On Tue, 26 Dec 2023 19:00:58 -0800 (PST)
"K. James" <kirby.nankiv...@gmail.com> wrote:

Hi,

please try to avoid HTML email on lists, that makes it hard to reply
inline and messes up the text view - and there is little need to provide
links to every identifier anyway.

> Hi All,
> 
> Been working on getting T113-s3 on mainline as I prepare to update a 
> project from a v3s. One of the benefits has been the ability to move from a 
> 18bit RGB LCD to a MIPI-DSI display, with the interface available on the 
> T113-s3 , which has given some better display choices.
> 
> The DSI driver was on mainline from 6.2, however building from sources on 
> init I am getting the following error:
> 
> *"sun6i-mipi-dsi 5450000.dsi: Couldn't get the DSI mod clock"*
> 
> Its tripping at the following init in sun6i_mipi_dsi.c 
> <https://elixir.bootlin.com/linux/v6.6.2/source/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c#L1155>
> 
> 
> if (variant-> has_mod_clk) { 
>       dsi->mod_clk = devm_clk_get(dev, "mod"); 
>       if (IS_ERR (dsi->mod_clk)) {
>               dev_err(dev, "Couldn't get the DSI mod clock\n");
>               ret = PTR_ERR(dsi->mod_clk);
>               goto err_attach_clk;
>}

But since this comes from the DSI driver, this refers to the DT node of
the DSI device, not the DE2 clock, doesn't it?

> The display modclock is registered from the following DTS node in 
> sunxi-d1s-t113.dtsi 
> <https://elixir.bootlin.com/linux/v6.6.2/source/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi#L641>
> 
> 
> display_clocks: clock-controller@5000000 {
>       compatible = "allwinner,sun20i-d1-de2-clk",
>                    "allwinner,sun50i-h5-de2-clk";
>       reg = <0x5000000 0x10000>;
>       clocks = <&ccu CLK_BUS_DE>, <&ccu CLK_DE>;
>       clock-names = "bus", *"mod"*;
>       resets = <&ccu RST_BUS_DE>;
>       #clock-cells = <1>;
>       #reset-cells = <1>;
> };

So those are the clocks from:
dsi: dsi@5450000 {
                ...
                clocks = <&ccu CLK_BUS_MIPI_DSI>,
                         <&tcon_top CLK_TCON_TOP_DSI>;
                clock-names = "bus", "mod";
                ...
};

So the "mod" clock here points to the tcon_top device, the one with the
"allwinner,sun20i-d1-tcon-top" compatible string. Which is implemented
by drivers/gpu/drm/sun4i/sun8i_tcon_top.c, controlled by the
DRM_SUN8I_TCON_TOP Kconfig symbol. Do you have that enabled?

You can check /sys/kernel/debug/clk/clk_summary (with debugfs mounted)
to see what clocks are there and how they are used.

Cheers,
Andre

> I checked the buildroot config and the CCU for sun8i DE2 is being
> built and included, the registration should occur and give an
> exception if it's not happening: ccu-sun8i-de2.c 
> <https://elixir.bootlin.com/linux/v6.6.2/source/drivers/clk/sunxi-ng/ccu-sun8i-de2.c#L263>
> 
> mod_clk <https://elixir.bootlin.com/linux/v6.6.2/C/ident/mod_clk> = 
> devm_clk_get
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/devm_clk_get>(
> &pdev->dev, "mod"); if (IS_ERR
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/IS_ERR>(mod_clk
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/mod_clk>)) return
> dev_err_probe
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/dev_err_probe>(&pdev->dev,
> PTR_ERR
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/PTR_ERR>(mod_clk
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/mod_clk>), "Couldn't
> get mod clk\n");
> 
> ret = clk_prepare_enable 
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/clk_prepare_enable>(mod_clk 
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/mod_clk>); if (ret)
> { dev_err
> <https://elixir.bootlin.com/linux/v6.6.2/C/ident/dev_err>(&pdev->dev
> , "Couldn't enable mod clk: %d\n", ret); goto err_disable_bus_clk; }
> 
> I don't see dmesg print any clock errors, but at the same time, I 
> understand that linux common clock framework also won't print
> anything by default.
> 
> I can't see anything in either driver that would cause an error other
> than the clock not existing, if anyone has any ideas - i'm all ears. 
> 
> At the moment I am leaning towards the clock-controller; Is there a 
> userspace or debug option to check (mod) clock status' under the
> common clock framework?
> 
> Thanks
> 

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20231227232842.5c1c9ed8%40minigeek.lan.

Reply via email to