add imx93 adc support
Subsystems (4)
[email protected]
maintainerv6 cover add imx93 adc support
From: Haibo Chen <[email protected]>
V6:
-Change the Copyright to 2023
-Power down the ADC if imx93_adc_calibration() if meet issue. -Add new error label in probe (error_adc_power_down)
-Add back the pm_runtime_get_sync(dev) in imx93_adc_remove().
Though in imx93_adc_remove(), already in pm runtime resume due to the useage of autosuspend logic. But call this pm_runtime_get_sync(dev) will make the code logic more clear and will make the runtime pm counter balance after pm_runtime_put_noidle(dev).
V5:
-For ADC driver, use dev_err_probe() to replace dev_err() in dev_err_probe(). -Add imx93_adc_power_down() in the probe error path.
-Re-order the function in imx93_adc_remove(), make them inverse in probe(). -Remove the pm_runtime_get_sync(dev) in imx93_adc_remove(), because this driver
enable the pm_runtime autosuspend feature, and config the delay as 50ms. So when called imx93_adc_remove(), this device still in runtime resume state, no need to force resume the device back.
-no changes for binding doc and dts.
V4:
For ADC driver, re-define the ADC status show the relation to specific register bit. Redo the imx93_adc_remove(), change the return error sequence in imx93_adc_read_raw(), and use a direct string for indio_dev->name.
For dt-bings, change the commit title and add maintainer's reviewed by tag For dts, no change.
V3:
For dt-bings, add some change according to review comments, and pass dt_binding_check. For dts, add #io-channel-cells = <1>; to pass dtbs_check
For ADC driver, no change.
V2:
For ADC driver, add change according to matainer's commets.
Haibo Chen (3):
iio: adc: add imx93 adc support
dt-bindings: iio: adc: Add NXP IMX93 ADC
arm64: dts: imx93: add ADC support
.../bindings/iio/adc/nxp,imx93-adc.yaml | 81 +++ MAINTAINERS | 4 +- .../boot/dts/freescale/imx93-11x11-evk.dts | 12 + arch/arm64/boot/dts/freescale/imx93.dtsi | 13 + drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/imx93_adc.c | 484 ++++++++++++++++++ 7 files changed, 604 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml create mode 100644 drivers/iio/adc/imx93_adc.c
Signature · 1 line
2.34.1
[email protected]
maintainerPATCH v6 1/3 iio: adc: add imx93 adc support
From: Haibo Chen <[email protected]>
The ADC in i.mx93 is a total new ADC IP, add a driver to support this ADC.
Currently, only support one shot normal conversion triggered by software. For other mode, will add in future.
--- MAINTAINERS | 4 +- drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/imx93_adc.c | 484 ++++++++++++++++++++++++++++++++++++ 4 files changed, 498 insertions(+), 1 deletion(-) create mode 100644 drivers/iio/adc/imx93_adc.c
MAINTAINERS +3 -1
@@ -14870,14 +14870,16 @@ S: Maintained F: Documentation/devicetree/bindings/iio/adc/nxp,imx8qxp-adc.yaml F: drivers/iio/adc/imx8qxp-adc.c -NXP i.MX 7D/6SX/6UL AND VF610 ADC DRIVER +NXP i.MX 7D/6SX/6UL/93 AND VF610 ADC DRIVER M: Haibo Chen <[email protected]> L: [email protected] L: [email protected] S: Maintained F: Documentation/devicetree/bindings/iio/adc/fsl,imx7d-adc.yaml F: Documentation/devicetree/bindings/iio/adc/fsl,vf610-adc.yaml +F: Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml F: drivers/iio/adc/imx7d_adc.c +F: drivers/iio/adc/imx93_adc.c F: drivers/iio/adc/vf610_adc.c NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER
drivers/iio/adc/Kconfig +10 -0
@@ -566,6 +566,16 @@ config IMX8QXP_ADC This driver can also be built as a module. If so, the module will be called imx8qxp-adc. +config IMX93_ADC + tristate "IMX93 ADC driver" + depends on ARCH_MXC || COMPILE_TEST + depends on HAS_IOMEM + help + Say yes here to build support for IMX93 ADC. + + This driver can also be built as a module. If so, the module will be + called imx93_adc. + config LP8788_ADC tristate "LP8788 ADC driver" depends on MFD_LP8788
drivers/iio/adc/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_HI8435) += hi8435.o obj-$(CONFIG_HX711) += hx711.o obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o obj-$(CONFIG_IMX8QXP_ADC) += imx8qxp-adc.o +obj-$(CONFIG_IMX93_ADC) += imx93_adc.o obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o obj-$(CONFIG_INGENIC_ADC) += ingenic-adc.o obj-$(CONFIG_INTEL_MRFLD_ADC) += intel_mrfld_adc.o
drivers/iio/adc/imx93_adc.c new file +484 -0
484 lines not on this page · raw message
Signature · 1 line
2.34.1
Jonathan Cameron
maintainerRe: [PATCH v6 1/3] iio: adc: add imx93 adc support
Quoted 10 lines · On Tue, 17 Jan 2023 21:51:35 +0800 [email protected] wrote:
From: Haibo Chen <[email protected]>
The ADC in i.mx93 is a total new ADC IP, add a driver to support this ADC.
Currently, only support one shot normal conversion triggered by software. For other mode, will add in future.
Signed-off-by Haibo Chen <[email protected]>---
Applied to the togreg branch of iio.git and pushed out as testing. Thanks,
Jonathan
[email protected]
maintainerPATCH v6 2/3 dt-bindings: iio: adc: Add NXP IMX93 ADC
In reply to [email protected]From: Haibo Chen <[email protected]>
The IMX93 SoC has a new ADC IP, so add binding documentation for NXP IMX93 ADC.
--- .../bindings/iio/adc/nxp,imx93-adc.yaml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml
Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml new file +81 -0
@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/nxp,imx93-adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP iMX93 ADC + +maintainers: + - Haibo Chen <[email protected]> + +description: + The ADC on iMX93 is a 8-channel 12-bit 1MS/s ADC with 4 channels + connected to pins. it support normal and inject mode, include + One-Shot and Scan (continuous) conversions. Programmable DMA + enables for each channel Also this ADC contain alternate analog + watchdog thresholds, select threshold through input ports. And + also has Self-test logic and Software-initiated calibration. + +properties: + compatible: + const: nxp,imx93-adc + + reg: + maxItems: 1 + + interrupts: + items: + - description: WDGnL, watchdog threshold interrupt requests. + - description: WDGnH, watchdog threshold interrupt requests. + - description: normal conversion, include EOC (End of Conversion), + ECH (End of Chain), JEOC (End of Injected Conversion) and + JECH (End of injected Chain). + - description: Self-testing Interrupts. + + clocks: + maxItems: 1 + + clock-names: + const: ipg + + vref-supply: + description: + The reference voltage which used to establish channel scaling. + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - vref-supply + - "#io-channel-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/clock/imx93-clock.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + soc { + #address-cells = <1>; + #size-cells = <1>; + adc@44530000 { + compatible = "nxp,imx93-adc"; + reg = <0x44530000 0x10000>; + interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_ADC1_GATE>; + clock-names = "ipg"; + vref-supply = <®_vref_1v8>; + #io-channel-cells = <1>; + }; + }; +...
Signature · 1 line
2.34.1
Re: [PATCH v6 2/3] dt-bindings: iio: adc: Add NXP IMX93 ADC
Quoted 7 lines · On Tue, 17 Jan 2023 21:51:36 +0800 [email protected] wrote:
From: Haibo Chen <[email protected]>
The IMX93 SoC has a new ADC IP, so add binding documentation for NXP IMX93 ADC.
Reviewed-by Rob Herring <[email protected]>Signed-off-by Haibo Chen <[email protected]>
Applied,
Thanks,
Jonathan
Quoted 92 lines
--- .../bindings/iio/adc/nxp,imx93-adc.yaml | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yamlDocumentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml new file +81
-0@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/nxp,imx93-adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP iMX93 ADC + +maintainers: + - Haibo Chen <[email protected]> + +description: + The ADC on iMX93 is a 8-channel 12-bit 1MS/s ADC with 4 channels + connected to pins. it support normal and inject mode, include + One-Shot and Scan (continuous) conversions. Programmable DMA + enables for each channel Also this ADC contain alternate analog + watchdog thresholds, select threshold through input ports. And + also has Self-test logic and Software-initiated calibration. + +properties: + compatible: + const: nxp,imx93-adc + + reg: + maxItems: 1 + + interrupts: + items: + - description: WDGnL, watchdog threshold interrupt requests. + - description: WDGnH, watchdog threshold interrupt requests. + - description: normal conversion, include EOC (End of Conversion), + ECH (End of Chain), JEOC (End of Injected Conversion) and + JECH (End of injected Chain). + - description: Self-testing Interrupts. + + clocks: + maxItems: 1 + + clock-names: + const: ipg + + vref-supply: + description: + The reference voltage which used to establish channel scaling. + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - vref-supply + - "#io-channel-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/clock/imx93-clock.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + soc { + #address-cells = <1>; + #size-cells = <1>; + adc@44530000 { + compatible = "nxp,imx93-adc"; + reg = <0x44530000 0x10000>; + interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_ADC1_GATE>; + clock-names = "ipg"; + vref-supply = <®_vref_1v8>; + #io-channel-cells = <1>; + }; + }; +...
[email protected]
maintainerPATCH v6 3/3 arm64: dts: imx93: add ADC support
In reply to [email protected]From: Haibo Chen <[email protected]>
Add ADC support for imx93-11x11-evk board.
--- arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts | 12 ++++++++++++ arch/arm64/boot/dts/freescale/imx93.dtsi | 13 +++++++++++++ 2 files changed, 25 insertions(+)
arch/arm64/boot/dts/freescale/imx93-11x11-evk.dts +12 -0
@@ -15,6 +15,13 @@ chosen { stdout-path = &lpuart1; }; + reg_vref_1v8: regulator-adc-vref { + compatible = "regulator-fixed"; + regulator-name = "vref_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + reg_usdhc2_vmmc: regulator-usdhc2 { compatible = "regulator-fixed"; pinctrl-names = "default";
@@ -27,6 +34,11 @@ reg_usdhc2_vmmc: regulator-usdhc2 { }; }; +&adc1 { + vref-supply = <®_vref_1v8>; + status = "okay"; +}; + &mu1 { status = "okay"; };
arch/arm64/boot/dts/freescale/imx93.dtsi +13 -0
@@ -280,6 +280,19 @@ anatop: anatop@44480000 { compatible = "fsl,imx93-anatop", "syscon"; reg = <0x44480000 0x10000>; }; + + adc1: adc@44530000 { + compatible = "nxp,imx93-adc"; + reg = <0x44530000 0x10000>; + interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 219 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_ADC1_GATE>; + clock-names = "ipg"; + #io-channel-cells = <1>; + status = "disabled"; + }; }; aips2: bus@42000000 {
Signature · 1 line
2.34.1
Shawn Guo
AppliedRe: [PATCH v6 3/3] arm64: dts: imx93: add ADC support
Quoted 5 lines · On Tue, Jan 17, 2023 at 09:51:37PM +0800, [email protected] wrote:
From: Haibo Chen <[email protected]>
Add ADC support for imx93-11x11-evk board.
Signed-off-by Haibo Chen <[email protected]>
Applied, thanks!