iio: adc: imx8qxp: Fix address for command buffer registers
Subsystems (3)
PATCH 1/1 iio: adc: imx8qxp: Fix address for command buffer registers
The ADC Command Buffer Register high and low are currently pointing to the wrong address and makes it impossible to perform correct ADC measurements over all channels.
According to the datasheet of the imx8qxp the ADC_CMDL register starts at address 0x100 and the ADC_CMDH register starts at address 0x104.
This bug seems to be in the kernel since the introduction of this driver.
This can be observed by checking all raw voltages of the adc and they are all nearly identical:
cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 3498
3494
3491
3491
3489
3490
3490
3490
--- drivers/iio/adc/imx8qxp-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/imx8qxp-adc.c +2 -2
@@ -38,8 +38,8 @@#define IMX8QXP_ADR_ADC_FCTRL 0x30#define IMX8QXP_ADR_ADC_SWTRIG 0x34#define IMX8QXP_ADR_ADC_TCTRL (tid) (0xc0 + (tid) * 4) -#define IMX8QXP_ADR_ADC_CMDH (cid) (0x100 + (cid) * 8) -#define IMX8QXP_ADR_ADC_CMDL (cid) (0x104 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDL (cid) (0x100 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDH (cid) (0x104 + (cid) * 8)#define IMX8QXP_ADR_ADC_RESFIFO 0x300#define IMX8QXP_ADR_ADC_TST 0xffc
Signature · 1 line
2.39.2
Quoted 24 lines
-----Original Message-----
From: Philipp Rossak <[email protected]>
Sent: 2023年9月5日 6:02
To: Cai Huoqing <[email protected]>; Bough Chen <[email protected]>; Jonathan Cameron <[email protected]>; Lars-Peter Clausen <[email protected]>; Shawn Guo <[email protected]>; Sascha Hauer <[email protected]>; Pengutronix Kernel Team <[email protected]>; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Philipp Rossak <[email protected]>
Subject: [PATCH] iio: adc: imx8qxp: Fix address for command buffer registersThe ADC Command Buffer Register high and low are currently pointing to the wrong address and makes it impossible to perform correct ADC measurements over all channels.
According to the datasheet of the imx8qxp the
ADC_CMDLregister starts at address0x100and theADC_CMDHregister starts at address0x104.This bug seems to be in the kernel since the introduction of this driver.
This can be observed by checking all raw voltages of the adc and they are all nearly identical:
Quoted 9 lines
cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 3498
3494
3491
3491
3489
3490
3490
3490
Oh, really thanks for this catch.
Best Regards
Haibo Chen
Quoted 25 lines
Fixes 1e23dcaa1a9fa ("iio: imx8qxp-adc: Add driver support for NXP IMX8QXPADC")
Signed-off-by Philipp Rossak <[email protected]>--- drivers/iio/adc/imx8qxp-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/adc/imx8qxp-adc.c index renamed from drivers/iio/adc/imx8qxp-adc.c +0
-0
f5a0fc9e64c5..fff6e5a2d956100644drivers/iio/adc/imx8qxp-adc.c +2
-3@@ -38,8 +38,8 @@#define IMX8QXP_ADR_ADC_FCTRL 0x30#define IMX8QXP_ADR_ADC_SWTRIG 0x34#define IMX8QXP_ADR_ADC_TCTRL (tid) (0xc0 + (tid) * 4) -#define IMX8QXP_ADR_ADC_CMDH (cid) (0x100 + (cid) * 8) -#define IMX8QXP_ADR_ADC_CMDL (cid) (0x104 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDL (cid) (0x100 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDH (cid) (0x104 + (cid) * 8)#define IMX8QXP_ADR_ADC_RESFIFO 0x300#define IMX8QXP_ADR_ADC_TST 0xffc --
Quoted 1 line
2.39.2
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel