-
Notifications
You must be signed in to change notification settings - Fork 8
MIPI DBI SPI driver
Noralf Trønnes edited this page Mar 12, 2022
·
2 revisions
Note: This driver will be removed in the next release in favour of panel-mipi-dbi
This driver can be used with MIPI DBI compatible SPI panels.
Device Tree properties:
-
width Width in pixels
-
height Height in pixels
-
init The same format as fbtft: commands are OR’ed with 0x1000000, millisecond delays are OR’ed with 0x2000000.
The pi (not lite) image has a Device Tree compiler:
# Make /boot writeable # rw boot # Compile overlay # dtc -@ -I dts -O dtb -o /boot/overlays/mipi-dbi-drv.dtbo /boot/mipi-dbi-drv-overlay.dts # Enable overlay # nano /boot/config.txt dtoverlay=mipi-dbi-drv
Example overlay (rpi-display: drivers/gpu/drm/tiny/mi0283qt.c):
/dts-v1/; /plugin/; / { compatible = "brcm,bcm2835"; fragment@0 { target = <&spi0>; __overlay__ { status = "okay"; spidev@0{ status = "disabled"; }; spidev@1{ status = "disabled"; }; }; }; fragment@1 { target = <&spi0>; __overlay__ { /* needed to avoid dtc warning */ #address-cells = <1>; #size-cells = <0>; display: display@0{ compatible = "mipi_dbi_drv"; reg = <0>; spi-max-frequency = <64000000>; reset-gpios = <&gpio 23 0>; dc-gpios = <&gpio 24 0>; backlight = <&backlight>; width = <320>; height = <240>; init = <0x1000028 0x10000cf 0x00 0x83 0x30 0x10000ed 0x64 0x03 0x12 0x81 0x10000e8 0x85 0x01 0x79 0x10000cb 0x39 0x2c 0x00 0x34 0x02 0x10000f7 0x20 0x10000ea 0x00 0x00 0x10000c0 0x26 0x10000c1 0x11 0x10000c5 0x35 0x3e 0x10000c7 0xbe 0x100003a 0x55 0x1000036 0x28 0x10000b1 0x00 0x1b 0x1000026 0x01 0x10000f2 0x08 0x1000026 0x01 0x10000e0 0x1f 0x1a 0x18 0x0a 0x0f 0x06 0x45 0x87 0x32 0x0a 0x07 0x02 0x07 0x05 0x00 0x10000e1 0x00 0x25 0x27 0x05 0x10 0x09 0x3a 0x78 0x4d 0x05 0x18 0x0d 0x38 0x3a 0x1f 0x10000b7 0x07 0x10000b6 0x0a 0x82 0x27 0x00 0x1000011 0x2000064 0x1000029 0x2000064>; }; ts@1 { compatible = "ti,ads7846"; reg = <1>; spi-max-frequency = <2000000>; interrupts = <25 2>; /* high-to-low edge triggered */ interrupt-parent = <&gpio>; pendown-gpio = <&gpio 25 0>; ti,x-plate-ohms = /bits/ 16 <60>; ti,pressure-max = /bits/ 16 <255>; }; }; }; fragment@2 { target-path = "/soc"; __overlay__ { backlight: backlight { compatible = "gpio-backlight"; gpios = <&gpio 18 0>; }; }; }; __overrides__ { speed = <&display>,"spi-max-frequency:0"; }; };
Example backlight section for pwm capable backlights:
fragment@2 { target = <&pwm>; __overlay__ { pinctrl-names = "default"; // Pi Zero pinctrl-0 = <&pwm0_gpio18>; // Pi 4 //pinctrl-0 = <&pwm0_0_gpio18>; status = "okay"; }; }; fragment@3 { target-path = "/soc"; __overlay__ { backlight: backlight { compatible = "pwm-backlight"; pwms = <&pwm 0 5000000>; // pwm_bl uses CIE 1931 to construct a brightness table }; }; };