1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright (C) 2019 Renesas Electronics Corp.
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/media/i2c/maxim,max9286.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: Maxim Integrated Quad GMSL Deserializer
9
10maintainers:
11  - Jacopo Mondi <jacopo+renesas@jmondi.org>
12  - Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
13  - Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
14  - Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
15
16description: |
17  The MAX9286 deserializer receives video data on up to 4 Gigabit Multimedia
18  Serial Links (GMSL) and outputs them on a CSI-2 D-PHY port using up to 4 data
19  lanes.
20
21  In addition to video data, the GMSL links carry a bidirectional control
22  channel that encapsulates I2C messages. The MAX9286 forwards all I2C traffic
23  not addressed to itself to the other side of the links, where a GMSL
24  serializer will output it on a local I2C bus. In the other direction all I2C
25  traffic received over GMSL by the MAX9286 is output on the local I2C bus.
26
27properties:
28  '#address-cells':
29    const: 1
30
31  '#size-cells':
32    const: 0
33
34  compatible:
35    const: maxim,max9286
36
37  reg:
38    description: I2C device address
39    maxItems: 1
40
41  poc-supply:
42    description: Regulator providing Power over Coax to the cameras
43
44  enable-gpios:
45    description: GPIO connected to the \#PWDN pin with inverted polarity
46    maxItems: 1
47
48  gpio-controller: true
49
50  '#gpio-cells':
51    const: 2
52
53  maxim,reverse-channel-microvolt:
54    minimum: 30000
55    maximum: 200000
56    default: 170000
57    description: |
58      Initial amplitude of the reverse control channel, in micro volts.
59
60      The initial amplitude shall be adjusted to a value compatible with the
61      configuration of the connected remote serializer.
62
63      Some camera modules (for example RDACM20) include an on-board MCU that
64      pre-programs the embedded serializer with power supply noise immunity
65      (high-threshold) enabled. A typical value of the deserializer's reverse
66      channel amplitude to communicate with pre-programmed serializers is
67      170000 micro volts.
68
69      A typical value for the reverse channel amplitude to communicate with
70      a remote serializer whose high-threshold noise immunity is not enabled
71      is 100000 micro volts
72
73  maxim,gpio-poc:
74    $ref: '/schemas/types.yaml#/definitions/uint32-array'
75    minItems: 2
76    maxItems: 2
77    description: |
78      Index of the MAX9286 gpio output line (0 or 1) that controls Power over
79      Coax to the cameras and its associated polarity flag.
80
81      The property accepts an array of two unsigned integers, the first being
82      the gpio line index (0 or 1) and the second being the gpio line polarity
83      flag (GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW) as defined in
84      <include/dt-bindings/gpio/gpio.h>.
85
86      When the remote cameras power is controlled by one of the MAX9286 gpio
87      lines, this property has to be used to specify which line among the two
88      available ones controls the remote camera power enablement.
89
90      When this property is used it is not possible to register a gpio
91      controller as the gpio lines are controlled directly by the MAX9286 and
92      not available for consumers, nor the 'poc-supply' property should be
93      specified.
94
95  ports:
96    $ref: /schemas/graph.yaml#/properties/ports
97
98    properties:
99      port@0:
100        $ref: /schemas/graph.yaml#/properties/port
101        description: GMSL Input 0
102
103      port@1:
104        $ref: /schemas/graph.yaml#/properties/port
105        description: GMSL Input 1
106
107      port@2:
108        $ref: /schemas/graph.yaml#/properties/port
109        description: GMSL Input 2
110
111      port@3:
112        $ref: /schemas/graph.yaml#/properties/port
113        description: GMSL Input 3
114
115      port@4:
116        $ref: /schemas/graph.yaml#/$defs/port-base
117        unevaluatedProperties: false
118        description: CSI-2 Output
119
120        properties:
121          endpoint:
122            $ref: /schemas/media/video-interfaces.yaml#
123            unevaluatedProperties: false
124
125            properties:
126              data-lanes: true
127
128            required:
129              - data-lanes
130
131    required:
132      - port@4
133
134  i2c-mux:
135    type: object
136    $ref: /schemas/i2c/i2c-mux.yaml#
137    unevaluatedProperties: false
138    description: |
139      Each GMSL link is modelled as a child bus of an i2c bus multiplexer/switch.
140
141    patternProperties:
142      "^i2c@[0-3]$":
143        type: object
144        description: |
145          Child node of the i2c bus multiplexer which represents a GMSL link.
146          Each serializer device on the GMSL link remote end is represented with
147          an i2c-mux child node. The MAX9286 chip supports up to 4 GMSL
148          channels.
149
150        properties:
151          reg:
152            description: The index of the GMSL channel.
153            maxItems: 1
154
155        patternProperties:
156          "^camera@[a-f0-9]+$":
157            type: object
158            description: |
159              The remote camera device, composed by a GMSL serializer and a
160              connected video source.
161
162            properties:
163              compatible:
164                description: The remote device compatible string.
165
166              reg:
167                minItems: 2
168                maxItems: 3
169                description: |
170                  The I2C addresses to be assigned to the remote devices through
171                  address reprogramming. The number of entries depends on the
172                  requirements of the currently connected remote device.
173
174              port:
175                $ref: /schemas/graph.yaml#/properties/port
176                description: Connection to the MAX9286 sink.
177
178            required:
179              - compatible
180              - reg
181              - port
182
183            additionalProperties: false
184
185required:
186  - compatible
187  - reg
188  - ports
189  - i2c-mux
190
191# If 'maxim,gpio-poc' is present, then 'poc-supply' and 'gpio-controller'
192# are not allowed.
193if:
194  required:
195    - maxim,gpio-poc
196then:
197  properties:
198    poc-supply: false
199    gpio-controller: false
200
201additionalProperties: false
202
203examples:
204  - |
205    #include <dt-bindings/gpio/gpio.h>
206
207    i2c@e66d8000 {
208        #address-cells = <1>;
209        #size-cells = <0>;
210
211        reg = <0 0xe66d8000>;
212
213        gmsl-deserializer@2c {
214            compatible = "maxim,max9286";
215            reg = <0x2c>;
216            poc-supply = <&camera_poc_12v>;
217            enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
218
219            gpio-controller;
220            #gpio-cells = <2>;
221
222            maxim,reverse-channel-microvolt = <170000>;
223
224            ports {
225                #address-cells = <1>;
226                #size-cells = <0>;
227
228                port@0 {
229                    reg = <0>;
230
231                    max9286_in0: endpoint {
232                        remote-endpoint = <&rdacm20_out0>;
233                    };
234                };
235
236                port@1 {
237                    reg = <1>;
238
239                    max9286_in1: endpoint {
240                        remote-endpoint = <&rdacm20_out1>;
241                    };
242                };
243
244                port@2 {
245                    reg = <2>;
246
247                    max9286_in2: endpoint {
248                        remote-endpoint = <&rdacm20_out2>;
249                    };
250                };
251
252                port@3 {
253                    reg = <3>;
254
255                    max9286_in3: endpoint {
256                        remote-endpoint = <&rdacm20_out3>;
257                    };
258                };
259
260                port@4 {
261                    reg = <4>;
262
263                    max9286_out: endpoint {
264                        data-lanes = <1 2 3 4>;
265                        remote-endpoint = <&csi40_in>;
266                    };
267                };
268            };
269
270            i2c-mux {
271                #address-cells = <1>;
272                #size-cells = <0>;
273
274                i2c@0 {
275                    #address-cells = <1>;
276                    #size-cells = <0>;
277                    reg = <0>;
278
279                    camera@51 {
280                        compatible = "imi,rdacm20";
281                        reg = <0x51>, <0x61>;
282
283                        port {
284                            rdacm20_out0: endpoint {
285                                remote-endpoint = <&max9286_in0>;
286                            };
287                        };
288
289                    };
290                };
291
292                i2c@1 {
293                    #address-cells = <1>;
294                    #size-cells = <0>;
295                    reg = <1>;
296
297                    camera@52 {
298                        compatible = "imi,rdacm20";
299                        reg = <0x52>, <0x62>;
300
301                        port {
302                            rdacm20_out1: endpoint {
303                                remote-endpoint = <&max9286_in1>;
304                            };
305                        };
306                    };
307                };
308
309                i2c@2 {
310                    #address-cells = <1>;
311                    #size-cells = <0>;
312                    reg = <2>;
313
314                    camera@53 {
315                        compatible = "imi,rdacm20";
316                        reg = <0x53>, <0x63>;
317
318                        port {
319                            rdacm20_out2: endpoint {
320                                remote-endpoint = <&max9286_in2>;
321                            };
322                        };
323                    };
324                };
325
326                i2c@3 {
327                    #address-cells = <1>;
328                    #size-cells = <0>;
329                    reg = <3>;
330
331                    camera@54 {
332                        compatible = "imi,rdacm20";
333                        reg = <0x54>, <0x64>;
334
335                        port {
336                            rdacm20_out3: endpoint {
337                                remote-endpoint = <&max9286_in3>;
338                            };
339                        };
340                    };
341                };
342            };
343        };
344
345        /*
346        * Example of a deserializer that controls the camera Power over Coax
347        * through one of its gpio lines.
348        */
349        gmsl-deserializer@6c {
350            compatible = "maxim,max9286";
351            reg = <0x6c>;
352            enable-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
353
354            /*
355            * The remote camera power is controlled by MAX9286 GPIO line #0.
356            * No 'poc-supply' nor 'gpio-controller' are specified.
357            */
358            maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
359
360            /*
361            * Do not describe connections as they're the same as in the previous
362            * example.
363            */
364            ports {
365                #address-cells = <1>;
366                #size-cells = <0>;
367
368                port@4 {
369                    reg = <4>;
370                };
371            };
372
373            i2c-mux {
374                #address-cells = <1>;
375                #size-cells = <0>;
376            };
377        };
378    };
379