Skip to contentSkip to conversation

iio: stx104: Add IIO support for the ADC channels

PATCH Superseded William Breathitt Gray 1 participant 2 messages Jul 25, 2016 IIO

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover iio: stx104: Add IIO support for the ADC channels

Changes in v3:
- Squash move patch as unneeded thanks to "git format-patch -M"
- Fix multiline comment syntax for value conversion math explanation
- Select between two const iio_chan_spec structures in order to support differential input channels configuration correctly for multiple devices
Changes in v2:
- IIO_CHAN_INFO_RAW mask used for analog input channels
- STX104_ prefix added to IN_CHAN_OFFSET define
- STX104_MAX_NUM_CHAN define removed as unnecessary
- Whitespace added to pad comment about ADC sample capture and completion wait
- Switch statement in write_raw callback refactored to return 0
- Comma added to last element initialization of stx104_info
- Comment added to warn why stx104_channels is not const
- Comment added to explain GPIO offset in gpio_get_direction callback
- ARRAY_SIZE macro utilized to get number of channels in stx104_channels
- Replace devm_iio_device_register with iio_device_register call and respective iio_device_unregister call
- Perform GPIO chip registration before iio_device_register to prevent race condition

The first patch of version 2 of this patchset ("iio: stx104: Unregister IIO device on remove callback") has been removed from this patchset since it was picked up in the iio.git fixes-togreg-post-rc1 branch.

The move patch of version 2 of this patchset has been squashed with the ADC support implementation code since the "git format-patch -M" command has been used to clarify the rename of the stx104.c file from the dac directory to the adc directory.

William Breathitt Gray (1):
iio: stx104: Add IIO support for the ADC channels

 MAINTAINERS                       |   2 +-
 drivers/iio/adc/Kconfig           |  15 ++++
 drivers/iio/adc/Makefile          |   1 +
 drivers/iio/{dac => adc}/stx104.c | 157 ++++++++++++++++++++++++++++++++------
 drivers/iio/dac/Kconfig           |  10 ---
 drivers/iio/dac/Makefile          |   1 -
 6 files changed, 150 insertions(+), 36 deletions(-)
 rename drivers/iio/{dac => adc}/stx104.c (59%)
Signature · 1 line
2.7.3
#1 lore raw

PATCH v3 1/1 iio: stx104: Add IIO support for the ADC channels

The Apex Embedded Systems STX104 features 16 channels of single-ended (8 channels of true differential) 16-bit analog input. Differential input configuration may be selected via a physical jumper on the device. Similarly, input polarity (unipolar/bipolar) is configured via a physical jumper on the device.

Input gain selection is available to the user via software, thus allowing eight possible input ranges: +-10V, +-5V, +-2.5V, +-1.25V, 0 to 10V, 0 to 5V, 0 to 2.5V, and 0 to 1.25V. Four input gain configurations are supported: x1, x2, x4, and x8.

This ADC resolution is 16-bits (1/65536 of full scale). Analog input samples are taken on software trigger; neither FIFO sampling nor interrupt triggering is supported by this driver.

The Apex Embedded Systems STX104 is primarily an analog-to-digital converter device. The STX104 IIO driver was initially placed in the DAC directory because only the DAC portion of the STX104 was supported at the time. Now that ADC support has been added to the STX104 IIO driver, the driver should be moved to the more appropriate ADC directory.

---
 MAINTAINERS                       |   2 +-
 drivers/iio/adc/Kconfig           |  15 ++++
 drivers/iio/adc/Makefile          |   1 +
 drivers/iio/{dac => adc}/stx104.c | 157 ++++++++++++++++++++++++++++++++------
 drivers/iio/dac/Kconfig           |  10 ---
 drivers/iio/dac/Makefile          |   1 -
 6 files changed, 150 insertions(+), 36 deletions(-)
 rename drivers/iio/{dac => adc}/stx104.c (59%)
MAINTAINERS +1 -1
index b5c802d..ddd0a0b9 100644
@@ -796,7 +796,7 @@ APEX EMBEDDED SYSTEMS STX104 DAC DRIVER
 M:	William Breathitt Gray <[email protected]>
 L:	[email protected]
 S:	Maintained
-F:	drivers/iio/dac/stx104.c
+F:	drivers/iio/adc/stx104.c
 
 APM DRIVER
 M:	Jiri Kosina <[email protected]>
drivers/iio/adc/Kconfig +15 -0
index 1de31bd..ec9ada8 100644
@@ -396,6 +396,21 @@ config ROCKCHIP_SARADC
 	  To compile this driver as a module, choose M here: the
 	  module will be called rockchip_saradc.
 
+config STX104
+	tristate "Apex Embedded Systems STX104 driver"
+	depends on X86 && ISA_BUS_API
+	select GPIOLIB
+	help
+	  Say yes here to build support for the Apex Embedded Systems STX104
+	  integrated analog PC/104 card.
+
+	  This driver supports the 16 channels of single-ended (8 channels of
+	  differential) analog inputs, 2 channels of analog output, 4 digital
+	  inputs, and 4 digital outputs provided by the STX104.
+
+	  The base port addresses for the devices may be configured via the base
+	  array module parameter.
+
 config TI_ADC081C
 	tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
 	depends on I2C
drivers/iio/adc/Makefile +1 -0
index 0ba0d50..d7b4a71 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o
 obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o
 obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
 obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
+obj-$(CONFIG_STX104) += stx104.o
 obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
 obj-$(CONFIG_TI_ADC0832) += ti-adc0832.o
 obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o
drivers/iio/adc/stx104.c renamed from drivers/iio/dac/stx104.c +133 -24

222 lines not on this page · raw message

drivers/iio/dac/Kconfig +0 -10
index b9f0442..6048aed 100644
@@ -254,16 +254,6 @@ config MCP4922
 	  To compile this driver as a module, choose M here: the module
 	  will be called mcp4922.
 
-config STX104
-	tristate "Apex Embedded Systems STX104 DAC driver"
-	depends on X86 && ISA_BUS_API
-	select GPIOLIB
-	help
-	  Say yes here to build support for the 2-channel DAC and GPIO on the
-	  Apex Embedded Systems STX104 integrated analog PC/104 card. The base
-	  port addresses for the devices may be configured via the base array
-	  module parameter.
-
 config VF610_DAC
 	tristate "Vybrid vf610 DAC driver"
 	depends on OF
drivers/iio/dac/Makefile +0 -1
index b1a1206..e6abef9 100644
@@ -27,5 +27,4 @@ obj-$(CONFIG_MAX517) += max517.o
 obj-$(CONFIG_MAX5821) += max5821.o
 obj-$(CONFIG_MCP4725) += mcp4725.o
 obj-$(CONFIG_MCP4922) += mcp4922.o
-obj-$(CONFIG_STX104) += stx104.o
 obj-$(CONFIG_VF610_DAC) += vf610_dac.o
Signature · 1 line
2.7.3