Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1316751ybl; Fri, 16 Aug 2019 12:43:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRgJkem/wuyRA15/Fy7fMxALYE9FRhVjSQNnfX1QIPTdA3YNfDbpbOrW1Po1cw84XLSi64 X-Received: by 2002:a62:2603:: with SMTP id m3mr12772869pfm.163.1565984607005; Fri, 16 Aug 2019 12:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565984606; cv=none; d=google.com; s=arc-20160816; b=kJvWG/GQYLoB+YNp16No7/0AppSFbEJb6+Ox7p6NIH5d9CQlnK+6eCHT1cf5XK0yDp TRZjXK1bZMSc9bBO4Qas2ld5WZtROKW+LN/xn9o/fCYcwzxxyY1a6SsEfI4EvGVokmPQ nQnHP8642YrzdG+z2Zs87agqFJbY/82/c8pfMWofq/06szIhvSsApy1cH3IQmxQhee2N OgOtcOrcwufnklbxFsJZ0wciwXQc5t91imvb1HkD6nSubcxa5wpZu21d3qqLfxIm2ZIV qBFpNtnoXCs6r/127MsQA/VOKYbM+qtvKkg7nKSXqz3ywo6mRUQOaPmmaoSVuCKlDSv2 29Yw== 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=MtqUu0N+Lpcr8Jj2xIV5/hjuwWqS7+q8M0ew1JLKB4s=; b=w2lTXd3Ewmkh6ZoQqDPvmZ0YMjb8Oc+WwXhT2hRF66DV9qb5bfiFpPDcLBiYJTYt9s 5DTBHqXqG7MINoJohiTQ4B1QUWkY/AvDFDvixotLj/Foo5+LFaHgv/eOI6wAllij4dgY q3LhDjwoMkKLLm/G3qnh7LSyBQaJ+jwBnBsYPifu95Yo4ZKdrTd00lLhG1JRXKUSmnnC u8/XPutLkCkA8y7cXL+h8KAHNyO/E5p+N5wId6/MaS3KM63TH6SZSMrIk6tizzBUJGfA 9cltuHup9m4800vQKnTEKuwVFL/i6jgzYqAGlHrh/CZOtu/s6TwlwjM15/Es+VVTJfxY rxqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=r8DB3jlB; 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 o31si4395297pgb.579.2019.08.16.12.43.11; Fri, 16 Aug 2019 12:43:26 -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=r8DB3jlB; 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 S1727689AbfHPTm2 (ORCPT + 99 others); Fri, 16 Aug 2019 15:42:28 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:14953 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727671AbfHPTm0 (ORCPT ); Fri, 16 Aug 2019 15:42:26 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 16 Aug 2019 12:42:31 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 16 Aug 2019 12:42:20 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 16 Aug 2019 12:42:20 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:42:19 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 16 Aug 2019 19:42:19 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.166.126]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 16 Aug 2019 12:42:19 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 03/22] clk: tegra: divider: Save and restore divider rate Date: Fri, 16 Aug 2019 12:41:48 -0700 Message-ID: <1565984527-5272-4-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565984527-5272-1-git-send-email-skomatineni@nvidia.com> References: <1565984527-5272-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=1565984551; bh=MtqUu0N+Lpcr8Jj2xIV5/hjuwWqS7+q8M0ew1JLKB4s=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=r8DB3jlBjs40CV7Z9w/NCWZyqjS4DGYdDdqjH7HbwIj2hGnRHcK3XTO7BQgRYirIq CFXZq4+yZkuOH6LzOB4f8BZdKcm4782JKbA/nyxVMxHUtuMn88yP/7ywif9kqJiWcw HJ+cW2JwSVfQwrnFq3Yd5LdOgM5ncHn5ZbCSgcQSWthzELWdFqn7itakPeTvyhO11w BuZsRD/3B700VlUlIxZyKurPD0ap6TMOqXOzYF5on38sU7XiWEmhv9y2KA4OQwA64t UZhRFVMdJWValy3C62KOFAVhtmURFb+dDvDloR6UXJ/V/4EnHbgYb78l0jyva5XugW g7xSGTgEKYEoQ== 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. Acked-by: Thierry Reding Reviewed-by: Dmitry Osipenko 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