Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dts: bcm2712-rpi: Add aliases for the CSI/DSI I2Cs #6421

Merged
merged 1 commit into from
Oct 17, 2024

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Oct 16, 2024

Older Pis arrange that the camera I2C ports appear as /dev/i2c-10. Add aliases so that on the Pi 5 family, i2c_csi_dsi0 becomes i2c-10 and i2c_csi_dsi1 becomes i2c-11. Only the I2C buses that appear on the 40-pin header, i.e. I2C0 to I2C3, get a low bus number.

Also add hints for our udev rules about which symlinks to create for backwards-compatibility with the previous bus numbers. Note that lower numbers have priority, so i2c-0 on CM5 masks i2c-11, forcing i2c-11 to be a symlink to i2c-0, not vice versa.

Older Pis arrange that the camera I2C ports appear as /dev/i2c-10. Add
aliases so that on the Pi 5 family, i2c_csi_dsi0 becomes i2c-10 and
i2c_csi_dsi1 becomes i2c-11. Only the I2C buses that appear on the
40-pin header, i.e. I2C0 to I2C3, get a low bus number.

Also add hints for our udev rules about which symlinks to create for
backwards-compatibility with the previous bus numbers. Note that
lower numbers have priority, so i2c-0 on CM5 masks i2c-11, forcing
i2c-11 to be a symlink to i2c-0, not vice versa.

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor Author

pelwell commented Oct 16, 2024

A suitably updated /lib/udev/rules.d/60-i2c-tools.rules would be:

SUBSYSTEM=="i2c-dev",KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660", PROGRAM="/bin/sh -c '\
        DTNODE=/sys/class/i2c-dev/%k/device/of_node; \
        if [ -e $$DTNODE/symlink ]; then \
            cat $$DTNODE/symlink; \
        else \
            exit 1; \
        fi \
'", SYMLINK+="%c"

@pelwell
Copy link
Contributor Author

pelwell commented Oct 16, 2024

This is Pi 5 with this PR and the above udev rule:

$ ls -l /dev/i2c*
crw-rw---- 1 root i2c 89, 13 Oct 16 15:57 /dev/i2c-13
crw-rw---- 1 root i2c 89, 14 Oct 16 15:57 /dev/i2c-14
$ i2cdetect -l
i2c-13  i2c             107d508200.i2c                          I2C adapter
i2c-14  i2c             107d508280.i2c                          I2C adapter

$ sudo dtparam i2c_csi_dsi0
$ ls -l /dev/i2c*
crw-rw---- 1 root i2c  89, 10 Oct 16 15:58 /dev/i2c-10
crw-rw---- 1 root i2c  89, 13 Oct 16 15:57 /dev/i2c-13
crw-rw---- 1 root i2c  89, 14 Oct 16 15:57 /dev/i2c-14
lrwxrwxrwx 1 root root      6 Oct 16 15:58 /dev/i2c-6 -> i2c-10
$ i2cdetect -l
i2c-10  i2c             Synopsys DesignWare I2C adapter         I2C adapter
i2c-13  i2c             107d508200.i2c                          I2C adapter
i2c-14  i2c             107d508280.i2c                          I2C adapter

$ sudo dtparam i2c_csi_dsi1
$ ls -l /dev/i2c*
crw-rw---- 1 root i2c  89, 10 Oct 16 15:58 /dev/i2c-10
crw-rw---- 1 root i2c  89, 11 Oct 16 15:58 /dev/i2c-11
crw-rw---- 1 root i2c  89, 13 Oct 16 15:57 /dev/i2c-13
crw-rw---- 1 root i2c  89, 14 Oct 16 15:57 /dev/i2c-14
lrwxrwxrwx 1 root root      6 Oct 16 15:58 /dev/i2c-4 -> i2c-11
lrwxrwxrwx 1 root root      6 Oct 16 15:58 /dev/i2c-6 -> i2c-10
$ i2cdetect -l
i2c-10  i2c             Synopsys DesignWare I2C adapter         I2C adapter
i2c-11  i2c             Synopsys DesignWare I2C adapter         I2C adapter
i2c-13  i2c             107d508200.i2c                          I2C adapter
i2c-14  i2c             107d508280.i2c                          I2C adapter

@pelwell pelwell merged commit 36faab6 into raspberrypi:rpi-6.6.y Oct 17, 2024
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Oct 18, 2024
See: raspberrypi/linux#6421

kernel: Fixes for video-mux with Pi5
See: raspberrypi/linux#6410

kernel: OV5647 link frequency control
See: raspberrypi/linux#6423

kernel: CQE incremental fixes part 2
See: raspberrypi/linux#6419
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Oct 18, 2024
See: raspberrypi/linux#6421

kernel: Fixes for video-mux with Pi5
See: raspberrypi/linux#6410

kernel: OV5647 link frequency control
See: raspberrypi/linux#6423

kernel: CQE incremental fixes part 2
See: raspberrypi/linux#6419
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.

1 participant