5e983251a0f8fb8e9784856045cb0399d1c1d55b
[openwrt/staging/dangole.git] /
1 From a36565341b0b144ea37c4793793e3c835cc6458d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 10 Jun 2021 17:42:47 +0100
4 Subject: [PATCH] dtoverlays: Add overlay for Sony IMX258 image sensor
5
6 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
7 ---
8 arch/arm/boot/dts/overlays/Makefile | 1 +
9 arch/arm/boot/dts/overlays/README | 18 +++
10 arch/arm/boot/dts/overlays/imx258-overlay.dts | 148 ++++++++++++++++++
11 3 files changed, 167 insertions(+)
12 create mode 100644 arch/arm/boot/dts/overlays/imx258-overlay.dts
13
14 --- a/arch/arm/boot/dts/overlays/Makefile
15 +++ b/arch/arm/boot/dts/overlays/Makefile
16 @@ -98,6 +98,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
17 i2s-gpio28-31.dtbo \
18 ilitek251x.dtbo \
19 imx219.dtbo \
20 + imx258.dtbo \
21 imx290.dtbo \
22 imx378.dtbo \
23 imx477.dtbo \
24 --- a/arch/arm/boot/dts/overlays/README
25 +++ b/arch/arm/boot/dts/overlays/README
26 @@ -1872,6 +1872,24 @@ Params: rotation Mounting
27 vcm Configure a VCM focus drive on the sensor.
28
29
30 +Name: imx258
31 +Info: Sony IMX258 camera module.
32 + Uses Unicam 1, which is the standard camera connector on most Pi
33 + variants.
34 +Load: dtoverlay=imx258,<param>=<val>
35 +Params: rotation Mounting rotation of the camera sensor (0 or
36 + 180, default 180)
37 + orientation Sensor orientation (0 = front, 1 = rear,
38 + 2 = external, default external)
39 + media-controller Configure use of Media Controller API for
40 + configuring the sensor (default on)
41 + cam0 Adopt the default configuration for CAM0 on a
42 + Compute Module (CSI0, i2c_vc, and cam0_reg).
43 + vcm Configure a VCM focus drive on the sensor.
44 + 4lane Enable 4 CSI2 lanes. This requires a Compute
45 + Module (1, 3, or 4).
46 +
47 +
48 Name: imx290
49 Info: Sony IMX290 camera module.
50 Uses Unicam 1, which is the standard camera connector on most Pi
51 --- /dev/null
52 +++ b/arch/arm/boot/dts/overlays/imx258-overlay.dts
53 @@ -0,0 +1,148 @@
54 +// SPDX-License-Identifier: GPL-2.0-only
55 +// Definitions for IMX258 camera module on VC I2C bus
56 +/dts-v1/;
57 +/plugin/;
58 +
59 +#include <dt-bindings/gpio/gpio.h>
60 +
61 +/{
62 + compatible = "brcm,bcm2835";
63 +
64 + fragment@2 {
65 + target = <&i2c0if>;
66 + __overlay__ {
67 + status = "okay";
68 + };
69 + };
70 +
71 + clk_frag: fragment@3 {
72 + target = <&cam1_clk>;
73 + cam_clk: __overlay__ {
74 + clock-frequency = <24000000>;
75 + status = "okay";
76 + };
77 + };
78 +
79 + fragment@4 {
80 + target = <&i2c0mux>;
81 + __overlay__ {
82 + status = "okay";
83 + };
84 + };
85 +
86 + reg_frag: fragment@5 {
87 + target = <&cam1_reg>;
88 + cam_reg: __overlay__ {
89 + regulator-name = "imx258_vana";
90 + startup-delay-us = <300000>;
91 + regulator-min-microvolt = <2700000>;
92 + regulator-max-microvolt = <2700000>;
93 + };
94 + };
95 +
96 + i2c_frag: fragment@100 {
97 + target = <&i2c_csi_dsi>;
98 + __overlay__ {
99 + #address-cells = <1>;
100 + #size-cells = <0>;
101 + status = "okay";
102 +
103 + imx258: imx258@10 {
104 + compatible = "sony,imx258";
105 + reg = <0x10>;
106 + status = "okay";
107 +
108 + clocks = <&cam1_clk>;
109 + clock-names = "xclk";
110 +
111 + vana-supply = <&cam1_reg>; /* 2.8v */
112 + vdig-supply = <&cam_dummy_reg>; /* 1.05v */
113 + vif-supply = <&cam_dummy_reg>; /* 1.8v */
114 +
115 + rotation = <180>;
116 + orientation = <2>;
117 +
118 + port {
119 + imx258_0: endpoint {
120 + remote-endpoint = <&csi_ep>;
121 + clock-lanes = <0>;
122 + clock-noncontinuous;
123 + link-frequencies =
124 + /bits/ 64 <633600000
125 + 320000000>;
126 + };
127 + };
128 + };
129 +
130 + vcm: ad5398@0c {
131 + compatible = "adi,ad5398";
132 + reg = <0x0c>;
133 + status = "disabled";
134 + VANA-supply = <&cam1_reg>;
135 + };
136 + };
137 + };
138 +
139 + csi_frag: fragment@101 {
140 + target = <&csi1>;
141 + csi: __overlay__ {
142 + status = "okay";
143 + brcm,media-controller;
144 +
145 + port {
146 + csi_ep: endpoint {
147 + remote-endpoint = <&imx258_0>;
148 + clock-lanes = <0>;
149 + clock-noncontinuous;
150 + };
151 + };
152 + };
153 + };
154 +
155 + fragment@102 {
156 + target = <&imx258_0>;
157 + __overlay__ {
158 + data-lanes = <1 2>;
159 + link-frequencies = /bits/ 64 <633600000
160 + 320000000>;
161 + };
162 + };
163 +
164 + fragment@103 {
165 + target = <&imx258_0>;
166 + __dormant__ {
167 + data-lanes = <1 2 3 4>;
168 + link-frequencies =
169 + /bits/ 64 <633600000 320000000>;
170 + };
171 + };
172 +
173 + fragment@104 {
174 + target = <&csi_ep>;
175 + __overlay__ {
176 + data-lanes = <1 2>;
177 + };
178 + };
179 +
180 + fragment@105 {
181 + target = <&csi_ep>;
182 + __dormant__ {
183 + data-lanes = <1 2 3 4>;
184 + };
185 + };
186 +
187 + __overrides__ {
188 + rotation = <&imx258>,"rotation:0";
189 + orientation = <&imx258>,"orientation:0";
190 + media-controller = <&csi>,"brcm,media-controller?";
191 + cam0 = <&i2c_frag>, "target:0=",<&i2c_vc>,
192 + <&csi_frag>, "target:0=",<&csi0>,
193 + <&clk_frag>, "target:0=",<&cam0_clk>,
194 + <&reg_frag>, "target:0=",<&cam0_reg>,
195 + <&imx258>, "clocks:0=",<&cam0_clk>,
196 + <&imx258>, "vana-supply:0=",<&cam0_reg>;
197 + vcm = <&vcm>, "status=okay",
198 + <&imx258>,"lens-focus:0=", <&vcm>;
199 + 4lane = <0>, "-102+103-104+105";
200 + };
201 +};