# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/media/amlogic,c3-mipi-csi2.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Amlogic C3 MIPI CSI-2 receiver

maintainers:
  - Keke Li <keke.li@amlogic.com>

description:
  MIPI CSI-2 receiver contains CSI-2 RX PHY and host controller.
  It receives the MIPI data from the image sensor and sends MIPI data
  to MIPI adapter.

properties:
  compatible:
    enum:
      - amlogic,c3-mipi-csi2

  reg:
    maxItems: 3

  reg-names:
    items:
      - const: aphy
      - const: dphy
      - const: host

  power-domains:
    maxItems: 1

  clocks:
    maxItems: 2

  clock-names:
    items:
      - const: vapb
      - const: phy0

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

    properties:
      port@0:
        $ref: /schemas/graph.yaml#/$defs/port-base
        unevaluatedProperties: false
        description: input port node, connected to sensor.

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

            properties:
              data-lanes:
                minItems: 1
                maxItems: 4

            required:
              - data-lanes

      port@1:
        $ref: /schemas/graph.yaml#/properties/port
        description: output port node

    required:
      - port@0
      - port@1

required:
  - compatible
  - reg
  - reg-names
  - power-domains
  - clocks
  - clock-names
  - ports

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/amlogic,c3-peripherals-clkc.h>
    #include <dt-bindings/power/amlogic,c3-pwrc.h>

    soc {
        #address-cells = <2>;
        #size-cells = <2>;

        csi: csi@ff018000 {
            compatible = "amlogic,c3-mipi-csi2";
            reg = <0x0 0xff018000 0x0 0x400>,
                  <0x0 0xff019000 0x0 0x300>,
                  <0x0 0xff01a000 0x0 0x100>;
            reg-names = "aphy", "dphy", "host";
            power-domains = <&pwrc PWRC_C3_MIPI_ISP_WRAP_ID>;
            clocks =  <&clkc_periphs CLKID_VAPB>,
                      <&clkc_periphs CLKID_CSI_PHY0>;
            clock-names = "vapb", "phy0";
            assigned-clocks = <&clkc_periphs CLKID_VAPB>,
                              <&clkc_periphs CLKID_CSI_PHY0>;
            assigned-clock-rates = <0>, <200000000>;

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

                port@0 {
                    reg = <0>;
                    c3_mipi_csi_in: endpoint {
                        remote-endpoint = <&imx290_out>;
                        data-lanes = <1 2 3 4>;
                    };
                };

                port@1 {
                    reg = <1>;
                    c3_mipi_csi_out: endpoint {
                        remote-endpoint = <&c3_adap_in>;
                    };
                };
            };
        };
    };
...
