* [PATCH] iio: light: vcnl4035: Fix swapped raw channel readings
@ 2026-11-13 11:01 Hungyu Lin
2026-11-13 12:27 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-11-13 11:01 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá,
Andy Shevchenko, Parthiban Nallathambi, linux-iio, linux-kernel,
stable
The IIO_LIGHT channel has channel number 0 and the IIO_INTENSITY
channel has channel number 1. vcnl4035_read_info_raw() selects the ALS
register for a nonzero channel number, so in_illuminance_raw returns
the white-channel sample and in_intensity_both_raw returns the ALS
sample. This also causes the illuminance scale to be applied to a
white-channel sample.
Select the ALS data register for IIO_LIGHT and the white data register
for the intensity channel.
Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
Link: https://www.vishay.com/docs/84251/vcnl4035x01.pdf
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
drivers/iio/light/vcnl4035.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index f1cc75245001..4bbb3b458eb5 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -156,7 +156,7 @@ static int vcnl4035_read_info_raw(struct iio_dev *indio_dev,
if (!iio_device_claim_direct(indio_dev))
return -EBUSY;
- if (chan->channel)
+ if (chan->type == IIO_LIGHT)
reg = VCNL4035_ALS_DATA;
else
reg = VCNL4035_WHITE_DATA;
base-commit: 9752760146e642f3e4a2ec860f8767fa72030d2c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: light: vcnl4035: Fix swapped raw channel readings
2026-11-13 11:01 [PATCH] iio: light: vcnl4035: Fix swapped raw channel readings Hungyu Lin
@ 2026-11-13 12:27 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-11-13 12:27 UTC (permalink / raw)
To: Hungyu Lin
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Parthiban Nallathambi, linux-iio, linux-kernel,
stable
On Fri, Nov 13, 2026 at 11:01:23AM +0000, Hungyu Lin wrote:
> The IIO_LIGHT channel has channel number 0 and the IIO_INTENSITY
> channel has channel number 1. vcnl4035_read_info_raw() selects the ALS
> register for a nonzero channel number, so in_illuminance_raw returns
> the white-channel sample and in_intensity_both_raw returns the ALS
> sample. This also causes the illuminance scale to be applied to a
> white-channel sample.
>
> Select the ALS data register for IIO_LIGHT and the white data register
> for the intensity channel.
>
> Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
> Link: https://www.vishay.com/docs/84251/vcnl4035x01.pdf
Make a Link tag with a reference: Link: $URL [1], and refer to that in the
commit message. Or make it a Datasheet tag. Otherwise intention of this
Link is odd.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-13 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 11:01 [PATCH] iio: light: vcnl4035: Fix swapped raw channel readings Hungyu Lin
2026-11-13 12:27 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®