xref: /freebsd/sys/contrib/device-tree/Bindings/media/renesas,vin.yaml (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
1# SPDX-License-Identifier: GPL-2.0-only
2# Copyright (C) 2020 Renesas Electronics Corp.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/media/renesas,vin.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Renesas R-Car Video Input (VIN)
9
10maintainers:
11  - Niklas Söderlund <niklas.soderlund@ragnatech.se>
12
13description:
14  The R-Car Video Input (VIN) device provides video input capabilities for the
15  Renesas R-Car family of devices.
16
17  Each VIN instance has a single parallel input that supports RGB and YUV video,
18  with both external synchronization and BT.656 synchronization for the latter.
19  Depending on the instance the VIN input is connected to external SoC pins, or
20  on Gen3 and RZ/G2 platforms to a CSI-2 receiver.
21
22properties:
23  compatible:
24    oneOf:
25      - items:
26          - enum:
27              - renesas,vin-r8a7742  # RZ/G1H
28              - renesas,vin-r8a7743  # RZ/G1M
29              - renesas,vin-r8a7744  # RZ/G1N
30              - renesas,vin-r8a7745  # RZ/G1E
31              - renesas,vin-r8a77470 # RZ/G1C
32              - renesas,vin-r8a7790  # R-Car H2
33              - renesas,vin-r8a7791  # R-Car M2-W
34              - renesas,vin-r8a7792  # R-Car V2H
35              - renesas,vin-r8a7793  # R-Car M2-N
36              - renesas,vin-r8a7794  # R-Car E2
37          - const: renesas,rcar-gen2-vin # Generic R-Car Gen2 or RZ/G1
38
39      - items:
40          - enum:
41              - renesas,vin-r8a774a1 # RZ/G2M
42              - renesas,vin-r8a774b1 # RZ/G2N
43              - renesas,vin-r8a774c0 # RZ/G2E
44              - renesas,vin-r8a774e1 # RZ/G2H
45              - renesas,vin-r8a7778  # R-Car M1
46              - renesas,vin-r8a7779  # R-Car H1
47              - renesas,vin-r8a7795  # R-Car H3
48              - renesas,vin-r8a7796  # R-Car M3-W
49              - renesas,vin-r8a77961 # R-Car M3-W+
50              - renesas,vin-r8a77965 # R-Car M3-N
51              - renesas,vin-r8a77970 # R-Car V3M
52              - renesas,vin-r8a77980 # R-Car V3H
53              - renesas,vin-r8a77990 # R-Car E3
54              - renesas,vin-r8a77995 # R-Car D3
55              - renesas,vin-r8a779a0 # R-Car V3U
56
57  reg:
58    maxItems: 1
59
60  interrupts:
61    maxItems: 1
62
63  clocks:
64    maxItems: 1
65
66  power-domains:
67    maxItems: 1
68
69  resets:
70    maxItems: 1
71
72  #The per-board settings for Gen2 and RZ/G1 platforms:
73  port:
74    $ref: /schemas/graph.yaml#/$defs/port-base
75    unevaluatedProperties: false
76    description:
77      A node containing a parallel input
78
79    properties:
80      endpoint:
81        $ref: video-interfaces.yaml#
82        unevaluatedProperties: false
83
84        properties:
85          hsync-active:
86            description:
87              If both HSYNC and VSYNC polarities are not specified, embedded
88              synchronization is selected.
89            default: 1
90
91          vsync-active:
92            description:
93              If both HSYNC and VSYNC polarities are not specified, embedded
94              synchronization is selected.
95            default: 1
96
97          field-active-even: true
98
99          bus-width: true
100
101          data-shift: true
102
103          data-enable-active:
104            description: Polarity of CLKENB signal
105            default: 1
106
107          pclk-sample: true
108
109          data-active: true
110
111  #The per-board settings for Gen3 and RZ/G2 platforms:
112  renesas,id:
113    description: VIN channel number
114    $ref: /schemas/types.yaml#/definitions/uint32
115    minimum: 0
116    maximum: 31
117
118  ports:
119    $ref: /schemas/graph.yaml#/properties/ports
120
121    properties:
122      port@0:
123        $ref: /schemas/graph.yaml#/$defs/port-base
124        unevaluatedProperties: false
125        description:
126          Input port node, single endpoint describing a parallel input source.
127
128        properties:
129          endpoint:
130            $ref: video-interfaces.yaml#
131            unevaluatedProperties: false
132
133            properties:
134              hsync-active:
135                description:
136                  If both HSYNC and VSYNC polarities are not specified, embedded
137                  synchronization is selected.
138                default: 1
139
140              vsync-active:
141                description:
142                  If both HSYNC and VSYNC polarities are not specified, embedded
143                  synchronization is selected.
144                default: 1
145
146              field-active-even: true
147
148              bus-width: true
149
150              data-shift: true
151
152              data-enable-active:
153                description: Polarity of CLKENB signal
154                default: 1
155
156              pclk-sample: true
157
158              data-active: true
159
160      port@1:
161        $ref: /schemas/graph.yaml#/properties/port
162        description:
163          Input port node, multiple endpoints describing all the R-Car CSI-2
164          modules connected the VIN.
165
166        properties:
167          endpoint@0:
168            $ref: /schemas/graph.yaml#/properties/endpoint
169            description: Endpoint connected to CSI20.
170
171          endpoint@1:
172            $ref: /schemas/graph.yaml#/properties/endpoint
173            description: Endpoint connected to CSI21.
174
175          endpoint@2:
176            $ref: /schemas/graph.yaml#/properties/endpoint
177            description: Endpoint connected to CSI40.
178
179          endpoint@3:
180            $ref: /schemas/graph.yaml#/properties/endpoint
181            description: Endpoint connected to CSI41.
182
183        anyOf:
184          - required:
185              - endpoint@0
186          - required:
187              - endpoint@1
188          - required:
189              - endpoint@2
190          - required:
191              - endpoint@3
192
193      port@2:
194        $ref: /schemas/graph.yaml#/properties/port
195        description:
196          Input port node, multiple endpoints describing all the R-Car ISP
197          modules connected the VIN.
198
199        properties:
200          endpoint@0:
201            $ref: /schemas/graph.yaml#/properties/endpoint
202            description: Endpoint connected to ISP0.
203
204          endpoint@1:
205            $ref: /schemas/graph.yaml#/properties/endpoint
206            description: Endpoint connected to ISP1.
207
208          endpoint@2:
209            $ref: /schemas/graph.yaml#/properties/endpoint
210            description: Endpoint connected to ISP2.
211
212          endpoint@3:
213            $ref: /schemas/graph.yaml#/properties/endpoint
214            description: Endpoint connected to ISP3.
215
216required:
217  - compatible
218  - reg
219  - interrupts
220  - clocks
221  - power-domains
222
223allOf:
224  - if:
225      not:
226        properties:
227          compatible:
228            contains:
229              enum:
230                - renesas,vin-r8a7778
231                - renesas,vin-r8a7779
232    then:
233      required:
234        - resets
235
236  - if:
237      properties:
238        compatible:
239          contains:
240            enum:
241              - renesas,vin-r8a7778
242              - renesas,vin-r8a7779
243              - renesas,rcar-gen2-vin
244    then:
245      required:
246        - port
247    else:
248      required:
249        - renesas,id
250        - ports
251
252additionalProperties: false
253
254examples:
255  # Device node example for Gen2 platform
256  - |
257    #include <dt-bindings/clock/r8a7790-cpg-mssr.h>
258    #include <dt-bindings/interrupt-controller/arm-gic.h>
259    #include <dt-bindings/power/r8a7790-sysc.h>
260
261    vin1: vin@e6ef1000 {
262            compatible = "renesas,vin-r8a7790",
263                         "renesas,rcar-gen2-vin";
264            reg = <0xe6ef1000 0x1000>;
265            interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
266            clocks = <&cpg CPG_MOD 810>;
267            power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
268            resets = <&cpg 810>;
269
270            port {
271                    vin1ep0: endpoint {
272                            remote-endpoint = <&adv7180>;
273                            bus-width = <8>;
274                    };
275            };
276    };
277
278  # Device node example for Gen3 platform with only CSI-2
279  - |
280    #include <dt-bindings/clock/r8a7795-cpg-mssr.h>
281    #include <dt-bindings/interrupt-controller/arm-gic.h>
282    #include <dt-bindings/power/r8a7795-sysc.h>
283
284    vin0: video@e6ef0000 {
285            compatible = "renesas,vin-r8a7795";
286            reg = <0xe6ef0000 0x1000>;
287            interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
288            clocks = <&cpg CPG_MOD 811>;
289            power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
290            resets = <&cpg 811>;
291            renesas,id = <0>;
292
293            ports {
294                    #address-cells = <1>;
295                    #size-cells = <0>;
296
297                    port@1 {
298                            #address-cells = <1>;
299                            #size-cells = <0>;
300
301                            reg = <1>;
302
303                            vin0csi20: endpoint@0 {
304                                    reg = <0>;
305                                    remote-endpoint= <&csi20vin0>;
306                            };
307                            vin0csi40: endpoint@2 {
308                                    reg = <2>;
309                                    remote-endpoint= <&csi40vin0>;
310                            };
311                    };
312            };
313    };
314
315  # Device node example for Gen3 platform with CSI-2 and parallel
316  - |
317    #include <dt-bindings/clock/r8a77970-cpg-mssr.h>
318    #include <dt-bindings/interrupt-controller/arm-gic.h>
319    #include <dt-bindings/power/r8a77970-sysc.h>
320
321    vin2: video@e6ef2000 {
322            compatible = "renesas,vin-r8a77970";
323            reg = <0xe6ef2000 0x1000>;
324            interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
325            clocks = <&cpg CPG_MOD 809>;
326            power-domains = <&sysc R8A77970_PD_ALWAYS_ON>;
327            resets = <&cpg 809>;
328            renesas,id = <2>;
329
330            ports {
331                    #address-cells = <1>;
332                    #size-cells = <0>;
333
334                    port@0 {
335                            reg = <0>;
336
337                            vin2_in: endpoint {
338                                    remote-endpoint = <&adv7612_out>;
339                                    hsync-active = <0>;
340                                    vsync-active = <0>;
341                            };
342                    };
343
344                    port@1 {
345                            #address-cells = <1>;
346                            #size-cells = <0>;
347
348                            reg = <1>;
349
350                            vin2csi40: endpoint@2 {
351                                    reg = <2>;
352                                    remote-endpoint = <&csi40vin2>;
353                            };
354                    };
355            };
356    };
357