Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1318186ybl; Fri, 16 Aug 2019 12:45:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMA9y4Tsi8zhHOW1kQonwMzxJohVZGgH1Vs4GyOqQbHHw+Zfb8GW4pcJQ3EN3TzKnlriZX X-Received: by 2002:a65:5786:: with SMTP id b6mr9086653pgr.236.1565984716368; Fri, 16 Aug 2019 12:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565984716; cv=none; d=google.com; s=arc-20160816; b=XXMC4/1BCcqHFpCjpqY1BoWm/3PZq998pLchU4XH+3fdKEvj7I4bvdq23ku43XGdf5 BSbpGeujdHX7t/+B8w4PysPs40cRZbaQbe2komalQjNQqxPbd+Clp2D33odeH6w+iCtn puTqDCRGUHmhWNt8fiyN0Y1OZseKip2X7vnDcfVIKxJBDVoYsdh8BmsolT+IYTb4KVjy 0uNI0azxiKGRxiV1Z5uCjm0nz7WTFUc6RNOoDvyDx0pGZPTzrmKrPkBPLlTlkUrmkLMj RAbGOo2JHEWcW9CvzHwez3v85Ws7myOlqd6Kulu4+Zq7lwX8nYj/Qkkn3R6xEi8Ltjpv vFAw== 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=G6UL0RiW0iYwiCgdSo9xSeLjLu0/Ysld5e3CD18vTzQ=; b=o+SALEspo/shjB+bZbSkRRy9y8Pu6gpDahnEnzKkJ4dBy8a2dhLbUL2B4y+Pl4+ync FtKr+Qq3351Bi+3bU7tTpEZ/H0y6Mn03N2bJzDqz2l275hP+iZM/gFc7GsyHAz9BHAsX AO5fgL4ehRrTVxwwo+WYX2LfPM+mU2YjXUYD84vk5ERmyx7H8Ww8KTwsHrHKIkIJRqT2 WICAVnc/O1u4TWTXWnjN4ooipSLSKKxeuAU/6xk+29LipUJyS5JAmhEWRUJ7VWOZoPN1 gZdSVMDrcrKWhDNOIznywVRUdenHx3QIGFbcMlno7OF534RL/uxLDDm09/4D4kX+uGlL pQ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=nO4imJUI; 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 u2si4370832pgr.284.2019.08.16.12.45.01; Fri, 16 Aug 2019 12:45:16 -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=nO4imJUI; 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 S1727668AbfHPTmZ (ORCPT + 99 others); Fri, 16 Aug 2019 15:42:25 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:13210 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727651AbfHPTmX (ORCPT ); Fri, 16 Aug 2019 15:42:23 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 16 Aug 2019 12:42:25 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 16 Aug 2019 12:42:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 16 Aug 2019 12:42:22 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 16 Aug 2019 19:42:21 +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; Fri, 16 Aug 2019 19:42:21 +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:21 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 04/22] clk: tegra: pllout: Save and restore pllout context Date: Fri, 16 Aug 2019 12:41:49 -0700 Message-ID: <1565984527-5272-5-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=1565984546; bh=G6UL0RiW0iYwiCgdSo9xSeLjLu0/Ysld5e3CD18vTzQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=nO4imJUI3OYBjz61XlaY/TaQIiBRB2UyYjzRRVut2edcV1rJdvjOPVpXQuyUv3Ri/ PmmP++JQrB1H+o7rcNsjHyw8srm6JDbNDj+3KQzu54bJ8zM8XNE3ESLvHXdW04dvNO M3S2ho0tTXnUZPZiL89O+o/kVDkKaUKnBxzNA+d6VQOh/qaMXQqm/9iVfIs9UyxHOg MAKlRg/ilT5lY55kNfGcM0ogIV+2mq5gPXlqOvDn+GE0Uq4hL0mwpruBvNqH/4+zW4 ECRniX/4fXs9BIKh2rNEhhEN2wtXw34272zjyddq0CPbJGnha9zZ1EoSltvt5hVgPM URlZNmlPtnyEg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements save and restore of pllout context. During system suspend, core power goes off and looses the settings of the Tegra CAR controller registers. So during suspend entry the state of pllout is saved and on resume it is restored back to have pllout in same state as before suspend. pllout rate is saved and restore in clock divider so it will be at same rate as before suspend when pllout state is restored. Acked-by: Thierry Reding Signed-off-by: Sowjanya Komatineni --- drivers/clk/tegra/clk-pll-out.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clk/tegra/clk-pll-out.c b/drivers/clk/tegra/clk-pll-out.c index 35f2bf00e1e6..d8bf89a81e6d 100644 --- a/drivers/clk/tegra/clk-pll-out.c +++ b/drivers/clk/tegra/clk-pll-out.c @@ -69,10 +69,19 @@ static void clk_pll_out_disable(struct clk_hw *hw) spin_unlock_irqrestore(pll_out->lock, flags); } +static void tegra_clk_pll_out_restore_context(struct clk_hw *hw) +{ + if (!__clk_get_enable_count(hw->clk)) + clk_pll_out_disable(hw); + else + clk_pll_out_enable(hw); +} + const struct clk_ops tegra_clk_pll_out_ops = { .is_enabled = clk_pll_out_is_enabled, .enable = clk_pll_out_enable, .disable = clk_pll_out_disable, + .restore_context = tegra_clk_pll_out_restore_context, }; struct clk *tegra_clk_register_pll_out(const char *name, -- 2.7.4