dtoverlays: Add a generic DPI panel overlay for KMS
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Thu, 2 Dec 2021 18:06:37 +0000 (18:06 +0000)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:04:33 +0000 (16:04 +0000)
Uses the "panel-dpi" compatible to set panel timings from
DT.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
arch/arm/boot/dts/overlays/Makefile
arch/arm/boot/dts/overlays/README
arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts [new file with mode: 0644]

index a6b0d9e..1c0da56 100644 (file)
@@ -232,6 +232,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
        vc4-fkms-v3d.dtbo \
        vc4-fkms-v3d-pi4.dtbo \
        vc4-kms-dpi-at056tn53v1.dtbo \
+       vc4-kms-dpi-generic.dtbo \
        vc4-kms-dsi-7inch.dtbo \
        vc4-kms-dsi-lt070me05000.dtbo \
        vc4-kms-dsi-lt070me05000-v2.dtbo \
index bedb501..4ae0bc9 100644 (file)
@@ -3563,6 +3563,34 @@ Load:   dtoverlay=vc4-kms-dpi-at056tn53v1
 Params: <None>
 
 
+Name:   vc4-kms-dpi-generic
+Info:   Enable a generic DPI display under KMS. Default timings are for the
+        Adafruit Kippah with 800x480 panel and RGB666 (GPIOs 0-21)
+        Requires vc4-kms-v3d to be loaded.
+Load:   dtoverlay=vc4-kms-dpi-generic,<param>=<val>
+Params: clock-frequency         Display clock frequency (Hz)
+        hactive                 Horizontal active pixels
+        hfp                     Horizontal front porch
+        hsync                   Horizontal sync pulse width
+        hbp                     Horizontal back porch
+        vactive                 Vertical active lines
+        vfp                     Vertical front porch
+        vsync                   Vertical sync pulse width
+        vbp                     Vertical back porch
+        hsync-invert            Horizontal sync active low
+        vsync-invert            Vertical sync active low
+        de-invert               Data Enable active low
+        pixclk-invert           Negative edge pixel clock
+        width-mm                Define the screen width in mm
+        height-mm               Define the screen height in mm
+        rgb565                  Change to RGB565 output on GPIOs 0-19
+        rgb666-padhi            Change to RGB666 output on GPIOs 0-9, 12-17, and
+                                20-25
+        rgb888                  Change to RGB888 output on GPIOs 0-27
+        bus-format              Override the bus format for a MEDIA_BUS_FMT_*
+                                value. NB also overridden by rgbXXX overrides.
+
+
 Name:   vc4-kms-dsi-7inch
 Info:   Enable the Raspberry Pi DSI 7" screen.
         Includes the edt-ft5406 for the touchscreen element.
diff --git a/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts b/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
new file mode 100644 (file)
index 0000000..def1757
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * vc4-kms-dpi-at056tn53v1-overlay.dts
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/bcm2835.h>
+
+/ {
+       compatible = "brcm,bcm2835";
+
+       fragment@0 {
+               target-path = "/";
+               __overlay__ {
+                       panel: panel {
+                               compatible = "panel-dpi";
+
+                               width-mm = <154>;
+                               height-mm = <83>;
+                               bus-format = <0x1009>;
+
+                               timing: panel-timing {
+                                       clock-frequency = <29500000>;
+                                       hactive = <800>;
+                                       hfront-porch = <24>;
+                                       hsync-len = <72>;
+                                       hback-porch = <96>;
+                                       hsync-active = <0>;
+                                       vactive = <480>;
+                                       vfront-porch = <3>;
+                                       vsync-len = <10>;
+                                       vback-porch = <7>;
+                                       vsync-active = <0>;
+
+                                       de-active = <1>;
+                                       pixelclk-active = <1>;
+                               };
+
+                               port {
+                                       panel_in: endpoint {
+                                               remote-endpoint = <&dpi_out>;
+                                       };
+                               };
+                       };
+               };
+       };
+
+       fragment@1 {
+               target = <&dpi>;
+               dpi_node: __overlay__  {
+                       status = "okay";
+
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&dpi_18bit_gpio0>;
+
+                       port {
+                               dpi_out: endpoint {
+                                       remote-endpoint = <&panel_in>;
+                               };
+                       };
+               };
+       };
+
+       __overrides__ {
+               clock-frequency = <&timing>, "clock-frequency:0";
+               hactive = <&timing>, "hactive:0";
+               hfp = <&timing>, "hfront-porch:0";
+               hsync = <&timing>, "hsync-len:0";
+               hbp = <&timing>, "hback-porch:0";
+               vactive = <&timing>, "vactive:0";
+               vfp = <&timing>, "vfront-porch:0";
+               vsync = <&timing>, "vsync-len:0";
+               vbp = <&timing>, "vback-porch:0";
+               hsync-invert = <&timing>, "hsync-active:0=0";
+               vsync-invert = <&timing>, "vsync-active:0=0";
+               de-invert = <&timing>, "de-active:0=0";
+               pixclk-invert = <&timing>, "pixelclk-active:0=0";
+
+               width-mm = <&panel>, "width-mm:0";
+               height-mm = <&panel>, "height-mm:0";
+
+               rgb565 = <&panel>, "bus-format:0=0x1017",
+                       <&dpi_node>, "pinctrl-0:0=",<&dpi_16bit_gpio0>;
+               rgb666-padhi = <&panel>, "bus-format:0=0x1015",
+                       <&dpi_node>, "pinctrl-0:0=",<&dpi_18bit_cpadhi_gpio0>;
+               rgb888 = <&panel>, "bus-format:0=0x100a",
+                       <&dpi_node>, "pinctrl-0:0=",<&dpi_gpio0>;
+               bus-format = <&panel>, "bus-format:0";
+       };
+};