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 all the ports
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,bus-width:
54    $ref: /schemas/types.yaml#/definitions/uint32
55    enum: [ 24, 27, 32 ]
56    description: |
57      The GMSL serial data bus width. This setting is normally controlled by
58      the BWS pin, but may be overridden with this property. The value must
59      match the configuration of the remote serializers.
60
61  maxim,i2c-remote-bus-hz:
62    enum: [ 8470, 28300, 84700, 105000, 173000, 339000, 533000, 837000 ]
63    default: 105000
64    description: |
65      The I2C clock frequency for the remote I2C buses. The value must match
66      the configuration of the remote serializers.
67
68  maxim,reverse-channel-microvolt:
69    minimum: 30000
70    maximum: 200000
71    default: 170000
72    description: |
73      Initial amplitude of the reverse control channel, in micro volts.
74
75      The initial amplitude shall be adjusted to a value compatible with the
76      configuration of the connected remote serializer.
77
78      Some camera modules (for example RDACM20) include an on-board MCU that
79      pre-programs the embedded serializer with power supply noise immunity
80      (high-threshold) enabled. A typical value of the deserializer's reverse
81      channel amplitude to communicate with pre-programmed serializers is
82      170000 micro volts.
83
84      A typical value for the reverse channel amplitude to communicate with
85      a remote serializer whose high-threshold noise immunity is not enabled
86      is 100000 micro volts
87
88  maxim,gpio-poc:
89    $ref: '/schemas/types.yaml#/definitions/uint32-array'
90    minItems: 2
91    maxItems: 2
92    description: |
93      Index of the MAX9286 gpio output line (0 or 1) that controls Power over
94      Coax to the cameras and its associated polarity flag.
95
96      The property accepts an array of two unsigned integers, the first being
97      the gpio line index (0 or 1) and the second being the gpio line polarity
98      flag (GPIO_ACTIVE_HIGH or GPIO_ACTIVE_LOW) as defined in
99      <include/dt-bindings/gpio/gpio.h>.
100
101      When the remote cameras power is controlled by one of the MAX9286 gpio
102      lines, this property has to be used to specify which line among the two
103      available ones controls the remote camera power enablement.
104
105      When this property is used it is not possible to register a gpio
106      controller as the gpio lines are controlled directly by the MAX9286 and
107      not available for consumers, nor the 'poc-supply' property should be
108      specified.
109
110  ports:
111    $ref: /schemas/graph.yaml#/properties/ports
112
113    properties:
114      port@0:
115        $ref: /schemas/graph.yaml#/properties/port
116        description: GMSL Input 0
117
118      port@1:
119        $ref: /schemas/graph.yaml#/properties/port
120        description: GMSL Input 1
121
122      port@2:
123        $ref: /schemas/graph.yaml#/properties/port
124        description: GMSL Input 2
125
126      port@3:
127        $ref: /schemas/graph.yaml#/properties/port
128        description: GMSL Input 3
129
130      port@4:
131        $ref: /schemas/graph.yaml#/$defs/port-base
132        unevaluatedProperties: false
133        description: CSI-2 Output
134
135        properties:
136          endpoint:
137            $ref: /schemas/media/video-interfaces.yaml#
138            unevaluatedProperties: false
139
140            properties:
141              data-lanes: true
142
143            required:
144              - data-lanes
145
146    required:
147      - port@4
148
149  i2c-mux:
150    type: object
151    $ref: /schemas/i2c/i2c-mux.yaml#
152    unevaluatedProperties: false
153    description: |
154      Each GMSL link is modelled as a child bus of an i2c bus multiplexer/switch.
155
156    patternProperties:
157      "^i2c@[0-3]$":
158        type: object
159        description: |
160          Child node of the i2c bus multiplexer which represents a GMSL link.
161          Each serializer device on the GMSL link remote end is represented with
162          an i2c-mux child node. The MAX9286 chip supports up to 4 GMSL
163          channels.
164
165        properties:
166          reg:
167            description: The index of the GMSL channel.
168            maxItems: 1
169
170        patternProperties:
171          "^camera@[a-f0-9]+$":
172            type: object
173            description: |
174              The remote camera device, composed by a GMSL serializer and a
175              connected video source.
176
177            properties:
178              compatible:
179                description: The remote device compatible string.
180
181              reg:
182                minItems: 2
183                maxItems: 3
184                description: |
185                  The I2C addresses to be assigned to the remote devices through
186                  address reprogramming. The number of entries depends on the
187                  requirements of the currently connected remote device.
188
189              port:
190                $ref: /schemas/graph.yaml#/properties/port
191                description: Connection to the MAX9286 sink.
192
193            required:
194              - compatible
195              - reg
196              - port
197
198            additionalProperties: false
199
200patternProperties:
201  "^port[0-3]-poc-supply$":
202    description: Regulator providing Power over Coax for a particular port
203
204required:
205  - compatible
206  - reg
207  - ports
208  - i2c-mux
209
210allOf:
211  # Only one way of specifying power supplies is allowed: 'maxim,gpio-poc',
212  # 'poc-supply' or per-port poc-supply. Additionally, if 'maxim,gpio-poc' is
213  # present, then 'gpio-controller' isn't allowed.
214  - if:
215      required:
216        - maxim,gpio-poc
217    then:
218      properties:
219        poc-supply: false
220        gpio-controller: false
221      patternProperties:
222        "^port[0-3]-poc-supply$": false
223
224  - if:
225      required:
226        - poc-supply
227    then:
228      patternProperties:
229        "^port[0-3]-poc-supply$": false
230
231additionalProperties: false
232
233examples:
234  - |
235    #include <dt-bindings/gpio/gpio.h>
236
237    i2c@e66d8000 {
238        #address-cells = <1>;
239        #size-cells = <0>;
240
241        reg = <0 0xe66d8000>;
242
243        gmsl-deserializer@2c {
244            compatible = "maxim,max9286";
245            reg = <0x2c>;
246            poc-supply = <&camera_poc_12v>;
247            enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
248
249            gpio-controller;
250            #gpio-cells = <2>;
251
252            maxim,i2c-remote-bus-hz = <339000>;
253            maxim,reverse-channel-microvolt = <170000>;
254
255            ports {
256                #address-cells = <1>;
257                #size-cells = <0>;
258
259                port@0 {
260                    reg = <0>;
261
262                    max9286_in0: endpoint {
263                        remote-endpoint = <&rdacm20_out0>;
264                    };
265                };
266
267                port@1 {
268                    reg = <1>;
269
270                    max9286_in1: endpoint {
271                        remote-endpoint = <&rdacm20_out1>;
272                    };
273                };
274
275                port@2 {
276                    reg = <2>;
277
278                    max9286_in2: endpoint {
279                        remote-endpoint = <&rdacm20_out2>;
280                    };
281                };
282
283                port@3 {
284                    reg = <3>;
285
286                    max9286_in3: endpoint {
287                        remote-endpoint = <&rdacm20_out3>;
288                    };
289                };
290
291                port@4 {
292                    reg = <4>;
293
294                    max9286_out: endpoint {
295                        data-lanes = <1 2 3 4>;
296                        remote-endpoint = <&csi40_in>;
297                    };
298                };
299            };
300
301            i2c-mux {
302                #address-cells = <1>;
303                #size-cells = <0>;
304
305                i2c@0 {
306                    #address-cells = <1>;
307                    #size-cells = <0>;
308                    reg = <0>;
309
310                    camera@51 {
311                        compatible = "imi,rdacm20";
312                        reg = <0x51>, <0x61>;
313
314                        port {
315                            rdacm20_out0: endpoint {
316                                remote-endpoint = <&max9286_in0>;
317                            };
318                        };
319
320                    };
321                };
322
323                i2c@1 {
324                    #address-cells = <1>;
325                    #size-cells = <0>;
326                    reg = <1>;
327
328                    camera@52 {
329                        compatible = "imi,rdacm20";
330                        reg = <0x52>, <0x62>;
331
332                        port {
333                            rdacm20_out1: endpoint {
334                                remote-endpoint = <&max9286_in1>;
335                            };
336                        };
337                    };
338                };
339
340                i2c@2 {
341                    #address-cells = <1>;
342                    #size-cells = <0>;
343                    reg = <2>;
344
345                    camera@53 {
346                        compatible = "imi,rdacm20";
347                        reg = <0x53>, <0x63>;
348
349                        port {
350                            rdacm20_out2: endpoint {
351                                remote-endpoint = <&max9286_in2>;
352                            };
353                        };
354                    };
355                };
356
357                i2c@3 {
358                    #address-cells = <1>;
359                    #size-cells = <0>;
360                    reg = <3>;
361
362                    camera@54 {
363                        compatible = "imi,rdacm20";
364                        reg = <0x54>, <0x64>;
365
366                        port {
367                            rdacm20_out3: endpoint {
368                                remote-endpoint = <&max9286_in3>;
369                            };
370                        };
371                    };
372                };
373            };
374        };
375
376        /*
377        * Example of a deserializer that controls the camera Power over Coax
378        * through one of its gpio lines.
379        */
380        gmsl-deserializer@6c {
381            compatible = "maxim,max9286";
382            reg = <0x6c>;
383            enable-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
384
385            /*
386            * The remote camera power is controlled by MAX9286 GPIO line #0.
387            * No 'poc-supply' nor 'gpio-controller' are specified.
388            */
389            maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
390
391            /*
392            * Do not describe connections as they're the same as in the previous
393            * example.
394            */
395            ports {
396                #address-cells = <1>;
397                #size-cells = <0>;
398
399                port@4 {
400                    reg = <4>;
401                };
402            };
403
404            i2c-mux {
405                #address-cells = <1>;
406                #size-cells = <0>;
407            };
408        };
409    };
410