Most MIPI-DSI panel drivers follow an identical pattern: acquire
regulators and GPIOs, perform a reset pulse with specific timing,
send a vendor-supplied sequence of DSI commands, then enable the
display. The only truly panel-specific part is the init sequence
and power-on/off timing.

The panel-mipi-dsi-bpf driver replaces per-panel kernel modules
with a single generic driver whose panel-specific behavior is
provided by BPF programs loaded from userspace at runtime,
following the HID-BPF model. This enables new panel support
without kernel patches.

Panel DT nodes use a two-entry compatible with the panel-specific
string first and "panel-mipi-dsi-bpf" as fallback. The generic
driver matches on the fallback, while the first compatible is used
to identify which BPF program to load.

Six normalized optional regulator supplies cover ~95% of existing
MIPI-DSI panels: vcc (IC core), iovcc (I/O interface), avdd/avee
(positive/negative analog), and elvdd/elvss (OLED EL driver).

Signed-off-by: Maxime Ripard <[email protected]>
---
 .../bindings/display/panel/panel-mipi-dsi-bpf.yaml | 184 +++++++++++++++++++++
 1 file changed, 184 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/panel/panel-mipi-dsi-bpf.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-mipi-dsi-bpf.yaml
new file mode 100644
index 000000000000..9a20a21cf70e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-mipi-dsi-bpf.yaml
@@ -0,0 +1,184 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-mipi-dsi-bpf.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic MIPI-DSI panel with BPF init sequences
+
+maintainers:
+  - Maxime Ripard <[email protected]>
+
+description: |
+  A generic MIPI-DSI panel driver where the panel-specific power sequencing
+  and DSI init commands are provided by BPF programs.
+
+  Panel DT nodes use a fallback compatible so the generic driver matches on
+  "panel-mipi-dsi-bpf" while the first compatible identifies the specific
+  panel for BPF program matching.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    items:
+      - description: Panel-specific compatible string
+      - const: panel-mipi-dsi-bpf
+
+  reg:
+    maxItems: 1
+    description: DSI virtual channel
+
+  backlight: true
+  enable-gpios: true
+  height-mm: true
+  port: true
+  reset-gpios: true
+  rotation: true
+  width-mm: true
+
+  vcc-supply:
+    description: IC core supply, typically 2.8-3.3V (charge pump input)
+
+  iovcc-supply:
+    description: I/O interface supply, typically 1.8V (MIPI logic level)
+
+  avdd-supply:
+    description: Positive analog supply for source/gate driver, typically +5V
+
+  avee-supply:
+    description: Negative analog supply for source/gate driver, typically -5V
+
+  elvdd-supply:
+    description: OLED EL positive supply
+
+  elvss-supply:
+    description: OLED EL negative supply
+
+  dsi-lanes:
+    description: Number of DSI data lanes
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 3, 4]
+    default: 4
+
+  mode-video:
+    type: boolean
+    description: Use DSI video mode (as opposed to command mode)
+
+  mode-video-burst:
+    type: boolean
+    description: Use DSI video burst mode
+
+  mode-lpm:
+    type: boolean
+    description: Use low-power mode for DSI commands
+
+  mode-no-eot:
+    type: boolean
+    description: Disable end-of-transmission packet
+
+  clock-non-continuous:
+    type: boolean
+    description: DSI clock is non-continuous
+
+  hs-rate:
+    description: Maximum lane frequency for high speed mode in hertz
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  lp-rate:
+    description: Maximum lane frequency for low power mode in hertz
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  panel-timing: true
+
+required:
+  - compatible
+  - reg
+  - panel-timing
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "elida,kd35t133", "panel-mipi-dsi-bpf";
+            reg = <0>;
+            backlight = <&backlight>;
+            vcc-supply = <&vcc3v3_lcd>;
+            iovcc-supply = <&vcc_1v8>;
+            reset-gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
+            dsi-lanes = <1>;
+            mode-video;
+            mode-video-burst;
+            mode-lpm;
+
+            width-mm = <42>;
+            height-mm = <82>;
+
+            panel-timing {
+                clock-frequency = <17000000>;
+                hactive = <320>;
+                vactive = <480>;
+                hfront-porch = <20>;
+                hsync-len = <4>;
+                hback-porch = <20>;
+                vfront-porch = <2>;
+                vsync-len = <1>;
+                vback-porch = <2>;
+            };
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+  - |
+    /* OLED panel using avdd/avee and elvdd/elvss supplies */
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@0 {
+            compatible = "boe,bf060y8m-aj0", "panel-mipi-dsi-bpf";
+            reg = <0>;
+            vcc-supply = <&vreg_l14a>;
+            iovcc-supply = <&vreg_l12a>;
+            elvdd-supply = <&vreg_oled_pos>;
+            elvss-supply = <&vreg_oled_neg>;
+            reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
+            dsi-lanes = <4>;
+            mode-video;
+
+            panel-timing {
+                clock-frequency = <157000000>;
+                hactive = <1080>;
+                vactive = <2160>;
+                hfront-porch = <36>;
+                hsync-len = <4>;
+                hback-porch = <36>;
+                vfront-porch = <4>;
+                vsync-len = <4>;
+                vback-porch = <4>;
+            };
+
+            port {
+                oled_in: endpoint {
+                    remote-endpoint = <&dsi0_out>;
+                };
+            };
+        };
+    };
+
+...

-- 
2.55.0

Reply via email to