raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.03k stars 4.96k forks source link

dtoverlay=ADS1115 does not support loading multiple devices at different i2c addresses #4213

Closed Dloranger closed 3 years ago

Dloranger commented 3 years ago

Describe the bug The overlay works properly for a single device, but the device supports multiple addresses so the overlay needs to support using multiple devices at different addresses concurrently.

To reproduce instantiate the overlay 2x in the /boot/config.txt. only changing the dtparam=addr=0x48 between the 2 devices

dtoverlay=ads1115 dtparam=addr=0x48 dtparam=cha_enable dtparam=cha_cfg=4 dtparam=cha_datarate=7 dtparam=cha_gain=1 dtparam=chb_enable dtparam=chb_cfg=5 dtparam=chb_datarate=7 dtparam=chb_gain=1 dtparam=chc_enable dtparam=chc_cfg=6 dtparam=chc_datarate=7 dtparam=chc_gain=1 dtparam=chd_enable dtparam=chd_cfg=7 dtparam=chd_datarate=7 dtparam=chd_gain=1

dtoverlay=ads1115 dtparam=addr=0x49 dtparam=cha_enable dtparam=cha_cfg=4 dtparam=cha_datarate=7 dtparam=cha_gain=1 dtparam=chb_enable dtparam=chb_cfg=5 dtparam=chb_datarate=7 dtparam=chb_gain=1 dtparam=chc_enable dtparam=chc_cfg=6 dtparam=chc_datarate=7 dtparam=chc_gain=1 dtparam=chd_enable dtparam=chd_cfg=7 dtparam=chd_datarate=7 dtparam=chd_gain=1

Expected behaviour Both devices should be loaded as separate devices and detectable using i2cdetect -y 1 command

Actual behaviour Only the last instance of the dtoverlay=ads1115 is actually used, so I have devices at 0x48 and 0x49. When I check the i2c bus scan, I can only see the 0x49 device loaded.

image

System Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

root@openrepeater-bd16:~# uname -a Linux openrepeater-bd16 4.19.57-v7l+ #1244 SMP Thu Jul 4 18:48:07 BST 2019 armv7l GNU/Linux

Logs If applicable, add the relevant output from dmesg or similar.

root@openrepeater-bd16:~# dmesg | grep ads1 [ 6.913652] ads1015 1-0049: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().

Additional context https://cdn-shop.adafruit.com/datasheets/ads1115.pdf, Page 14 shows the available address options simple source to get breakout boards if needed: https://www.adafruit.com/product/1085

pelwell commented 3 years ago

You're a bit behind the times - this was fixed in rpi-5.4.y.