Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp51304ybi; Wed, 29 May 2019 16:29:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8C554RVo5FS3/M8z8S/cBmReLDbpEMf2ymDA+xcGpi3LbBHGNtXvqxb9lj4QHDir1/tjd X-Received: by 2002:a17:902:42e2:: with SMTP id h89mr596293pld.271.1559172568056; Wed, 29 May 2019 16:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559172568; cv=none; d=google.com; s=arc-20160816; b=dNh8yKdYSbf6GaZ/Xpgvz8SIzkx9U72KhUyESESdN1Mvrm1InjYRg/2ZkBDE6c71mE aVXKf1yd2L7YVtho5WSIivXqfRJB1E2cZhHZKA4SqDNUT2MIesE7toTgUTNE4oDJNzJ+ 8CywFmtMhCnAz95bStcMCuuFaLGC7P6k++3V79dpfhDhAOgotC04R6bO3WrdqZOYhq1h YugnGJLOLCEP9wSImLd9qA/OgVfxJVWqDti03qr6x21g5w8nVfFhzzHyKuWve1VJS+CR gFAlUu69AHsVWsW05F1wK4vUdXuHXbUju2Vz1kpes3fzYDeDHKkaW04DnB4oZ0w/zbR0 NAjg== 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:from :to:cc:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=m0jUnzdFiXDe1r8B76CfLXTJYdI3LGzdnjurgeo6hy8=; b=rexVA+CqMJGAavbzsI5Vdy1UtZcs72PBWfVJrmlftPfIa7EBUXZ7iWQT5Of68+JzxB 2utfQRh2EfWrSLj7mtvz9tSNWdYa94nOCbBWbVL1M1PcMvitfCKgthQwb/pAwkzBrpUb FDWGESZ1oxTa8FuJ25DlogWvveE7S/FSYL80V09HB80qR17FZAypM4jUL3Tl78ec9RXP +8Whu026gvPLnM0aKnVwU8BjsRRGKpUSUDv1PaCMxiPW0F1Gy/shHlHdMyRNRKvgLT2i fw3gzdLaOXwtH0tdkJfSHaSdkoJufrV3EUMjNx9C1bTCJIx7CUwwPrCQrSoTcmAQMK7h 4LpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bLZP9ZV/"; 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 d10si1327772pla.406.2019.05.29.16.29.12; Wed, 29 May 2019 16:29:28 -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=@kernel.org header.s=default header.b="bLZP9ZV/"; 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 S1726628AbfE2X2M (ORCPT + 99 others); Wed, 29 May 2019 19:28:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:46736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbfE2X2L (ORCPT ); Wed, 29 May 2019 19:28:11 -0400 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 14A5224366; Wed, 29 May 2019 23:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559172490; bh=8kdlDPHPJB9SK5OUX6kVhT6RIbf9CHlBwHsoSX6UV6o=; h=In-Reply-To:References:Cc:To:From:Subject:Date:From; b=bLZP9ZV/pnaLDEkb6Fbtff0PTHDRn9b6Voj3YcGTY/tQ1tNF2rGSeBQaB0XHoihS2 TMcVcgkYcQf5St5x/266iplFn0U8BGyKco7QXrQCq3EcSeFylbzskaTS6YDmEbn/Ee T2XcGWR3cupx2hA2oTOV9Orc6ECjgp2zfX++VPkc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1559084936-4610-4-git-send-email-skomatineni@nvidia.com> References: <1559084936-4610-1-git-send-email-skomatineni@nvidia.com> <1559084936-4610-4-git-send-email-skomatineni@nvidia.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, devicetree@vger.kernel.org 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 From: Stephen Boyd Subject: Re: [PATCH V2 03/12] clk: tegra: save and restore PLLs state for system User-Agent: alot/0.8.1 Date: Wed, 29 May 2019 16:28:09 -0700 Message-Id: <20190529232810.14A5224366@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-05-28 16:08:47) > This patch has implementation of saving and restoring PLL's state to > support system suspend and resume operations. Can you provide some more background on _why_ this patch should exist? That's typically what gets written in the commit text. >=20 > Signed-off-by: Sowjanya Komatineni > --- > drivers/clk/tegra/clk-divider.c | 19 ++++++++ > drivers/clk/tegra/clk-pll-out.c | 25 +++++++++++ > drivers/clk/tegra/clk-pll.c | 99 ++++++++++++++++++++++++++++++++---= ------ > drivers/clk/tegra/clk.h | 9 ++++ > 4 files changed, 132 insertions(+), 20 deletions(-) >=20 > diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divi= der.c > index 2a1822a22740..718694727042 100644 > --- a/drivers/clk/tegra/clk-divider.c > +++ b/drivers/clk/tegra/clk-divider.c > @@ -14,6 +14,7 @@ > * along with this program. If not, see . > */ > =20 > +#include > #include > #include > #include > @@ -179,3 +180,21 @@ struct clk *tegra_clk_register_mc(const char *name, = const char *parent_name, > reg, 16, 1, CLK_DIVIDER_READ_ON= LY, > mc_div_table, lock); > } > + > +#if defined(CONFIG_PM_SLEEP) > +void tegra_clk_divider_resume(struct clk_hw *hw, unsigned long rate) > +{ > + struct clk_hw *parent =3D clk_hw_get_parent(hw); > + unsigned long parent_rate; > + > + if (IS_ERR(parent)) { Will this ever happen? Collapse the WARN_ON into the if please: if (WARN_ON(IS_ERR(parent))) > + WARN_ON(1); > + return; > + } > + > + parent_rate =3D clk_hw_get_rate(parent); > + > + if (clk_frac_div_set_rate(hw, rate, parent_rate) < 0) > + WARN_ON(1); > +} > +#endif > diff --git a/drivers/clk/tegra/clk.h b/drivers/clk/tegra/clk.h > index 09bccbb9640c..e4d124cc5657 100644 > --- a/drivers/clk/tegra/clk.h > +++ b/drivers/clk/tegra/clk.h > @@ -841,6 +841,15 @@ int tegra_pll_p_div_to_hw(struct tegra_clk_pll *pll,= u8 p_div); > int div_frac_get(unsigned long rate, unsigned parent_rate, u8 width, > u8 frac_width, u8 flags); > =20 > +#ifdef CONFIG_PM_SLEEP Can you remove this ifdef? It just complicates compilation testing. > +void tegra_clk_pll_resume(struct clk *c, unsigned long rate); > +void tegra_clk_divider_resume(struct clk_hw *hw, unsigned long rate); > +void tegra_clk_pll_out_resume(struct clk *clk, unsigned long rate); > +void tegra_clk_plle_tegra210_resume(struct clk *c); > +void tegra_clk_sync_state_pll(struct clk *c); > +void tegra_clk_sync_state_pll_out(struct clk *clk); Do these APIs need to operate on struct clk? Why can't they operate on clk_hw or why can't we drive the suspend/resume sequence from the clk provider driver itself?