1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/media/i2c/ovti,ov5642.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: OmniVision OV5642 Image Sensor
8
9maintainers:
10  - Fabio Estevam <festevam@gmail.com>
11
12allOf:
13  - $ref: /schemas/media/video-interface-devices.yaml#
14
15properties:
16  compatible:
17    const: ovti,ov5642
18
19  reg:
20    maxItems: 1
21
22  clocks:
23    description: XCLK Input Clock
24
25  AVDD-supply:
26    description: Analog voltage supply, 2.8V.
27
28  DVDD-supply:
29    description: Digital core voltage supply, 1.5V.
30
31  DOVDD-supply:
32    description: Digital I/O voltage supply, 1.8V.
33
34  powerdown-gpios:
35    maxItems: 1
36    description: Reference to the GPIO connected to the powerdown pin, if any.
37
38  reset-gpios:
39    maxItems: 1
40    description: Reference to the GPIO connected to the reset pin, if any.
41
42  port:
43    $ref: /schemas/graph.yaml#/$defs/port-base
44    description: |
45      Video output port.
46
47    properties:
48      endpoint:
49        $ref: /schemas/media/video-interfaces.yaml#
50        unevaluatedProperties: false
51
52        properties:
53          bus-type:
54            enum: [5, 6]
55
56          bus-width:
57            enum: [8, 10]
58            default: 10
59
60          data-shift:
61            enum: [0, 2]
62            default: 0
63
64          hsync-active:
65            enum: [0, 1]
66            default: 1
67
68          vsync-active:
69            enum: [0, 1]
70            default: 1
71
72          pclk-sample:
73            enum: [0, 1]
74            default: 1
75
76        allOf:
77          - if:
78              properties:
79                bus-type:
80                  const: 6
81            then:
82              properties:
83                hsync-active: false
84                vsync-active: false
85
86          - if:
87              properties:
88                bus-width:
89                  const: 10
90            then:
91              properties:
92                data-shift:
93                  const: 0
94
95        required:
96          - bus-type
97
98    additionalProperties: false
99
100required:
101  - compatible
102  - reg
103  - clocks
104  - port
105
106additionalProperties: false
107
108examples:
109  - |
110      #include <dt-bindings/gpio/gpio.h>
111      #include <dt-bindings/media/video-interfaces.h>
112
113      i2c {
114          #address-cells = <1>;
115          #size-cells = <0>;
116
117          camera@3c {
118              compatible = "ovti,ov5642";
119              reg = <0x3c>;
120              pinctrl-names = "default";
121              pinctrl-0 = <&pinctrl_ov5642>;
122              clocks = <&clk_ext_camera>;
123              DOVDD-supply = <&vgen4_reg>;
124              AVDD-supply = <&vgen3_reg>;
125              DVDD-supply = <&vgen2_reg>;
126              powerdown-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
127              reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
128
129              port {
130                  ov5642_to_parallel: endpoint {
131                      bus-type = <MEDIA_BUS_TYPE_PARALLEL>;
132                      remote-endpoint = <&parallel_from_ov5642>;
133                      bus-width = <8>;
134                      data-shift = <2>; /* lines 9:2 are used */
135                      hsync-active = <0>;
136                      vsync-active = <0>;
137                      pclk-sample = <1>;
138                  };
139              };
140          };
141      };
142