OSDN Git Service

iio: adc: add max1117/max1118/max1119 ADC driver
authorAkinobu Mita <akinobu.mita@gmail.com>
Tue, 28 Mar 2017 16:34:48 +0000 (01:34 +0900)
committerJonathan Cameron <jic23@kernel.org>
Fri, 14 Apr 2017 14:09:06 +0000 (15:09 +0100)
commita9e9c7153e96ee7f2777b3d5d99a23bf74dcaa21
tree035fb04e12cd4ea81883a7cbdf291f17e268613f
parentd97a913206379fe978a20a127ec76aaafbf65ef1
iio: adc: add max1117/max1118/max1119 ADC driver

This adds max1117/max1118/max1119 8-bit, dual-channel ADC driver.

This new driver uses the zero length spi_transfers with the cs_change
flag set and/or the non-zero delay_usecs.

1. The zero length transfer with the spi_transfer.cs_change set is
required in order to select CH1.  The chip select line must be brought
high and low again without transfer.

2. The zero length transfer with the spi_transfer.delay_usecs > 0 is
required for waiting the conversion to be complete.  The conversion
begins with the falling edge of the chip select.  During the conversion
process, SCLK is ignored.

These two usages are unusual.  But the spi controller drivers that use
a default implementation of transfer_one_message() are likely to work.
(I've tested this adc driver with spi-omap2-mcspi and spi-xilinx)

On the other hand, some spi controller drivers that have their own
transfer_one_message() may not work.  But at least for the zero length
transfer with delay_usecs > 0, I'm proposing a new testcase for the
spi-loopback-test that can test whether the delay_usecs setting has
taken effect.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/devicetree/bindings/iio/adc/max1118.txt [new file with mode: 0644]
drivers/iio/adc/Kconfig
drivers/iio/adc/Makefile
drivers/iio/adc/max1118.c [new file with mode: 0644]