Skip to content
Noralf Trønnes edited this page Mar 24, 2022 · 22 revisions

The panel-mipi-dbi Linux display driver works with all displays that have a MIPI DBI compatible controller and use the SPI interface.

It will be available in Linux 5.18.

Example configuration for a Sainsmart 1.8 display:

Device Tree node:

sainsmart18@0 {
	compatible = "sainsmart18", "panel-mipi-dbi-spi";

	spi-max-frequency = <40000000>;
	reg = <0>;

	width-mm = <35>;
	height-mm = <28>;

	reset-gpios = <&gpio 25 0>;
	dc-gpios = <&gpio 24 0>;
	write-only;

	panel-timing {
		hactive = <160>;
		vactive = <128>;
		hback-porch = <0>;
		vback-porch = <0>;

		clock-frequency = <0>;
		hfront-porch = <0>;
		hsync-len = <0>;
		vfront-porch = <0>;
		vsync-len = <0>;
	};
};

Commands file: sainsmart18.txt

command 0x11 # exit sleep mode
delay 120

command 0xB1 0x01 0x2C 0x2D # FRMCTR1
command 0xB4 0x07           # INVCTR
command 0xC0 0xA2 0x02 0x84 # PWCTR1
command 0xC1 0xC5           # PWCTR2
command 0xC2 0x0A 0x00      # PWCTR3
command 0xC5 0x0E           # VMCTR1

command 0x3A 0x05 # pixel format RGB565
command 0x36 0xA0 # address mode (madctl)

# gamma
command 0xE0 0x0F 0x1A 0x0F 0x18 0x2F 0x28 0x20 0x22 0x1F 0x1B 0x23 0x37 0x00 0x07 0x02 0x10
command 0xE1 0x0F 0x1B 0x0F 0x17 0x33 0x2C 0x29 0x2E 0x30 0x30 0x39 0x3F 0x00 0x07 0x03 0x10

command 0x29 # display on

Use mipi-dbi-cmd to convert and then copy

$ mipi-dbi-cmd sainsmart18.bin sainsmart18.txt
$ sudo cp sainsmart18.bin /lib/firmware

Parse firmware file:

$ mipi-dbi-cmd /lib/firmware/sainsmart18.bin
command 0x11
delay 120
command 0xb1 0x01 0x2c 0x2d
command 0xb4 0x07
command 0xc0 0xa2 0x02 0x84
command 0xc1 0xc5
command 0xc2 0x0a 0x00
command 0xc5 0x0e
command 0x3a 0x05
command 0x36 0xa0
command 0xe0 0x0f 0x1a 0x0f 0x18 0x2f 0x28 0x20 0x22 0x1f 0x1b 0x23 0x37 0x00 0x07 0x02 0x10
command 0xe1 0x0f 0x1b 0x0f 0x17 0x33 0x2c 0x29 0x2e 0x30 0x30 0x39 0x3f 0x00 0x07 0x03 0x10
command 0x29

History

Clone this wiki locally