Skip to content

Commit fbadeba

Browse files
marckleinebuddegregkh
authored andcommitted
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
commit 2ac0b02 upstream. The regmap is configured for 8 bit registers, uses a RB-Tree cache and marks several registers as volatile (i.e. do not cache). The ALS and PS data registers in the chip are 16 bit wide and spans two regmap registers. In the current driver only the base register is marked as volatile, resulting in the upper register only read once. Further the data sheet notes: | When the I2C read operation starts, all four ALS data registers are | locked until the I2C read operation of register 0x8B is completed. Which results in the registers never update after the 2nd read. This patch fixes the problem by marking the upper 8 bits of the ALS and PS registers as volatile, too. Fixes: 2f2c963 ("iio: ltr501: Add regmap support.") Reported-by: Oliver Lang <Oliver.Lang@gossenmetrawatt.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559 Link: https://lore.kernel.org/r/20210610134619.2101372-2-mkl@pengutronix.de Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 17c67f4 commit fbadeba

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎drivers/iio/light/ltr501.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232
#define LTR501_PART_ID 0x86
3333
#define LTR501_MANUFAC_ID 0x87
3434
#define LTR501_ALS_DATA1 0x88 /* 16-bit, little endian */
35+
#define LTR501_ALS_DATA1_UPPER 0x89 /* upper 8 bits of LTR501_ALS_DATA1 */
3536
#define LTR501_ALS_DATA0 0x8a /* 16-bit, little endian */
37+
#define LTR501_ALS_DATA0_UPPER 0x8b /* upper 8 bits of LTR501_ALS_DATA0 */
3638
#define LTR501_ALS_PS_STATUS 0x8c
3739
#define LTR501_PS_DATA 0x8d /* 16-bit, little endian */
40+
#define LTR501_PS_DATA_UPPER 0x8e /* upper 8 bits of LTR501_PS_DATA */
3841
#define LTR501_INTR 0x8f /* output mode, polarity, mode */
3942
#define LTR501_PS_THRESH_UP 0x90 /* 11 bit, ps upper threshold */
4043
#define LTR501_PS_THRESH_LOW 0x92 /* 11 bit, ps lower threshold */
@@ -1354,9 +1357,12 @@ static bool ltr501_is_volatile_reg(struct device *dev, unsigned int reg)
13541357
{
13551358
switch (reg) {
13561359
case LTR501_ALS_DATA1:
1360+
case LTR501_ALS_DATA1_UPPER:
13571361
case LTR501_ALS_DATA0:
1362+
case LTR501_ALS_DATA0_UPPER:
13581363
case LTR501_ALS_PS_STATUS:
13591364
case LTR501_PS_DATA:
1365+
case LTR501_PS_DATA_UPPER:
13601366
return true;
13611367
default:
13621368
return false;

0 commit comments

Comments
 (0)