linux-stable/drivers/iio/adc
Quentin Schulz f77c8c1603 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:28:22 +02:00
..
ab8500-gpadc.c iio: adc: Remove redundant dev_err_probe() 2023-07-29 12:13:17 +01:00
ad799x.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ad4130.c iio: adc: ad4130: only set GPIO_CTRL if pin is unused 2024-02-23 09:24:58 +01:00
ad7091r-base.c iio: adc: ad7091r: Enable internal vref if external vref is not supplied 2024-01-31 16:18:47 -08:00
ad7091r-base.h iio: adc: ad7091r: Enable internal vref if external vref is not supplied 2024-01-31 16:18:47 -08:00
ad7091r5.c iio: adc: ad7091r: Allow users to configure device events 2024-01-31 16:18:47 -08:00
ad7124.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
ad7192.c iio: adc: ad7192: Correct reference voltage 2023-10-05 18:06:46 +01:00
ad7266.c
ad7280a.c
ad7291.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ad7292.c iio: adc: ad7292: Add explicit include for of.h 2023-04-06 20:36:26 +02:00
ad7298.c
ad7476.c iio: adc: ad7476: simplify using devm_regulator_get_enable() 2022-11-23 19:44:00 +00:00
ad7606.c iio: Rename iio_trigger_poll_chained and add kernel-doc 2023-03-11 12:18:29 +00:00
ad7606.h iio: adc: ad7606: simplify using devm_regulator_get_enable() 2022-11-23 19:44:00 +00:00
ad7606_par.c iio: use devm_platform_get_and_ioremap_resource() 2022-11-23 20:41:23 +00:00
ad7606_spi.c
ad7766.c
ad7768-1.c iio: adc: ad7768-1: Benefit from devm_clk_get_enabled() to simplify 2022-08-15 22:30:02 +01:00
ad7780.c
ad7791.c iio: adc: ad7791: fix IRQ flags 2023-02-18 17:06:09 +00:00
ad7793.c
ad7887.c
ad7923.c iio: adc: ad7923: support extended range 2022-09-21 18:42:55 +01:00
ad7949.c iio: adc: ad7949: Fix error message 2022-07-16 18:50:24 +01:00
ad9467.c iio: adc: ad9467: fix scale setting 2024-01-25 15:35:52 -08:00
ad_sigma_delta.c iio: adc: ad_sigma_delta: Fix IRQ issue by setting IRQ_DISABLE_UNLAZY flag 2023-05-20 16:34:52 +01:00
adi-axi-adc.c iio: adc: ad9467: fix scale setting 2024-01-25 15:35:52 -08:00
aspeed_adc.c iio: adc: aspeed: Remove the trim valid dts property. 2022-11-14 20:20:08 +00:00
at91-sama5d2_adc.c Char/Misc drivers for 6.4-rc1 2023-04-27 12:07:50 -07:00
at91_adc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
axp20x_adc.c iio: adc: axp20x_adc: Replace adc_en2 flag with adc_en2_mask field 2023-03-11 12:18:28 +00:00
axp288_adc.c iio: adc: axp288_adc: do not use internal iio_dev lock 2022-11-23 19:43:57 +00:00
bcm_iproc_adc.c iio: adc: fix the return value handle for platform_get_irq() 2023-07-29 16:23:45 +01:00
berlin2-adc.c iio: adc: berlin2-adc: Add missing of_node_put() in error path 2022-12-28 17:20:03 +00:00
cc10001_adc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
cpcap-adc.c
da9150-gpadc.c
dln2-adc.c
envelope-detector.c
ep93xx_adc.c iio: adc: ep93xx: Add OF support 2022-12-30 18:05:16 +00:00
exynos_adc.c iio: exynos-adc: request second interupt only when touchscreen mode is used 2023-10-14 17:47:20 +01:00
fsl-imx25-gcq.c
hi8435.c
hx711.c
imx7d_adc.c iio: adc: Remove redundant dev_err_probe() 2023-07-29 12:13:17 +01:00
imx8qxp-adc.c iio: adc: imx8qxp: Fix address for command buffer registers 2023-10-05 18:06:45 +01:00
imx93_adc.c iio: adc: imx93: add four channels for imx93 adc 2024-01-01 12:42:37 +00:00
ina2xx-adc.c Merge 6.5-rc6 into char-misc-next 2023-08-13 22:14:51 +02:00
ingenic-adc.c iio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify 2022-08-15 22:30:02 +01:00
intel_mrfld_adc.c iio: adc: intel_mrfld_adc: explicitly add proper header files 2022-06-15 22:07:09 +01:00
Kconfig iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC 2023-07-20 19:21:29 +01:00
lp8788_adc.c
lpc18xx_adc.c iio: adc: lpc18xx: Benefit from devm_clk_get_enabled() to simplify 2022-08-15 22:30:02 +01:00
lpc32xx_adc.c iio: adc: fix the return value handle for platform_get_irq() 2023-07-29 16:23:45 +01:00
ltc2471.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ltc2485.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ltc2496.c drivers: iio: adc: ltc2497: Rename the LTC2499 iio device 2022-09-21 18:42:54 +01:00
ltc2497-core.c iio: adc: ltc2947-core: do not use internal iio_dev lock 2022-11-23 19:43:58 +00:00
ltc2497.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ltc2497.h iio: adc: ltc2947-core: do not use internal iio_dev lock 2022-11-23 19:43:58 +00:00
Makefile iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC 2023-07-20 19:21:29 +01:00
max1027.c iio: adc: max1027: unlock on error path in max1027_read_single_value() 2022-07-19 09:30:05 +01:00
max1118.c
max1241.c iio: adc: max1241: simplify using devm_regulator_get_enable() 2022-11-23 19:44:01 +00:00
max1363.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
max9611.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
max11100.c
max11205.c iio: adc: add max11205 adc driver 2022-09-05 18:08:34 +01:00
max11410.c 1st set of IIO new device support, features and cleanups for the 6.4 cycle. 2023-04-12 09:45:34 +02:00
max77541-adc.c iio: adc: max77541: Add ADI MAX77541 ADC Support 2023-06-28 15:18:11 +01:00
mcp320x.c
mcp3422.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
mcp3911.c iio: adc: mcp3911: add support to set PGA 2022-11-23 19:43:57 +00:00
men_z188_adc.c iio: adc: men_z188_adc: Remove redundant initialization owner in men_z188_driver 2023-08-05 17:43:17 +01:00
meson_saradc.c iio: adc: meson: add separate config for axg SoC family 2024-01-01 12:42:36 +00:00
mp2629_adc.c iio: adc: mp2629: fix potential array out of bound access 2022-11-01 08:48:02 +00:00
mt6360-adc.c iio: adc: mt6360: Drop an incorrect __maybe_unused marking. 2022-08-15 22:30:02 +01:00
mt6370-adc.c iio: adc: mt6370: Fix ibus and ibat scaling value of some specific vendor ID chips 2023-05-13 17:54:56 +01:00
mt6577_auxadc.c iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() 2022-07-18 18:48:17 +01:00
mxs-lradc-adc.c iio: adc: mxs-lradc: fix the order of two cleanup operations 2023-05-13 17:54:57 +01:00
nau7802.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
npcm_adc.c iio: adc: fix the return value handle for platform_get_irq() 2023-07-29 16:23:45 +01:00
palmas_gpadc.c iio: adc: Remove redundant dev_err_probe() 2023-07-29 12:13:17 +01:00
qcom-pm8xxx-xoadc.c iio: adc: qcom-pm8xxx-xoadc: Remove useless condition in pm8xxx_xoadc_parse_channel() 2023-03-18 15:44:30 +00:00
qcom-spmi-adc5.c iio: adc: qcom-spmi-adc5: Add ADC5_GPIO2_100K_PU 2023-07-20 19:21:30 +01:00
qcom-spmi-iadc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
qcom-spmi-rradc.c iio: adc: qcom-spmi-rradc: Fix spelling mistake "coherrency" -> "coherency" 2022-07-01 11:19:08 +01:00
qcom-spmi-vadc.c iio: adc: qcom-spmi-vadc: Propagate fw node label to userspace 2023-05-13 18:28:10 +01:00
qcom-vadc-common.c
rcar-gyroadc.c iio: adc: rcar-gyroadc: mark OF related data as maybe unused 2023-03-11 12:22:36 +00:00
rn5t618-adc.c
rockchip_saradc.c iio: adc: rockchip_saradc: use mask for write_enable bitfield 2024-04-03 15:28:22 +02:00
rtq6056.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
rzg2l_adc.c IIO new device support, features and minor fixes for 5.20 2022-07-14 15:04:49 +02:00
sc27xx_adc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
sd_adc_modulator.c
spear_adc.c iio: adc: fix the return value handle for platform_get_irq() 2023-07-29 16:23:45 +01:00
stm32-adc-core.c iio: adc: stm32-adc: harden against NULL pointer deref in stm32_adc_probe() 2023-11-28 17:19:45 +00:00
stm32-adc-core.h iio: adc: stm32-adc: smart calibration support 2022-11-23 20:56:13 +00:00
stm32-adc.c 1st set of IIO new device support, features and cleanup for the 6.5 cycle. 2023-06-15 13:01:55 +02:00
stm32-dfsdm-adc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
stm32-dfsdm-core.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
stm32-dfsdm.h iio: adc: stm32-dfsdm: add id registers support 2023-01-08 13:11:03 +00:00
stmpe-adc.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
sun4i-gpadc-iio.c iio: adc: Explicitly include correct DT includes 2023-07-23 13:38:13 +01:00
sun20i-gpadc-iio.c iio: adc: Add Allwinner D1/T113s/R329/T507 SoCs GPADC 2023-07-20 19:21:29 +01:00
ti-adc081c.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ti-adc084s021.c iio: adc: ti-adc084s021: Fix alignment for DMA safety 2022-06-14 11:53:14 +01:00
ti-adc108s102.c iio: adc: ti-adc108s102: Fix alignment for DMA safety 2022-06-14 11:53:14 +01:00
ti-adc128s052.c iio: adc: ti-adc128s052: Sort headers 2023-01-08 12:12:10 +00:00
ti-adc161s626.c iio: adc: ti-adc161s626: Fix alignment for DMA safety 2022-06-14 11:53:14 +01:00
ti-adc0832.c iio: adc: ti-adc0832: Fix alignment for DMA safety 2022-06-14 11:53:14 +01:00
ti-adc12138.c iio: adc: ti-adc12138: Fix alignment for DMA safety 2022-06-14 11:53:14 +01:00
ti-ads124s08.c iio: adc: ti-ads124s08: Drop unused parameter to ads124s_read() 2022-07-18 18:43:42 +01:00
ti-ads131e08.c iio: adc: ti-ads131e08: Silence no spi_device_id warnings 2022-11-23 19:43:57 +00:00
ti-ads1015.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ti-ads1100.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ti-ads7924.c iio: Switch i2c drivers back to use .probe() 2023-05-21 18:54:53 +01:00
ti-ads7950.c iio: adc: ti-ads7950: Set can_sleep flag for GPIO chip 2023-03-18 16:39:35 +00:00
ti-ads8344.c iio: adc: ti-ads8344: Fix alignment for DMA safety 2022-06-14 11:53:15 +01:00
ti-ads8688.c iio: adc: ti-ads8688: Fix alignment for DMA safety 2022-06-14 11:53:15 +01:00
ti-lmp92064.c iio: adc: ti-lmp92064: add buffering support 2023-07-20 19:21:30 +01:00
ti-tlc4541.c iio: adc: ti-tlc4541: Fix alignment for DMA safety 2022-06-14 11:53:15 +01:00
ti-tsc2046.c iio: adc: tsc2046: silent spi_device_id warning 2022-09-04 14:55:03 +01:00
ti_am335x_adc.c iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma() 2024-01-01 12:42:37 +00:00
twl4030-madc.c iio: adc: twl4030-madc: add missing of.h include 2022-10-24 05:57:16 -07:00
twl6030-gpadc.c iio:adc:twl6030: Enable measurement of VAC 2022-12-28 17:20:04 +00:00
vf610_adc.c iio: adc: vf610_adc: vf610_adc: do not use internal iio_dev lock 2022-11-23 19:43:58 +00:00
viperboard_adc.c
xilinx-ams.c iio: adc: Use devm_krealloc_array 2023-05-30 21:07:15 +01:00
xilinx-xadc-core.c iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale 2023-10-13 19:10:39 +01:00
xilinx-xadc-events.c
xilinx-xadc.h iio: adc: xilinx-xadc: Correct temperature offset/scale for UltraScale 2023-10-13 19:10:39 +01:00