[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yr5xS/HCrBuNrn9N@builder.lan>
Date: Thu, 30 Jun 2022 23:00:11 -0500
From: Bjorn Andersson <bjorn.andersson@...aro.org>
To: Stephen Boyd <swboyd@...omium.org>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, patches@...ts.linux.dev,
linux-arm-msm@...r.kernel.org, Taniya Das <quic_tdas@...cinc.com>,
Mike Tipton <quic_mdtipton@...cinc.com>
Subject: Re: [PATCH/RFC] clk: qcom: rpmh: Block system suspend if XO is
enabled
On Tue 28 Jun 15:13 CDT 2022, Stephen Boyd wrote:
> Tracking down what RPMh resource is blocking XO shutdown in suspend is
> hard. Largely because we need external debug tools to dump the RPMh
> internal state to figure out what resource is enabled. Instead of doing
> that, let's just block system wide suspend in the kernel if the RPMh XO
> resource is enabled by something in the kernel. This will help us narrow
> down XO shutdown failures to the XO clk, and not something else like an
> interconnect or regulator RPMh resource.
>
> I'm sending this as an RFC because it breaks suspend for me on Trogdor
> boards. I found out that the XO resource is always enabled on these
> devices because the audio driver leaves an audio clk always on. This
> means that the XO resource must not be used to determine if XO shutdown
> is achievable, or we're leaving power savings on the table.
>
> Cc: Taniya Das <quic_tdas@...cinc.com>
> Cc: Mike Tipton <quic_mdtipton@...cinc.com>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@...aro.org>
> ---
>
> Please don't apply. It will break suspend on Trogdor boards.
>
This seems like a useful debug feature for people outside of Qualcomm,
so I assume you're saying that we shouldn't merge it until someone has
fixed the audio driver? Or did you post it just as a debug tool?
Regards,
Bjorn
> drivers/clk/qcom/clk-rpmh.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/clk/qcom/clk-rpmh.c b/drivers/clk/qcom/clk-rpmh.c
> index aed907982344..ba0e0e4b9cf2 100644
> --- a/drivers/clk/qcom/clk-rpmh.c
> +++ b/drivers/clk/qcom/clk-rpmh.c
> @@ -70,6 +70,14 @@ struct clk_rpmh_desc {
>
> static DEFINE_MUTEX(rpmh_clk_lock);
>
> +/* XO shutdown will fail if XO is enabled across suspend */
> +static int clk_rpmh_suspend(struct device *dev)
> +{
> + struct clk_rpmh *xo = dev_get_drvdata(dev);
> +
> + return xo && xo->state ? -EBUSY : 0;
> +}
> +
> #define __DEFINE_CLK_RPMH(_platform, _name, _name_active, _res_name, \
> _res_en_offset, _res_on, _div) \
> static struct clk_rpmh _platform##_##_name_active; \
> @@ -690,6 +698,10 @@ static int clk_rpmh_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "failed to register %s\n", name);
> return ret;
> }
> +
> + /* Stash CXO clk for XO shutdown tracking */
> + if (i == RPMH_CXO_CLK)
> + platform_set_drvdata(pdev, rpmh_clk);
> }
>
> /* typecast to silence compiler warning */
> @@ -722,9 +734,12 @@ static const struct of_device_id clk_rpmh_match_table[] = {
> };
> MODULE_DEVICE_TABLE(of, clk_rpmh_match_table);
>
> +static SIMPLE_DEV_PM_OPS(clk_rpmh_pm_ops, clk_rpmh_suspend, NULL);
> +
> static struct platform_driver clk_rpmh_driver = {
> .probe = clk_rpmh_probe,
> .driver = {
> + .pm = pm_ptr(&clk_rpmh_pm_ops),
> .name = "clk-rpmh",
> .of_match_table = clk_rpmh_match_table,
> },
>
> base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
> --
> https://chromeos.dev
>
Powered by blists - more mailing lists