Re: [PATCH] clk: qcom: gfm-mux: use runtime pm while accessing registers

From: Stephen Boyd
Date: Tue Mar 21 2023 - 18:49:00 EST


Quoting Srinivas Kandagatla (2023-03-21 13:33:49)
>
>
> On 21/03/2023 18:46, Stephen Boyd wrote:
> > Quoting Srinivas Kandagatla (2023-03-21 10:57:58)
> >> gfm mux driver does support runtime pm but we never use it while
> >> accessing registers. Looks like this driver was getting lucky and
> >> totally depending on other drivers to leave the clk on.
> >>
> >> Fix this by doing runtime pm while accessing registers.
> >>
> >> Fixes: a2d8f507803e ("clk: qcom: Add support to LPASS AUDIO_CC Glitch Free Mux clocks")
> >> Cc: stable@xxxxxxxxxxxxxxx
> >> Reported-by: Amit Pundir <amit.pundir@xxxxxxxxxx>
> >
> > Is there a link to the report?
>
> https://www.spinics.net/lists/stable/msg638380.html

Please add a Link: after the reported-by and use a lore link instead of
spinics please.

> >> {
> >> struct clk_gfm *clk = to_clk_gfm(hw);
> >> unsigned int val;
> >> + int ret;
> >> +
> >> + ret = pm_runtime_resume_and_get(clk->priv->dev);
> >
> > Doesn't the clk framework already do this? Why do we need to do it
> > again?
>
> You are right, clk core already does do pm_runtime_resume_and_get for
> set_parent.
>
> this looks redundant here.
>
>
> so we need only need to add this for get_parent
>

The get_parent() clk op is called from a couple places in the clk
framework. I guess that you're getting called from
clk_core_reparent_orphans() where the runtime PM count isn't
incremented? Can you confirm? Either way, this should be fixed in the
framework and not in the driver.