bcm27xx: import latest patches from the RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0836-dtoverlays-Add-an-overlay-for-the-Sony-IMX290-image-.patch
1 From 57250281004e141dff4662d1abb3f31982ec01ee Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 19 May 2020 13:35:17 +0100
4 Subject: [PATCH] dtoverlays: Add an overlay for the Sony IMX290
5 image sensor
6
7 Adds an overlay to configure the IMX290 image sensor.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 arch/arm/boot/dts/overlays/Makefile | 1 +
12 arch/arm/boot/dts/overlays/README | 16 ++
13 arch/arm/boot/dts/overlays/imx290-overlay.dts | 32 ++++
14 .../boot/dts/overlays/imx290_327-overlay.dtsi | 145 ++++++++++++++++++
15 4 files changed, 194 insertions(+)
16 create mode 100644 arch/arm/boot/dts/overlays/imx290-overlay.dts
17 create mode 100644 arch/arm/boot/dts/overlays/imx290_327-overlay.dtsi
18
19 --- a/arch/arm/boot/dts/overlays/Makefile
20 +++ b/arch/arm/boot/dts/overlays/Makefile
21 @@ -85,6 +85,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
22 i2s-gpio28-31.dtbo \
23 ilitek251x.dtbo \
24 imx219.dtbo \
25 + imx290.dtbo \
26 imx477.dtbo \
27 iqaudio-codec.dtbo \
28 iqaudio-dac.dtbo \
29 --- a/arch/arm/boot/dts/overlays/README
30 +++ b/arch/arm/boot/dts/overlays/README
31 @@ -1430,6 +1430,22 @@ Load: dtoverlay=imx219
32 Params: <None>
33
34
35 +Name: imx290
36 +Info: Sony IMX290 camera module.
37 + Uses Unicam 1, which is the standard camera connector on most Pi
38 + variants. NB This currently uses 4 CSI2 data lanes and therefore will
39 + only work on a CM.
40 +Load: dtoverlay=imx290,<param>
41 +Params: 4lane Enable 4 CSI2 lanes. This requires a Compute
42 + Module (1, 3, or 4).
43 + clock-frequency Sets the clock frequency to match that used on
44 + the board.
45 + Modules from Vision Components use 37.125MHz
46 + (the default), whilst those from Innomaker use
47 + 74.25MHz.
48 + mono Denote that the module is a mono sensor.
49 +
50 +
51 Name: imx477
52 Info: Sony IMX477 camera module.
53 Uses Unicam 1, which is the standard camera connector on most Pi
54 --- /dev/null
55 +++ b/arch/arm/boot/dts/overlays/imx290-overlay.dts
56 @@ -0,0 +1,32 @@
57 +// SPDX-License-Identifier: GPL-2.0-only
58 +// Definitions for IMX290 camera module on VC I2C bus
59 +/dts-v1/;
60 +/plugin/;
61 +
62 +#include <dt-bindings/gpio/gpio.h>
63 +#include "imx290_327-overlay.dtsi"
64 +
65 +/{
66 + compatible = "brcm,bcm2835";
67 +
68 + // Fragment numbers deliberately high to avoid conflicts with the
69 + // included imx290_327 overlay file.
70 +
71 + fragment@101 {
72 + target = <&imx290>;
73 + __overlay__ {
74 + compatible = "sony,imx290";
75 + };
76 + };
77 +
78 + fragment@102 {
79 + target = <&imx290>;
80 + __dormant__ {
81 + compatible = "sony,imx290-mono";
82 + };
83 + };
84 +
85 + __overrides__ {
86 + mono = <0>, "-101+102";
87 + };
88 +};
89 --- /dev/null
90 +++ b/arch/arm/boot/dts/overlays/imx290_327-overlay.dtsi
91 @@ -0,0 +1,145 @@
92 +// SPDX-License-Identifier: GPL-2.0-only
93 +// Partial definitions for IMX290 or IMX327 camera module on VC I2C bus
94 +// The compatible string should be set in an overlay that then includes this one
95 +/dts-v1/;
96 +/plugin/;
97 +
98 +#include <dt-bindings/gpio/gpio.h>
99 +
100 +/{
101 + compatible = "brcm,bcm2835";
102 +
103 + fragment@0 {
104 + target = <&i2c_csi_dsi>;
105 + __overlay__ {
106 + #address-cells = <1>;
107 + #size-cells = <0>;
108 + status = "okay";
109 +
110 + imx290: imx290@1a {
111 + reg = <0x1a>;
112 + status = "okay";
113 +
114 + clocks = <&imx290_clk>;
115 + clock-names = "xclk";
116 + clock-frequency = <37125000>;
117 +
118 + vdda-supply = <&imx290_vdda>; /* 2.8v */
119 + vdddo-supply = <&imx290_vdddo>; /* 1.8v */
120 + vddd-supply = <&imx290_vddd>; /* 1.5v */
121 +
122 + port {
123 + imx290_0: endpoint {
124 + remote-endpoint = <&csi1_ep>;
125 + clock-lanes = <0>;
126 + };
127 + };
128 + };
129 + };
130 + };
131 +
132 + fragment@1 {
133 + target = <&csi1>;
134 + __overlay__ {
135 + status = "okay";
136 +
137 + port {
138 + csi1_ep: endpoint {
139 + remote-endpoint = <&imx290_0>;
140 + };
141 + };
142 + };
143 + };
144 +
145 + fragment@2 {
146 + target = <&i2c0if>;
147 + __overlay__ {
148 + status = "okay";
149 + };
150 + };
151 +
152 + fragment@3 {
153 + target-path="/";
154 + __overlay__ {
155 + imx290_vdda: fixedregulator@0 {
156 + compatible = "regulator-fixed";
157 + regulator-name = "imx290_vdda";
158 + regulator-min-microvolt = <2800000>;
159 + regulator-max-microvolt = <2800000>;
160 + gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
161 + enable-active-high;
162 + };
163 + imx290_vdddo: fixedregulator@1 {
164 + compatible = "regulator-fixed";
165 + regulator-name = "imx290_vdddo";
166 + regulator-min-microvolt = <1800000>;
167 + regulator-max-microvolt = <1800000>;
168 + };
169 + imx290_vddd: fixedregulator@2 {
170 + compatible = "regulator-fixed";
171 + regulator-name = "imx290_vddd";
172 + regulator-min-microvolt = <1500000>;
173 + regulator-max-microvolt = <1500000>;
174 + };
175 +
176 + imx290_clk: camera-clk {
177 + compatible = "fixed-clock";
178 + #clock-cells = <0>;
179 + clock-frequency = <37125000>;
180 + };
181 + };
182 + };
183 +
184 + fragment@4 {
185 + target = <&i2c0mux>;
186 + __overlay__ {
187 + status = "okay";
188 + };
189 + };
190 +
191 + fragment@5 {
192 + target-path="/__overrides__";
193 + __overlay__ {
194 + cam0-pwdn-ctrl = <&imx290_vdda>,"gpio:0";
195 + cam0-pwdn = <&imx290_vdda>,"gpio:4";
196 + };
197 + };
198 +
199 + fragment@6 {
200 + target = <&imx290_0>;
201 + __overlay__ {
202 + data-lanes = <1 2>;
203 + link-frequencies =
204 + /bits/ 64 <445500000 297000000>;
205 + };
206 + };
207 +
208 + fragment@7 {
209 + target = <&imx290_0>;
210 + __dormant__ {
211 + data-lanes = <1 2 3 4>;
212 + link-frequencies =
213 + /bits/ 64 <222750000 148500000>;
214 + };
215 + };
216 +
217 + fragment@8 {
218 + target = <&csi1_ep>;
219 + __overlay__ {
220 + data-lanes = <1 2>;
221 + };
222 + };
223 +
224 + fragment@9 {
225 + target = <&csi1_ep>;
226 + __dormant__ {
227 + data-lanes = <1 2 3 4>;
228 + };
229 + };
230 +
231 + __overrides__ {
232 + 4lane = <0>, "-6+7-8+9";
233 + clock-frequency = <&imx290_clk>,"clock-frequency:0",
234 + <&imx290>,"clock-frequency:0";
235 + };
236 +};