Skip to content

Commit 5c1e856

Browse files
committed
dts: comma: pin i2c bus numbers for openpilot via aliases
openpilot opens fixed i2c bus numbers: IMU on bus 1 (sensord.py I2C_BUS_IMU=1), touch on bus 2, power on bus 0. Linux derives the adapter number from the DT aliases node (of_alias_get_id), and upstream sdm845.dtsi ships identity aliases (i2cN=&i2cN) — so the IMU node (i2c@890000 = i2c4) would otherwise enumerate as bus 4 and sensord would fail. Override the aliases so the three buses we use map to the numbers openpilot expects, reassigning the displaced identity aliases to the now-unused nodes so no two aliases target the same node. Bus assignment matches the legacy agnos DTS (se10=/dev/i2c-0, se4=IMU, se5=/dev/i2c-2). Also enable i2c10 (a88000, the legacy /dev/i2c-0 power bus) so bus 0 exists; it carries no devices on the comma four (no ina231 — that is a comma-three part). Verified on device (mainline 6.18.0-vamos): i2c-1 has the IMU at 0x6a, i2c-2 has the ft3168 touch at 0x38, i2c-0 present.
1 parent 76b9e81 commit 5c1e856

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

kernel/dts/sdm845-comma-common.dtsi

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,26 @@
88
/ {
99
aliases {
1010
serial0 = &uart9;
11+
12+
/*
13+
* openpilot opens fixed i2c bus numbers: IMU on bus 1
14+
* (sensord.py I2C_BUS_IMU=1), ina231 power monitor on bus 0,
15+
* touch on bus 2. Linux derives the adapter number from these
16+
* aliases (of_alias_get_id). Upstream sdm845.dtsi ships identity
17+
* aliases (i2cN=&i2cN), so without this override the IMU node
18+
* (i2c@890000 = i2c4) would be bus 4. Remap the three buses we
19+
* use to the legacy numbers and park the displaced identity
20+
* aliases on unused nodes so no two aliases target one node.
21+
*
22+
* Matches agnos legacy DTS: se10=/dev/i2c-0 (power),
23+
* se4=IMU bus 1, se5=/dev/i2c-2 (touch).
24+
*/
25+
i2c0 = &i2c10; /* i2c@a88000 legacy /dev/i2c-0 (no devices on mici) */
26+
i2c1 = &i2c4; /* i2c@890000 IMU */
27+
i2c2 = &i2c5; /* i2c@894000 touch */
28+
i2c4 = &i2c0;
29+
i2c5 = &i2c1;
30+
i2c10 = &i2c2;
1131
};
1232

1333
chosen {
@@ -379,6 +399,19 @@
379399
clock-frequency = <100000>;
380400
};
381401

402+
/*
403+
* Legacy /dev/i2c-0 (SE10, a88000) -> aliased to bus 0 above. On the comma
404+
* four this bus carries no devices openpilot uses: there is NO ina231 (legacy
405+
* comma_mici.dts /delete-node's it as "not populated on mici" — confirmed on
406+
* device: probe of 0x40 returns -ENXIO, bus scan empty). openpilot reads power
407+
* from the PMIC bms power_supply, not this bus. Kept enabled only to preserve
408+
* bus-0 numbering parity with legacy.
409+
*/
410+
&i2c10 {
411+
status = "okay";
412+
clock-frequency = <100000>;
413+
};
414+
382415
&mdss {
383416
status = "okay";
384417
};

0 commit comments

Comments
 (0)