Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: clk_set_parent() by name ?
On Mon, 19 Mar 2018, Manuel Bouyer wrote:
Looking at what we have now, I see 2 ways for doing this:
- clk_set_parent(). But this one takes a "struct clk*" as parent,
and I don't have this handy in the driver. There is clk_get(), but it
need the ckock domain, which I also don't have it in the driver.
There is no clk_get_domain()
- clk->set_parent(), which takes a clock name. But for this I need to
use a struct sunxi_ccu_clk * instead of struct clk *.
So what should I do to solve this ? Introduce clk_get_domain() or
clk_set_parent_byname() in sys/dev/clk/, or use struct sunxi_ccu_clk in
the sunxi drivers ?
The dt should have references to the parent clocks - the hdmi node has:
clocks = <&ccu CLK_AHB_HDMI0>, <&ccu CLK_HDMI>,
<&ccu 9>,
<&ccu 18>;
clock-names = "ahb", "mod", "pll-0", "pll-1";
So you can do something like:
struct clk *clk_hdmi = fdtbus_clock_get(phandle, "mod");
struct clk *clk_video0 = fdtbus_clock_get(phandle, "pll-0");
struct clk *clk_video1 = fdtbus_clock_get(phandle, "pll-1");
...
clk_set_parent(clk_hdmi, use_video0 ? clk_video0 : clk_video1);
Cheers,
Jared
Home |
Main Index |
Thread Index |
Old Index