platform/kernel/linux-rpi.git
2 years agoiio:accel:adxl372: Move exports into IIO_ADXL372 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:30 +0000 (18:05 +0000)]
iio:accel:adxl372: Move exports into IIO_ADXL372 namespace

To avoid unnecessary pollution of the global symbol namespace move the
driver core exports into their own namespace and import that into the two
bus modules.

For more info see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-9-jic23@kernel.org
2 years agoiio:accel:adxl355: Move exports into IIO_ADXL355 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:29 +0000 (18:05 +0000)]
iio:accel:adxl355: Move exports into IIO_ADXL355 namespace

To avoid unnecessary pollution of the global symbol namespace move the
driver core exports into their own namespace and import that into the two
bus modules.

For more info see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Puranjay Mohan <puranjay12@gmail.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-8-jic23@kernel.org
2 years agoiio:accel:adxl345: Move exports into IIO_ADXL345 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:28 +0000 (18:05 +0000)]
iio:accel:adxl345: Move exports into IIO_ADXL345 namespace

To avoid unnecessary pollution of the global symbol namespace move the
driver core exports into their own namespace and import that into the two
bus modules.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-7-jic23@kernel.org
2 years agoiio:accel:adxl313: Move exports into IIO_ADXL313 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:27 +0000 (18:05 +0000)]
iio:accel:adxl313: Move exports into IIO_ADXL313 namespace

In order to avoid unnecessary pollution of the global symbol namespace
move the driver core exports into their own namespace and import
that into the two bus modules.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lucas Stankus <lucas.p.stankus@gmail.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-6-jic23@kernel.org
2 years agoiio:accel:bma400: Move exports into IIO_BMA400 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:26 +0000 (18:05 +0000)]
iio:accel:bma400: Move exports into IIO_BMA400 namespace

In order to avoid unnecessary pollution of the global symbol namespace
move the core bma400 functions into a bma400 specific namespace
and import that into the two bus modules.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220116180535.2367780-5-jic23@kernel.org
2 years agoiio:accel:kxsd9: Move exports into IIO_KDSD9 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:25 +0000 (18:05 +0000)]
iio:accel:kxsd9: Move exports into IIO_KDSD9 namespace

In order to avoid unnecessary pollution of the global symbol namespace
move the core kxsd9 functions into a kxsd9 specific namespace and import
that into the two bus modules.

For more information see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-4-jic23@kernel.org
2 years agoiio:accel:mma7455_core: Move exports into IIO_MMA7455 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:24 +0000 (18:05 +0000)]
iio:accel:mma7455_core: Move exports into IIO_MMA7455 namespace

In order to avoid unnecessary pollution of the global symbol namespace
move the core mma7455 functions into an mma7455 specific namespace and
import that into the two bus modules.

For more information see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220116180535.2367780-3-jic23@kernel.org
2 years agoiio:accel:mma9551_core: Move exports into IIO_MMA9551 namespace
Jonathan Cameron [Sun, 16 Jan 2022 18:05:23 +0000 (18:05 +0000)]
iio:accel:mma9551_core: Move exports into IIO_MMA9551 namespace

In order to avoid unnecessary pollution of the global symbol namespace
move the core mma9551 functions into an mma9551 specific namespace.

For more information see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220116180535.2367780-2-jic23@kernel.org
2 years agoiio: accel: st_accel: Add support for Silan SC7A20
Samuel Holland [Wed, 2 Feb 2022 23:50:48 +0000 (17:50 -0600)]
iio: accel: st_accel: Add support for Silan SC7A20

This chip appears to be register-compatible with the LIS2DH. The new
description is a copy of the LIS2DH's description with a different WAI
value.

Datasheet: http://linux-chenxing.org/silan/SC7A20-SilanMicroelectronics.pdf
Datasheet: http://www.siitek.com.cn/Upfiles/down/SC7A20说明书_0.92(智能穿戴).pdf
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220202235049.8051-4-samuel@sholland.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: st: Add Silan SC7A20 accelerometer
Samuel Holland [Wed, 2 Feb 2022 23:50:47 +0000 (17:50 -0600)]
dt-bindings: iio: st: Add Silan SC7A20 accelerometer

This chip is not an ST part, but it appears to be register-compatible
with the LIS2DH, so it can use the same binding.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220202235049.8051-3-samuel@sholland.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: vendor-prefixes: Add silan vendor prefix
Samuel Holland [Wed, 2 Feb 2022 23:50:46 +0000 (17:50 -0600)]
dt-bindings: vendor-prefixes: Add silan vendor prefix

Hangzhou Silan Microelectronics Co., Ltd. (http://www.silan.com.cn/) is
a manufacturer of ICs, including MEMS sensors.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220202235049.8051-2-samuel@sholland.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: trigger: stm32-timer: Make use of device properties
Andy Shevchenko [Wed, 2 Feb 2022 20:41:12 +0000 (22:41 +0200)]
iio: trigger: stm32-timer: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220202204112.57095-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: mma8452: Add support for the "mount-matrix" device property
Hans de Goede [Tue, 8 Feb 2022 12:43:36 +0000 (13:43 +0100)]
iio: mma8452: Add support for the "mount-matrix" device property

Add support for the standard "mount-matrix" device property to
the mma8452 driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220208124336.511884-2-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: mma8452: Fix probe failing when an i2c_device_id is used
Hans de Goede [Tue, 8 Feb 2022 12:43:35 +0000 (13:43 +0100)]
iio: mma8452: Fix probe failing when an i2c_device_id is used

The mma8452_driver declares both of_match_table and i2c_driver.id_table
match-tables, but its probe() function only checked for of matches.

Add support for i2c_device_id matches. This fixes the driver not loading
on some x86 tablets (e.g. the Nextbook Ares 8) where the i2c_client is
instantiated by platform code using an i2c_device_id.

Drop of_match_ptr() protection to avoid unused warning.

Fixes: c3cdd6e48e35 ("iio: mma8452: refactor for seperating chip specific data")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220208124336.511884-1-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: chemical: atlas-ezo-sensor: Make use of device properties
Andy Shevchenko [Mon, 7 Feb 2022 12:42:04 +0000 (14:42 +0200)]
iio: chemical: atlas-ezo-sensor: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220207124204.11658-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: ssp_sensors: Make use of device properties
Andy Shevchenko [Thu, 10 Feb 2022 13:57:24 +0000 (15:57 +0200)]
iio: ssp_sensors: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220210135724.26660-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: as3935: Use devm_delayed_work_autocancel()
Christophe JAILLET [Sun, 13 Feb 2022 12:30:11 +0000 (13:30 +0100)]
iio: as3935: Use devm_delayed_work_autocancel()

Use devm_delayed_work_autocancel() instead of hand writing it.
It saves a few lines of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8d5c50f191bd8f751849d72127f83b14a7636d64.1644755396.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: cpcap-adc: remove redundant assignment to variable cal_data_diff
Colin Ian King [Mon, 7 Feb 2022 13:59:43 +0000 (13:59 +0000)]
iio: adc: cpcap-adc: remove redundant assignment to variable cal_data_diff

The variable cal_data_diff is being assigned a value that is never read,
it is being re-assigned later on with a new value in both paths of an
if statement. The assignment is redundant, so remove it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220207135943.340629-1-colin.i.king@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: imu: inv_mpu6050: Make use of device properties
Andy Shevchenko [Thu, 3 Feb 2022 15:59:20 +0000 (17:59 +0200)]
iio: imu: inv_mpu6050: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203155920.18586-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: imu: inv_mpu6050: Check ACPI companion directly
Andy Shevchenko [Thu, 3 Feb 2022 15:59:19 +0000 (17:59 +0200)]
iio: imu: inv_mpu6050: Check ACPI companion directly

Instead of checking for ACPI handle followed by extracting a companion
device, do the latter first and use it for checks.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203155920.18586-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: imu: inv_mpu6050: Drop wrong use of ACPI_PTR()
Andy Shevchenko [Thu, 3 Feb 2022 15:59:18 +0000 (17:59 +0200)]
iio: imu: inv_mpu6050: Drop wrong use of ACPI_PTR()

ACPI_PTR() is more harmful than helpful. For example, in this case
if CONFIG_ACPI=n, the ID table left unused which is not what we want.

Instead of adding ifdeffery or attribute here and there, drop ACPI_PTR().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203155920.18586-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: accel: adxl355: Replace custom definitions with generic from units.h
Andy Shevchenko [Wed, 2 Feb 2022 17:37:23 +0000 (19:37 +0200)]
iio: accel: adxl355: Replace custom definitions with generic from units.h

The units.h provides MEGA and TERA. Replace custom ones.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220202173723.8678-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: temperature: maxim_thermocouple: Switch from of headers to mod_devicetable.h
Andy Shevchenko [Wed, 2 Feb 2022 20:53:28 +0000 (22:53 +0200)]
iio: temperature: maxim_thermocouple: Switch from of headers to mod_devicetable.h

There is nothing directly using of specific interfaces in this driver,
so lets not include the headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220202205328.57837-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: temperature: mlx90632: Switch from of headers to mod_devicetable.h
Andy Shevchenko [Wed, 2 Feb 2022 20:55:31 +0000 (22:55 +0200)]
iio: temperature: mlx90632: Switch from of headers to mod_devicetable.h

There is nothing directly using of specific interfaces in this driver,
so lets not include the headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220202205531.57966-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: humidity: dht11: Switch from of headers to mod_devicetable.h
Andy Shevchenko [Wed, 2 Feb 2022 20:34:20 +0000 (22:34 +0200)]
iio: humidity: dht11: Switch from of headers to mod_devicetable.h

There is nothing directly using of specific interfaces in this driver,
so lets not include the headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220202203420.56654-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: frequency: adf4350: Make use of device properties
Andy Shevchenko [Thu, 3 Feb 2022 11:00:06 +0000 (13:00 +0200)]
iio: frequency: adf4350: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203110006.4291-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: amplifiers: hmc425a: Make use of device properties
Andy Shevchenko [Thu, 3 Feb 2022 12:16:24 +0000 (14:16 +0200)]
iio: amplifiers: hmc425a: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203121624.75515-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: chemical: bme680: Switch from of headers to mod_devicetable.h
Andy Shevchenko [Thu, 3 Feb 2022 12:27:25 +0000 (14:27 +0200)]
iio: chemical: bme680: Switch from of headers to mod_devicetable.h

There is nothing directly using of specific interfaces in this driver,
so lets not include the headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203122725.75939-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: dac: ad5592r: Drop leftover header inclusion
Andy Shevchenko [Thu, 3 Feb 2022 12:33:54 +0000 (14:33 +0200)]
iio: dac: ad5592r: Drop leftover header inclusion

There is no use of of.h in the module, drop it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220203123354.76573-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: at91-sama5d2: update maintainers entry
Nicolas Ferre [Sun, 30 Jan 2022 14:50:08 +0000 (15:50 +0100)]
dt-bindings: iio: adc: at91-sama5d2: update maintainers entry

Update the maintainers entry to match the changes made back in
mid-2020 with 853fa48717c2 ("MAINTAINERS: adc: at91-sama5d2_adc:
remove myself as co-maintainer").

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/6acdb66592baf395a77a431c0cb9a37b0f178097.1643554065.git.nicolas.ferre@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agomailmap: Update email address for Cai Huoqing
Cai Huoqing [Mon, 6 Dec 2021 02:50:34 +0000 (10:50 +0800)]
mailmap: Update email address for Cai Huoqing

The caihuoqing@baidu.com would be deprecated and use cai.huoqing@linux.dev
as the main email address.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20211206025034.2729-1-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: atmel,sama5d2-adc: make atmel,trigger-edge-type non-mandatory
Eugen Hristev [Fri, 17 Dec 2021 09:54:01 +0000 (11:54 +0200)]
dt-bindings: iio: adc: atmel,sama5d2-adc: make atmel,trigger-edge-type non-mandatory

The atmel,trigger-edge-type was never imposed by the driver.
Make things right and remove this property from the mandatory list.
This will not break existing nodes because according to the binding they
should have this property.
However, the driver does not impose it and it works without it, the property
selects the trigger type, and without it, the driver will have no trigger
available, which is the case on some boards which do not have access
to the trigger pin.
This will avoid generating this warning for example:

*/arch/arm/boot/dts/at91-sama7g5ek.dt.yaml: adc@e1000000: 'atmel,trigger-edge-type' is a required property
From schema: */Documentation/devicetree/bindings/iio/adc/atmel,sama5d2-adc.yaml

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211217095401.583821-1-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: afe: rescale: reorder includes
Liam Beguin [Sat, 8 Jan 2022 20:53:08 +0000 (15:53 -0500)]
iio: afe: rescale: reorder includes

Includes should be ordered alphabetically which is already the case,
but follow what is done in other drivers by separation IIO specific
headers with a blank line.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-6-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: afe: rescale: use s64 for temporary scale calculations
Liam Beguin [Sat, 8 Jan 2022 20:53:07 +0000 (15:53 -0500)]
iio: afe: rescale: use s64 for temporary scale calculations

All four scaling coefficients can take signed values.
Make tmp a signed 64-bit integer and switch to div_s64() to preserve
signs during 64-bit divisions.

Fixes: 8b74816b5a9a ("iio: afe: rescale: new driver")
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-5-liambeguin@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: inkern: make a best effort on offset calculation
Liam Beguin [Sat, 8 Jan 2022 20:53:06 +0000 (15:53 -0500)]
iio: inkern: make a best effort on offset calculation

iio_convert_raw_to_processed_unlocked() assumes the offset is an
integer. Make a best effort to get a valid offset value for fractional
cases without breaking implicit truncations.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-4-liambeguin@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: inkern: apply consumer scale when no channel scale is available
Liam Beguin [Sat, 8 Jan 2022 20:53:05 +0000 (15:53 -0500)]
iio: inkern: apply consumer scale when no channel scale is available

When a consumer calls iio_read_channel_processed() and no channel scale
is available, it's assumed that the scale is one and the raw value is
returned as expected.

On the other hand, if the consumer calls iio_convert_raw_to_processed()
the scaling factor requested by the consumer is not applied.

This for example causes the consumer to process mV when expecting uV.
Make sure to always apply the scaling factor requested by the consumer.

Fixes: adc8ec5ff183 ("iio: inkern: pass through raw values if no scaling")
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-3-liambeguin@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: inkern: apply consumer scale on IIO_VAL_INT cases
Liam Beguin [Sat, 8 Jan 2022 20:53:04 +0000 (15:53 -0500)]
iio: inkern: apply consumer scale on IIO_VAL_INT cases

When a consumer calls iio_read_channel_processed() and the channel has
an integer scale, the scale channel scale is applied and the processed
value is returned as expected.

On the other hand, if the consumer calls iio_convert_raw_to_processed()
the scaling factor requested by the consumer is not applied.

This for example causes the consumer to process mV when expecting uV.
Make sure to always apply the scaling factor requested by the consumer.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220108205319.2046348-2-liambeguin@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: humidity: hdc100x: Add ACPI HID table
Kai-Heng Feng [Fri, 28 Jan 2022 04:20:51 +0000 (12:20 +0800)]
iio: humidity: hdc100x: Add ACPI HID table

x86 boards may use ACPI HID "TXNW1010" for the hdc100x device.

TI told us "The ACPI ID for TI is: https://uefi.org/node/1028 (TXNW),
therefore it would most likely be appropriate to use TXNW1010."

So add an ACPI match table for that accordingly.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220128042054.2062060-1-kai.heng.feng@canonical.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: pressure: dps310: Add ACPI HID table
Kai-Heng Feng [Fri, 28 Jan 2022 02:31:44 +0000 (10:31 +0800)]
iio: pressure: dps310: Add ACPI HID table

x86 boards may use ACPI HID "IFX3100" for the dps310 device.

Vendor told us feel free to add the ID and contact
"Saumitra.Chafekar@infineon.com" for further questions.

So add an ACPI match table for that accordingly.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20220128023144.2050615-1-kai.heng.feng@canonical.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: sx9360: fix iio event generation
Jongpil Jung [Sat, 22 Jan 2022 21:34:44 +0000 (13:34 -0800)]
iio: sx9360: fix iio event generation

To convert SX9360 status register ["REG_STAT"], into a channel
index, we need to right shift by |stat_offset|, not left shift.
Also the PROXSTAT bit (3) is for channel 1 (PHM, Phase Measured), not (PHR,
Phase Reference, channel 0), so the offset is 2 instead of 3.

Fixes: 1cdb4c47f7f5 ("iio:proximity:sx9360: Add sx9360 support")
Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220122213444.745152-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: qcom-vadc-common: Re-use generic struct u32_fract
Andy Shevchenko [Wed, 26 Jan 2022 13:53:53 +0000 (15:53 +0200)]
iio: adc: qcom-vadc-common: Re-use generic struct u32_fract

Instead of custom data type re-use generic struct u32_fract.
No changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220126135353.24007-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: twl4030-madc: Re-use generic struct s16_fract
Andy Shevchenko [Wed, 26 Jan 2022 13:53:52 +0000 (15:53 +0200)]
iio: adc: twl4030-madc: Re-use generic struct s16_fract

Instead of custom data type re-use generic struct s16_fract.
No changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220126135353.24007-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: rn5t618: Re-use generic struct u16_fract
Andy Shevchenko [Wed, 26 Jan 2022 13:53:51 +0000 (15:53 +0200)]
iio: adc: rn5t618: Re-use generic struct u16_fract

Instead of custom data type re-use generic struct u16_fract.
No changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220126135353.24007-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agomath.h: Introduce data types for fractional numbers
Andy Shevchenko [Wed, 26 Jan 2022 13:53:50 +0000 (15:53 +0200)]
math.h: Introduce data types for fractional numbers

Introduce a macro to produce data types like

struct TYPE_fract {
__TYPE numerator;
__TYPE denominator;
};

to be used in the code wherever it's needed.

In the following changes convert some users to it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220126135353.24007-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio/adc: qcom,spmi-iadc: Fix 'reg' property in example
Rob Herring [Wed, 26 Jan 2022 23:12:17 +0000 (17:12 -0600)]
dt-bindings: iio/adc: qcom,spmi-iadc: Fix 'reg' property in example

The QCom SPMI PMIC child nodes are defined to have a single address cell,
but the example has an erroneous size cell. Remove it.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220126231217.1633935-1-robh@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: tsc2046: add sanity check to avoid to big allocations
Oleksij Rempel [Mon, 17 Jan 2022 08:28:52 +0000 (09:28 +0100)]
iio: adc: tsc2046: add sanity check to avoid to big allocations

To avoid problematic devicetree configurations. Set allocation limit
with error message and suggestion on what can be done to solve this
issue.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20220117082852.3370869-2-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: tsc2046: add .read_raw support
Oleksij Rempel [Mon, 17 Jan 2022 08:28:51 +0000 (09:28 +0100)]
iio: adc: tsc2046: add .read_raw support

Add read_raw() support to make use of iio_hwmon and other iio clients.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20220117082852.3370869-1-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: hw_consumer: Use struct_size() helper in kzalloc()
Gustavo A. R. Silva [Thu, 20 Jan 2022 22:52:43 +0000 (16:52 -0600)]
iio: hw_consumer: Use struct_size() helper in kzalloc()

Make use of the struct_size() helper instead of an open-coded version,
in order to avoid any potential type mistakes or integer overflows that,
in the worst scenario, could lead to heap overflows.

Also, address the following sparse warnings:
drivers/iio/buffer/industrialio-hw-consumer.c:63:23: warning: using sizeof on a flexible structure when using CF='-Wflexible-array-sizeof'

Link: https://github.com/KSPP/linux/issues/174
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220120225243.GA37225@embeddedor
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adis: stylistic changes
Nuno Sá [Sat, 22 Jan 2022 13:09:05 +0000 (14:09 +0100)]
iio: adis: stylistic changes

Minor stylistic changes to address checkptach complains when called with
'--strict'.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220122130905.99-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoadis: simplify 'adis_update_bits' macros
Nuno Sá [Sat, 22 Jan 2022 13:09:04 +0000 (14:09 +0100)]
adis: simplify 'adis_update_bits' macros

There's no need to use  '__builtin_choose_expr' to choose the right
call to 'adis_update_bits_base()'. We can change the 'BUILD_BUG_ON()'
condition so that it makes sure only the supported sizes are
passed in. With that, we can just use 'sizeof(val)' as the size argument
of 'adis_update_bits_base()'.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220122130905.99-2-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add missing files to the adis lib
Nuno Sá [Sat, 22 Jan 2022 13:09:03 +0000 (14:09 +0100)]
MAINTAINERS: add missing files to the adis lib

The triggered buffer support was missing in the MAINTAINERS file. Add
them.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220122130905.99-1-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add maintainer for ADMV8818 driver
Antoniu Miclaus [Mon, 17 Jan 2022 07:00:39 +0000 (09:00 +0200)]
MAINTAINERS: add maintainer for ADMV8818 driver

Add myself as maintainer for the ADMV8818 driver.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220117070039.6139-3-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add maintainer for ADMV1013 driver
Antoniu Miclaus [Mon, 17 Jan 2022 07:00:38 +0000 (09:00 +0200)]
MAINTAINERS: add maintainer for ADMV1013 driver

Add myself as maintainer for the ADMV1013 driver.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220117070039.6139-2-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add maintainer for AD7293 driver
Antoniu Miclaus [Mon, 17 Jan 2022 07:00:37 +0000 (09:00 +0200)]
MAINTAINERS: add maintainer for AD7293 driver

Add myself as maintainer for the AD7293 driver.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220117070039.6139-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: sps30: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:17 +0000 (19:52 +0100)]
iio: sps30: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `cleaning_period` device attribute of
the sps30 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-14-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: scd4x: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:16 +0000 (19:52 +0100)]
iio: scd4x: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `calibration_auto_enable` device
attribute of the scd4x driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-13-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: ms_sensors: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:15 +0000 (19:52 +0100)]
iio: ms_sensors: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `battery_low` and `heater_enable`
device attributes of the ms_sensors driver shared code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-12-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: max9611: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:14 +0000 (19:52 +0100)]
iio: max9611: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `in_power_shunt_resistor` and
`in_current_shunt_resistor` device attributes of the max9611 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Link: https://lore.kernel.org/r/20211216185217.1054495-11-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: max31865: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:13 +0000 (19:52 +0100)]
iio: max31865: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom ``in_filter_notch_center_frequency`
and fault_ovuv` device attributes of the max31865 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-10-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: max31856: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:12 +0000 (19:52 +0100)]
iio: max31856: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `fault_ovuv`, `fault_oc` and
`in_temp_filter_notch_center_frequency` device attributes of the max31856
driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-9-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: lm3533: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:11 +0000 (19:52 +0100)]
iio: lm3533: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom device attributes of the lm3533
driver.  Note this driver was using scnprintf correctly so this change
is about ensuring examples of code that might get cut and paste into new
drivers are using current best practice.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211216185217.1054495-8-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: ina2xx-adc: sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:10 +0000 (19:52 +0100)]
iio: ina2xx-adc: sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `in_allow_async_readout` device
attribute of the ina2xx-adc driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-7-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: as3935: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:09 +0000 (19:52 +0100)]
iio: as3935: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `noise_level_tripped` device
attribute of the as3935 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-6-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: ad9523: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:08 +0000 (19:52 +0100)]
iio: ad9523: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom device attributes of the ad9523
driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-5-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: ad7192: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:07 +0000 (19:52 +0100)]
iio: ad7192: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() to format the custom `ac_excitation` and `bridge_swtich`
attributes of the ad7192 driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-4-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: dmaengine-buffer: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:06 +0000 (19:52 +0100)]
iio: dmaengine-buffer: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

Use sysfs_emit() for the `length_align_bytes` buffer attribute.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-3-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: core: Use sysfs_emit()
Lars-Peter Clausen [Thu, 16 Dec 2021 18:52:05 +0000 (19:52 +0100)]
iio: core: Use sysfs_emit()

sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it
knows about the sysfs buffer specifics and has some built-in checks for
size and alignment.

This patch converts the places in the IIO core that follow the pattern of

   return s*printf(...)

to

   return sysfs_emit(...)

This covers the new places that have been introduced where sprintf() is
used for formatting sysfs output since the last time this was done in
commit 83ca56b663cf ("iio: core: Use sysfs_emit() (trivial bits)").

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20211216185217.1054495-2-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: tsc2046: rework the trigger state machine
Oleksij Rempel [Tue, 11 Jan 2022 13:04:02 +0000 (14:04 +0100)]
iio: adc: tsc2046: rework the trigger state machine

Initially this was designed to:
| Fix sleeping in atomic context warning and a deadlock after iio_trigger_poll()
| call
|
| If iio_trigger_poll() is called after IRQ was disabled, we will call
| reenable_trigger() directly from hard IRQ or hrtimer context instead of
| IRQ thread. In this case we will run in to multiple issue as sleeping in atomic
| context and a deadlock.
|
| To avoid this issue, rework the trigger to use state machine. All state
| changes are done over the hrtimer, so it allows us to drop fsleep() and
| avoid the deadlock.

Since this issue was fixed by: 9020ef659885 ("iio: trigger: Fix a scheduling
whilst atomic issue seen on tsc2046"). This patch is a cleanup to make
state machine easier to follow.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20220111130402.3404769-1-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add maintainer for ADRF6780 driver
Antoniu Miclaus [Mon, 3 Jan 2022 11:16:24 +0000 (13:16 +0200)]
MAINTAINERS: add maintainer for ADRF6780 driver

Add myself as maintainer for the ADRF6780 driver.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220103111624.82262-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: fix Analog Devices links
Antoniu Miclaus [Mon, 3 Jan 2022 10:44:12 +0000 (12:44 +0200)]
MAINTAINERS: fix Analog Devices links

The forum link for the Analog Devices linux drivers has changed.

Fix the links to redirect to the correct forum subsection.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220103104412.81247-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: core: Fix the kernel doc regarding the currentmode iio_dev entry
Miquel Raynal [Wed, 15 Dec 2021 15:13:35 +0000 (16:13 +0100)]
iio: core: Fix the kernel doc regarding the currentmode iio_dev entry

This is an internal variable, which should be accessed in a very
sporadic way and in no case changed by any device driver.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211215151344.163036-2-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: mt8186: Add compatible node for mt8186
Guodong Liu [Mon, 10 Jan 2022 08:48:41 +0000 (16:48 +0800)]
iio: adc: mt8186: Add compatible node for mt8186

This commit adds mt8186 compatible node.

Signed-off-by: Guodong Liu <guodong.liu@mediatek.com>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220110084841.575-2-guodong.liu@mediatek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: Add compatible for Mediatek MT8186
Guodong Liu [Mon, 10 Jan 2022 08:48:40 +0000 (16:48 +0800)]
dt-bindings: iio: adc: Add compatible for Mediatek MT8186

This commit adds dt-binding documentation of auxadc for Mediatek MT8186 SoC
Platform.

Signed-off-by: Guodong Liu <guodong.liu@mediatek.com>
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220110084841.575-1-guodong.liu@mediatek.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: st_sensors: don't always auto-enable I2C and SPI interface drivers
Nikita Yushchenko [Mon, 10 Jan 2022 15:24:32 +0000 (18:24 +0300)]
iio: st_sensors: don't always auto-enable I2C and SPI interface drivers

This patch makes I2C and SPI interface drivers for STMicroelectronics
sensor chips individually selectable via Kconfig.

The default is kept unchanged - I2C and SPI interface drivers are still
selected by default if the corresponding bus support is available.

However, the patch makes it possible to explicitly disable drivers
that are not needed for a particular target.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220110152432.3799227-1-nikita.yoush@cogentembedded.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: rzg2l_adc: Fix typo
Lad Prabhakar [Fri, 7 Jan 2022 17:25:29 +0000 (17:25 +0000)]
iio: adc: rzg2l_adc: Fix typo

Fix typo RZG2L_ADSMP_DEFUALT_SAMPLING -> RZG2L_ADSMP_DEFAULT_SAMPLING.

Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Link: https://lore.kernel.org/r/20220107172529.12361-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio/adc: ti,palmas-gpadc: Split interrupt fields in example
Rob Herring [Thu, 6 Jan 2022 18:25:11 +0000 (12:25 -0600)]
dt-bindings: iio/adc: ti,palmas-gpadc: Split interrupt fields in example

Best practice for multi-cell property values is to bracket each multi-cell
value.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220106182518.1435497-3-robh@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:accel:dmard09: Tidy up white space around {} in id table
Jonathan Cameron [Thu, 30 Dec 2021 17:49:11 +0000 (17:49 +0000)]
iio:accel:dmard09: Tidy up white space around {} in id table

Previously inconsistent with a space after { but not before }.
Tidy that up to avoid providing a bad example that might get
copied into other drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-17-jic23@kernel.org
2 years agoiio:proximity:vl53l0x: Tidy up white space around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:10 +0000 (17:49 +0000)]
iio:proximity:vl53l0x: Tidy up white space around {} in id tables

Previously inconsistent with a space after { but not before }.
Tidy that up to avoid providing a bad example that might get copied
into other drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ivan Drobyshevskyi <drobyshevskyi@gmail.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-16-jic23@kernel.org
2 years agoiio:light:tsl2722: Fix inconsistent spacing before } in id table
Jonathan Cameron [Thu, 30 Dec 2021 17:49:09 +0000 (17:49 +0000)]
iio:light:tsl2722: Fix inconsistent spacing before } in id table

The final entry was missing a space. Tidy that up.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-15-jic23@kernel.org
2 years agoiio:adc:ti-adc084s021: Tidy up white space around {}
Jonathan Cameron [Thu, 30 Dec 2021 17:49:08 +0000 (17:49 +0000)]
iio:adc:ti-adc084s021: Tidy up white space around {}

Previously inconsistent with a space after { but not before }.
Tidy that up to avoid providing an example to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-14-jic23@kernel.org
2 years agoiio:adc:hi8435: Tidy up white space around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:07 +0000 (17:49 +0000)]
iio:adc:hi8435: Tidy up white space around {} in id tables

Previously inconsistent with space after { but not before }.
Tidy that up to avoid providing a bad example to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-13-jic23@kernel.org
2 years agoiio:adc:mt6577_auxadc: Tidy up white space around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:06 +0000 (17:49 +0000)]
iio:adc:mt6577_auxadc: Tidy up white space around {} in id tables

Previously inconsistent with space after { and not before }.
Tidy that up to avoid providing a bad example to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Cc: Hui Liu <hui.liu@mediatek.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-12-jic23@kernel.org
2 years agoiio:frequency:admv1013: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:05 +0000 (17:49 +0000)]
iio:frequency:admv1013: White space cleanup of spacing around {} in id tables

The spacing was inconsistent with a space after the { but not
before the }. Tidy this up to avoid providing a bad example to copy into
new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-11-jic23@kernel.org
2 years agoiio:proximity:srf08: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:04 +0000 (17:49 +0000)]
iio:proximity:srf08: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent with a space after the {
but not before the }.  Tidy this up to avoid providing a bad example
to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-10-jic23@kernel.org
2 years agoiio:proximity:srf04: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:03 +0000 (17:49 +0000)]
iio:proximity:srf04: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent with a space after the {
but not before the }.  Tidy this up to avoid providing a bad example
to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-9-jic23@kernel.org
2 years agoiio:proximity:rfd77402: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:02 +0000 (17:49 +0000)]
iio:proximity:rfd77402: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent with a space after the {
but not before the }.  Tidy this up to avoid providing a bad example
to copy into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-8-jic23@kernel.org
2 years agoiio:proximity:ping: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:01 +0000 (17:49 +0000)]
iio:proximity:ping: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent so make sure we have a space
after { and before } for the two id tables.
Avoid providing examples of this inconsistency that get copied into new
drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-7-jic23@kernel.org
2 years agoiio:light:ltr501: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:49:00 +0000 (17:49 +0000)]
iio:light:ltr501: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent so make sure we have a space
after { and before } for the two id tables.
Part of aim is to avoid providing examples of this inconsistency that
get copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Nikita Travkin <nikita@trvn.ru>
Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-6-jic23@kernel.org
2 years agoiio:light:us5182: White space cleanup of spacing around {} in id tables
Jonathan Cameron [Thu, 30 Dec 2021 17:48:59 +0000 (17:48 +0000)]
iio:light:us5182: White space cleanup of spacing around {} in id tables

The spacing in this driver was inconsistent so make sure we have a space
after { and before } for the two id tables.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-5-jic23@kernel.org
2 years agoiio:light:vcnl4035: Trivial whitespace cleanup to add space before }
Jonathan Cameron [Thu, 30 Dec 2021 17:48:58 +0000 (17:48 +0000)]
iio:light:vcnl4035: Trivial whitespace cleanup to add space before }

Having a space after the { and not one before the } is inconsistent and
I'd rather not have examples of this that get copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-4-jic23@kernel.org
2 years agoiio:light:pa12203001: Tidy up white space change to add spaces after { and before }
Jonathan Cameron [Thu, 30 Dec 2021 17:48:57 +0000 (17:48 +0000)]
iio:light:pa12203001: Tidy up white space change to add spaces after { and before }

One case in here was inconsistent and was main focus of this patch.
In that case there was a space after the { and none before the }.
The second case was then inconsistent in having now spaces.
Change makes sure there are spaces.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-3-jic23@kernel.org
2 years agoiio:chemical:atlas: Trivial white space cleanup to add space before }
Jonathan Cameron [Thu, 30 Dec 2021 17:48:56 +0000 (17:48 +0000)]
iio:chemical:atlas: Trivial white space cleanup to add space before }

Having a space after the { and not one before the } is inconsistent and
good to remove examples that might get copied into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20211230174911.78291-2-jic23@kernel.org
2 years agoiio:proximity:sx9360: Add dt-binding support
Gwendal Grignou [Sat, 1 Jan 2022 20:38:00 +0000 (12:38 -0800)]
iio:proximity:sx9360: Add dt-binding support

Add support to configure sx9360 from dt-binding, to match device
hardware setup.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203800.290387-4-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings:iio:proximity: Add sx9360 binding
Gwendal Grignou [Sat, 1 Jan 2022 20:37:59 +0000 (12:37 -0800)]
dt-bindings:iio:proximity: Add sx9360 binding

Add binding to configure Semtech sx9360 sensor.
It is a simpler version of sx9324.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203800.290387-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:proximity:sx9360: Add sx9360 support
Gwendal Grignou [Sat, 1 Jan 2022 20:37:58 +0000 (12:37 -0800)]
iio:proximity:sx9360: Add sx9360 support

A simplified version of SX9324, it only have one pin and
2 phases (aka channels).
Only one event is presented.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203800.290387-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:proximity:sx9324: Add dt_binding support
Gwendal Grignou [Sat, 1 Jan 2022 20:38:17 +0000 (12:38 -0800)]
iio:proximity:sx9324: Add dt_binding support

Based on bindings/iio/proximity/semtech,sx9324.yaml, implement
retrieving sensor hardware property and alter default values.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203817.290512-6-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings:iio:proximity: Add sx9324 binding
Gwendal Grignou [Sat, 1 Jan 2022 20:38:16 +0000 (12:38 -0800)]
dt-bindings:iio:proximity: Add sx9324 binding

Similar to SX9310, add biddings to setup sx9324 hardware properties.
SX9324 is a little different, introduce 4 phases to be configured in 2
pairs over 3 antennas.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203817.290512-5-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:proximity:sx9324: Add SX9324 support
Gwendal Grignou [Sat, 1 Jan 2022 20:38:15 +0000 (12:38 -0800)]
iio:proximity:sx9324: Add SX9324 support

Semtech SAR sensor SX9324 is an evolution of the SX9310:
It has 4 phases that can be configured to capture and process data
from any of 3 CS pins and provide independent detection:
proximity, table proximity or body proximity.

Gather antenna data:
  echo sx9324-dev3 > trigger/current_trigger
  echo 1 > scan_elements/in_proximity0_en
  echo 1 > buffer/enable
  od -v -An --endian=big -t d2 -w2 /dev/iio\:device3
  (at 10Hz, the default).

Trigger events:
Setting:
  thresh_falling_period: 2 (events)
  thresh_rising_period: 2 (events)
  in_proximity0_thresh_either_value: 300
  in_proximity0_thresh_either_hysteresis: 72

using iio_event_monitor /dev/iio\:deviceX, approaching my hand to the
antenna pad, I see:
...
Event: time: 1634763907532035297, type: proximity, channel: 0, evtype:
thresh, direction: falling
Event: time: 1634763910138104640, type: proximity, channel: 0, evtype:
thresh, direction: rising
...

Datasheet: https://edit.wpgdadawant.com/uploads/news_file/program/2019/30184/tech_files/program_30184_suggest_other_file.pdf
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203817.290512-4-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:proximity:sx9310: Extract common Semtech sensor logic
Gwendal Grignou [Sat, 1 Jan 2022 20:38:14 +0000 (12:38 -0800)]
iio:proximity:sx9310: Extract common Semtech sensor logic

Before adding new Semtech sensors, move common logic to all Semtech SAR
sensor in its own file:
- interface with IIO subsystem,
- interrupt management,
- channel access conrol,
- event processing.

The change adds a bidirectional interface between sx93xx and sx_common.

The change is quite mechanical, as the impacted functions are moved
and renamed.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203817.290512-3-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:proximity:sx9310: Add frequency in read_avail
Gwendal Grignou [Sat, 1 Jan 2022 20:38:13 +0000 (12:38 -0800)]
iio:proximity:sx9310: Add frequency in read_avail

Instead of using IIO_DEV_ATTR_SAMP_FREQ_AVAIL sysfs attribute,
add a _FREQ case in read_avail() to display the frequency table.
No change to |sampling_frequency_available| was observed.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20220101203817.290512-2-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>