From 79895886b3d57bff2fa5058c777b7ceb15d1d545 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 14 Oct 2024 18:53:43 +0100 Subject: [PATCH] dtoverlays: Add an overlay for Waveshare's 800x480 4.3" DSI screen It tried to be a clone of the Pi 7" display, but isn't, and gives corrupt images with the current timings. Add a new overlay for it. Signed-off-by: Dave Stevenson --- arch/arm/boot/dts/overlays/Makefile | 1 + arch/arm/boot/dts/overlays/README | 17 +++ .../vc4-kms-dsi-waveshare-800x480-overlay.dts | 119 ++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile index e14dc0857327a8..21222f244c3ad7 100644 --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -321,6 +321,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ vc4-kms-dsi-ili9881-7inch.dtbo \ vc4-kms-dsi-lt070me05000.dtbo \ vc4-kms-dsi-lt070me05000-v2.dtbo \ + vc4-kms-dsi-waveshare-800x480.dtbo \ vc4-kms-dsi-waveshare-panel.dtbo \ vc4-kms-kippah-7inch.dtbo \ vc4-kms-v3d.dtbo \ diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README index 23877d36a25637..3404238c93f1d2 100644 --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -5288,6 +5288,23 @@ Load: dtoverlay=vc4-kms-dsi-lt070me05000-v2 Params: +Name: vc4-kms-dsi-waveshare-800x480 +Info: Enable the Waveshare 4.3" 800x480 DSI screen. + It tries to look like the Pi 7" display, but won't accept some of the + timings. + Includes the edt-ft5406 for the touchscreen element. + Requires vc4-kms-v3d to be loaded. +Load: dtoverlay=vc4-kms-dsi-waveshare-800x480,= +Params: sizex Touchscreen size x (default 800) + sizey Touchscreen size y (default 480) + invx Touchscreen inverted x axis + invy Touchscreen inverted y axis + swapxy Touchscreen swapped x y axis + disable_touch Disables the touch screen overlay driver + dsi0 Use DSI0 and i2c_csi_dsi0 (rather than + the default DSI1 and i2c_csi_dsi). + + Name: vc4-kms-dsi-waveshare-panel Info: Enable a Waveshare DSI touchscreen Includes the Goodix driver for the touchscreen element. diff --git a/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts new file mode 100644 index 00000000000000..78e8f46c69cc6b --- /dev/null +++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-800x480-overlay.dts @@ -0,0 +1,119 @@ +/* + * Device Tree overlay for Waveshare 4.3" 800x480 panel. + * It tries to look like a Pi 7" panel, but fails with some of the timing + * options. + */ + +/dts-v1/; +/plugin/; + +#include "edt-ft5406.dtsi" + +/ { + /* No compatible as it will have come from edt-ft5406.dtsi */ + + dsi_frag: fragment@0 { + target = <&dsi1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + port { + dsi_out: endpoint { + remote-endpoint = <&panel_dsi_port>; + }; + }; + + panel: panel-dsi-generic@0 { + // See panel-dsi.yaml binding + compatible = "waveshare,4-3-inch-dsi","panel-dsi"; + reg = <0>; + power-supply = <®_display>; + backlight = <®_display>; + dsi-color-format = "RGB888"; + mode = "MODE_VIDEO"; + width-mm = <0>; + height-mm = <0>; + + port { + panel_dsi_port: endpoint { + data-lanes = <1>; + remote-endpoint = <&dsi_out>; + }; + }; + + timing: panel-timing { + clock-frequency = <27777000>; + hactive = <800>; + vactive = <480>; + hfront-porch = <59>; + hsync-len = <2>; + hback-porch = <45>; + vfront-porch = <7>; + vsync-len = <2>; + vback-porch = <22>; + }; + }; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + reg_bridge: reg_bridge@1 { + reg = <1>; + compatible = "regulator-fixed"; + regulator-name = "bridge_reg"; + gpio = <®_display 0 0>; + vin-supply = <®_display>; + enable-active-high; + }; + }; + }; + + i2c_frag: fragment@2 { + target = <&i2c_csi_dsi>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + reg_display: reg_display@45 { + compatible = "raspberrypi,7inch-touchscreen-panel-regulator"; + reg = <0x45>; + gpio-controller; + #gpio-cells = <2>; + }; + }; + }; + + fragment@3 { + target = <&i2c0if>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@4 { + target = <&i2c0mux>; + __overlay__ { + status = "okay"; + }; + }; + fragment@5 { + target = <&ft5406>; + __overlay__ { + vcc-supply = <®_display>; + reset-gpio = <®_display 1 1>; + }; + }; + + __overrides__ { + dsi0 = <&dsi_frag>, "target:0=",<&dsi0>, + <&i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <&ts_i2c_frag>, "target:0=",<&i2c_csi_dsi0>, + <®_bridge>, "reg:0=0", + <®_bridge>, "regulator-name=bridge_reg_0"; + disable_touch = <&ft5406>, "status=disabled"; + }; +};