how to add a new panel with imx8mm evk ? I got some problem

cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a new panel with imx8mm evk ? I got some problem

4,067 Views
fangkai
Contributor II

hi,

   I got a imx8mm evk board and a panel (MX8_DSI_OLED1).

   I have test the demo images , it works well.

   And I want to test my own lcd with the panel driver st7701s.And i made a connector board for it.

   steps:

   1. creat a driver file in kernel_imx\drivers\gpu\drm\panel, panel-sitronix-st7701s.c

    2. and add     obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701S) += panel-sitronix-st7701s.o   

   in Makefile under kernel_imx\drivers\gpu\drm\panel

    3. then add : in Kconfig ,also under kernel_imx\drivers\gpu\drm\panel

               config DRM_PANEL_SITRONIX_ST7701S
                     tristate "Sitronix ST7701S panel"
                     depends on OF
                     depends on DRM_MIPI_DSI
                     depends on BACKLIGHT_CLASS_DEVICE
                     help
                        Say Y here if you want to enable support for Sitronix ST7701S
                        (480x640) DSI panel.

      4.add : in kernel_imx\arch\arm64\configs\android_defconfig

               CONFIG_DRM_PANEL_SITRONIX_ST7701S=y

      5. modify: line 131  in android_build\device\fsl\imx8m\evk_8mm\BoardConfig.mk

old :

            TARGET_BOARD_DTS_CONFIG ?= imx8mm:fsl-imx8mm-evk.dtb imx8mm-mipi-panel:fsl-imx8mm-evk-rm67191.dtb imx8mm-dsd:fsl-imx8mm-evk-ak4497.dtb imx8mm-m4:fsl-imx8mm-evk-m4.dtb

new:

 TARGET_BOARD_DTS_CONFIG ?= imx8mm:fsl-imx8mm-evk.dtb imx8mm-mipi-panel:fsl-imx8mm-evk-st7701s.dtb imx8mm-dsd:fsl-imx8mm-evk-ak4497.dtb imx8mm-m4:fsl-imx8mm-evk-m4.dtb

   6. creat a dts file for st7701s

            kernel_imx\arch\arm64\boot\dts\freescale\fsl-imx8mm-evk-st7701s.dts

make with no error ,but no display on the panel.

the driver file below may:

//dsi->mode_flags |= MIPI_DSI_MODE_LPM;

when I test it is set as LP Mode, and I can get the MIPI-D0+/-  signal well .But the signal is not correct,it is incomplete, even short writes.

I don't know why.

----------------------------

Then I test the rm67191(MX8_DSI_OLED1),and I find almost all the cmds is 2 bytes short write. 

why ?

would you pls send me the panel driver file of rm67191?(not the datasheet for the panel,I have got it)

there is some error while with more the 2 bytes .

As below it is 3 bytes(in file panel-raydium-rm67191.c),and the data really sent is all 0.

/* Set tear scanline */
ret = mipi_dsi_dcs_set_tear_scanline(dsi, 0x380);
if (ret < 0) {
DRM_DEV_ERROR(dev, "Failed to set tear scanline (%d)\n", ret);
goto fail;
}

would u please tell me ,the total steps of proting a new panel for imx8mm (android)?

 

         

Labels (1)
12 Replies

51 Views
jeremie1
Contributor I

Hello everyone , 

FIXED ! st7701s LCD WORKs

We succeded bring the st7701s on linux :

  • 2 mipi-dsi lanes ( 1 clock , 2 lanes ) 
  • IMX8m Plus Soc
  • Linux ( yocto , kernel 5.4.24 )

 

The general idea was : 

  • 1° Pay attention to the rst pin level , the driver should let it HIGH when using the lcd 
  • 2° The init sequence need to be sent in LOW POWER DSI mode 
  • 3° The header and payload of each packet has to be wrote according to the driver's datasheet ->
    • 3.1° Pay attention to the Data_id in each DSI packet ! , to stick to the Data_id and low power mode we do not use " mipi_dsi_generic_write " to send the init sequence , instead we use a custom function that look like this : 

 

 

 

 

ssize_t DcsPktWrite(struct mipi_dsi_device *dsi, u8 DCS_DI, u8 Len, u8* Ptr)
{
	printk(KERN_INFO "---** BOURS **---  DcsPktWrite ENTER");
		struct mipi_dsi_msg msg; 	
		msg.channel = dsi->channel; // DSI channel from device ( 0 in most case, I think ) 
		msg.tx_buf = Ptr;       // payload to send in the DSI packet 
		msg.tx_len = Len;          // size of the payload to be sent 
		msg.flags = MIPI_DSI_MSG_USE_LPM; // only in low power mode ( init sequence has to be done in low power mode , often the case for LCD panels I think...  ) 
		//.flags =0,
		msg.type = DCS_DI; // the init sequence already give the right "DI" aka "Data ID" , of the DSI DCS protocol 
		msg.rx_len = 0;
		msg.rx_buf = NULL;
		
		

		printk(KERN_INFO "---** BOURS **---  DcsPktWrite RETURN ");
		//return 0xDEAD;
        return mipi_dsi_device_transfer(dsi,&msg);
		
}

 

 

  • 3.2° : The init sequence we got from our panel manufacturer give the Data_id code for each packet , these are : 

 

 

#define LPT_DI 0x29
#define SPT_DI 0x15  //0x23   0x15
#define DSI_GENERIC_SHORT_WRITE_1_PARAM_DI 0x13

 

 

  • 4 : send the init sequence withing a driver like the one provided by fangkai @fangkai 

Hope it will help ! 

For licence reason , we managed to creat a complete custom driver , that I connot provide here. ( sorry , working on a non open-source product ).

0 Kudos

128 Views
jeremie1
Contributor I

Hello every-one , thank you for your work and this forum. 

@fangkai 
We are also trying to add a Mipi-DSI St7701s 480x480px lcd to our custom imx8mplus board ,

the driver provided as exemple by you, fangkai is not showing any pixels on the LCD , we made some changes with no luck... 

The driver is sending data with no error to the mipi-dsi controller , but I cannot check the DSI lanes for hardware reason (I have already destroyed one board trying to probe such small contacts ).

To test the display , we try to read one st7701s register on the mipi-dsi like this:

u8 output_read[3] = {0, 0, 0};
ret = mipi_dsi_generic_read(dsi, (u8[]) {0x4}, 1, &output_read, 3);
if (ret < 0) { ... }
printk(KERN_INFO "read pixels [%x, %x, %x]", output_read[0], output_read[1], output_read[2]);

And failed with :

[ 4.483195] imx_sec_dsim_drv 32e60000.mipi_dsi: wait rx done time out

Any idea what is going wrong ? 

More info : 

We have this in the drivers/sec_dsim_drv  folder : 

root@imx8mpdee:/sys/bus/platform/drivers/imx_sec_dsim_drv/32e60000.mipi_dsi# ls
32e60000.mipi_dsi.0      driver       modalias      power       suppliers
consumers          driver_override            of_node       subsystem        uevent
 

Attached: the boot log for info. 

Any help would be greatly appreciated..

Best regard, 
Jérémie  
 

0 Kudos

1,982 Views
electronic15
Contributor III

Hello fangkai, thanks for your post and all the detailed information that you put in it, it is very helpful to me.

I'm facing the same situation you did, I have to write my own drm driver for a custom MIPI DSI panel for our board based on the imx8 mini processor. The problem is that I don't have a clue about how the panel driver (e.g. panel-sitronix-st7701s.c in your case) communicates with the uppers layers, which header file I should include, which functions and/or structures I must declare in it, etc.. Can you give a piece of advice about it or at least where to find information regards this?

Our MIPI panel has a Himax HX8394-A01 controller inside.

best regards, 

Gonzalo.

0 Kudos

2,053 Views
et0
Contributor II

Hi Fangkai, thank you for publishing your files and experience here.  I am in the same position, trying to get an ST7701S panel to work with i.MX8M (actually, Coral SoM board).  I am very interested to know if you had success...

Thanks!

 

0 Kudos

2,124 Views
nxp31
Contributor II

Thanks for your work, you did already.

I added a new display (the ORIC ORC03003N-40) using the Sitronix ST7701 driver chip  to the iMX8MM EVK.

I patched the Raydium rm67191 driver by only changing the init sequence to the manufacturer command set of the new display, adjusted the pixel clock, and corrected the number of lanes in the corresponding dts and I immediately got colored stripes shown on the display.

One important observation is that the raydium driver uses

mipi_dsi_generic_write() to send mipi commands, which is working, while mipi_dsi_dcs_write_buffer() failed with "wait payload tx done time out" or ""wait pkthdr tx done time out" errors (in kernel log) after about four successful writes.

Find patches for i.MX8MM Android 10 sources below.

Apply with

cd imx-android-10/android_build/vendor/nxp-opensource/kernel_imx

git apply 0001-add-st7701-driver-shows-stripes-not-finished.patch

cd imx-android-10/android_build/device/fsl

git apply 0001-change-mipi-display-to-st7701.patch

2,124 Views
13660284951
Contributor III

hello:did you solve this problem

i think you used rn67191 default manufacturer_cmd,which is diffrent of you lcd module.

0 Kudos

2,124 Views
fangkai
Contributor II

Hi igor,

         I'm very glad to receive your reply.

I have tried to modify the manufacturer_cmd_set[],and add some prints to show it works.

//-----------------------------------------------------------

the cmds I need to send:

unsigned char ST7701S_CMD_TABLE_BK0[]={0xFF,0x77,0x01,0x00,0x00,0x10};
unsigned char ST7701S_CMD_LNESET[]={0xC0,0x4F,0x00};

//----------------------------------------------------------

log:

...

                     Enter rad_panel_enable ...
[ 1.508806] Send cmd exit slp in rad_panel_enable.
[ 1.518847] Enter rad_panel_push_cmd_list.
[ 1.518850] current cmd lenth 6.
[ 1.518852] send 0xff 0x77.
[ 1.518872] send 0x1 0x0.
[ 1.518891] send 0x0 0x10.
[ 1.518909] current cmd lenth 3.
[ 1.518911] send 0xc0 0x4f.
[ 1.518929] send 0x0.

....

becaues the data length more than 2 ,it will be an error(I don't know why).

so all the cmds is send 2 by 2,

I don't know it works or not to the panel.

and 1st ,I should sent the cmds.

but the signals on data lane 0 is not correct,while the log seems no error.

slpout_error.jpg

and the right one on panle rm67191 is as below:  (CMD: SLP_OUT)

slpout_ok.jpg

I really need some help on how to modify the driver files.

Thank u 

0 Kudos

2,124 Views
fangkai
Contributor II

rad_default_timing

I modified it,

static const struct display_timing rad_default_timing = {
#if 0
.pixelclock = { 66000000, 132000000, 132000000 },
.hactive = { 1080, 1080, 1080 },
.hfront_porch = { 20, 20, 20 },
.hsync_len = { 2, 2, 2 },
.hback_porch = { 34, 34, 34 },
.vactive = { 1920, 1920, 1920 },
.vfront_porch = { 10, 10, 10 },
.vsync_len = { 2, 2, 2 },
.vback_porch = { 4, 4, 4 },
.flags = DISPLAY_FLAGS_HSYNC_LOW |
DISPLAY_FLAGS_VSYNC_LOW |
DISPLAY_FLAGS_DE_LOW |
DISPLAY_FLAGS_PIXDATA_NEGEDGE,
#else
.pixelclock = { 24000000, 24000000, 24000000 },//Hz : htotal*vtotal*60 = 23 908 800 Hz
.hactive = { 480, 480, 480 },
.hfront_porch = { 50, 50, 50 },
.hsync_len = { 10, 10, 10 },
.hback_porch = { 46, 46, 46 },
.vactive = { 640, 640, 640 },
.vfront_porch = { 15, 15, 15 },
.vsync_len = { 10, 10, 10 },
.vback_porch = { 15, 15, 15 },
.flags = DISPLAY_FLAGS_HSYNC_LOW |
DISPLAY_FLAGS_VSYNC_LOW |
DISPLAY_FLAGS_DE_HIGH|
DISPLAY_FLAGS_PIXDATA_POSEDGE,
#endif
};

and the dts file of rm67191 :

   change the lanes,width,height

 kernel_imx\arch\arm64\boot\dts\freescale\fsl-imx8mm-evk-rm67191.dts

 

   &mipi_dsi {
            panel@0 {
                     compatible = "raydium,rm67191";
                     reg = <0>;
                     pinctrl-0 = <&pinctrl_mipi_dsi_en>;
                     reset-gpio = <&gpio1 8 GPIO_ACTIVE_HIGH>;
                     dsi-lanes = <2>;//4,2
                     video-mode = <2>; /* 0: burst mode
                                                      * 1: non-burst mode with sync event
                                                      * 2: non-burst mode with sync pulse
                                       */
                      panel-width-mm = <37>;//68,37
                      panel-height-mm = <65>;//121,65
                      status = "okay";
                 };
   };

but there is something wrong:

[1.710043] imx_sec_dsim_drv 32e10000.mipi_dsi: wait pkthdr tx done time out
[ 1.710051] panel-raydium-rm67191 32e10000.mipi_dsi.0: [drm:rad_panel_enable] *ERROR* Failed to send init cmds (-16)
[ 1.710056] imx_sec_dsim_drv 32e10000.mipi_dsi: panel enable failed: -16

Anywhere I need to modify?

   

2,124 Views
LinhNguyen
Contributor III

Hi, I got the same problem "wait pkthdr tx done time out" with MIPI DSI LCD based on NT35596 Panel Driver. Do you have any idea to solve it? Thank you.

0 Kudos

2,124 Views
igorpadykov
NXP TechSupport
NXP TechSupport

probably your custom panel needs different that radium initialization

(check cmd_set_table manufacturer_cmd_set[]), it can be found in panel datasheet.

Best regards
igor

0 Kudos

2,124 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi 凯 方

custom lcd timings can be adjusted in display_timing rad_default_timing() in

 drivers/gpu/drm/panel/panel-raydium-rm67191.c

panel-raydium-rm67191.c\panel\drm\gpu\drivers - linux-imx - i.MX Linux kernel 

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

0 Kudos

1,197 Views
kaney
Contributor I

The BSP version is Yocto Linux 5.4.47_2.2.0

I have the same problem, when eable rm67191 mipi-dsi panel, use below device tree:

imx8mm-evk-rm67191.dtb

[ 2.549264] imx-drm soc@0:bus@32c00000:display-subsystem: bound imx-lcdif-crtc.0 (ops lcdif_crtc_ops)
[ 2.559161] imx_sec_dsim_drv 32e10000.mipi_dsi: version number is 0x1060200
[ 2.567464] panel-raydium-rm67191 32e10000.mipi_dsi.0: 32e10000.mipi_dsi.0 supply v3p3 not found, using dummy regulator
[ 2.578305] panel-raydium-rm67191 32e10000.mipi_dsi.0: 32e10000.mipi_dsi.0 supply v1p8 not found, using dummy regulator
[ 2.589188] imx-drm soc@0:bus@32c00000:display-subsystem: bound 32e10000.mipi_dsi (ops imx_sec_dsim_ops)
[ 2.599236] [drm] Initialized imx-drm 1.0.0 20120507 for soc@0:bus@32c00000:display-subsystem on minor 0
[ 2.638751] random: fast init done
[ 2.658569] ------------[ cut here ]------------
[ 2.658585] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/bridge/sec-dsim.c:1769 sec_mipi_dsim_irq_handler+0x194/0x218
[ 2.658587] Modules linked in:
[ 2.658595] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.47-2.2.0+g5ec03d0 #1
[ 2.658597] Hardware name: FSL i.MX8MM EVK board (DT)
[ 2.658601] pstate: 00000085 (nzcv daIf -PAN -UAO)
[ 2.658606] pc : sec_mipi_dsim_irq_handler+0x194/0x218
[ 2.658614] lr : __handle_irq_event_percpu+0x64/0x170
[ 2.658615] sp : ffff800010003e60
[ 2.658619] x29: ffff800010003e60 x28: 0000000000000060
[ 2.658624] x27: ffff8000114b20f0 x26: ffff800011b0a704
[ 2.658630] x25: ffff800011a02580 x24: ffff0000763b4400
[ 2.658635] x23: 0000000000000037 x22: ffff800010003f24
[ 2.658641] x21: 0000000000000000 x20: ffff000077600080
[ 2.658647] x19: 0000000000200003 x18: 0000000000000000
[ 2.658653] x17: 0000000000000000 x16: 0000000000000000
[ 2.658658] x15: 0000000000000000 x14: ffff800011a02580
[ 2.658664] x13: ffff800011a02580 x12: ffff80006c382000
[ 2.658670] x11: 0000000034d4d91d x10: 0000000000000040
[ 2.658674] x9 : ffff800011a11c80 x8 : ffff800011a11c78
[ 2.658680] x7 : ffff000074000428 x6 : 0000000000000000
[ 2.658685] x5 : ffff000074000248 x4 : ffff80006c382000
[ 2.658691] x3 : ffff800010003f60 x2 : ffff800010749698
[ 2.658697] x1 : 00000000f1370000 x0 : 000000008011040e
[ 2.658703] Call trace:
[ 2.658709] sec_mipi_dsim_irq_handler+0x194/0x218
[ 2.658713] __handle_irq_event_percpu+0x64/0x170
[ 2.658719] handle_irq_event_percpu+0x30/0x88
[ 2.658725] handle_irq_event+0x44/0xc8
[ 2.658732] handle_fasteoi_irq+0xb4/0x160
[ 2.658736] generic_handle_irq+0x24/0x38
[ 2.658740] __handle_domain_irq+0x60/0xb8
[ 2.658745] gic_handle_irq+0x5c/0x148
[ 2.658748] el1_irq+0xb8/0x180
[ 2.658754] cpuidle_enter_state+0x84/0x360
[ 2.658757] cpuidle_enter+0x34/0x48
[ 2.658762] call_cpuidle+0x18/0x38
[ 2.658765] do_idle+0x1e0/0x280
[ 2.658769] cpu_startup_entry+0x20/0x40
[ 2.658774] rest_init+0xd4/0xe0
[ 2.658781] arch_call_rest_init+0xc/0x14
[ 2.658784] start_kernel+0x418/0x44c
[ 2.658787] ---[ end trace 2727000a38e64047 ]---
[ 2.658795] imx_sec_dsim_drv 32e10000.mipi_dsi: LP RX timeout
[ 2.916479] imx_sec_dsim_drv 32e10000.mipi_dsi: wait payload tx done time out
[ 2.916490] panel-raydium-rm67191 32e10000.mipi_dsi.0: [drm:rad_panel_enable] *ERROR* Failed to set tear scanline (-16)
[ 2.916495] imx_sec_dsim_drv 32e10000.mipi_dsi: panel enable failed: -16

0 Kudos