Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5266505ybi; Tue, 30 Jul 2019 17:25:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYni2UnOkQzJoXbE5atLAw9MoWd5DQXzCkV3SK/8j0NHzM9/cUe2F/ZkuaQR36aC/zKE6T X-Received: by 2002:a65:684c:: with SMTP id q12mr66935757pgt.405.1564532739084; Tue, 30 Jul 2019 17:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564532739; cv=none; d=google.com; s=arc-20160816; b=d3oppZR5Ld4gbkQGNuh/PSqbISKbpzrqAIgUUMraVwDYevuaXvyQlyMx6ZYJuObAmg fOT256b4Ppj8NT+hsY/S7B44BU4iUgLWhsaRurZiNfB8nY6X98Xihz95Vm89si/xVaU9 JZ3+8Bi7KEdjKuRjX2kUWdCwtm+csrVuUdGDDq+5BetxQAnw2p+ttZEHfCucFkh6e5lG WdWRfDHXTIoAxg4LXF5dz8do1a4XhNYaIFNY4gKs38PWydfOu/H5GNj+GKMjrFriz4Gd MtoLFjqKqzQL/afGXi8wP9ZdA3xs7d2uwxq5COgXC5hpULcQymH7fHW314ubMBFviEmp mN9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=C/Vv+R//hhu8plFOiaQm9odxXoC5mT2dS2+ZICVm6us=; b=nnwR1r/KU6E7ewRTBm3MlYBKLU9yS/2ojBSywJEYoYHPZ+qkjV6xW8JFILeH6B6rif NA/+76EcZIAtf011qRxAAmZTAxQBQr1zk9C5o40LrSgIbVOsF+x3mykzJmGP0K9TSJdO Yh74pmtnaTD0bxXVmueaKZfVp37rV15HyZ8Qkydz0ciNhCraIinVen9DyUwyDGjQ34yc hLBSr2u+672/ic0YmYgiv4FTC5xUNZb1jv6ymFaodVWOP69ZcAXYNYex/MNddlaSo/fz iO4YPHR4MwOQDFlMVM1KKXURbnE4d5nKwy0vtanJIEcOCu9R2TalSqZE/am4WpD5sFJh jYFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZucR7kDI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b73si32856pjc.53.2019.07.30.17.25.24; Tue, 30 Jul 2019 17:25:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZucR7kDI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728993AbfGaAWE (ORCPT + 99 others); Tue, 30 Jul 2019 20:22:04 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:7237 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728532AbfGaAUa (ORCPT ); Tue, 30 Jul 2019 20:20:30 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 30 Jul 2019 17:20:37 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 30 Jul 2019 17:20:28 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 30 Jul 2019 17:20:28 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL108.nvidia.com (172.18.146.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 31 Jul 2019 00:20:28 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 31 Jul 2019 00:20:28 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 31 Jul 2019 00:20:28 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.107]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 30 Jul 2019 17:20:27 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , Subject: [PATCH v7 03/20] clk: tegra: divider: Save and restore divider rate Date: Tue, 30 Jul 2019 17:20:07 -0700 Message-ID: <1564532424-10449-4-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564532424-10449-1-git-send-email-skomatineni@nvidia.com> References: <1564532424-10449-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1564532437; bh=C/Vv+R//hhu8plFOiaQm9odxXoC5mT2dS2+ZICVm6us=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=ZucR7kDIE9gPIrkmSH7FJIz9H+YUtRSSdAByo9sw2qZVoN3ZKRLzV0rodJXIs+CZe IJiqoHV0FK0eAySU1ihIsdBkwPGj7IYJktPW/Kloz8Z+Ohez7Aw9Ks7Q9eJ7Zt19e9 7M11f8yKhtec+b4DYQjAvQcjurzgiez8YNdAk/gatHRaRP5e9m9HZn8ehjyw1A9TFI OisAyDnx2gD17ZarbjJlREfc8EwdILhJhvYw1Fi3PVt5arHNFs+yJCz2ISy3twj47U /e2lKtRq3Wc8KdXwj/YRr03OlWKZGPEC14oxKea6VrjS5k3sLfaWQlqFrCYDebgjGl 5j2sMDBrU5cow== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements context restore for clock divider. During system suspend, core power goes off and looses the settings of the Tegra CAR controller registers. So on resume, clock dividers are restored back for normal operation. Signed-off-by: Sowjanya Komatineni --- drivers/clk/tegra/clk-divider.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c index e76731fb7d69..ca0de5f11f84 100644 --- a/drivers/clk/tegra/clk-divider.c +++ b/drivers/clk/tegra/clk-divider.c @@ -109,10 +109,21 @@ static int clk_frac_div_set_rate(struct clk_hw *hw, unsigned long rate, return 0; } +static void clk_divider_restore_context(struct clk_hw *hw) +{ + struct clk_hw *parent = clk_hw_get_parent(hw); + unsigned long parent_rate = clk_hw_get_rate(parent); + unsigned long rate = clk_hw_get_rate(hw); + + if (clk_frac_div_set_rate(hw, rate, parent_rate) < 0) + WARN_ON(1); +} + const struct clk_ops tegra_clk_frac_div_ops = { .recalc_rate = clk_frac_div_recalc_rate, .set_rate = clk_frac_div_set_rate, .round_rate = clk_frac_div_round_rate, + .restore_context = clk_divider_restore_context, }; struct clk *tegra_clk_register_divider(const char *name, -- 2.7.4