diff mbox series

[v2,07/10] iio: light: veml6030: drop processed info for white channel

Message ID 20240923-veml6035-v2-7-58c72a0df31c@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series iio: light: veml6030: fix issues and add support for veml6035 | expand

Commit Message

Javier Carrasco Sept. 22, 2024, 10:17 p.m. UTC
The resolution of the WHITE channel is not provided by the manufacturer,
neither in the datasheet nor in the application note (even their
proprietary application only processes the ALS channel, giving raw
values for WHITE).

The current implementation assumes that both resolutions are identical,
which is extremely unlikely, especially for photodiodes with different
spectral responses.

Drop the processed information as it is meaningless.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/iio/light/veml6030.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Jonathan Cameron Sept. 28, 2024, 4:20 p.m. UTC | #1
On Mon, 23 Sep 2024 00:17:55 +0200
Javier Carrasco <javier.carrasco.cruz@gmail.com> wrote:

> The resolution of the WHITE channel is not provided by the manufacturer,
> neither in the datasheet nor in the application note (even their
> proprietary application only processes the ALS channel, giving raw
> values for WHITE).
> 
> The current implementation assumes that both resolutions are identical,
> which is extremely unlikely, especially for photodiodes with different
> spectral responses.
> 
> Drop the processed information as it is meaningless.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Just to note, this one is fine as it is fixing an ABI bug
so is a valid reason to change the ABI.

In theory though we should pull it out as a fix to add to stable
as well, but it's low risk that anyone is using the 'false'
channel so I don't think we care about backports for this one.

Thanks,

Jonathan

> ---
>  drivers/iio/light/veml6030.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> index a3190fab3add..861bdf2edd4d 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -209,8 +209,7 @@ static const struct iio_chan_spec veml6030_channels[] = {
>  		.channel = CH_WHITE,
>  		.modified = 1,
>  		.channel2 = IIO_MOD_LIGHT_BOTH,
> -		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> -				BIT(IIO_CHAN_INFO_PROCESSED),
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_INT_TIME) |
>  					       BIT(IIO_CHAN_INFO_SCALE),
>  		.info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_INT_TIME) |
> @@ -549,11 +548,6 @@ static int veml6030_read_raw(struct iio_dev *indio_dev,
>  				dev_err(dev, "can't read white data %d\n", ret);
>  				return ret;
>  			}
> -			if (mask == IIO_CHAN_INFO_PROCESSED) {
> -				*val = (reg * data->cur_resolution) / 10000;
> -				*val2 = (reg * data->cur_resolution) % 10000;
> -				return IIO_VAL_INT_PLUS_MICRO;
> -			}
>  			*val = reg;
>  			return IIO_VAL_INT;
>  		default:
>
diff mbox series

Patch

diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index a3190fab3add..861bdf2edd4d 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -209,8 +209,7 @@  static const struct iio_chan_spec veml6030_channels[] = {
 		.channel = CH_WHITE,
 		.modified = 1,
 		.channel2 = IIO_MOD_LIGHT_BOTH,
-		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
-				BIT(IIO_CHAN_INFO_PROCESSED),
+		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
 		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_INT_TIME) |
 					       BIT(IIO_CHAN_INFO_SCALE),
 		.info_mask_shared_by_all_available = BIT(IIO_CHAN_INFO_INT_TIME) |
@@ -549,11 +548,6 @@  static int veml6030_read_raw(struct iio_dev *indio_dev,
 				dev_err(dev, "can't read white data %d\n", ret);
 				return ret;
 			}
-			if (mask == IIO_CHAN_INFO_PROCESSED) {
-				*val = (reg * data->cur_resolution) / 10000;
-				*val2 = (reg * data->cur_resolution) % 10000;
-				return IIO_VAL_INT_PLUS_MICRO;
-			}
 			*val = reg;
 			return IIO_VAL_INT;
 		default: