platform/kernel/linux-starfive.git
4 years agoiio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*
Jonathan Cameron [Sun, 5 Apr 2020 18:03:20 +0000 (19:03 +0100)]
iio:magn:mmc35240: Drop unnecessary casts of val parameter in regmap_bulk*

Given the parameter is void *, casting to u8 * is unnecessary.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
4 years agoiio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.
Jonathan Cameron [Sun, 5 Apr 2020 18:03:19 +0000 (19:03 +0100)]
iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.

A mixture of:
* Casts to u8 * for the val parameter which is void * and so needs no cast.
* Explicit sizes when we can use sizeof on the destination / source variable.

Not broken in anyway, I'm just trying to tidy up the is in the subsystem to
avoid it getting cut and paste into new drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
4 years agoiio:chemical:bme680: Tidy up parameters to regmap_bulk_read
Jonathan Cameron [Sun, 5 Apr 2020 18:03:18 +0000 (19:03 +0100)]
iio:chemical:bme680: Tidy up parameters to regmap_bulk_read

A mixture of:
* Unnecessary casts of val parameter to u8 * which makes little sense as
  the function take a void *.
* Explicit sizes where we can use the destination type to define that.
  Note that's not true in all cases as we do read 3 bytes into 4 byte
  destinations.

Note that noting was broken here, I'm just trying to ensure this doesn't
get cut and paste into more drivers so cleaning these out subsystem wide.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
4 years agoiio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls
Jonathan Cameron [Sun, 5 Apr 2020 18:03:17 +0000 (19:03 +0100)]
iio:chemical:atlas-sensor: Drop unnecessary explicit casts in regmap_bulk_read calls

regmap_bulk_read takes a void * for its val parameter. It certainly
makes no sense to cast to a (u8 *) + no need to explicitly cast
at all when converting another pointer type to void *.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
4 years agoiio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls
Jonathan Cameron [Sun, 5 Apr 2020 18:03:16 +0000 (19:03 +0100)]
iio:accel:mxc4005: Drop unnecessary explicit casts in regmap_bulk_read calls

regmap_bulk_read takes a void * for its val parameter. It certainly
makes no sense to cast to a (u8 *) + no need to explicitly cast
at all when converting another pointer type to void *.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
4 years agoiio: imu: st_lsm6dsx: drop huge include in sensor-hub driver
Lorenzo Bianconi [Mon, 6 Apr 2020 19:00:25 +0000 (21:00 +0200)]
iio: imu: st_lsm6dsx: drop huge include in sensor-hub driver

st_lsm6dsx is a standalone driver for STM IMU sensors and does not rely
on st_sensor common framework, so it does not include st_sensor common
definitions.
In st_lsm6dsx_shub driver st_sensors.h is used just to introduce the
default wai address for LIS3MDL sensor.
Drop this largely unconnected include file and introduce the default wai
address for LIS3MDL in st_lsm6dsx_ext_dev_settings register map

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: drop devm_iio_kfifo_free() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:27 +0000 (15:52 +0200)]
iio: buffer: drop devm_iio_kfifo_free() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: drop devm_iio_hw_consumer_free() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:26 +0000 (15:52 +0200)]
iio: buffer: drop devm_iio_hw_consumer_free() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: inkern: drop devm_iio_channel_release{_all} API calls
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:25 +0000 (15:52 +0200)]
iio: inkern: drop devm_iio_channel_release{_all} API calls

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: drop devm_iio_trigger_free() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:24 +0000 (15:52 +0200)]
iio: core: drop devm_iio_trigger_free() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: drop devm_iio_trigger_unregister() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:23 +0000 (15:52 +0200)]
iio: core: drop devm_iio_trigger_unregister() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: drop devm_iio_device_free() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:22 +0000 (15:52 +0200)]
iio: core: drop devm_iio_device_free() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

This is the last user of 'devm_iio_device_match()', so it can be removed as
well in this patch.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: drop devm_iio_triggered_buffer_cleanup() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:21 +0000 (15:52 +0200)]
iio: core: drop devm_iio_triggered_buffer_cleanup() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: drop devm_iio_device_unregister() API call
Alexandru Ardelean [Thu, 27 Feb 2020 13:52:20 +0000 (15:52 +0200)]
iio: core: drop devm_iio_device_unregister() API call

It's unused so far, so it can be removed. Also makes sense to remove it
to discourage weird uses of this call during review.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: move 'indio_dev->info' null check first in __iio_device_register()
Alexandru Ardelean [Tue, 7 Apr 2020 15:07:43 +0000 (18:07 +0300)]
iio: move 'indio_dev->info' null check first in __iio_device_register()

Moves this to be the first check, as it's very simple and fails the
registration earlier, instead of potentially initializing the
'indio_dev->label' and checking for duplicate indexes, and then failing
with this simple-check.

This is a minor optimization, since '__iio_device_register()' will waste
fewer validation cycles in case 'indio_dev->info' is NULL.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: remove 'scan_el_attrs' attribute group from buffer struct
Alexandru Ardelean [Fri, 10 Apr 2020 09:36:07 +0000 (12:36 +0300)]
iio: buffer: remove 'scan_el_attrs' attribute group from buffer struct

This field doesn't seem used. It seems that only 'buffer->attrs' was ever
used to extend sysfs attributes for an IIO buffer.

Moving forward, it may not make sense to keep it. This patch removes the
field and it's initialization code.

Since we want to rework IIO buffer, to be able to add more buffers per IIO
device, we will merge [somehow] the 'buffer' & 'scan_elements' groups, and
we will continue to add the attributes to the 'buffer' group.

Removing it here, will also make the rework here a bit smaller, since
this code will not be present.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis: Add a missing '\n' in a log message
Christophe JAILLET [Fri, 10 Apr 2020 17:12:24 +0000 (19:12 +0200)]
iio: imu: adis: Add a missing '\n' in a log message

Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'.

Fixes: 1fd456702692 ("iio: imu: adis: add support product ID check in adis_initial_startup")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: xilinx-xadc: Fix typo
Lars-Peter Clausen [Fri, 3 Apr 2020 13:27:17 +0000 (15:27 +0200)]
iio: xilinx-xadc: Fix typo

Fix a typo. 'at the a time' -> 'at a time'.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: rockchip-saradc: add description for px30
Johan Jonker [Sat, 4 Apr 2020 10:27:30 +0000 (12:27 +0200)]
dt-bindings: iio: adc: rockchip-saradc: add description for px30

The description below is already in use for px30.dtsi,
but was somehow never added to a document, so add
"rockchip,px30-saradc", "rockchip,rk3399-saradc"
for saradc nodes on a px30 platform to rockchip-saradc.yaml.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: rockchip-saradc: add description for rk3308
Johan Jonker [Sat, 4 Apr 2020 10:27:29 +0000 (12:27 +0200)]
dt-bindings: iio: adc: rockchip-saradc: add description for rk3308

The description below is already in use for rk3308.dtsi,
but was somehow never added to a document, so add
"rockchip,rk3308-saradc", "rockchip,rk3399-saradc"
for saradc nodes on a rk3308 platform to rockchip-saradc.yaml.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: convert rockchip saradc bindings to yaml
Johan Jonker [Sat, 4 Apr 2020 10:27:28 +0000 (12:27 +0200)]
dt-bindings: iio: adc: convert rockchip saradc bindings to yaml

Current dts files with 'saradc' nodes are manually verified.
In order to automate this process rockchip-saradc.txt
has to be converted to yaml.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: dma-buffer: Cleanup buffer.h/buffer_impl.h includes
Lars-Peter Clausen [Wed, 1 Apr 2020 16:57:06 +0000 (18:57 +0200)]
iio: dma-buffer: Cleanup buffer.h/buffer_impl.h includes

The IIO DMA buffer is a DMA buffer implementation. As such it should
include buffer_impl.h rather than buffer.h.

The include to buffer.h in buffer-dma.h should be buffer_impl.h so it has
access to the struct iio_buffer definition. The code currently only works
because all places that use buffer-dma.h include buffer_impl.h before it.

The include to buffer.h in industrialio-buffer-dma.c  can be removed since
those file does not reference any of buffer consumer functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: Add MAX1241 driver
Alexandru Lazar [Fri, 3 Apr 2020 12:13:23 +0000 (15:13 +0300)]
iio: adc: Add MAX1241 driver

Add driver for the Maxim MAX1241 12-bit, single-channel ADC.

Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX1240-MAX1241.pdf
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Alexandru Lazar <alazar@startmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: Add MAX1241 bindings
Alexandru Lazar [Fri, 3 Apr 2020 12:13:22 +0000 (15:13 +0300)]
dt-bindings: iio: adc: Add MAX1241 bindings

Add device-tree bindings documentation for the MAX1241 device driver.

Signed-off-by: Alexandru Lazar <alazar@startmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: accel: st_sensors: add support for LIS2HH12
Gaëtan André [Mon, 30 Mar 2020 14:19:23 +0000 (16:19 +0200)]
iio: accel: st_sensors: add support for LIS2HH12

Add support for STMicroelectronics LISHH12 accelerometer in st_accel
framework.

https://www.st.com/resource/en/datasheet/lis2hh12.pdf

Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: st_sensors: add st,lis2hh12 compatible entry
Gaëtan André [Mon, 30 Mar 2020 14:19:22 +0000 (16:19 +0200)]
dt-bindings: st_sensors: add st,lis2hh12 compatible entry

Add LIS2HH12 compatible entry.

Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: Add sensor hub device LIS3MDL
Jimmy Assarsson [Sat, 28 Mar 2020 18:45:19 +0000 (19:45 +0100)]
iio: imu: st_lsm6dsx: Add sensor hub device LIS3MDL

Add LIS3MDL register map to sensor hub device table.
Tested with LSM6DSM.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: Increase ODR_LIST_SIZE
Jimmy Assarsson [Tue, 24 Mar 2020 21:52:25 +0000 (22:52 +0100)]
iio: imu: st_lsm6dsx: Increase ODR_LIST_SIZE

Support for sensor with up to 8 different ODR settings.
Required for supporting LIS3MDL as sensor hub slave device.

Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis16460: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE
Rohit Sarkar [Tue, 31 Mar 2020 11:47:31 +0000 (17:17 +0530)]
iio: imu: adis16460: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE

debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Tested-by Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE
Rohit Sarkar [Tue, 31 Mar 2020 11:47:30 +0000 (17:17 +0530)]
iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTE

debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Tested-by Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: st_lsm6dsx: configure full scale on slave device if supported
Lorenzo Bianconi [Thu, 19 Mar 2020 21:02:45 +0000 (22:02 +0100)]
iio: imu: st_lsm6dsx: configure full scale on slave device if supported

Introduce st_lsm6dsx_shub_set_full_scale routine in order to configure
the i2c slave device sensitivity

Tested-by: Jimmy Assarsson <jimmyassarsson@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: dac: stm32-dac: convert bindings to json-schema
Fabrice Gasnier [Thu, 19 Mar 2020 17:46:23 +0000 (18:46 +0100)]
dt-bindings: iio: dac: stm32-dac: convert bindings to json-schema

Convert the STM32 DAC binding to DT schema format using json-schema

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: tsl2563: convert bindings to YAML
Nishant Malpani [Wed, 18 Mar 2020 07:19:40 +0000 (12:49 +0530)]
dt-bindings: iio: tsl2563: convert bindings to YAML

Convert the TSL2563 device tree bindings to the new YAML format.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: add bindings doc for AD9467 ADC
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:36 +0000 (15:46 +0200)]
dt-bindings: iio: adc: add bindings doc for AD9467 ADC

This change adds the binding doc for the AD9467 ADC.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad9467: add support AD9467 ADC
Michael Hennerich [Tue, 24 Mar 2020 13:46:35 +0000 (15:46 +0200)]
iio: adc: ad9467: add support AD9467 ADC

The AD9467 is a 16-bit, monolithic, IF sampling analog-to-digital converter
(ADC). It is optimized for high performanceover wide bandwidths and ease of
use. The product operates at a 250 MSPS conversion rate and is designed for
wireless receivers, instrumentation, and test equipment that require a high
dynamic range. The ADC requires 1.8 V and 3.3 V power supplies and a low
voltage differential input clock for full performance operation. No
external reference or driver components are required for many applications.
Data outputs are LVDS compatible (ANSI-644 compatible) and include the
means to reduce the overall current needed for short trace distances.

Since the chip can operate at such high sample-rates (much higher than
classical interfaces), it requires that a DMA controller be used to
interface directly to the chip and push data into memory.
Typically, the AXI ADC IP core is used to interface with it.

Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/AD9467.pdf

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agodt-bindings: iio: adc: add bindings doc for AXI ADC driver
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:34 +0000 (15:46 +0200)]
dt-bindings: iio: adc: add bindings doc for AXI ADC driver

This change adds the bindings documentation for the AXI ADC driver.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: adi-axi-adc: add support for AXI ADC IP core
Michael Hennerich [Tue, 24 Mar 2020 13:46:33 +0000 (15:46 +0200)]
iio: adc: adi-axi-adc: add support for AXI ADC IP core

This change adds support for the Analog Devices Generic AXI ADC IP core.
The IP core is used for interfacing with analog-to-digital (ADC) converters
that require either a high-speed serial interface (JESD204B/C) or a source
synchronous parallel interface (LVDS/CMOS).

Usually, some other interface type (i.e SPI) is used as a control interface
for the actual ADC, while the IP core (controlled via this driver), will
interface to the data-lines of the ADC and handle  the streaming of data
into memory via DMA.

Because of this, the AXI ADC driver needs the other SPI-ADC driver to
register with it. The SPI-ADC needs to be register via the SPI framework,
while the AXI ADC registers as a platform driver. The two cannot be ordered
in a hierarchy as both drivers have their own registers, and trying to
organize this [in a hierarchy becomes] problematic when trying to map
memory/registers.

There are some modes where the AXI ADC can operate as standalone ADC, but
those will be implemented at a later point in time.

DocLink: https://wiki.analog.com/resources/fpga/docs/axi_adc_ip
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer-dmaengine: add dev-managed calls for buffer alloc
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:32 +0000 (15:46 +0200)]
iio: buffer-dmaengine: add dev-managed calls for buffer alloc

Currently, when using a 'iio_dmaengine_buffer_alloc()', an matching call to
'iio_dmaengine_buffer_free()' must be made.

With this change, this can be avoided by using
'devm_iio_dmaengine_buffer_alloc()'. The buffer will get free'd via the
device's devres handling.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer-dmaengine: use %zu specifier for sprintf(align)
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:31 +0000 (15:46 +0200)]
iio: buffer-dmaengine: use %zu specifier for sprintf(align)

The 'size_t' type behaves differently on 64-bit architectures, and causes
compiler a warning of the sort "format '%u' expects argument of type
'unsigned int', but argument 3 has type 'size_t {aka long unsigned int}'".

This change adds the correct specifier for the 'align' field.

Fixes: 4538c18568099 ("iio: buffer-dmaengine: Report buffer length requirements")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoinclude: fpga: adi-axi-common.h: add version helper macros
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:30 +0000 (15:46 +0200)]
include: fpga: adi-axi-common.h: add version helper macros

The format for all ADI AXI IP cores is the same.
i.e. 'major.minor.patch'.

This patch adds the helper macros to be re-used in ADI AXI drivers.

Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoinclude: fpga: adi-axi-common.h: fixup whitespace tab -> space
Alexandru Ardelean [Tue, 24 Mar 2020 13:46:29 +0000 (15:46 +0200)]
include: fpga: adi-axi-common.h: fixup whitespace tab -> space

The initial version use a tab between '#define' & 'ADI_AXI_REG_VERSION'.
This changes it to space. The change is purely cosmetic.

Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: drop left-over 'stufftoread' field
Alexandru Ardelean [Sat, 28 Mar 2020 16:34:21 +0000 (18:34 +0200)]
iio: buffer: drop left-over 'stufftoread' field

This seems like a left-over from a7348347ba8a4 ("staging:iio: Add polling
of events on the ring access chrdev.").

Then it was moved into the sca3000 driver around 9dd4694dafbd8 ("iio:
staging: sca3000: hide stufftoread logic"), and that one seemed to be the
only user of this.

Then it eventually was no longer used after 152a6a884ae1
("staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.")

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: temperature: ltc2983: remove redundant comparison to bool
Rohit Sarkar [Sat, 28 Mar 2020 06:53:04 +0000 (12:23 +0530)]
iio: temperature: ltc2983: remove redundant comparison to bool

Remove redundant comparison to a boolean variable.

Fixes coccinelle warning:
drivers/iio/temperature//ltc2983.c:393:20-32: WARNING: Comparison to bool
drivers/iio/temperature//ltc2983.c:394:20-32: WARNING: Comparison to bool

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Acked-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: add debugfs register r/w interface
Rohit Sarkar [Fri, 27 Mar 2020 13:10:23 +0000 (18:40 +0530)]
iio: imu: inv_mpu6050: add debugfs register r/w interface

The debugfs interface provides direct access to read and write device
registers if debugfs is enabled.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: pressure: bmp280: Join string literals back
Andy Shevchenko [Mon, 23 Mar 2020 10:41:29 +0000 (12:41 +0200)]
iio: pressure: bmp280: Join string literals back

For easy grepping on debug purposes join string literals back in
the messages.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: pressure: bmp280: Drop unneeded explicit castings
Andy Shevchenko [Mon, 23 Mar 2020 10:41:28 +0000 (12:41 +0200)]
iio: pressure: bmp280: Drop unneeded explicit castings

In few places the unnecessary explicit castings are being used.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: pressure: bmp280: Explicitly mark GPIO optional
Andy Shevchenko [Mon, 23 Mar 2020 10:41:27 +0000 (12:41 +0200)]
iio: pressure: bmp280: Explicitly mark GPIO optional

Show by using a corresponding API call that GPIO is optional.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: pressure: bmp280: Convert to use ->read_avail()
Andy Shevchenko [Mon, 23 Mar 2020 10:41:26 +0000 (12:41 +0200)]
iio: pressure: bmp280: Convert to use ->read_avail()

Convert to use ->read_avail() instead of open-coded attribute handling.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: pressure: bmp280: Tolerate IRQ before registering
Andy Shevchenko [Mon, 23 Mar 2020 10:41:25 +0000 (12:41 +0200)]
iio: pressure: bmp280: Tolerate IRQ before registering

With DEBUG_SHIRQ enabled we have a kernel crash

[  116.482696] BUG: kernel NULL pointer dereference, address: 0000000000000000

...

[  116.606571] Call Trace:
[  116.609023]  <IRQ>
[  116.611047]  complete+0x34/0x50
[  116.614206]  bmp085_eoc_irq+0x9/0x10 [bmp280]

because DEBUG_SHIRQ mechanism fires an IRQ before registration and drivers
ought to be able to handle an interrupt happening before request_irq() returns.

Fixes: aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050: convert to use i2c_new_client_device()
Wolfram Sang [Thu, 26 Mar 2020 21:09:55 +0000 (22:09 +0100)]
iio: imu: inv_mpu6050: convert to use i2c_new_client_device()

Move away from the deprecated API and return the shiny new ERRPTR where
useful.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: magn: bmc150: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:15 +0000 (22:53 +0530)]
iio: magn: bmc150: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050_spi: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:12 +0000 (22:53 +0530)]
iio: imu: inv_mpu6050_spi: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: inv_mpu6050_i2c: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:11 +0000 (22:53 +0530)]
iio: imu: inv_mpu6050_i2c: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: bmi160_spi: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:10 +0000 (22:53 +0530)]
iio: imu: bmi160_spi: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: imu: bmi160_i2c: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:09 +0000 (22:53 +0530)]
iio: imu: bmi160_i2c: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: mpu3050: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:08 +0000 (22:53 +0530)]
iio: gyro: mpu3050: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: bmg160_spi: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:07 +0000 (22:53 +0530)]
iio: gyro: bmg160_spi: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: gyro: bmg160_i2c: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:06 +0000 (22:53 +0530)]
iio: gyro: bmg160_i2c: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: accel: kxsd9: Use vsprintf extension %pe for symbolic error name
Nishant Malpani [Sun, 22 Mar 2020 17:23:03 +0000 (22:53 +0530)]
iio: accel: kxsd9: Use vsprintf extension %pe for symbolic error name

Utilize %pe format specifier from vsprintf while printing error logs
with dev_err(). Discards the use of unnecessary explicit casting and
prints symbolic error name which might prove to be convenient during
debugging.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7793: use read_avail iio hook for scale available
Alexandru Ardelean [Sun, 22 Mar 2020 15:26:56 +0000 (17:26 +0200)]
iio: adc: ad7793: use read_avail iio hook for scale available

This change uses the read_avail and '.info_mask_shared_by_type_available'
modifier to set the available scale.
Essentially, nothing changes to the driver's ABI.

The main idea for this patch is to remove the AD7793 driver from
checkpatch's radar. There have been about ~3 attempts to fix/break the
'in_voltage-voltage_scale_available' attribute, because checkpatch assumed
it to be an arithmetic operation and people were trying to change that.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: Don't allow buffers without any channels enabled to be activated
Lars-Peter Clausen [Thu, 26 Mar 2020 09:30:12 +0000 (11:30 +0200)]
iio: buffer: Don't allow buffers without any channels enabled to be activated

Before activating a buffer make sure that at least one channel is enabled.
Activating a buffer with 0 channels enabled doesn't make too much sense and
disallowing this case makes sure that individual driver don't have to add
special case code to handle it.

Currently, without this patch enabling a buffer is possible and no error is
produced. With this patch -EINVAL is returned.

An example of execution with this patch and some instrumented print-code:
   root@analog:~# cd /sys/bus/iio/devices/iio\:device3/buffer
   root@analog:/sys/bus/iio/devices/iio:device3/buffer# echo 1 > enable
   0: iio_verify_update 748 indio_dev->masklength 2 *insert_buffer->scan_mask 00000000
   1: iio_verify_update 753
   2:__iio_update_buffers 1115 ret -22
   3: iio_buffer_store_enable 1241 ret -22
   -bash: echo: write error: Invalid argument
1, 2 & 3 are exit-error paths. 0 the first print in iio_verify_update()
rergardless of error path.

Without this patch (and same instrumented print-code):
   root@analog:~# cd /sys/bus/iio/devices/iio\:device3/buffer
   root@analog:/sys/bus/iio/devices/iio:device3/buffer# echo 1 > enable
   0: iio_verify_update 748 indio_dev->masklength 2 *insert_buffer->scan_mask 00000000
   root@analog:/sys/bus/iio/devices/iio:device3/buffer#
Buffer is enabled with no error.

Note from Jonathan: Probably not suitable for automatic application to stable.
This has been there from the very start.  It tidies up an odd corner
case but won't effect any 'real' users.

Fixes: 84b36ce5f79c0 ("staging:iio: Add support for multiple buffers")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: tsl2772: Use scnprintf() for avoiding potential buffer overflow
Takashi Iwai [Mon, 16 Mar 2020 12:49:41 +0000 (13:49 +0100)]
iio: tsl2772: Use scnprintf() for avoiding potential buffer overflow

snprintf() is a hard-to-use function, it's especially difficult to use
it for concatenating substrings in a buffer with a limited size.
Since snprintf() returns the would-be-output size, not the actual
size, the subsequent use of snprintf() may go beyond the given limit
easily.  Although the current code doesn't actually overflow the
buffer, it's an incorrect usage.

This patch replaces such snprintf() calls with a safer version,
scnprintf().

Also this fixes the incorrect argument of the buffer limit size passed
to snprintf(), too.  The size has to be decremented for the remaining
length.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: max1363: replace uses of mlock
Rohit Sarkar [Sun, 15 Mar 2020 16:04:58 +0000 (21:34 +0530)]
iio: adc: max1363: replace uses of mlock

Replace usage indio_dev's mlock with either local lock or
iio_device_claim_direct_mode.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: health: max30100: use generic property handler
Rohit Sarkar [Sun, 15 Mar 2020 15:25:12 +0000 (20:55 +0530)]
iio: health: max30100: use generic property handler

Instead of of_property_read_xxx use device_property_read_xxx as it is
compatible with ACPI too as opposed to only device tree.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio/gyro/bmg160: Add support for BMI088 chip
Mike Looijmans [Mon, 16 Mar 2020 06:34:03 +0000 (07:34 +0100)]
iio/gyro/bmg160: Add support for BMI088 chip

The BMI088 is pin-compatible with the BMI055, and provides
both gyro and accel functions. The gyro part is similar to
the BMI055 and this adds the chip to the list of supported
devices for the gyro part.

The accel part of the chip is not compatible with anything
existing already.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: buffer: re-introduce bitmap_zalloc() for trialmask
Alexandru Ardelean [Sat, 21 Mar 2020 08:59:56 +0000 (10:59 +0200)]
iio: buffer: re-introduce bitmap_zalloc() for trialmask

Commit 3862828a903d3 ("iio: buffer: Switch to bitmap_zalloc()") introduced
bitmap_alloc(), but commit 20ea39ef9f2f9 ("iio: Fix scan mask selection")
reverted it.

This change adds it back. The only difference is that it's adding
bitmap_zalloc(). There might be some changes later that would require
initializing it to zero. In any case, now it's already zero-ing the
trialmask.

Appears to have been the result of merge conflict resolution rather
than an intentional revert.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoMAINTAINERS: Add Syed Nayyar Waris to ACCES 104-QUAD-8 driver
Syed Nayyar Waris [Fri, 20 Mar 2020 08:12:58 +0000 (13:42 +0530)]
MAINTAINERS: Add Syed Nayyar Waris to ACCES 104-QUAD-8 driver

Add Syed Nayyar Waris as a co-maintainer for the ACCES 104-QUAD-8
counter driver.

Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: ad_sigma_delta: remove unused IIO channel macros
Alexandru Ardelean [Sat, 21 Mar 2020 09:08:01 +0000 (11:08 +0200)]
iio: ad_sigma_delta: remove unused IIO channel macros

Now that all channel SigmaDelta IIO channel macros have been localized,
remove the generic ones.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7793: define/use own IIO channel macros
Alexandru Ardelean [Sat, 21 Mar 2020 09:08:00 +0000 (11:08 +0200)]
iio: adc: ad7793: define/use own IIO channel macros

This driver seems to use most of the AD_SD_*_CHANNEL. This change will move
them in the driver. The intent is that if a new part comes along which
would require tweaks per IIO channel, these should be doable in the driver.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7791: define/use own IIO channel macros
Alexandru Ardelean [Sat, 21 Mar 2020 09:07:59 +0000 (11:07 +0200)]
iio: adc: ad7791: define/use own IIO channel macros

This driver seems to use most of the AD_SD_*_CHANNEL. This change will move
them in the driver. The intent is that if a new part comes along which
would require tweaks per IIO channel, these should be doable in the driver.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7780: define/use own IIO channel macros
Alexandru Ardelean [Sat, 21 Mar 2020 09:07:58 +0000 (11:07 +0200)]
iio: adc: ad7780: define/use own IIO channel macros

This change gets rid of the AD_SD_*_CHANNEL macros in favor of defining
it's own. The ad7780 is quite simpler than it's other Sigma-Delta brothers.

It turned out that centralizing the AD_SD_*_CHANNEL macros doesn't scale
too well, especially with some more complicated drivers. Some of the
variations in the more complicated drivers require new macros, and that way
things can become harder to maintain.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: tsl2563: Rename macro to fix typo
Nishant Malpani [Wed, 18 Mar 2020 08:03:11 +0000 (13:33 +0530)]
iio: light: tsl2563: Rename macro to fix typo

This patch renames macro to fix the following warning generated by
checkpatch.pl:

WARNING: 'DISBLED' may be misspelled - perhaps 'DISABLED'?

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: Make mlock internal to the iio core
Rohit Sarkar [Wed, 18 Mar 2020 16:11:51 +0000 (21:41 +0530)]
iio: core: Make mlock internal to the iio core

"mlock" should ideally only be used by the iio core. The mlock
implementation may change in the future which means that no driver
should be explicitly using mlock.

Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: Add SEMTECH SX9310/9311 sensor driver
Daniel Campello [Tue, 10 Mar 2020 20:06:59 +0000 (14:06 -0600)]
iio: Add SEMTECH SX9310/9311 sensor driver

Add SEMTECH SX9310/9311 driver.

The device has the following entry points:

Usual frequency:
- sampling_frequency
- sampling_frequency_available

Instant reading of current values for different sensors:
- in_proximity0_raw
- in_proximity1_raw
- in_proximity2_raw
- in_proximity3_comb_raw
and associated events in events/

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enrico Granata <egranata@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7476: implement devm_add_action_or_reset
Beniamin Bia [Wed, 11 Mar 2020 08:43:28 +0000 (10:43 +0200)]
iio: adc: ad7476: implement devm_add_action_or_reset

Use devm_add_action_or_reset to automatically disable the device
when it is removed or an error occurs during probe routine.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7476: Add AD7091 support
Dragos Bogdan [Wed, 11 Mar 2020 08:43:27 +0000 (10:43 +0200)]
iio: adc: ad7476: Add AD7091 support

AD7091R is already supported by this driver. While AD7091R allows the
choice of an internal or an external voltage reference, for AD7091 the
reference is only provided by VDD. Since this information is anyway
obtained through the "vcc" regulator, no other driver changes are
required for adding AD7091 support as well.

Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R
Dragos Bogdan [Wed, 11 Mar 2020 08:43:26 +0000 (10:43 +0200)]
iio: adc: ad7476: Add IIO_CHAN_INFO_RAW for AD7091R

When CONVST signal is generated internally, IIO_CHAN_INFO_RAW can be
made available for AD7091R for single reads. This patch enables it and
makes supporting more devices by this driver easier.

Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: ad7476: Generate CONVST signal internally
Dragos Bogdan [Wed, 11 Mar 2020 08:43:25 +0000 (10:43 +0200)]
iio: adc: ad7476: Generate CONVST signal internally

Compared to the other supported parts, AD7091R are dependent of
a CONVST signal that initiates the conversion. At this moment, only
sampling in buffered mode is supported for AD7091R and the only
option until now was to generate this signal externally using an
IIO trigger. This patch adds the option of generating it internally,
more compatible triggers being available in this case.

Also, it is an intermediate step of adding support more devices.

Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: adc: intel_mrfld_adc: Use be16_to_cpu() instead of get_unaligned_be16()
Andy Shevchenko [Wed, 11 Mar 2020 09:22:23 +0000 (11:22 +0200)]
iio: adc: intel_mrfld_adc: Use be16_to_cpu() instead of get_unaligned_be16()

There is no need to call unaligned helpers on stack placed variables
because compiler will align them correctly, accordingly to architectural
ABI. Moreover, using bitwise type makes it explicit to see what we are
reading in bulk transfer. On top of that, use sizeof() instead of
magic value.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: humidity: hts221: Drop unneeded casting when print error code
Andy Shevchenko [Fri, 13 Mar 2020 10:49:55 +0000 (12:49 +0200)]
iio: humidity: hts221: Drop unneeded casting when print error code

Explicit casting in printf() usually shows that something is not okay.
Here, we really don't need it by providing correct specifier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: humidity: hts221: Make use of device properties
Andy Shevchenko [Fri, 13 Mar 2020 10:49:54 +0000 (12:49 +0200)]
iio: humidity: hts221: Make use of device properties

Device property API allows to gather device resources from different sources,
such as ACPI. Convert the drivers to unleash the power of device property API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: humidity: hts221: Use dev_get_platdata() to get platform_data
Andy Shevchenko [Fri, 13 Mar 2020 10:49:53 +0000 (12:49 +0200)]
iio: humidity: hts221: Use dev_get_platdata() to get platform_data

Use dev_get_platdata() to get the platform_data instead of
referencing it directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: st_sensors: Join string literals back
Andy Shevchenko [Fri, 13 Mar 2020 10:49:52 +0000 (12:49 +0200)]
iio: st_sensors: Join string literals back

For easy grepping on debug purposes join string literals back in
the messages.

No functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: st_sensors: Drop unneeded casting when print error code
Andy Shevchenko [Fri, 13 Mar 2020 10:49:51 +0000 (12:49 +0200)]
iio: st_sensors: Drop unneeded casting when print error code

Explicit casting in printf() usually shows that something is not okay.
Here, we really don't need it by providing correct specifier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: st_sensors: Drop unneeded explicit castings
Andy Shevchenko [Fri, 13 Mar 2020 10:49:50 +0000 (12:49 +0200)]
iio: st_sensors: Drop unneeded explicit castings

In few places the unnecessary explicit castings are being used.
Drop them for good.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: st_sensors: Use dev_get_platdata() to get platform_data
Andy Shevchenko [Fri, 13 Mar 2020 10:49:49 +0000 (12:49 +0200)]
iio: st_sensors: Use dev_get_platdata() to get platform_data

Use dev_get_platdata() to get the platform_data instead of
referencing it directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: light: st_uvis25: Drop unneeded casting when print error code
Andy Shevchenko [Fri, 13 Mar 2020 10:49:48 +0000 (12:49 +0200)]
iio: light: st_uvis25: Drop unneeded casting when print error code

Explicit casting in printf() usually shows that something is not okay.
Here, we really don't need it by providing correct specifier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: core: Use scnprintf() for avoiding potential buffer overflow
Takashi Iwai [Wed, 11 Mar 2020 07:43:24 +0000 (08:43 +0100)]
iio: core: Use scnprintf() for avoiding potential buffer overflow

Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agoiio: xilinx-xadc: Fix typo in author's name
Lars-Peter Clausen [Mon, 9 Mar 2020 10:28:47 +0000 (11:28 +0100)]
iio: xilinx-xadc: Fix typo in author's name

It appears the author of the xilinx-xadc driver can't even spell his own
name correctly. Fix that.

Reported-by: Lars Möllendorf <lars.moellendorf@plating.de>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
4 years agostaging: mt7621-pci: be sure gpio descriptor is null on fails
Sergio Paracuellos [Fri, 20 Mar 2020 11:01:23 +0000 (12:01 +0100)]
staging: mt7621-pci: be sure gpio descriptor is null on fails

Function 'devm_gpiod_get_index_optional' returns NULL if the
descriptor is invalid and the error associated for the error
pointer is ENOENT. Sometimes if the pin is just assigned the
error associated for the pointer might not be ENOENT but other.
In order to avoid weirds behaviours if this happen set descriptor
to NULL in the driver port structure.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200320110123.9907-6-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: mt7621-pci: change variable to print for slot
Sergio Paracuellos [Fri, 20 Mar 2020 11:01:22 +0000 (12:01 +0100)]
staging: mt7621-pci: change variable to print for slot

We are using the counter to print the slot which has been
enabled. Use the correct associated slot for the port instead.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200320110123.9907-5-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: mt7621-pci: use only two phys from device tree
Sergio Paracuellos [Fri, 20 Mar 2020 11:01:21 +0000 (12:01 +0100)]
staging: mt7621-pci: use only two phys from device tree

In order to align work with the mt7621-pci-phy part of
the driver and device tree which is now using only two
real phys one of them dual ported properly parse the
device tree and don't call phy initialization for the
slot 1 because is being taking into account when the
phy for the slot 0 is instantiated.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200320110123.9907-4-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: mt7621-dts: set up only two pcie phys
Sergio Paracuellos [Fri, 20 Mar 2020 11:01:20 +0000 (12:01 +0100)]
staging: mt7621-dts: set up only two pcie phys

This soc has only two real pcie phys one of them
having a different register to enable and disable it.
Change this to have only two dt nodes for the phys and
use 'phy-cells' properly to say if the phy has dual ports.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200320110123.9907-3-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: mt7621-pci-phy: avoid to create to different phys for a dual port one
Sergio Paracuellos [Fri, 20 Mar 2020 11:01:19 +0000 (12:01 +0100)]
staging: mt7621-pci-phy: avoid to create to different phys for a dual port one

This soc has two phy's for the pcie one of them using just a different
register for settig it up but sharing all the rest of the config. Until
now we was presenting this schema as three different phy's in the device
tree using the 'phy-cells' node property to discriminate an index and
setting up a complete phy for the dual port index. This sometimes worked
properly but reconfiguring the same registers twice presents sometimes
some unstable pcie links and the ports was not properly being detected.
The problems only appears on hard resets and soft resets was properly
working. Instead of having this schema just set two phy's in the device
ree and use the 'phy-cells' property to say if the port has or not a dual
port. Doing this configuration and set up becomes easier, LOC is decreased
and the behaviour also gets deterministic with properly and stable pcie
links in both hard and soft resets.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20200320110123.9907-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: vc04_services: interface: vchi: Correct long line comments and make them...
R Veera Kumar [Fri, 20 Mar 2020 02:43:37 +0000 (08:13 +0530)]
staging: vc04_services: interface: vchi: Correct long line comments and make them C89 style

Correct long lines of comments to respect 80 character per line
limit and make them C89 style one.
Found using checkpatch.pl.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Link: https://lore.kernel.org/r/20200320024337.4754-1-vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8723bs: hal: Correct typos in comments
R Veera Kumar [Fri, 20 Mar 2020 07:13:00 +0000 (12:43 +0530)]
staging: rtl8723bs: hal: Correct typos in comments

Correct typos in comments.
Misspellings found using checkpatch.pl.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Link: https://lore.kernel.org/r/46d4e7cd66ec8d5bf7445201e10e3d50fe1c618e.1584687545.git.vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8723bs: hal: Correct multi-line comments as per coding style
R Veera Kumar [Fri, 20 Mar 2020 07:12:59 +0000 (12:42 +0530)]
staging: rtl8723bs: hal: Correct multi-line comments as per coding style

Correct multi-line comments as per coding style to respect
80 characters per line limit.

Amalgamate individual lines into single multiline comment.
Reorganize it for readability.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Link: https://lore.kernel.org/r/5b5cdb520df6d579a6659fbe45ac545628be50e4.1584687545.git.vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: gdm724x: use netdev_err() instead of pr_err()
Lourdes Pedrajas [Fri, 20 Mar 2020 00:39:47 +0000 (01:39 +0100)]
staging: gdm724x: use netdev_err() instead of pr_err()

use netdev_err() which is a message printing function specific for network
devices instead of pr_err(), in function netlink_send().

Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
Link: https://lore.kernel.org/r/20200320003947.31726-1-lu@pplo.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8712: Remove unnecessary braces
Gokce Kuler [Fri, 20 Mar 2020 00:03:26 +0000 (03:03 +0300)]
staging: rtl8712: Remove unnecessary braces

Remove unnecessary braces for single statement block

Signed-off-by: Gokce Kuler <gokcekuler@gmail.com>
Link: https://lore.kernel.org/r/20200320000326.GA9349@siyah2
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agostaging: rtl8723bs: os_dep: Correct typo in comments
R Veera Kumar [Thu, 19 Mar 2020 16:17:12 +0000 (21:47 +0530)]
staging: rtl8723bs: os_dep: Correct typo in comments

Correct typo in two comments.
Misspelling found using checkpatch.pl.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Link: https://lore.kernel.org/r/1ea4ff5dedf35b51afc53866c303b62a66caff7d.1584633953.git.vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>