Skip to content

Add TCS3472 and VEML6040 sensor support (and a few others)#6448

Merged
pelwell merged 4 commits intoraspberrypi:rpi-6.12.yfrom
pelwell:is6446
Apr 25, 2025
Merged

Add TCS3472 and VEML6040 sensor support (and a few others)#6448
pelwell merged 4 commits intoraspberrypi:rpi-6.12.yfrom
pelwell:is6446

Conversation

@pelwell
Copy link
Copy Markdown
Contributor

@pelwell pelwell commented Oct 29, 2024

Add support for the I2C sensors requested in #6446, and a few other related devices.

@gnustomp
Copy link
Copy Markdown

Hi, might it be possible to update this for 6.12.y? There should be no need to backport patches, just add the sensors to the devicetree overlay and defconfigs. I can test for VEML6040.

@pelwell
Copy link
Copy Markdown
Contributor Author

pelwell commented Apr 22, 2025

Are you in a position to test it? The reason the PR was never merged is that the original requester stopped responding.

@gnustomp
Copy link
Copy Markdown

I only have a VEML6040, but yes I am happy to test. (In fact, I had manually added it to the devicetree locally, only to discover the kernel driver wasn't built.)

@pelwell pelwell changed the base branch from rpi-6.6.y to rpi-6.12.y April 24, 2025 16:41
commit b89710b upstream.

Currently there are only two modifiers for ultraviolet light: a generic
one for any ultraviolet light (IIO_MOD_LIGHT_UV) and one for deep
ultraviolet (IIO_MOD_LIGHT_DUV), which is also referred as ultraviolet
C (UV-C) band and covers short-wave ultraviolet.

There are still no modifiers for the long-wave and medium-wave
ultraviolet bands. These two bands are the main components used to
obtain the UV index on the Earth's surface.

Add modifiers for the ultraviolet A (UV-A) and ultraviolet B (UV-B)
bands.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231110-veml6075-v3-1-6ee46775b422@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
commit 6f6c72a upstream.

The new modifiers should have added to the end of the enum, so they do
not affect the existing entries.

No modifiers were added since then, so they can be moved safely to the
end of the list.

Move IIO_MOD_LIGHT_UVA and IIO_MOD_LIGHT_UVB to the end of iio_modifier.

Fixes: b89710b ("iio: add modifiers for A and B ultraviolet light")
Suggested-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240127200208.185815-1-javier.carrasco.cruz@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Copy link
Copy Markdown

@gnustomp gnustomp left a comment

Choose a reason for hiding this comment

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

With sudo rpi-update pulls/6448, the devicetree node of VEML6040 is present but there is no driver loaded.

$ uname -a
Linux dispi 6.12.22-v8-16k+ #1 SMP PREEMPT Thu Apr 24 17:25:53 UTC 2025 aarch64 GNU/Linux
$ cat /boot/firmware/config.txt
<snipped>
dtoverlay=i2c-sensor,bme280,veml6040
$ cat /sys/firmware/devicetree/base/axi/pcie@1000120000/rp1/i2c@74000/veml6040@10/status; echo
okay
$ lsmod | grep veml6040
$ ls /lib/modules/6.12.22-v8-16k+/kernel/drivers/iio/light
apds9960.ko.xz  as73211.ko.xz  bh1750.ko.xz  tcs3472.ko.xz  tsl4531.ko.xz  veml6070.ko.xz  veml6075.ko.xz

CONFIG_BH1750=m
CONFIG_TCS3472=m
CONFIG_TSL4531=m
CONFIG_VEML6070=m
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think CONFIG_VEML6040=m needs to be added to the defconfigs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed - it's been missing from the start, but not tested. It's there now, and there will be another test build in about 40 minutes.

pelwell added 2 commits April 25, 2025 15:04
Enable support for the TCS3472 and VEML6040 families of light sensors.

Link: raspberrypi#6446

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Extend the i2c-sensor overlay with support for the VEML6040 and TCS3472
family of light sensors.

Link: raspberrypi#6446

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
@pelwell pelwell merged commit 84620c3 into raspberrypi:rpi-6.12.y Apr 25, 2025
12 of 13 checks passed
@gnustomp
Copy link
Copy Markdown

Confirmed that veml6040 is loaded and functional:

$ uname -a
Linux dispi 6.12.22-v8-16k+ #1 SMP PREEMPT Fri Apr 25 14:43:02 UTC 2025 aarch64 GNU/Linux
$ cat /sys/bus/iio/devices/iio\:device0/name
veml6040
$ cat /sys/bus/iio/devices/iio\:device0/in_intensity_clear_raw 
120

Thanks!

@pelwell pelwell deleted the is6446 branch April 26, 2025 07:09
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Apr 26, 2025
kernel: lockdep fixes for imx708 and imx477
See: raspberrypi/linux#6813

kernel: drm/vc4: plane: Fix incorrect handling of GEN_6_D in vc4_plane_async_set_fb
See: raspberrypi/linux#6811

kernel: configs: Enable UNICODE support (for filesystems)
See: raspberrypi/linux#6809

kernel: configs: Enable the EROFS read-only filesystem
See: raspberrypi/linux#6806

kernel: overlays: Add aht20 support to i2c-sensor
See: raspberrypi/linux#6805

kernel: 6.12/iob/topic/imx335
See: raspberrypi/linux#6804

kernel: hwmon: aht10: Fix AHT20 initialization
See: raspberrypi/linux#6803

kernel: drm/vc4: plane: Use nearest neighbour filter with YUV444 workaround
See: raspberrypi/linux#6796

kernel: dtoverlays: Create Pi5 variant of tc358743 overlay
See: raspberrypi/linux#6795

kernel: usb: xhci: default to Intel scheme for calculating U1/U2 timeouts
See: raspberrypi/linux#6794

kernel: Add TCS3472 and VEML6040 sensor support (and a few others)
See: raspberrypi/linux#6448

kernel: drm/vc4: plane: Increase UPM allocation size for YUV444
See: raspberrypi/linux#6791

kernel: media: i2c: imx219: Restore the 1920x1080 to using a 1:1 PAR
See: raspberrypi/linux#6793
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Apr 26, 2025
kernel: lockdep fixes for imx708 and imx477
See: raspberrypi/linux#6813

kernel: drm/vc4: plane: Fix incorrect handling of GEN_6_D in vc4_plane_async_set_fb
See: raspberrypi/linux#6811

kernel: configs: Enable UNICODE support (for filesystems)
See: raspberrypi/linux#6809

kernel: configs: Enable the EROFS read-only filesystem
See: raspberrypi/linux#6806

kernel: overlays: Add aht20 support to i2c-sensor
See: raspberrypi/linux#6805

kernel: 6.12/iob/topic/imx335
See: raspberrypi/linux#6804

kernel: hwmon: aht10: Fix AHT20 initialization
See: raspberrypi/linux#6803

kernel: drm/vc4: plane: Use nearest neighbour filter with YUV444 workaround
See: raspberrypi/linux#6796

kernel: dtoverlays: Create Pi5 variant of tc358743 overlay
See: raspberrypi/linux#6795

kernel: usb: xhci: default to Intel scheme for calculating U1/U2 timeouts
See: raspberrypi/linux#6794

kernel: Add TCS3472 and VEML6040 sensor support (and a few others)
See: raspberrypi/linux#6448

kernel: drm/vc4: plane: Increase UPM allocation size for YUV444
See: raspberrypi/linux#6791

kernel: media: i2c: imx219: Restore the 1920x1080 to using a 1:1 PAR
See: raspberrypi/linux#6793
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.

3 participants