Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: vcnl4035: fixed chip ID check

VCNL4035 register(0xE) ID_L and ID_M define as:

ID_L: 0x80
ID_H: 7:6 (0:0)
5:4 (0:0) slave address = 0x60 (7-bit)
(0:1) slave address = 0x51 (7-bit)
(1:0) slave address = 0x40 (7-bit)
(1:0) slave address = 0x41 (7-bit)
3:0 Version code default (0:0:0:0)

So just check ID_L.

Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230501143605.1615549-1-Frank.Li@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Frank Li and committed by
Jonathan Cameron
a551c26e 72c1d110

+3
+3
drivers/iio/light/vcnl4035.c
··· 8 8 * TODO: Proximity 9 9 */ 10 10 #include <linux/bitops.h> 11 + #include <linux/bitfield.h> 11 12 #include <linux/i2c.h> 12 13 #include <linux/module.h> 13 14 #include <linux/pm_runtime.h> ··· 43 42 #define VCNL4035_ALS_PERS_MASK GENMASK(3, 2) 44 43 #define VCNL4035_INT_ALS_IF_H_MASK BIT(12) 45 44 #define VCNL4035_INT_ALS_IF_L_MASK BIT(13) 45 + #define VCNL4035_DEV_ID_MASK GENMASK(7, 0) 46 46 47 47 /* Default values */ 48 48 #define VCNL4035_MODE_ALS_ENABLE BIT(0) ··· 415 413 return ret; 416 414 } 417 415 416 + id = FIELD_GET(VCNL4035_DEV_ID_MASK, id); 418 417 if (id != VCNL4035_DEV_ID_VAL) { 419 418 dev_err(&data->client->dev, "Wrong id, got %x, expected %x\n", 420 419 id, VCNL4035_DEV_ID_VAL);