linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* clk: clk_register is deprecated
@ 2020-04-30 12:24 Jerome Brunet
  2020-05-04 17:16 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Jerome Brunet @ 2020-04-30 12:24 UTC (permalink / raw)
  To: Stephen Boyd, Martin Blumenstingl, ulf.hansson; +Cc: linux-amlogic, linux-clk

Hi Stephen,

We have a question regarding drivers which register clocks in CCF and
later need to use these clocks.

So far, these drivers had been using clk_register() to get a 'struct
clk*' they could later use with the linux/clk.h API.

Now that this clk_register() is deprecated in favor of
clk_hw_register(), how are these driver supposed to get the per-user
"struct clk*" they need ?

In this mmc thread [0] Martin proposed to go through a provider. I think
it is overkill, especially for a device which will not provide its clocks
to any other device.

They other way available is "hw->clk". I suspect it is not recommended
to do so, is it ?

If not, what would be the recommended way to get the "struct clk*" from
a newly registered "struct clk_hw *" ? Should we add something new to
clk-provider.h API ?

Cheers
Jerome

[0]: https://lore.kernel.org/linux-amlogic/20200428210229.703309-3-martin.blumenstingl@googlemail.com

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk: clk_register is deprecated
  2020-04-30 12:24 clk: clk_register is deprecated Jerome Brunet
@ 2020-05-04 17:16 ` Stephen Boyd
  2020-05-05 16:03   ` Jerome Brunet
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2020-05-04 17:16 UTC (permalink / raw)
  To: Jerome Brunet, Martin Blumenstingl, ulf.hansson; +Cc: linux-amlogic, linux-clk

Quoting Jerome Brunet (2020-04-30 05:24:41)
> Hi Stephen,
> 
> We have a question regarding drivers which register clocks in CCF and
> later need to use these clocks.
> 
> So far, these drivers had been using clk_register() to get a 'struct
> clk*' they could later use with the linux/clk.h API.
> 
> Now that this clk_register() is deprecated in favor of
> clk_hw_register(), how are these driver supposed to get the per-user
> "struct clk*" they need ?
> 
> In this mmc thread [0] Martin proposed to go through a provider. I think
> it is overkill, especially for a device which will not provide its clocks
> to any other device.
> 
> They other way available is "hw->clk". I suspect it is not recommended
> to do so, is it ?
> 
> If not, what would be the recommended way to get the "struct clk*" from
> a newly registered "struct clk_hw *" ? Should we add something new to
> clk-provider.h API ?
> 

Yes we should add a clk_hw_get_clk() API that takes a device pointer and
a string name, mirroring the clk_get() API but cutting out the part
where we have to go through the provider to find it.

This is so that one day in "the future" we can remove hw->clk and make
that an internal detail that struct clk_hw can't see because we go
through the clk_hw::clk_core pointer instead.

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk: clk_register is deprecated
  2020-05-04 17:16 ` Stephen Boyd
@ 2020-05-05 16:03   ` Jerome Brunet
  2020-05-05 19:10     ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Jerome Brunet @ 2020-05-05 16:03 UTC (permalink / raw)
  To: Stephen Boyd, Martin Blumenstingl, ulf.hansson; +Cc: linux-amlogic, linux-clk


On Mon 04 May 2020 at 19:16, Stephen Boyd <sboyd@kernel.org> wrote:

> Quoting Jerome Brunet (2020-04-30 05:24:41)
>> Hi Stephen,
>> 
>> We have a question regarding drivers which register clocks in CCF and
>> later need to use these clocks.
>> 
>> So far, these drivers had been using clk_register() to get a 'struct
>> clk*' they could later use with the linux/clk.h API.
>> 
>> Now that this clk_register() is deprecated in favor of
>> clk_hw_register(), how are these driver supposed to get the per-user
>> "struct clk*" they need ?
>> 
>> In this mmc thread [0] Martin proposed to go through a provider. I think
>> it is overkill, especially for a device which will not provide its clocks
>> to any other device.
>> 
>> They other way available is "hw->clk". I suspect it is not recommended
>> to do so, is it ?
>> 
>> If not, what would be the recommended way to get the "struct clk*" from
>> a newly registered "struct clk_hw *" ? Should we add something new to
>> clk-provider.h API ?
>> 
>
> Yes we should add a clk_hw_get_clk() API that takes a device pointer and
> a string name, mirroring the clk_get() API but cutting out the part
> where we have to go through the provider to find it.

We will try to propose something for clk_hw_get_clk() soon.
If we do so, could we "UN-deprecate" clk_register() and make it a
wrapper around clk_hw_register() and clk_hw_get_clk() ?

It would make it easier on drivers which both register and use clocks.

To get a short term solution for Martin and his MMC driver:
-  If the above wrapper is OK and we commit on doing it soon, would you
   also be OK for martin to use clk_register() in his MMC driver (now) ?

-  If not, could we use clk_hw->clk until  we have clk_hw_get_clk() in
   CCF ?

>
> This is so that one day in "the future" we can remove hw->clk and make
> that an internal detail that struct clk_hw can't see because we go
> through the clk_hw::clk_core pointer instead.

Yes, I know it is your secret plan ... ;)




_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: clk: clk_register is deprecated
  2020-05-05 16:03   ` Jerome Brunet
@ 2020-05-05 19:10     ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-05-05 19:10 UTC (permalink / raw)
  To: Jerome Brunet, Martin Blumenstingl, ulf.hansson; +Cc: linux-amlogic, linux-clk

Quoting Jerome Brunet (2020-05-05 09:03:21)
> 
> On Mon 04 May 2020 at 19:16, Stephen Boyd <sboyd@kernel.org> wrote:
> 
> > Quoting Jerome Brunet (2020-04-30 05:24:41)
> >> 
> >> If not, what would be the recommended way to get the "struct clk*" from
> >> a newly registered "struct clk_hw *" ? Should we add something new to
> >> clk-provider.h API ?
> >> 
> >
> > Yes we should add a clk_hw_get_clk() API that takes a device pointer and
> > a string name, mirroring the clk_get() API but cutting out the part
> > where we have to go through the provider to find it.
> 
> We will try to propose something for clk_hw_get_clk() soon.
> If we do so, could we "UN-deprecate" clk_register() and make it a
> wrapper around clk_hw_register() and clk_hw_get_clk() ?
> 
> It would make it easier on drivers which both register and use clocks.
> 
> To get a short term solution for Martin and his MMC driver:
> -  If the above wrapper is OK and we commit on doing it soon, would you
>    also be OK for martin to use clk_register() in his MMC driver (now) ?
> 
> -  If not, could we use clk_hw->clk until  we have clk_hw_get_clk() in
>    CCF ?

Using clk_hw->clk until we have clk_hw_get_clk() is fine for now.
Various drivers do that already and I hope that a simple coccinelle
script can figure out how to convert that to the new function.l Is it
much work to introduce this API now? I thought it would be fairly simple
to do it but I haven't looked deeply.

> 
> >
> > This is so that one day in "the future" we can remove hw->clk and make
> > that an internal detail that struct clk_hw can't see because we go
> > through the clk_hw::clk_core pointer instead.
> 
> Yes, I know it is your secret plan ... ;)
> 
> 

Hehe

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-05 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 12:24 clk: clk_register is deprecated Jerome Brunet
2020-05-04 17:16 ` Stephen Boyd
2020-05-05 16:03   ` Jerome Brunet
2020-05-05 19:10     ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).