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        additionalProperties: false
160        description: |
161          Child node of the i2c bus multiplexer which represents a GMSL link.
162          Each serializer device on the GMSL link remote end is represented with
163          an i2c-mux child node. The MAX9286 chip supports up to 4 GMSL
164          channels.
165
166        properties:
167          reg:
168            description: The index of the GMSL channel.
169            maxItems: 1
170
171          '#address-cells':
172            const: 1
173
174          '#size-cells':
175            const: 0
176
177        patternProperties:
178          "^camera@[a-f0-9]+$":
179            type: object
180            description: |
181              The remote camera device, composed by a GMSL serializer and a
182              connected video source.
183
184            properties:
185              compatible:
186                description: The remote device compatible string.
187
188              reg:
189                minItems: 2
190                maxItems: 3
191                description: |
192                  The I2C addresses to be assigned to the remote devices through
193                  address reprogramming. The number of entries depends on the
194                  requirements of the currently connected remote device.
195
196              port:
197                $ref: /schemas/graph.yaml#/properties/port
198                description: Connection to the MAX9286 sink.
199
200            required:
201              - compatible
202              - reg
203              - port
204
205            additionalProperties: false
206
207patternProperties:
208  "^port[0-3]-poc-supply$":
209    description: Regulator providing Power over Coax for a particular port
210
211required:
212  - compatible
213  - reg
214  - ports
215  - i2c-mux
216
217allOf:
218  # Only one way of specifying power supplies is allowed: 'maxim,gpio-poc',
219  # 'poc-supply' or per-port poc-supply. Additionally, if 'maxim,gpio-poc' is
220  # present, then 'gpio-controller' isn't allowed.
221  - if:
222      required:
223        - maxim,gpio-poc
224    then:
225      properties:
226        poc-supply: false
227        gpio-controller: false
228      patternProperties:
229        "^port[0-3]-poc-supply$": false
230
231  - if:
232      required:
233        - poc-supply
234    then:
235      patternProperties:
236        "^port[0-3]-poc-supply$": false
237
238additionalProperties: false
239
240examples:
241  - |
242    #include <dt-bindings/gpio/gpio.h>
243
244    i2c@e66d8000 {
245        #address-cells = <1>;
246        #size-cells = <0>;
247
248        reg = <0 0xe66d8000>;
249
250        gmsl-deserializer@2c {
251            compatible = "maxim,max9286";
252            reg = <0x2c>;
253            poc-supply = <&camera_poc_12v>;
254            enable-gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
255
256            gpio-controller;
257            #gpio-cells = <2>;
258
259            maxim,i2c-remote-bus-hz = <339000>;
260            maxim,reverse-channel-microvolt = <170000>;
261
262            ports {
263                #address-cells = <1>;
264                #size-cells = <0>;
265
266                port@0 {
267                    reg = <0>;
268
269                    max9286_in0: endpoint {
270                        remote-endpoint = <&rdacm20_out0>;
271                    };
272                };
273
274                port@1 {
275                    reg = <1>;
276
277                    max9286_in1: endpoint {
278                        remote-endpoint = <&rdacm20_out1>;
279                    };
280                };
281
282                port@2 {
283                    reg = <2>;
284
285                    max9286_in2: endpoint {
286                        remote-endpoint = <&rdacm20_out2>;
287                    };
288                };
289
290                port@3 {
291                    reg = <3>;
292
293                    max9286_in3: endpoint {
294                        remote-endpoint = <&rdacm20_out3>;
295                    };
296                };
297
298                port@4 {
299                    reg = <4>;
300
301                    max9286_out: endpoint {
302                        data-lanes = <1 2 3 4>;
303                        remote-endpoint = <&csi40_in>;
304                    };
305                };
306            };
307
308            i2c-mux {
309                #address-cells = <1>;
310                #size-cells = <0>;
311
312                i2c@0 {
313                    #address-cells = <1>;
314                    #size-cells = <0>;
315                    reg = <0>;
316
317                    camera@51 {
318                        compatible = "imi,rdacm20";
319                        reg = <0x51>, <0x61>;
320
321                        port {
322                            rdacm20_out0: endpoint {
323                                remote-endpoint = <&max9286_in0>;
324                            };
325                        };
326
327                    };
328                };
329
330                i2c@1 {
331                    #address-cells = <1>;
332                    #size-cells = <0>;
333                    reg = <1>;
334
335                    camera@52 {
336                        compatible = "imi,rdacm20";
337                        reg = <0x52>, <0x62>;
338
339                        port {
340                            rdacm20_out1: endpoint {
341                                remote-endpoint = <&max9286_in1>;
342                            };
343                        };
344                    };
345                };
346
347                i2c@2 {
348                    #address-cells = <1>;
349                    #size-cells = <0>;
350                    reg = <2>;
351
352                    camera@53 {
353                        compatible = "imi,rdacm20";
354                        reg = <0x53>, <0x63>;
355
356                        port {
357                            rdacm20_out2: endpoint {
358                                remote-endpoint = <&max9286_in2>;
359                            };
360                        };
361                    };
362                };
363
364                i2c@3 {
365                    #address-cells = <1>;
366                    #size-cells = <0>;
367                    reg = <3>;
368
369                    camera@54 {
370                        compatible = "imi,rdacm20";
371                        reg = <0x54>, <0x64>;
372
373                        port {
374                            rdacm20_out3: endpoint {
375                                remote-endpoint = <&max9286_in3>;
376                            };
377                        };
378                    };
379                };
380            };
381        };
382
383        /*
384        * Example of a deserializer that controls the camera Power over Coax
385        * through one of its gpio lines.
386        */
387        gmsl-deserializer@6c {
388            compatible = "maxim,max9286";
389            reg = <0x6c>;
390            enable-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
391
392            /*
393            * The remote camera power is controlled by MAX9286 GPIO line #0.
394            * No 'poc-supply' nor 'gpio-controller' are specified.
395            */
396            maxim,gpio-poc = <0 GPIO_ACTIVE_LOW>;
397
398            /*
399            * Do not describe connections as they're the same as in the previous
400            * example.
401            */
402            ports {
403                #address-cells = <1>;
404                #size-cells = <0>;
405
406                port@4 {
407                    reg = <4>;
408                };
409            };
410
411            i2c-mux {
412                #address-cells = <1>;
413                #size-cells = <0>;
414            };
415        };
416    };
417