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

title: OmniVision OV5645 Image Sensor

maintainers:
  - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

properties:
  compatible:
    const: ovti,ov5645

  reg:
    maxItems: 1

  clocks:
    description: XCLK Input Clock

  clock-frequency:
    description: Frequency of the xclk clock in Hz.

  vdda-supply:
    description: Analog voltage supply, 2.8 volts

  vddd-supply:
    description: Digital core voltage supply, 1.5 volts

  vdddo-supply:
    description: Digital I/O voltage supply, 1.8 volts

  enable-gpios:
    maxItems: 1
    description:
      Reference to the GPIO connected to the PWDNB pin, if any.

  reset-gpios:
    maxItems: 1
    description:
      Reference to the GPIO connected to the RESETB pin, if any.

  port:
    description: Digital Output Port
    $ref: /schemas/graph.yaml#/$defs/port-base
    additionalProperties: false

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

        properties:
          data-lanes:
            minItems: 1
            maxItems: 2
            items:
              enum: [1, 2]

        required:
          - data-lanes

required:
  - compatible
  - reg
  - clocks
  - vdddo-supply
  - vdda-supply
  - vddd-supply
  - port

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>

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

        camera@3c {
            compatible = "ovti,ov5645";
            reg = <0x3c>;
            clocks = <&clks 1>;
            clock-frequency = <24000000>;
            vdddo-supply = <&ov5645_vdddo_1v8>;
            vdda-supply = <&ov5645_vdda_2v8>;
            vddd-supply = <&ov5645_vddd_1v5>;
            enable-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_ov5645>;

            port {
                ov5645_ep: endpoint {
                    remote-endpoint = <&csi0_ep>;
                    data-lanes = <1 2>;
                };
            };
        };
    };
...