Skip to contentSkip to conversation

imx93: add ADC support

PATCH Superseded Luca Ellero 3 participants 8 messages Feb 23, 2023 – Feb 24, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover imx93: add ADC support

Add ADC support for NXP iMX93

Changes for v2:
- add "static" to functions
- enable ADC in iMX93 EVK

Luca Ellero (2):
dm: adc: add iMX93 ADC support
imx93_evk: enable ADC

 arch/arm/dts/imx93-11x11-evk.dts  |   4 +
 configs/imx93_11x11_evk_defconfig |   1 +
 drivers/adc/Kconfig               |   8 +
 drivers/adc/Makefile              |   1 +
 drivers/adc/imx93-adc.c           | 284 ++++++++++++++++++++++++++++++
 5 files changed, 298 insertions(+)
 create mode 100644 drivers/adc/imx93-adc.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/2 dm: adc: add iMX93 ADC support

This commit adds driver for iMX93 ADC.

The driver is implemented using driver model and provides ADC uclass's methods for ADC single channel operations:
- adc_start_channel()
- adc_channel_data()
- adc_stop()

ADC features:
- channels: 4
- resolution: 12-bit

---
 drivers/adc/Kconfig     |   8 ++
 drivers/adc/Makefile    |   1 +
 drivers/adc/imx93-adc.c | 284 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/adc/imx93-adc.c
drivers/adc/Kconfig +8 -0
index e719c38bb3..4336732dee 100644
@@ -63,3 +63,11 @@ config STM32_ADC
 	  - core driver to deal with common resources
 	  - child driver to deal with individual ADC resources (declare ADC
 	  device and associated channels, start/stop conversions)
+
+config ADC_IMX93
+	bool "Enable NXP IMX93 ADC driver"
+	help
+	  This enables basic driver for NXP IMX93 ADC.
+	  It provides:
+	  - 4 analog input channels
+	  - 12-bit resolution
drivers/adc/Makefile +1 -0
index c1387f3a34..5336c82097 100644
@@ -10,3 +10,4 @@ obj-$(CONFIG_ADC_SANDBOX) += sandbox.o
 obj-$(CONFIG_SARADC_ROCKCHIP) += rockchip-saradc.o
 obj-$(CONFIG_SARADC_MESON) += meson-saradc.o
 obj-$(CONFIG_STM32_ADC) += stm32-adc.o stm32-adc-core.o
+obj-$(CONFIG_ADC_IMX93) += imx93-adc.o
drivers/adc/imx93-adc.c new file +284 -0

284 lines not on this page · raw message

Signature · 1 line
2.25.1
reviewer Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH 1/2] dm: adc: add iMX93 ADC support

Quoted 9 lines · Luca Ellero

This commit adds driver for iMX93 ADC.

The driver is implemented using driver model and provides ADC uclass's methods for ADC single channel operations:
- adc_start_channel()
- adc_channel_data()
- adc_stop()

Quoted 5 lines

ADC features:
- channels: 4
- resolution: 12-bit

#3 lore raw

PATCH v2 2/2 imx93_evk: enable ADC

In reply to Luca Ellero
---
 arch/arm/dts/imx93-11x11-evk.dts  | 4 ++++
 configs/imx93_11x11_evk_defconfig | 1 +
 2 files changed, 5 insertions(+)
arch/arm/dts/imx93-11x11-evk.dts +4 -0
index b3a5a3d71e..f7ffe7b3d2 100644
@@ -525,3 +525,7 @@
 &wdog3 {
 	status = "okay";
 };
+
+&adc1 {
+	status = "okay";
+};
configs/imx93_11x11_evk_defconfig +1 -0
index 477fb25807..fa929dd4ec 100644
@@ -82,6 +82,7 @@ CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_REGMAP=y
 CONFIG_SYSCON=y
+CONFIG_ADC_IMX93=y
 CONFIG_IMX_RGPIO2P=y
 CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
Signature · 1 line
2.25.1
reviewer
#4 lore raw

Re: [PATCH 2/2] imx93_evk: enable ADC

Hi Luca,

On Thu, Feb 23, 2023 at 9:52 AM Luca Ellero <[email protected]> wrote:

Please write a commit log.

Quoted 11 lines
---
 arch/arm/dts/imx93-11x11-evk.dts  | 4 ++++
 configs/imx93_11x11_evk_defconfig | 1 +
 2 files changed, 5 insertions(+)
arch/arm/dts/imx93-11x11-evk.dts +0 -0
index b3a5a3d71e..f7ffe7b3d2 100644

arch/arm/dts/imx93-11x11-evk.dts line 531

Quoted 7 lines
arch/arm/dts/imx93-11x11-evk.dts +4 -0
@@ -525,3 +525,7 @@
 &wdog3 {
        status = "okay";
 };
+
+&adc1 {
+       status = "okay";
+};

The nodes should be kept in alphabetical order.

Actually, it would be better if you could sync imx93-11x11-evk.dts with linux-next, which already contains the adc1 node:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts?h=next-20230223#n37

We want to keep U-Boot and Linux devicetree in sync as much as possible.

Thanks

#5 lore raw

Re: [PATCH 2/2] imx93_evk: enable ADC

Quoted 27 lines · Fabio Estevam

Hi Luca,

On Thu, Feb 23, 2023 at 9:52 AM Luca Ellero <[email protected]> wrote:

Please write a commit log.

Quoted 11 lines
---
  arch/arm/dts/imx93-11x11-evk.dts  | 4 ++++
  configs/imx93_11x11_evk_defconfig | 1 +
  2 files changed, 5 insertions(+)
arch/arm/dts/imx93-11x11-evk.dts +0 -0
index b3a5a3d71e..f7ffe7b3d2 100644

arch/arm/dts/imx93-11x11-evk.dts line 531

Quoted 7 lines
arch/arm/dts/imx93-11x11-evk.dts +4 -0
@@ -525,3 +525,7 @@
  &wdog3 {
         status = "okay";
  };
+
+&adc1 {
+       status = "okay";
+};

The nodes should be kept in alphabetical order.

Quoted 8 lines

Actually, it would be better if you could sync imx93-11x11-evk.dts with linux-next, which already contains the adc1 node:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts?h=next-20230223#n37

We want to keep U-Boot and Linux devicetree in sync as much as possible.

Thanks

Hi Fabio,
thank you for your reply.
Ok, I will add a comment to the patch and fix DT node. Should I resend only this patch or both? Regards

Signature · 4 lines
Luca Ellero

E-mail: [email protected]
Internet: www.brickedbrain.com
reviewer
#6 lore raw

Re: [PATCH 2/2] imx93_evk: enable ADC

Hi Luca,

Quoted 4 lines · Luca Ellero

Hi Fabio,
thank you for your reply.
Ok, I will add a comment to the patch and fix DT node. Should I resend only this patch or both?

Please resend the whole series.

My suggestion:

1/3 - ADC driver
2/3 - Sync U-Boot imx93 evk dts with the one from linux-next 20230224 3/3 - Enable the ADC driver in the imx93 evk defconfig

#7 lore raw

Re: [PATCH 2/2] imx93_evk: enable ADC

Quoted 10 lines · Fabio Estevam

Hi Luca,

Quoted 4 lines · Luca Ellero

Hi Fabio,
thank you for your reply.
Ok, I will add a comment to the patch and fix DT node. Should I resend only this patch or both?

Quoted 7 lines

Please resend the whole series.

My suggestion:

1/3 - ADC driver
2/3 - Sync U-Boot imx93 evk dts with the one from linux-next 20230224 3/3 - Enable the ADC driver in the imx93 evk defconfig

Hi Fabio,
ok, thanks for your suggestions.
Regards

Signature · 4 lines
Luca Ellero

E-mail: [email protected]
Internet: www.brickedbrain.com