Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp3055275ybx; Fri, 8 Nov 2019 13:21:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxJUdI5CatL/8VkJuPAMsHL5kYLRdfEyI9QhmnAINzBdzEJTBQxcHAer8SbrVNcuRKgJ1TU X-Received: by 2002:a05:6402:1a50:: with SMTP id bf16mr12735140edb.116.1573248068213; Fri, 08 Nov 2019 13:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573248068; cv=none; d=google.com; s=arc-20160816; b=ToeWnbxjfK4chq5eZ69YNx9jTI4C24JjtS3eQ4O4rwMoVc4EoGHZKa3Y4HsoUas3MU eClUSu/d2y9AE6MOEKnkLndFTSY+tchQCZqAn4TtXDkFy+K7eHJUu2kMbDGHPzrqCuDg axGckwK345c6NE9zqguFeQJNKu3zZKFvwMrJPqkexA6jn9QaHh5q/1H13shf51a75eqa aB7gf2QnuTykhZOgYLMRrUjoWnEXzFAEDcHV85KIJ5H9XlEVN9D2cCAGd2eDpBAGYRgS OAQIeaVFZx0rHDZcklHgrpCA02Rys9QFaGRw2w/klCNrPjeaLf2fw8mi6VRxLmXVMQHZ limA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:subject:cc:to :from:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=6xC4a3IRDCkOECEMzO4HtdiitSTnwWdXfco8Y5Moeho=; b=hxxjcv96rLRxG9GoYuqP3nUMuBIEJRaosPnsRkIUkmejJBwZBrObr8BhA32hANluEW amyZL3XFC7p3RzqeLOHDO7iZiXytzflInhPlTvhqr330ficNCkc1C7T8QjxhEnf60rW/ mCT3X2dtaz9EuLwa1rrIr/9EwCoxdpG084bjC39AfcvF8X5PbVFT2DsoDsuFKI0yiYRj Klu78AX8Z2n62rtKldTW2PMczWG12P0upyoM7EJ4AYhY/jnoSJJT20YIrTskRYgP3/iM NIbXjSCB6i165qSs7qISRmdUeEfKI/3kyWSns35w9ytvDFTsv1hUqCP1IyUpwKspeHWG O09g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Me4X4kOP; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si5736140edl.409.2019.11.08.13.20.45; Fri, 08 Nov 2019 13:21:08 -0800 (PST) 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=@kernel.org header.s=default header.b=Me4X4kOP; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731777AbfKHVUQ (ORCPT + 99 others); Fri, 8 Nov 2019 16:20:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:58872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbfKHVUP (ORCPT ); Fri, 8 Nov 2019 16:20:15 -0500 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07BC720869; Fri, 8 Nov 2019 21:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573248015; bh=W/41aRz8a8e9Jzva0r1YTdxOVETPDBmfjwIJpNNiqTo=; h=In-Reply-To:References:From:To:Cc:Subject:Date:From; b=Me4X4kOP6rnHyQzvR7U+RS3BdTpdzXkCGMlKfLEKkPOQQTryEtc5EnICH4UTyxRxe L8e3Hx/hWXqBzqJyYQIQV5lINo5swzsVWD3rGH7cP5RgO++f4s6unqKLhuHSGdzE/M iEsMjCqCROMDMaZLuXWIkRGnFffYUdUeITafEutM= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1565984527-5272-12-git-send-email-skomatineni@nvidia.com> References: <1565984527-5272-1-git-send-email-skomatineni@nvidia.com> <1565984527-5272-12-git-send-email-skomatineni@nvidia.com> From: Stephen Boyd To: Sowjanya Komatineni , jason@lakedaemon.net, jonathanh@nvidia.com, linus.walleij@linaro.org, marc.zyngier@arm.com, mark.rutland@arm.com, stefan@agner.ch, tglx@linutronix.de, thierry.reding@gmail.com Cc: pdeschrijver@nvidia.com, pgaikwad@nvidia.com, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, jckuo@nvidia.com, josephl@nvidia.com, talho@nvidia.com, skomatineni@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, mperttunen@nvidia.com, spatra@nvidia.com, robh+dt@kernel.org, digetx@gmail.com, devicetree@vger.kernel.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, linux-pm@vger.kernel.org Subject: Re: [PATCH v9 11/22] clk: tegra: clk-dfll: Add suspend and resume support User-Agent: alot/0.8.1 Date: Fri, 08 Nov 2019 13:20:14 -0800 Message-Id: <20191108212015.07BC720869@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Sowjanya Komatineni (2019-08-16 12:41:56) > diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c > index f8688c2ddf1a..c051d92c2bbf 100644 > --- a/drivers/clk/tegra/clk-dfll.c > +++ b/drivers/clk/tegra/clk-dfll.c > @@ -1487,6 +1487,7 @@ static int dfll_init(struct tegra_dfll *td) > td->last_unrounded_rate =3D 0; > =20 > pm_runtime_enable(td->dev); > + pm_runtime_irq_safe(td->dev); Why irq_safe? It would be good to mention it in the commit text or something. > pm_runtime_get_sync(td->dev); > =20 > dfll_set_mode(td, DFLL_DISABLED); > @@ -1513,6 +1514,61 @@ static int dfll_init(struct tegra_dfll *td) > return ret; > } > =20 > +/** > + * tegra_dfll_suspend - check DFLL is disabled > + * @dev: DFLL device * > + * > + * DFLL clock should be disabled by the CPUFreq driver. So, make > + * sure it is disabled and disable all clocks needed by the DFLL. > + */ > +int tegra_dfll_suspend(struct device *dev) > +{ > + struct tegra_dfll *td =3D dev_get_drvdata(dev); > + > + if (dfll_is_running(td)) { > + dev_err(td->dev, "DFLL still enabled while suspending\n"); > + return -EBUSY; > + } > + > + reset_control_assert(td->dvco_rst); > + > + return 0; > +} > +EXPORT_SYMBOL(tegra_dfll_suspend); > + > +/** > + * tegra_dfll_resume - reinitialize DFLL on resume > + * @dev: DFLL instance I prefer this description for tegra_dfll_suspend's 'dev' argument. > + * > + * DFLL is disabled and reset during suspend and resume. > + * So, reinitialize the DFLL IP block back for use. > + * DFLL clock is enabled later in closed loop mode by CPUFreq > + * driver before switching its clock source to DFLL output. > + */ > +int tegra_dfll_resume(struct device *dev) > +{ > + struct tegra_dfll *td =3D dev_get_drvdata(dev); > + > + reset_control_deassert(td->dvco_rst); > + > + pm_runtime_get_sync(td->dev); > + > + dfll_set_mode(td, DFLL_DISABLED); > + dfll_set_default_params(td);