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

title: Omnivision OV02A10 CMOS Sensor Device Tree Bindings

maintainers:
  - Dongchun Zhu <dongchun.zhu@mediatek.com>

description: |-
  The Omnivision OV02A10 is a low-cost, high performance, 1/5-inch, 2 megapixel
  image sensor, which is the latest production derived from Omnivision's CMOS
  image sensor technology. Ihis chip supports high frame rate speeds up to 30fps
  @ 1600x1200 (UXGA) resolution transferred over a 1-lane MIPI interface. The
  sensor output is available via CSI-2 serial data output.

allOf:
  - $ref: /schemas/media/video-interface-devices.yaml#

properties:
  compatible:
    const: ovti,ov02a10

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

  clock-names:
    description:
      External clock for the sensor.
    items:
      - const: eclk

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

  dovdd-supply:
    description:
      Definition of the regulator used as Digital I/O voltage supply.

  avdd-supply:
    description:
      Definition of the regulator used as Analog voltage supply.

  dvdd-supply:
    description:
      Definition of the regulator used as Digital core voltage supply.

  powerdown-gpios:
    description:
      Must be the device tree identifier of the GPIO connected to the
      PD_PAD pin. This pin is used to place the OV02A10 into standby mode
      or shutdown mode. As the line needs to be high for the powerdown mode
      to be active, it should be marked GPIO_ACTIVE_HIGH.
    maxItems: 1

  reset-gpios:
    description:
      Must be the device tree identifier of the GPIO connected to the
      RST_PD pin. If specified, it will be asserted during driver probe.
      As the line needs to be low for the reset to be active, it should be
      marked GPIO_ACTIVE_LOW.
    maxItems: 1

  rotation:
    enum:
      - 0    # Sensor Mounted Upright
      - 180  # Sensor Mounted Upside Down
    default: 0

  port:
    $ref: /schemas/graph.yaml#/$defs/port-base
    additionalProperties: false
    description:
      Output port node, single endpoint describing the CSI-2 transmitter.

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

        properties:
          link-frequencies: true
          ovti,mipi-clock-voltage:
            $ref: "/schemas/types.yaml#/definitions/uint32"
            description:
              Definition of MIPI clock voltage unit. This entry corresponds to
              the link speed defined by the 'link-frequencies' property.
              If present, the value shall be in the range of 0-4.
            default: 4

        required:
          - link-frequencies

    required:
      - endpoint

required:
  - compatible
  - reg
  - clocks
  - clock-names
  - clock-frequency
  - dovdd-supply
  - avdd-supply
  - dvdd-supply
  - powerdown-gpios
  - reset-gpios
  - port

additionalProperties: false

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

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

        ov02a10: camera-sensor@3d {
            compatible = "ovti,ov02a10";
            reg = <0x3d>;

            powerdown-gpios = <&pio 107 GPIO_ACTIVE_HIGH>;
            reset-gpios = <&pio 109 GPIO_ACTIVE_LOW>;

            clocks = <&ov02a10_clk>;
            clock-names = "eclk";
            clock-frequency = <24000000>;

            rotation = <180>;

            dovdd-supply = <&ov02a10_dovdd>;
            avdd-supply = <&ov02a10_avdd>;
            dvdd-supply = <&ov02a10_dvdd>;

            port {
                wcam_out: endpoint {
                    link-frequencies = /bits/ 64 <390000000>;
                    ovti,mipi-clock-voltage = <3>;
                    remote-endpoint = <&mipi_in_wcam>;
                };
            };
        };
    };

...
