bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-1185-overlays-ADS1115-allow-specification-of-the-i2c-bus.patch
1 From a477a6351575aa173f9f82857f5797e384fbc704 Mon Sep 17 00:00:00 2001
2 From: JinShil <slavo5150@yahoo.com>
3 Date: Tue, 28 Nov 2023 17:05:44 +0900
4 Subject: [PATCH] overlays: ADS1115: allow specification of the i2c bus
5
6 ---
7 arch/arm/boot/dts/overlays/README | 10 +++
8 .../arm/boot/dts/overlays/ads1115-overlay.dts | 80 +++++++++++++------
9 2 files changed, 66 insertions(+), 24 deletions(-)
10
11 --- a/arch/arm/boot/dts/overlays/README
12 +++ b/arch/arm/boot/dts/overlays/README
13 @@ -489,6 +489,16 @@ Params: addr I2C bus
14 cha_gain Set the gain of the Programmable Gain
15 Amplifier for this channel. (Default 1 sets the
16 full scale of the channel to 4.096 Volts)
17 + i2c0 Choose the I2C0 bus on GPIOs 0&1
18 + i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
19 + i2c3 Choose the I2C3 bus (configure with the i2c3
20 + overlay - BCM2711 only)
21 + i2c4 Choose the I2C4 bus (configure with the i2c4
22 + overlay - BCM2711 only)
23 + i2c5 Choose the I2C5 bus (configure with the i2c5
24 + overlay - BCM2711 only)
25 + i2c6 Choose the I2C6 bus (configure with the i2c6
26 + overlay - BCM2711 only)
27
28 Channel parameters can be set for each enabled channel.
29 A maximum of 4 channels can be enabled (letters a thru d).
30 --- a/arch/arm/boot/dts/overlays/ads1115-overlay.dts
31 +++ b/arch/arm/boot/dts/overlays/ads1115-overlay.dts
32 @@ -9,23 +9,6 @@
33 compatible = "brcm,bcm2835";
34
35 fragment@0 {
36 - target = <&i2c_arm>;
37 - __overlay__ {
38 - #address-cells = <1>;
39 - #size-cells = <0>;
40 - status = "okay";
41 -
42 - ads1115: ads1115@48 {
43 - compatible = "ti,ads1115";
44 - status = "okay";
45 - #address-cells = <1>;
46 - #size-cells = <0>;
47 - reg = <0x48>;
48 - };
49 - };
50 - };
51 -
52 - fragment@1 {
53 target = <&ads1115>;
54 __dormant__ {
55 #address-cells = <1>;
56 @@ -39,7 +22,7 @@
57 };
58 };
59
60 - fragment@2 {
61 + fragment@1 {
62 target = <&ads1115>;
63 __dormant__ {
64 #address-cells = <1>;
65 @@ -53,7 +36,7 @@
66 };
67 };
68
69 - fragment@3 {
70 + fragment@2 {
71 target = <&ads1115>;
72 __dormant__ {
73 #address-cells = <1>;
74 @@ -67,7 +50,7 @@
75 };
76 };
77
78 - fragment@4 {
79 + fragment@3 {
80 target = <&ads1115>;
81 __dormant__ {
82 #address-cells = <1>;
83 @@ -81,23 +64,72 @@
84 };
85 };
86
87 + fragment@4 {
88 + target = <&i2cbus>;
89 + __overlay__ {
90 + #address-cells = <1>;
91 + #size-cells = <0>;
92 + status = "okay";
93 +
94 + ads1115: ads1115@48 {
95 + compatible = "ti,ads1115";
96 + status = "okay";
97 + #address-cells = <1>;
98 + #size-cells = <0>;
99 + reg = <0x48>;
100 + };
101 + };
102 + };
103 +
104 + frag100: fragment@100 {
105 + target = <&i2c1>;
106 + i2cbus: __overlay__ {
107 + status = "okay";
108 + };
109 + };
110 +
111 + fragment@101 {
112 + target = <&i2c0if>;
113 + __dormant__ {
114 + status = "okay";
115 + };
116 + };
117 +
118 + fragment@102 {
119 + target = <&i2c0mux>;
120 + __dormant__ {
121 + status = "okay";
122 + };
123 + };
124 +
125 __overrides__ {
126 addr = <&ads1115>,"reg:0";
127 - cha_enable = <0>,"=1";
128 + cha_enable = <0>,"=0";
129 cha_cfg = <&channel_a>,"reg:0";
130 cha_gain = <&channel_a>,"ti,gain:0";
131 cha_datarate = <&channel_a>,"ti,datarate:0";
132 - chb_enable = <0>,"=2";
133 + chb_enable = <0>,"=1";
134 chb_cfg = <&channel_b>,"reg:0";
135 chb_gain = <&channel_b>,"ti,gain:0";
136 chb_datarate = <&channel_b>,"ti,datarate:0";
137 - chc_enable = <0>,"=3";
138 + chc_enable = <0>,"=2";
139 chc_cfg = <&channel_c>,"reg:0";
140 chc_gain = <&channel_c>,"ti,gain:0";
141 chc_datarate = <&channel_c>,"ti,datarate:0";
142 - chd_enable = <0>,"=4";
143 + chd_enable = <0>,"=3";
144 chd_cfg = <&channel_d>,"reg:0";
145 chd_gain = <&channel_d>,"ti,gain:0";
146 chd_datarate = <&channel_d>,"ti,datarate:0";
147 + i2c0 = <&frag100>, "target:0=",<&i2c0>;
148 + i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
149 + <0>,"+101+102";
150 + i2c3 = <&frag100>, "target?=0",
151 + <&frag100>, "target-path=i2c3";
152 + i2c4 = <&frag100>, "target?=0",
153 + <&frag100>, "target-path=i2c4";
154 + i2c5 = <&frag100>, "target?=0",
155 + <&frag100>, "target-path=i2c5";
156 + i2c6 = <&frag100>, "target?=0",
157 + <&frag100>, "target-path=i2c6";
158 };
159 };