9be42a6a247dfca858c81530381eee4ba6c6b65a
[oweals/openwrt.git] /
1 From 7a4d12054b24c8cb980be4c6466b50c14beb78d3 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Wed, 28 Aug 2019 13:35:19 +0100
4 Subject: [PATCH] dtoverlays: Add overlay for the Sony IMX219 image
5  sensor.
6
7 Adds an overlay for the IMX219 image sensor, connected to the
8 Unicam CSI2 receiver peripheral.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 ---
12  arch/arm/boot/dts/overlays/Makefile           |   1 +
13  arch/arm/boot/dts/overlays/README             |  12 ++
14  arch/arm/boot/dts/overlays/imx219-overlay.dts | 129 ++++++++++++++++++
15  3 files changed, 142 insertions(+)
16  create mode 100644 arch/arm/boot/dts/overlays/imx219-overlay.dts
17
18 --- a/arch/arm/boot/dts/overlays/Makefile
19 +++ b/arch/arm/boot/dts/overlays/Makefile
20 @@ -77,6 +77,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
21         i2c6.dtbo \
22         i2s-gpio28-31.dtbo \
23         ilitek251x.dtbo \
24 +       imx219.dtbo \
25         iqaudio-codec.dtbo \
26         iqaudio-dac.dtbo \
27         iqaudio-dacplus.dtbo \
28 --- a/arch/arm/boot/dts/overlays/README
29 +++ b/arch/arm/boot/dts/overlays/README
30 @@ -1269,6 +1269,18 @@ Params: interrupt               GPIO use
31                                  touchscreen (in pixels)
32  
33  
34 +Name:   imx219
35 +Info:   Sony IMX219 camera module.
36 +        Uses Unicam 1, which is the standard camera connector on most Pi
37 +        variants.
38 +Load:   dtoverlay=imx219,<param>=<val>
39 +Params: i2c_pins_0_1            Use pins 0&1 for the I2C instead of 44&45.
40 +                                Useful on Compute Modules.
41 +
42 +        i2c_pins_28_29          Use pins 28&29 for the I2C instead of 44&45.
43 +                                This is required for Pi B+, 2, 0, and 0W.
44 +
45 +
46  Name:   iqaudio-codec
47  Info:   Configures the IQaudio Codec audio card
48  Load:   dtoverlay=iqaudio-codec
49 --- /dev/null
50 +++ b/arch/arm/boot/dts/overlays/imx219-overlay.dts
51 @@ -0,0 +1,129 @@
52 +// SPDX-License-Identifier: GPL-2.0-only
53 +// Definitions for IMX219 camera module on VC I2C bus
54 +/dts-v1/;
55 +/plugin/;
56 +
57 +#include <dt-bindings/gpio/gpio.h>
58 +
59 +/{
60 +       compatible = "brcm,bcm2835";
61 +
62 +       fragment@0 {
63 +               target = <&i2c_vc>;
64 +               __overlay__ {
65 +                       #address-cells = <1>;
66 +                       #size-cells = <0>;
67 +                       status = "okay";
68 +
69 +                       imx219: imx219@10 {
70 +                               compatible = "sony,imx219";
71 +                               reg = <0x10>;
72 +                               status = "okay";
73 +
74 +                               clocks = <&imx219_clk>;
75 +                               clock-names = "xclk";
76 +
77 +                               VANA-supply = <&imx219_vana>;   /* 2.8v */
78 +                               VDIG-supply = <&imx219_vdig>;   /* 1.8v */
79 +                               VDDL-supply = <&imx219_vddl>;   /* 1.2v */
80 +
81 +                               imx219_clk: camera-clk {
82 +                                       compatible = "fixed-clock";
83 +                                       #clock-cells = <0>;
84 +                                       clock-frequency = <24000000>;
85 +                               };
86 +
87 +                               port {
88 +                                       imx219_0: endpoint {
89 +                                               remote-endpoint = <&csi1_ep>;
90 +                                               clock-lanes = <0>;
91 +                                               data-lanes = <1 2>;
92 +                                               clock-noncontinuous;
93 +                                               link-frequencies =
94 +                                                       /bits/ 64 <297000000>;
95 +                                       };
96 +                               };
97 +                       };
98 +               };
99 +       };
100 +
101 +       fragment@1 {
102 +               target = <&csi1>;
103 +               __overlay__ {
104 +                       status = "okay";
105 +
106 +                       port {
107 +                               csi1_ep: endpoint {
108 +                                       remote-endpoint = <&imx219_0>;
109 +                               };
110 +                       };
111 +               };
112 +       };
113 +
114 +       fragment@2 {
115 +               target = <&i2c0_pins>;
116 +               __dormant__ {
117 +                       brcm,pins = <28 29>;
118 +                       brcm,function = <4>; /* alt0 */
119 +               };
120 +       };
121 +       fragment@3 {
122 +               target = <&i2c0_pins>;
123 +               __overlay__ {
124 +                       brcm,pins = <44 45>;
125 +                       brcm,function = <5>; /* alt1 */
126 +               };
127 +       };
128 +       fragment@4 {
129 +               target = <&i2c0_pins>;
130 +               __dormant__ {
131 +                       brcm,pins = <0 1>;
132 +                       brcm,function = <4>; /* alt0 */
133 +               };
134 +       };
135 +       fragment@5 {
136 +               target = <&i2c_vc>;
137 +               __overlay__ {
138 +                       status = "okay";
139 +               };
140 +       };
141 +
142 +       fragment@6 {
143 +               target-path="/";
144 +               __overlay__ {
145 +                       imx219_vana: fixedregulator@0 {
146 +                               compatible = "regulator-fixed";
147 +                               regulator-name = "imx219_vana";
148 +                               regulator-min-microvolt = <2800000>;
149 +                               regulator-max-microvolt = <2800000>;
150 +                               gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
151 +                               enable-active-high;
152 +                       };
153 +                       imx219_vdig: fixedregulator@1 {
154 +                               compatible = "regulator-fixed";
155 +                               regulator-name = "imx219_vdig";
156 +                               regulator-min-microvolt = <1800000>;
157 +                               regulator-max-microvolt = <1800000>;
158 +                       };
159 +                       imx219_vddl: fixedregulator@2 {
160 +                               compatible = "regulator-fixed";
161 +                               regulator-name = "imx219_vddl";
162 +                               regulator-min-microvolt = <1200000>;
163 +                               regulator-max-microvolt = <1200000>;
164 +                       };
165 +               };
166 +       };
167 +
168 +       fragment@7 {
169 +               target-path="/__overrides__";
170 +               __overlay__ {
171 +                       cam0-pwdn-ctrl = <&imx219_vana>,"gpio:0";
172 +                       cam0-pwdn      = <&imx219_vana>,"gpio:4";
173 +               };
174 +       };
175 +
176 +       __overrides__ {
177 +               i2c_pins_0_1 = <0>,"-2-3+4";
178 +               i2c_pins_28_29 = <0>,"+2-3-4";
179 +       };
180 +};