linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio: adc: imx8qxp: Fix address for command buffer registers
@ 2023-09-04 22:02 Philipp Rossak
  2023-09-05  2:01 ` Bough Chen
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Rossak @ 2023-09-04 22:02 UTC (permalink / raw)
  To: Cai Huoqing, Haibo Chen, Jonathan Cameron, Lars-Peter Clausen,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team
  Cc: linux-iio, linux-arm-kernel, linux-kernel, Philipp Rossak

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

Fixes: 1e23dcaa1a9fa ("iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC")

Signed-off-by: Philipp Rossak <embed3d@gmail.com>
---
 drivers/iio/adc/imx8qxp-adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c
index f5a0fc9e64c5..fff6e5a2d956 100644
--- a/drivers/iio/adc/imx8qxp-adc.c
+++ b/drivers/iio/adc/imx8qxp-adc.c
@@ -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
 
-- 
2.39.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] iio: adc: imx8qxp: Fix address for command buffer registers
  2023-09-04 22:02 [PATCH] iio: adc: imx8qxp: Fix address for command buffer registers Philipp Rossak
@ 2023-09-05  2:01 ` Bough Chen
  0 siblings, 0 replies; 2+ messages in thread
From: Bough Chen @ 2023-09-05  2:01 UTC (permalink / raw)
  To: Philipp Rossak, Cai Huoqing, Jonathan Cameron, Lars-Peter Clausen,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	dl-linux-imx
  Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org

> -----Original Message-----
> From: Philipp Rossak <embed3d@gmail.com>
> Sent: 2023年9月5日 6:02
> To: Cai Huoqing <cai.huoqing@linux.dev>; Bough Chen <haibo.chen@nxp.com>;
> Jonathan Cameron <jic23@kernel.org>; Lars-Peter Clausen <lars@metafoo.de>;
> Shawn Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Pengutronix Kernel Team <kernel@pengutronix.de>; Fabio Estevam
> <festevam@gmail.com>; dl-linux-imx <linux-imx@nxp.com>
> Cc: linux-iio@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; Philipp Rossak <embed3d@gmail.com>
> Subject: [PATCH] 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

Oh, really thanks for this catch.

Acked-by: Haibo Chen <haibo.chen@nxp.com>

Best Regards
Haibo Chen
> 
> Fixes: 1e23dcaa1a9fa ("iio: imx8qxp-adc: Add driver support for NXP IMX8QXP
> ADC")
> 
> Signed-off-by: Philipp Rossak <embed3d@gmail.com>
> ---
>  drivers/iio/adc/imx8qxp-adc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c index
> f5a0fc9e64c5..fff6e5a2d956 100644
> --- a/drivers/iio/adc/imx8qxp-adc.c
> +++ b/drivers/iio/adc/imx8qxp-adc.c
> @@ -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
> 
> --
> 2.39.2

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-05  2:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 22:02 [PATCH] iio: adc: imx8qxp: Fix address for command buffer registers Philipp Rossak
2023-09-05  2:01 ` Bough Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).