Message ID | 20181110203115.13335-3-andreas@kemnade.info (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | mach-omap2: handle autoidle denial | expand |
Quoting Andreas Kemnade (2018-11-10 12:31:14) > Code might use autoidle api with clocks not being omap2 clocks, > so check if clock type is not basic > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > --- > New in v2 > --- > drivers/clk/ti/autoidle.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c > index 161f67850393..5bdae5552d38 100644 > --- a/drivers/clk/ti/autoidle.c > +++ b/drivers/clk/ti/autoidle.c > @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); > int omap2_clk_deny_idle(struct clk *clk) > { > struct clk_hw_omap *c; > + struct clk_hw *hw = __clk_get_hw(clk); > > - c = to_clk_hw_omap(__clk_get_hw(clk)); > + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) Please try to avoid using CLK_IS_BASIC if at all possible. Can you? Maybe add some flag in clk_hw_omap() instead?
Hi Stephen, On Thu, 29 Nov 2018 16:25:05 -0800 Stephen Boyd <sboyd@kernel.org> wrote: > Quoting Andreas Kemnade (2018-11-10 12:31:14) > > Code might use autoidle api with clocks not being omap2 clocks, > > so check if clock type is not basic > > > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > > --- > > New in v2 > > --- > > drivers/clk/ti/autoidle.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c > > index 161f67850393..5bdae5552d38 100644 > > --- a/drivers/clk/ti/autoidle.c > > +++ b/drivers/clk/ti/autoidle.c > > @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); > > int omap2_clk_deny_idle(struct clk *clk) > > { > > struct clk_hw_omap *c; > > + struct clk_hw *hw = __clk_get_hw(clk); > > > > - c = to_clk_hw_omap(__clk_get_hw(clk)); > > + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) > > Please try to avoid using CLK_IS_BASIC if at all possible. Can you? > Maybe add some flag in clk_hw_omap() instead? > hmm, Tero suggested that. But to check flags in clk_hw_omap I first need to know that there is a clk_hw_omap behind clk_hw. And for that I either need to check flags in clk_hw or do more changes in the omap_hwmod code. Regards, Andreas
Quoting Andreas Kemnade (2018-11-29 22:15:34) > Hi Stephen, > > On Thu, 29 Nov 2018 16:25:05 -0800 > Stephen Boyd <sboyd@kernel.org> wrote: > > > Quoting Andreas Kemnade (2018-11-10 12:31:14) > > > Code might use autoidle api with clocks not being omap2 clocks, > > > so check if clock type is not basic > > > > > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > > > --- > > > New in v2 > > > --- > > > drivers/clk/ti/autoidle.c | 12 ++++++++++-- > > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c > > > index 161f67850393..5bdae5552d38 100644 > > > --- a/drivers/clk/ti/autoidle.c > > > +++ b/drivers/clk/ti/autoidle.c > > > @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); > > > int omap2_clk_deny_idle(struct clk *clk) > > > { > > > struct clk_hw_omap *c; > > > + struct clk_hw *hw = __clk_get_hw(clk); > > > > > > - c = to_clk_hw_omap(__clk_get_hw(clk)); > > > + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) > > > > Please try to avoid using CLK_IS_BASIC if at all possible. Can you? > > Maybe add some flag in clk_hw_omap() instead? > > > hmm, Tero suggested that. > But to check flags in clk_hw_omap I first need to know that there is a > clk_hw_omap behind clk_hw. And for that I either need to check flags in > clk_hw or do more changes in the omap_hwmod code. Can you do it? The omap code is the only user of CLK_IS_BASIC. All the other users are marking clks with this but there is no reason to do so. I'll go make another pass over the tree and nuke those ones from orbit.
On 30/11/2018 09:20, Stephen Boyd wrote: > Quoting Andreas Kemnade (2018-11-29 22:15:34) >> Hi Stephen, >> >> On Thu, 29 Nov 2018 16:25:05 -0800 >> Stephen Boyd <sboyd@kernel.org> wrote: >> >>> Quoting Andreas Kemnade (2018-11-10 12:31:14) >>>> Code might use autoidle api with clocks not being omap2 clocks, >>>> so check if clock type is not basic >>>> >>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info> >>>> --- >>>> New in v2 >>>> --- >>>> drivers/clk/ti/autoidle.c | 12 ++++++++++-- >>>> 1 file changed, 10 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c >>>> index 161f67850393..5bdae5552d38 100644 >>>> --- a/drivers/clk/ti/autoidle.c >>>> +++ b/drivers/clk/ti/autoidle.c >>>> @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); >>>> int omap2_clk_deny_idle(struct clk *clk) >>>> { >>>> struct clk_hw_omap *c; >>>> + struct clk_hw *hw = __clk_get_hw(clk); >>>> >>>> - c = to_clk_hw_omap(__clk_get_hw(clk)); >>>> + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) >>> >>> Please try to avoid using CLK_IS_BASIC if at all possible. Can you? >>> Maybe add some flag in clk_hw_omap() instead? >>> >> hmm, Tero suggested that. >> But to check flags in clk_hw_omap I first need to know that there is a >> clk_hw_omap behind clk_hw. And for that I either need to check flags in >> clk_hw or do more changes in the omap_hwmod code. > > Can you do it? The omap code is the only user of CLK_IS_BASIC. All the > other users are marking clks with this but there is no reason to do so. > I'll go make another pass over the tree and nuke those ones from orbit. The reason for using this flag is because OMAP uses two clock types around, the basic clocks like fixed-factor-clock/fixed-clock, and then all the omap derivatives, which can be cast to clk_hw_omap. If we want to avoid usage of CLK_IS_BASIC, we need to copy paste the remaining basic code under drivers/clk/ti/ and convert them to use clk_hw_omap as internal datatype. Is this preferred? -Tero -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoting Tero Kristo (2018-11-29 23:35:35) > On 30/11/2018 09:20, Stephen Boyd wrote: > > Quoting Andreas Kemnade (2018-11-29 22:15:34) > >> Hi Stephen, > >> > >> On Thu, 29 Nov 2018 16:25:05 -0800 > >> Stephen Boyd <sboyd@kernel.org> wrote: > >> > >>> Quoting Andreas Kemnade (2018-11-10 12:31:14) > >>>> Code might use autoidle api with clocks not being omap2 clocks, > >>>> so check if clock type is not basic > >>>> > >>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > >>>> --- > >>>> New in v2 > >>>> --- > >>>> drivers/clk/ti/autoidle.c | 12 ++++++++++-- > >>>> 1 file changed, 10 insertions(+), 2 deletions(-) > >>>> > >>>> diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c > >>>> index 161f67850393..5bdae5552d38 100644 > >>>> --- a/drivers/clk/ti/autoidle.c > >>>> +++ b/drivers/clk/ti/autoidle.c > >>>> @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); > >>>> int omap2_clk_deny_idle(struct clk *clk) > >>>> { > >>>> struct clk_hw_omap *c; > >>>> + struct clk_hw *hw = __clk_get_hw(clk); > >>>> > >>>> - c = to_clk_hw_omap(__clk_get_hw(clk)); > >>>> + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) > >>> > >>> Please try to avoid using CLK_IS_BASIC if at all possible. Can you? > >>> Maybe add some flag in clk_hw_omap() instead? > >>> > >> hmm, Tero suggested that. > >> But to check flags in clk_hw_omap I first need to know that there is a > >> clk_hw_omap behind clk_hw. And for that I either need to check flags in > >> clk_hw or do more changes in the omap_hwmod code. > > > > Can you do it? The omap code is the only user of CLK_IS_BASIC. All the > > other users are marking clks with this but there is no reason to do so. > > I'll go make another pass over the tree and nuke those ones from orbit. > > The reason for using this flag is because OMAP uses two clock types > around, the basic clocks like fixed-factor-clock/fixed-clock, and then > all the omap derivatives, which can be cast to clk_hw_omap. If we want > to avoid usage of CLK_IS_BASIC, we need to copy paste the remaining > basic code under drivers/clk/ti/ and convert them to use clk_hw_omap as > internal datatype. Is this preferred? > No that is not preferred. Can the omap2_clk_deny_idle() function be integrated closer into the clk framework in some way that allows it to be part of the clk_ops structure? And then have that take a clk_hw structure instead of a struct clk? I haven't looked at this in any detail whatsoever so I may be way off right now.
On 30/11/2018 09:57, Stephen Boyd wrote: > Quoting Tero Kristo (2018-11-29 23:35:35) >> On 30/11/2018 09:20, Stephen Boyd wrote: >>> Quoting Andreas Kemnade (2018-11-29 22:15:34) >>>> Hi Stephen, >>>> >>>> On Thu, 29 Nov 2018 16:25:05 -0800 >>>> Stephen Boyd <sboyd@kernel.org> wrote: >>>> >>>>> Quoting Andreas Kemnade (2018-11-10 12:31:14) >>>>>> Code might use autoidle api with clocks not being omap2 clocks, >>>>>> so check if clock type is not basic >>>>>> >>>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info> >>>>>> --- >>>>>> New in v2 >>>>>> --- >>>>>> drivers/clk/ti/autoidle.c | 12 ++++++++++-- >>>>>> 1 file changed, 10 insertions(+), 2 deletions(-) >>>>>> >>>>>> diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c >>>>>> index 161f67850393..5bdae5552d38 100644 >>>>>> --- a/drivers/clk/ti/autoidle.c >>>>>> +++ b/drivers/clk/ti/autoidle.c >>>>>> @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); >>>>>> int omap2_clk_deny_idle(struct clk *clk) >>>>>> { >>>>>> struct clk_hw_omap *c; >>>>>> + struct clk_hw *hw = __clk_get_hw(clk); >>>>>> >>>>>> - c = to_clk_hw_omap(__clk_get_hw(clk)); >>>>>> + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) >>>>> >>>>> Please try to avoid using CLK_IS_BASIC if at all possible. Can you? >>>>> Maybe add some flag in clk_hw_omap() instead? >>>>> >>>> hmm, Tero suggested that. >>>> But to check flags in clk_hw_omap I first need to know that there is a >>>> clk_hw_omap behind clk_hw. And for that I either need to check flags in >>>> clk_hw or do more changes in the omap_hwmod code. >>> >>> Can you do it? The omap code is the only user of CLK_IS_BASIC. All the >>> other users are marking clks with this but there is no reason to do so. >>> I'll go make another pass over the tree and nuke those ones from orbit. >> >> The reason for using this flag is because OMAP uses two clock types >> around, the basic clocks like fixed-factor-clock/fixed-clock, and then >> all the omap derivatives, which can be cast to clk_hw_omap. If we want >> to avoid usage of CLK_IS_BASIC, we need to copy paste the remaining >> basic code under drivers/clk/ti/ and convert them to use clk_hw_omap as >> internal datatype. Is this preferred? >> > > No that is not preferred. Can the omap2_clk_deny_idle() function be > integrated closer into the clk framework in some way that allows it to > be part of the clk_ops structure? And then have that take a clk_hw > structure instead of a struct clk? I haven't looked at this in any > detail whatsoever so I may be way off right now. It could be added under the main clk_ops struct, however this would introduce two new func pointers to it which are not used by anything else but OMAP. Are you aware of any other platforms requiring similar feature? -Tero -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Hi Tero, On Fri, 30 Nov 2018 11:20:49 +0200 Tero Kristo <t-kristo@ti.com> wrote: > On 30/11/2018 09:57, Stephen Boyd wrote: > > Quoting Tero Kristo (2018-11-29 23:35:35) > >> On 30/11/2018 09:20, Stephen Boyd wrote: > >>> Quoting Andreas Kemnade (2018-11-29 22:15:34) > >>>> Hi Stephen, > >>>> > >>>> On Thu, 29 Nov 2018 16:25:05 -0800 > >>>> Stephen Boyd <sboyd@kernel.org> wrote: > >>>> > >>>>> Quoting Andreas Kemnade (2018-11-10 12:31:14) > >>>>>> Code might use autoidle api with clocks not being omap2 clocks, > >>>>>> so check if clock type is not basic > >>>>>> > >>>>>> Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > >>>>>> --- > >>>>>> New in v2 > >>>>>> --- > >>>>>> drivers/clk/ti/autoidle.c | 12 ++++++++++-- > >>>>>> 1 file changed, 10 insertions(+), 2 deletions(-) > >>>>>> > >>>>>> diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c > >>>>>> index 161f67850393..5bdae5552d38 100644 > >>>>>> --- a/drivers/clk/ti/autoidle.c > >>>>>> +++ b/drivers/clk/ti/autoidle.c > >>>>>> @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); > >>>>>> int omap2_clk_deny_idle(struct clk *clk) > >>>>>> { > >>>>>> struct clk_hw_omap *c; > >>>>>> + struct clk_hw *hw = __clk_get_hw(clk); > >>>>>> > >>>>>> - c = to_clk_hw_omap(__clk_get_hw(clk)); > >>>>>> + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) > >>>>> > >>>>> Please try to avoid using CLK_IS_BASIC if at all possible. Can you? > >>>>> Maybe add some flag in clk_hw_omap() instead? > >>>>> > >>>> hmm, Tero suggested that. > >>>> But to check flags in clk_hw_omap I first need to know that there is a > >>>> clk_hw_omap behind clk_hw. And for that I either need to check flags in > >>>> clk_hw or do more changes in the omap_hwmod code. > >>> > >>> Can you do it? The omap code is the only user of CLK_IS_BASIC. All the > >>> other users are marking clks with this but there is no reason to do so. > >>> I'll go make another pass over the tree and nuke those ones from orbit. > >> > >> The reason for using this flag is because OMAP uses two clock types > >> around, the basic clocks like fixed-factor-clock/fixed-clock, and then > >> all the omap derivatives, which can be cast to clk_hw_omap. If we want > >> to avoid usage of CLK_IS_BASIC, we need to copy paste the remaining > >> basic code under drivers/clk/ti/ and convert them to use clk_hw_omap as > >> internal datatype. Is this preferred? > >> > > > > No that is not preferred. Can the omap2_clk_deny_idle() function be > > integrated closer into the clk framework in some way that allows it to > > be part of the clk_ops structure? And then have that take a clk_hw > > structure instead of a struct clk? I haven't looked at this in any > > detail whatsoever so I may be way off right now. > > It could be added under the main clk_ops struct, however this would > introduce two new func pointers to it which are not used by anything > else but OMAP. Are you aware of any other platforms requiring similar > feature? The question here is also how we organize the procedure here. One patchset fixing nasty problems and another mainly reorganize things? Where do we draw the line between these two? If we have the autoidle code in main clk_ops, we could also think whether other autoidle code should go into main code. Regards, Andreas
Hi, * Tero Kristo <t-kristo@ti.com> [181130 09:21]: > On 30/11/2018 09:57, Stephen Boyd wrote: > > No that is not preferred. Can the omap2_clk_deny_idle() function be > > integrated closer into the clk framework in some way that allows it to > > be part of the clk_ops structure? And then have that take a clk_hw > > structure instead of a struct clk? I haven't looked at this in any > > detail whatsoever so I may be way off right now. > > It could be added under the main clk_ops struct, however this would > introduce two new func pointers to it which are not used by anything else > but OMAP. Are you aware of any other platforms requiring similar feature? From consumer usage point of view, I'm still wondering about the relationship of clk_deny_idle() and clkdm_deny_idle(). It seems that we need to allow reset control drivers call clk_deny_idle() for the duration of reset. And it seems the clk_deny_idle() should propagate to also up to the related clock domain driver to do clkdm_deny_idle(). So maybe clk_deny_idle() is could just be something like: dev = clk_get_device(clk); ... error = pm_runtime_get(dev); ... pm_runtime_put(dev); ... And that way it would just propagate to the parent clock domain driver and the clock framework does not need to know about clockdomains. A clockdomain could be just a genpd domain. Or do you guys have better ideas? Regards, Tony
Quoting Tony Lindgren (2018-11-30 07:37:29) > Hi, > > * Tero Kristo <t-kristo@ti.com> [181130 09:21]: > > On 30/11/2018 09:57, Stephen Boyd wrote: > > > No that is not preferred. Can the omap2_clk_deny_idle() function be > > > integrated closer into the clk framework in some way that allows it to > > > be part of the clk_ops structure? And then have that take a clk_hw > > > structure instead of a struct clk? I haven't looked at this in any > > > detail whatsoever so I may be way off right now. > > > > It could be added under the main clk_ops struct, however this would > > introduce two new func pointers to it which are not used by anything else > > but OMAP. Are you aware of any other platforms requiring similar feature? > > From consumer usage point of view, I'm still wondering about > the relationship of clk_deny_idle() and clkdm_deny_idle(). > > It seems that we need to allow reset control drivers call > clk_deny_idle() for the duration of reset. And it seems the > clk_deny_idle() should propagate to also up to the related > clock domain driver to do clkdm_deny_idle(). > > So maybe clk_deny_idle() is could just be something like: > > dev = clk_get_device(clk); > ... > error = pm_runtime_get(dev); > ... > pm_runtime_put(dev); > ... > > And that way it would just propagate to the parent clock > domain driver and the clock framework does not need to know > about clockdomains. A clockdomain could be just a genpd > domain. > > Or do you guys have better ideas? > Wouldn't the device link in clk framework patches do this for you if we had the RUNTIME_PM flag passed in. If this is about keeping the clock controller active when a consumer device is using it then I think it may work.
* Stephen Boyd <sboyd@kernel.org> [181130 23:52]: > Quoting Tony Lindgren (2018-11-30 07:37:29) > > Hi, > > > > * Tero Kristo <t-kristo@ti.com> [181130 09:21]: > > > On 30/11/2018 09:57, Stephen Boyd wrote: > > > > No that is not preferred. Can the omap2_clk_deny_idle() function be > > > > integrated closer into the clk framework in some way that allows it to > > > > be part of the clk_ops structure? And then have that take a clk_hw > > > > structure instead of a struct clk? I haven't looked at this in any > > > > detail whatsoever so I may be way off right now. > > > > > > It could be added under the main clk_ops struct, however this would > > > introduce two new func pointers to it which are not used by anything else > > > but OMAP. Are you aware of any other platforms requiring similar feature? > > > > From consumer usage point of view, I'm still wondering about > > the relationship of clk_deny_idle() and clkdm_deny_idle(). > > > > It seems that we need to allow reset control drivers call > > clk_deny_idle() for the duration of reset. And it seems the > > clk_deny_idle() should propagate to also up to the related > > clock domain driver to do clkdm_deny_idle(). > > > > So maybe clk_deny_idle() is could just be something like: > > > > dev = clk_get_device(clk); > > ... > > error = pm_runtime_get(dev); > > ... > > pm_runtime_put(dev); > > ... > > > > And that way it would just propagate to the parent clock > > domain driver and the clock framework does not need to know > > about clockdomains. A clockdomain could be just a genpd > > domain. > > > > Or do you guys have better ideas? > > > > Wouldn't the device link in clk framework patches do this for you if we > had the RUNTIME_PM flag passed in. If this is about keeping the clock > controller active when a consumer device is using it then I think it may > work. The consumer device stays active just fine with PM runtime calls. So yes, the problem is keeping a clock controller forced active for the period of consumer device reset. Other than that typically autoidle can be just kept enabled. Below is a clarified suggested example usage if we wanted to use PM runtime on a clock controller device from a consumer device reset driver: error = pm_runtime_get_dev() ... cdev = clk_get_device(clk); ... error = pm_runtime_get(cdev); ... /* Do the consumer device reset here */ ... pm_runtime_put(cdev); pm_runtime_put(dev); Regards, Tony
On Mon, 3 Dec 2018 07:39:10 -0800 Tony Lindgren <tony@atomide.com> wrote: > * Stephen Boyd <sboyd@kernel.org> [181130 23:52]: > > Quoting Tony Lindgren (2018-11-30 07:37:29) > > > Hi, > > > > > > * Tero Kristo <t-kristo@ti.com> [181130 09:21]: > > > > On 30/11/2018 09:57, Stephen Boyd wrote: > > > > > No that is not preferred. Can the omap2_clk_deny_idle() function be > > > > > integrated closer into the clk framework in some way that allows it to > > > > > be part of the clk_ops structure? And then have that take a clk_hw > > > > > structure instead of a struct clk? I haven't looked at this in any > > > > > detail whatsoever so I may be way off right now. > > > > > > > > It could be added under the main clk_ops struct, however this would > > > > introduce two new func pointers to it which are not used by anything else > > > > but OMAP. Are you aware of any other platforms requiring similar feature? > > > > > > From consumer usage point of view, I'm still wondering about > > > the relationship of clk_deny_idle() and clkdm_deny_idle(). > > > > > > It seems that we need to allow reset control drivers call > > > clk_deny_idle() for the duration of reset. And it seems the > > > clk_deny_idle() should propagate to also up to the related > > > clock domain driver to do clkdm_deny_idle(). > > > > > > So maybe clk_deny_idle() is could just be something like: > > > > > > dev = clk_get_device(clk); > > > ... > > > error = pm_runtime_get(dev); > > > ... > > > pm_runtime_put(dev); > > > ... > > > > > > And that way it would just propagate to the parent clock > > > domain driver and the clock framework does not need to know > > > about clockdomains. A clockdomain could be just a genpd > > > domain. > > > > > > Or do you guys have better ideas? > > > > > > > Wouldn't the device link in clk framework patches do this for you if we > > had the RUNTIME_PM flag passed in. If this is about keeping the clock > > controller active when a consumer device is using it then I think it may > > work. > > The consumer device stays active just fine with PM runtime > calls. So yes, the problem is keeping a clock controller forced > active for the period of consumer device reset. Other than > that typically autoidle can be just kept enabled. > Are we still talking about the same problem? Maybe I am losing track here. Just to make sure. The patch series was about disabling autoidle for devices which cannot work with it during normal operation. Not during reset or something like that. Or is the keep-clock-active-during-reset just a requirement for bigger restructuring ideas? Regards, Andreas
Quoting Tony Lindgren (2018-12-03 07:39:10) > * Stephen Boyd <sboyd@kernel.org> [181130 23:52]: > > Quoting Tony Lindgren (2018-11-30 07:37:29) > > > * Tero Kristo <t-kristo@ti.com> [181130 09:21]: > > > > On 30/11/2018 09:57, Stephen Boyd wrote: > > > ... > > > > > > And that way it would just propagate to the parent clock > > > domain driver and the clock framework does not need to know > > > about clockdomains. A clockdomain could be just a genpd > > > domain. > > > > > > Or do you guys have better ideas? > > > > > > > Wouldn't the device link in clk framework patches do this for you if we > > had the RUNTIME_PM flag passed in. If this is about keeping the clock > > controller active when a consumer device is using it then I think it may > > work. > > The consumer device stays active just fine with PM runtime > calls. So yes, the problem is keeping a clock controller forced > active for the period of consumer device reset. Other than > that typically autoidle can be just kept enabled. > > Below is a clarified suggested example usage if we wanted to > use PM runtime on a clock controller device from a consumer > device reset driver: > > error = pm_runtime_get_dev() > ... > cdev = clk_get_device(clk); > ... > error = pm_runtime_get(cdev); > ... > /* Do the consumer device reset here */ > ... > pm_runtime_put(cdev); > pm_runtime_put(dev); > Does the consumer reset use the reset framework or something else? If the driver is using the reset framework, I would expect the reset framework to _also_ have device links and keep the clock controller, i.e. reset provider, active while the reset is being toggled. And this assumes the reset controller and clock controller code is all rolled up together in a single driver that can tell itself to deny idle for certain clks that are associated with whatever resets they affect.
* Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > On Mon, 3 Dec 2018 07:39:10 -0800 > Tony Lindgren <tony@atomide.com> wrote: > > The consumer device stays active just fine with PM runtime > > calls. So yes, the problem is keeping a clock controller forced > > active for the period of consumer device reset. Other than > > that typically autoidle can be just kept enabled. > > > Are we still talking about the same problem? Maybe I am losing track > here. Just to make sure. > The patch series was about disabling autoidle for devices which cannot > work with it during normal operation. Not during reset or something > like that. > Or is the keep-clock-active-during-reset just a requirement for bigger > restructuring ideas? Yeah there are two issues: The fix needed for the issue you brought up, and also how to let a reset driver to block autoidle for reset. Regards, Tony
Hi, On Tue, 4 Dec 2018 08:45:57 -0800 Tony Lindgren <tony@atomide.com> wrote: > * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > > On Mon, 3 Dec 2018 07:39:10 -0800 > > Tony Lindgren <tony@atomide.com> wrote: > > > The consumer device stays active just fine with PM runtime > > > calls. So yes, the problem is keeping a clock controller forced > > > active for the period of consumer device reset. Other than > > > that typically autoidle can be just kept enabled. > > > > > Are we still talking about the same problem? Maybe I am losing track > > here. Just to make sure. > > The patch series was about disabling autoidle for devices which cannot > > work with it during normal operation. Not during reset or something > > like that. > > Or is the keep-clock-active-during-reset just a requirement for bigger > > restructuring ideas? > > Yeah there are two issues: The fix needed for the issue you brought up, > and also how to let a reset driver to block autoidle for reset. > Hmm, is this set now waiting for the famous "somebody" fixing all the stuff? What are currently visible symptoms for the driver not blocking autoidle for reset? Maybe I can at least test something there. I have also omap5 here. Regards, Andreas
* Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: > Hi, > > On Tue, 4 Dec 2018 08:45:57 -0800 > Tony Lindgren <tony@atomide.com> wrote: > > > * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > > > On Mon, 3 Dec 2018 07:39:10 -0800 > > > Tony Lindgren <tony@atomide.com> wrote: > > > > The consumer device stays active just fine with PM runtime > > > > calls. So yes, the problem is keeping a clock controller forced > > > > active for the period of consumer device reset. Other than > > > > that typically autoidle can be just kept enabled. > > > > > > > Are we still talking about the same problem? Maybe I am losing track > > > here. Just to make sure. > > > The patch series was about disabling autoidle for devices which cannot > > > work with it during normal operation. Not during reset or something > > > like that. > > > Or is the keep-clock-active-during-reset just a requirement for bigger > > > restructuring ideas? > > > > Yeah there are two issues: The fix needed for the issue you brought up, > > and also how to let a reset driver to block autoidle for reset. > > > Hmm, is this set now waiting for the famous "somebody" fixing all > the stuff? Well I think we're still waiting on Tero to comment on this. > What are currently visible symptoms for the driver not blocking > autoidle for reset? Maybe I can at least test something there. I have > also omap5 here. Oh that's just for making drivers/reset drivers to work in the long run. Let's keep that separate from these fixes.. Regards, Tony
On 28/12/2018 22:02, Tony Lindgren wrote: > * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: >> Hi, >> >> On Tue, 4 Dec 2018 08:45:57 -0800 >> Tony Lindgren <tony@atomide.com> wrote: >> >>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: >>>> On Mon, 3 Dec 2018 07:39:10 -0800 >>>> Tony Lindgren <tony@atomide.com> wrote: >>>>> The consumer device stays active just fine with PM runtime >>>>> calls. So yes, the problem is keeping a clock controller forced >>>>> active for the period of consumer device reset. Other than >>>>> that typically autoidle can be just kept enabled. >>>>> >>>> Are we still talking about the same problem? Maybe I am losing track >>>> here. Just to make sure. >>>> The patch series was about disabling autoidle for devices which cannot >>>> work with it during normal operation. Not during reset or something >>>> like that. >>>> Or is the keep-clock-active-during-reset just a requirement for bigger >>>> restructuring ideas? >>> >>> Yeah there are two issues: The fix needed for the issue you brought up, >>> and also how to let a reset driver to block autoidle for reset. >>> >> Hmm, is this set now waiting for the famous "somebody" fixing all >> the stuff? > > Well I think we're still waiting on Tero to comment on this. The only item requiring immediate fixing is the point Stephen made out, removing the usage of CLK_IS_BASIC from this patch. Afaics, the reset related concerns Tony has can be handled later. -Tero > >> What are currently visible symptoms for the driver not blocking >> autoidle for reset? Maybe I can at least test something there. I have >> also omap5 here. > > Oh that's just for making drivers/reset drivers to work in > the long run. Let's keep that separate from these fixes.. > > Regards, > > Tony > > -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
On Mon, 31 Dec 2018 09:23:01 +0200 Tero Kristo <t-kristo@ti.com> wrote: > On 28/12/2018 22:02, Tony Lindgren wrote: > > * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: > >> Hi, > >> > >> On Tue, 4 Dec 2018 08:45:57 -0800 > >> Tony Lindgren <tony@atomide.com> wrote: > >> > >>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > >>>> On Mon, 3 Dec 2018 07:39:10 -0800 > >>>> Tony Lindgren <tony@atomide.com> wrote: > >>>>> The consumer device stays active just fine with PM runtime > >>>>> calls. So yes, the problem is keeping a clock controller forced > >>>>> active for the period of consumer device reset. Other than > >>>>> that typically autoidle can be just kept enabled. > >>>>> > >>>> Are we still talking about the same problem? Maybe I am losing track > >>>> here. Just to make sure. > >>>> The patch series was about disabling autoidle for devices which cannot > >>>> work with it during normal operation. Not during reset or something > >>>> like that. > >>>> Or is the keep-clock-active-during-reset just a requirement for bigger > >>>> restructuring ideas? > >>> > >>> Yeah there are two issues: The fix needed for the issue you brought up, > >>> and also how to let a reset driver to block autoidle for reset. > >>> > >> Hmm, is this set now waiting for the famous "somebody" fixing all > >> the stuff? > > > > Well I think we're still waiting on Tero to comment on this. > > The only item requiring immediate fixing is the point Stephen made out, > removing the usage of CLK_IS_BASIC from this patch. > > Afaics, the reset related concerns Tony has can be handled later. > hmm, and there we need Stephen's opinion about having the allow/deny autoidle functions in the main clk_ops struct. Regards, Andreas
Quoting Andreas Kemnade (2018-12-31 00:30:21) > On Mon, 31 Dec 2018 09:23:01 +0200 > Tero Kristo <t-kristo@ti.com> wrote: > > > On 28/12/2018 22:02, Tony Lindgren wrote: > > > * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: > > >> Hi, > > >> > > >> On Tue, 4 Dec 2018 08:45:57 -0800 > > >> Tony Lindgren <tony@atomide.com> wrote: > > >> > > >>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > > >>>> On Mon, 3 Dec 2018 07:39:10 -0800 > > >>>> Tony Lindgren <tony@atomide.com> wrote: > > >>>>> The consumer device stays active just fine with PM runtime > > >>>>> calls. So yes, the problem is keeping a clock controller forced > > >>>>> active for the period of consumer device reset. Other than > > >>>>> that typically autoidle can be just kept enabled. > > >>>>> > > >>>> Are we still talking about the same problem? Maybe I am losing track > > >>>> here. Just to make sure. > > >>>> The patch series was about disabling autoidle for devices which cannot > > >>>> work with it during normal operation. Not during reset or something > > >>>> like that. > > >>>> Or is the keep-clock-active-during-reset just a requirement for bigger > > >>>> restructuring ideas? > > >>> > > >>> Yeah there are two issues: The fix needed for the issue you brought up, > > >>> and also how to let a reset driver to block autoidle for reset. > > >>> > > >> Hmm, is this set now waiting for the famous "somebody" fixing all > > >> the stuff? > > > > > > Well I think we're still waiting on Tero to comment on this. > > > > The only item requiring immediate fixing is the point Stephen made out, > > removing the usage of CLK_IS_BASIC from this patch. > > > > Afaics, the reset related concerns Tony has can be handled later. > > > hmm, and there we need Stephen's opinion about having the allow/deny > autoidle functions in the main clk_ops struct. > I have unanswered questions on the list for this thread[1]. I'm not sure what allow/deny autoidle functions mean to clk drivers. It looks like an OMAP specific addition to the clk_ops struct, which sounds wrong to put it plainly. Hopefully it can be done outside of the clk framework by having the provider driver know more things about all the frameworks it's hooking into. [1] https://lkml.kernel.org/r/154385676593.88331.5239924154783168815@swboyd.mtv.corp.google.com
On 04/01/2019 01:39, Stephen Boyd wrote: > Quoting Andreas Kemnade (2018-12-31 00:30:21) >> On Mon, 31 Dec 2018 09:23:01 +0200 >> Tero Kristo <t-kristo@ti.com> wrote: >> >>> On 28/12/2018 22:02, Tony Lindgren wrote: >>>> * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: >>>>> Hi, >>>>> >>>>> On Tue, 4 Dec 2018 08:45:57 -0800 >>>>> Tony Lindgren <tony@atomide.com> wrote: >>>>> >>>>>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: >>>>>>> On Mon, 3 Dec 2018 07:39:10 -0800 >>>>>>> Tony Lindgren <tony@atomide.com> wrote: >>>>>>>> The consumer device stays active just fine with PM runtime >>>>>>>> calls. So yes, the problem is keeping a clock controller forced >>>>>>>> active for the period of consumer device reset. Other than >>>>>>>> that typically autoidle can be just kept enabled. >>>>>>>> >>>>>>> Are we still talking about the same problem? Maybe I am losing track >>>>>>> here. Just to make sure. >>>>>>> The patch series was about disabling autoidle for devices which cannot >>>>>>> work with it during normal operation. Not during reset or something >>>>>>> like that. >>>>>>> Or is the keep-clock-active-during-reset just a requirement for bigger >>>>>>> restructuring ideas? >>>>>> >>>>>> Yeah there are two issues: The fix needed for the issue you brought up, >>>>>> and also how to let a reset driver to block autoidle for reset. >>>>>> >>>>> Hmm, is this set now waiting for the famous "somebody" fixing all >>>>> the stuff? >>>> >>>> Well I think we're still waiting on Tero to comment on this. >>> >>> The only item requiring immediate fixing is the point Stephen made out, >>> removing the usage of CLK_IS_BASIC from this patch. >>> >>> Afaics, the reset related concerns Tony has can be handled later. >>> >> hmm, and there we need Stephen's opinion about having the allow/deny >> autoidle functions in the main clk_ops struct. >> > > I have unanswered questions on the list for this thread[1]. The reset portion we can't answer with the current knowledge I fear, we need to prototype this a bit first and see which way to go. > I'm not sure > what allow/deny autoidle functions mean to clk drivers. It looks like an > OMAP specific addition to the clk_ops struct, which sounds wrong to put > it plainly. Yeah, I don't think other SoCs implement the same functionality, at least not in the same way. The autoidle bits are available in omap2/omap3 only, where they control the HW autoidle functionality of these clocks. If the bit is enabled, the HW can autonomously disable the clock once it is not needed anymore by HW. > Hopefully it can be done outside of the clk framework by > having the provider driver know more things about all the frameworks > it's hooking into. This is how it has been done so far, however Andreas wants to expand the functionality a bit where it breaks... unless we can use the CLK_IS_BASIC flag to detect if we accessing an OMAP specific clock or not. If we are passing in a clk pointer from a consumer level API, I don't know if there is any other way to go with this if we can't modify the generic clk_ops struct. The same flag check is used across TI clock driver already btw. -Tero > > [1] https://lkml.kernel.org/r/154385676593.88331.5239924154783168815@swboyd.mtv.corp.google.com > -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Quoting Tero Kristo (2019-01-03 23:28:58) > On 04/01/2019 01:39, Stephen Boyd wrote: > > Quoting Andreas Kemnade (2018-12-31 00:30:21) > >> On Mon, 31 Dec 2018 09:23:01 +0200 > >> Tero Kristo <t-kristo@ti.com> wrote: > >> > >>> On 28/12/2018 22:02, Tony Lindgren wrote: > >>>> * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: > >>>>> Hi, > >>>>> > >>>>> On Tue, 4 Dec 2018 08:45:57 -0800 > >>>>> Tony Lindgren <tony@atomide.com> wrote: > >>>>> > >>>>>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: > >>>>>>> On Mon, 3 Dec 2018 07:39:10 -0800 > >>>>>>> Tony Lindgren <tony@atomide.com> wrote: > >>>>>>>> The consumer device stays active just fine with PM runtime > >>>>>>>> calls. So yes, the problem is keeping a clock controller forced > >>>>>>>> active for the period of consumer device reset. Other than > >>>>>>>> that typically autoidle can be just kept enabled. > >>>>>>>> > >>>>>>> Are we still talking about the same problem? Maybe I am losing track > >>>>>>> here. Just to make sure. > >>>>>>> The patch series was about disabling autoidle for devices which cannot > >>>>>>> work with it during normal operation. Not during reset or something > >>>>>>> like that. > >>>>>>> Or is the keep-clock-active-during-reset just a requirement for bigger > >>>>>>> restructuring ideas? > >>>>>> > >>>>>> Yeah there are two issues: The fix needed for the issue you brought up, > >>>>>> and also how to let a reset driver to block autoidle for reset. > >>>>>> > >>>>> Hmm, is this set now waiting for the famous "somebody" fixing all > >>>>> the stuff? > >>>> > >>>> Well I think we're still waiting on Tero to comment on this. > >>> > >>> The only item requiring immediate fixing is the point Stephen made out, > >>> removing the usage of CLK_IS_BASIC from this patch. > >>> > >>> Afaics, the reset related concerns Tony has can be handled later. > >>> > >> hmm, and there we need Stephen's opinion about having the allow/deny > >> autoidle functions in the main clk_ops struct. > >> > > > > I have unanswered questions on the list for this thread[1]. > > The reset portion we can't answer with the current knowledge I fear, we > need to prototype this a bit first and see which way to go. > > > I'm not sure > > what allow/deny autoidle functions mean to clk drivers. It looks like an > > OMAP specific addition to the clk_ops struct, which sounds wrong to put > > it plainly. > > Yeah, I don't think other SoCs implement the same functionality, at > least not in the same way. The autoidle bits are available in > omap2/omap3 only, where they control the HW autoidle functionality of > these clocks. If the bit is enabled, the HW can autonomously disable the > clock once it is not needed anymore by HW. Some qcom chips have automatic clock gating (basically hw clk gating) but they don't really need to involve that with the reset asserting or deasserting anymore. It used to be that they had to turn off the automatic mode, assert the reset, deassert the reset, and then reenable the automatic mode. So there is some precedence for this. But again, I think that the reset controller and the clk controller are the same device in both vendor instances so in theory the driver can be one driver for both clk and reset and do the proper things on the backend. So just use reset controller framework and register that from the clk controller driver? > > > Hopefully it can be done outside of the clk framework by > > having the provider driver know more things about all the frameworks > > it's hooking into. > > This is how it has been done so far, however Andreas wants to expand the > functionality a bit where it breaks... unless we can use the > CLK_IS_BASIC flag to detect if we accessing an OMAP specific clock or > not. If we are passing in a clk pointer from a consumer level API, I > don't know if there is any other way to go with this if we can't modify > the generic clk_ops struct. > > The same flag check is used across TI clock driver already btw. > Sure, it's not like this is a new problem. I'd just like to see if we can solve it now and get rid of the CLK_IS_BASIC flag now. It would be great if some extra effort could be put into it vs. punting the problem until 2020 or something.
On 12/01/2019 00:49, Stephen Boyd wrote: > Quoting Tero Kristo (2019-01-03 23:28:58) >> On 04/01/2019 01:39, Stephen Boyd wrote: >>> Quoting Andreas Kemnade (2018-12-31 00:30:21) >>>> On Mon, 31 Dec 2018 09:23:01 +0200 >>>> Tero Kristo <t-kristo@ti.com> wrote: >>>> >>>>> On 28/12/2018 22:02, Tony Lindgren wrote: >>>>>> * Andreas Kemnade <andreas@kemnade.info> [181227 20:13]: >>>>>>> Hi, >>>>>>> >>>>>>> On Tue, 4 Dec 2018 08:45:57 -0800 >>>>>>> Tony Lindgren <tony@atomide.com> wrote: >>>>>>> >>>>>>>> * Andreas Kemnade <andreas@kemnade.info> [181204 06:17]: >>>>>>>>> On Mon, 3 Dec 2018 07:39:10 -0800 >>>>>>>>> Tony Lindgren <tony@atomide.com> wrote: >>>>>>>>>> The consumer device stays active just fine with PM runtime >>>>>>>>>> calls. So yes, the problem is keeping a clock controller forced >>>>>>>>>> active for the period of consumer device reset. Other than >>>>>>>>>> that typically autoidle can be just kept enabled. >>>>>>>>>> >>>>>>>>> Are we still talking about the same problem? Maybe I am losing track >>>>>>>>> here. Just to make sure. >>>>>>>>> The patch series was about disabling autoidle for devices which cannot >>>>>>>>> work with it during normal operation. Not during reset or something >>>>>>>>> like that. >>>>>>>>> Or is the keep-clock-active-during-reset just a requirement for bigger >>>>>>>>> restructuring ideas? >>>>>>>> >>>>>>>> Yeah there are two issues: The fix needed for the issue you brought up, >>>>>>>> and also how to let a reset driver to block autoidle for reset. >>>>>>>> >>>>>>> Hmm, is this set now waiting for the famous "somebody" fixing all >>>>>>> the stuff? >>>>>> >>>>>> Well I think we're still waiting on Tero to comment on this. >>>>> >>>>> The only item requiring immediate fixing is the point Stephen made out, >>>>> removing the usage of CLK_IS_BASIC from this patch. >>>>> >>>>> Afaics, the reset related concerns Tony has can be handled later. >>>>> >>>> hmm, and there we need Stephen's opinion about having the allow/deny >>>> autoidle functions in the main clk_ops struct. >>>> >>> >>> I have unanswered questions on the list for this thread[1]. >> >> The reset portion we can't answer with the current knowledge I fear, we >> need to prototype this a bit first and see which way to go. >> >>> I'm not sure >>> what allow/deny autoidle functions mean to clk drivers. It looks like an >>> OMAP specific addition to the clk_ops struct, which sounds wrong to put >>> it plainly. >> >> Yeah, I don't think other SoCs implement the same functionality, at >> least not in the same way. The autoidle bits are available in >> omap2/omap3 only, where they control the HW autoidle functionality of >> these clocks. If the bit is enabled, the HW can autonomously disable the >> clock once it is not needed anymore by HW. > > Some qcom chips have automatic clock gating (basically hw clk gating) > but they don't really need to involve that with the reset asserting or > deasserting anymore. It used to be that they had to turn off the > automatic mode, assert the reset, deassert the reset, and then reenable > the automatic mode. So there is some precedence for this. But again, I > think that the reset controller and the clk controller are the same > device in both vendor instances so in theory the driver can be one > driver for both clk and reset and do the proper things on the backend. > So just use reset controller framework and register that from the clk > controller driver? > >> >>> Hopefully it can be done outside of the clk framework by >>> having the provider driver know more things about all the frameworks >>> it's hooking into. >> >> This is how it has been done so far, however Andreas wants to expand the >> functionality a bit where it breaks... unless we can use the >> CLK_IS_BASIC flag to detect if we accessing an OMAP specific clock or >> not. If we are passing in a clk pointer from a consumer level API, I >> don't know if there is any other way to go with this if we can't modify >> the generic clk_ops struct. >> >> The same flag check is used across TI clock driver already btw. >> > > Sure, it's not like this is a new problem. I'd just like to see if we > can solve it now and get rid of the CLK_IS_BASIC flag now. It would be > great if some extra effort could be put into it vs. punting the problem > until 2020 or something. Ok, let me see if I can figure out something for this... -Tero -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c index 161f67850393..5bdae5552d38 100644 --- a/drivers/clk/ti/autoidle.c +++ b/drivers/clk/ti/autoidle.c @@ -54,8 +54,12 @@ static DEFINE_SPINLOCK(autoidle_spinlock); int omap2_clk_deny_idle(struct clk *clk) { struct clk_hw_omap *c; + struct clk_hw *hw = __clk_get_hw(clk); - c = to_clk_hw_omap(__clk_get_hw(clk)); + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) + return -EINVAL; + + c = to_clk_hw_omap(hw); if (c->ops && c->ops->deny_idle) { unsigned long irqflags; @@ -77,8 +81,12 @@ int omap2_clk_deny_idle(struct clk *clk) int omap2_clk_allow_idle(struct clk *clk) { struct clk_hw_omap *c; + struct clk_hw *hw = __clk_get_hw(clk); - c = to_clk_hw_omap(__clk_get_hw(clk)); + if (clk_hw_get_flags(hw) & CLK_IS_BASIC) + return -EINVAL; + + c = to_clk_hw_omap(hw); if (c->ops && c->ops->allow_idle) { unsigned long irqflags;
Code might use autoidle api with clocks not being omap2 clocks, so check if clock type is not basic Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- New in v2 --- drivers/clk/ti/autoidle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)