iio: light: add support for VEML6075 UVA and UVB light sensor
Javier Carrasco
maintainerv3 cover iio: light: add support for VEML6075 UVA and UVB light sensor
This series adds support for the Vishay VEML6075 ultraviolet sensor, which offers UVA and UVB measurement channels and I2C communication.
The device bindings and a simple example are also provided.
This driver has been tested with a Gravity VEML6075 UV Sensor Module in open air conditions.
---
Changes in v3:
- veml6075.c: use MICRO instead of 1000000LL (add linux/units.h).
- veml6075.c: improve lock description.
- veml6075.c: remove unnecessary i2c_get_client_data() from the probe function.
- veml6075.c: remove shutdown function and do the bit update inline.
- veml6075.c: improve return path in read/write_raw().
- veml6075.c: remove -ENODEV return check for regulator_get_enable().
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- General: swap patch order (bindings first).
- iio core: add uva and uvb modifiers.
- veml6075.c: use uva and uvb modifiers instead of extend_name
- veml6075.c: remove redundant information from the description.
- veml6075.c: inline device name.
- veml6075.c: use read_avail() for available attributes.
- veml6075.c: use guard(mutex) instead of lock/unlock().
- veml6075.c: use regulator_get_enable() without _optional.
- veml6075.c: register managed iio device and delete remove().
- veml6075.c: remove remaining debug messages.
- veml6075.c: error path cleanup (return type after val assignment).
- veml6075.c: remove zero from i2c_device_id.
- MAINTAINERS: fix bindings name.
- vishay,veml6075.yaml: remove vdd-supply description and mark property as true.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Javier Carrasco (3):
iio: add modifiers for A and B ultraviolet light
dt-bindings: iio: light: add support for Vishay VEML6075
iio: light: add VEML6075 UVA and UVB light sensor driver
Documentation/ABI/testing/sysfs-bus-iio | 7 +- .../bindings/iio/light/vishay,veml6075.yaml | 39 ++ MAINTAINERS | 6 + drivers/iio/industrialio-core.c | 2 + drivers/iio/light/Kconfig | 11 + drivers/iio/light/Makefile | 1 + drivers/iio/light/veml6075.c | 474 +++++++++++++++++++++ include/uapi/linux/iio/types.h | 2 + tools/iio/iio_event_monitor.c | 2 + 9 files changed, 542 insertions(+), 2 deletions(-)
---
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
change-id: 20231110-veml6075-321522ceaca9
Best regards,
Signature · 1 line
Javier Carrasco <[email protected]>
Javier Carrasco
maintainerPATCH v3 1/3 iio: add modifiers for A and B ultraviolet light
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.
--- Documentation/ABI/testing/sysfs-bus-iio | 7 +++++-- drivers/iio/industrialio-core.c | 2 ++ include/uapi/linux/iio/types.h | 2 ++ tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-)
Documentation/ABI/testing/sysfs-bus-iio +5 -2
@@ -1574,6 +1574,8 @@ What: /sys/.../iio:deviceX/in_intensityY_raw What: /sys/.../iio:deviceX/in_intensityY_ir_raw What: /sys/.../iio:deviceX/in_intensityY_both_raw What: /sys/.../iio:deviceX/in_intensityY_uv_raw +What: /sys/.../iio:deviceX/in_intensityY_uva_raw +What: /sys/.../iio:deviceX/in_intensityY_uvb_raw What: /sys/.../iio:deviceX/in_intensityY_duv_raw KernelVersion: 3.4 Contact: [email protected]
@@ -1582,8 +1584,9 @@ Description: that measurements contain visible and infrared light components or just infrared light, respectively. Modifier uv indicates that measurements contain ultraviolet light - components. Modifier duv indicates that measurements - contain deep ultraviolet light components. + components. Modifiers uva, uvb and duv indicate that + measurements contain A, B or deep (C) ultraviolet light + components respectively. What: /sys/.../iio:deviceX/in_uvindex_input KernelVersion: 4.6
drivers/iio/industrialio-core.c +2 -0
@@ -117,6 +117,8 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_LIGHT_GREEN] = "green", [IIO_MOD_LIGHT_BLUE] = "blue", [IIO_MOD_LIGHT_UV] = "uv", + [IIO_MOD_LIGHT_UVA] = "uva", + [IIO_MOD_LIGHT_UVB] = "uvb", [IIO_MOD_LIGHT_DUV] = "duv", [IIO_MOD_QUATERNION] = "quaternion", [IIO_MOD_TEMP_AMBIENT] = "ambient",
include/uapi/linux/iio/types.h +2 -0
@@ -91,6 +91,8 @@ enum iio_modifier {IIO_MOD_CO2 ,IIO_MOD_VOC ,IIO_MOD_LIGHT_UV , +IIO_MOD_LIGHT_UVA , +IIO_MOD_LIGHT_UVB ,IIO_MOD_LIGHT_DUV ,IIO_MOD_PM1 , IIO_MOD_PM2P5,
tools/iio/iio_event_monitor.c +2 -0
@@ -105,6 +105,8 @@ static const char * const iio_modifier_names[] = { [IIO_MOD_LIGHT_GREEN] = "green", [IIO_MOD_LIGHT_BLUE] = "blue", [IIO_MOD_LIGHT_UV] = "uv", + [IIO_MOD_LIGHT_UVA] = "uva", + [IIO_MOD_LIGHT_UVB] = "uvb", [IIO_MOD_LIGHT_DUV] = "duv", [IIO_MOD_QUATERNION] = "quaternion", [IIO_MOD_TEMP_AMBIENT] = "ambient",
Signature · 1 line
2.39.2
Javier Carrasco
maintainerPATCH v3 2/3 dt-bindings: iio: light: add support for Vishay VEML6075
In reply to Javier CarrascoThe Vishay VEML6075 is a 16-bit digital UVA and UVB sensor with I2C interface.
Add bindings and an example for the Vishay VEML6075.
--- .../bindings/iio/light/vishay,veml6075.yaml | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+)
Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml new file +39 -0
@@ -0,0 +1,39 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/light/vishay,veml6075.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Vishay VEML6075 UVA and UVB sensor + +maintainers: + - Javier Carrasco <[email protected]> + +properties: + compatible: + const: vishay,veml6075 + + reg: + maxItems: 1 + + vdd-supply: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + uv-sensor@10 { + compatible = "vishay,veml6075"; + reg = <0x10>; + vdd-supply = <&vdd_reg>; + }; + }; +...
Signature · 1 line
2.39.2
Javier Carrasco
maintainerPATCH v3 3/3 iio: light: add VEML6075 UVA and UVB light sensor driver
In reply to Javier CarrascoThe Vishay VEMl6075 is a low power, 16-bit resolution UVA and UVB light sensor with I2C interface and noise compensation (visible and infrarred).
Every UV channel generates an output signal measured in counts per integration period, where the integration time is configurable.
This driver adds support for both UV channels and the ultraviolet index (UVI) inferred from them according to the device application note with open-air (no teflon) coefficients.
--- MAINTAINERS | 6 + drivers/iio/light/Kconfig | 11 + drivers/iio/light/Makefile | 1 + drivers/iio/light/veml6075.c | 474 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 492 insertions(+)
MAINTAINERS +6 -0
@@ -23184,6 +23184,12 @@ S: Maintained F: drivers/input/serio/userio.c F: include/uapi/linux/userio.h +VISHAY VEML6075 UVA AND UVB LIGHT SENSOR DRIVER +M: Javier Carrasco <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/iio/light/vishay,veml6075.yaml +F: drivers/iio/light/veml6075.c + VISL VIRTUAL STATELESS DECODER DRIVER M: Daniel Almeida <[email protected]> L: [email protected]
drivers/iio/light/Kconfig +11 -0
@@ -637,6 +637,17 @@ config VEML6070 To compile this driver as a module, choose M here: the module will be called veml6070. +config VEML6075 + tristate "VEML6075 UVA and UVB light sensor" + select REGMAP_I2C + depends on I2C + help + Say Y here if you want to build a driver for the Vishay VEML6075 UVA + and UVB light sensor. + + To compile this driver as a module, choose M here: the + module will be called veml6075. + config VL6180 tristate "VL6180 ALS, range and proximity sensor" depends on I2C
drivers/iio/light/Makefile +1 -0
@@ -60,5 +60,6 @@ obj-$(CONFIG_VCNL4000) += vcnl4000.o obj-$(CONFIG_VCNL4035) += vcnl4035.o obj-$(CONFIG_VEML6030) += veml6030.o obj-$(CONFIG_VEML6070) += veml6070.o +obj-$(CONFIG_VEML6075) += veml6075.o obj-$(CONFIG_VL6180) += vl6180.o obj-$(CONFIG_ZOPT2201) += zopt2201.o
drivers/iio/light/veml6075.c new file +474 -0
474 lines not on this page · raw message
Signature · 1 line
2.39.2
Jonathan Cameron
maintainerQuoted 9 lines · On Mon, 27 Nov 2023 18:34:27 +0100 Javier Carrasco…
This series adds support for the Vishay VEML6075 ultraviolet sensor, which offers UVA and UVB measurement channels and I2C communication.
The device bindings and a simple example are also provided.
This driver has been tested with a Gravity VEML6075 UV Sensor Module in open air conditions.
Signed-off-by Javier Carrasco <[email protected]>
Hi Javier,
Applied to the togreg branch of iio.git and pushed out as testing for 0-day to see if it can find anything we missed.
Thanks,
Jonathan