Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1318099ybl; Fri, 16 Aug 2019 12:45:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxHs6OTzxWSeW0RXcSpmmbq6qUjYjc7hfcN9uYTg9HoU8LaIM1PTIHIpNZRQYws2VQYBF4 X-Received: by 2002:a63:b10f:: with SMTP id r15mr9044049pgf.230.1565984708560; Fri, 16 Aug 2019 12:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565984708; cv=none; d=google.com; s=arc-20160816; b=TbdddBXEBiMpCEulNsUtW33lhsJQQz0/IWbpEoJf6osZ5FK/zKzBfJCBzhZosMFRrM PlhgD2lF1E9EAy4s62g+80Ud78+bbGDKdWt2oHTWPgWHAw9aRot2Jb6V9tzZKPOkLCwC seg0RoVuHpkVtjfEk1cj2Xv7ACNTVMEJ21pMcZBzD5ECGfG8Q8UCIAvCsQJYBtB/Jp0f f57FBsI0t6m0fiVV5uMBRL3uAiilb2+n4oP4W55PNuHb5oDMggAkUs+KR8UmHtgO3PLM /TrJWcArkkgvVXv26P3WfSg5w5wVdACyqIAPFkex/FC++Se1eZHmPBg0y6npCKH4DR+Y 6w/Q== 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=peNaX+OjsKzvMnF5xQX40g75Dzd96yXRP1cP47w7Vug=; b=kbI0A28D6xsZq/crpG55GImWEBZ4O/cAw4573/IBjT1dwj+b/KPBYr2OMhqxoDNELo 6VmEDseMA0P8703pZsUfkNzbsTfAPVDXvUynzmJcwmlFBJ39yz5RTOnwUENFp3ng+N2O VSFQSxA5dfnjkG8NPcKQSeS1Bk1hvHvyl2TqEnkgkLbPAgscpHIslrAUrwOOmgvIwL8o OUdQNAdkorcdBvjDN5utZpFiXIWwwPFhAk0Eh38bspWyG3KeiWrjIdhuF9JX3vpzE2Hm V1QlLftOyVBfJm9ECSvE5ym5FbPC5IHoCF5Obzfpb1BaUa/f1zBbZIUTWcBOF9JEZAh/ EUBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=B6KJUfZc; 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 q11si3635599pjv.95.2019.08.16.12.44.52; Fri, 16 Aug 2019 12:45:08 -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=B6KJUfZc; 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 S1727753AbfHPTmk (ORCPT + 99 others); Fri, 16 Aug 2019 15:42:40 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:13133 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727671AbfHPTmi (ORCPT ); Fri, 16 Aug 2019 15:42:38 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 16 Aug 2019 12:42:40 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 16 Aug 2019 12:42:38 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 16 Aug 2019 12:42:38 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:42:37 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:42:37 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 16 Aug 2019 19:42:37 +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:37 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 10/22] clk: tegra: clk-super: Add restore-context support Date: Fri, 16 Aug 2019 12:41:55 -0700 Message-ID: <1565984527-5272-11-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=1565984560; bh=peNaX+OjsKzvMnF5xQX40g75Dzd96yXRP1cP47w7Vug=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=B6KJUfZc305XAYCa0nyLta3ptXRda7xoNqLsA8+HbjEJenqbgjcXljiR7NtRnRbMz xS5GZurWxClZUumuCTcNn8azFWgSERJGka9uxfosZW/Vh8DmVhE9xTSskHjLe/9iP9 //agjuPf8omen2+AZz/96K1hh6+oF7wQf2nibH/Ubn6dtebFOBUXP9ta/t2lroX+/U wWEz8XrcNqepksTk1sG8gXtkGM21JHCMCltWVpLFjQRfIdBv1R1AALLm032kn+90i9 3PM7d4pViuOrDESUV9odhUIDHsYAJGcRD+ZdP94No7d6c3grSf0s/oI9ojQEOXXcTE hngf4dcI4TM9g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements restore_context for clk_super_mux and clk_super. During system supend, core power goes off the and context of Tegra CAR registers is lost. So on system resume, context of super clock registers are restored to have them in same state as before suspend. Acked-by: Thierry Reding Signed-off-by: Sowjanya Komatineni --- drivers/clk/tegra/clk-super.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/clk/tegra/clk-super.c b/drivers/clk/tegra/clk-super.c index e2a1e95a8db7..74c9e913e41c 100644 --- a/drivers/clk/tegra/clk-super.c +++ b/drivers/clk/tegra/clk-super.c @@ -124,9 +124,18 @@ static int clk_super_set_parent(struct clk_hw *hw, u8 index) return err; } +static void clk_super_mux_restore_context(struct clk_hw *hw) +{ + struct clk_hw *parent = clk_hw_get_parent(hw); + int parent_id = clk_hw_get_parent_index(hw, parent); + + clk_super_set_parent(hw, parent_id); +} + static const struct clk_ops tegra_clk_super_mux_ops = { .get_parent = clk_super_get_parent, .set_parent = clk_super_set_parent, + .restore_context = clk_super_mux_restore_context, }; static long clk_super_round_rate(struct clk_hw *hw, unsigned long rate, @@ -162,12 +171,24 @@ static int clk_super_set_rate(struct clk_hw *hw, unsigned long rate, return super->div_ops->set_rate(div_hw, rate, parent_rate); } +static void clk_super_restore_context(struct clk_hw *hw) +{ + struct tegra_clk_super_mux *super = to_clk_super_mux(hw); + struct clk_hw *div_hw = &super->frac_div.hw; + struct clk_hw *parent = clk_hw_get_parent(hw); + int parent_id = clk_hw_get_parent_index(hw, parent); + + super->div_ops->restore_context(div_hw); + clk_super_set_parent(hw, parent_id); +} + const struct clk_ops tegra_clk_super_ops = { .get_parent = clk_super_get_parent, .set_parent = clk_super_set_parent, .set_rate = clk_super_set_rate, .round_rate = clk_super_round_rate, .recalc_rate = clk_super_recalc_rate, + .restore_context = clk_super_restore_context, }; struct clk *tegra_clk_register_super_mux(const char *name, -- 2.7.4