OpenCloudOS-Kernel/drivers/iio
Lukas Wunner c1375d671a iio: adc: mcp320x: Add support for mcp3550/1/3
These ADCs are marketed as single-channel 22 bit delta-sigma ADCs, but
in reality their resolution is 21 bit with an overrange or underrange
of 12% beyond Vref.  In other words, "full scale" means +/- 2^20.

This driver does not explicitly signal back to the user when an
overrange or underrange occurs, but the user can detect it by comparing
the raw value to +/- 2^20 (or the scaled value to Vref).

The chips feature an extended temperature range and high accuracy,
low noise characteristics, but their conversion times are slow with
up to 80 ms +/- 2% (on the MCP3550-50).

Hence, unlike the other ADCs supported by the driver, conversion does
not take place in realtime upon lowering CS.  Instead, CS is asserted
for 8 usec to start the conversion.  After waiting for the duration of
the conversion, the result can be fetched.  While waiting, control of
the bus is ceased so it may be used by a different device.

After the result has been fetched and 10 us have passed, the chip goes
into shutdown and an additional power-up delay of 144 clock periods is
then required to wake the analog circuitry upon the next conversion
(footnote below table 4-1, page 16 in the spec).

Optionally, the chips can be used in so-called "continuous conversion
mode":  Conversions then take place continuously and the last result may
be fetched at any time without observing a delay.  The mode is enabled
by permanently driving CS low, e.g. by wiring it to ground.  The driver
only supports "single conversion mode" for now but should be adaptable
to "continuous conversion mode" with moderate effort.

The chips clock out a 3 byte word, unlike the other ADCs supported by
the driver which all have a lower resolution than 16 bit and thus make
do with 2 bytes.  Calculate the word length on probe by rounding up the
resolution to full bytes.  Crucially, if the clock idles low, the
transfer is preceded by a useless Data Ready bit which increases its
length from 24 bit to 25 bit = 4 bytes (section 5.5 in the spec).
Autosense this based on the SPI slave's configuration.

Cc: Mathias Duckeck <m.duckeck@kunbus.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 21:01:36 +01:00
..
accel iio: accel: kxcjk1013: add support for KXTF9 2017-10-09 20:50:06 +01:00
adc iio: adc: mcp320x: Add support for mcp3550/1/3 2017-10-09 21:01:36 +01:00
amplifiers iio:amplifiers:ad8366 drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:24:50 +01:00
buffer iio: buffer-dmaengine: Add missing header buffer_impl.h 2017-06-13 20:56:05 +01:00
chemical iio: chemical: ccs811: Add support for data ready trigger 2017-09-24 12:34:36 +01:00
common Merge 4.14-rc4 into staging-next 2017-10-09 09:02:35 +02:00
counter iio:stm32-lp-timer and ep93xx: drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-09-26 09:38:57 +02:00
dac iio: dac: ds4422/ds4424 dac driver 2017-10-09 20:49:39 +01:00
dummy iio: dummy: evgen: use irq_sim 2017-10-09 20:50:34 +01:00
frequency iio:frequency: drop assign iio_info.driver_module 2017-08-22 21:28:20 +01:00
gyro iio:gyro: drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:28:56 +01:00
health iio:health: drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:29:44 +01:00
humidity iio:humidity: drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:30:20 +01:00
imu iio: imu: st_lsm6dsx: add FIFO ops data structure 2017-10-09 20:51:01 +01:00
light iio: light: vl6180: Correct ALS scale for non-default gain/integration time 2017-10-09 20:50:21 +01:00
magnetometer Merge 4.14-rc4 into staging-next 2017-10-09 09:02:35 +02:00
multiplexer iio: multiplexer: add NULL check on devm_kzalloc() and devm_kmemdup() return values 2017-09-03 18:10:29 +01:00
orientation iio:orientation: drop assign iio_info.driver_module 2017-08-22 21:33:36 +01:00
potentiometer iio:potentiometer:max5487: Drop explicit setting of module owner 2017-09-03 18:10:27 +01:00
potentiostat iio:potentiostat:lmp91000 drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 21:34:48 +01:00
pressure Merge 4.14-rc4 into staging-next 2017-10-09 09:02:35 +02:00
proximity iio:proximity: drop assign iio_info.driver_module and iio_trigger_ops.owner 2017-08-22 22:14:51 +01:00
temperature iio:temperature: drop assignment of iio_info.driver_module 2017-08-22 22:14:52 +01:00
trigger Merge 4.14-rc4 into staging-next 2017-10-09 09:02:35 +02:00
Kconfig iio: multiplexer: new iio category and iio-mux driver 2017-06-03 19:29:26 +09:00
Makefile iio: multiplexer: new iio category and iio-mux driver 2017-06-03 19:29:26 +09:00
iio_core.h iio:core: timestamping clock selection support 2016-06-30 19:41:38 +01:00
iio_core_trigger.h
industrialio-buffer.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00
industrialio-configfs.c iio:configfs: Introduce iio/configfs.h to provide a location for the configfs_subsystem 2015-12-05 16:25:30 +00:00
industrialio-core.c Merge 4.14-rc4 into staging-next 2017-10-09 09:02:35 +02:00
industrialio-event.c iio: iio_push_event(): Don't crash if the event interface is not registered 2016-09-10 16:40:44 +01:00
industrialio-sw-device.c iio: Add support for creating IIO devices via configfs 2016-05-04 11:43:54 +01:00
industrialio-sw-trigger.c iio: core: fix ptr_ret.cocci warnings 2016-01-20 17:09:18 -08:00
industrialio-trigger.c iio:trigger: Remove necessity to have a trig->ops structure. 2017-08-22 21:20:28 +01:00
industrialio-triggered-event.c iio: Support triggered events 2015-08-27 20:47:09 +01:00
inkern.c First round of IIO new device support, features and cleanups for the 4.14 cycle. 2017-07-27 21:29:49 -07:00