IMX6Q support two LCD's

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6Q support two LCD's

Jump to solution
1,985 Views
sebastianpancea
Contributor III

Hi everyone,

I'm trying to make the IMX6Q display data on two LCD displays but only one works.

I'm using 3.10.62 kernel.

The display that works is connected to IPU2 (ipu1 in device tree) and the one that doesn't work is connected to IPU1 (ipu0 in device tree).

The device tree looks like this:

aliases {
mxcfb0 = &lcd_display;
lcd_display = &lcd_display;
mxcfb1 = &lcd_display1;
lcd_display1 = &lcd_display1;
};

lcd_display: fb@0 {
compatible = "fsl,mxc_sdc_fb";
disp_dev = "lcd";
interface_pix_fmt = "RGB666";
mode_str = "800x480@60";
default_bpp = <32>;
int_clk = <0>;
late_init = <0>;
status = "okay";
};

lcd_display1: fb@1 {
compatible = "fsl,mxc_sdc_fb";
disp_dev = "lcd";
interface_pix_fmt = "RGB666";
mode_str = "800x480@60";
default_bpp = <32>;
int_clk = <0>;
late_init = <1>;
status = "okay";
};

lcd: lcd@0 {
compatible = "fsl,lcd";
ipu_id = <1>;
disp_id = <0>;
default_ifmt = "RGB24";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu2_1 &pinctrl_lcd0_1>;
status = "okay";
};

lcd1: lcd@1{
compatible = "fsl,lcd";
ipu_id = <0>;
disp_id = <0>;
default_ifmt = "RGB24";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ipu1_4>;
status = "okay";

};

The problem that I'm facing is that when mxcfb registers, it says that ipu1-di0 is already taken.

[    1.849931] mxc_sdc_fb fb.14: di_pixfmt:0x33424752, bpp:0x20, di:0, ipu:1

[    1.971470] mxc_sdc_fb fb.15: di_pixfmt:0x36424752, bpp:0x20, di:0, ipu:1

[    1.971484] mxc_sdc_fb fb.15: ipu1-di0 already in use

[    1.971514] mxc_sdc_fb: probe of fb.15 failed with error -16

I traced the problem to the lcdif_init() function in mxc_lcdif.c file.

This function is called 2 times at fb driver probe, each time for each fb that I'm adding.

Here, the ipu_ids that are retrieved should be 1 first time, and 0 second time, but for both times the value 1 is retrieved.

The function calls that lead to this are the following: mxcfb_dispdrv_init() -> mxc_dispdrv_gethandle() ->  lcdif_init() -> mxc_dispdrv_getdata().

Is this a kernel bug or am I doing something wrong?

Thank you!

Labels (5)
0 Kudos
1 Solution
1,335 Views
sebastianpancea
Contributor III

Hi Artur,

I have two LCD displays connected on the parallel interface.

I never saw anyone using two parallel LCD's simultaneously on a board with IMX6 SoC. 

The examples you pointed me to show a combination of hdmi, lvds, LCD but nothing about 2 LCDs working simultaneously.

I have the sensation that this scenario was never tested.

The problem is that when the second fb registers it says that the ipu is already in use.

I did some search in kernel on why this problem occurs and I found an answer.

The problem seems to be in the "mxc_dispdrv.c" source at the function "mxc_dispdrv_gethandle".

I made a patch that now allows the fb to register both LCD interfaces, on the correct IPU's.

diff --git a/drivers/video/mxc/mxc_dispdrv.c b/drivers/video/mxc/mxc_dispdrv.c

index 5193c7d..5682df4 100644

--- a/drivers/video/mxc/mxc_dispdrv.c

+++ b/drivers/video/mxc/mxc_dispdrv.c

struct mxc_dispdrv_handle *mxc_dispdrv_gethandle(char *name,

        struct mxc_dispdrv_setting *setting)

{

        int ret, found = 0;

        struct mxc_dispdrv_entry *entry;

        mutex_lock(&dispdrv_lock);

        list_for_each_entry(entry, &dispdrv_list, list) {

+               if(entry->active == true)

+                       continue;

                if (!strcmp(entry->drv->name, name) && (entry->drv->init)) {

                        ret = entry->drv->init((struct mxc_dispdrv_handle *)

                                entry, setting);

                        if (ret >= 0) {

                                entry->active = true;

                                found = 1;

                                break;

                        }

                }

        }

        mutex_unlock(&dispdrv_lock);

        return found ? (struct mxc_dispdrv_handle *)entry:ERR_PTR(-ENODEV);

}

It seems that before applying the patch, the same entry from the list was retrieved every time the funcion was called and the loop was breaking.

This was the cause of the error of ipu already in use.

I did not managed yet to make the second LCD display work since I have another problem with it but I expect it to work.
I will provide further information when I will have it.

Thank you!

View solution in original post

5 Replies
1,335 Views
art
NXP Employee
NXP Employee

Not sure about 3.10.62 kernel, but in L3.14.28 BSP the dual display support feature is implemented by default. To make it work, you have first to specify the display interfaces to use in the kernel command line as shown in the Table 11 of the Release Notes document attached. Then, the various display use cases are described in the Chapter 7 "Multimedia" of the User's Guide document attached.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,336 Views
sebastianpancea
Contributor III

Hi Artur,

I have two LCD displays connected on the parallel interface.

I never saw anyone using two parallel LCD's simultaneously on a board with IMX6 SoC. 

The examples you pointed me to show a combination of hdmi, lvds, LCD but nothing about 2 LCDs working simultaneously.

I have the sensation that this scenario was never tested.

The problem is that when the second fb registers it says that the ipu is already in use.

I did some search in kernel on why this problem occurs and I found an answer.

The problem seems to be in the "mxc_dispdrv.c" source at the function "mxc_dispdrv_gethandle".

I made a patch that now allows the fb to register both LCD interfaces, on the correct IPU's.

diff --git a/drivers/video/mxc/mxc_dispdrv.c b/drivers/video/mxc/mxc_dispdrv.c

index 5193c7d..5682df4 100644

--- a/drivers/video/mxc/mxc_dispdrv.c

+++ b/drivers/video/mxc/mxc_dispdrv.c

struct mxc_dispdrv_handle *mxc_dispdrv_gethandle(char *name,

        struct mxc_dispdrv_setting *setting)

{

        int ret, found = 0;

        struct mxc_dispdrv_entry *entry;

        mutex_lock(&dispdrv_lock);

        list_for_each_entry(entry, &dispdrv_list, list) {

+               if(entry->active == true)

+                       continue;

                if (!strcmp(entry->drv->name, name) && (entry->drv->init)) {

                        ret = entry->drv->init((struct mxc_dispdrv_handle *)

                                entry, setting);

                        if (ret >= 0) {

                                entry->active = true;

                                found = 1;

                                break;

                        }

                }

        }

        mutex_unlock(&dispdrv_lock);

        return found ? (struct mxc_dispdrv_handle *)entry:ERR_PTR(-ENODEV);

}

It seems that before applying the patch, the same entry from the list was retrieved every time the funcion was called and the loop was breaking.

This was the cause of the error of ipu already in use.

I did not managed yet to make the second LCD display work since I have another problem with it but I expect it to work.
I will provide further information when I will have it.

Thank you!

1,335 Views
sebastianpancea
Contributor III

Hi Artur,

Even though the fb's are now loading on the correct IPU and DI I still can't use the two LCD displays simultaneously.

Does my suggested patch looks OK to you?

Thank you!

0 Kudos
1,335 Views
aznjaput
Contributor III

Hi Sebastian,

I have the exact same issue. I have a board driving two LCD displays simultaneously and tracked the issue down to mxc_dispdrv_gethandle(). I was wondering if you ever achieved a solution aside from the patch you posted.

Thanks,

0 Kudos
1,335 Views
sebastianpancea
Contributor III

Hi Aznjaput,

The patch I posted was the solution that made both my LCD displays work.

This seems to be a Freescale kernel bug but I don't know if in the future it will be fixed.

Regards!

0 Kudos