linux-stable/drivers/iio
Quentin Schulz 4434bd1c58 iio: adc: rockchip_saradc: use mask for write_enable bitfield
[ Upstream commit 5b4e4b7203 ]

Some of the registers on the SARADCv2 have bits write protected except
if another bit is set. This is usually done by having the lowest 16 bits
store the data to write and the highest 16 bits specify which of the 16
lowest bits should have their value written to the hardware block.

The write_enable mask for the channel selection was incorrect because it
was just the value shifted by 16 bits, which means it would only ever
write bits and never clear them. So e.g. if someone starts a conversion
on channel 5, the lowest 4 bits would be 0x5, then starts a conversion
on channel 0, it would still be 5.

Instead of shifting the value by 16 as the mask, let's use the OR'ing of
the appropriate masks shifted by 16.

Note that this is not an issue currently because the only SARADCv2
currently supported has a reset defined in its Device Tree, that reset
resets the SARADC controller before starting a conversion on a channel.
However, this reset is handled as optional by the probe function and
thus proper masking should be used in the event an SARADCv2 without a
reset ever makes it upstream.

Fixes: 757953f8ec ("iio: adc: rockchip_saradc: Add support for RK3588")
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20240223-saradcv2-chan-mask-v1-2-84b06a0f623a@theobroma-systems.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:32:08 +02:00
..
accel iio: accel: adxl367: fix I2C FIFO data register 2024-02-25 14:31:14 +00:00
adc iio: adc: rockchip_saradc: use mask for write_enable bitfield 2024-04-03 15:32:08 +02:00
addac IIO: 1st set of new device support, features and cleanup for 6.7 2023-10-20 07:54:15 +02:00
afe iio: afe: rescale: Accept only offset channels 2023-10-17 20:25:32 +01:00
amplifiers iio: amplifiers: hmc425a: add support for ADRF5740 Attenuator 2023-11-26 16:36:53 +00:00
buffer Char/Misc and other Driver changes for 6.8-rc1 2024-01-17 16:47:17 -08:00
cdc iio: cdc: ad7150: relax return value check for IRQ get 2023-08-01 18:55:55 +01:00
chemical TTY/Serial changes for 6.8-rc1 2024-01-18 11:37:24 -08:00
common iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table 2023-11-16 19:35:41 +00:00
dac iio: dac: driver for MCP4821 2023-12-21 17:04:42 +00:00
dummy
filter drivers: iio: filter: admv8818: add bypass mode 2023-08-08 09:51:06 +01:00
frequency iio: frequency: admv1014: Switch to device_property_match_property_string() 2023-11-16 19:10:26 +00:00
gyro iio: gyro: hid-sensor-gyro-3d: Convert to platform remove callback returning void 2023-09-23 15:06:55 +01:00
health iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
humidity iio: humidity: hdc3020: fix temperature offset 2024-01-27 14:40:07 +00:00
imu iio: imu: inv_mpu6050: fix frequency setting when chip is off 2024-02-25 11:42:12 +00:00
light iio: hid-sensor-als: Return 0 for HID_USAGE_SENSOR_TIME_TIMESTAMP 2024-02-04 14:02:16 +00:00
magnetometer iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC 2024-01-22 18:59:06 +00:00
multiplexer iio: multiplexer: Switch to use dev_err_probe() helper 2022-11-23 19:43:57 +00:00
orientation iio: orientation: hid-sensor-rotation: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
position iio: position: hid-sensor-custom-intel-hinge: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
potentiometer iio: potentiometer: ad5110: Use i2c_get_match_data() 2023-09-12 10:42:03 +01:00
potentiostat iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
pressure iio: pressure: mprls0025pa fix off-by-one enum 2024-03-26 18:17:28 -04:00
proximity iio: proximity: irsd200: Drop unused include 2023-12-04 13:24:42 +00:00
resolver iio: resolver: ad2s1210: add reset gpio support 2023-11-16 19:10:25 +00:00
temperature iio: temperature: mlx90635 MLX90635 IR Temperature sensor 2023-12-11 19:16:34 +00:00
test
trigger iio: trigger: stm32-timer: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
Kconfig iio: light: Add gain-time-scale helpers 2023-04-10 12:26:34 +01:00
Makefile iio: light: Add gain-time-scale helpers 2023-04-10 12:26:34 +01:00
TODO iio: core: move 'mlock' to 'struct iio_dev_opaque' 2022-11-23 19:44:00 +00:00
iio_core.h iio: Remove unused declarations 2023-09-12 10:42:03 +01:00
iio_core_trigger.h
industrialio-buffer.c iio: buffer: Use IIO_SEPARATE instead of a hard-coded 0 2023-12-21 10:48:29 +00:00
industrialio-configfs.c
industrialio-core.c iio: core: fix memleak in iio_device_register_sysfs 2024-01-22 18:59:06 +00:00
industrialio-event.c iio: event: add optional event label support 2023-10-11 15:54:41 +01:00
industrialio-gts-helper.c iio: gts-helper: Fix division loop 2024-03-26 18:17:29 -04:00
industrialio-sw-device.c
industrialio-sw-trigger.c iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails 2022-11-12 17:53:35 +00:00
industrialio-trigger.c iio: Make return value check for set_trigger_state() consistent 2023-07-20 19:21:30 +01:00
industrialio-triggered-event.c
inkern.c iio: inkern: Add a helper to query an available minimum raw value 2023-07-09 22:48:17 +01:00