Skip to content

dts: comma: pin i2c bus numbers for openpilot via aliases#116

Draft
greatgitsby wants to merge 1 commit into
commaai:masterfrom
greatgitsby:dts-i2c-bus-aliases
Draft

dts: comma: pin i2c bus numbers for openpilot via aliases#116
greatgitsby wants to merge 1 commit into
commaai:masterfrom
greatgitsby:dts-i2c-bus-aliases

Conversation

@greatgitsby

Copy link
Copy Markdown
Collaborator

What

Override the i2c aliases in sdm845-comma-common.dtsi so the touch / IMU / power buses enumerate at the bus numbers openpilot hardcodes, and enable i2c10 so bus 0 exists.

i2c0  = &i2c10;   /* i2c@a88000  legacy /dev/i2c-0 (no devices on mici) */
i2c1  = &i2c4;    /* i2c@890000  IMU   -> bus 1 */
i2c2  = &i2c5;    /* i2c@894000  touch -> bus 2 */
i2c4  = &i2c0;    /* park displaced identity aliases on unused nodes  */
i2c5  = &i2c1;
i2c10 = &i2c2;

Why

openpilot opens fixed i2c bus numbers — sensord.py hardcodes I2C_BUS_IMU = 1, touch is expected 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). With those, the IMU node (i2c@890000 = i2c4) enumerates as bus 4, so sensord opens /dev/i2c-1 and finds nothing.

The override remaps the three buses we use to the legacy numbers and reassigns the displaced identity aliases to the now-unused nodes so no two aliases target the same node (of_alias_get_id returns the first match). Bus assignment matches the legacy agnos DTS (se10=/dev/i2c-0, se4=IMU, se5=/dev/i2c-2).

i2c10 (a88000) is enabled with no children — it's the legacy /dev/i2c-0; on the comma four it carries no devices openpilot uses (no ina231 — that's a comma-three part), kept only for bus-0 numbering parity.

Test

Flashed and verified on a comma four (mici) on mainline 6.18.0-vamos:

  • i2c-1i2c@890000, IMU 0x6a present (LSM6DS3TR-C, live accel/gyro/temp)
  • i2c-2i2c@894000, ft3168 touch at 0x38 (driver bound, ABS_MT axes 0–239 × 0–535)
  • i2c-0i2c@a88000, present (empty)

Panda (/dev/spidev0.0) and GPS (/dev/ttyHS0) confirmed unaffected and working.

🤖 Generated with Claude Code

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.
@github-actions

Copy link
Copy Markdown

vamOS System Profile

Changes vs master

Metric Change
Used space 3491.5MB → 3495.3MB (+3.8MB)
Sparse image 3445.6MB → 3449.4MB (+3.7MB)
Package count 524 → 524

Added packages: ModemManager-1.24.2_1, ModemManager-devel-1.24.2_1, NetworkManager-1.56.0_1, OpenCL-Headers-2026.05.29_1, brotli-1.2.0_2, brotli-devel-1.2.0_2, dnsmasq-2.93_1, elfutils-devel-0.195_1, expat-2.8.1_1, expat-devel-2.8.1_1, fftw-devel-3.3.11_1, foot-terminfo-1.27.0_1, fuse3-3.18.2_2, gdb-17.2_1, gdb-common-17.2_1, kitty-terminfo-0.47.1_1, lcms2-2.19.1_1, libcrypto3-3.6.3_1, libdebuginfod-0.195_1, libdrm-2.4.134_1, libdrm-devel-2.4.134_1, libedit-20260512.3.1_1, libelf-0.195_1, libfftw-3.3.11_1, libharfbuzz-14.2.1_1, libicu78-78.3_1, libmm-glib-1.24.2_1, libnm-1.56.0_1, libpciaccess-0.19_1, libpciaccess-devel-0.19_1, libpipewire-1.6.6_1, libssl3-3.6.3_1, libunbound-1.25.1_1, libxkbcommon-1.13.2_1, libxkbcommon-devel-1.13.2_1, libxkbcommon-x11-1.13.2_1, libxkbregistry-1.13.2_1, nghttp2-1.69.0_1, nghttp2-devel-1.69.0_1, ngtcp2-1.23.0_1, ngtcp2-devel-1.23.0_1, nss-3.123.1_1, openssl-3.6.3_1, openssl-devel-3.6.3_1, pipewire-devel-1.6.6_1, python3-3.14.6_1, python3-Markdown-3.10.2_1, python3-setuptools-80.10.2_2, removed-packages-0.1.20260529_1, rsync-3.4.4_1, sqlite-3.53.2_1, sqlite-devel-3.53.2_1, vim-9.2.0506_1, vim-common-9.2.0506_1, wayland-protocols-1.49_1, xbps-triggers-0.131_1, xkbcomp-1.5.0_1, xkeyboard-config-2.47_1, xxd-9.2.0506_1

Removed packages: ModemManager-1.24.0_1, ModemManager-devel-1.24.0_1, NetworkManager-1.50.0_1, OpenCL-Headers-2025.07.22_1, brotli-1.2.0_1, brotli-devel-1.2.0_1, dnsmasq-2.92_1, elfutils-devel-0.194_1, expat-2.8.0_1, expat-devel-2.8.0_1, fftw-devel-3.3.10_3, foot-terminfo-1.26.1_1, fuse3-3.18.2_1, gdb-16.3_2, gdb-common-16.3_2, kitty-terminfo-0.46.2_1, lcms2-2.18_1, libcrypto3-3.6.2_1, libdebuginfod-0.194_1, libdrm-2.4.131_1, libdrm-devel-2.4.131_1, libedit-20251016.3.1_1, libelf-0.194_1, libfftw-3.3.10_3, libharfbuzz-14.2.0_1, libicu78-78.2_2, libmm-glib-1.24.0_1, libnm-1.50.0_1, libpciaccess-0.18.1_1, libpciaccess-devel-0.18.1_1, libpipewire-1.6.4_1, libssl3-3.6.2_1, libunbound-1.25.0_1, libxkbcommon-1.13.1_2, libxkbcommon-devel-1.13.1_2, libxkbcommon-x11-1.13.1_2, libxkbregistry-1.13.1_2, nghttp2-1.68.1_1, nghttp2-devel-1.68.1_1, ngtcp2-1.22.1_1, ngtcp2-devel-1.22.1_1, nss-3.123_1, openssl-3.6.2_1, openssl-devel-3.6.2_1, pipewire-devel-1.6.4_1, python3-3.14.4_1, python3-Markdown-3.6_3, python3-setuptools-80.10.2_1, removed-packages-0.1.20260503_1, rsync-3.4.2_1, sqlite-3.53.0_1, sqlite-devel-3.53.0_1, vim-9.2.0280_1, vim-common-9.2.0280_1, wayland-protocols-1.48_1, xbps-triggers-0.130_1, xkbcomp-1.4.7_1, xkeyboard-config-2.45_1, xxd-9.2.0280_1

Directory size changes (>1MB)
Directory Change

Metric Value
Used space 3495.3MB / 5959.5MB
Files 56127
Directories 4750
Symlinks 3606
Packages 524

Top 10 Directories

Directory Size

Category Breakdown

Category Size %
xbps packages 2499.7MB 71.5%
Python venv 655.6MB 18.7%
Firmware 11.5MB .3%
Other 328.4MB 9.3%

Top 10 Packages by Size

Package Size
mit-krb5-libs-1.21.3_1 270.4MB
gawk-5.3.2_1 210.3MB
llvm-21_3 148.6MB
libldns-1.9.0_1 124.3MB
pd-mapper-1.0_1 73.9MB
libclang21-21.1.7_1 70.2MB
glib-2.88.0_1 67.4MB
gcc-14.2.1+20250405_4 66.6MB
libcap-progs-2.78_1 56MB
cmake-4.2.2_2 53.2MB

Top 30 Files by Size

File Size
/usr/lib/llvm/21/lib/libLLVM.so.21.1 124.3MB
/usr/lib/llvm/21/lib/libMLIR.so.21.1 89.7MB
/usr/lib/llvm/21/bin/mlir-transform-opt 82.9MB
/usr/lib/llvm/21/lib/libclang-cpp.so.21.1 56MB
/usr/lib/llvm/21/bin/mlir-translate 53.2MB
/usr/lib/llvm/21/bin/llvm-exegesis 52MB
/usr/lib/llvm/21/bin/llvm-bolt-binary-analysis 50.6MB
/usr/local/venv/lib/python3.12/site-packages/ffmpeg/install/lib/libavcodec.a 50.6MB
/usr/bin/uv 49.6MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/gnat1 40.1MB
/usr/bin/gdb 39.1MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/cc1plus 37.3MB
/usr/lib/libgallium-26.0.6.so 36.6MB
/usr/lib/libllvm-qcom.so 35.2MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/cc1 35.2MB
/usr/lib/gcc/aarch64-linux-gnu/14.2/lto1 33.9MB
/usr/bin/lto-dump 33.9MB
/usr/lib/libRusticlOpenCL.so.1.0.0 33.7MB
/usr/local/venv/bin/ruff 31.8MB
/usr/share/icu/78.3/icudt78l.dat 31.5MB
/usr/lib/llvm/21/lib/libclang.so.21.1.7 30.2MB
/usr/lib/llvm/21/bin/c-index-test 28.6MB
/usr/local/venv/lib/python3.12/site-packages/gcc_arm_none_eabi/toolchain/libexec/gcc/arm-none-eabi/13.2.1/cc1 28.2MB
/usr/lib/libz3.so 27.9MB
/usr/bin/run 26.7MB
/usr/local/venv/lib/python3.12/site-packages/numpy.libs/libscipy_openblas64_-71e1b124.so 23.6MB
/usr/comma/updater 23.5MB
/usr/comma/setup 23.5MB
/usr/comma/reset 23.5MB
/usr/local/uv/python/cpython-3.12.13-linux-aarch64-gnu/bin/python3.12 22.2MB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just give these nice alias names instead? we'll be shipping a new kernel anyway in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants