Skip to contentSkip to conversation

imx93: add ADC support

PATCH Superseded Luca Ellero 2 participants 5 messages Feb 27, 2023 – Mar 1, 2023

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover imx93: add ADC support

Add ADC support for NXP iMX93

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

Changes for v3:
- split in 3 commits
- keep dts file in sync with Linux devicetree
- add comments to commits

Luca Ellero (3):
dm: adc: add iMX93 ADC support
imx93_evk: add adc node to dts file
imx93_evk: defconfig: add adc support

 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 v3 1/3 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
#2 lore raw

PATCH v3 2/3 imx93_evk: add adc node to dts file

In reply to Luca Ellero

This node uses imx93_adc driver under drivers/adc.

The node is added keeping dts file in sync with iMX9 evk Linux devicetree.

---
 arch/arm/dts/imx93-11x11-evk.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/imx93-11x11-evk.dts +4 -0
index b3a5a3d71e..91f99cebae 100644
@@ -58,6 +58,10 @@
 
 };
 
+&adc1 {
+	status = "okay";
+};
+
 &lpi2c1 {
 	#address-cells = <1>;
 	#size-cells = <0>;
Signature · 1 line
2.25.1
#3 lore raw

PATCH v3 3/3 imx93_evk: defconfig: add adc support

In reply to Luca Ellero

iMX93 ADC features:
- 4 channels
- 12 bit resolution

---
 configs/imx93_11x11_evk_defconfig | 1 +
 1 file changed, 1 insertion(+)
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
#4 lore raw
In reply to Luca Ellero

+ Haibo

Quoted 24 lines · Luca Ellero

Add ADC support for NXP iMX93

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

Changes for v3:
- split in 3 commits
- keep dts file in sync with Linux devicetree
- add comments to commits

Luca Ellero (3):
dm: adc: add iMX93 ADC support
imx93_evk: add adc node to dts file
imx93_evk: defconfig: add adc support

  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