mbox series

[v2,0/3] iio: light: add support for AMS AS7331

Message ID 20240103-as7331-v2-0-6f0ad05e0482@gmail.com (mailing list archive)
Headers show
Series iio: light: add support for AMS AS7331 | expand

Message

Javier Carrasco Jan. 3, 2024, 12:08 p.m. UTC
The AMS AS7331 UV light sensor measures three ultraviolet bands (UVA,
UVB and UVC, also known as deep UV or DUV) as well as temperature.

This device is practically identical to the AMS AS73211 XYZ True Color
sensor that is already supported by the iio subsystem, except for the
photodiodes used to aquire the desired light wavelengths.

In order to reuse code and reduce maintenance load, this series extends
the AS73211 driver to support the AS7331 as well.

Note that the UVA and UVB light modifiers have not been merged into the
mainline kernel yet, but they are already available in Greg's char-misc
git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.

The original device AS73211 supported by the driver could only be tested
briefly due to the lack of hardware. Instead, the i2c-stub module has
been used to make sure that the driver registers the iio device properly
and the attributes exported to sysfs are correct. Some basic register
assignments reported the expected intensity scales and in principle
nothing else should have been affected by the modifications in the code.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Changes in v2:
- as73211.c: Use IIO_VAL_FRACTIONAL to retrieve scales of AS73211.
- as73211.c: simplify device-specific data retrieval in probe function.
- as73211.c: minor coding-style fix (shorter line).
- Link to v1: https://lore.kernel.org/r/20231220-as7331-v1-0-745b73c27703@gmail.com

---
Javier Carrasco (3):
      iio: light: as73211: use IIO_VAL_FRACTIONAL for intensity scales
      dt-bindings: iio: light: as73211: add support for as7331
      iio: light: as73211: add support for as7331

 .../devicetree/bindings/iio/light/ams,as73211.yaml |   7 +-
 drivers/iio/light/Kconfig                          |   5 +-
 drivers/iio/light/as73211.c                        | 142 +++++++++++++++++----
 3 files changed, 123 insertions(+), 31 deletions(-)
---
base-commit: e9215fcca2561b208c78359110ee4009b454f761
change-id: 20231220-as7331-88a25ceeb66d

Best regards,

Comments

Jonathan Cameron Jan. 7, 2024, 3:58 p.m. UTC | #1
On Wed, 03 Jan 2024 13:08:50 +0100
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:

> The AMS AS7331 UV light sensor measures three ultraviolet bands (UVA,
> UVB and UVC, also known as deep UV or DUV) as well as temperature.
> 
> This device is practically identical to the AMS AS73211 XYZ True Color
> sensor that is already supported by the iio subsystem, except for the
> photodiodes used to aquire the desired light wavelengths.
> 
> In order to reuse code and reduce maintenance load, this series extends
> the AS73211 driver to support the AS7331 as well.
> 
> Note that the UVA and UVB light modifiers have not been merged into the
> mainline kernel yet, but they are already available in Greg's char-misc
> git tree which can be found at
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
> in the char-misc-next branch.
> 
> The original device AS73211 supported by the driver could only be tested
> briefly due to the lack of hardware. Instead, the i2c-stub module has
> been used to make sure that the driver registers the iio device properly
> and the attributes exported to sysfs are correct. Some basic register
> assignments reported the expected intensity scales and in principle
> nothing else should have been affected by the modifications in the code.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Hi Javier,

Series applied - but given timing I'll only push this out as testing for
now as I'll want to rebase the IIO tree on rc1 once available in a couple of
weeks time.

Thanks,

Jonathan

> ---
> Changes in v2:
> - as73211.c: Use IIO_VAL_FRACTIONAL to retrieve scales of AS73211.
> - as73211.c: simplify device-specific data retrieval in probe function.
> - as73211.c: minor coding-style fix (shorter line).
> - Link to v1: https://lore.kernel.org/r/20231220-as7331-v1-0-745b73c27703@gmail.com
> 
> ---
> Javier Carrasco (3):
>       iio: light: as73211: use IIO_VAL_FRACTIONAL for intensity scales
>       dt-bindings: iio: light: as73211: add support for as7331
>       iio: light: as73211: add support for as7331
> 
>  .../devicetree/bindings/iio/light/ams,as73211.yaml |   7 +-
>  drivers/iio/light/Kconfig                          |   5 +-
>  drivers/iio/light/as73211.c                        | 142 +++++++++++++++++----
>  3 files changed, 123 insertions(+), 31 deletions(-)
> ---
> base-commit: e9215fcca2561b208c78359110ee4009b454f761
> change-id: 20231220-as7331-88a25ceeb66d
> 
> Best regards,
Javier Carrasco Jan. 7, 2024, 5:34 p.m. UTC | #2
On 07.01.24 16:58, Jonathan Cameron wrote:
> On Wed, 03 Jan 2024 13:08:50 +0100
> Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:
> 
>> The AMS AS7331 UV light sensor measures three ultraviolet bands (UVA,
>> UVB and UVC, also known as deep UV or DUV) as well as temperature.
>>
>> This device is practically identical to the AMS AS73211 XYZ True Color
>> sensor that is already supported by the iio subsystem, except for the
>> photodiodes used to aquire the desired light wavelengths.
>>
>> In order to reuse code and reduce maintenance load, this series extends
>> the AS73211 driver to support the AS7331 as well.
>>
>> Note that the UVA and UVB light modifiers have not been merged into the
>> mainline kernel yet, but they are already available in Greg's char-misc
>> git tree which can be found at
>> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
>> in the char-misc-next branch.
>>
>> The original device AS73211 supported by the driver could only be tested
>> briefly due to the lack of hardware. Instead, the i2c-stub module has
>> been used to make sure that the driver registers the iio device properly
>> and the attributes exported to sysfs are correct. Some basic register
>> assignments reported the expected intensity scales and in principle
>> nothing else should have been affected by the modifications in the code.
>>
>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> Hi Javier,
> 
> Series applied - but given timing I'll only push this out as testing for
> now as I'll want to rebase the IIO tree on rc1 once available in a couple of
> weeks time.
> 
> Thanks,
> 
> Jonathan
> 
Hi Jonathan,

I am happy with that approach. Some extra time to catch issues before
going live is a good thing anyway.

Thank you and best regards,

Javier Carrasco