xref: /linux/Documentation/devicetree/bindings/media/renesas,vin.yaml (revision c7546e2c3cb739a3c1a2f5acaf9bb629d401afe5)
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      - items:
56          - enum:
57              - renesas,vin-r8a779a0 # R-Car V3U
58              - renesas,vin-r8a779g0 # R-Car V4H
59              - renesas,vin-r8a779h0 # R-Car V4M
60          - const: renesas,rcar-gen4-vin # Generic R-Car Gen4
61
62  reg:
63    maxItems: 1
64
65  interrupts:
66    maxItems: 1
67
68  clocks:
69    maxItems: 1
70
71  power-domains:
72    maxItems: 1
73
74  resets:
75    maxItems: 1
76
77  # The per-board settings for Gen2 and RZ/G1 platforms:
78  port:
79    $ref: /schemas/graph.yaml#/$defs/port-base
80    unevaluatedProperties: false
81    description:
82      A node containing a parallel input
83
84    properties:
85      endpoint:
86        $ref: video-interfaces.yaml#
87        unevaluatedProperties: false
88
89        properties:
90          hsync-active:
91            description:
92              If both HSYNC and VSYNC polarities are not specified, embedded
93              synchronization is selected.
94            default: 1
95
96          vsync-active:
97            description:
98              If both HSYNC and VSYNC polarities are not specified, embedded
99              synchronization is selected.
100            default: 1
101
102          field-even-active: true
103
104          bus-width: true
105
106          data-shift: true
107
108          data-enable-active:
109            description: Polarity of CLKENB signal
110            default: 1
111
112          pclk-sample: true
113
114          data-active: true
115
116  # The per-board settings for Gen3 and RZ/G2 platforms:
117  renesas,id:
118    description: VIN channel number
119    $ref: /schemas/types.yaml#/definitions/uint32
120    minimum: 0
121    maximum: 31
122
123  ports:
124    $ref: /schemas/graph.yaml#/properties/ports
125
126    properties:
127      port@0:
128        $ref: /schemas/graph.yaml#/$defs/port-base
129        unevaluatedProperties: false
130        description:
131          Input port node, single endpoint describing a parallel input source.
132
133        properties:
134          endpoint:
135            $ref: video-interfaces.yaml#
136            unevaluatedProperties: false
137
138            properties:
139              hsync-active:
140                description:
141                  If both HSYNC and VSYNC polarities are not specified, embedded
142                  synchronization is selected.
143                default: 1
144
145              vsync-active:
146                description:
147                  If both HSYNC and VSYNC polarities are not specified, embedded
148                  synchronization is selected.
149                default: 1
150
151              field-even-active: true
152
153              bus-width: true
154
155              data-shift: true
156
157              data-enable-active:
158                description: Polarity of CLKENB signal
159                default: 1
160
161              pclk-sample: true
162
163              data-active: true
164
165      port@1:
166        $ref: /schemas/graph.yaml#/properties/port
167        description:
168          Input port node, multiple endpoints describing all the R-Car CSI-2
169          modules connected the VIN.
170
171        properties:
172          endpoint@0:
173            $ref: /schemas/graph.yaml#/properties/endpoint
174            description: Endpoint connected to CSI20.
175
176          endpoint@1:
177            $ref: /schemas/graph.yaml#/properties/endpoint
178            description: Endpoint connected to CSI21.
179
180          endpoint@2:
181            $ref: /schemas/graph.yaml#/properties/endpoint
182            description: Endpoint connected to CSI40.
183
184          endpoint@3:
185            $ref: /schemas/graph.yaml#/properties/endpoint
186            description: Endpoint connected to CSI41.
187
188        anyOf:
189          - required:
190              - endpoint@0
191          - required:
192              - endpoint@1
193          - required:
194              - endpoint@2
195          - required:
196              - endpoint@3
197
198      port@2:
199        $ref: /schemas/graph.yaml#/properties/port
200        description:
201          Input port node, multiple endpoints describing all the R-Car ISP
202          modules connected the VIN.
203
204        properties:
205          endpoint@0:
206            $ref: /schemas/graph.yaml#/properties/endpoint
207            description: Endpoint connected to ISP0.
208
209          endpoint@1:
210            $ref: /schemas/graph.yaml#/properties/endpoint
211            description: Endpoint connected to ISP1.
212
213          endpoint@2:
214            $ref: /schemas/graph.yaml#/properties/endpoint
215            description: Endpoint connected to ISP2.
216
217          endpoint@3:
218            $ref: /schemas/graph.yaml#/properties/endpoint
219            description: Endpoint connected to ISP3.
220
221required:
222  - compatible
223  - reg
224  - interrupts
225  - clocks
226  - power-domains
227
228allOf:
229  - if:
230      not:
231        properties:
232          compatible:
233            contains:
234              enum:
235                - renesas,vin-r8a7778
236                - renesas,vin-r8a7779
237    then:
238      required:
239        - resets
240
241  - if:
242      properties:
243        compatible:
244          contains:
245            enum:
246              - renesas,vin-r8a7778
247              - renesas,vin-r8a7779
248              - renesas,rcar-gen2-vin
249    then:
250      required:
251        - port
252    else:
253      required:
254        - renesas,id
255        - ports
256
257additionalProperties: false
258
259examples:
260  # Device node example for Gen2 platform
261  - |
262    #include <dt-bindings/clock/r8a7790-cpg-mssr.h>
263    #include <dt-bindings/interrupt-controller/arm-gic.h>
264    #include <dt-bindings/power/r8a7790-sysc.h>
265
266    vin1: vin@e6ef1000 {
267            compatible = "renesas,vin-r8a7790",
268                         "renesas,rcar-gen2-vin";
269            reg = <0xe6ef1000 0x1000>;
270            interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
271            clocks = <&cpg CPG_MOD 810>;
272            power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
273            resets = <&cpg 810>;
274
275            port {
276                    vin1ep0: endpoint {
277                            remote-endpoint = <&adv7180>;
278                            bus-width = <8>;
279                    };
280            };
281    };
282
283  # Device node example for Gen3 platform with only CSI-2
284  - |
285    #include <dt-bindings/clock/r8a7795-cpg-mssr.h>
286    #include <dt-bindings/interrupt-controller/arm-gic.h>
287    #include <dt-bindings/power/r8a7795-sysc.h>
288
289    vin0: video@e6ef0000 {
290            compatible = "renesas,vin-r8a7795";
291            reg = <0xe6ef0000 0x1000>;
292            interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
293            clocks = <&cpg CPG_MOD 811>;
294            power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
295            resets = <&cpg 811>;
296            renesas,id = <0>;
297
298            ports {
299                    #address-cells = <1>;
300                    #size-cells = <0>;
301
302                    port@1 {
303                            #address-cells = <1>;
304                            #size-cells = <0>;
305
306                            reg = <1>;
307
308                            vin0csi20: endpoint@0 {
309                                    reg = <0>;
310                                    remote-endpoint = <&csi20vin0>;
311                            };
312                            vin0csi40: endpoint@2 {
313                                    reg = <2>;
314                                    remote-endpoint = <&csi40vin0>;
315                            };
316                    };
317            };
318    };
319
320  # Device node example for Gen3 platform with CSI-2 and parallel
321  - |
322    #include <dt-bindings/clock/r8a77970-cpg-mssr.h>
323    #include <dt-bindings/interrupt-controller/arm-gic.h>
324    #include <dt-bindings/power/r8a77970-sysc.h>
325
326    vin2: video@e6ef2000 {
327            compatible = "renesas,vin-r8a77970";
328            reg = <0xe6ef2000 0x1000>;
329            interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
330            clocks = <&cpg CPG_MOD 809>;
331            power-domains = <&sysc R8A77970_PD_ALWAYS_ON>;
332            resets = <&cpg 809>;
333            renesas,id = <2>;
334
335            ports {
336                    #address-cells = <1>;
337                    #size-cells = <0>;
338
339                    port@0 {
340                            reg = <0>;
341
342                            vin2_in: endpoint {
343                                    remote-endpoint = <&adv7612_out>;
344                                    hsync-active = <0>;
345                                    vsync-active = <0>;
346                            };
347                    };
348
349                    port@1 {
350                            #address-cells = <1>;
351                            #size-cells = <0>;
352
353                            reg = <1>;
354
355                            vin2csi40: endpoint@2 {
356                                    reg = <2>;
357                                    remote-endpoint = <&csi40vin2>;
358                            };
359                    };
360            };
361    };
362