iio: ltr501: ltr501_read_ps(): add missing endianness conversion
The PS ADC Channel data is spread over 2 registers in little-endian
form. This patch adds the missing endianness conversion.
Fixes: 2690be9051
("iio: Add Lite-On ltr501 ambient light / proximity sensor driver")
Signed-off-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-4-mkl@pengutronix.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
421a26f3d7
commit
71b33f6f93
|
@ -409,18 +409,19 @@ static int ltr501_read_als(const struct ltr501_data *data, __le16 buf[2])
|
|||
|
||||
static int ltr501_read_ps(const struct ltr501_data *data)
|
||||
{
|
||||
int ret, status;
|
||||
__le16 status;
|
||||
int ret;
|
||||
|
||||
ret = ltr501_drdy(data, LTR501_STATUS_PS_RDY);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = regmap_bulk_read(data->regmap, LTR501_PS_DATA,
|
||||
&status, 2);
|
||||
&status, sizeof(status));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return status;
|
||||
return le16_to_cpu(status);
|
||||
}
|
||||
|
||||
static int ltr501_read_intr_prst(const struct ltr501_data *data,
|
||||
|
|
Loading…
Reference in New Issue