How do I configure a 320x240 LCD in the Device Tree for i.MX6 Solo?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure a 320x240 LCD in the Device Tree for i.MX6 Solo?

Jump to solution
7,079 Views
natesigrist
Contributor III

So I'm lazy, or I'm hoping to benefit from kernel changes and maintenance.  It's confusing as to what the correct way to define an LCD in the device tree for Linux.  I've read the binding documentation and managed to run `fbset' to change the resolution to 320x240 along with guessing the timings.  However, this is NOT clean and gives bad LCD flicker on startup.  Also, I am still not getting the right timing settings.

I feel like I am missing something simple.  I am using Hantronic HDA350-2S LCD panel.

Is there a way to do something like the following but ALSO with SPI?

&lcdif {

    compatible = "fsl,imx6dl-lcdif";

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_lcdif_dat_0

                 &pinctrl_lcdif_ctrl_0>;

    lcd-supply = <&reg_lcd_3v3>;

    display = <&display_conf>;

    status = "okay";

    display_conf: display-0 {

        bits-per-pixel = <24>;

        bus-width = <24>;

        display-timings {

            native-mode = <&timing0>;

            timing0: timing0 {

            clock-frequency = <6500000>;

            hactive = <320>;

            vactive = <240>;

            hback-porch = <68>;

            hfront-porch = <20>;

            vback-porch = <18>;

            vfront-porch = <4>;

            hsync-len = <10>;

            vsync-len = <10>;

            hsync-active = <0>;

            vsync-active = <0>;

            de-active = <1>;

            pixelclk-active = <0>;

        };

    };

};

Labels (4)
0 Kudos
1 Solution
930 Views
natesigrist
Contributor III

Turns out I didn't need half that much.  But it would have been easier to enter the LCD properties in a device tree rather than editing the driver.  The following is what I did for a Hantronic HDA350-2S LCD panel,

Device Tree:

mxcfb2: fb@1 {

     compatible = "fsl,mxc_sdc_fb";

     disp_dev = "lcd";

     interface_pix_fmt = "RGB24";

     mode_str ="CLAA-QVGA";

     default_bpp = <24>;

     int_clk = <0>;

     late_init = <0>;

     status = "okay";

};

lcd@0 {

     compatible = "fsl,lcd";

     pinctrl-names = "default";

     pinctrl-0 = <&pinctrl_ipu1_1>;

     ipu_id = <0>;

     disp_id = <0>;

     default_ifmt = "BGR24";

     status = "okay";

};

And I modified the Kernel driver (from ArchARM sources):

static struct fb_videomode lcdif_modedb[] = {

  {

  /* 320x240 @ 56 Hz , pixel clk @ 6.5MHz */

  "CLAA-QVGA", 60, 320, 240, 153846, 68, 20, 18, 4, 1, 1,

  0,

  FB_VMODE_NONINTERLACED,

  0

},} }

View solution in original post

0 Kudos
7 Replies
930 Views
pedroruizdiaz
Contributor II

Hi Nate,

Did you find a resolution? I'm fighting with the same problem, I have a generic 800x480 Chinese display but modifying my device tree doesn't modify my blank LCD screen. Changing fbset doesn't change anything but its values. Is there a generic driver with its corresponding device tree node?

0 Kudos
931 Views
natesigrist
Contributor III

Turns out I didn't need half that much.  But it would have been easier to enter the LCD properties in a device tree rather than editing the driver.  The following is what I did for a Hantronic HDA350-2S LCD panel,

Device Tree:

mxcfb2: fb@1 {

     compatible = "fsl,mxc_sdc_fb";

     disp_dev = "lcd";

     interface_pix_fmt = "RGB24";

     mode_str ="CLAA-QVGA";

     default_bpp = <24>;

     int_clk = <0>;

     late_init = <0>;

     status = "okay";

};

lcd@0 {

     compatible = "fsl,lcd";

     pinctrl-names = "default";

     pinctrl-0 = <&pinctrl_ipu1_1>;

     ipu_id = <0>;

     disp_id = <0>;

     default_ifmt = "BGR24";

     status = "okay";

};

And I modified the Kernel driver (from ArchARM sources):

static struct fb_videomode lcdif_modedb[] = {

  {

  /* 320x240 @ 56 Hz , pixel clk @ 6.5MHz */

  "CLAA-QVGA", 60, 320, 240, 153846, 68, 20, 18, 4, 1, 1,

  0,

  FB_VMODE_NONINTERLACED,

  0

},} }

View solution in original post

0 Kudos
930 Views
LPs
Contributor III

Hi Nate,

  I'm fighting with a similar issue on imx6sx.

I'm trying to set up a display 320x240 with the same parameters as your lcd.

I followed your instruction and now I see a completely white scree at the end of kernel init, and /dev/fb0 is mounted.

What can I do now to test fb?

Thanks

0 Kudos
930 Views
jimmychan
NXP TechSupport
NXP TechSupport

For your reference, I have a qr_test.c.

Show the QR code on the display and save in a BMP file

The program can display the QR code to display via fb0. You may modify the code to ignore the QR code and simply write your own pattern.

0 Kudos
930 Views
natesigrist
Contributor III

I am also using the following,

     lcd@0 {
           compatible = "fsl,lcd";
            ipu_id = ;
           disp_id = ;
           default_ifmt = "BGR24";
           pinctrl-names = "default";
           pinctrl-0 = <&pinctrl_ipu1_1>;/*pinctrl_lcdif_dat_0
                           &pinctrl_lcdif_ctrl_0>;*/
           status = "okay";
           spics-gpios = <&gpio3 19 0>;
      };
     mxcfb1: fb@0 {
           compatible = "fsl,mxc_sdc_fb";
           disp_dev = "lcd";
           interface_pix_fmt = "BGR24";
           mode_str ="HDA350-QVGA";
           default_bpp = <24>;
           int_clk = <0>;
           late_init = <0>;
           status = "okay";
      };

lcdif doesn't seem to be working for iMX6-Solo even though it describes the connected LCD.  There are registers that can be configured for LCD as well but they are not well documented.  Anyone have any suggestions on what to do next?

Again, I get the tty login prompt but only the first 4 lines followed by a line, then blank screen, then another white line at the bottom of the screen.  Even when the display is 'stable' I still do not get a full console screen.  (I tried adjusting it using stty but this did not change anything)

0 Kudos
930 Views
jimmychan
NXP TechSupport
NXP TechSupport

According to the BSP Linux reference manual, the elcdif driver only DOTCLK mode of the ELCDIF API is tested. Is your LCD is running in DOTCLK mode? please try the DOTCLK mode first.

0 Kudos
930 Views
natesigrist
Contributor III

Where can I find more information about "DOTCLK mode" and ELCDIF API?

0 Kudos