platform/kernel/linux-rpi.git
22 months agoiio: Use per-device lockdep class for mlock
Vincent Whitchurch [Mon, 29 Aug 2022 09:18:40 +0000 (11:18 +0200)]
iio: Use per-device lockdep class for mlock

If an IIO driver uses callbacks from another IIO driver and calls
iio_channel_start_all_cb() from one of its buffer setup ops, then
lockdep complains due to the lock nesting, as in the below example with
lmp91000.

Since the locks are being taken on different IIO devices, there is no
actual deadlock.  Fix the warning by telling lockdep to use a different
class for each iio_device.

 ============================================
 WARNING: possible recursive locking detected
 --------------------------------------------
 python3/23 is trying to acquire lock:
 (&indio_dev->mlock){+.+.}-{3:3}, at: iio_update_buffers

 but task is already holding lock:
 (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&indio_dev->mlock);
   lock(&indio_dev->mlock);

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 5 locks held by python3/23:
  #0: (sb_writers#5){.+.+}-{0:0}, at: ksys_write
  #1: (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter
  #2: (kn->active#14){.+.+}-{0:0}, at: kernfs_fop_write_iter
  #3: (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store
  #4: (&iio_dev_opaque->info_exist_lock){+.+.}-{3:3}, at: iio_update_buffers

 Call Trace:
  __mutex_lock
  iio_update_buffers
  iio_channel_start_all_cb
  lmp91000_buffer_postenable
  __iio_update_buffers
  enable_store

Fixes: 67e17300dc1d76 ("iio: potentiostat: add LMP91000 support")
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220829091840.2791846-1-vincent.whitchurch@axis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: add max11205 adc driver
Ramona Bolboaca [Wed, 31 Aug 2022 13:30:21 +0000 (16:30 +0300)]
iio: adc: add max11205 adc driver

Adding support for max11205 16-bit single-channel ultra-low power
delta-sigma adc.
The MAX11205 is compatible with the 2-wire interface and uses
SCLK and RDY/DOUT for serial communications. In this mode, all
controls are implemented by timing the high or low phase of the SCLK.
The 2-wire serial interface only allows for data to be read out through
the RDY/DOUT output.

Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX11205.pdf
Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220831133021.215625-2-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adc: Add max11205 documentation file
Ramona Bolboaca [Wed, 31 Aug 2022 13:30:20 +0000 (16:30 +0300)]
dt-bindings: iio: adc: Add max11205 documentation file

Add bindings documentation file and MAINTAINERS entry for MAX11205.

Signed-off-by: Ramona Bolboaca <ramona.bolboaca@analog.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220831133021.215625-1-ramona.bolboaca@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Use dev_err_probe()
Andy Shevchenko [Wed, 31 Aug 2022 14:15:30 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Use dev_err_probe()

Unify error message format by using dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Make strings const in chip info
Andy Shevchenko [Wed, 31 Aug 2022 14:15:29 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Make strings const in chip info

For better compiler coverage mark strings consts in the chip info.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: magnetometer: yamaha-yas530: Use pointers as driver data
Andy Shevchenko [Wed, 31 Aug 2022 14:15:28 +0000 (17:15 +0300)]
iio: magnetometer: yamaha-yas530: Use pointers as driver data

Unify ID tables to use pointers for driver data. It will allow
to simplify the driver later on.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220831141530.80572-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: tsc2046: silent spi_device_id warning
Oleksij Rempel [Sun, 4 Sep 2022 10:02:03 +0000 (12:02 +0200)]
iio: adc: tsc2046: silent spi_device_id warning

Add spi_device_id to silent following kernel runtime warning:
"SPI driver tsc2046 has no spi_device_id for ti,tsc2046e-adc".

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220904100203.3614502-3-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: adc: tsc2046: add vref support
Oleksij Rempel [Sun, 4 Sep 2022 10:02:02 +0000 (12:02 +0200)]
iio: adc: tsc2046: add vref support

If VREF pin is attached, we should use external VREF source instead of
the internal. Otherwise we will get wrong measurements on some of the channel
types.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220904100203.3614502-2-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: adc: ti,tsc2046: add vref-supply property
Oleksij Rempel [Sun, 4 Sep 2022 10:02:01 +0000 (12:02 +0200)]
dt-bindings: iio: adc: ti,tsc2046: add vref-supply property

Add property for the voltage reference supply.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220904100203.3614502-1-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: light: ltrf216a: Add raw attribute
Shreeya Patel [Fri, 12 Aug 2022 10:04:24 +0000 (15:34 +0530)]
iio: light: ltrf216a: Add raw attribute

Add IIO_CHAN_INFO_RAW to the mask to be able to read raw values
from the light sensor.

The userspace code for brightness control in steam deck uses the
in_illuminance_input value through sysfs and multiplies it
with a constant stored in BIOS at factory calibration time.

The downstream driver for LTRF216A that we have been using
has incorrect formula for LUX calculation which we corrected
in the upstreamed driver.

Now to be able to use the upstreamed driver, we need to add some
magic in userspace so that the brightness control works like before
even with the updated LUX formula.

Hence, we need the raw data to calculate a constant that can be
added in userspace code.

Downstream driver LUX formula :-
(greendata*8*LTRF216A_WIN_FAC) / (data->als_gain_fac*data->int_time_fac*10)

Upstreamed driver LUX formula :-
(greendata*45*LTRF216A_WIN_FAC) / (data->als_gain_fac*data->int_time_fac)

greendata is the ALS_DATA which we would like to get through sysfs using
the raw attribute.

Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Link: https://lore.kernel.org/r/20220812100424.529425-1-shreeya.patel@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: Add missing (unevaluated|additional)Properties on child nodes
Rob Herring [Tue, 23 Aug 2022 14:56:33 +0000 (09:56 -0500)]
dt-bindings: iio: Add missing (unevaluated|additional)Properties on child nodes

In order to ensure only documented properties are present, node schemas
must have unevaluatedProperties or additionalProperties set to false
(typically).

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220823145649.3118479-2-robh@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoMAINTAINERS: fix Analog Devices forum links
Antoniu Miclaus [Wed, 24 Aug 2022 17:09:13 +0000 (20:09 +0300)]
MAINTAINERS: fix Analog Devices forum links

Fix the links to redirect to the correct forum subsection for the latest
Analog Devices drivers added.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220824170913.13411-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio/accel: fix repeated words in comments
wangjianli [Tue, 23 Aug 2022 14:00:23 +0000 (22:00 +0800)]
iio/accel: fix repeated words in comments

Delete the redundant word 'in'.

Signed-off-by: wangjianli <wangjianli@cdjrlc.com>
Link: https://lore.kernel.org/r/20220823140023.2567-1-wangjianli@cdjrlc.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: iio: accel: add dt-binding schema for msa311 accel driver
Dmitry Rokosov [Mon, 22 Aug 2022 17:49:26 +0000 (17:49 +0000)]
dt-bindings: iio: accel: add dt-binding schema for msa311 accel driver

Introduce devicetree binding json-schema for MSA311 tri-axial,
low-g accelerometer driver.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220822175011.2886-5-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: add MEMSensing MSA311 3-axis accelerometer driver
Dmitry Rokosov [Mon, 22 Aug 2022 17:49:25 +0000 (17:49 +0000)]
iio: add MEMSensing MSA311 3-axis accelerometer driver

MSA311 is a tri-axial, low-g accelerometer with I2C digital output for
sensitivity consumer applications. It has dynamic user-selectable full
scales range of +-2g/+-4g/+-8g/+-16g and allows acceleration measurements
with output data rates from 1Hz to 1000Hz.

This driver supports following MSA311 features:
    - IIO interface
    - Different power modes: NORMAL and SUSPEND (using pm_runtime)
    - ODR (Output Data Rate) selection
    - Scale and samp_freq selection
    - IIO triggered buffer, IIO reg access
    - NEW_DATA interrupt + trigger

Below features to be done:
    - Motion Events: ACTIVE, TAP, ORIENT, FREEFALL
    - Low Power mode

Datasheet: https://cdn-shop.adafruit.com/product-files/5309/MSA311-V1.1-ENG.pdf
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220822175011.2886-4-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agodt-bindings: vendor-prefixes: add MEMSensing Microsystems Co., Ltd.
Dmitry Rokosov [Mon, 22 Aug 2022 17:49:24 +0000 (17:49 +0000)]
dt-bindings: vendor-prefixes: add MEMSensing Microsystems Co., Ltd.

MEMSensing Microsystems (Suzhou, China) Co., Ltd. operates as a micro
electromechanical system technology company which produces micro
electromechanical system microphones and sensors.
MEMSensing Microsystems (Suzhou, China) Co., Ltd. applies its products
in consumer electronics, industrial control, medical electronics
and automotive, and other fields.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220822175011.2886-3-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agolib/string_helpers: Add str_read_write() helper
Andy Shevchenko [Mon, 22 Aug 2022 17:49:23 +0000 (17:49 +0000)]
lib/string_helpers: Add str_read_write() helper

Add str_read_write() helper to return 'read' or 'write' string literal.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20220822175011.2886-2-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: common: scmi_sensors: use HZ macro from units.h
Dmitry Rokosov [Fri, 12 Aug 2022 16:52:27 +0000 (16:52 +0000)]
iio: common: scmi_sensors: use HZ macro from units.h

Remove duplicated definition of UHZ_PER_HZ, because it's available in
the units.h as MICROHZ_PER_HZ.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220812165243.22177-5-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agoiio: accel: adxl345: use HZ macro from units.h
Dmitry Rokosov [Fri, 12 Aug 2022 16:52:27 +0000 (16:52 +0000)]
iio: accel: adxl345: use HZ macro from units.h

Remove duplicated definition of NHZ_PER_HZ, because it's available in
the units.h as NANOHZ_PER_HZ.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220812165243.22177-4-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
22 months agounits: complement the set of Hz units
Dmitry Rokosov [Fri, 12 Aug 2022 16:52:26 +0000 (16:52 +0000)]
units: complement the set of Hz units

Currently, Hz units do not have milli, micro and nano Hz coefficients.
Some drivers (IIO especially) use their analogues to calculate
appropriate Hz values. This patch includes them to units.h definitions,
so they can be used from different kernel places.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20220812165243.22177-3-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: Avoid multiple line dereference for mask
Joe Simmons-Talbott [Fri, 19 Aug 2022 18:20:12 +0000 (14:20 -0400)]
iio: Avoid multiple line dereference for mask

Prefer lines > 80 characters over splitting dereferences across multiple
lines. Reported by checkpatch.pl.

Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
Link: https://lore.kernel.org/r/20220819182012.219523-1-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: stx104: Move to addac subdirectory
William Breathitt Gray [Mon, 15 Aug 2022 22:29:21 +0000 (18:29 -0400)]
iio: stx104: Move to addac subdirectory

The stx104 driver supports both ADC and DAC functionality.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/20220815222921.138945-1-william.gray@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agostaging: iio: frequency: ad9832: Fix alignment for DMA safety
Jonathan Cameron [Sat, 13 Aug 2022 16:06:00 +0000 (17:06 +0100)]
staging: iio: frequency: ad9832: Fix alignment for DMA safety

____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1.  Switch to the updated
IIO_DMA_MINALIGN definition.  Whilst here, move the marking to cover
the whole union. That has no functional affect, but makes it slightly
easier to see what is going on.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220813160600.1157169-1-jic23@kernel.org
23 months agodt-bindings: iio: temperature: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:21 +0000 (15:43 +0300)]
dt-bindings: iio: temperature: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-11-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: samsung,sensorhub-rinato: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:20 +0000 (15:43 +0300)]
dt-bindings: iio: samsung,sensorhub-rinato: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-10-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: potentiometer: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:19 +0000 (15:43 +0300)]
dt-bindings: iio: potentiometer: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-9-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: imu: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:18 +0000 (15:43 +0300)]
dt-bindings: iio: imu: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-8-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: health: ti,afe4403: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:17 +0000 (15:43 +0300)]
dt-bindings: iio: health: ti,afe4403: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: frequency: adf4371: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:16 +0000 (15:43 +0300)]
dt-bindings: iio: frequency: adf4371: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-6-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: dac: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:15 +0000 (15:43 +0300)]
dt-bindings: iio: dac: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-5-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: amplifiers: adi,ada4250: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:14 +0000 (15:43 +0300)]
dt-bindings: iio: amplifiers: adi,ada4250: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: accel: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:13 +0000 (15:43 +0300)]
dt-bindings: iio: accel: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: adc: use spi-peripheral-props.yaml
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:43:12 +0000 (15:43 +0300)]
dt-bindings: iio: adc: use spi-peripheral-props.yaml

Instead of listing directly properties typical for SPI peripherals,
reference the spi-peripheral-props.yaml schema.  This allows using all
properties typical for SPI-connected devices, even these which device
bindings author did not tried yet.

Remove the spi-* properties which now come via spi-peripheral-props.yaml
schema, except for the cases when device schema adds some constraints
like maximum frequency.

While changing additionalProperties->unevaluatedProperties, put it in
typical place, just before example DTS.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816124321.67817-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: adc: Drop Patrick Vasseur
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:54:01 +0000 (15:54 +0300)]
dt-bindings: iio: adc: Drop Patrick Vasseur

Emails to Patrick Vasseur bounce ("Unknown To address").

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816125401.70317-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: MAINTAINERS: Drop Tomislav Denis
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:54:00 +0000 (15:54 +0300)]
iio: MAINTAINERS: Drop Tomislav Denis

Emails to Tomislav Denis bounce ("550 5.1.1 User Unknown").

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220816125401.70317-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: Drop Tomislav Denis
Krzysztof Kozlowski [Tue, 16 Aug 2022 12:53:59 +0000 (15:53 +0300)]
dt-bindings: iio: Drop Tomislav Denis

Emails to Tomislav Denis bounce ("550 5.1.1 User Unknown").

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220816125401.70317-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: qcom-spmi-adc5: add ADC5_VREF_VADC to rev2 ADC5
Robert Marko [Thu, 18 Aug 2022 22:18:13 +0000 (00:18 +0200)]
iio: adc: qcom-spmi-adc5: add ADC5_VREF_VADC to rev2 ADC5

Add support for ADC5_VREF_VADC channel to rev2 ADC5 channel list.
This channel measures the VADC reference LDO output.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220818221815.346233-3-robimarko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: imu: inv_mpu6050: move from strlcpy with unused retval to strscpy
Wolfram Sang [Fri, 19 Aug 2022 17:23:48 +0000 (18:23 +0100)]
iio: imu: inv_mpu6050: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: st_sensors: move from strlcpy with unused retval to strscpy
Wolfram Sang [Thu, 18 Aug 2022 21:00:16 +0000 (23:00 +0200)]
iio: st_sensors: move from strlcpy with unused retval to strscpy

Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220818210017.6817-1-wsa+renesas@sang-engineering.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: frequency: admv1014: return -EINVAL directly
Antoniu Miclaus [Fri, 19 Aug 2022 10:41:17 +0000 (13:41 +0300)]
iio: frequency: admv1014: return -EINVAL directly

Remove extra step where the error code is assigned to the `ret`
variable.

Return instead error code directly.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20220819104117.4600-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: pressure: dlhl60d: Don't take garbage into consideration when reading data
Andy Shevchenko [Tue, 26 Jul 2022 14:20:48 +0000 (17:20 +0300)]
iio: pressure: dlhl60d: Don't take garbage into consideration when reading data

Both pressure and temperature are 24-bit long. Use proper accessors
instead of overlapping readings.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220726142048.4494-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Add YAS537 variant
Jakob Hauser [Fri, 12 Aug 2022 22:05:03 +0000 (00:05 +0200)]
iio: magnetometer: yas530: Add YAS537 variant

Add support for the magnetometer Yamaha YAS537. The additions are based on
comparison of Yamaha Android kernel drivers for YAS532 [1] and YAS537 [2].

In the Yamaha YAS537 Android driver, there is an overflow/underflow control
implemented. For regular usage, this seems not necessary. A similar overflow/
underflow control of Yamaha YAS530/532 Android driver isn't integrated in the
mainline driver. It is therefore skipped for YAS537 in the mainline too.

Also in the Yamaha YAS537 Android driver, at the end of the reset_yas537()
function, a measurement is saved in "last_after_rcoil". Later on, this is
compared to current measurements. If the difference gets too big, a new
reset is initialized. The difference in measurements needs to be quite big,
it's hard to say if this is necessary for regular operation. Therefore this
isn't integrated in the mainline driver either.

[1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c
[2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas537.c

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/264c6488733a5c32089c9ab406a5bcb808c48fef.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Add function pointers to "chip_info"
Jakob Hauser [Fri, 12 Aug 2022 22:05:02 +0000 (00:05 +0200)]
iio: magnetometer: yas530: Add function pointers to "chip_info"

Add function pointers to the "chip_info" structure to ease the handling of
different YAS variants.

In the function yas5xx_probe(), the function call for "measure_offsets" was
added as a conditional "if (ci->measure_offsets)". This is a preparatory step
for YAS537, as this variant doesn't need an offset measurement.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/4bd3f96262e0132b7f9720521a801da3c18abd95.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Add temperature calculation to "chip_info"
Jakob Hauser [Fri, 12 Aug 2022 22:05:01 +0000 (00:05 +0200)]
iio: magnetometer: yas530: Add temperature calculation to "chip_info"

Add temperature calculation to the "chip_info" structure to ease the handling
of different YAS variants.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/1a8bffdb7e807455620a73f2d61981e7f9aab8d5.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Add IIO scaling to "chip_info"
Jakob Hauser [Fri, 12 Aug 2022 22:05:00 +0000 (00:05 +0200)]
iio: magnetometer: yas530: Add IIO scaling to "chip_info"

Add IIO scaling to the "chip_info" structure to ease the handling to
different YAS variants.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/a12f892633bbee13a8856c231dc793ebbc5d3a03.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Add volatile registers to "chip_info"
Jakob Hauser [Fri, 12 Aug 2022 21:54:15 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Add volatile registers to "chip_info"

Add volatile registers to the "chip_info" structure to ease the handling of
different YAS variants.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/aeba3877933ba9d2c920b459a9037d9186c15a4f.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Introduce "chip_info" structure
Jakob Hauser [Fri, 12 Aug 2022 21:54:14 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Introduce "chip_info" structure

Introduce the "chip_info" structure approach for better variant handling.

The variant to be used is now chosen by the Device Tree (enum "chip_ids"),
not by the chip ID in the register. However, there is a check to make sure
they match (using integer "id_check").

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/57236545107286771d351b95091bf56815d3717d.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Apply documentation and style fixes
Jakob Hauser [Fri, 12 Aug 2022 21:54:13 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Apply documentation and style fixes

This commit gathers several minor changes.

In the device examples, "Xiaomi" is too generic, specific devices should be
listed here. E.g. Xiaomi Redmi 2 seems to have YAS537 but it's not fully clear
if this applies to all its variants. Samsung Galaxy S7 is often quoted in
conjunction with YAS537.

Removed defines for device IDs of YAS537 and YAS539, they are not needed so far.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/300e394a76eb30fa031ecb69b594e9f9a70dac42.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Move printk %*ph parameters out from stack
Jakob Hauser [Fri, 12 Aug 2022 21:54:12 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Move printk %*ph parameters out from stack

Use less stack by modifying %*ph parameters.

While at it, in the function yas530_get_calibration_data(), the debug dump was
extended to 16 elements as this is the size of the calibration data array of
YAS530.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/93b50c20adb1b2acb4cddb1ab25755070edd7c07.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Rename functions and registers
Jakob Hauser [Fri, 12 Aug 2022 21:54:11 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Rename functions and registers

This is a preparation for adding the YAS537 variant.

Functions that are used only by YAS530, YAS532 and YAS533 are renamed from
yas5xx to yas530. Same for the registers.

To avoid part listing in function and registers names, the name of the first
variant is used. Where appropriate, comments were added that these functions
are used by more than one variant.

Functions that will be used by all variants including YAS537 remain in the
naming scheme yas5xx. Or YAS5XX for registers, respectively.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/344d3b2f5e050eab79ce9962c24781486774d9fb.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Change data type of calibration coefficients
Jakob Hauser [Fri, 12 Aug 2022 21:54:10 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Change data type of calibration coefficients

This is a preparation for adding YAS537 variant.

YAS537 uses other data types on the calibration coefficients [1] than YAS530 [2]
and YAS532 [3].

On YAS537, at least for a4 and a7 this could matter because 8-bit unsigned data
from the register gets stored into a signed data type, therefore this should be
8-bit as well.

For YAS530/532, on the other hand, it doesn't seem to matter. The size of a2-a9
and k is smaller than 8-bit at extraction, also the applied math is low. And
Cx/Cy1/Cy2, now being defined as signed 16-bit, are extracted as unsigned 8-bit
and undergo only minor math.

[1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas537.c#L76-L78
[2] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas_mag_driver-yas530.c#L526-L527
[3] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L76-L77

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/f1e53bd6672aebe59f9b236b41374482edf888f8.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Correct temperature handling
Jakob Hauser [Fri, 12 Aug 2022 21:54:09 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Correct temperature handling

The raw temperature value is a number of counts from a certain starting
point. The resolution of the temperature counts is different for the YAS
variants.

Temperature compensation for YAS532 version AC seems to be handled differently.
It uses the deviation from 20 degree Celsius [1] whereas YAS530 and older
versions of YAS532 apply solely the t value as a multiplier [2][3].

In funtion yas5xx_read_raw(), add case IIO_CHAN_INFO_PROCESSED. Remove scale
of temperature as this isn't applied.

Additionally correct sign of temperature channel in iio_chan_spec. It's already
defined that way in the yas5xx_get_measure() function.

[1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L442
[2] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas_mag_driver-yas530.c#L881-L883
[3] https://github.com/LineageOS/android_kernel_samsung_msm8930-common/blob/lineage-18.1/drivers/sensors/geomagnetic/yas_mag_driver-yas53x.c#L856-L858

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/eb45f328c7a81eb622c6a8cfc5c468ea58bbdace.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Correct scaling of magnetic axes
Jakob Hauser [Fri, 12 Aug 2022 21:54:08 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Correct scaling of magnetic axes

Looks like YAS530 raw values return picotesla and YAS532 nanotesla. Adapt
comments and scaling.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/053ab05cb9a0f6b0536ab5e0de57009f513c6f81.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Change range of data in volatile register
Jakob Hauser [Fri, 12 Aug 2022 21:54:07 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Change range of data in volatile register

In function yas5xx_volatile_reg(), register "YAS5XX_MEASURE_DATA + 8" shouldn't
be volatile as we count from 0 to 7 here.

Instead of lowering the number from 8 to 7, the operator "<=" is replaced by
"<". The size of the measure data array is 8, therefore it's more natural to
use 8 as a constant.

This change is of low importance as the "+ 8" register isn't called.

Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/dabba10feb80171350525ac874f944076c46e084.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magnetometer: yas530: Change data type of hard_offsets to signed
Jakob Hauser [Fri, 12 Aug 2022 21:54:06 +0000 (23:54 +0200)]
iio: magnetometer: yas530: Change data type of hard_offsets to signed

The "hard_offsets" are currently unsigned u8 but they should be signed as they
can get negative. They are signed in function yas5xx_meaure_offsets() and in the
Yamaha drivers [1][2].

[1] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas.h#L156
[2] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L91

Fixes: de8860b1ed47 ("iio: magnetometer: Add driver for Yamaha YAS530")
Signed-off-by: Jakob Hauser <jahau@rocketmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/40f052bf6491457d0c5c0ed4c3534dc6fa251c3c.1660337264.git.jahau@rocketmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agodt-bindings: iio: mlx90632 Add supply regulator documentation
Crt Mori [Mon, 8 Aug 2022 14:49:36 +0000 (16:49 +0200)]
dt-bindings: iio: mlx90632 Add supply regulator documentation

Document the newly added vdd supply option.

Signed-off-by: Crt Mori <cmo@melexis.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220808144936.1559158-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: temperature: mlx90632 Add supply regulator to sensor
Crt Mori [Mon, 8 Aug 2022 14:49:08 +0000 (16:49 +0200)]
iio: temperature: mlx90632 Add supply regulator to sensor

Provide possibility to toggle power supply to the sensor so that user
can optimize their setup and not have the sensor constantly powered.

Signed-off-by: Crt Mori <cmo@melexis.com>
Link: https://lore.kernel.org/r/20220808144908.1559069-1-cmo@melexis.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: imu: adis16475: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:40 +0000 (22:47 +0200)]
iio: imu: adis16475: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: frequency: adrf6780: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:39 +0000 (22:47 +0200)]
iio: frequency: adrf6780: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: frequency: adf4371: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:37 +0000 (22:47 +0200)]
iio: frequency: adf4371: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: xilinx-xadc: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:36 +0000 (22:47 +0200)]
iio: adc: xilinx-xadc: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: xilinx-ams: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:35 +0000 (22:47 +0200)]
iio: adc: xilinx-ams: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ti-ads131e08: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:34 +0000 (22:47 +0200)]
iio: adc: ti-ads131e08: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: lpc18xx: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:32 +0000 (22:47 +0200)]
iio: adc: lpc18xx: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:31 +0000 (22:47 +0200)]
iio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify

Make use of devm_clk_get_prepared() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ad9467: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:30 +0000 (22:47 +0200)]
iio: adc: ad9467: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ad7768-1: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:29 +0000 (22:47 +0200)]
iio: adc: ad7768-1: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ad7124: Benefit from devm_clk_get_enabled() to simplify
Uwe Kleine-König [Mon, 8 Aug 2022 20:47:28 +0000 (22:47 +0200)]
iio: adc: ad7124: Benefit from devm_clk_get_enabled() to simplify

Make use of devm_clk_get_enabled() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220808204740.307667-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: magn: hmc5843: Move struct dev_pm_ops out of header
Jonathan Cameron [Sun, 7 Aug 2022 18:45:34 +0000 (19:45 +0100)]
iio: magn: hmc5843: Move struct dev_pm_ops out of header

Having this structure defined static in the header lead to
unnecessary duplication and required additional symbol exports.
Use the EXPORT_NS_SIMPLE_DEV_PM_OPS() to clean this up in the same
fashion as many other drivers do this.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807184534.1037363-3-jic23@kernel.org
23 months agoiio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver
Jonathan Cameron [Sun, 7 Aug 2022 18:45:33 +0000 (19:45 +0100)]
iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver

This formatting is odd, so fix it to be more standard.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807184534.1037363-2-jic23@kernel.org
23 months agoiio: adc: mt6360: Drop an incorrect __maybe_unused marking.
Jonathan Cameron [Sun, 7 Aug 2022 16:21:21 +0000 (17:21 +0100)]
iio: adc: mt6360: Drop an incorrect __maybe_unused marking.

Given the struct platform_driver has one of it's elements assigned to
point to the of_device_id table, it is never going to be unused.

Drop the marking.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Gene Chen <gene_chen@richtek.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807162121.862894-1-jic23@kernel.org
23 months agostaging: iio: resolver: ad2s1210: Fix alignment for DMA safety
Jonathan Cameron [Sun, 7 Aug 2022 15:12:18 +0000 (16:12 +0100)]
staging: iio: resolver: ad2s1210: Fix alignment for DMA safety

____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1.  Switch to the updated
IIO_DMA_MINALIGN definition.  As the tx[] an rx[] buffers are only used
in the same SPI exchanges, we should be safe with them on the same cacheline.
Hence only mark the first one __aligned(IIO_DMA_MINALIGN).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807151218.656881-5-jic23@kernel.org
23 months agostaging: iio: meter: ade7854: Fix alignment for DMA safety
Jonathan Cameron [Sun, 7 Aug 2022 15:12:17 +0000 (16:12 +0100)]
staging: iio: meter: ade7854: Fix alignment for DMA safety

____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1.  Switch to the updated
IIO_DMA_MINALIGN definition.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Link: https://lore.kernel.org/r/20220807151218.656881-4-jic23@kernel.org
23 months agostaging: iio: frequency: ad9834: Fix alignment for DMA safety
Jonathan Cameron [Sun, 7 Aug 2022 15:12:16 +0000 (16:12 +0100)]
staging: iio: frequency: ad9834: Fix alignment for DMA safety

____cacheline_aligned is an insufficient guarantee for non-coherent DMA
on platforms with 128 byte cachelines above L1.  Switch to the updated
IIO_DMA_MINALIGN definition.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807151218.656881-3-jic23@kernel.org
23 months agoiio: light: cm32181: Mark the dev_pm_ops static.
Jonathan Cameron [Sun, 7 Aug 2022 14:54:57 +0000 (15:54 +0100)]
iio: light: cm32181: Mark the dev_pm_ops static.

Only accessed from the local file.
Warning:
  drivers/iio/light/cm32181.c:508:1: warning: symbol 'cm32181_pm_ops' was not declared. Should it be static?

Fixes: 68c1b3dd5c48 ("iio: light: cm32181: Add PM support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807145457.646062-3-jic23@kernel.org
23 months agoiio: test: Mark file local structure arrays static.
Jonathan Cameron [Sun, 7 Aug 2022 14:54:56 +0000 (15:54 +0100)]
iio: test: Mark file local structure arrays static.

Warning cleanup:
  drivers/iio/test/iio-test-rescale.c:32:30: warning: symbol 'scale_cases' was not declared. Should it be static?
  drivers/iio/test/iio-test-rescale.c:480:30: warning: symbol 'offset_cases' was not declared. Should it be static?

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807145457.646062-2-jic23@kernel.org
23 months agodt-bindings: iio: adc: stmpe: Remove node name requirement
Francesco Dolcini [Tue, 12 Jul 2022 16:33:44 +0000 (18:33 +0200)]
dt-bindings: iio: adc: stmpe: Remove node name requirement

STMPE driver does not require a specific node name anymore, only the
compatible is checked, update binding according to this.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220712163345.445811-5-francesco.dolcini@toradex.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: cdc: ad7746: Move driver out of staging.
Jonathan Cameron [Sun, 7 Aug 2022 14:01:44 +0000 (15:01 +0100)]
iio: cdc: ad7746: Move driver out of staging.

All known major issues with this driver resolved so time to move
it out of staging. This also allows us to remove the now empty
staging/iio/cdc directory and build files.

Note this cleanup work was done using the roadtest framework.
https://lore.kernel.org/all/20220311162445.346685-1-vincent.whitchurch@axis.com/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
23 months agoiio: cdc: ad7746: Add device specific ABI documentation.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:36 +0000 (13:29 +0100)]
iio: cdc: ad7746: Add device specific ABI documentation.

The datasheet description of offset calibration is complex, so for that
on just refer the reader to the device datasheet.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-16-jic23@kernel.org
23 months agostaging: iio: ad7746: White space cleanup
Jonathan Cameron [Sun, 26 Jun 2022 12:29:35 +0000 (13:29 +0100)]
staging: iio: ad7746: White space cleanup

Tidy up some trivial whitespace issues.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-15-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Use read_avail() rather than opencoding.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:34 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Use read_avail() rather than opencoding.

Switch over to the IIO core handling for _available attributes
making them available for in kernel users and enforcing correct
naming etc automatically.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-14-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Switch from _offset to _zeropoint for differential channels.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:33 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Switch from _offset to _zeropoint for differential channels.

As this offset is applied equally to both lines of the differential
pair, _ofset should not be used. Use the new ABI _zeropoint instead
to avoid userspace software applying this value when calculating
real value = (_raw + _offset) * _scale

Also add a comment to explain why an offset of 0x800000 is applied
within the driver rather than exposed to userspace.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-13-jic23@kernel.org
23 months agoiio: core: Introduce _zeropoint for differential channels
Jonathan Cameron [Sun, 26 Jun 2022 12:29:32 +0000 (13:29 +0100)]
iio: core: Introduce _zeropoint for differential channels

Address an ABI gap for device where the offset of both lines in a
differential pair may be controlled so as to allow a wider range of
inputs, but without having any direct effect of the differential
measurement.

_offset cannot be used as to remain in line with existing usage,
userspace would be expected to apply it as (_raw + _offset) * _scale
whereas _zeropoint is not. i.e. If we were computing the differential
in software it would be.
((postive_raw + _zeropoint) - (negative_raw + zeropoint) + _offset) * _scale
= ((postive_raw - negative_raw) + _offset) * _scale
= (differential_raw + _offset) * _scale

Similarly calibbias is expected to tweak the measurement seen, not
the adjust the two lines of the differential pair.

Needed for in_capacitanceX-capacitanceY_zeropoint for the
AD7746 CDC driver.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-12-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Use _raw and _scale for temperature channels.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:31 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Use _raw and _scale for temperature channels.

Performing the maths to rescale a 24 bit raw reading within the driver
was resulting in precision losses.  So make that userspace's problem
by exporting the scale and letting the maths be done in userspace with
appropriate precision.  Issue identified using roadtester testing
framework.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-11-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Drop unused i2c_set_clientdata()
Jonathan Cameron [Sun, 26 Jun 2022 12:29:30 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Drop unused i2c_set_clientdata()

As the comment states, this was only used in remove() and now
there is no explicit remove() function to make use of it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-10-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Break up use of chan->address and use FIELD_PREP etc
Jonathan Cameron [Sun, 26 Jun 2022 12:29:29 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Break up use of chan->address and use FIELD_PREP etc

Instead of encoding several different fields into chan->address use
an indirection to a separate per channel structure where the various
fields can be expressed in a more readable form.  This also allows
the register values to be constructed at runtime using FIELD_PREP().

Drop the now redundant _SHIFT macros.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-9-jic23@kernel.org
23 months agostaging: iio: cdc: ad7764: Push locking down into case statements in read/write_raw
Jonathan Cameron [Sun, 26 Jun 2022 12:29:28 +0000 (13:29 +0100)]
staging: iio: cdc: ad7764: Push locking down into case statements in read/write_raw

Not all paths require any locking at all. So to simplify the
removal of such locking push the locks down into the individual
case statements.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-8-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Factor out ad7746_read_channel()
Jonathan Cameron [Sun, 26 Jun 2022 12:29:27 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Factor out ad7746_read_channel()

Reduce deep indenting and simplify the locking cleanup that follows.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-7-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Use local buffer for multi byte reads.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:26 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Use local buffer for multi byte reads.

I2C does not require DMA safe buffers so there is no need to ensure
the buffers are in their own cacheline. Hence simplify things by
using a local variable instead of embedding the buffer in the chip
info structure.

Includes a trivial whitespace cleanup to drop a line between function
and error handling.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-6-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Push handling of supply voltage scale to userspace.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:25 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Push handling of supply voltage scale to userspace.

The supply voltage is attenuated by 6 before being fed to the ADC.
Handle this explicitly rather than pre-multiplying the _raw value by 6.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-5-jic23@kernel.org
23 months agostaging: iio: cdc: ad7746: Use explicit be24 handling.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:24 +0000 (13:29 +0100)]
staging: iio: cdc: ad7746: Use explicit be24 handling.

Chance from fiddly local implementation of be24 to cpu endian conversion
by reading into a 3 byte buffer and using get_unaligned_be24()

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-4-jic23@kernel.org
23 months agoiio: ABI: Fix wrong format of differential capacitance channel ABI.
Jonathan Cameron [Sun, 26 Jun 2022 12:29:23 +0000 (13:29 +0100)]
iio: ABI: Fix wrong format of differential capacitance channel ABI.

in_ only occurs once in these attributes.

Fixes: 0baf29d658c7 ("staging:iio:documentation Add abi docs for capacitance adcs.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220626122938.582107-3-jic23@kernel.org
23 months agoiio: inkern: fix coding style warnings
Nuno Sá [Fri, 15 Jul 2022 12:29:03 +0000 (14:29 +0200)]
iio: inkern: fix coding style warnings

Just cosmetics. No functional change intended...

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-16-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: inkern: remove OF dependencies
Nuno Sá [Fri, 15 Jul 2022 12:29:02 +0000 (14:29 +0200)]
iio: inkern: remove OF dependencies

Since all users of the OF dependendent API are now converted to use the
firmware agnostic alternative, we can drop OF dependencies from the IIO
in kernel interface.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-15-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: stm32-adc: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:29:01 +0000 (14:29 +0200)]
iio: adc: stm32-adc: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Tested-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220715122903.332535-14-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: qcom-spmi-adc5: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:29:00 +0000 (14:29 +0200)]
iio: adc: qcom-spmi-adc5: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-13-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: qcom-spmi-vadc: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:28:59 +0000 (14:28 +0200)]
iio: adc: qcom-spmi-vadc: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-12-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: qcom-pm8xxx-xoadc: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:28:58 +0000 (14:28 +0200)]
iio: adc: qcom-pm8xxx-xoadc: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-11-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: at91-sama5d2_adc: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:28:57 +0000 (14:28 +0200)]
iio: adc: at91-sama5d2_adc: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20220715122903.332535-10-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
23 months agoiio: adc: ab8500-gpadc: convert to device properties
Nuno Sá [Fri, 15 Jul 2022 12:28:56 +0000 (14:28 +0200)]
iio: adc: ab8500-gpadc: convert to device properties

Make the conversion to firmware agnostic device properties. As part of
the conversion the IIO inkern interface 'of_xlate()' is also converted to
'fwnode_xlate()'. The goal is to completely drop 'of_xlate' and hence OF
dependencies from IIO.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220715122903.332535-9-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>