summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
AgeCommit message (Collapse)AuthorFilesLines
2020-05-25Merge 5.7-rc7 into staging-nextGreg Kroah-Hartman1-5/+12
We need the staging/iio fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-11staging: iio: ad5933: attach life-cycle of kfifo buffer to parent device and ↵Alexandru Ardelean1-40/+37
use managed calls throughout This change makes the use of devm_iio_kfifo_allocate() to attach the life-cycle of the kfifo buffer to the parent (client->dev) object. This removes the need to explicitly free 'indio_dev->buffer' via iio_kfifo_free(), which is the main intent. Having done this, it is straight forward to move to devm_ calls throughout and drop the remove function. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-05-03staging: iio: ad2s1210: Fix SPI readingDragos Bogdan1-5/+12
If the serial interface is used, the 8-bit address should be latched using the rising edge of the WR/FSYNC signal. This basically means that a CS change is required between the first byte sent, and the second one. This change splits the single-transfer transfer of 2 bytes into 2 transfers with a single byte, and CS change in-between. Note fixes tag is not accurate, but reflects a point beyond which there are too many refactors to make backporting straight forward. Fixes: b19e9ad5e2cb ("staging:iio:resolver:ad2s1210 general driver cleanup.") Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-23Merge tag 'iio-for-5.8a' of ↵Greg Kroah-Hartman1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new IIO device support, features and cleanup for the 5.8 cycle Usual mix of new drivers, new support in old drivers and lots of minor cleanup. Yaml conversions also continue to trickle in (plenty more to go!) New device support * ad7476 - Add ad7091 support (ID only) * ad9467 - New driver for this 200/250 MSPS adi-axi-adc and SPI attached ADC. * adi-axi-adc - New driver to support ADIs generic AXI ADC IP core, used to provide high speed interfaces to ADCs (JESD204B/C or parallel interfaces). Usually paired with a device using a slow configuration interface (spi etc) Includes DT bindings and some fixes for fpga headers. * bmg160 - Add support for BMI088 (ID only) * max1241 - New driver for this ADC. * st_sensors - Add support for LIS2HH12 accelerometer * sx9310 - New driver supporting sx9310 and sx9311 proximity sensors. Yaml DT binding conversions * rockchip-saradc (including adding some missing parts) * stm32-dac * tsl2563 * vcnl4000 Features * st_lsm6dsx - Add LIS3MDL as a possible sensor hub device. * vcnl4000 - Add new concept of near level (from DT) to provide to userspace which often needs to have some calibrated concept of 'near'. Cleanups, minor fixes etc. * core - Use snprintf for functions where strings are built and there is potential for overflow. - Correct docs to indicate mlock should not be used directly by drivers. - Fix up accidental dropping of a patch to use bitmap_zalloc. - Stop allowing enabling of buffers with no channels enabled. - Drop unused 'stufftoread' from iio_buffer. - Drop scan_el_attrs form iio_buffer as unused. - Reorder sanity checks in __iio_device_register to fail earlier. - Drop all the devm_ runregister / free functions from IIO as they were never used and encourage poor design. * dma-buffer - Tidy up includes. * dma-engine-buffer - Provide dev-managed allocator. - Fix an issue with printing a size_t * cross subsystem (kxsd9, bmg160, mpu3050, bmi160, mpu6050, bmc150) - Replace some unnecessary casts of error ptrs and whilst there. use the %pe printf parameter to print them in a more useful fashion. * cross subsystem - Drop casts in calls to regmap_bulk_read as they make no sense. - Use devm_platform_ioremap_resource to reduce boilerplate. - Fix typos in Analog Devices. * counters/104-quad - Add Syed Nayyar Waris as an additional maintainer. * ad7476 - Generate CONVST signal internally rather than requiring external trigger. Add sysfs read back as can now do so. - use devm_add_action_or_reset to tidy up error and remove handling. * ad7793 - Switch to read_avail from explicit attribute. Mostly done to avoid confusing people with a - sign (without surounding spaces) that was correct but checkpatch didn't like. * adis library - Add missing newlines at end of error messages. * adis16400 - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR. * adis16460 - Use DEFINE_DEBUGS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTR. * ad_sigma_delta - Move some channel definitions into individual drivers to avoid having to deal with complex options. * ak8974 - Silence an error on deffered probe. * bmp280 - Harden against IRQ before registration. - Convert to read_avail instead of opencoding the equivalent. - Explicitly mark GPIO as optional. - Cleanup casts. - Remove line breaks from strings. * htts221 - Replace direct access to platform_data with dev_get_platdata(). - Use device properties rather than device tree ones to allow ACPI probing. - Casting cleanups. * intel_mrfld_adc - Don't use unaligned accessor for aligned data. * isl29125 - Reorder buer pre and post hooks to allow for coming core rework. * ltc2983 - Remove comp to bool. * max1363 - Stop using mlock from the iio_dev directly in favour of a local lock with clearly defined scope. * max30100 - Use generic device properties to allow ACPI probe. * mpu6050 - Convert to i2c_new_client_device. - Add debugfs register access. * st_lsm6dsx - Provide means of configuring full scale on slave device if supported. - Drop include of st_sensors header to get one value. Its not otherwise used by this driver. * st-sensors - Replace direct access to platform_data with dev_get_platdata(). - Casting cleanups. - Avoid splitting strings. * st_uvis25 - Casting cleanups. * tsl2563 - Typo fix. * tsl2772 - scnprintf in a non obvious string building usecase. Note also 'fixes' a wrong calculation of remaining space that couldn't actually cause any trouble as there was lots of room. * xilinx-xadc - Fix Lars-Peter spelling his own name wrong :) + additional typos. * tag 'iio-for-5.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (101 commits) iio: magnetometer: ak8974: Silence deferred-probe error Documentation: ABI: document IIO in_proximity_nearlevel file iio: vcnl4000: Export near level property for proximity sensor dt-bindings: iio: light: vcnl4000: Add proximity-near-level dt-bindings: iio: Introduce common properties for iio sensors dt-bindings: iio: vcnl4000: convert bindings to YAML format iio: Fix misspellings of "Analog Devices" iio: light: isl29125: fix iio_triggered_buffer_{predisable,postenable} positions iio: adc: fsl-imx25-gcq: Use devm_platform_ioremap_resource iio: adc: at91-adc: Use devm_platform_ioremap_resource iio: adc: sun4i-gpadc-iio: Use devm_platform_ioremap_resource iio:light:ltr501: Drop unnecessary cast of parameter in regmap_bulk_read iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk* iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions. iio:chemical:bme680: Tidy up parameters to regmap_bulk_read iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls iio: imu: st_lsm6dsx: drop huge include in sensor-hub driver iio: buffer: drop devm_iio_kfifo_free() API call iio: buffer: drop devm_iio_hw_consumer_free() API call ...
2020-04-19iio: Fix misspellings of "Analog Devices"Geert Uytterhoeven1-1/+1
According to https://www.analog.com/, the company name is spelled "Analog Devices". Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-23staging: iio: adc: ad7280a: Add comments to clarify stringified argumentsDeepak R Varma1-0/+4
Checkpatch would flash a check message around a stringified macro argument containing a '-' character. Add comment to indicate the argument is legitimate and doesn't need fixing. Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com> Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/469bf8db1c228913e72841367182fba2168fe795.1584904896.git.mh12gx2825@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-08staging: iio: update TODORohit Sarkar1-7/+1
Since there are no uses of the old GPIO API, remove the item from the TODO. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08staging: iio: adc: ad7192: move out of stagingAlexandru Tachici3-1047/+0
Move ad7192 ADC driver out of staging into mainline. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08Documentation: ABI: testing: ad7192: update sysfs docsAlexandru Tachici1-20/+0
Updated mainline documentation on ad7192 userspace sysfs. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08staging: iio: adc: ad7192: removed spi_device_idAlexandru Tachici1-22/+11
This patch removes spi_device_id table and moves the init data (id of the chip) in the .data field of of_device_id table. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08staging: iio: adc: ad7192: modify iio_chan_spec arrayAlexandru Tachici1-46/+66
This patch changes the static const struct iio_chan_spec arrays in a way that all the necessary attributes are set at compile time. Now ad7192_channels_config only makes the channels attribute of iio_dev point to the right array depending on the chip. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08staging: iio: adc: ad7192: fail probe on get_voltageAlexandru Tachici1-2/+5
This patch makes the ad7192_probe fail in case regulator_get_voltage will return an error or voltage is set to 0. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08iio: imu: adis: Add self_test_reg variableNuno Sá2-0/+2
This patch adds a dedicated self_test_reg variable. This is also a step to let new drivers make use of `adis_initial_startup()`. Some devices use MSG_CTRL reg to request a self_test command while others use the GLOB_CMD register. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-01-12iio: adis: Remove startup_delayNuno Sá2-2/+0
All timeouts are now handled by a dedicated timeout struct. This variable is no longer needed. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-01-12iio: adis: Introduce timeouts structureNuno Sá2-0/+14
The adis library only allows to define a `startup_delay` which for some devices is enough. However, other devices define different timeouts with significantly different timings which could lead to devices to not wait enough time or to wait a lot more than necessary (which is not efficient). This patch introduces a new timeout struct that must be passed into `adis_init()`. There are mainly, for now, three timeouts used. This is also an introductory patch with the goal of refactoring `adis_initial_startup()`. New driver's (eg: adis16480, adis16460) are replicating code for the device initial setup. With some changes (being this the first one) we can pass this to `adis_initial_startup()`. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-12-15staging: iio: accel: adis16240: enforce SPI mode on probe functionRodrigo Carvalho1-0/+7
According to the datasheet, this driver supports only SPI mode 3, so we should enforce it on probe function. Signed-off-by: Rodrigo Carvalho <rodrigorsdc@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-18staging: iio: ad9834: add a check for devm_clk_getChuhong Yuan1-0/+4
ad9834_probe misses a check for devm_clk_get and may cause problems. Add a check like what ad9832 does to fix it. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-15staging: iio: ADIS16240: Remove unused includeRohit Sarkar1-1/+0
'#include<linux/gpio.h>' isn't being used anywhere. Remove it. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-08staging: iio: adc: ad7192: Add system calibration supportMircea Caprioru1-1/+78
This patch will add a system calibration attribute for each channel. Using this option the user will have the ability to calibrate each channel for zero scale and full scale. It uses the iio_chan_spec_ext_info and IIO_ENUM to implement the functionality. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18staging: iio: accel: adis16240: Improve readability on write_raw functionRodrigo Ribeiro1-4/+1
Replace shift and minus operation by GENMASK macro and remove the local variables used to store intermediate data. Signed-off-by: Rodrigo Ribeiro Carvalho <rodrigorsdc@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18staging: iio: adc: ad7192: Add low_pass_3db_filter_frequencyMircea Caprioru1-16/+133
By adding this option we are able to remove the sync3 field and dt binding. When setting the required cutoff frequency we also determine the ADC configuration for chop and sync filter. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18staging: iio: adc: ad7192: Remove platform dataMircea Caprioru2-49/+2
This patch removes the reference voltage entry from the platform_data structure. This is no longer needed since the reference voltage is obtained from the device tree. With this we also remove the entire ad7192.h file. The undefined reference voltage warning is promoted to an error signaling a problem with the device tree. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-07-27staging: iio: ad2s1210: Use device-managed APIChuhong Yuan1-11/+1
Use device-managed API to simplify the code. The remove function is redundant now and can be deleted. Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-07-27staging: iio: ad7192: create of_device_id arrayBárbara Fernandes1-0/+12
Create list of compatible device ids to be matched with those stated in the device tree. Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br> Signed-off-by: Wilson Sales <spoonm@spoonm.org> Co-developed by: Wilson Sales <spoonm@spoonm.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-07-01Merge tag 'iio-for-5.3b' of ↵Greg Kroah-Hartman7-42/+74
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of IIO device support, features, cleanups and minor fixes for 5.3. A few bits for the counters subsystem mixed in here as well. There are some late breaking fixes as well, which aren't so urgent they can't wait for the merge window. New Device Support * adf4371 - New driver + bindings. - Support the adf4372 PLL. Mostly ID and bindings. * ad8366 (note includes rework of driver needed to allow support for these). - Support the ADL5240 variable gain amplifier (VGA). - Support the ADA4961 digital gain amplifier (DGA). * dps310 - New driver, in several parts from different authors for this temp and pressure sensor. - Includes errata workaround for a temperature reading issue. * stk3310 - Support the stk3335, mostly ID. Features and cleanups * core - drop error handling on debugfs registration. - harden by making sure we don't overrun iio_chan_info_postfix. * docs - convert remaining docs to rst. At somepoint we'll fit these few into the main IIO docs. - improve sampling_frequency_available docs but explaining the range form. * ad_sigma_delta - Drop a pointless goto. * ad2s1210 - Drop pointless platform data null check seeing as we don't actually use platform data anymore. * ad7124 - Relax limitation on channel numbers to allow pseudo different channels. - Support control of whether the input is buffered via DT. - Use dynamic allocation for channel configuration to make it easier to support new devices. - YAML binding conversion. * ad7150 - Comment tidy up. - Consistent and simple if (ret) handling of i2c errors. - FIELD_GET and GENMASK. - Ternary rather than !!(condition) for readability. - Use macros to avoid repetition of channel definitions. * ad7606 - Add software channel config (rather that pin controlled) - Refactor to simplify addition of new part in future. * ad7746 - of_deivce_id table. * ad7780 - MAINTAINERS entry - YAML DT bindings. * ad8366 - Stop using core mlock in favour of well scoped local lock. - SPDX + copyright date update. * ad9834 - of_device_id table * adf4371 - Add support for output stage muting before lock on has occured. * adis library - MAINTAINERS entry to reflect that this now Alexandru's problem ;) * adis162xx: - Fix a slightly incorrect set of comments and print statements on minimum supported voltage. * adis16203 - of_device_id table. * adis16240 - Add of_device_id table (in two parts as first patch only used it for MODULE_DEVICE_TABLE.) * adt7316-spi - of_device_id table * adxl372 - YAML DT binding conversion. - Cleanup use of buffer callback functions (precursor to core rework). * bh1710 - Simplify getting the i2c adapter from the client. * dht11 - Mote to newer GPIO consumer interface. * kxcjk-1013.c - Add binding for sensor in display of some ultrabooks after userspace tools updated for it not be a problem to report two similar sensors. * imx7d - drop unused variables. - white space - define instead of variable for clock frequency that is fixed. - drop pointless error message. * messon_saradc - SPDX * sps30 - MAINTAINERS entry - YAML binding conversion. * st_accel - Tidy up ordering in various buffer related callbacks. This is part of a long running effort to simplify the core code. * stm32-dfsdm: - Manage the resolution cleanly in triggerd modes. - Add fast mode support which allows more flexible filter choices. - Add a comment on the reason for a 16 bit record when technically not 'required'. * st_lsm6dsx - Embed device name in the sensor_settings struct as i3c doesn't have a convenient name field to use for this. * xilinx-adc - Relax constraints on supported platforms to reflect that this can used with FPGAs on PCIe cards and hence many architectures. * counters/ftm-quaddec - Fix some formatting io MODULE_AUTHOR - MAINTAINERS entry Fixes * tools - fix incorrect handling of 32 bit channels. * sca3000 - Potential endian bug that is unlikely to bite anyone (be64 host seems unlikely for this old part). * stm32-adc - Add vdda-supply. On some boards it needs to be turned on to supply the ADC. DT bindings included. * stm32-dfsdm - Fix output resolution to work with filter orders other than 3. - Fix output datatype as it's signed and previously claimed not to be. * tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits) iio: iio-utils: Fix possible incorrect mask calculation iio: frequency: adf4371: Add support for output stage mute dt-bindings: iio: frequency: Add ADF4372 PLL documentation iio: frequency: adf4371: Add support for ADF4372 PLL dt-bindings: iio: adc: Add buffered input property Convert AD7124 bindings documentation to YAML format. iio: adc: ad7124: Shift to dynamic allocation for channel configuration iio: adc: ad7124: Add buffered input support iio: adc: ad7124: Remove input number limitation MAINTAINERS: add ADIS IMU driver library entry iio: adis162xx: fix low-power docs & reports counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR iio: core: no need to check return value of debugfs_create functions docs: iio: convert to ReST iio: adc: stm32-adc: add missing vdda-supply dt-bindings: iio: adc: stm32: add missing vdda supply iio: adc: stm32-dfsdm: add comment for 16 bits record iio: adc: stm32-dfsdm: add fast mode support iio: adc: stm32-dfsdm: manage data resolution in trigger mode iio: adc: stm32-dfsdm: fix data type ...
2019-06-26iio: adis162xx: fix low-power docs & reportsAlexandru Ardelean2-3/+3
All current ADIS162XX drivers have incorrect values defined via comments. Also, when an error is reported the printed value is incorrect. The functionality itself isn't affected, so it's not a critical issue. And since the change is trivial, it was included in a single patch that fixes these in one go. All values were correlated with the ones specified in the data-sheets. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-23Merge 5.2-rc6 into staging-nextGreg Kroah-Hartman2-9/+13
We want the fixes and this resolves a merge issue as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-17staging: iio: ad7150: clean up of commentsMelissa Wen1-9/+2
General cleaning of comments to remove useless information or improve description. Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-17staging: iio: ad7150: simplify i2c SMBus return treatmentMelissa Wen1-7/+2
Since i2c_smbus_write_byte_data returns no-positive value, this commit making the treatment of its return value less verbose. Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-17staging: iio: ad7150: use FIELD_GET and GENMASKMelissa Wen1-1/+5
Use the bitfield macro FIELD_GET, and GENMASK to do the shift and mask in one go. This makes the code more readable than explicit masking followed by a shift. Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-17staging: iio: ad7150: use ternary operating to ensure 0/1 valueMelissa Wen1-2/+2
Remove idiom and use ternary operator for consistently trigger 0/1 value on variable declaration. Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-17staging: iio: ad2s1210: Remove platform data NULL check in probeAlexandru Ardelean1-3/+0
The driver only needs to access GPIOs via GPIOLIB. And SPI can be configured via device-tree or ACPI. The platform data is a remnant from another time, and should not cause the driver to error out during probing if it is NULL. Also, it's not used. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-06-08staging: iio: adt7316: Fix build errors when GPIOLIB is not setFabio Estevam1-1/+2
On x86_64 when GPIOLIB is not set the following build errors are seen: drivers/staging/iio/addac/adt7316.c:947:3: error: implicit declaration of function 'gpiod_set_value' [-Werror=implicit-function-declaration] drivers/staging/iio/addac/adt7316.c:1805:2: error: implicit declaration of function 'irqd_get_trigger_type' [-Werror=implicit-function-declaration] These functions are provided by the <linux/gpio/consumer.h> and <linux/irq.h> headers, so include them to fix these build errors. While at it, remove <linux/gpio.h> as this driver is a GPIO consumer and not a GPIO driver. Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-27staging:iio:ad7150: fix threshold mode config bitMelissa Wen1-8/+11
According to the AD7150 configuration register description, bit 7 assumes value 1 when the threshold mode is fixed and 0 when it is adaptive, however, the operation that identifies this mode was considering the opposite values. This patch renames the boolean variable to describe it correctly and properly replaces it in the places where it is used. Fixes: 531efd6aa0991 ("staging:iio:adc:ad7150: chan_spec conv + i2c_smbus commands + drop unused poweroff timeout control.") Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: adis16240: add of_match_table entryRodrigo Ribeiro1-0/+1
This patch adds of_match_table entry in device driver in order to enable spi fallback probing. Signed-off-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: ad7746: add device tree supportJoão Seckler1-0/+10
Add a of_device_id struct variable and subsequent call to MODULE_DEVICE_TABLE macro to support device tree. Signed-off-by: João Seckler <joaoseckler@gmail.com> Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com> Co-developed-by: Lucas Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: adis16240: add device to module device tableLucas Oshiro1-0/+6
Add a of_device_id struct and MODULE_DEVICE_TABLE call, in order to add device-tree support for this driver. Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com> Co-developed-by: Rodrigo Ribeiro <rodrigorsdc@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: adt7316: create of_device_id arrayBárbara Fernandes1-0/+13
Create structure of type of_device_id in order to register all devices the driver is able to manage. Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br> Signed-off-by: Wilson Sales <spoonm@spoonm.org> Co-developed-by: Wilson Sales <spoonm@spoonm.org> Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: adis16203: Add of_device_id tableThiago Estrela1-0/+8
Accomplish device tree compatibility to driver ADIS16203 by adding of_device_id table and making a subsequent call to MODULE_DEVICE_TABLE. Signed-off-by: Thiago Estrela <thiagestrela@gmail.com> Signed-off-by: Tiago Napoli <napoli.tiago96@gmail.com> Co-developed-by: Tiago Napoli <napoli.tiago96@gmail.com> Signed-off-by: Pedro Sousa <pedroteosousa@gmail.com> Co-developed-by: Pedro Sousa <pedroteosousa@gmail.com> Reviewed-by: Matheus Tavares <matheus.bernardino@usp.br> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: ad9834: add of_device_id tableJoão Victor Marques de Oliveira1-0/+11
Add a of_device_id struct array of_match_table variable and subsequent call to MODULE_DEVICE_TABLE macro to enable explicit device tree support. Co-developed-by: Thiago L. A. Miller <tmiller@mochsl.org.br> Signed-off-by: Thiago L. A. Miller <tmiller@mochsl.org.br> Co-developed-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br> Signed-off-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br> Signed-off-by: João Victor Marques de Oliveira <joao.marques.oliveira@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-26staging: iio: cdc: ad7150: create macro for capacitance channelsBárbara Fernandes1-17/+12
Create macro for capacitance channels in order to remove the repeated code and improve its readability. Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br> Signed-off-by: Wilson Sales <spoonm@spoonm.org> Co-developed-by: Wilson Sales <spoonm@spoonm.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-05staging: iio: adc: Add paragraph to describe Kconfig symbolVatsala Narang1-0/+3
This patch updates Kconfig with paragraph that describe config symbol fully.Issue addressed by checkpatch. Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-05staging: iio: adt7316: match parenthesis alignmentJoão Seckler1-1/+1
This patch solves the following checkpatch.pl message: CHECK: Alignment should match open parenthesis. This makes the file more compliant with the preferred coding style for the Linux kernel. Signed-off-by: João Seckler <joaoseckler@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-25Merge tag 'iio-for-5.2b' of ↵Greg Kroah-Hartman3-20/+34
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of IIO new device support, features and cleanup for the 5.2 cycle. New device suport * ad7606 - Support the AD7616 16 channel, 12bit ADC. * fxas21002c - New driver for this gyroscope with I2C and SPI support. * lsm6dsx - Support the lsm6dsr, new device information structure and dt bindings. * srf04 - Addition device IDs for mb1000, mb1010, mb1020, mb1030 and mb1040 + support of different required trigger pulse lengths. * st-accel - Support the ls2de12, new device info and dt bindings. * ti-ads8344 - New driver for this 8 channel, 16 bit SPI ADC. Binding conversions to yaml - we have started doing these in general for IIO. * avia-hx711 * bmp085 Cleanups and minor fixes / additions * ad5758 - Fixup for some changes between preproduction parts and final part. * ad7606 - Refactor handling of oversampling to make it easy to vary between supported devices. * ad9832 - Organise includes. - Clock framework to handle clocks. * ad9834 - Drop unnecessary parenthesis. * bmc150 - Use __func__ rather than hardcoding. * dummy_evgen. - Fix a memleak on error in probe. * kxcjk1013 - Add KXCJ91008 ACPI ID as seen in the wild. - Use __func__ rather than hardcoding. * imx7d - Local dev variable to simplify code a bit. - dev_err replaces pr_err to give more info. - devm_platform_ioremap_resource for small reduction in boilerplate. - Simplify probe and remove by sharing suspend / resume logic. - Devm for iio_device_register as remove only contains the unregister. * lsm6dsx - Remove a variable that was never read. - Open code values where they are effectively described by what is assigned to them rather than using uninformative defines. * max31856 - Avoid an unintialized ret variable in a path that can't actually occur but is hard for a static checker to know. * max9611 - White space * mpu3050 - Reduce a sleep worst case by switching from msleep to usleep_range. * qcom-spmi-adc5 - Add MODULE_DEVICE_TABLE to assist autoloading of this as a module. * stm32-dfsdm - Fix missing dependencies. * stm32-timer trigger - Fix a build issue when disabled. * ti-ads7950 - Fix mising dependency on CONFIG_GPIOLIB. * tag 'iio-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (42 commits) iio: adc: qcom-spmi-adc5: Fix of-based module autoloading iio: dummy_evgen: fix possible memleak in evgen init iio:accel:Switch hardcoded function name with a reference to __func__ making the code more maintainable iio: adc: stm32-dfsdm: fix triggered buffer build dependency iio: adc: stm32-dfsdm: fix unmet direct dependencies detected iio: trigger: stm32-timer: fix build issue when disabled iio: imx7d_adc: Use devm_iio_device_register() iio: imx7d_adc: Simplify imx7d_adc_remove() with imx7d_adc_suspend() iio: imx7d_adc: Simplify imx7d_adc_probe() with imx7d_adc_resume() drivers/iio/gyro/mpu3050-core.c: This patch fix the following checkpatch warning. iio: dac: ad5758: Modifications for new revision iio: imu: st_lsm6dsx: inline per-sensor data iio: adc: Add driver for the TI ADS8344 A/DC chips dt-bindings: iio: adc: Add bindings for TI ADS8344 A/DC chips MAINTAINERS: add entry for fxas21002c gyro driver iio: gyro: fxas21002c: add spi driver iio: gyro: fxas21002c: add i2c driver iio: gyro: add core driver for fxas21002c iio: gyro: add DT bindings to fxas21002c Kconfig: change configuration of srf04 ultrasonic iio sensor ...
2019-04-21Merge 5.1-rc6 into staging-nextGreg Kroah-Hartman2-5/+5
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-14staging: iio: ad9832: use clock framework for clock referenceMarcelo Schmitt2-13/+25
Previously external clock were set through platform_data struct. Now device uses clk struct defined in include/linux/clk.h to handle external clock source. It also removes mclk from platform_data struct. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14staging: iio: ad9832: organize includesMarcelo Schmitt1-6/+8
Organize includes to list them in lexicographic order. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-14staging: iio: frequency: ad9834: Remove unnecessary parenthesesMelissa Wen1-1/+1
Remove unneeded parentheses around the arguments of ||. This reduces clutter and code behave in the same way. Change suggested by checkpatch.pl. CHECK: Unnecessary parentheses around 'st->devid == ID_AD9833' CHECK: Unnecessary parentheses around 'st->devid == ID_AD9837' Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04Merge tag 'iio-for-5.2a-2' of ↵Greg Kroah-Hartman9-497/+227
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new device support, features and fixes for IIO in the 5.2 cycle Staging graduations * ad7780 - Move this ADC driver out of staging. Included adding some new features along the way (see below). Also added DT bindings. New device support * adis16480 - Support the ADIS16495 and ADIS16497 IMU devices making heavy use of refactoring of various aspects of the driver in precursor patches. * lsm6dsx - Support for the ASM330LHH 6-axis (accelerometer + gyro) sensor. - Support for the LSM6DS0X * matbotix mb1232 - New driver for this ultrasound ranging device family. Including bindings. - Supports mb1202, mb1212, mb1222, mb1232, mb1242, mb7040 and mb7137. * max31856 - New driver for this thermocouple temperature sensor. * meson saradc - Support the Meson-G12A (ID addition only). * stmpe-adc - New driver supporting generic ADC alongside touchscreen support which previously existed. Includes DT bindings. * vcnl4000 - Support for the vcln4040 proximity and light sensor, including adding DT bindings for this and parts previously supported. Features * core - Allow reading of mount matrices from ACPI in addition to DT. - Common binding for theromcouple types. * ad5933 - Add ABI docs as there are a few 'unsual' elements about this device - perhaps because it's our only impedance analyser. * ad7780 - Add gain and filter gpio support + readback of current gain and filter. * adis16480 - Allow selection fo the dataready pin to be used. - Device tree ID table and binding documentation. - Support external clock modes, including new bindings. * bma180 - Mount matrix support. * bmc150 - Mount matrix support. * bmg160 - Mount matrix support. - DT id table and bindings doc. * bmp280 - Put calibration data into the entropy pool. * hmc5843 - Mount matrix support. * itg3200 - Mount matrix support. * kxcjk1013 - Device tree id table, and binding docs. * lpc32xx - Add scale when regulator specified including DT docs for regulator. * pms7003 - Add device IDs for all supported parts to driver and binding. * stm32-dfsdm - Enable hw consumer support, scan mode control and a complex set of triggered buffer modes. - Power management. * stm32-lptimer-counter - power management. - Document the pinctrl sleep state binding. * ti-ads7950 - GPIO pin support. Cleanups, minor fixes * core - Use bitmap_zalloc to make it explicit that is what we are doing. - Tidy up all the Kconfig files (which had slowly gotten messy) - Fix a forwards definition missing issue in iio/driver.h * ad sigma delta core - Improve handling of SPI bus locking vs CS assertion. This has been wrong a long time so not rushing this in. * ad5064 - Mlock to local lock. * ad5933 (staging cleanup) - Multiline comment fixes. - Include ordering. - SPDX. - Tidy up Kconfig help which was a bit missleading. - Change some non standard attributes to ABI defined ones. * ad7124 - White space fix. * ad7192 - White space. - Use DT clock binding. - Improve error reporting. - Platform data to DT conversion. - Use read_avail callback, mostly to avoid the endless series of patches from new contributors trying to falsely put spaces around the negative sign. * ad7280a - Add brackets to macros to avoid potential precedence isseus. - Add temp vars for event codes to reduce indent and improved readability. - Clean out som CamelCase notation. - White space. * ad7606 - Fix broken file naming in MAINTAINERS. * ad7780 - Missing switch defaults to supress warnings and harden the code slightly. - Set pattern masks more directly. - Add ID values and masks for all supported chips. - SPDX + add Renato as a copyright holder as he has done a lot of work on this driver. - Add brackets to macros to avoid potential precedence issues. * ad7923 - White space fixes. - Use BIT macro to improve readability. - Add brackets to macros to avoid potential precedence issues. - Tidy up a null comparisom. * ad9523 - Fix a typo in naming of variables. * adis16400 - Combine trigger file into main code as no advantage in separate files. Rename core file to just adis16400. - Squash the header into the c file now there is only one file. - Generalize burst mode to support new variants. * ak8975 - Local variable to improve readability around mount matrix support. * as3935 - Avoid potential race by ensuring remove does exact opposite of probe rather than a slightly different order. * cross_ec - Drop some unnecessary includes. - Fix some warning and the slightly 'unusual' code. - Add some docs for non obvious function. - SPDX * hmc5843 - Potential unhandled error case. * iio trigger core - Print an error if there is no available irq due to max consumers per trigger being set to low. * iio loop trigger - Drop an unlikely on IS_ERR as IS_ERR already has the annotation. * ingenic-adc - Drop a redundant dev_err call as devm_ioremap_resource reports the same internally. * lmp91000 - Drop some unncessary parentheses and white space tidy up. - Invert and if statement to improve readability. - Fix a wrong error message. * lpc32xx - Header sorting + drop some unused ones. * mma8542 - Mark a switch fallthrough. * mpu6050 - Add a local variable to improve code readability around mount matrix support. * mxs-lradc-adc - Handle devm_iio_trigger_alloc failure. * sps30 - Fix up a kernel version in the ABI docs. * srf04 - DT binding doc converted to yaml. * ssp_sensors - Supress a clang build warning due to lack of visibility of conditional within a iio_push_to_buffers_with_timestamp. (reasonable false warning!) * st_accel - Drop pointless less than 0 comparisom of unsigned int. * stm32-dfsdm - Improve accuracy of spi_master_frequency calculation. - Improve calculation fo sampling frequency. - Rework various internals to simplify adding triggered buffer support. - Claim direct mode to avoid racing around read_raw and being in buffered mode. * stmpe - Fix a clang false positive warning. * ti-ads7950 - Use local lock rather than using the core mlock when not locking around the device mode. * vcnl4000 - Use word writes instead of byte writes. It seems byte writes are fine for some parts (undocument) but not others that the driver will shortly support. Other * mailmap - Add email address change for Sean Nyekjaer. Update in relevant drivers * tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (129 commits) iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion iio: adc: stm32-dfsdm: add PM support iio: adc: stm32-dfsdm: improve sampling frequency accuracy staging: iio: adc: ad7280a: Tab alignment MAINTAINERS: Fix the link to ad7606 dt-bindings iio:temperature: Add MAX31856 thermocouple support iio:temperature:max31856:Add device tree bind info dt-bindings: iio/temperature: Add thermocouple types (and doc) devantech-srf04.yaml: transform DT binding to YAML iio: frequency: ad9523: Fix typo in ad9523_platform_data iio: Make possible to include driver.h first dt-bindings: iio: add Bosch BMG160 gyroscope sensor iio: gyro: bmg160: add device tree compatibility table staging: iio: adc: ad7192: Use read_avail for available attributes dt-bindings: iio: light: add vcnl4040 devicetree bindings iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor dt-bindings: iio: light: add vcnl4000 devicetree bindings iio: light: vcnl4000 add devicetree hooks iio: light: vcnl4000 use word writes instead of byte writes iio: adc: stm32-dfsdm: claim direct mode for raw read and settings ...
2019-04-04staging: iio: adc: ad7280a: Tab alignmentCristian Sicilia1-18/+18
Aligned some parameters. Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>