[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aIv46mUHu9u6uIzq@lizhi-Precision-Tower-5810>
Date: Thu, 31 Jul 2025 19:14:50 -0400
From: Frank Li <Frank.li@....com>
To: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
Cc: Abel Vesa <abelvesa@...nel.org>, Peng Fan <peng.fan@....com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, linux-clk@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] clk: imx95-blk-ctl: Save/restore registers when RPM
routines are called
On Thu, Jul 31, 2025 at 10:31:25AM +0300, Laurentiu Palcu wrote:
> Hi Frank,
>
> On Wed, Jul 30, 2025 at 12:23:46PM -0400, Frank Li wrote:
> > On Wed, Jul 30, 2025 at 03:59:31PM +0300, Laurentiu Palcu wrote:
> > > If runtime PM is used for the clock providers and they're part of a
> > > power domain, then the power domain supply will be cut off when runtime
> > > suspended. That means all BLK CTL registers belonging to that power
> > > domain will be reset. Save the registers, then, before entering suspend
> > > and restore them in resume.
> >
> > Save the registers before entering suspend, then restore them in resume.
> >
> > >
> > > Also, fix the suspend/resume routines and make sure we disable/enable
> > > the clock correctly.
> >
> > Check runtime pm status in suspend/resume routines to make sure
> > disable/enable clock correctly.
>
> I think the current commit message is clear enough already and follows
> the guidelines. Obviously, someone else could rephrase it differently
> but I'm pretty happy with it in its current state. TBH, your suggested
> changes neither add new information nor correct any grammar or spelling
> mistakes, so I don't see a strong point in changing the commit message.
"fix the suspend/resume routines" have not carry much informaiton. Need
deescript as "do (what) in (where) to fix (what's problem).
Without check patch, No one understand what's means of
"fix the suspend/resume routines and make sure we disable/enable
the clock correctly."
Frank
>
> Thanks,
> Laurentiu
>
> >
> > >
> > > Signed-off-by: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
> > > ---
> > > drivers/clk/imx/clk-imx95-blk-ctl.c | 33 ++++++++++++++++++-----------
> > > 1 file changed, 21 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c
> > > index c72debaf3a60b..56bed44719954 100644
> > > --- a/drivers/clk/imx/clk-imx95-blk-ctl.c
> > > +++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
> > > @@ -453,15 +453,24 @@ static int imx95_bc_runtime_suspend(struct device *dev)
> > > {
> > > struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
> > >
> > > + bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
> > > clk_disable_unprepare(bc->clk_apb);
> > > +
> > > return 0;
> > > }
> > >
> > > static int imx95_bc_runtime_resume(struct device *dev)
> > > {
> > > struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
> > > + int ret;
> > >
> > > - return clk_prepare_enable(bc->clk_apb);
> > > + ret = clk_prepare_enable(bc->clk_apb);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);
> > > +
> > > + return 0;
> > > }
> > > #endif
> > >
> > > @@ -469,17 +478,12 @@ static int imx95_bc_runtime_resume(struct device *dev)
> > > static int imx95_bc_suspend(struct device *dev)
> > > {
> > > struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
> > > - int ret;
> > >
> > > - if (bc->pdata->rpm_enabled) {
> > > - ret = pm_runtime_get_sync(bc->dev);
> > > - if (ret < 0) {
> > > - pm_runtime_put_noidle(bc->dev);
> > > - return ret;
> > > - }
> > > - }
> > > + if (pm_runtime_suspended(dev))
> > > + return 0;
> > >
> > > bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
> > > + clk_disable_unprepare(bc->clk_apb);
> > >
> > > return 0;
> > > }
> > > @@ -487,11 +491,16 @@ static int imx95_bc_suspend(struct device *dev)
> > > static int imx95_bc_resume(struct device *dev)
> > > {
> > > struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
> > > + int ret;
> > >
> > > - writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);
> > > + if (pm_runtime_suspended(dev))
> > > + return 0;
> > >
> > > - if (bc->pdata->rpm_enabled)
> > > - pm_runtime_put(bc->dev);
> > > + ret = clk_prepare_enable(bc->clk_apb);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);
> > >
> > > return 0;
> > > }
> > > --
> > > 2.46.1
> > >
Powered by blists - more mailing lists