Skip to contentSkip to conversation

staging:iio:adc: Add SPEAr ADC driver

PATCH New Stefan Roese 1 participant 1 message Apr 12, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 staging:iio:adc: Add SPEAr ADC driver

This patch implements the basic single data conversion support for the SPEAr600 SoC ADC. The register layout of SPEAr600 differs a bit from other SPEAr SoC variants (e.g. SPEAr3xx). These differences are handled via DT compatible testing. Resulting in a multi-arch binary.

This driver is currently tested only on SPEAr600. Future patches may add support for other SoC variants (SPEAr3xx) and features like software buffer or DMA.

---
v3:
- Used devm_request_irq() instead of request_irq and removed free_irq()
- Added clk_disable() and clk_unprepare() in error path and spear_adc_remove()

v2:
- Minor spelling fixes pointed out by Jonathan
- Renamed scale_uv to scale_mv
- Used defines for constants (CLK_MIN, CLK_MAX)
- Used of_iomap() instead of ioremap() and platform_get_resource()
- Added clk_prepare()
- Added error checking to clk_enable()

 .../bindings/staging/iio/adc/spear-adc.txt         |   26 ++
 drivers/staging/iio/adc/Kconfig                    |    7 +
 drivers/staging/iio/adc/Makefile                   |    1 +
 drivers/staging/iio/adc/spear_adc.c                |  447 ++++++++++++++++++++
 4 files changed, 481 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/staging/iio/adc/spear-adc.txt
 create mode 100644 drivers/staging/iio/adc/spear_adc.c
Documentation/devicetree/bindings/staging/iio/adc/spear-adc.txt new file +26 -0
new file mode 100644
index 0000000..02ea23a
@@ -0,0 +1,26 @@
+* ST SPEAr ADC device driver
+
+Required properties:
+- compatible: Should be "st,spear600-adc"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the ADC interrupt
+- sampling-frequency: Default sampling frequency
+
+Optional properties:
+- vref-external: External voltage reference in milli-volts. If omitted
+  the internal voltage reference will be used.
+- average-samples: Number of samples to generate an average value. If
+  omitted, single data conversion will be used.
+
+Examples:
+
+	adc: adc@d8200000 {
+		compatible = "st,spear600-adc";
+		reg = <0xd8200000 0x1000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <6>;
+		sampling-frequency = <5000000>;
+		vref-external = <2500>;	/* 2.5V VRef */
+	};
drivers/staging/iio/adc/Kconfig +7 -0
index 592eabd..ec006e7 100644
@@ -202,4 +202,11 @@ config LPC32XX_ADC
 	  touchscreen driver, so you can only select one of the two drivers
 	  (lpc32xx_adc or lpc32xx_ts). Provides direct access via sysfs.
 
+config SPEAR_ADC
+	tristate "ST SPEAr ADC"
+	depends on PLAT_SPEAR
+	help
+	  Say yes here to build support for the integrated ADC inside the
+	  ST SPEAr SoC. Provides direct access via sysfs.
+
 endmenu
drivers/staging/iio/adc/Makefile +1 -0
index f83ab95..14e98b6 100644
@@ -38,3 +38,4 @@ obj-$(CONFIG_ADT7310) += adt7310.o
 obj-$(CONFIG_ADT7410) += adt7410.o
 obj-$(CONFIG_AD7280) += ad7280a.o
 obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o
+obj-$(CONFIG_SPEAR_ADC) += spear_adc.o
drivers/staging/iio/adc/spear_adc.c new file +447 -0

447 lines not on this page · raw message

Signature · 1 line
1.7.10