Add device tree overlays for the Raspberry Pi 5-inch and 7-inch
MIPI-DSI panels (ILI9881C) on the Raspberry Pi 4 Model B.

Both panels share the same I2C-connected display MCU at 0x45 on
i2c0_1, which provides GPIO and PWM for reset and backlight
control. The common parts are in a shared dtsi. Each panel overlay
includes it and adds only the panel-specific compatible string, physical
dimensions, and timing.

Signed-off-by: Maxime Ripard <[email protected]>
---
 arch/arm64/boot/dts/broadcom/Makefile              |  8 +++
 .../bcm2711-rpi-4-b-dsi-ili9881-5inch.dtso         | 22 ++++++++
 .../bcm2711-rpi-4-b-dsi-ili9881-7inch.dtso         | 22 ++++++++
 .../dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881.dtsi  | 65 ++++++++++++++++++++++
 4 files changed, 117 insertions(+)

diff --git a/arch/arm64/boot/dts/broadcom/Makefile 
b/arch/arm64/boot/dts/broadcom/Makefile
index 01ecfa304184..d717dc8c4071 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -13,8 +13,16 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \
                              bcm2837-rpi-3-b.dtb \
                              bcm2837-rpi-3-b-plus.dtb \
                              bcm2837-rpi-cm3-io3.dtb \
                              bcm2837-rpi-zero-2-w.dtb
 
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b-dsi-ili9881-5inch.dtb
+bcm2711-rpi-4-b-dsi-ili9881-5inch-dtbs := bcm2711-rpi-4-b.dtb \
+       bcm2711-rpi-4-b-dsi-ili9881-5inch.dtbo
+
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-4-b-dsi-ili9881-7inch.dtb
+bcm2711-rpi-4-b-dsi-ili9881-7inch-dtbs := bcm2711-rpi-4-b.dtb \
+       bcm2711-rpi-4-b-dsi-ili9881-7inch.dtbo
+
 subdir-y       += bcmbca
 subdir-y       += northstar2
 subdir-y       += stingray
diff --git 
a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-5inch.dtso 
b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-5inch.dtso
new file mode 100644
index 000000000000..99aac1105ac6
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-5inch.dtso
@@ -0,0 +1,22 @@
+/dts-v1/;
+/plugin/;
+
+#include "bcm2711-rpi-4-b-dsi-ili9881.dtsi"
+
+&panel {
+       compatible = "raspberrypi,dsi-5inch", "panel-mipi-dsi-bpf";
+       width-mm = <62>;
+       height-mm = <110>;
+
+       panel-timing {
+               clock-frequency = <83333000>;
+               hactive = <720>;
+               vactive = <1280>;
+               hfront-porch = <110>;
+               hsync-len = <12>;
+               hback-porch = <95>;
+               vfront-porch = <100>;
+               vsync-len = <2>;
+               vback-porch = <100>;
+       };
+};
diff --git 
a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-7inch.dtso 
b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-7inch.dtso
new file mode 100644
index 000000000000..809d9b354b89
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881-7inch.dtso
@@ -0,0 +1,22 @@
+/dts-v1/;
+/plugin/;
+
+#include "bcm2711-rpi-4-b-dsi-ili9881.dtsi"
+
+&panel {
+       compatible = "raspberrypi,dsi-7inch", "panel-mipi-dsi-bpf";
+       width-mm = <90>;
+       height-mm = <151>;
+
+       panel-timing {
+               clock-frequency = <83330000>;
+               hactive = <720>;
+               vactive = <1280>;
+               hfront-porch = <239>;
+               hsync-len = <33>;
+               hback-porch = <50>;
+               vfront-porch = <20>;
+               vsync-len = <2>;
+               vback-porch = <30>;
+       };
+};
diff --git a/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881.dtsi 
b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881.dtsi
new file mode 100644
index 000000000000..bd08e22581a3
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b-dsi-ili9881.dtsi
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Common DSI infrastructure for Raspberry Pi ILI9881C panels
+ * (backlight, i2c mux, display MCU, DSI1 port wiring)
+ *
+ * Each panel overlay includes this and extends &panel with its own
+ * compatible, dimensions, and panel-timing.
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+
+&{/} {
+       panel_backlight: panel_backlight {
+               compatible = "pwm-backlight";
+               brightness-levels = <0 31>;
+               num-interpolated-steps = <31>;
+               default-brightness-level = <15>;
+               pwms = <&display_mcu 0 200000 0>;
+       };
+};
+
+&i2c0 {
+       status = "okay";
+};
+
+&i2c0mux {
+       status = "okay";
+};
+
+&i2c0_1 {
+       status = "okay";
+
+       display_mcu: display_mcu@45 {
+               compatible = "raspberrypi,touchscreen-panel-regulator-v2";
+               reg = <0x45>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               #pwm-cells = <3>;
+       };
+};
+
+&dsi1 {
+       status = "okay";
+
+       panel: panel@0 {
+               reg = <0>;
+               reset-gpios = <&display_mcu 0 GPIO_ACTIVE_LOW>;
+               backlight = <&panel_backlight>;
+               dsi-lanes = <2>;
+               mode-video;
+               mode-lpm;
+
+               port {
+                       panel_in: endpoint {
+                               remote-endpoint = <&dsi1_out>;
+                       };
+               };
+       };
+
+       port {
+               dsi1_out: endpoint {
+                       remote-endpoint = <&panel_in>;
+               };
+       };
+};

-- 
2.55.0

Reply via email to