summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-04-04iio: imu: adis16400: rename adis16400_core.c -> adi16400.cAlexandru Ardelean2-1/+0
This change does a simple 1-to-1 rename of the adis16400_core.c file. Now that the `adis16400_buffer.c` file was removed, everything can be moved into a single driver file. But first, this rename. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: move burst logic to ADIS libAlexandru Ardelean5-77/+41
This change has been done separately, so that it's easier to visualize the changed logic in the adis_scan_update() function. Most of the function in this `adis16400_update_scan_mode()` that deals with burst-mode will be re-used in the ADIS16480, but with different parameters. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis: generalize burst mode supportAlexandru Ardelean3-4/+25
Some variants in the ADIS16400 family support burst mode. This mechanism is implemented in the `adis16400_buffer.c` file. Some variants in ADIS16480 are also adding burst mode, which is functionally similar to ADIS16400, but with different parameters. To get there, a `adis_burst` struct is added to parametrize certain bits of the SPI communication to setup: the register that triggers burst-mode, and the extra-data-length that needs be accounted for when building the bust-length buffer. The trigger handler cannot be made generic, since it's very specific to each ADIS164XX family. A future enhancement of this `adis_burst` mode will be the possibility to enable/disable burst-mode. For the ADIS16400 family it's hard-coded to on by default. But for ADIS16480 there will be a need to disable this. When that will be implemented, both ADIS16400 & ADIS16480 will have the burst-mode enable-able/disable-able. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16400: move trigger handler into adis16400_coreAlexandru Ardelean3-43/+46
The trigger handler for the ADIS16400 is very different from the generic one in the ADIS library. Keeping it in a separate file won't make much sense once the update_scan_mode function will be made more generic and moved into the ADIS library. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7280a: Remove CamelCase notationCristian Sicilia1-6/+5
Fix CamelCase naming. Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7280a: Adding temp var to improve readabilityCristian Sicilia1-30/+25
Creating a temporary variable to improve readability Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7280a: Avoid precedence issues in macroCristian Sicilia1-3/+4
Enclosing parameter with parenthesis due to avoid possible precedence issue. Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04MAINTAINERS: add maintainer for maxbotix ultrasonic driverAndreas Klinger1-0/+7
add a maintainer for the newly created ultrasonic driver family of maxbotix Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04mb1232.c: add distance iio sensor with i2cAndreas Klinger3-0/+285
Add I2CXL-MaxSonar ultrasonic distance sensors of types mb1202, mb1212, mb1222, mb1232, mb1242, mb7040, mb7137 using an i2c interface Implemented functionality: - reading the distance via in_distance_raw - buffered mode with trigger - make use of interrupt to announce completion of ranging Add mb1232 driver to Kconfig and Makefile Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04dt-bindings: maxbotix,mb1232: Add MaxBotix i2c ultrasonic rangersAndreas Klinger1-0/+29
Add doc for dt binding maxbotix,mb1232. This binding is for MaxBotix I2CXL-MaxSonar ultrasonic rangers which share a common i2c interface. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04dt-bindings: Add vendor prefix for MaxBotixAndreas Klinger1-0/+1
Add MaxBotix, which is a vendor of ultrasonic rangers in different varieties and interfaces. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: hmc5843: fix potential NULL pointer dereferencesKangjie Lu2-2/+12
devm_regmap_init_i2c may fail and return NULL. The fix returns the error when it fails. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad5933: add ABI documentationMarcelo Schmitt1-7/+12
Add an ABI documentation for the ad5933 driver. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad5933: change help rule messageMarcelo Schmitt1-1/+1
Remove the previous comment about direct access via sysfs which would lead one think ad5933 driver has limitations it actually doesn't. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad5933: add SPDX identifierMarcelo Schmitt1-2/+1
Add SPDX identifier of GPL-2.0 for the ad5933 driver. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad5933: organize includesMarcelo Schmitt1-9/+9
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-04staging: iio: ad5933: change multi-line comment styleMarcelo Schmitt1-3/+6
Make multi-line comments compliant with the preferred code style. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add device tree bindingRenato Lui Geh1-0/+48
Adds a device tree binding for the ad7780 driver. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: moving ad7780 out of stagingRenato Lui Geh5-14/+13
Move ad7780 ADC driver out of staging and into the mainline. The ad7780 is a sigma-delta analog to digital converter. This driver provides reading voltage values and status bits from both the ad778x and ad717x series. Its interface also allows writing on the FILTER and GAIN GPIO pins on the ad778x. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add new copyright holderRenato Lui Geh1-0/+1
This patch adds a new copyright holder to the ad7780 driver. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add SPDX identifierRenato Lui Geh1-2/+1
Add SPDX identifier (GPL-2.0) to the AD7780 driver. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: move regulator to after GPIO initRenato Lui Geh1-10/+10
To maintain consistency between ad7780_probe and ad7780_remove orders, regulator initialization has been moved to after GPIO initializations. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging:iio:ad7780: add chip ID values and maskRenato Lui Geh1-0/+6
The ad7780 supports both the ad778x and ad717x families. Each chip has a corresponding ID. This patch provides a mask for extracting ID values from the status bits and also macros for the correct values for the ad7170, ad7171, ad7780 and ad7781. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: set pattern values and masks directlyRenato Lui Geh1-11/+9
The AD7780 driver contains status pattern bits designed for checking whether serial transfers have been correctly performed. Pattern macros were previously generated through bit fields. This patch sets good pattern values directly and masks through GENMASK. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add filter reading to ad778xRenato Lui Geh1-4/+14
This patch adds the new feature of reading the filter odr value for ad778x chips. This value is stored in the chip's state struct whenever a read or write call is performed on the chip's driver. This feature requires sharing SAMP_FREQ. Since the ad717x does not have a filter option, the driver only shares the relevant info mask for the ad778x family. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add gain reading to ad778xRenato Lui Geh1-0/+5
This patch adds a new functionality of reading gain values from the ad778x chips. This value is stored in the chip's state struct and is updated whenever a read or write call is performed on the driver. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add missing switch default caseRenato Lui Geh1-0/+2
This patch simply adds a missing switch default case in read_raw. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add gain & filter gpio supportRenato Lui Geh1-18/+96
Previously, the AD7780 driver only supported gpio for the 'powerdown' pin. This commit adds suppport for the 'gain' and 'filter' pin. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04dt-bindings: iio: adc: lpc32xx-adc: Document vref-supplyGregory CLEMENT1-0/+5
As most of the other ADC the lpc32xx one use a vref-supply property: document it. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: lpc32xx: Add scale featureGregory CLEMENT1-6/+38
Until now this driver only exposed the raw value of the channels. With this patch, the scale value is also exposed. It depends of a regulator supply, and unlike most of the other driver, do not having this regulator won't prevent to use the driver. The reason for it is to allow to continue to use this driver with an old device tree. If there is no regulator supply then the scale won't be exposed. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: lpc32xx: Cleanup headersGregory CLEMENT1-5/+0
A few headers is useless: remove them. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: lpc32xx: Sort headersGregory CLEMENT1-10/+9
Sort the headers in alphabetic order in order to ease the maintenance for this part. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Convert platform data to DT propertiesMircea Caprioru2-19/+21
This patch will remove platform data members and replace them with device tree properties. These properties will be subject to further modifications and probably replaced with other functionalities at some point in time. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04dt-bindings: iio: imu: st_lsm6dsx: add lsm6dsox device bindingsLorenzo Bianconi1-0/+1
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: st_lsm6dsx: add support to LSM6DSOXLorenzo Bianconi6-4/+17
Add support to STM LSM6DSOX 6-axis (acc + gyro) Mems sensor https://www.st.com/resource/en/datasheet/lsm6dsox.pdf Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Report error directly in ad7192_setupMircea Caprioru1-8/+5
This patch removes the goto out statement and uninformative print message. This improves readability. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Use DT clock bindingMircea Caprioru2-28/+58
This patch replaces the platform data clock select member with DT clock binding. Through the DT the external clock binding is specified. If this is not provided then the device will use the internal clock source. With the external clock binding there is the option to use a clock or a crystal as the clock source. When an external crystal is used it is connected to MCLK1 and MCLK2 pins. If the external clock is used only MCLK2 pin will be connected. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Fix identationMircea Caprioru1-2/+2
This patch fixes the odd indentation inside function ad7192_calibrate_all. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: ad7124 fix indentation issue, remove extra tabColin Ian King1-1/+1
A return statement is indented one level too deeply; clean this up by removing a tab. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Switch to SPDX identifier.Enric Balletbo i Serra5-46/+6
Adopt the SPDX license identifier headers to ease license compliance management. Also fix MODULE_LICENSE for cros_ec_accel_legacy to match the SPDX and boiler plate license. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Add kernel-doc for cros_ec_sensors_read_lpcGwendal Grignou1-0/+11
Document cros_ec_sensors_read_lpc, adding an additional note to explain that this is the safe function for reading the EC data. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Drop unnecessary include filesGuenter Roeck5-7/+0
The cros_ec sensors drivers do not call any sysfs functions or use any sysfs defines, and thus do not need to include linux/sysfs.h. Also, some cros_ec drivers include linux/delay.h and is not used. Signed-off-by: Guenter Roeck <groeck@chromium.org> [remove linux/delay.h] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: pressure: bmp280: BMP280 calibration to entropyLinus Walleij1-0/+6
The BMP280/BME280 calibration data should also go into the entropy pool, like we do for BMP180. This just adds the temperature and pressure calibration, the humidity calibration seems like too much annoying calls to add. Cc: Tomasz Duszynski <tduszyns@gmail.com> Cc: Stefan Tatschner <stefan.tatschner@gmail.com> Cc: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04dt-bindings: iio: imu: adis16480: Document external clockStefan Popa1-0/+36
Add documentation for optional use of external clock. All devices supported by this driver can work with an external clock in sync mode. Another mode, called Pulse Per Second (PPS) is supported only by adis1649x devices. The mode is selected by using the "clock-names" property. The pin which is used as external clock input is selected by using a custom optional property called "adi,ext-clk-pin". If this field is left empty, DIO2 is assigned as default external clock input pin. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: imu: adis16480: Add support for external clockStefan Popa1-7/+179
Inertial sensor data collection and processing can be controlled by configuring one of the DIOx lines as an external clock input. This option is available for all devices supported by this driver. However, only adis1649x devices support different modes for the external clock. Sync mode is supported by all devices. In this mode, the output data rate is equal with the clock frequency divided by DEC_RATE + 1. This mode of calculation is similar with the case when the internal clock is used. Pulse Per Second (PPS) Mode, is only supported by adis1649x devices. In this mode, the output data rate is equal to the product of the external clock frequency and the scale factor in the SYNC_SCALE register. This patch uses the "clock-names" property to enable the external clock in one of the two supported modes: "sync" or "pps". This property is optional. If it is not specified, the internal clock is used. This patch also offers the option to select the DIOx line to be used as an external clock input via the custom "adi,ext-clk-pin" property. If this field is left empty, DIO2 is assigned as default external clock input pin. Each DIOx pin supports only one function at a time (data ready line selection or external clock input). Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio:dac:ad5064 mlock cleanup - move to a local lock.Jonathan Cameron1-6/+9
indio_dev->mlock is intended to protect state transitions in the core. It's scope is tightly defined. For device specific uses such as those made here, we should define a local lock allowing the scope of the lock to be defined near to what it is protecting. These mlock changes can be non obvious, but given we don't do anything other than direct for DACs, these ones are easy to do. If anyone wants to help with this particular effort it would be most welcome! Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04drivers: iio: Kconfig: pedantic cleanupEnrico Weigelt, metux IT consult9-225/+225
Formatting of Kconfig files doesn't look so pretty, so just take damp cloth and clean it up. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isrNathan Chancellor1-3/+2
When building with -Wsometimes-uninitialized, Clang warns: drivers/iio/adc/stmpe-adc.c:204:13: warning: variable 'data' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] Clang can't tell that data will never be used uninitialized because the two if statements take care of all cases. Remove the first if statement and make it the else branch of the second one so that it is apparent to Clang that all cases are covered. Link: https://github.com/ClangBuiltLinux/linux/issues/387 Suggested-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: NIck Desaulniers <ndesaulniers@google.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_dataNathan Chancellor1-1/+1
When building with -Wsometimes-uninitialized, Clang warns: drivers/iio/common/ssp_sensors/ssp_iio.c:95:6: warning: variable 'calculated_time' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] While it isn't wrong, this will never be a problem because iio_push_to_buffers_with_timestamp only uses calculated_time on the same condition that it is assigned (when scan_timestamp is not zero). While iio_push_to_buffers_with_timestamp is marked as inline, Clang does inlining in the optimization stage, which happens after the semantic analysis phase (plus inline is merely a hint to the compiler). Fix this by just zero initializing calculated_time. Link: https://github.com/ClangBuiltLinux/linux/issues/394 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: proximity: as3935: fix use-after-free on device removeSven Van Asbroeck1-29/+21
This driver's probe() uses a mix of devm_ and non-devm_ functions. This means that the remove order will not be the exact opposite of the probe order. Remove order: 1. remove() executes: iio_device_unregister iio_triggered_buffer_cleanup iio_trigger_unregister (A) 2. core frees devm resources in reverse order: free_irq iio_trigger_free iio_device_free In (A) the trigger has been unregistered, but the irq handler is still registered and active, so the trigger may still be touched via interrupt -> as3935_event_work. This is a potential use-after-unregister. Given that the delayed work is never canceled explicitly, it may run even after iio_device_free. This is a potential use-after-free. Solution: convert all probe functions to their devm_ equivalents. Add a devm callback, called by the core on remove right after irq_free, which explicitly cancels the delayed work. This will guarantee that all resources are freed in the correct order. As an added bonus, some boilerplate code can be removed. Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>