Skip to contentSkip to conversation

IIO: ADC: New driver for the AD7298 8-channel SPI ADC

PATCH New [email protected] 1 participant 1 message Feb 24, 2011

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 IIO: ADC: New driver for the AD7298 8-channel SPI ADC

From: Michael Hennerich <[email protected]>

This patch adds support for the
AD7298: 8-Channel, 1MSPS, 12-Bit SAR ADC with Temperature Sensor via SPI bus.

This patch replaces the existing ad7298.c driver completely. It was necessary since, the old driver did not comply with the IIO ABI for such devices.

Changes since V1:
IIO: ADC: New driver for the AD7298 8-channel SPI ADC

Add documentation for new sysfs file tempX_input.
Simplify bit defines.
Remove outdated comments.
Fix indention style.
ad7298_show_temp():
Add locking.
Simplify temperature calculation.
Change temperature result from degrees into milli degrees Celsius. Rename file according to new sysfs ABI documentation

Add timestamp attributes.
Revise timestamp handling accordingly.
Preset timestamp generation.

---
 drivers/staging/iio/Documentation/sysfs-bus-iio |    6 +
 drivers/staging/iio/adc/Kconfig                 |    7 +-
 drivers/staging/iio/adc/Makefile                |    5 +-
 drivers/staging/iio/adc/ad7298.c                |  501 -----------------------
 drivers/staging/iio/adc/ad7298.h                |   80 ++++
 drivers/staging/iio/adc/ad7298_core.c           |  287 +++++++++++++
 drivers/staging/iio/adc/ad7298_ring.c           |  258 ++++++++++++
 7 files changed, 640 insertions(+), 504 deletions(-)
 delete mode 100644 drivers/staging/iio/adc/ad7298.c
 create mode 100644 drivers/staging/iio/adc/ad7298.h
 create mode 100644 drivers/staging/iio/adc/ad7298_core.c
 create mode 100644 drivers/staging/iio/adc/ad7298_ring.c
drivers/staging/iio/Documentation/sysfs-bus-iio +6 -0
index 8e5d8d1..73cc529 100644
@@ -86,6 +86,12 @@ Description:
 		sensor is associated with one part of a compound device (e.g.
 		a gyroscope axis).
 
+What:		/sys/bus/iio/devices/deviceX/tempX_input
+KernelVersion:	2.6.38
+Contact:	[email protected]
+Description:
+		Scaled temperature measurement in milli degrees Celsius.
+
 What:		/sys/bus/iio/devices/deviceX/accel_x_raw
 What:		/sys/bus/iio/devices/deviceX/accel_y_raw
 What:		/sys/bus/iio/devices/deviceX/accel_z_raw
drivers/staging/iio/adc/Kconfig +5 -2
index 86869cd..34daf58 100644
@@ -49,11 +49,14 @@ config AD7291
 	  temperature sensors.
 
 config AD7298
-	tristate "Analog Devices AD7298 temperature sensor and ADC driver"
+	tristate "Analog Devices AD7298 ADC driver"
 	depends on SPI
 	help
 	  Say yes here to build support for Analog Devices AD7298
-	  temperature sensors and ADC.
+	  8 Channel ADC with temperature sensor.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ad7298.
 
 config AD7314
 	tristate "Analog Devices AD7314 temperature sensor driver"
drivers/staging/iio/adc/Makefile +4 -1
index 6f231a2..662e56f 100644
@@ -19,10 +19,13 @@ ad7887-y := ad7887_core.o
 ad7887-$(CONFIG_IIO_RING_BUFFER) += ad7887_ring.o
 obj-$(CONFIG_AD7887) += ad7887.o
 
+ad7298-y := ad7298_core.o
+ad7298-$(CONFIG_IIO_RING_BUFFER) += ad7298_ring.o
+obj-$(CONFIG_AD7298) += ad7298.o
+
 obj-$(CONFIG_AD7150) += ad7150.o
 obj-$(CONFIG_AD7152) += ad7152.o
 obj-$(CONFIG_AD7291) += ad7291.o
-obj-$(CONFIG_AD7298) += ad7298.o
 obj-$(CONFIG_AD7314) += ad7314.o
 obj-$(CONFIG_AD7745) += ad7745.o
 obj-$(CONFIG_AD7816) += ad7816.o
drivers/staging/iio/adc/ad7298.c deleted +0 -501

501 lines not on this page · raw message

drivers/staging/iio/adc/ad7298.h new file +80 -0

80 lines not on this page · raw message

drivers/staging/iio/adc/ad7298_core.c new file +287 -0

287 lines not on this page · raw message

drivers/staging/iio/adc/ad7298_ring.c new file +258 -0

258 lines not on this page · raw message

--
1.6.0.2