# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/display/bridge/waveshare,dsi2dpi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Waveshare MIPI-DSI to DPI Converter bridge

maintainers:
  - Joseph Guo <qijian.guo@nxp.com>

description:
  Waveshare bridge board is part of Waveshare panel which converts DSI to DPI
  or LVDS.

properties:
  compatible:
    enum:
      - waveshare,dsi2dpi
      - waveshare,dsi2lvds

  reg:
    maxItems: 1
    description: base I2C address of the device

  power-supply: true

  ports:
    $ref: /schemas/graph.yaml#/properties/ports

    properties:
      port@0:
        $ref: /schemas/graph.yaml#/$defs/port-base
        unevaluatedProperties: false
        description:
          Video port for MIPI DSI input

        properties:
          endpoint:
            $ref: /schemas/media/video-interfaces.yaml#
            unevaluatedProperties: false

            properties:
              data-lanes:
                description: array of physical DSI data lane indexes.
                minItems: 1
                items:
                  - const: 1
                  - const: 2
                  - const: 3
                  - const: 4

            required:
              - data-lanes

      port@1:
        $ref: /schemas/graph.yaml#/properties/port
        description:
          Video port for MIPI DPI or LVDS output to the panel.

    required:
      - port@0
      - port@1

required:
  - compatible
  - reg
  - ports
  - power-supply

additionalProperties: false

examples:
  - |

    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      bridge@45 {
        compatible = "waveshare,dsi2dpi";
        reg = <0x45>;
        power-supply = <&reg_3p3v>;

        ports {
          #address-cells = <1>;
          #size-cells = <0>;

          port@0 {
            reg = <0>;

            waveshare_from_dsim: endpoint {
              data-lanes = <1 2>;
              remote-endpoint = <&dsim_to_waveshare>;
            };
          };

          port@1 {
            reg = <1>;

            waveshare_to_panel: endpoint {
              remote-endpoint = <&panel_to_waveshare>;
            };
          };
        };
      };
    };

...