Patch "iio: light: veml6030: fix microlux value calculation" has been added to the 6.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iio: light: veml6030: fix microlux value calculation

to the 6.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iio-light-veml6030-fix-microlux-value-calculation.patch
and it can be found in the queue-6.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 617e0a742fa1ec269638d280602c22c4ebd702b2
Author: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
Date:   Wed Oct 16 19:04:31 2024 +0200

    iio: light: veml6030: fix microlux value calculation
    
    [ Upstream commit 63dd163cd61dda6f38343776b42331cc6b7e56e0 ]
    
    The raw value conversion to obtain a measurement in lux as
    INT_PLUS_MICRO does not calculate the decimal part properly to display
    it as micro (in this case microlux). It only calculates the module to
    obtain the decimal part from a resolution that is 10000 times the
    provided in the datasheet (0.5376 lux/cnt for the veml6030). The
    resulting value must still be multiplied by 100 to make it micro.
    
    This bug was introduced with the original implementation of the driver.
    
    Only the illuminance channel is fixed becuase the scale is non sensical
    for the intensity channels anyway.
    
    Cc: stable@xxxxxxxxxxxxxxx
    Fixes: 7b779f573c48 ("iio: light: add driver for veml6030 ambient light sensor")
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx>
    Link: https://patch.msgid.link/20241016-veml6030-fix-processed-micro-v1-1-4a5644796437@xxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
index 621428885455c..8e76c828afddc 100644
--- a/drivers/iio/light/veml6030.c
+++ b/drivers/iio/light/veml6030.c
@@ -535,7 +535,7 @@ static int veml6030_read_raw(struct iio_dev *indio_dev,
 			}
 			if (mask == IIO_CHAN_INFO_PROCESSED) {
 				*val = (reg * data->cur_resolution) / 10000;
-				*val2 = (reg * data->cur_resolution) % 10000;
+				*val2 = (reg * data->cur_resolution) % 10000 * 100;
 				return IIO_VAL_INT_PLUS_MICRO;
 			}
 			*val = reg;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux