summaryrefslogtreecommitdiffstats
path: root/drivers/iio
AgeCommit message (Collapse)AuthorFilesLines
2019-04-22iio: adc: Add driver for the TI ADS8344 A/DC chipsGregory CLEMENT3-0/+215
This adds support for the Texas Instruments ADS8344 ADC chip. This chip has a 16-bit 8-Channel ADC and is access directly through SPI. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: fxas21002c: add spi driverRui Miguel Silva3-1/+77
Add driver to talk over spi to a fxas21002c gyroscope device and use the core as main controller. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: fxas21002c: add i2c driverRui Miguel Silva3-0/+76
Add the real driver to talk over i2c and use the fxas21002c core for the main tasks. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-22iio: gyro: add core driver for fxas21002cRui Miguel Silva4-0/+1166
Add core support for the NXP fxas21002c Tri-axis gyroscope, using the iio subsystem. It supports PM operations, axis reading, temperature, scale factor of the axis, high pass and low pass filtering, and sampling frequency selection. It will have extras modules to support the communication over i2c and spi. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-21Merge 5.1-rc6 into staging-nextGreg Kroah-Hartman15-95/+178
We want the fixes in here as well as this resolves an iio driver merge issue. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-19Make anon_inodes unconditionalDavid Howells1-1/+0
Make the anon_inodes facility unconditional so that it can be used by core VFS code and pidfd code. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> [christian@brauner.io: adapt commit message to mention pidfds] Signed-off-by: Christian Brauner <christian@brauner.io>
2019-04-18Merge 'ib-jz47xx-battery-prereq' into psy-nextSebastian Reichel1-5/+17
Merge immutable branch containing the IIO changes required for the new Ingenic JZ47xx battery fuel gauge driver. Signed-off-by: Sebastian Reichel <sre@kernel.org>
2019-04-14Kconfig: change configuration of srf04 ultrasonic iio sensorAndreas Klinger1-2/+9
reword configuration option for SRF04 list supported types in help text Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14srf04.c: add maxbotix ultrasonic sensorsAndreas Klinger1-9/+29
add Maxbotix LV ultrasonic sensor types mb1000, mb1010, mb1020, mb1030 and mb1040 add a configuration struct with the different trigger pulse lengths Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: adc: ti-ads7950: Fix build error without CONFIG_GPIOLIBYueHaibing1-1/+1
When building with CONFIG_GPIOLIB is not set gcc warns this: drivers/iio/adc/ti-ads7950.c:75:19: error: field chip has incomplete type struct gpio_chip chip; ^~~~ drivers/iio/adc/ti-ads7950.c: In function ti_ads7950_set: drivers/iio/adc/ti-ads7950.c:409:32: error: implicit declaration of function gpiochip_get_data; did you mean acpi_get_data? [-Werror=implicit-function-declaration] struct ti_ads7950_state *st = gpiochip_get_data(chip); ^~~~~~~~~~~~~~~~~ acpi_get_data Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Reviewed-by: Justin Chen <justinpopo6@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: temperature: max31856: fix uninitialized error returnColin Ian King1-0/+3
Currently if mask is neither CHAN_INFO_RAW or CHAN_INFO_SCALE then then an uninitialized error return 'ret' is returned. Fix this by adding a default case that ensures -EINVAL is returned for this specific case. Addresses-Coverity: ("Uninitialized scalar variable") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: imu: st_lsm6dsx: remove set but not used variables 'acc_sensor' and ↵YueHaibing1-4/+0
'gyro_sensor' Fixes gcc '-Wunused-but-set-variable' warning: drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c: In function 'st_lsm6dsx_read_tagged_fifo': drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:520:41: warning: variable 'gyro_sensor' set but not used [-Wunused-but-set-variable] drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:520:28: warning: variable 'acc_sensor' set but not used [-Wunused-but-set-variable] They are not used since commit 14c7c6e1a860 ("iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: accel: add support to LIS2DE12Robert Jones4-1/+84
Add support to STMicroelectronics LIS2DE12 accelerometer in st_accel framework. http://www.st.com/resource/en/datasheet/lis2de12.pdf Signed-off-by: Robert Jones <rjones@gateworks.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: accel: kxcjk1013: Add KIOX0008 ACPI Hardware-IDValentin Manea1-0/+1
Add the ACPI ID for KXCJ9 sensor seen on the a Teclast X80 Power tablet. Signed-off-by: Valentin Manea <linux-iio@mrs.ro> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: imx7d_adc: Use devm_platform_ioremap_resource()Andrey Smirnov1-3/+1
Use devm_platform_ioremap_resource() to be able to drop a bit of explicit boilerplate code. Signed-off-by: Andrey Smirnov <andrew.smirnov@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: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: imx7d_adc: Replace pr_err with dev_errAndrey Smirnov1-2/+3
Replace combination of pr_err()/dev_name() with an equivalent call for dev_err(). Signed-off-by: Andrey Smirnov <andrew.smirnov@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: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: imx7d_adc: Add local struct device pointer in imx7d_adc_probe()Andrey Smirnov1-19/+18
Use a local "struct device *dev" in imx7d_adc_probe() for brevity. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@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: Chris Healy <cphealy@gmail.com> Cc: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: adc: ad7616: Add support for AD7616 ADCBeniamin Bia3-3/+54
The AD7616 is a 12-bit ADC with 16 channels. The AD7616 can be configured to work in hardware mode by controlling it via gpio pins and read data via spi. No support for software mode yet, but it is a work in progress. This device requires a reset in order to update oversampling, so chip info has got a new attribute to mark this. The current assumption that this driver makes for AD7616, is that it's working in Hardware Mode with Serial, Burst and Sequencer modes activated. To activate them, following pins must be pulled high: -SER/PAR -SEQEN And following must be pulled low: -WR/BURST -DB4/SEQEN Datasheets: Link: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7616.pdf Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: adc: ad7606: Move oversampling options in chip info and rework *_avail ↵Stefan Popa2-23/+67
attributes Available oversampling ratios and scales can be shown by calling a common ad7606_show_avail function which takes as parameters the array which stores the values, together with the size of the array. Oversampling options are now defined in chip info structure and they are loaded at probe. Has_Oversampling attribute was removed because oversampling_num was added and it is not needed anymore. The purpose of this patch is to deal with the scale_avail and oversampling_avail arrays in a generic way. This makes it easier to add support for new devices which will work with different scales and oversampling ratios. It is also an intermediate step for adding support for ad7616 which has different oversampling sampling ratios available. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: adc: Fix MAX9611 spacingFabrizio Castro1-1/+1
Between "config" and "MAX9611" there is a tab, replace it with a space. Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: imu: mpu6050: Fix FIFO layout for ICM20602Steve Moskovchenko3-5/+64
The MPU6050 driver has recently gained support for the ICM20602 IMU, which is very similar to MPU6xxx. However, the ICM20602's FIFO data specifically includes temperature readings, which were not present on MPU6xxx parts. As a result, the driver will under-read the ICM20602's FIFO register, causing the same (partial) sample to be returned for all reads, until the FIFO overflows. Fix this by adding a table of scan elements specifically for the ICM20602, which takes the extra temperature data into consideration. While we're at it, fix the temperature offset and scaling on ICM20602, since it uses different scale/offset constants than the rest of the MPU6xxx devices. Signed-off-by: Steve Moskovchenko <stevemo@skydio.com> Fixes: 22904bdff978 ("iio: imu: mpu6050: Add support for the ICM 20602 IMU") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: inkern: Convert iio_read_avail_channel_raw into a wrapperArtur Rojek1-10/+2
Convert "iio_read_avail_channel_raw" over to a wrapper around "iio_read_avail_channel_attribute". With the introduction of "iio_read_avail_channel_attribute", the necessity of having a separate call to read raw channel values became redundant. Signed-off-by: Artur Rojek <contact@artur-rojek.eu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14iio: inkern: API for reading available iio channel attribute valuesArtur Rojek1-0/+20
Extend the inkern API with a function for reading available attribute values of iio channels. Signed-off-by: Artur Rojek <contact@artur-rojek.eu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-07iio: adc: ads124: avoid buffer overflowVincent Stehlé1-1/+1
When initializing the priv->data array starting from index 1, there is one less element to consider than when initializing the full array. Fixes: e717f8c6dfec8f76 ("iio: adc: Add the TI ads124s08 ADC code") Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Reviewed-by: Dan Murphy <dmurphy@ti.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-07iio: imu: st_lsm6dsx: add support to LSM6DSRLorenzo Bianconi6-6/+83
Add support to STM LSM6DSR 6-axis (acc + gyro) Mems sensor https://www.st.com/resource/en/datasheet/lsm6dsr.pdf Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-07iio: adc: modify NPCM ADC read reference voltageTomer Maimon1-1/+1
Checking if regulator is valid before reading NPCM ADC regulator voltage to avoid system crash in a case the regulator is not valid. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertionLars-Peter Clausen1-5/+11
For devices from the SigmaDelta family we need to keep CS low when doing a conversion, since the device will use the MISO line as a interrupt to indicate that the conversion is complete. This is why the driver locks the SPI bus and when the SPI bus is locked keeps as long as a conversion is going on. The current implementation gets one small detail wrong though. CS is only de-asserted after the SPI bus is unlocked. This means it is possible for a different SPI device on the same bus to send a message which would be wrongfully be addressed to the SigmaDelta device as well. Make sure that the last SPI transfer that is done while holding the SPI bus lock de-asserts the CS signal. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <Alexandru.Ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: add PM supportFabrice Gasnier2-32/+206
Add PM and runtime PM support to STM32 DFSDM drivers: - stm32-dfsdm-core: manage clocks. - stm32-dfsdm-adc: restore channels configuration upon resume. Also stop restart everything in case of buffer mode. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: improve sampling frequency accuracyFabrice Gasnier1-26/+30
The sample frequency is driven using the oversampling ratio depending on the SPI bus frequency. Currently, oversampling ratio is computed by an entire division: - spi_freq / sample_freq. This may result in inaccurate value. Using DIV_ROUND_CLOSEST improves resulting sample frequency, which is useful for audio that requests fixed rates (such as: 8, 16 or 32 kHz). BTW, introduce new routine to re-factor sample frequency setting, and move frequency accuracy message from warning to debug level. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio:temperature: Add MAX31856 thermocouple supportParesh Chaudhary3-0/+364
This patch adds support for Maxim MAX31856 thermocouple temperature sensor support. More information can be found in: https://www.maximintegrated.com/en/ds/MAX31856.pdf NOTE: Driver support only Comparator Mode. Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com> Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com> Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: frequency: ad9523: Fix typo in ad9523_platform_dataLars-Peter Clausen1-8/+8
Replace diff_{m1,m2} with div_{m1,m2} since they are dividers and not a differential settings. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: gyro: bmg160: add device tree compatibility tableH. Nikolaus Schaller1-0/+9
Add of_match_table. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensorAngus Ainslie (Purism)1-8/+43
The VCNL4040 is almost identical to the VCNL4200 as far as register layout goes but just need to check a different ID register location. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: light: vcnl4000 add devicetree hooksAngus Ainslie (Purism)1-0/+22
Add an of_match table for devicetree probing. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: light: vcnl4000 use word writes instead of byte writesAngus Ainslie (Purism)1-2/+2
The VCNL4200 datasheet says that word read and writes should be used to access the registers. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Tested-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: claim direct mode for raw read and settingsFabrice Gasnier1-1/+16
Claim direct mode to ensure no buffer mode is in use for: - single conversion - sample rate setting (must be set when filter isn't enabled). - oversampling ratio (must be set when filter isn't enabled). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: add support for buffer modesFabrice Gasnier1-24/+194
DFSDM conversions can be launched continuously, or using various triggers: - by software - hardware triggers (e.g. like in stm32-adc: TIM, LPTIM, EXTI) - synchronously with DFSDM filter 0. e.g. for filters 1, 2 Launching conversions can be done using two methods: a - injected: - scan mode can be used to convert several channels each time a trigger occurs. - When not is scan mode, channels are converted in sequence, one upon each trigger. b - regular: - supports software triggers or synchronous with filter 0 - single or continuous conversions This patch finalizes DFSDM operating modes using IIO buffer modes: - INDIO_BUFFER_SOFTWARE: regular continuous conversions (no trigger) but limited to 1 channel. Users must set sampling frequency in this case. For filters > 1, conversions can be started synchronously with filter 0. - INDIO_BUFFER_TRIGGERED: triggered conversions uses injected mode for launching conversions. DFSDM can use hardware triggers (e.g. STM32 timer or lptimer), so add INDIO_HARDWARE_TRIGGERED to supported modes. - INDIO_DIRECT_MODE: Only support DMA-based buffer modes. In case no DMA is available, only support single conversions. From userland perspective, to summarize various use cases: 1 - single conversion on any filter: $ cd iio:deviceX $ cat in_voltageY_raw This uses regular a conversion (not continuous) 2 - Using sampling frequency without trigger (single channel, buffer) $ cd iio:deviceX $ echo 100 > sampling_frequency $ echo "" > trigger/current_trigger $ echo 1 > scan_elements/in_voltageY_en $ echo 1 > buffer/enable This uses regular conversion in continuous mode (Frequency is achieved by tuning filter parameters) 3 - sync mode with filter 0: other filters can be converted when using "st,filter0-sync" dt property. The conversions will get started at the same time as filter 0. So for any filters > 1: $ cd iio:deviceX $ echo 100 > sampling_frequency $ echo "" > trigger/current_trigger $ echo 1 > scan_elements/in_voltageY_en $ echo 1 > buffer/enable Then start filter 0 as in 2 above. 4 - Using a hardware trigger (with one channel): - check trigger, configure it: $ cat /sys/bus/iio/devices/trigger1/name tim6_trgo $ echo 100 > /sys/bus/iio/devices/trigger1/sampling_frequency - go to any filter: $ echo 1 > scan_elements/in_voltageY_en $ echo tim6_trgo > trigger/current_trigger $ echo 1 > buffer/enable This uses injected conversion as it uses a hardware trigger (without scan) 5 - Using a hardware trigger (with 2+ channel): Same as in 4/ above, but enable two or more channels in scan_elements. This uses injected conversion as it uses a hardware trigger (with scan mode) Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: add support for scan modeFabrice Gasnier1-40/+142
In order to support multiple channels in buffer mode, add support for scan mode. This is precursor patch to ease support of triggered buffer mode. Currently, only audio uses buffer mode: Regular continuous conversions with a single channel (per filter). DFSDM hardware supports scan mode (only) with injected conversions. Conversions can be launched by software (JSWSTART), trigger or synchronously with filter 0 (e.g. JSYNC). Continuous conversion mode isn't available for injected. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: enable hw consumerFabrice Gasnier1-1/+13
Optionally enable IIO hw consumer, when provided (e.g. for DFSDM_IIO type). This is precursor patch to introduce buffer modes. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: move dma slave config to start routineFabrice Gasnier1-20/+11
Move DMA slave configuration to start routine: depending on regular or injected mode is in use, DMA needs to read resp. RDATAR or JDATAR. This is precursor patch to introduce injected mode (used for scan). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: move dma enable from start_conv() to start_dma()Fabrice Gasnier1-39/+38
Move DMA enable (e.g. set RDMAEN bit) away from start_conv() that is used for both buffer and single conversions. Thus, single conv rely on interrupt, not dma. Note: take care to prepare all DMA stuff and set RDMAEN before starting filter (can be set only when DFEN=0). This is precursor patch to ease support of triggered buffer mode. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: continuous mode depends on current modeFabrice Gasnier1-27/+27
DFSDM regular continuous mode usage depends on current mode (not DMA): - for single conversion, RCONT doesn't need to be set. - for buffer mode, RCONT has to be set (e.g. INDIO_BUFFER_SOFTWARE used by audio currently). This is related to filter configuration, move it to relevant routine. This is precursor patch to ease support of triggered buffer mode. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stm32-dfsdm: make spi_master_freq more accurateFabrice Gasnier1-5/+12
Current ckout divider may be set to a value that makes ckout to exceed spi-max-frequency. Rather use lower value (e.g. round up divider when ckout isn't accurate). Also when the SPI clock isn't accurate, 'spi_master_freq' is filled in with expected frequency. Use computed value instead to be more accurate: - e.g. source clock / (CKOUTDIV + 1) Enforce checks on the divider: ckoutdiv range can be from 1-255 to provide divider of 2-256. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: ad7780: Add parentheses to macrosVladimir Petrigo1-2/+2
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues Slightly modified by Jonathan to take into account the staging graduation and a copy and paste version of the same item on the following line. Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: move adis16400.h into adis16400.cAlexandru Ardelean2-198/+175
Final part of the re-organization. Move the `adis16400.h` into `adis16400.c` since it no longer needs to be shared among other files. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: rename adis16400_core.c -> adi16400.cAlexandru Ardelean2-1/+0
This change does a simple 1-to-1 rename of the adis16400_core.c file. Now that the `adis16400_buffer.c` file was removed, everything can be moved into a single driver file. But first, this rename. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: move burst logic to ADIS libAlexandru Ardelean5-77/+41
This change has been done separately, so that it's easier to visualize the changed logic in the adis_scan_update() function. Most of the function in this `adis16400_update_scan_mode()` that deals with burst-mode will be re-used in the ADIS16480, but with different parameters. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis: generalize burst mode supportAlexandru Ardelean2-4/+11
Some variants in the ADIS16400 family support burst mode. This mechanism is implemented in the `adis16400_buffer.c` file. Some variants in ADIS16480 are also adding burst mode, which is functionally similar to ADIS16400, but with different parameters. To get there, a `adis_burst` struct is added to parametrize certain bits of the SPI communication to setup: the register that triggers burst-mode, and the extra-data-length that needs be accounted for when building the bust-length buffer. The trigger handler cannot be made generic, since it's very specific to each ADIS164XX family. A future enhancement of this `adis_burst` mode will be the possibility to enable/disable burst-mode. For the ADIS16400 family it's hard-coded to on by default. But for ADIS16480 there will be a need to disable this. When that will be implemented, both ADIS16400 & ADIS16480 will have the burst-mode enable-able/disable-able. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: move trigger handler into adis16400_coreAlexandru Ardelean3-43/+46
The trigger handler for the ADIS16400 is very different from the generic one in the ADIS library. Keeping it in a separate file won't make much sense once the update_scan_mode function will be made more generic and moved into the ADIS library. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04mb1232.c: add distance iio sensor with i2cAndreas Klinger3-0/+285
Add I2CXL-MaxSonar ultrasonic distance sensors of types mb1202, mb1212, mb1222, mb1232, mb1242, mb7040, mb7137 using an i2c interface Implemented functionality: - reading the distance via in_distance_raw - buffered mode with trigger - make use of interrupt to announce completion of ranging Add mb1232 driver to Kconfig and Makefile Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>