Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6425112ybi; Wed, 31 Jul 2019 14:14:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsL4DhKE782WnUCGRrMF7lMLS8pCZ7eCRBJMfC0JnfcVAni+ELx/b+aFqp7wAxle0f25zN X-Received: by 2002:a62:107:: with SMTP id 7mr49874817pfb.4.1564607649480; Wed, 31 Jul 2019 14:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564607649; cv=none; d=google.com; s=arc-20160816; b=EhVRyqhuaKfk2cebOXcjiq81f/h8qGo9qagdEIoGRluc25XByGWBSQ3E+bK2e7iFji KOEzLIuRb0WX3HN2cQ/ZLxiUoEz/IGZkbQ3u1NUPuQ08HrReEVuwKOdBUj3OFtJBA9Vz rwt+l8kw8zo2+eCbi49QnJaiztvNah36tq6guPMNQ8237ASfblHFddtOjC2OUr0k8t6Y idJZ/kI/GHzfvTfXrASoCaeLDSbaEc7F7GY9r0bzrVn9MbRw1GnHKLX8xW//AzpURJgD 75zbn4oWLLYpV+KfsBi+tkKccGuAk3DEB4vkj+FQrOKHXdwkU/DHUBBJTyRD2/9X6UFu ijsA== 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=MLfoNbSZfaQlhm/BxLg4Zgu0k7frWwo5D/8hmpUyTyPIbaCaLRvoNZxRzVMXg9X2tU CIkW3wO7xliC+7RxLc0yCyOkzrUHd3jQGm5vmtaWFB9CtBB4w8TYHHvN0DviW7x2lytM gEdVefygoMNpNCNG+/8xw0ViiCRUppDOlr6y09WycdFswyvkt7nEQR2TfJrGGsu8JTkm XWB54dztDrP7W2Oml8EyOyVZLkv+ISK/oJ5I2wilgwYl8hm/4jy1tbwHjEAlK3vBwpzW S2YapWmU9CvvtmKy3LjCaccuaL5Ia256/wUpClV337Gf0UXhKUs7Nmvnz5t8kdEfeM5l +vsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=pwxbq+T8; 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 m45si2295507pje.39.2019.07.31.14.13.54; Wed, 31 Jul 2019 14:14:09 -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=pwxbq+T8; 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 S1731088AbfGaVMs (ORCPT + 99 others); Wed, 31 Jul 2019 17:12:48 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:10568 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727448AbfGaVLI (ORCPT ); Wed, 31 Jul 2019 17:11:08 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 31 Jul 2019 14:11:07 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 31 Jul 2019 14:11:07 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 31 Jul 2019 14:11:07 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 31 Jul 2019 21:11:07 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 31 Jul 2019 21:11:06 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 31 Jul 2019 21:11:06 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.102.167]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Wed, 31 Jul 2019 14:11:06 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v7 03/20] clk: tegra: divider: Save and restore divider rate Date: Wed, 31 Jul 2019 14:10:46 -0700 Message-ID: <1564607463-28802-4-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564607463-28802-1-git-send-email-skomatineni@nvidia.com> References: <1564607463-28802-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=1564607467; 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=pwxbq+T8NVZNQ2v5m2H9tUhZ8r6z6KJZZJw+ahcRMYPgrEHij/p8tiY3QtNT9aOKD rJb7h6UXsG8yirbuB4Km/yJN357YigQ6qpfqpp1EQ7YVbbrNkOH2P/Dxfs6Y5Siv8R PqrVQvzO/n3Mhyi8q0ipfWldOz12vdwx3SSWDEtcJofhKTRlm576vul6oo1/ZjJ0ha uBFPAOy2kM8i8lXr8XRZMqOFXhhe++Kq9PcqP7oMVBK9k7ww+vFntXF0zNDBIANdvm FhjGdchDSizs51ZJro6WM4UPSVzZpQUK9DfA58tkpPJczTPj/7V7KrxKpvS+KaUWbm lUTBoG48+X9og== 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