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