summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/Kconfig
AgeCommit message (Collapse)Author
2021-03-24iio:adc:stm32-adc: Add HAS_IOMEM dependencyJonathan Cameron
commit 121875b28e3bd7519a675bf8ea2c2e793452c2bd upstream. Seems that there are config combinations in which this driver gets enabled and hence selects the MFD, but with out HAS_IOMEM getting pulled in via some other route. MFD is entirely contained in an if HAS_IOMEM block, leading to the build issue in this bugzilla. https://bugzilla.kernel.org/show_bug.cgi?id=209889 Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20210124195034.22576-1-jic23@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-31iio: adc: stm32-dfsdm: fix unmet direct dependencies detectedFabrice Gasnier
[ Upstream commit ba7ecfe43d6bf12e2aa76705c45f7d187ae3d7c0 ] This fixes unmet direct dependencies seen when CONFIG_STM32_DFSDM_ADC is selected: WARNING: unmet direct dependencies detected for IIO_BUFFER_HW_CONSUMER Depends on [n]: IIO [=y] && IIO_BUFFER [=n] Selected by [y]: - STM32_DFSDM_ADC [=y] && IIO [=y] && (ARCH_STM32 [=y] && OF [=y] || COMPILE_TEST [=n]) Fixes: e2e6771c6462 ("IIO: ADC: add STM32 DFSDM sigma delta ADC support") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-06-30iio: adc: Add Spreadtrum SC27XX PMICs ADC supportFreeman Liu
The Spreadtrum SC27XX PMICs ADC controller contains 32 channels, which is used to sample voltages with 12 bits conversion. [Baolin Wang did lots of improvements] Signed-off-by: Freeman Liu <freeman.liu@spreadtrum.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-24iio: adc: Remove depends on HAS_DMA in case of platform dependencyGeert Uytterhoeven
Remove dependencies on HAS_DMA where a Kconfig symbol depends on another symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST". In most cases this other symbol is an architecture or platform specific symbol, or PCI. Generic symbols and drivers without platform dependencies keep their dependencies on HAS_DMA, to prevent compiling subsystems or drivers that cannot work anyway. This simplifies the dependencies, and allows to improve compile-testing. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Mark Brown <broonie@kernel.org> Acked-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10iio: adc: sun4i-gpadc: select REGMAP_IRQArnd Bergmann
We can't call regmap_irq_get_virq() unless the regmap-irq support is enabled: drivers/iio/adc/sun4i-gpadc-iio.o: In function `sun4i_irq_init': sun4i-gpadc-iio.c:(.text+0x59c): undefined reference to `regmap_irq_get_virq' I came across this in a randconfig build now, but I guess this is a much older problem that I simply never hit before because regmap_irq is usually enabled by one of the other drivers that need it. Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-09Merge tag 'iio-fixes-for-4.17a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: First round of IIO fixes for the 4.17 cycle. * core - fix up some issues with overflow etc around wrong types for some fo the kfifo handling functions. Seems unlikely this would be triggered in reality but the fixes are simple so let's tidy them up. Second patch deals with checking the userspace value passed for length for potential overflow. * ad7793 - Catch up with changes to the ad_sigma_delta core and use read_raw / write_raw iwth IIO_CHAN_INFO_SAMP_FEW to handle sampling frequency control. * at91-sama5d2 - Channel config for differential channels was completely broken. - Missing Kconfig dependency for buffer support. * hid-sensor - Fix an issue with powering up after resume due to wrong reference counting. * stm32-dfsdm - Fix an issue with second writes of the oversampling settings failing. - Fix an issue with the sample rate being set to half of requested value when particular clock source is used.
2018-04-21iio: adc: select buffer for at91-sama5d2_adcEugen Hristev
We need to select the buffer code, otherwise we get build errors with undefined functions on the trigger and buffer, if we select just IIO and then AT91_SAMA5D2_ADC from menuconfig This adds a Kconfig 'select' statement like other ADC drivers have it already. Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-05Merge tag 'gpio-v4.17-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.17 kernel cycle: New drivers: - Nintendo Wii GameCube GPIO, known as "Hollywood" - Raspberry Pi mailbox service GPIO expander - Spreadtrum main SC9860 SoC and IEC GPIO controllers. Improvements: - Implemented .get_multiple() callback for most of the high-performance industrial GPIO cards for the ISA bus. - ISA GPIO drivers now select the ISA_BUS_API instead of depending on it. This is merged with the same pattern for all the ISA drivers and some other Kconfig cleanups related to this. Cleanup: - Delete the TZ1090 GPIO drivers following the deletion of this SoC from the ARM tree. - Move the documentation over to driver-api to conform with the rest of the kernel documentation build. - Continue to make the GPIO drivers include only <linux/gpio/driver.h> and not the too broad <linux/gpio.h> that we want to get rid of. - Managed to remove VLA allocation from two drivers pending more fixes in this area for the next merge window. - Misc janitorial fixes" * tag 'gpio-v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (77 commits) gpio: Add Spreadtrum PMIC EIC driver support gpio: Add Spreadtrum EIC driver support dt-bindings: gpio: Add Spreadtrum EIC controller documentation gpio: ath79: Fix potential NULL dereference in ath79_gpio_probe() pinctrl: qcom: Don't allow protected pins to be requested gpiolib: Support 'gpio-reserved-ranges' property gpiolib: Change bitmap allocation to kmalloc_array gpiolib: Extract mask allocation into subroutine dt-bindings: gpio: Add a gpio-reserved-ranges property gpio: mockup: fix a potential crash when creating debugfs entries gpio: pca953x: add compatibility for pcal6524 and pcal9555a gpio: dwapb: Add support for a bus clock gpio: Remove VLA from xra1403 driver gpio: Remove VLA from MAX3191X driver gpio: ws16c48: Implement get_multiple callback gpio: gpio-mm: Implement get_multiple callback gpio: 104-idi-48: Implement get_multiple callback gpio: 104-dio-48e: Implement get_multiple callback gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks gpio: pci-idio-16: Implement get_multiple callback ...
2018-02-22iio: Change ISA_BUS_API dependency to selectionWilliam Breathitt Gray
The ISA_BUS_API Kconfig option enables the compilation of the ISA bus driver. The ISA bus driver does not perform any hardware interaction, and is instead just a thin layer of software abstraction to eliminate boilerplate code common to ISA-style device drivers. Since ISA_BUS_API has no dependencies and does not jeopardize the integrity of the system when enabled, drivers should select it when the ISA bus driver functionality is needed. Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-02-20Merge tag 'iio-for-4.17a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First round of new devices, features and cleanups for IIO in the 4.17 cycle. Outside of IIO * Strongly typed 64bit int_sqrt function needed by the mlx90632 New device support * adc081s - New driver supporting adc081s, adc101s and adc121s TI ADCs. * ad5272 - New driver supproting the ad5272 and ad5274 ADI digital potentiometers with DT bindings. * axp20x_adc - support the AXP813 ADC - includes rework patches to prepare for this. * mlx90632 - New driver with dt bindings for this IR temperature sensor. Features * axp20x_adc - Add DT bindings and probing. * dht11 - The sensor has a wider range than advertised in the datasheet - support it. * st_lsm6dsx - Add hardware timestamp su9pport. Cleanups * ABI docs - Update email contact for Matt Ranostay * SPDX changes - Matt Ranostay has moved his drivers over to SPDX. Currently we are making this an author choice in IIO. * ad7192 - Disable burnout current on misconfiguration. No actually effect as they simply won't work otherwise. * ad7476 - Drop a license definition that was replicating information in SPDX tag. * ade7758 - Expand buf_lock to cover both buffer and state protection allowing unintented uses of mlock in the core to be removed. * ade7759 - Align parameters to opening parenthesis. * at91_adc - Depend on sysfs instead of selecting it - for try wide consistency. * ccs811 - trivial naming type for a define. * ep93xx - Drop a redundant return as a result checking platform_get_resource. * hts221 - Regmap conversion which simplifies the driver somewhat. - Clean up some restricted endian cast warnings. - Drop a trailing whitespace from a comment - Drop an unnecessary get_unaligned by changing to the right 16bit data type. * ms5611 - Fix coding style in the probe function (whitespace) * st_accel - Use strlcpy instead of strncpy to avoid potentially truncating a string.
2018-02-01Merge tag 'staging-4.16-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging/IIO updates from Greg KH: "Here is the big Staging and IIO driver patches for 4.16-rc1. There is the normal amount of new IIO drivers added, like all releases. The networking IPX and the ncpfs filesystem are moved into the staging tree, as they are on their way out of the kernel due to lack of use anymore. The visorbus subsystem finall has started moving out of the staging tree to the "real" part of the kernel, and the most and fsl-mc codebases are almost ready to move out, that will probably happen for 4.17-rc1 if all goes well. Other than that, there is a bunch of license header cleanups in the tree, along with the normal amount of coding style churn that we all know and love for this codebase. I also got frustrated at the Meltdown/Spectre mess and took it out on the dgnc tty driver, deleting huge chunks of it that were never even being used. Full details of everything is in the shortlog. All of these patches have been in linux-next for a while with no reported issues" * tag 'staging-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (627 commits) staging: rtlwifi: remove redundant initialization of 'cfg_cmd' staging: rtl8723bs: remove a couple of redundant initializations staging: comedi: reformat lines to 80 chars or less staging: lustre: separate a connection destroy from free struct kib_conn Staging: rtl8723bs: Use !x instead of NULL comparison Staging: rtl8723bs: Remove dead code Staging: rtl8723bs: Change names to conform to the kernel code staging: ccree: Fix missing blank line after declaration staging: rtl8188eu: remove redundant initialization of 'pwrcfgcmd' staging: rtlwifi: remove unused RTLHALMAC_ST and RTLPHYDM_ST staging: fbtft: remove unused FB_TFT_SSD1325 kconfig staging: comedi: dt2811: remove redundant initialization of 'ns' staging: wilc1000: fix alignments to match open parenthesis staging: wilc1000: removed unnecessary defined enums typedef staging: wilc1000: remove unnecessary use of parentheses staging: rtl8192u: remove redundant initialization of 'timeout' staging: sm750fb: fix CamelCase for dispSet var staging: lustre: lnet/selftest: fix compile error on UP build staging: rtl8723bs: hal_com_phycfg: Remove unneeded semicolons staging: rts5208: Fix "seg_no" calculation in reset_ms_card() ...
2018-01-30iio/adc: depend on SYSFS instead of selecting itRandy Dunlap
Drivers should not 'select' a subsystem. Instead they should depend on it. If the subsystem is disabled, the user probably did that for a purpose and one driver shouldn't be changing that. This also makes all IIO drivers consistent w.r.t depending on SYSFS instead of selecting it. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-10IIO: ADC: add STM32 DFSDM sigma delta ADC supportArnaud Pouliquen
Add DFSDM driver to handle sigma delta ADC. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-10IIO: ADC: add stm32 DFSDM core supportArnaud Pouliquen
Add driver for stm32 DFSDM pheripheral. Its converts a sigma delta stream in n bit samples through a low pass filter and an integrator. stm32-dfsdm-core driver is the core part supporting the filter instances dedicated to sigma-delta ADC or audio PDM microphone purpose. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-10IIO: ADC: add sigma delta modulator supportArnaud Pouliquen
Add generic driver to support sigma delta modulators. Typically, this device is hardware connected to an IIO device in charge of the conversion. Devices are bonded through the hardware consumer API. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-08iio: hx711: add triggered buffer supportAndreas Klinger
Add buffer to device data struct and add trigger function Data format is quite simple: voltage - channel 0 32 Bit voltage - channel 1 32 Bit timestamp 64 Bit Using both channels at the same time is working quite slow because of changing the channel which needs a dummy read. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-02iio: adc: at91-sama5d2_adc: add support for DMAEugen Hristev
Added support for DMA transfers. The implementation uses the user watermark to decide whether DMA will be used or not. For watermark 1, DMA will not be used. If watermark is bigger, DMA will be used. Sysfs attributes are created to indicate whether the DMA is used, with hwfifo_enabled, and the current DMA watermark is readable in hwfifo_watermark. Minimum and maximum values are in hwfifo_watermark_min and hwfifo_watermark_max. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-23Merge 4.14-rc6 into staging-nextGreg Kroah-Hartman
We want the IIO and staging driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-09iio: adc: mcp320x: Add support for mcp3550/1/3Lukas Wunner
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-09iio: adc: rcar-gyroadc: Enable compile-testing on non-ARMGeert Uytterhoeven
The rcar-gyroadc driver compiles fine on other platforms, hence increase compile coverage. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-08iio: adc: dln2-adc: fix build errorRandy Dunlap
The dln2-adc driver uses interface(s) that are controlled by the IIO_TRIGGERED_BUFFER Kconfig symbol, so the driver needs to select that symbol to prevent the build error. drivers/iio/adc/dln2-adc.o: In function `dln2_adc_probe': dln2-adc.c:(.text+0x528): undefined reference to `devm_iio_triggered_buffer_setup' Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Cc: Jack Andersen <jackoalan@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-17iio: adc: select triggered buffer for sama5d2 adcArnd Bergmann
Without the triggered buffer code, we get a link error: drivers/iio/adc/at91-sama5d2_adc.o: In function `at91_adc_probe': at91-sama5d2_adc.c:(.text+0x938): undefined reference to `devm_iio_triggered_buffer_setup' This adds a Kconfig 'select' statement like other ADC drivers have it already. Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-25iio: adc: New driver for Cirrus Logic EP93xx ADCAlexander Sverdlin
New driver adding support for ADC found on Cirrus Logic EP93xx series of SoCs. Board specific code must take care to create plaform device with all necessary resources. Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-09iio: adc: Add support for DLN2 ADCJack Andersen
This patch adds support for Diolan DLN2 ADC via IIO's ADC interface. ADC is the fourth and final component of the DLN2 for the kernel. Signed-off-by: Jack Andersen <jackoalan@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-04iio: Add LTC2471/LTC2473 driverMike Looijmans
The LTC2741 and LTC2473 are single voltage ADC chips. The LTC2473 is similar to the LTC2471 but outputs a signed differential value. Datasheet: http://cds.linear.com/docs/en/datasheet/24713fb.pdf Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01iio: adc: Kconfig: Append vendor name for IMX7D_ADCFabio Estevam
To keep IMX7D_ADC text consistent with other iio/adc entries, add the vendor name to the driver menu text. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-29Merge tag 'iio-for-4.13a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new device support, features and cleanups for IIO in the 4.13 cycle Two entirely new drivers in here plus the usual range of cleanups and features. New device support * ad5064 - add ltc2631, ltc2633 and ltc2635 support. * bma180 - trivial support for bma250e (new id) * hid-sensor-rotation - add relative orientation and geometric orientation support. * isl29028 - add isl29030 support (its effectively the same part from a driver point of view) * maxim_thermocouple - add max31856 id. * meson-saradc - add meson8b SoC adc support. * ti-adc084s021 - new driver and bindings. * ti-adc108s102 - new driver and bindings. Staging graduations * isl29028 Features * bma180 - ACPI enumeration for BMA250E which is used in various x86 tablets. * hi8453 - add raw access rather than only events. * hid-sensor-hub - Implement batch mode in which we can set a threshold on the amount of time between data coming from the fifos. This is the first device to do this rather than use a watershed on the number of samples. * hts221 - power management support * lsm6dsx - add system power management support. * rpr0521 - sampling frequency read / write * stm32-trigger - add support for TRG02 triggers. * tsl2583 - runtime power management support. Cleanups * core - inkern: fix a double unlock in iio_read_available_channel_raw when raw value doesn't appear to be raw (error path). - fixup accidental sizeof pointer in iio_device_add_mask_type. * docs - fix an accidental duplicated line in sysfs-bus-iio-meas-spec. * tools - use local include/uapi headers to ensure always up to date. - increase length of allowed trigger names. * ad9834 - symbolic to octal permissions. * ade7753 - symbolic to octal permissions. - fix indentation * ade7754 - symbolic to octal permissions. * ade7758 - symbolic to octal permissions. - ade7854 - symbolic to octal permissions. * as3935 - move out of storm check to given consistent results for raw and processed values. * bmp280 - fix bme280 naming in Kconfig help. * hi8435 - avoid garbage on event after enable. - add missing in_voltage_sensing_mode_available to list possible enum options. - handle the reset gpio with the obvious polarity rather than relying on DT to provide it correctly. * hid-sensors - fix a wrong error path scrubbing of return values. * hid-sensors-accel - drop static on a local variable * hid-sensors-rotation - Add missing scale and offset property parsing support. * ina2xx - Fix a bad use of GENMASK and some typos and whitespace issues. * isl29018 - only declare the ACPI table when ACPI is enabled. * isl29028 - fix proximity sleep times. * lsm6dsx - replace ifdef CONFIG_PM with __maybe_unused to avoid the complexity of dealing with the various PM config variables. * meson-saradc - mark meson_sar_adc_data static and const. * rcar-gyroadc - derive the interface clock speed from the fck clock on the basis they are the same actual clock. - drop the now unused if clock from the bindings. * rpr0521 - disable sensor when marked as such rather than always enabling it. - poweroff if probe fails and we can talk to device. - make sure device powered off when it doesn't need to be on. - use sizeof rather than hardcoded size on value read. - whitespace fixup. - reorder channel numbers ready for buffered support which didn't quite make this pull request. * st-accel - fix platform data initialization to allow remove and reprobe. * st-pressure - fix platform data initialization to allow remove and reprobe. * tsl2x7x - S_IRUGO, S_IWUSR to octal values - rename driver for consistency with more recent drivers - drop FSF mailing address - replace DEVICE_ATTR macros with the shorter DEVICE_ATTR_RW form and relevant function renames. * zpa2326 - report an error for consistency with other error paths.
2017-05-21iio: adc: Add support for TI ADC108S102 and ADC128S102Jan Kiszka
This is an upstream port of an IIO driver for the TI ADC108S102 and ADC128S102. The former can be found on the Intel Galileo Gen2 and the Siemens SIMATIC IOT2000. For those boards, ACPI-based enumeration is included. Due to the lack of regulators under ACPI, we hard-code the voltage provided to the VA pin of the ADC to 5 V, the value used on Galileo and IOT2000. For DT usage, the regulator "vref-supply" provides this information. Note that DT usage has not been tested. Original author: Bogdan Pricop <bogdan.pricop@emutex.com> Ported from Intel Galileo Gen2 BSP to Intel Yocto kernel: Todor Minchev <todor@minchev.co.uk>. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-14iio: adc: add driver for the ti-adc084s021 chipMårten Lindahl
This adds support for the Texas Instruments ADC084S021 ADC chip. Signed-off-by: Mårten Lindahl <martenli@axis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-05Merge tag 'staging-4.12-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging/IIO updates from Greg KH: "Here is the big staging tree update for 4.12-rc1. It's a big one, adding about 350k new lines of crap^Wcode, mostly all in a big dump of media drivers from Intel. But there's other new drivers in here as well, yet-another-wifi driver, new IIO drivers, and a new crypto accelerator. We also deleted a bunch of stuff, mostly in patch cleanups, but also the Android ION code has shrunk a lot, and the Android low memory killer driver was finally deleted, much to the celebration of the -mm developers. All of these have been in linux-next with a few build issues that will show up when you merge to your tree" Merge conflicts in the new rtl8723bs driver (due to the wifi changes this merge window) handled as per linux-next, courtesy of Stephen Rothwell. * tag 'staging-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1182 commits) staging: fsl-mc/dpio: add cpu <--> LE conversion for dpaa2_fd staging: ks7010: remove line continuations in quoted strings staging: vt6656: use tabs instead of spaces staging: android: ion: Fix unnecessary initialization of static variable staging: media: atomisp: fix range checking on clk_num staging: media: atomisp: fix misspelled word in comment staging: media: atomisp: kmap() can't fail staging: atomisp: remove #ifdef for runtime PM functions staging: atomisp: satm include directory is gone atomisp: remove some more unused files atomisp: remove hmm_load/store/clear indirections atomisp: kill off mmgr_free atomisp: clean up the hmm init/cleanup indirections atomisp: handle allocation calls before init in the hmm layer staging: fsl-dpaa2/eth: Add maintainer for Ethernet driver staging: fsl-dpaa2/eth: Add TODO file staging: fsl-dpaa2/eth: Add trace points staging: fsl-dpaa2/eth: Add driver specific stats staging: fsl-dpaa2/eth: Add ethtool support staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver ...
2017-04-27iio: adc: add support for X-Powers AXP20X and AXP22X PMICs ADCsQuentin Schulz
The X-Powers AXP20X and AXP22X PMICs have multiple ADCs. They expose the battery voltage, battery charge and discharge currents, AC-in and VBUS voltages and currents, 2 GPIOs muxable in ADC mode and PMIC temperature. This adds support for most of AXP20X and AXP22X ADCs. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Reviewed-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-14iio: adc: add max1117/max1118/max1119 ADC driverAkinobu Mita
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>
2017-04-08iio: adc: add a driver for Qualcomm PM8xxx HK/XOADCLinus Walleij
The Qualcomm PM8xxx PMICs contain a simpler ADC than its successors (already in the kernel as qcom-spmi-vadc.c): the HK/XO ADC (Housekeeping/Chrystal oscillator ADC). As far as I can understand this is equal to the PMICs using SSBI transport and encompass PM8018, PM8038, PM8058, and PM8921, so this is shortly named PM8xxx. This ADC monitors a bunch of on-board voltages and the die temperature of the PMIC itself, but it can also be routed to convert a few external MPPs (multi-purpose pins). On the APQ8060 DragonBoard this feature is used to let this ADC convert an analog ALS (Ambient Light Sensor) voltage signal from a Capella CM3605 ALS into a LUX value. Developed and tested with APQ8060 DragonBoard based on Ivan's driver and Rama Krishna's patches. The SPMI VADC driver is quite different, but share enough minor functionality that I have split out to the common file in a previous patch. Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: Ivan T. Ivanov <iivanov.xz@gmail.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-08iio: adc: break out common code from SPMI VADCLinus Walleij
The SPMI VADC and the earlier XOADC share a subset of common code, so to be able to use the same code in both drivers, we break out a separate file with the common code, prefix exported functions that are no longer static with qcom_* and bake an object qcom-spmi-vadc.o that contains both files: qcom-vadc-common.o and qcom-spmi-vadc-core.o. As we need to follow the procedure for making a kernel module or compiled in object from several files, but still want to produce the same module name, rename the qcom-spmi-vadc.c file to qcom-spmi-vadc-core.c so we can bake the two objects into qcom-spmi-vadc.o Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: Ivan T. Ivanov <iivanov.xz@gmail.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-08iio: adc: sun4i-gpadc-iio: add support for A33 thermal sensorQuentin Schulz
This adds support for the Allwinner A33 thermal sensor. Unlike the A10, A13 and A31, the Allwinner A33 only has one channel which is dedicated to the thermal sensor. Moreover, its thermal sensor does not generate interruptions, thus we only need to directly read the register storing the temperature value. The MFD used by the A10, A13 and A31, was created to avoid breaking the DT binding, but since the nodes for the ADC weren't there for the A33, it is not needed. Though the A33 does not have an internal ADC, it has a thermal sensor which shares the same registers with GPADC of the already supported SoCs and almost the same bits, for the same purpose (thermal sensor). The thermal sensor behaves exactly the same (except the presence of interrupts or not) on the different SoCs. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-08iio: adc: Add Maxim max9611 ADC driverJacopo Mondi
Add iio driver for Maxim max9611 and max9612 current-sense amplifiers with 12-bits ADC interface. Datasheet publicly available at: https://datasheets.maximintegrated.com/en/ds/MAX9611-MAX9612.pdf Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02iio: adc: sun4i: add THERMAL dependencyArnd Bergmann
With CONFIG_THERMAL=m and CONFIG_SUN4I_GPADC=y, we get a link error from calling devm_thermal_zone_of_sensor_register: drivers/iio/built-in.o: In function `sun4i_gpadc_probe': :(.text+0x1c284): undefined reference to `devm_thermal_zone_of_sensor_register' This adds a Kconfig dependency to ensure we can only have the ADC driver as built-in when this function is also built-in, or when we see the empty stub implementation. When the thermal code is a module, we can still build the adc driver as a module, too. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: d1caa99055382 ("iio: adc: add support for Allwinner SoCs ADC") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02iio:adc: Driver for Linear Technology LTC2497 ADCMichael Hennerich
This patch adds support for the Analog Devices / Linear Technology LTC2497 ADCs. The LTC2497 is a 16-channel (eight differential), 16-bit, high precision, delta-sigma ADC with an automatic, differential, input current cancellation front end and a 2-wire, I2C interface. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-01iio: Aspeed ADCRick Altherr
Aspeed BMC SoCs include a 16 channel, 10-bit ADC. Low and high threshold interrupts are supported by the hardware but are not currently implemented. Signed-off-by: Rick Altherr <raltherr@google.com> Tested-by: Xo Wang <xow@google.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-30iio: adc: cpcap: Add minimal support for CPCAP PMIC ADCTony Lindgren
On Motorola phones like droid 4 there is a custom CPCAP PMIC. This PMIC has ADCs that are used for battery charging and USB PHY VBUS and ID pin detection. Unfortunately the only documentation for this ADC seems to be the Motorola mapphone Linux kernel tree. I have tested that reading raw and scaled values works, but I have not used the timed sampling that the ADC seems to support. Let's add a minimal support for it so we can eventually provide IIO channels for the related battery charging and USB PHY drivers. Cc: devicetree@vger.kernel.org Cc: Marcel Partap <mpartap@gmx.net> Cc: Michael Scott <michael.scott@linaro.org> Cc: Sebastian Reichel <sre@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23iio: adc: mxs-lradc: Remove driverKsenija Stanojevic
Since the driver has been split into MFD there is no reason for it to stay, so remove it. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-23iio: adc: mxs-lradc: Add support for ADC driverKsenija Stanojevic
Add support for sixteen-channel 12-bit resolution ADC and its functions, which include general-purpose ADC readings, battery voltage measurement, and die temperature measurement. Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Reviewed-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-03-15iio: pc104: Mask PC/104 drivers via the PC104 Kconfig optionWilliam Breathitt Gray
PC/104 drivers should be hidden on machines which do not support PC/104 devices. This patch adds the PC104 Kconfig option as a dependency for the relevant PC/104 device driver Kconfig options. 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> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-08iio: adc: add support for Allwinner SoCs ADCQuentin Schulz
The Allwinner SoCs all have an ADC that can also act as a touchscreen controller and a thermal sensor. This patch adds the ADC driver which is based on the MFD for the same SoCs ADC. This also registers the thermal adc channel in the iio map array so iio_hwmon could use it without modifying the Device Tree. This registers the driver in the thermal framework. The thermal sensor requires the IP to be in touchscreen mode to return correct values. Therefore, if the user is continuously reading the ADC channel(s), the thermal framework in which the thermal sensor is registered will switch the IP in touchscreen mode to get a temperature value and requires a delay of 100ms (because of the mode switching), then the ADC will switch back to ADC mode and requires also a delay of 100ms. If the ADC readings are critical to user and the SoC temperature is not, this driver is capable of not registering the thermal sensor in the thermal framework and thus, "quicken" the ADC readings. This driver probes on three different platform_device_id to take into account slight differences (registers bit and temperature computation) between Allwinner SoCs ADCs. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11staging:iio:adc:lpc32xx Move out of staging.Jonathan Cameron
There are a few more little cleanups that could be done on this driver, but I don't think any are sufficient to justify not moving it out of staging. It's a very simple driver (presumably for a simple part) so not much that can go wrong. I think it was only ever in staging because that's where IIO was as a whole at the time and then we forgot about it! Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Roland Stigge <stigge@antcom.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11staging:iio:adc:spear Move out of staging.Jonathan Cameron
There are some unanswered questions due to disagreements between the code and various datasheets (including between different datasheets for the same part). I don't think that is necessarily a reason to keep it in staging however. I'm partly posting this patch inorder to reignite debate and with a bit of luck find someone who has one of these to test! Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-29iio: adc: stm32: add optional dma supportFabrice Gasnier
Add DMA optional support to STM32 ADC, as there is a limited number DMA channels (request lines) that can be assigned to ADC. This way, driver may fall back using interrupts when all DMA channels are in use for other IPs. Use dma cyclic mode with two periods. Allow to tune period length by using watermark. Coherent memory is used for dma (max buffer size is fixed to PAGE_SIZE). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28iio: adc: stm32: Enable use of stm32 timer triggersFabrice Gasnier
STM32 ADC has external timer trigger sources. Use stm32 timer triggers API (e.g. is_stm32_timer_trigger()) with local ADC lookup table to validate a trigger can be used. This also provides correct trigger selection value (e.g. extsel). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28iio: adc: stm32: add support for triggered buffer modeFabrice Gasnier
STM32 ADC conversions can be launched using hardware triggers. It can be used to start conversion sequences (group of channels). Selected channels are select via sequence registers. Trigger source is selected via 'extsel' (external trigger mux). Trigger polarity is set to rising edge by default. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCsMartin Blumenstingl
This adds support for the SAR (Successive Approximation Register) ADC on the Amlogic Meson SoCs. The code is based on the public S805 (Meson8b) and S905 (GXBB) datasheets (see [0] and [1]), as well as by reading (various versions of) the vendor driver and by inspecting the registers on the vendor kernels of my testing-hardware. Currently the GXBB, GXL and GXM SoCs are supported. GXBB hardware has 10-bit ADC resolution, while GXL and GXM have 12-bit ADC resolution. The code was written to support older SoCs (Meson8 and Meson8b) as well, but due to lack of actual testing-hardware no of_device_id was added for these. Two "features" from the vendor driver are currently missing: - the vendor driver uses channel #7 for calibration (this improves the accuracy of the results - in my tests the results were less than 3% off without calibration compared to the vendor driver). Adding support for this should be easy, but is not required for most applications. - channel #6 is connected to the SoCs internal temperature sensor. Adding support for this is probably not so easy since (based on the u-boot sources) most SoC versions are using different registers and algorithms for the conversion from "ADC value" to temperature. Supported by the hardware but currently not supported by the driver: - reading multiple channels at the same time (the hardware has a FIFO buffer which stores multiple results) - continuous sampling (this would require a way to enable this individually because otherwise the ADC would be drawing power constantly) - interrupt support (similar to the vendor driver this new driver is polling the results. It is unclear if the IRQ-mode is supported on older (Meson6 or Meson8) hardware as well or if there are any errata) [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf [1] http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>