aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-07-23Merge tag 'iio-fixes-for-4.13a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman9-14/+133
Jonathan writes: First set of IIO fixes for the 4.13 cycle. * ad2s1210 - Fix negative angular velocity reads (identified by a gcc 7 warning) * aspeed-adc - Wait for initialization sequence to finish before enabling channels. Without it no channels work. * axp288 - Revert a patch that dropped some bogus register mods. No one is entirely sure why but it breaks charging on some devices. - Fix GPADC pin read returning 0. Turns out a small sleep is needed. * bmc150 - Make sure device is restored to normal state after suspend / resume cycle. Otherwise, simple sysfs reads are broken. * tsl2563 - fix wrong event code. * st-accel - add spi 3-wire support. Needed to fix the lsm303agr accelerometer which only had 3 wires in all cases. Side effect is to enable optional 3-wire support for other devices. * st-pressure - disable multiread by default for LPS22HB (only effects SPI) * sun4i-gpadc-iio - fix unbalanced irq enable / disable * vf610 - Fix VALT slection for REFSEL bits - ensures we are using the right reference pins.
2017-07-23iio: aspeed-adc: wait for initial sequence.Mykola Kostenok1-0/+26
This patch enables adc engine at initialization time and waits for the initial sequence completion before enabling adc channels. Without this code adc channels are not functional and shows zeros for all connected channels. Tested on mellanox msn platform. v1 -> v2: Pointed by Rick Altherr: - Wait init sequence code enabled by bool from OF match table. Signed-off-by: Mykola Kostenok <c_mykolak@mellanox.com> Reviewed-by: Rick Altherr <raltherr@google.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-17iio: accel: bmc150: Always restore device to normal mode after suspend-resumeHans de Goede1-8/+1
After probe we would put the device in normal mode, after a runtime suspend-resume we would put it back in normal mode. But for a regular suspend-resume we would only put it back in normal mode if triggers or events have been requested. This is not consistent and breaks reading raw values after a suspend-resume. This commit changes the regular resume path to also unconditionally put the device back in normal mode, fixing reading of raw values not working after a regular suspend-resume cycle. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-09iio: adc: axp288: Fix the GPADC pin reading often wrongly returning 0Hans de Goede1-1/+11
I noticed in its DSDT that one of my tablets actually is using the GPADC pin for temperature monitoring. The whole axp288_adc_set_ts() function is a bit weird, in the past it was removed because it seems to make no sense, then this was reverted because of regressions. So I decided to test the special GPADC pin handling on this tablet. Conclusion: not only is axp288_adc_set_ts() necessary, we need to sleep a bit after making the AXP288_ADC_TS_PIN_CTRL changes before sampling the GPADC, otherwise it will often (about 80% of the time) read 0 instead of its actual value. It seems that there is only 1 bias current source and to be able to use it for the GPIO0 pin in GPADC mode it must be temporarily turned off for the TS pin, but the datasheet does not mention this. This commit adds a sleep after disabling the TS pin bias current, fixing the GPADC more often then not wrongly returning 0. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-06iio: adc: vf610_adc: Fix VALT selection value for REFSEL bitsStefan-Gabriel Mirea1-1/+1
In order to select the alternate voltage reference pair (VALTH/VALTL), the right value for the REFSEL field in the ADCx_CFG register is "01", leading to 0x800 as register mask. See section 8.2.6.4 in the reference manual[1]. [1] http://www.nxp.com/docs/en/reference-manual/VFXXXRM.pdf Fixes: a775427632fd ("iio:adc:imx: add Freescale Vybrid vf610 adc driver") Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-06iio: accel: st_accel: add SPI-3wire supportLorenzo Bianconi2-0/+61
Add SPI Serial Interface Mode (SIM) register information in st_sensor_settings look up table to support devices (like LSM303AGR accel sensor) that allow just SPI-3wire communication mode. SIM mode has to be configured before any other operation since it is not enabled by default and the driver is not able to read without that configuration Whilst a fairly substantial patch, the actual logic is simple and it is better to have the generic fix than a band aid. Fixes: ddc05fa28606 (iio: st-accel: add support for lsm303agr accel) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-04iio: adc: Revert "axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications"Hans de Goede1-1/+31
Inheriting the ADC BIAS current settings from the BIOS instead of hardcoding then causes the AXP288 to disable charging (I think it mis-detects an overheated battery) on at least one model tablet. So lets go back to hard coding the values, this reverts commit fa2849e9649b ("iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications"), fixing charging not working on the model tablet in question. The exact cause is not fully understood, hence the revert to a known working state. Cc: stable@vger.kernel.org Reported-by: Umberto Ixxo <sfumato1977@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-04iio: adc: sun4i-gpadc-iio: fix unbalanced irq enable/disableQuentin Schulz1-2/+1
When initializing interrupts, the devm_request_any_context_irq will enable them right away. An atomic flag was set in sun4i_irq_init and read in the interrupt handler to make sure no unwanted interrupts were handled. If an unwanted interrupt occurred, the handler would disable the irq and return IRQ_HANDLED. However, at the end of sun4i_irq_init, the irq would be disabled as well, resulting in an unbalanced enable (since there are more disables than enables, the code enabling the interrupt would never be called). When reading the ADC or the temperature, the respective irq would be enabled in the read function and disabled in the irq handler. In the read function, we would wait for a completion (with a timeout) that will be set in the irq handler. However, if the completion is never set or if the wait for completion times out, the irq would not be disabled in the read function resulting in an unbalanced enable once the read function is called again (since there are 2+ enables for no disable). Moving disable_irq from the irq handler to the read function get rid of these two cases of unbalanced enable. Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC") Reported-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-04Merge tag 'hwmon-for-linus-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-stagingLinus Torvalds1-1/+1
Pull hwmon updates from Guenter Roeck: - Add PMBus client driver for IR35221 - Add support for NCT6795D to nct6775 driver - Functional improvements to adt7475, aspeed-pwm-tacho, and ibmpowernv drivers - Minor fixes and cleanups in various drivers * tag 'hwmon-for-linus-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (22 commits) hwmon: (aspeed-pwm-tacho) Poll with short sleeps. hwmon: (aspeed-pwm-tacho) reduce fan_tach period hwmon: (ibmpowernv) Add current(A) sensor hwmon: (ibmpowernv) introduce a legacy_compatibles array hwmon: (pwm-fan) Switch to new atomic PWM API hwmon: (scpi) Fix the scale of SCP sensor readings hwmon: (aspeed-pwm-tacho) Enable both edge measurement. hwmon: (ibmpowernv) Add highest/lowest attributes to sensors hwmon: (pmbus) move header file out of I2C realm hwmon: (max6639) move header file out of I2C realm hwmon: (ltc4245) move header file out of I2C realm hwmon: (ds620) move header file out of I2C realm hwmon: (ads1015) move header file out of I2C realm hwmon: (adt7475) temperature smoothing hwmon: (adt7475) add high frequency support hwmon: (adt7475) fan stall prevention hwmon: (adt7475) replace find_nearest() with find_closest() hwmon: (pmbus) Add client driver for IR35221 hwmon: (nct6775) Add support for NCT6795D hwmon: (nct6775) Improve fan detection ...
2017-07-03Merge tag 'char-misc-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-miscLinus Torvalds6-0/+545
Pull char/misc updates from Greg KH: "Here is the "big" char/misc driver patchset for 4.13-rc1. Lots of stuff in here, a large thunderbolt update, w1 driver header reorg, the new mux driver subsystem, google firmware driver updates, and a raft of other smaller things. Full details in the shortlog. All of these have been in linux-next for a while with the only reported issue being a merge problem with this tree and the jc-docs tree in the w1 documentation area" * tag 'char-misc-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (147 commits) misc: apds990x: Use sysfs_match_string() helper mei: drop unreachable code in mei_start mei: validate the message header only in first fragment. DocBook: w1: Update W1 file locations and names in DocBook mux: adg792a: always require I2C support nvmem: rockchip-efuse: add support for rk322x-efuse nvmem: core: add locking to nvmem_find_cell nvmem: core: Call put_device() in nvmem_unregister() nvmem: core: fix leaks on registration errors nvmem: correct Broadcom OTP controller driver writes w1: Add subsystem kernel public interface drivers/fsi: Add module license to core driver drivers/fsi: Use asynchronous slave mode drivers/fsi: Add hub master support drivers/fsi: Add SCOM FSI client device driver drivers/fsi/gpio: Add tracepoints for GPIO master drivers/fsi: Add GPIO based FSI master drivers/fsi: Document FSI master sysfs files in ABI drivers/fsi: Add error handling for slave drivers/fsi: Add tracepoints for low-level operations ...
2017-06-26Merge tag 'iio-for-4.13b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman26-415/+1585
Jonathan writes: Second set of IIO new device support, features and cleanups for the 4.13 cycle. A few reverts here. One was a general failure to notice a device was already supported by another driver. The second is due to a review comment pointing out that the original patch was a bad idea and would break existing systems. Reverts * bma180 - Revert addition of support for the BMA250E it is already supported by the bmc150-accel and better supported at that. Oops. * hi8435 - The fix for cleanup of the reset gpio stuff isn't a good way to go. It breaks systems where an inverting level convertor is used. The right fix is to make the original devicetree correct - even if it involves patching the devicetree in kernel. New Device Support * stm32-adc - STM32H7 support and bindings. Features * core - add a hardware triggered operating mode for systems in which the actual trigger is never seen by the kernel. This is typically only used when a device 'can' use other triggers, but if a particular magic one is enabled the interrupt is effectively handled in hardware and we never see it. * st-lsm6dsx - support active low interrupts. * stm32-adc - Make the core adc clock optional as not all hardware supported requires it. - Make the bus clock optional in the per instance driver as it may be shared by all instances of the ADC and is handled by the core. - Rework to have a data structure representing the device type specific elements. * stm32-trigger (and counter) - Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate. - Add an attribute to configure device modes for quadrature counting etc. Clean ups and minor fixes * IIO core. - use __sysfs_match_string() helper rather than open coding the same. * ad7791 - use sysfs_match_string() helper rather than open coding the same. * aspeed-adc - handle return value of clk_prepare_enable * cpcap - Fix default register values and ensure the battery thermistor is enabled correctly. - Fix the reported die temperature where we can - docs are lacking. - Remove the hung interrupt quirk as no longer happens due to fix in the mfd driver. * hi8435 - Remove &s from hi8435_info definition as unneeded and inconsistent. * hid-sensor-trgger - Add kconfig depends on IIO_BUFFER (fixes patch in previous series) * ina2xx - Make the use of iio_info_mask* elements consistent for all channels. This doesn't have any visible effect, but acts as clear documentation of which channels various resulting attributes apply to. * lpc32xx - handle the return value of clk_prepare_enable. * meson-saradc - NULL instead of 0 for pointer. * mma9551 - use NULL for GPIO connection ID to aid implementation fo ACPI support. Here the connection ID doesn't actually tell us anything and it is much easier to deal with the driver if it's not there. * mpu6050 - Fix lock issues through use of a local mux. - Replace sprintf with scnprintf as appropriate. - Check whoami against all known values. This allows for a small number of boards where we are really fishing for the part not being present at all. It is unfortunately common to have undescribed changes to use newer chips. We paper over this but just emitting a warning for those cases as long as we know about. * mxs-lradc - Fix some non static warnings. * rcar-adc - Part of making the naming for this part consistent across the kernel. * st_accel - drop some spi_device_id entries for variants with no SPI support * st_magn - drop some spi_device_id entries for variants with no SPI support. * sx9500 - Use devm_gpiod_get instead of indexed value with an index of 0 on all occasions. * twl4030 - Drop unused twl4030_get_madc_conversion as callers removed now throughout kernel. - Unexport twl4030_madc_conversion() as no used only within this driver. - Drop twl4030_madc_user_params as not used now. - Drop twl4030_madc_request.func_cb as not used now. - Fold the twl4030-madc.h header into the driver as no longer used anywhere else in the kernel. * xilinx - Handle the return value of clk_prepare_enable
2017-06-24iio: pressure: st_pressure_core: disable multiread by default for LPS22HBLorenzo Bianconi1-1/+1
Set multiread variable to false for LPS22HB pressure sensor since it is already enabled in CTRL_REG2. Previous configuration does not cause any issue in I2C communication since SUB Msb has no meaning whereas it breaks register address in SPI communication Fixes: e039e2f5b4da (iio:st_pressure:initial lps22hb sensor support) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-24iio: light: tsl2563: use correct event codeAkinobu Mita1-1/+1
The TSL2563 driver provides three iio channels, two of which are raw ADC channels (channel 0 and channel 1) in the device and the remaining one is calculated by the two. The ADC channel 0 only supports programmable interrupt with threshold settings and this driver supports the event but the generated event code does not contain the corresponding iio channel type. This is going to change userspace ABI. Hopefully fixing this to be what it should always have been won't break any userspace code. Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-20Merge 4.12-rc6 into staging-nextGreg Kroah-Hartman6-7/+48
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13iio: imu: inv_mpu6050: test whoami first and against all known valuesJean-Baptiste Maneyrol1-9/+24
SPI bus is never generating error during transfer, so to check if a chip is correctly connected on a SPI bus we enforce whoami check to be correct. In this way we can assure SPI probe is failing if there is no chip connected. Note that this is really papering over boards that claim the device is there when it isn't. Not a bad thing to cope with, but not necessarily stable material. Fixes: cec0154556f8 ("iio: inv_mpu6050: Check WHO_AM_I register on probe") Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-13iio hid-sensor-trigger: add Kconfig depends on IIO_BUFFERAlexander Wuerstlein1-1/+1
Building a kernel with my configuration failed with: > drivers/built-in.o: In function `hid_sensor_setup_batch_mode': staging/drivers/iio/common/hid-sensors/hid-sensor-trigger.c:104: undefined reference to `iio_buffer_set_attrs' which is fixed by this patch. Signed-off-by: Alexander Wuerstlein <arw@arw.name> Fixes: 138bc7969c24 ("iio: hid-sensor-hub: Implement batch mode") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-13iio: buffer-dmaengine: Add missing header buffer_impl.hPhil Reid1-0/+1
Add buffer_impl.h as buffer.h was split into interface for using and for internals. Without this industrialio-buffer-dmaengine.c fails to compile. Fixes: commit 33dd94cb972175249258329c4aaffddcc82c2005 ("iio:buffer.h - split into buffer.h and buffer_impl.h") Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-13iio: buffer-dma: Add missing header buffer_impl.hPhil Reid1-0/+1
Add buffer_impl.h as buffer.h was split into interface for using and for internals. Without this industrialio-buffer-dma.c fails to compile. Fixes: commit 33dd94cb972175249258329c4aaffddcc82c2005 ("iio:buffer.h - split into buffer.h and buffer_impl.h") Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-12Merge 4.12-rc5 into staging-nextGreg Kroah-Hartman7-35/+44
We want the IIO fixes and other staging driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-12Merge 4.12-rc5 into char-misc-nextGreg Kroah-Hartman7-35/+44
We want the char/misc driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-11hwmon: (ads1015) move header file out of I2C realmWolfram Sang1-1/+1
include/linux/i2c is not for client devices. Move the header file to a more appropriate location. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2017-06-11iio: accel: mma9551: use NULL for GPIO connection IDAndy Shevchenko1-3/+1
While using GPIO library API we might get into troubles in the future, because we can't rely on label name in the driver since vendor firmware might provide any GPIO pin there, e.g. "reset", and even mark it in _DSD (in which case the request will fail). To avoid inconsistency and potential issues we have two options: a) generate GPIO ACPI mapping table and supply it via acpi_dev_add_driver_gpios(), or b) just pass NULL as connection ID. The b) approach is much simpler and would work since the driver relies on GPIO indices only. Moreover, the _CRS fallback mechanism, when requesting GPIO, is going to be stricter, and supplying non-NULL connection ID when neither _DSD, nor GPIO ACPI mapping is present, will make request fail. See https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=for-next&id=ed7fcf1ed5ea4ea01243995ae085757a77cf0f3e for more background. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: make stm32 trigger driver use INDIO_HARDWARE_TRIGGERED modeBenjamin Gaignard1-0/+61
Add validate function to be use to use the correct trigger. Add an attribute to configure device mode like for quadrature and enable modes Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: add hardware triggered operating modeBenjamin Gaignard1-2/+2
Devices, like stm32 timer, could be triggered by hardware events which are not buffer or software events. However it could be necessary to validate the triggers like it is done for buffer or event triggered modes. This patch add a new INDIO_HARDWARE_TRIGGERED operating mode for this kind of devices and allow this mode to register trigger consumer. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: Aspeed ADC - Handle return value of clk_prepare_enableArvind Yadav1-1/+5
clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Reviewed-by: Rick Altherr <raltherr@google.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11Revert "iio: accel: bma180: Add support for BMA250E"Hans de Goede1-23/+1
This reverts commit f1320b09517bceb261fed887fe261d6cbab2094e. The BMA250E is already handled by the bmc150-accel-i2c driver, which supports the "E" variants of the BMA??? accelerometers better then the bma180 driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11Revert "iio: accel: bma180: Add ACPI enumeration support for BMA250E"Hans de Goede1-19/+2
This reverts commit 5333e88661f2079d5ca8b94690ac920976300de3. The BMA250E is already handled by the bmc150-accel-i2c driver, which supports the "E" variants of the BMA??? accelerometers better then the bma180 driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: magnetometer: st_magn_spi: fix spi_device_id tableLorenzo Bianconi1-2/+0
Remove LSM303DLHC, LSM303DLM from st_magn_id_table since LSM303DL series does not support spi interface Fixes: 872e79add756 (iio: magn: Add STMicroelectronics magn driver) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: accel: st_accel_spi: fix spi_device_id tableLorenzo Bianconi1-4/+0
Remove LSM303DL, LSM303DLM, LSM303DLH, LSM303DLHC from st_accel_id_table since LSM303DL series does not support spi interface Fixes: d62511689de5 (iio: accel: Add STMicroelectronics accel driver) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: imu: inv_mpu6050: replace sprintf with scnprintfJean-Baptiste Maneyrol1-1/+2
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: imu: inv_mpu6050: fix lock issues by using our own mutexJean-Baptiste Maneyrol5-74/+103
There are several locks issues when using buffer and direct polling data at the same time. Use our own mutex for managing locking and block simultaneous use of buffer and direct polling by using iio_device_{claim/release}_direct_mode. This makes chip_config enable bit obsolete, so delete it. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: imu: st_lsm6dsx: support active-low interruptsLorenzo Bianconi1-0/+14
Add support for active low interrupts (IRQF_TRIGGER_LOW and IRQF_TRIGGER_FALLING). Configure the device as active high or low according to the requested irq line. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: ad7791: Use sysfs_match_string() helperAndy Shevchenko1-5/+3
Use sysfs_match_string() helper instead of open coded variant. Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: core: Use __sysfs_match_string() helperAndy Shevchenko1-9/+4
Use __sysfs_match_string() helper instead of open coded variant. Cc: Jonathan Cameron <jic23@kernel.org> Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: proximity: sx9500: Use devm_gpiod_get()Andy Shevchenko1-2/+1
Since index is always 0 replace devm_gpiod_get_index() by devm_gpiod_get(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: twl4030: Fold twl4030-madc.h into driverSebastian Reichel1-1/+112
twl4030-madc.h is no longer used by anything outside of the iio driver, so it can be merged into the driver. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: twl4030: Remove twl4030_madc_request.func_cbSebastian Reichel1-70/+0
This functionality is not used by the IIO subsystem. Due to removal of legacy API it can also be removed. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: twl4030: Unexport twl4030_madc_conversion()Sebastian Reichel1-2/+3
All madc users have been converted to IIO API, so drop the legacy API. The function is still used inside of the driver. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: twl4030: Drop twl4030_get_madc_conversion()Sebastian Reichel1-21/+0
Drop legacy twl4030_get_madc_conversion() method. It has been used by drivers to get madc data before it conversion to IIO API. There are no users in the mainline kernel anymore. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Acked-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: stm32: add support for STM32H7Fabrice Gasnier3-4/+701
Add support for STM32H7 Analog to Digital Converter. It has up to 20 external channels, resolution ranges from 8 to 16bits. Either bus or asynchronous adc clock may be used. Add registers & bitfields definition. Also add new configuration options to enter/exit powerdown and perform self-calibration. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: stm32: make per instance bus clock optionalFabrice Gasnier1-8/+20
STM32F4 requires one clock per ADC instance for register access. But, newer version of ADC hardware block have common bus clock for all instances (per instance driver isn't responsible for getting it). So, make it optional by default. Still, enforce it's required on STM32F4. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: stm32: introduce compatible data cfgFabrice Gasnier2-59/+205
Prepare support for stm32h7 adc variant by introducing compatible configuration data. Move STM32F4 specific stuff to compatible data structure: - registers & bit fields - input channels data - start/stop procedures - trigger definitions Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: stm32: make core adc clock optional by defaultFabrice Gasnier1-12/+26
Analog clock input is mandatory on stm32f4. But newer version of ADC hardware block allow to select either bus clock or asynchronous clock, for analog circuitry. So, make it optional by default, but enforce clk presence on stm32f4. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11iio: adc: meson-saradc: fix potential crash in meson_sar_adc_clear_fifoMartin Blumenstingl1-2/+2
meson_sar_adc_clear_fifo passes a 0 as value-pointer to regmap_read(). In case of the meson-saradc driver this ends up in regmap_mmio_read(), where the value-pointer is de-referenced unconditionally to assign the value which was read. Fix this by passing an actual pointer, even though all we want to do is to discard the value. As a side-effect this fixes a sparse warning ("Using plain integer as NULL pointer") as reported by Paolo Cretaro. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Reported-by: Paolo Cretaro <paolocretaro@gmail.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03iio: multiplexer: new iio category and iio-mux driverPeter Rosin5-0/+485
When a multiplexer changes how an iio device behaves (for example by feeding different signals to an ADC), this driver can be used to create one virtual iio channel for each multiplexer state. Depends on the generic multiplexer subsystem. Cache any ext_info values from the parent iio channel, creating a private copy of the ext_info attributes for each multiplexer state/channel. Reviewed-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03iio: inkern: api for manipulating ext_info of iio channelsPeter Rosin1-0/+60
Extend the inkern api with functions for reading and writing ext_info of iio channels. Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03iio: adc: mxs-lradc: Fix return value check in mxs_lradc_adc_probe()Wei Yongjun1-2/+5
In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Also add NULL test for iores. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03iio: adc: Fix integration time/averaging for INA219/220Stefan Brüns1-22/+182
INA226/230/231 has integration times per voltage channel and common averaging setting for both channels, while the INA219/220 only has a combined integration time/averaging setting per channel. Only expose the averaging attribute for the INA226, and expose the correct integration times for the INA219. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03iio: adc: meson-saradc: use NULL instead of 0 for pointerPaolo Cretaro1-1/+1
Fix sparse warning: Using plain integer as NULL pointer Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03iio:adc:lpc32xx Handle return value of clk_prepare_enableArvind Yadav1-2/+6
clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>