tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: clk_set_parent() by name ?



On Mon, Mar 19, 2018 at 05:20:45PM -0300, Jared McNeill wrote:
> I see what you mean now. The issue I have with clk_set_parent_byname is that
> it pushes internals of the clk provider into device drivers. The names are
> arbitrary and not consistent across ccu drivers, only really meant for
> printing/debugging etc.

Yes I understant that.
On the other hand, the clock hierarchy knowledge in the display's driver
is also quise soc-specific.

> 
> If you're using static clock parents, you can just initialize them in your
> ccu driver's attach function.
> 
> If you need to dynamically adjust clock parents, do you have enough context
> in the ccu driver on a clk_set_rate call to auto-select the correct parent?

unfortunably no, not in all case.
In allwinner/, the debe clocks are hardcoded to use pll5 as parent,
we could probably do the same in sunxi.

the video0/video1 clocks depends on the video mode, they will have to be setup
either in the hdmi when we're using hdmi (this is where we know the video
mode), or directly in the tcon when using the LCD outputs.
But when using tcon without hdmi we have to reference to the video0/video1
clocks in the device tree.

Maybe there would be one way to avoid referencing arbitrary clocks
(and the need for a clk_set_parent_byname()): add a
struct clk * clk_get_parent_byindex(struct clk *, int)
which would allow enumerating the possible parents of a clk.
I think this would work for me.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index