On 10/23/2024, Marek Vasut wrote: > On 10/22/24 7:59 AM, Liu Ying wrote: > > [...] > >>>> Anyway, I don't think it is necessary to manage the clk_set_rate() >>>> function calls between this driver and mxsfb_kms or lcdif_kms >>>> because "video_pll1" clock rate is supposed to be assigned in DT... >>> >>> I disagree with this part. I believe the assignment of clock in DT is only a temporary workaround which should be removed. The drivers should be able to figure out and set the clock tree configuration. >> >> I think the clock rate assignment in DT is still needed. >> A good reason is that again we need to share one video PLL >> between MIPI DSI and LDB display pipelines for i.MX8MP. > > You don't really need to share the Video PLL , you can free up e.g. PLL3 and use it for one video output pipeline, and use the Video PLL for the other video pipeline, and then you get accurate pixel clock in both pipelines. I need to share the video PLL. PLL3 is used as audio AXI's parent in NXP downstream kernel for i.MX8MP EVK(Nominal Drive Mode) and derives a audio AXI clock running at 600MHz which is the nominal audio AXI clock rate mentioned in i.MX8MP chip data sheet. https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk-ndm.dts#L19 https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-ddr4-evk.dts#L25 Upstream kernel currently uses PLL1 800M as audio AXI's parent. Although audio AXI clock is assigned to 600MHz, the actual rate reported by clock summary is 400MHz(not the nominal rate). So, audio AXI clock's parent is supposed to be changed to PLL3. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/freescale/imx8mp.dtsi?h=v6.12-rc4#n815 sys_pll1_ref_sel 1 1 0 24000000 0 0 50000 Y deviceless no_connection_id sys_pll1 1 1 0 800000000 0 0 50000 Y deviceless no_connection_id sys_pll1_bypass 1 1 0 800000000 0 0 50000 Y deviceless no_connection_id sys_pll1_out 4 4 0 800000000 0 0 50000 Y deviceless no_connection_id sys_pll1_800m 5 6 0 800000000 0 0 50000 Y deviceless no_connection_id audio_axi 1 1 0 400000000 0 0 50000 Y power-domain@5 no_connection_id deviceless no_connection_id audio_axi_root 0 0 0 400000000 0 0 50000 Y deviceless no_connection_id All other clocks in imx8mp_media_disp_pix_sels[] are not appropriate to be used by display pipelines, except "video_pll1_out", at least for i.MX8MP EVK. > >>>>>> The idea is to assign a reasonable PLL clock rate in DT to make >>>>>> display drivers' life easier, especially for i.MX8MP where LDB, >>>>>> Samsung MIPI DSI may use a single PLL at the same time. >>>>> I would really like to avoid setting arbitrary clock in DT, esp. if it can be avoided. And it surely can be avoided for this simple use case. >>>> >>>> ... just like I said in patch 1/2, "video_pll1" clock rate needs >>>> to be x2 "media_ldb" clock rate for dual LVDS link mode. Without >>>> an assigned "video_pll1" clock rate in DT, this driver cannot >>>> achieve that. >>> >>> This is something the LDB driver can infer from DT and configure the clock tree accordingly. >> >> Well, the LDB driver only controls the "ldb" clock rate. It doesn't >> magically set the parent "video_pll1" clock's rate to 2x it's rate, >> unless the driver gets "video_pll1_out" clock by calling >> clk_get_parent() and directly controls the PLL clock rate which >> doesn't look neat. > > It isn't nice, but it actually may solve this problem, no ? Not nice, but it may actually call clk_set_rate() directly for "video_pll1_out". > >>>> And, the i.MX8MP LDB + Samsung MIPI DSI case is >>>> not simple considering using one single PLL and display modes >>>> read from EDID. >>> You could use separate PLLs for each LCDIF scanout engine in such a deployment, I already ran into that, so I am aware of it. That is probably the best way out of such a problem, esp. if accurate pixel clock are the requirement. >> >> I cannot use separate PLLs for the i.MX8MP LDB and Samsung MIPI >> DSI display pipelines on i.MX8MP EVK, because the PLLs are limited >> resources and we are running out of it. Because LDB needs the pixel >> clock and LVDS serial clock to be derived from a same PLL, the only >> valid PLLs(see imx8mp_media_disp_pix_sels[] and >> imx8mp_media_ldb_sels[]) are "video_pll1_out", "audio_pll2_out", >> "sys_pll2_1000m" and "sys_pll1_800m". All are used as either audio >> clock or system clocks on i.MX8MP EVK, except "video_pll1_out". > > Could you use Video PLL for LDB and PLL3 for DSI then ? No, I can't, as I explained above - PLL3 is supposed to be used as audio AXI clock's parent to achieve the nominal 600MHz clock rate for audio AXI clock. > > I think this could still be configurable per board, it shouldn't be such that one board which attempts to showcase everything would prevent other boards with specific requirements from achieving those. You probably may set "ldb" clock rate in this driver and additionally/un-nicely set it's parent clock rate(the video PLL rate for i.MX8MP) for dual-link LVDS use cases. But, due to the shared PLL, it doesn't look ok to set CLK_SET_RATE_PARENT flag for "media_ldb" as patch 1 does. > >> You probably may use separate PLLs for a particular i.MX8MP platform >> with limited features, but not for i.MX8MP EVK which is supposed to >> evaluate all SoC features. > Right, that, exactly. > > [...] > -- Regards, Liu Ying