Skip to content

Commit 2688d37

Browse files
committed
Software i2c addr aliasing
To allow for deserializer boards which do not have the I2C mux that aliases 8 i2c addr (30 - 37) to i2c 0, we define all devices under i2c@0 with virtual addr 0x1b-0x1d, and in the driver override them with 0x1a Signed-off-by: ejgoldik <ehud.joseph.goldik@intel.com>
1 parent 60e95ab commit 2688d37

2 files changed

Lines changed: 20 additions & 35 deletions

File tree

hardware/realsense/tegra194-camera-d4xx-single.dtsi

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
maxim,gmsl-dser-device = <&dser>;
106106
};
107107

108-
d4m0: d4m@1a {
108+
ds5_0: ds5@1a {
109109
status = "ok";
110110
def-addr = <0x10>;
111111
reg = <0x1a>;
@@ -120,7 +120,7 @@
120120

121121
port@0 {
122122
reg = <0>;
123-
d4m0_out: endpoint {
123+
ds5_0_out: endpoint {
124124
port-index = <0>;
125125
bus-width = <2>;
126126
remote-endpoint = <&csi_in0>;
@@ -149,19 +149,11 @@
149149
num-lanes = <2>;
150150
};
151151
};
152-
};
153152

154-
i2c@1 {
155-
status = "ok";
156-
reg = <0x3>; // line 18-19 of the I2C switch
157-
#address-cells = <0x1>;
158-
i2c-mux,deselect-on-exit;
159-
#size-cells = <0x0>;
160-
161-
d4m1: d4m@1a {
153+
ds5_1: ds5@1b {
162154
status = "ok";
163155
def-addr = <0x10>;
164-
reg = <0x1a>;
156+
reg = <0x1b>;
165157
compatible = "intel,d4xx";
166158
vcc-supply = <&p2822_vdd_1v8_cvb>;
167159
cam-type = "RGB";
@@ -173,7 +165,7 @@
173165

174166
port@0 {
175167
reg = <0>;
176-
d4m1_out: endpoint {
168+
ds5_1_out: endpoint {
177169
port-index = <1>;
178170
bus-width = <2>;
179171
remote-endpoint = <&csi_in1>;
@@ -202,17 +194,11 @@
202194
num-lanes = <2>;
203195
};
204196
};
205-
};
206-
i2c@2 {
207-
reg = <0x4>; // line 4 of the I2C switch
208-
#address-cells = <0x1>;
209-
i2c-mux,deselect-on-exit;
210-
#size-cells = <0x0>;
211197

212-
d4m2: d4m@1a {
198+
ds5_2: ds5@1c {
213199
status = "ok";
214200
def-addr = <0x10>;
215-
reg = <0x1a>;
201+
reg = <0x1c>;
216202
compatible = "intel,d4xx";
217203
vcc-supply = <&p2822_vdd_1v8_cvb>;
218204
cam-type = "Y8";
@@ -224,7 +210,7 @@
224210

225211
port@0 {
226212
reg = <0>;
227-
d4m2_out: endpoint {
213+
ds5_2_out: endpoint {
228214
port-index = <2>;
229215
bus-width = <2>;
230216
remote-endpoint = <&csi_in2>;
@@ -254,17 +240,11 @@
254240
num-lanes = <2>;
255241
};
256242
};
257-
};
258-
i2c@3 {
259-
reg = <0x5>; // line 4 of the I2C switch
260-
#address-cells = <0x1>;
261-
i2c-mux,deselect-on-exit;
262-
#size-cells = <0x0>;
263243

264-
d4m3: d4m@1a {
244+
ds5_3: ds5@1d {
265245
status = "ok";
266246
def-addr = <0x10>;
267-
reg = <0x1a>;
247+
reg = <0x1d>;
268248
compatible = "intel,d4xx";
269249
vcc-supply = <&p2822_vdd_1v8_cvb>;
270250
cam-type = "IMU";
@@ -276,7 +256,7 @@
276256

277257
port@0 {
278258
reg = <0>;
279-
d4m3_out: endpoint {
259+
ds5_3_out: endpoint {
280260
port-index = <3>;
281261
bus-width = <2>;
282262
remote-endpoint = <&csi_in3>;
@@ -332,7 +312,7 @@
332312
status = "ok";
333313
port-index = <0>;
334314
bus-width = <2>;
335-
remote-endpoint = <&d4m0_out>;
315+
remote-endpoint = <&ds5_0_out>;
336316
};
337317
};
338318
port@1 {
@@ -362,7 +342,7 @@
362342
status = "ok";
363343
port-index = <0>;
364344
bus-width = <2>;
365-
remote-endpoint = <&d4m1_out>;
345+
remote-endpoint = <&ds5_1_out>;
366346
};
367347
};
368348
port@1 {
@@ -392,7 +372,7 @@
392372
status = "ok";
393373
port-index = <0>;
394374
bus-width = <2>;
395-
remote-endpoint = <&d4m2_out>;
375+
remote-endpoint = <&ds5_2_out>;
396376
};
397377
};
398378
port@1 {
@@ -421,7 +401,7 @@
421401
status = "ok";
422402
port-index = <0>;
423403
bus-width = <2>;
424-
remote-endpoint = <&d4m3_out>;
404+
remote-endpoint = <&ds5_3_out>;
425405
};
426406
};
427407
port@1 {

kernel/realsense/d4xx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@
164164
#define MAX9295_I2C_ADDR_DEF 0x40
165165
#define D457_I2C_ADDR 0x10
166166
#endif
167+
168+
#define DS5_FIXED_REG_ADDR 0x1a
169+
167170
enum ds5_mux_pad {
168171
DS5_MUX_PAD_EXTERNAL,
169172
DS5_MUX_PAD_DEPTH,
@@ -5688,6 +5691,8 @@ static int ds5_probe(struct i2c_client *c, const struct i2c_device_id *id)
56885691

56895692
state->client = c;
56905693
dev_warn(&c->dev, "Probing driver for D4xx\n");
5694+
// Alias all addresses to 0x1a
5695+
c->addr = DS5_FIXED_REG_ADDR;
56915696

56925697
state->variant = ds5_variants + id->driver_data;
56935698
#ifdef CONFIG_OF

0 commit comments

Comments
 (0)