1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2# Copyright (c) 2023 Ideas on Board
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/media/i2c/thine,thp7312.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: THine THP7312
9
10maintainers:
11  - Paul Elder <paul.elder@@ideasonboard.com>
12
13description:
14  The THP7312 is a standalone ISP controlled over i2c, and is capable of
15  various image processing and correction functions, including 3A control. It
16  can be connected to CMOS image sensors from various vendors, supporting both
17  MIPI CSI-2 and parallel interfaces. It can also output on either MIPI CSI-2
18  or parallel. The hardware is capable of transmitting and receiving MIPI
19  interlaved data strams with data types or multiple virtual channel
20  identifiers.
21
22allOf:
23  - $ref: /schemas/media/video-interface-devices.yaml#
24
25properties:
26  compatible:
27    const: thine,thp7312
28
29  reg:
30    maxItems: 1
31
32  clocks:
33    maxItems: 1
34    description: CLKI clock input
35
36  thine,boot-mode:
37    $ref: /schemas/types.yaml#/definitions/uint32
38    minimum: 0
39    maximum: 1
40    default: 1
41    description:
42      Boot mode of the THP7312, reflecting the value of the BOOT[0] pin strap.
43      0 is for the SPI/2-wire slave boot, 1 is for the SPI master boot (from
44      external flash ROM).
45
46  reset-gpios:
47    maxItems: 1
48    description:
49      Reference to the GPIO connected to the RESET_N pin, if any.
50      Must be released (set high) after all supplies are applied.
51
52  vddcore-supply:
53    description:
54      1.2V supply for core, PLL, MIPI rx and MIPI tx.
55
56  vhtermrx-supply:
57    description:
58      Supply for input (RX). 1.8V for MIPI, or 1.8/2.8/3.3V for parallel.
59
60  vddtx-supply:
61    description:
62      Supply for output (TX). 1.8V for MIPI, or 1.8/2.8/3.3V for parallel.
63
64  vddhost-supply:
65    description:
66      Supply for host interface. 1.8V, 2.8V, or 3.3V.
67
68  vddcmos-supply:
69    description:
70      Supply for sensor interface. 1.8V, 2.8V, or 3.3V.
71
72  vddgpio-0-supply:
73    description:
74      Supply for GPIO_0. 1.8V, 2.8V, or 3.3V.
75
76  vddgpio-1-supply:
77    description:
78      Supply for GPIO_1. 1.8V, 2.8V, or 3.3V.
79
80  orientation: true
81  rotation: true
82
83  port:
84    $ref: /schemas/graph.yaml#/$defs/port-base
85    additionalProperties: false
86
87    properties:
88      endpoint:
89        $ref: /schemas/media/video-interfaces.yaml#
90        unevaluatedProperties: false
91
92        properties:
93          bus-type:
94            const: 4 # CSI-2 D-PHY
95
96          data-lanes:
97            description:
98              This property is for lane reordering between the THP7312 and the
99              SoC. The sensor supports either two-lane, or four-lane operation.
100              If this property is omitted four-lane operation is assumed. For
101              two-lane operation the property must be set to <1 2>.
102            minItems: 2
103            maxItems: 4
104            items:
105              maximum: 4
106
107  sensors:
108    type: object
109    description: List of connected sensors
110
111    properties:
112      "#address-cells":
113        const: 1
114
115      "#size-cells":
116        const: 0
117
118    patternProperties:
119      "^sensor@[01]$":
120        type: object
121        description:
122          Sensors connected to the first and second input, with one node per
123          sensor.
124
125        properties:
126          thine,model:
127            $ref: /schemas/types.yaml#/definitions/string
128            description:
129              Model of the connected sensors. Must be a valid compatible string.
130
131          reg:
132            description: THP7312 input port number
133            items:
134              - maximum: 1
135
136          data-lanes:
137            $ref: /schemas/media/video-interfaces.yaml#/properties/data-lanes
138            items:
139              maxItems: 4
140            description:
141              This property is for lane reordering between the THP7312 and the imaging
142              sensor that it is connected to.
143
144        required:
145          - reg
146          - data-lanes
147
148        additionalProperties: false
149
150    required:
151      - "#address-cells"
152      - "#size-cells"
153
154    additionalProperties: false
155
156required:
157  - compatible
158  - reg
159  - reset-gpios
160  - clocks
161  - vddcore-supply
162  - vhtermrx-supply
163  - vddtx-supply
164  - vddhost-supply
165  - vddcmos-supply
166  - vddgpio-0-supply
167  - vddgpio-1-supply
168  - sensors
169  - port
170
171additionalProperties: false
172
173examples:
174  - |
175    #include <dt-bindings/gpio/gpio.h>
176    #include <dt-bindings/media/video-interfaces.h>
177
178    i2c {
179        #address-cells = <1>;
180        #size-cells = <0>;
181
182        camera@61 {
183            compatible = "thine,thp7312";
184            reg = <0x61>;
185
186            pinctrl-names = "default";
187            pinctrl-0 = <&cam1_pins_default>;
188
189            reset-gpios = <&pio 119 GPIO_ACTIVE_LOW>;
190            clocks = <&camera61_clk>;
191
192            vddcore-supply = <&vsys_v4p2>;
193            vhtermrx-supply = <&vsys_v4p2>;
194            vddtx-supply = <&vsys_v4p2>;
195            vddhost-supply = <&vsys_v4p2>;
196            vddcmos-supply = <&vsys_v4p2>;
197            vddgpio-0-supply = <&vsys_v4p2>;
198            vddgpio-1-supply = <&vsys_v4p2>;
199
200            orientation = <0>;
201            rotation = <0>;
202
203            sensors {
204                #address-cells = <1>;
205                #size-cells = <0>;
206
207                sensor@0 {
208                    thine,model = "sony,imx258";
209                    reg = <0>;
210
211                    data-lanes = <4 1 3 2>;
212                };
213            };
214
215            port {
216                thp7312_2_endpoint: endpoint {
217                    remote-endpoint = <&mipi_thp7312_2>;
218                    bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
219                    data-lanes = <4 2 1 3>;
220                };
221            };
222        };
223    };
224...
225