Page 1 of 3

Dual lvds with different frequencies

Posted: Wed Mar 21, 2018 4:38 pm
by nvilaca
We're trying to use 2 different displays, with different frequencies, in separate-mode.

We set both channels like this:

Code: Select all

&ldb {
   lvds-channel@0 {
      crtc = "ipu1-di0";
      fsl,data-mapping = "spwg";
      fsl,data-width = <24>;
      status = "okay";
      display-timings {
      native-mode = <&timing0>;
      timing0: lcd12 {
         clock-frequency = <40000000>;
         hactive = <800>;
         vactive = <600>;
         hback-porch = <88>;
         hfront-porch = <40>;
         vback-porch = <23>;
         vfront-porch = <39>;
         hsync-len = <128>;
         vsync-len = <4>;
         bpp = <24>;
       };
      };         
   };
   lvds-channel@1 {
      crtc = "ipu1-di1";
      fsl,data-mapping = "spwg";
      fsl,data-width = <24>;
      status = "okay";
      display-timings {
      native-mode = <&timing7>;
      timing7: lcd7 {
          clock-frequency = <51206400>;
          hactive = <1024>;
          vactive = <600>;
          hback-porch = <140>;
          hfront-porch = <160>;
          vback-porch = <20>;
          vfront-porch = <12>;
          hsync-len = <20>;
          vsync-len = <3>;
       };
      };
   };
};


Everything in the lvds1 display is correct except for the frequency, that is set (and measured) at 40Mhz, same as lvds0.
How can we set a different frequency for the lvds1 channel? Should we set a different clock? How do we do that?

EDIT: We are using VAR-SOM-SOLO/DUAL.

Re: Dual lvds with different frequencies

Posted: Wed Mar 21, 2018 4:48 pm
by varigigi
Hi,
which SOM and BSP version are we talking about?
BR
Pier

Re: Dual lvds with different frequencies

Posted: Wed Mar 21, 2018 5:00 pm
by nvilaca
VSM-DUAL-210, but same on solo modules.
Poky-daisy, kernel imx_3.10.53_1.1.0_ga_var01, but I think is happening the same on a newer BSP, on poky-morty. I'll check it as soon as I can.

Re: Dual lvds with different frequencies

Posted: Wed Mar 21, 2018 5:25 pm
by varigigi
Hi,
and which is the output of command:
cat /proc/cmdline
BR
Pier

Re: Dual lvds with different frequencies

Posted: Thu Mar 22, 2018 9:18 am
by nvilaca
It happens despite of the kernel parameters. We are trying to debug it on an image where the parameters are default

Code: Select all

console=ttymxc0,115200 video=mxcfb0:dev=ldb consoleblank=0 quiet debug
but same happens on our production image

Code: Select all

console=ttymxc0,115200 ubi.mtd=3 video=mxcfb0:dev=ldb,bpp=24 video=mxcfb1:dev=ldb,bpp=24 root=ubi0:rootfs rootfstype=ubifs consoleblank=0 logo.nologo


Like I said both displays are working fine, with the correct resolution (800x600 for the first and 1024x600 for the second), only the frequency is wrong.

Debugging the imx-ipuv3 driver we get:

Code: Select all

imx-ipuv3 2400000.ipu: dev 0 panel size = 800 x 600
imx-ipuv3 2400000.ipu: pixel clk = 40000000
imx-ipuv3 2400000.ipu: use special clk parent
imx-ipuv3 2400000.ipu: round pixel clk:39999998
imx-ipuv3 2400000.ipu: div:1


Code: Select all

imx-ipuv3 2400000.ipu: dev 1 panel size = 1024 x 600
imx-ipuv3 2400000.ipu: pixel clk = 51205000
imx-ipuv3 2400000.ipu: use special clk parent
imx-ipuv3 2400000.ipu: round pixel clk:39999998
imx-ipuv3 2400000.ipu: div:1
imx-ipuv3 2400000.ipu: IPU DMFC DC HIGH RESOLUTION: 1(0~3), 5B(4,5), 5F(6,7)


The ipu driver gets the correct frequency but it's setting a different clock.

Re: Dual lvds with different frequencies

Posted: Thu Mar 22, 2018 10:37 am
by varigigi
Hi,
from your debug output, I can see that the clock setting is correctly received by the ipu driver, but somehow the clock is "rounded" to 39999999 in both the cases.
It looks that the problem is not relates to the dts, but to the clock tree: most likely, if you swap the display order, you wil get the 51MHZ for both of them.
Recent kernel 4.9 has a quite different clock tree: I would suggest to check against latest Rocko BSP.
BR
Pier

Re: Dual lvds with different frequencies

Posted: Thu Mar 22, 2018 5:06 pm
by nvilaca
Just tried with another version we are working on, poky morty with kernel imx-rel_imx_4.1.15_1.1.0_ga-var02. Same result, same output.

I'm not sure if we are able to move to Rocko right now, so i would rather get a fix/workaround for this latest version on Morty. Do you have any suggestion?

Re: Dual lvds with different frequencies

Posted: Thu Mar 22, 2018 7:11 pm
by varigigi
Hi,
could you please apply the following patch and post the debug messages in both the cases when the display frequency is correctly set and when not?
BR
Pier

--- a/drivers/mxc/ipu3/ipu_disp.c
+++ b/drivers/mxc/ipu3/ipu_disp.c
@@ -1112,6 +1112,7 @@ int32_t ipu_init_sync_panel(struct ipu_soc *ipu, int disp, uint32_t pixel_clk,
!strcmp(__clk_get_name(di_parent), __clk_get_name(ldb_di1_clk))) {
/* if di clk parent is tve/ldb, then keep it;*/
dev_dbg(ipu->dev, "use special clk parent\n");
+ dev_dbg(ipu->dev, "parent %s, rate %lu\n", __clk_get_name(di_parent), clk_get_rate(di_parent));
ret = clk_set_parent(ipu->pixel_clk_sel[disp], ipu->di_clk[disp]);
if (ret) {
dev_err(ipu->dev, "set pixel clk error:%d\n", ret);

Re: Dual lvds with different frequencies

Posted: Fri Mar 23, 2018 9:17 am
by nvilaca

Code: Select all

imx-ipuv3 2400000.ipu: panel size = 800 x 600
imx-ipuv3 2400000.ipu: pixel clk = 40000000
imx-ipuv3 2400000.ipu: use special clk parent
imx-ipuv3 2400000.ipu: parent ldb_di0, rate 39999999
imx-ipuv3 2400000.ipu: round pixel clk:39999999
imx-ipuv3 2400000.ipu: div:1


Code: Select all

imx-ipuv3 2400000.ipu: panel size = 1024 x 600
imx-ipuv3 2400000.ipu: pixel clk = 51205000
imx-ipuv3 2400000.ipu: use special clk parent
imx-ipuv3 2400000.ipu: parent ldb_di1, rate 39999999
imx-ipuv3 2400000.ipu: round pixel clk:39999999
imx-ipuv3 2400000.ipu: div:1
imx-ipuv3 2400000.ipu: IPU DMFC DC HIGH RESOLUTION: 1(0~3), 5B(4,5), 5F(6,7)

Re: Dual lvds with different frequencies

Posted: Fri Mar 23, 2018 9:32 am
by varigigi
Hi,
thanks for the logs.
What happens to the logs if you only declare the bigger LCD?
Always 40 MHz?
BR
Pier