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

title: SK Hynix Hi-846 1/4" 8M Pixel MIPI CSI-2 sensor

maintainers:
  - Martin Kepplinger <martin.kepplinger@puri.sm>

description: |-
  The Hi-846 is a raw image sensor with an MIPI CSI-2 image data
  interface and CCI (I2C compatible) control bus. The output format
  is raw Bayer.

properties:
  compatible:
    const: hynix,hi846

  reg:
    maxItems: 1

  clocks:
    items:
      - description: Reference to the mclk clock.

  assigned-clocks:
    maxItems: 1

  assigned-clock-rates:
    maxItems: 1

  reset-gpios:
    description: Reference to the GPIO connected to the RESETB pin. Active low.
    maxItems: 1

  shutdown-gpios:
    description: Reference to the GPIO connected to the XSHUTDOWN pin. Active low.
    maxItems: 1

  vddio-supply:
    description: Definition of the regulator used for the VDDIO power supply.

  vdda-supply:
    description: Definition of the regulator used for the VDDA power supply.

  vddd-supply:
    description: Definition of the regulator used for the VDDD power supply.

  port:
    $ref: /schemas/graph.yaml#/$defs/port-base
    unevaluatedProperties: false

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

        properties:
          data-lanes:
            oneOf:
              - items:
                  - const: 1
                  - const: 2
                  - const: 3
                  - const: 4
              - items:
                  - const: 1
                  - const: 2

          link-frequencies: true

        required:
          - data-lanes
          - link-frequencies

required:
  - compatible
  - reg
  - clocks
  - assigned-clocks
  - assigned-clock-rates
  - vddio-supply
  - vdda-supply
  - vddd-supply
  - port

additionalProperties: false

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

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

        hi846: camera@20 {
            compatible = "hynix,hi846";
            reg = <0x20>;
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_csi1>;
            clocks = <&clk 0>;
            assigned-clocks = <&clk 0>;
            assigned-clock-rates = <25000000>;
            vdda-supply = <&reg_camera_vdda>;
            vddd-supply = <&reg_camera_vddd>;
            vddio-supply = <&reg_camera_vddio>;
            reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
            shutdown-gpios = <&gpio5 4 GPIO_ACTIVE_LOW>;

            port {
                camera_out: endpoint {
                    remote-endpoint = <&csi1_ep1>;
                    link-frequencies = /bits/ 64
                        <80000000 200000000>;
                    data-lanes = <1 2>;
                };
            };
        };
    };

...