platform/kernel/linux-rpi.git
5 years agostaging: iio: adc: ad7280a: Remove CamelCase notation
Cristian Sicilia [Sat, 23 Mar 2019 19:21:49 +0000 (20:21 +0100)]
staging: iio: adc: ad7280a: Remove CamelCase notation

Fix CamelCase naming.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: Adding temp var to improve readability
Cristian Sicilia [Sat, 23 Mar 2019 19:21:45 +0000 (20:21 +0100)]
staging: iio: adc: ad7280a: Adding temp var to improve readability

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>
5 years agostaging: iio: adc: ad7280a: Avoid precedence issues in macro
Cristian Sicilia [Sat, 23 Mar 2019 19:21:42 +0000 (20:21 +0100)]
staging: iio: adc: ad7280a: Avoid precedence issues in macro

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>
5 years agoMAINTAINERS: add maintainer for maxbotix ultrasonic driver
Andreas Klinger [Sun, 17 Mar 2019 20:38:29 +0000 (21:38 +0100)]
MAINTAINERS: add maintainer for maxbotix ultrasonic driver

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>
5 years agomb1232.c: add distance iio sensor with i2c
Andreas Klinger [Sun, 17 Mar 2019 20:38:03 +0000 (21:38 +0100)]
mb1232.c: add distance iio sensor with i2c

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>
5 years agodt-bindings: maxbotix,mb1232: Add MaxBotix i2c ultrasonic rangers
Andreas Klinger [Sun, 17 Mar 2019 20:35:27 +0000 (21:35 +0100)]
dt-bindings: maxbotix,mb1232: Add MaxBotix i2c ultrasonic rangers

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>
5 years agodt-bindings: Add vendor prefix for MaxBotix
Andreas Klinger [Sun, 17 Mar 2019 20:35:00 +0000 (21:35 +0100)]
dt-bindings: Add vendor prefix for MaxBotix

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>
5 years agoiio: hmc5843: fix potential NULL pointer dereferences
Kangjie Lu [Sat, 16 Mar 2019 22:08:33 +0000 (17:08 -0500)]
iio: hmc5843: fix potential NULL pointer dereferences

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>
5 years agostaging: iio: ad5933: add ABI documentation
Marcelo Schmitt [Sat, 16 Mar 2019 15:07:32 +0000 (12:07 -0300)]
staging: iio: ad5933: add ABI documentation

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>
5 years agostaging: iio: ad5933: change help rule message
Marcelo Schmitt [Sat, 16 Mar 2019 15:07:18 +0000 (12:07 -0300)]
staging: iio: ad5933: change help rule message

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>
5 years agostaging: iio: ad5933: add SPDX identifier
Marcelo Schmitt [Sat, 16 Mar 2019 15:07:03 +0000 (12:07 -0300)]
staging: iio: ad5933: add SPDX identifier

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>
5 years agostaging: iio: ad5933: organize includes
Marcelo Schmitt [Sat, 16 Mar 2019 15:06:50 +0000 (12:06 -0300)]
staging: iio: ad5933: organize includes

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>
5 years agostaging: iio: ad5933: change multi-line comment style
Marcelo Schmitt [Sat, 16 Mar 2019 15:06:18 +0000 (12:06 -0300)]
staging: iio: ad5933: change multi-line comment style

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>
5 years agostaging: iio: ad7780: add device tree binding
Renato Lui Geh [Sat, 16 Mar 2019 02:16:13 +0000 (23:16 -0300)]
staging: iio: ad7780: add device tree binding

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>
5 years agostaging: iio: ad7780: moving ad7780 out of staging
Renato Lui Geh [Sat, 16 Mar 2019 02:15:55 +0000 (23:15 -0300)]
staging: iio: ad7780: moving ad7780 out of staging

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>
5 years agostaging: iio: ad7780: add new copyright holder
Renato Lui Geh [Sat, 16 Mar 2019 02:15:26 +0000 (23:15 -0300)]
staging: iio: ad7780: add new copyright holder

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>
5 years agostaging: iio: ad7780: add SPDX identifier
Renato Lui Geh [Sat, 16 Mar 2019 02:15:13 +0000 (23:15 -0300)]
staging: iio: ad7780: add SPDX identifier

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>
5 years agostaging: iio: ad7780: move regulator to after GPIO init
Renato Lui Geh [Sat, 16 Mar 2019 02:14:59 +0000 (23:14 -0300)]
staging: iio: ad7780: move regulator to after GPIO init

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>
5 years agostaging:iio:ad7780: add chip ID values and mask
Renato Lui Geh [Sat, 16 Mar 2019 02:14:27 +0000 (23:14 -0300)]
staging:iio:ad7780: add chip ID values and mask

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>
5 years agostaging: iio: ad7780: set pattern values and masks directly
Renato Lui Geh [Sat, 16 Mar 2019 02:14:14 +0000 (23:14 -0300)]
staging: iio: ad7780: set pattern values and masks directly

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>
5 years agostaging: iio: ad7780: add filter reading to ad778x
Renato Lui Geh [Sat, 16 Mar 2019 02:13:42 +0000 (23:13 -0300)]
staging: iio: ad7780: add filter reading to ad778x

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>
5 years agostaging: iio: ad7780: add gain reading to ad778x
Renato Lui Geh [Sat, 16 Mar 2019 02:13:13 +0000 (23:13 -0300)]
staging: iio: ad7780: add gain reading to ad778x

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>
5 years agostaging: iio: ad7780: add missing switch default case
Renato Lui Geh [Sat, 16 Mar 2019 02:12:53 +0000 (23:12 -0300)]
staging: iio: ad7780: add missing switch default case

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>
5 years agostaging: iio: ad7780: add gain & filter gpio support
Renato Lui Geh [Sat, 16 Mar 2019 02:12:27 +0000 (23:12 -0300)]
staging: iio: ad7780: add gain & filter gpio support

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>
5 years agodt-bindings: iio: adc: lpc32xx-adc: Document vref-supply
Gregory CLEMENT [Fri, 15 Mar 2019 09:52:31 +0000 (10:52 +0100)]
dt-bindings: iio: adc: lpc32xx-adc: Document vref-supply

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>
5 years agoiio: adc: lpc32xx: Add scale feature
Gregory CLEMENT [Fri, 15 Mar 2019 09:52:30 +0000 (10:52 +0100)]
iio: adc: lpc32xx: Add scale feature

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>
5 years agoiio: adc: lpc32xx: Cleanup headers
Gregory CLEMENT [Fri, 15 Mar 2019 09:52:29 +0000 (10:52 +0100)]
iio: adc: lpc32xx: Cleanup headers

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>
5 years agoiio: adc: lpc32xx: Sort headers
Gregory CLEMENT [Fri, 15 Mar 2019 09:52:28 +0000 (10:52 +0100)]
iio: adc: lpc32xx: Sort headers

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>
5 years agostaging: iio: adc: ad7192: Convert platform data to DT properties
Mircea Caprioru [Fri, 15 Mar 2019 11:29:03 +0000 (13:29 +0200)]
staging: iio: adc: ad7192: Convert platform data to DT properties

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>
5 years agodt-bindings: iio: imu: st_lsm6dsx: add lsm6dsox device bindings
Lorenzo Bianconi [Fri, 15 Mar 2019 10:08:25 +0000 (11:08 +0100)]
dt-bindings: iio: imu: st_lsm6dsx: add lsm6dsox device bindings

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add support to LSM6DSOX
Lorenzo Bianconi [Fri, 15 Mar 2019 10:08:24 +0000 (11:08 +0100)]
iio: imu: st_lsm6dsx: add support to LSM6DSOX

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>
5 years agostaging: iio: adc: ad7192: Report error directly in ad7192_setup
Mircea Caprioru [Fri, 15 Mar 2019 11:14:25 +0000 (13:14 +0200)]
staging: iio: adc: ad7192: Report error directly in ad7192_setup

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>
5 years agostaging: iio: adc: ad7192: Use DT clock binding
Mircea Caprioru [Fri, 15 Mar 2019 11:29:02 +0000 (13:29 +0200)]
staging: iio: adc: ad7192: Use DT clock binding

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>
5 years agostaging: iio: adc: ad7192: Fix identation
Mircea Caprioru [Fri, 15 Mar 2019 11:14:24 +0000 (13:14 +0200)]
staging: iio: adc: ad7192: Fix identation

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>
5 years agoiio: adc: ad7124 fix indentation issue, remove extra tab
Colin Ian King [Thu, 14 Mar 2019 23:26:03 +0000 (23:26 +0000)]
iio: adc: ad7124 fix indentation issue, remove extra tab

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>
5 years agoiio: cros_ec: Switch to SPDX identifier.
Enric Balletbo i Serra [Wed, 13 Mar 2019 11:41:20 +0000 (12:41 +0100)]
iio: cros_ec: Switch to SPDX identifier.

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>
5 years agoiio: cros_ec: Add kernel-doc for cros_ec_sensors_read_lpc
Gwendal Grignou [Wed, 13 Mar 2019 11:40:50 +0000 (12:40 +0100)]
iio: cros_ec: Add kernel-doc for cros_ec_sensors_read_lpc

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>
5 years agoiio: cros_ec: Drop unnecessary include files
Guenter Roeck [Wed, 13 Mar 2019 11:40:32 +0000 (12:40 +0100)]
iio: cros_ec: Drop unnecessary include files

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>
5 years agoiio: pressure: bmp280: BMP280 calibration to entropy
Linus Walleij [Tue, 12 Mar 2019 08:40:18 +0000 (09:40 +0100)]
iio: pressure: bmp280: BMP280 calibration to entropy

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>
5 years agodt-bindings: iio: imu: adis16480: Document external clock
Stefan Popa [Mon, 11 Mar 2019 09:46:37 +0000 (11:46 +0200)]
dt-bindings: iio: imu: adis16480: Document external clock

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>
5 years agoiio: imu: adis16480: Add support for external clock
Stefan Popa [Mon, 11 Mar 2019 09:45:29 +0000 (11:45 +0200)]
iio: imu: adis16480: Add support for external clock

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>
5 years agoiio:dac:ad5064 mlock cleanup - move to a local lock.
Jonathan Cameron [Wed, 20 Feb 2019 18:23:44 +0000 (18:23 +0000)]
iio:dac:ad5064 mlock cleanup - move to a local lock.

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>
5 years agodrivers: iio: Kconfig: pedantic cleanup
Enrico Weigelt, metux IT consult [Wed, 6 Mar 2019 14:52:23 +0000 (15:52 +0100)]
drivers: iio: Kconfig: pedantic cleanup

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>
5 years agoiio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isr
Nathan Chancellor [Thu, 7 Mar 2019 17:16:04 +0000 (10:16 -0700)]
iio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isr

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>
5 years agoiio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data
Nathan Chancellor [Thu, 7 Mar 2019 21:45:46 +0000 (14:45 -0700)]
iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data

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>
5 years agoiio: proximity: as3935: fix use-after-free on device remove
Sven Van Asbroeck [Fri, 8 Mar 2019 17:59:35 +0000 (12:59 -0500)]
iio: proximity: as3935: fix use-after-free on device remove

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>
5 years agoiio:potentiostat:lmp91000: change dev_err message
Anderson Reis [Fri, 8 Mar 2019 19:46:55 +0000 (16:46 -0300)]
iio:potentiostat:lmp91000: change dev_err message

Change dev_err message on line 215 in order to inform that
tia-gain-ohm is not defined and an external resistor is not
specified.

Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:potentiostat:lmp91000: invert if statement
Anderson Reis [Fri, 8 Mar 2019 19:46:54 +0000 (16:46 -0300)]
iio:potentiostat:lmp91000: invert if statement

Invert if statement arms in line 214, in order to make the code cleaner,
solve these checkpatch.pl CHECKs:

- lmp9100.c:214: CHECK: braces {} should be used on all arms of this statement
- lmp9100.c:216: CHECK: Unbalanced braces around else statement

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:potentiostat:lmp91000: reduce line width and remove blank line
Anderson Reis [Fri, 8 Mar 2019 19:46:53 +0000 (16:46 -0300)]
iio:potentiostat:lmp91000: reduce line width and remove blank line

Break the line 258 in order fit the line width on 80 characters. Remove
the blank line 279, as the line before is also a blank line. Solve these
checkpath.el WARNING and CHECK:

- lmp91000.c:258: WARNING: line over 80 characters
- lmp91000.c:279: CHECK: Please don't use multiple blank lines

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:potentiostat:lmp91000: remove unnecessary parentheses
Lucas Oshiro [Fri, 8 Mar 2019 19:46:52 +0000 (16:46 -0300)]
iio:potentiostat:lmp91000: remove unnecessary parentheses

Remove unnecessary parentheses on line 116.

Signed-off-by: Lucas Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Anderson Reis <andersonreisrosa@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ti-ads7950: add GPIO support
Justin Chen [Fri, 8 Mar 2019 22:03:28 +0000 (14:03 -0800)]
iio: adc: ti-ads7950: add GPIO support

The ADS79XX has GPIO pins that can be used. Add support for the GPIO
pins using the GPIO chip framework.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: fix a potential NULL pointer dereference
Kangjie Lu [Sat, 9 Mar 2019 04:53:55 +0000 (22:53 -0600)]
iio: adc: fix a potential NULL pointer dereference

devm_iio_trigger_alloc may fail and return NULL. The fix returns
ENOMEM when it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: dac: ti-dac5571: Update the module author email address
Sean Nyekjaer [Tue, 5 Mar 2019 07:36:27 +0000 (08:36 +0100)]
iio: dac: ti-dac5571: Update the module author email address

Update the module author to the current email address

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ti-ads8688: Update the module author email address
Sean Nyekjaer [Tue, 5 Mar 2019 07:36:26 +0000 (08:36 +0100)]
iio: adc: ti-ads8688: Update the module author email address

Update the module author to the current email address.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: kxcjk1013: Add device tree support
Robert Yang [Mon, 4 Mar 2019 15:19:12 +0000 (10:19 -0500)]
iio: accel: kxcjk1013: Add device tree support

Add device tree support for kxcjk-1013 accelerometer sensors.

Signed-off-by: Robert Yang <decatf@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: accel: kxcjk1013: Add device tree binding documentation
Robert Yang [Mon, 4 Mar 2019 15:19:11 +0000 (10:19 -0500)]
dt-bindings: iio: accel: kxcjk1013: Add device tree binding documentation

Document device tree bindings for Kionix KXCJK-1013 Accelerometer driver.

Signed-off-by: Robert Yang <decatf@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: Add vendor prefix for Kionix, Inc.
Robert Yang [Mon, 4 Mar 2019 15:19:10 +0000 (10:19 -0500)]
dt-bindings: Add vendor prefix for Kionix, Inc.

Kionix manufactured MEMs sensors. There are Kionix acceleromoter sensor
drivers which can be used with device tree.

Signed-off-by: Robert Yang <decatf@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: meson-saradc: add support for Meson G12A
Neil Armstrong [Mon, 4 Mar 2019 11:12:17 +0000 (12:12 +0100)]
iio: adc: meson-saradc: add support for Meson G12A

Add the SAR ADC driver for the Amlogic Meson-G12A SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: document the Meson G12A support
Neil Armstrong [Mon, 4 Mar 2019 11:12:16 +0000 (12:12 +0100)]
dt-bindings: iio: adc: document the Meson G12A support

Update the documentation to explicitly support the Meson-G12A SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agomailmap: Update email for Sean Nyekjaer
Sean Nyekjaer [Mon, 4 Mar 2019 10:08:08 +0000 (11:08 +0100)]
mailmap: Update email for Sean Nyekjaer

As I'll no longer be working with Prevas, add a mailmap entry so
any mail directed towards me reaches the appropriate mailbox.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: buffer: Switch to bitmap_zalloc()
Andy Shevchenko [Mon, 4 Mar 2019 08:55:40 +0000 (10:55 +0200)]
iio: buffer: Switch to bitmap_zalloc()

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: cros_ec_accel_legacy: Refactor code in cros_ec_accel_legacy_probe
Gustavo A. R. Silva [Thu, 21 Feb 2019 02:06:33 +0000 (20:06 -0600)]
iio: cros_ec_accel_legacy: Refactor code in cros_ec_accel_legacy_probe

Refactor some code in order to fix both the technical implementation
and the following warnings:

drivers/iio/accel/cros_ec_accel_legacy.c: In function ‘cros_ec_accel_legacy_probe’:
drivers/iio/accel/cros_ec_accel_legacy.c:387:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ec_accel_channels[X].scan_index = Y;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/iio/accel/cros_ec_accel_legacy.c:388:3: note: here
   case Y:
   ^~~~
drivers/iio/accel/cros_ec_accel_legacy.c:389:36: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ec_accel_channels[Y].scan_index = X;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
drivers/iio/accel/cros_ec_accel_legacy.c:390:3: note: here
   case Z:
   ^~~~

Notice that neither the for loop nor the switch statement is needed.
Also, "state->sign[Y] = 1" should be unconditional.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: st_accel: remove redundant unsigned less than zero check
Colin Ian King [Thu, 21 Feb 2019 10:46:36 +0000 (10:46 +0000)]
iio: st_accel: remove redundant unsigned less than zero check

The check that variable val is less than zero is redundant since val
is an unsigned int and hence can never be less than zero. Remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: imu: st_lsm6dsx: add asm330lhh device bindings
Lorenzo Bianconi [Thu, 21 Feb 2019 15:20:21 +0000 (16:20 +0100)]
dt-bindings: iio: imu: st_lsm6dsx: add asm330lhh device bindings

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add support to ASM330LHH
Lorenzo Bianconi [Thu, 21 Feb 2019 15:20:20 +0000 (16:20 +0100)]
iio: imu: st_lsm6dsx: add support to ASM330LHH

Add support to STM ASM330LHH 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/asm330lhh.pdf

Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ak8975: improve code readability
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:55 +0000 (18:02 +0100)]
iio: ak8975: improve code readability

- use temporary variable in get_mount_matrix()
- remove , after { }

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: mpu6050: improve code readability
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:54 +0000 (18:02 +0100)]
iio: mpu6050: improve code readability

- use temporary variable in get_mount_matrix()
- remove , after { }

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: hmc5843: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:53 +0000 (18:02 +0100)]
iio: magnetometer: hmc5843: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: bmc150: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:52 +0000 (18:02 +0100)]
iio: magnetometer: bmc150: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: gyro: itg3200: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:51 +0000 (18:02 +0100)]
iio: gyro: itg3200: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: gyro: bmg160: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:50 +0000 (18:02 +0100)]
iio: gyro: bmg160: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: bma180: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:49 +0000 (18:02 +0100)]
iio: accel: bma180: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: accel: bmc150: add mount matrix support
H. Nikolaus Schaller [Thu, 21 Feb 2019 17:02:48 +0000 (18:02 +0100)]
iio: accel: bmc150: add mount matrix support

This patch allows to read a mount-matrix device tree
property and report to user-space or in-kernel iio
clients.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: Allow to read mount matrix from ACPI
Andy Shevchenko [Thu, 21 Feb 2019 17:02:46 +0000 (18:02 +0100)]
iio: Allow to read mount matrix from ACPI

Currently mount matrix is allowed in Device Tree, though there is
no technical issue to extend it to support ACPI.

Convert the function to use device_property_read_string_array() and
thus allow to read mount matrix from ACPI if available.

Example of use in _DSD method:

  Name (_DSD, Package ()
  {
     ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
     Package ()
     {
        Package () { "mount-matrix", Package() {
                "1", "0",     "0",
                "0", "0.866", "0.5",
                "0", "-0.5",  "0.866",
        } },
     }
  })

At the same time drop the "of" prefix from its name and
convert current users.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:adc:ad7923: Rewrite comparison to NULL
Bárbara Fernandes [Fri, 22 Feb 2019 20:31:59 +0000 (17:31 -0300)]
iio:adc:ad7923: Rewrite comparison to NULL

Solves checkpath.pl's message:

CHECK: Comparison to NULL could be written "!indio_dev"

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:adc:ad7923: Put macro argument between ()'s
Bárbara Fernandes [Fri, 22 Feb 2019 20:31:58 +0000 (17:31 -0300)]
iio:adc:ad7923: Put macro argument between ()'s

Put macro argument between parenthesis in order to avoid precedence
issues. Solves the following checkpath.pl's messages:

CHECK: Macro argument 'mode' may be better as '(mode)' to avoid
precedence issues
CHECK: Macro argument 'channel' may be better as '(channel)' to
avoid precedence issues
CHECK: Macro argument reuse 'sequence' - possible side-effects?
CHECK: Macro argument 'sequence' may be better as '(sequence)' to
avoid precedence issues
CHECK: Macro argument 'val' may be better as '(val)' to avoid
precedence issues
CHECK: Macro argument 'dec' may be better as '(dec)' to avoid precedence
issues
CHECK: Macro argument 'bits' may be better as '(bits)' to avoid
precedence issues

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:adc:ad7923: Use BIT macro instead of bitshift
Bárbara Fernandes [Fri, 22 Feb 2019 20:31:57 +0000 (17:31 -0300)]
iio:adc:ad7923: Use BIT macro instead of bitshift

Replace use of the operation '<<' by the BIT macro. Solves checkpath.pl's
message:

CHECK: Prefer using the BIT macro

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:adc:ad7923: Align broken line to parenthesis
Bárbara Fernandes [Fri, 22 Feb 2019 20:31:56 +0000 (17:31 -0300)]
iio:adc:ad7923: Align broken line to parenthesis

Get broken line aligned with parenthesis on upper line. Solves
checkpatch.pl's message:

CHECK: Alignment should match open parenthesis

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: counter: stm32-lptimer: Add power management support
Fabrice Gasnier [Mon, 25 Feb 2019 10:42:47 +0000 (11:42 +0100)]
iio: counter: stm32-lptimer: Add power management support

Add suspend/resume PM sleep ops. When going to low power, disable
active counter. Only active counter should be resumed: don't touch
disabled counter, as it may be used by other LPTimer MFD child driver.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: stm32-lptimer-counter: document pinctrl sleep state
Fabrice Gasnier [Mon, 25 Feb 2019 10:42:46 +0000 (11:42 +0100)]
dt-bindings: iio: stm32-lptimer-counter: document pinctrl sleep state

Add documentation for optional pinctrl sleep state that can be used by
STM32 LPTimer encoder/counter.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: sps30: fix attribute kernel version
Tomasz Duszynski [Mon, 25 Feb 2019 18:17:40 +0000 (19:17 +0100)]
iio: chemical: sps30: fix attribute kernel version

4.22 have never existed and this change was actually added to 5.0
hence fix the numbering.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Add docs for ADIS16480 IMU
Stefan Popa [Wed, 27 Feb 2019 16:14:28 +0000 (18:14 +0200)]
iio: imu: adis16480: Add docs for ADIS16480 IMU

Document support for ADIS16480 Inertial Measurement Unit.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Add support for ADIS1649x family of devices
Stefan Popa [Wed, 27 Feb 2019 16:14:27 +0000 (18:14 +0200)]
iio: imu: adis16480: Add support for ADIS1649x family of devices

The ADIS16495 and ADIS16497 are inertial systems that include a triaxis
gyroscope and a triaxis accelerometer. The serial peripheral interface
(SPI) provide a simple interface for data collection and configuration
control. The devices are similar to ADIS16475, ADIS16480, ADIS16485 and
ADIS16488, the main differences are highlighted below:

* The temperature data scale is 0.00565 C/LSB for ADIS16475 and ADIS1648x
  devices, while for ADIS1649x 0.0125 C/LSB.

* ADIS1649x devices support different gyroscope measurement ranges which
  are dependent on the dash number (-1, -2, -3), see Table 24 in the
  ADIS16495 datasheet. However, the ADIS16497 gyroscopes have the same
  scale as ADIS16495.

* ADIS16495 devices support the acceleration maximum range of 8g, while
  ADIS16497 devices go up to 40g.

* The internal clock for ADIS1649x devices is 4.25 kSPS. The sampling
  frequency is calculated by applying a decimation rate which can take a
  maximum value of 4250.

* ADIS1649x devices support different default filter frequencies.

Datasheets:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adis16495.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/adis16497.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Deal with filter freq in a generic way
Stefan Popa [Wed, 27 Feb 2019 16:14:26 +0000 (18:14 +0200)]
iio: imu: adis16480: Deal with filter freq in a generic way

When setting the filter frequency, the driver looks into the
adis16480_def_filter_freqs table for the best match. Pass this table to
the chip_info struct since future devices will need to use a different
table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Calculate the sampling frequency in a generic way
Stefan Popa [Wed, 27 Feb 2019 16:14:25 +0000 (18:14 +0200)]
iio: imu: adis16480: Calculate the sampling frequency in a generic way

The adis1648x devices have an internal clock of 2.46 kSPS. The sampling
frequency is calculated by applying a decimation rate which can take the
maximum value of 2047.

Although all adis1648x devices are similar in this regard, devices that
will use this feature will be added in the future.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Treat temperature scale in a generic way
Stefan Popa [Wed, 27 Feb 2019 16:14:24 +0000 (18:14 +0200)]
iio: imu: adis16480: Treat temperature scale in a generic way

All supported devices provide internal temperature measurement from -40 C
to +85 C, with +25 C representing value 0x00.

This patch treats the temperature scale in a generic way, similar to the
accelerometer and gyroscope scales. So far, there are no temperature max
scale differences between the supported devices. However, devices that
will make use of this feature will be added in the future.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Add OF device ID table
Stefan Popa [Wed, 27 Feb 2019 16:14:23 +0000 (18:14 +0200)]
iio: imu: adis16480: Add OF device ID table

The driver does not have a struct of_device_id table, but supported
devices are registered via Device Trees. This patch adds OF device ID
table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: adis16480: Add support for configurable drdy indicator
Stefan Popa [Wed, 27 Feb 2019 16:14:22 +0000 (18:14 +0200)]
iio: imu: adis16480: Add support for configurable drdy indicator

The FNCTIO_CTRL register provides configuration control for each I/O pin
(DIO1, DIO2, DIO3 and DIO4).

This patch adds the option to configure each DIOx pin as data ready
indicator with positive or negative polarity by reading the 'interrupts'
and 'interrupt-names' properties from the devicetree. The
'interrupt-names' property is optional, if it is not specified, then the
DIO1 pin is used as default data ready signal.

Although the factory default assigns DIO2 as data ready signal, in the
versions previous this patch, DIO1 pin was used. We should leave this
configuration as is, since some devices might be expecting the interrupt
on the wrong physical pin.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ti-ads7950: Fix improper use of mlock
Justin Chen [Thu, 28 Feb 2019 22:16:48 +0000 (14:16 -0800)]
iio: adc: ti-ads7950: Fix improper use of mlock

Indio->mlock is used for protecting the different iio device modes.
It is currently not being used in this way. Replace the lock with
an internal lock specifically used for protecting the SPI transfer
buffer.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: trigger: Print an error if there is no available irq
Mathieu Othacehe [Wed, 20 Feb 2019 16:49:10 +0000 (17:49 +0100)]
iio: trigger: Print an error if there is no available irq

If there are more trigger consumers than
CONFIG_IIO_CONSUMERS_PER_TRIGGER, iio_trigger_attach_poll_func will
silently fail. Add an error message to inform the user that
CONFIG_IIO_CONSUMERS_PER_TRIGGER limit might be exceeded.

Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: mma8452: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:23:18 +0000 (16:23 -0600)]
iio: mma8452: mark expected switch fall-through

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warning:

drivers/iio/accel/mma8452.c: In function ‘mma8452_probe’:
drivers/iio/accel/mma8452.c:1581:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (ret == data->chip_info->chip_id)
      ^
drivers/iio/accel/mma8452.c:1584:2: note: here
  default:
  ^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: chemical: pms7003: extend supported sensors list
Tomasz Duszynski [Sun, 17 Feb 2019 19:22:13 +0000 (20:22 +0100)]
dt-bindings: iio: chemical: pms7003: extend supported sensors list

Add other sensors to the compatible list.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: chemical: pms7003: extend supported sensors list
Tomasz Duszynski [Sun, 17 Feb 2019 19:22:12 +0000 (20:22 +0100)]
iio: chemical: pms7003: extend supported sensors list

Add other sensors to the compatible list.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: ingenic: remove redundant dev_err call in ingenic_adc_probe()
Wei Yongjun [Mon, 18 Feb 2019 06:57:35 +0000 (06:57 +0000)]
iio: adc: ingenic: remove redundant dev_err call in ingenic_adc_probe()

There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: remove redundant unlikely annotation
Chengguang Xu [Mon, 18 Feb 2019 07:53:26 +0000 (15:53 +0800)]
iio: remove redundant unlikely annotation

unlikely has already included in IS_ERR(),
so just remove redundant unlikely annotation.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMerge 5.1-rc3 into staging-next
Greg Kroah-Hartman [Mon, 1 Apr 2019 05:49:24 +0000 (07:49 +0200)]
Merge 5.1-rc3 into staging-next

We want those fixes and this resolves an erofs merge conflict.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoLinux 5.1-rc3
Linus Torvalds [Sun, 31 Mar 2019 21:39:29 +0000 (14:39 -0700)]
Linux 5.1-rc3

5 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 31 Mar 2019 15:55:59 +0000 (08:55 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 "A collection of x86 and ARM bugfixes, and some improvements to
  documentation.

  On top of this, a cleanup of kvm_para.h headers, which were exported
  by some architectures even though they not support KVM at all. This is
  responsible for all the Kbuild changes in the diffstat"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (28 commits)
  Documentation: kvm: clarify KVM_SET_USER_MEMORY_REGION
  KVM: doc: Document the life cycle of a VM and its resources
  KVM: selftests: complete IO before migrating guest state
  KVM: selftests: disable stack protector for all KVM tests
  KVM: selftests: explicitly disable PIE for tests
  KVM: selftests: assert on exit reason in CR4/cpuid sync test
  KVM: x86: update %rip after emulating IO
  x86/kvm/hyper-v: avoid spurious pending stimer on vCPU init
  kvm/x86: Move MSR_IA32_ARCH_CAPABILITIES to array emulated_msrs
  KVM: x86: Emulate MSR_IA32_ARCH_CAPABILITIES on AMD hosts
  kvm: don't redefine flags as something else
  kvm: mmu: Used range based flushing in slot_handle_level_range
  KVM: export <linux/kvm_para.h> and <asm/kvm_para.h> iif KVM is supported
  KVM: x86: remove check on nr_mmu_pages in kvm_arch_commit_memory_region()
  kvm: nVMX: Add a vmentry check for HOST_SYSENTER_ESP and HOST_SYSENTER_EIP fields
  KVM: SVM: Workaround errata#1096 (insn_len maybe zero on SMAP violation)
  KVM: Reject device ioctls from processes other than the VM's creator
  KVM: doc: Fix incorrect word ordering regarding supported use of APIs
  KVM: x86: fix handling of role.cr4_pae and rename it to 'gpte_size'
  KVM: nVMX: Do not inherit quadrant and invalid for the root shadow EPT
  ...

5 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 31 Mar 2019 15:40:15 +0000 (08:40 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "A pile of x86 updates:

   - Prevent exceeding he valid physical address space in the /dev/mem
     limit checks.

   - Move all header content inside the header guard to prevent compile
     failures.

   - Fix the bogus __percpu annotation in this_cpu_has() which makes
     sparse very noisy.

   - Disable switch jump tables completely when retpolines are enabled.

   - Prevent leaking the trampoline address"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/realmode: Make set_real_mode_mem() static inline
  x86/cpufeature: Fix __percpu annotation in this_cpu_has()
  x86/mm: Don't exceed the valid physical address space
  x86/retpolines: Disable switch jump tables when retpolines are enabled
  x86/realmode: Don't leak the trampoline kernel address
  x86/boot: Fix incorrect ifdeffery scope
  x86/resctrl: Remove unused variable

5 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 31 Mar 2019 15:37:04 +0000 (08:37 -0700)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf tooling fixes from Thomas Gleixner:
 "Core libraries:
   - Fix max perf_event_attr.precise_ip detection.
   - Fix parser error for uncore event alias
   - Fixup ordering of kernel maps after obtaining the main kernel map
     address.

  Intel PT:
   - Fix TSC slip where A TSC packet can slip past MTC packets so that
     the timestamp appears to go backwards.
   - Fixes for exported-sql-viewer GUI conversion to python3.

  ARM coresight:
   - Fix the build by adding a missing case value for enumeration value
     introduced in newer library, that now is the required one.

  tool headers:
   - Syncronize kernel headers with the kernel, getting new io_uring and
     pidfd_send_signal syscalls so that 'perf trace' can handle them"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf pmu: Fix parser error for uncore event alias
  perf scripts python: exported-sql-viewer.py: Fix python3 support
  perf scripts python: exported-sql-viewer.py: Fix never-ending loop
  perf machine: Update kernel map address and re-order properly
  tools headers uapi: Sync powerpc's asm/kvm.h copy with the kernel sources
  tools headers: Update x86's syscall_64.tbl and uapi/asm-generic/unistd
  tools headers uapi: Update drm/i915_drm.h
  tools arch x86: Sync asm/cpufeatures.h with the kernel sources
  tools headers uapi: Sync linux/fcntl.h to get the F_SEAL_FUTURE_WRITE addition
  tools headers uapi: Sync asm-generic/mman-common.h and linux/mman.h
  perf evsel: Fix max perf_event_attr.precise_ip detection
  perf intel-pt: Fix TSC slip
  perf cs-etm: Add missing case value