]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
13 months agoiio: dac: max5522: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:49 +0000 (16:26 +0200)]
iio: dac: max5522: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-7-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: addac: ad74413r: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:48 +0000 (16:26 +0200)]
iio: addac: ad74413r: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-6-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ti-tsc2046: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:47 +0000 (16:26 +0200)]
iio: adc: ti-tsc2046: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-5-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ti-ads131e08: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:46 +0000 (16:26 +0200)]
iio: adc: ti-ads131e08: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-4-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: max11205: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:45 +0000 (16:26 +0200)]
iio: adc: max11205: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-3-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: accel: adxl355: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:44 +0000 (16:26 +0200)]
iio: accel: adxl355: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-2-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: accel: adxl313: simplify with spi_get_device_match_data()
Krzysztof Kozlowski [Thu, 6 Jun 2024 14:26:43 +0000 (16:26 +0200)]
iio: accel: adxl313: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-1-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agostaging: iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0
Uwe Kleine-König [Thu, 6 Jun 2024 15:54:04 +0000 (17:54 +0200)]
staging: iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0

These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606155407.499344-1-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: humidity: si7020: add heater support
Antoni Pokusinski [Fri, 7 Jun 2024 14:10:30 +0000 (16:10 +0200)]
iio: humidity: si7020: add heater support

This patch adds support for the integrated on-chip heater that is present
on all the devices supported by this driver (si7020, si7021, si7013, th6).
In order to configure the heater, the driver interacts with the following
device registers:
* User Register - the 2nd bit of this register is a "Heater Enable bit"
  (0 means that the heater is off, 1 means that it's on).
* Heater Register - this register is present only on the si70xx devices
  and controls the current flowing through the heater. The 4 lower bits
  of this register can be assigned values from 0x0 to 0xF.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Link: https://lore.kernel.org/r/20240607141029.51744-1-apokusinski@o2.pl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: add missing MODULE_DESCRIPTION() macros
Jeff Johnson [Fri, 7 Jun 2024 16:17:52 +0000 (09:17 -0700)]
iio: add missing MODULE_DESCRIPTION() macros

make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iio/adc/ingenic-adc.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iio/adc/xilinx-ams.o
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/iio/buffer/kfifo_buf.o

Add the missing invocations of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20240607-md-drivers-iic-v1-1-9f9db6246083@quicinc.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: event: use sizeof(*pointer) instead of sizeof(type)
Erick Archer [Sun, 2 Jun 2024 17:23:54 +0000 (19:23 +0200)]
iio: event: use sizeof(*pointer) instead of sizeof(type)

It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). At the same time refactor
the NULL comparison.

This patch has no effect on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
Link: https://lore.kernel.org/r/AS8PR02MB7237D024459C314CECE72EAF8BFE2@AS8PR02MB7237.eurprd02.prod.outlook.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: axp20x_adc: Add support for AXP192
Aidan MacDonald [Sun, 16 Oct 2022 23:43:31 +0000 (00:43 +0100)]
iio: adc: axp20x_adc: Add support for AXP192

The AXP192 is identical to the AXP20x, except for the addition of
two more GPIO ADC channels.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: ti,ads1015: add compatible for tla2021
Josua Mayer [Sun, 2 Jun 2024 15:49:38 +0000 (17:49 +0200)]
dt-bindings: iio: adc: ti,ads1015: add compatible for tla2021

TI tla2021 is a limited single-channel variant of tla2024 which is
similar enough to be easily supportable through the same driver.

Add compatible string for tla2021 so boards may describe it in
device-tree.

Signed-off-by: Josua Mayer <josua@solid-run.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240602-cn9130-som-v6-3-89393e86d4c7@solid-run.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ti-adc161s626: make use of iio_device_claim_direct_scoped()
Gustavo Ueti Fukunaga [Mon, 27 May 2024 09:19:40 +0000 (06:19 -0300)]
iio: adc: ti-adc161s626: make use of iio_device_claim_direct_scoped()

Make use of iio_device_claim_direct_scoped() to make error handling more
natural and simplify code.

Co-developed-by: Caio Dantas Simão Ugêda <caiodantas@usp.br>
Signed-off-by: Caio Dantas Simão Ugêda <caiodantas@usp.br>
Signed-off-by: Gustavo Ueti Fukunaga <gustavofukunaga@usp.br>
Link: https://lore.kernel.org/r/20240527091942.53616-1-gustavofukunaga@usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: accel: mma7660: add mount-matrix support
Val Packett [Mon, 27 May 2024 08:00:18 +0000 (05:00 -0300)]
iio: accel: mma7660: add mount-matrix support

Allow using the mount-matrix device tree property to align the
accelerometer relative to the whole device.

Signed-off-by: Val Packett <val@packett.cool>
Link: https://lore.kernel.org/r/20240527080043.2709-1-val@packett.cool
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodriver: iio: add missing checks on iio_info's callback access
Julien Stephan [Thu, 30 May 2024 09:22:46 +0000 (11:22 +0200)]
driver: iio: add missing checks on iio_info's callback access

Some callbacks from iio_info structure are accessed without any check, so
if a driver doesn't implement them trying to access the corresponding
sysfs entries produce a kernel oops such as:

[ 2203.527791] Unable to handle kernel NULL pointer dereference at virtual address 00000000 when execute
[...]
[ 2203.783416] Call trace:
[ 2203.783429]  iio_read_channel_info_avail from dev_attr_show+0x18/0x48
[ 2203.789807]  dev_attr_show from sysfs_kf_seq_show+0x90/0x120
[ 2203.794181]  sysfs_kf_seq_show from seq_read_iter+0xd0/0x4e4
[ 2203.798555]  seq_read_iter from vfs_read+0x238/0x2a0
[ 2203.802236]  vfs_read from ksys_read+0xa4/0xd4
[ 2203.805385]  ksys_read from ret_fast_syscall+0x0/0x54
[ 2203.809135] Exception stack(0xe0badfa8 to 0xe0badff0)
[ 2203.812880] dfa0:                   00000003 b6f10f80 00000003 b6eab000 00020000 00000000
[ 2203.819746] dfc0: 00000003 b6f10f80 7ff00000 00000003 00000003 00000000 00020000 00000000
[ 2203.826619] dfe0: b6e1bc88 bed80958 b6e1bc94 b6e1bcb0
[ 2203.830363] Code: bad PC value
[ 2203.832695] ---[ end trace 0000000000000000 ]---

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://lore.kernel.org/r/20240530-iio-core-fix-segfault-v3-1-8b7cd2a03773@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: chemical: ams-iaq-core: clean up codestyle warning
Bruna Bispo [Tue, 28 May 2024 14:38:16 +0000 (11:38 -0300)]
iio: chemical: ams-iaq-core: clean up codestyle warning

This fixes a checkpatch warning by changing the struct attribute from __attribute__((__packed__)) to __packed.

Signed-off-by: Bruna Bispo <blbispo1@gmail.com>
Link: https://lore.kernel.org/r/20240528143816.13409-1-blbispo1@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodocs: iio: add documentation for adis16480 driver
Ramona Gradinariu [Tue, 28 May 2024 14:24:09 +0000 (17:24 +0300)]
docs: iio: add documentation for adis16480 driver

Add documentation for adis16480 driver which describes the driver
device files and shows how the user may use the ABI for various
scenarios (configuration, measurement, etc.).

Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-7-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodocs: iio: add documentation for interfacing tools
Ramona Gradinariu [Tue, 28 May 2024 14:24:08 +0000 (17:24 +0300)]
docs: iio: add documentation for interfacing tools

Add documentation for IIO interfacing tools describing the available
tools which can be used to retrieve data from IIO sysfs.
Reference this documentation in adis16475.rst

Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-6-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adis16480: add support for adis16545/7 families
Ramona Gradinariu [Tue, 28 May 2024 14:24:07 +0000 (17:24 +0300)]
iio: adis16480: add support for adis16545/7 families

The ADIS16545 and ADIS16547 are a complete inertial system that
includes a triaxis gyroscope and a triaxis accelerometer.
The serial peripheral interface (SPI) and register structure provide a
simple interface for data collection and configuration control.

These devices are similar to the ones already supported in the driver,
with changes in the scales, timings and the max spi speed in burst
mode.
Also, they support delta angle and delta velocity readings in burst
mode, for which support was added in the trigger handler.

Co-developed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-5-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: imu: Add ADIS16545/47 compatibles
Ramona Gradinariu [Tue, 28 May 2024 14:24:06 +0000 (17:24 +0300)]
dt-bindings: iio: imu: Add ADIS16545/47 compatibles

Add ADIS16545/47 compatibles. Each newly added device has a different
angular velocity/linear acceleration scale combination, as follows:
Accel dynamic range:
- 8g: ADIS16545
- 40g: ADIS16547
Gyro dynamic range:
- 125 deg/sec: ADIS1545-1, ADIS16547-1
- 450 deg/sec: ADIS1545-2, ADIS16547-2
- 2000 deg/sec: ADIS1545-3, ADIS16547-3

Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-4-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: adis16480.c: Add delta angle and delta velocity channels
Ramona Gradinariu [Tue, 28 May 2024 14:24:05 +0000 (17:24 +0300)]
iio: imu: adis16480.c: Add delta angle and delta velocity channels

Add support for delta angle and delta velocity raw readings to
adis16480 driver.
The following devices do not support delta readings in burst mode:
ADIS16375, ADIS16480, ADIS16485, ADIS16488, ADIS16490, ADIS16495-1,
ADIS16495-2, ADIS16495-3, ADIS16497-1, ADIS16497-2, ADIS16497-3, thus
they cannot be retrieved via the buffer interface.
For these devices, the delta measurements are retrieved by performing
normal register readings and are made available through the raw
attributes of the specific channels.

Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-3-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adis16480: make the burst_max_speed configurable
Ramona Gradinariu [Tue, 28 May 2024 14:24:04 +0000 (17:24 +0300)]
iio: adis16480: make the burst_max_speed configurable

With this, we can pass the maxixum spi burst speed to the
'ADIS16480_DATA()' macro. This is in preparation to support new devices
that have a different speed than the one used so far.

Co-developed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240528142409.239187-2-ramona.gradinariu@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodrivers: iio: imu: Add support for adis1657x family
Ramona Gradinariu [Mon, 27 May 2024 14:26:18 +0000 (17:26 +0300)]
drivers: iio: imu: Add support for adis1657x family

Add support for ADIS1657X family devices in already exiting ADIS16475
driver.

Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-10-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: imu: Add ADIS1657X family devices compatibles
Ramona Gradinariu [Mon, 27 May 2024 14:26:17 +0000 (17:26 +0300)]
dt-bindings: iio: imu: Add ADIS1657X family devices compatibles

Add ADIS1657X family devices compatibles and specify the according
maximum SPI baudrate.
Similarly to other ADIS1650X devices, ADIS1657X supports sync-mode
values [0,2].
Each newly added device has a different angular velocity/linear
acceleration/ delta velocity scale combination, as follows:
Accel dynamic range sensitivity:
262144000 LSB/g: ADIS16575
52428800 LSB/g: ADIS16576, ADIS16577
Gyro dynamic range sensitivity:
2621440 LSB/deg/sec: ADIS1575-2, ADIS1576-2, ADIS1577-2
- 655360 LSB/deg/sec: ADIS1575-3, ADIS1576-3, ADIS1577-3
Delta velocity sensitivity:
- 2^15/100 LSB/m/sec: ADIS16575
- 2^15/125 LSB/m/sec: ADIS16576
- 2^15/400 LSB/m/sec: ADIS16577
Each ADIS1657X device supports FIFO usage and a sample-rate of 4.1KHz,
meanwhile the already existing devices do not support FIFO usage and
have a maximum sample-rate of 2.1KHz.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-9-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: adis16475: Re-define ADIS16475_DATA
Ramona Gradinariu [Mon, 27 May 2024 14:26:16 +0000 (17:26 +0300)]
iio: imu: adis16475: Re-define ADIS16475_DATA

Re-define ADIS16475_DATA such that it takes _burst_max_len,
_burst_max_speed_hz and _has_fifo as parameters.
Also, do a preparatory rename operation for ADIS16475_BURST32_MAX_DATA
to ADIS16475_BURST32_MAX_DATA_NO_TS32 to be able to differentiate in
the future between devices which are using 16-bit or 32-bit timestamp
size in burst mode.

Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-8-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: adis_trigger: Allow level interrupts for FIFO readings
Ramona Gradinariu [Mon, 27 May 2024 14:26:15 +0000 (17:26 +0300)]
iio: imu: adis_trigger: Allow level interrupts for FIFO readings

Currently, adis library allows configuration only for edge interrupts,
needed for data ready sampling.
This patch removes the restriction for level interrupts for devices
which have FIFO support.
Furthermore, in case of devices which have FIFO support,
devm_request_threaded_irq is used for interrupt allocation, to avoid
flooding the processor with the FIFO watermark level interrupt, which
is active until enough data has been read from the FIFO.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-7-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodrivers: iio: imu: adis16475: generic computation for sample rate
Ramona Gradinariu [Mon, 27 May 2024 14:26:14 +0000 (17:26 +0300)]
drivers: iio: imu: adis16475: generic computation for sample rate

Currently adis16475 supports a sample rate between 1900 and 2100 Hz.
This patch changes the setting of sample rate from hardcoded values to
a generic computation based on the internal clock frequency.
This is a preparatory patch for adding support for adis1657x family
devices which allow sample rates between 3900 and 4100 Hz.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-6-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: adis16475: Create push single sample API
Ramona Gradinariu [Mon, 27 May 2024 14:26:13 +0000 (17:26 +0300)]
iio: imu: adis16475: Create push single sample API

Create push single sample API reposnsible for pushing a single
sample into the buffer.
This is a preparation patch for FIFO support where more than
one sample has to be pushed in the trigger handler.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-5-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: adis_buffer: Add buffer setup API with buffer attributes
Ramona Gradinariu [Mon, 27 May 2024 14:26:12 +0000 (17:26 +0300)]
iio: imu: adis_buffer: Add buffer setup API with buffer attributes

Add new API called devm_adis_setup_buffer_and_trigger_with_attrs() which
also takes buffer attributes as a parameter.
Rewrite devm_adis_setup_buffer_and_trigger() implementation such that it
calls devm_adis_setup_buffer_and_trigger_with_attrs() with buffer
attributes parameter NULL

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-4-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodrivers: iio: imu: Add support for ADIS16501
Ramona Gradinariu [Mon, 27 May 2024 14:26:11 +0000 (17:26 +0300)]
drivers: iio: imu: Add support for ADIS16501

Add support for ADIS16501 device in already existing ADIS16475
driver.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-3-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: imu: Add ADIS16501 compatibles
Ramona Gradinariu [Mon, 27 May 2024 14:26:10 +0000 (17:26 +0300)]
dt-bindings: iio: imu: Add ADIS16501 compatibles

Add ADIS16501 compatible. Similarly to other ADIS1650X devices,
ADIS16501 supports sync-mode values [0,2].
There are two differences between ADIS16501 and ADIS16477-2:
- ADIS16501 does not support pulse sync mode
- the delta velocity scale value is different

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Link: https://lore.kernel.org/r/20240527142618.275897-2-ramona.bolboaca13@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: add oversampling support
Julien Stephan [Thu, 30 May 2024 15:14:12 +0000 (10:14 -0500)]
iio: adc: ad7380: add oversampling support

ad7380x(-4) parts are able to do oversampling to increase accuracy.

This chips supports a normal oversampling mode and a rolling mode and
also allows enabling and disabling extra resolution bits when
oversampling is enabled.

We have intentionally left out the rolling mode for now as there is not
a compelling use case for it. User can process a captured data buffer
to get the same effect.

We are also currently not supporting changing the oversampling mode
independently of the resolution bits. The resolution boost feature
can only be enabled when oversampling is enabled and oversampling is
not as useful without the resolution boost. So for now we consider the
features tightly coupled. When oversampling is enabled, the resolution
boost is enabled and when oversampling is disabled, the resolution
boost is disabled.

Since the resolution boost feature causes 16-bit chips to now have
18-bit data which means the storagebits has to change from 16 to 32
bits, we use the new ext_scan_type feature to allow changing the
scan_type at runtime based on if the resolution boost is enabled or
not.

SPI message optimization has to be moved since now some of the xfer
parameters change based on the resolution boost mode.

A few neighboring comments are also fixed up while we are touching this
code.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Co-developed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-5-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: use spi_optimize_message()
David Lechner [Thu, 30 May 2024 15:14:11 +0000 (10:14 -0500)]
iio: adc: ad7380: use spi_optimize_message()

This changes the AD7380 to use spi_optimize_message() to optimize
buffered reads.

This changes both direct reads and buffered reads to use the same
spi_message. This has some (welcome) side effects. The first is that
in buffered reads, the timestamp will now correspond to the same sample
rather than the previous sample. The second is that direct reads now
use the same SPI bus speed as buffered reads.

This reduces CPU usage of the IRQ thread from around 25% to around 20%
when sampling at 10 kHz on a ZedBoard.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-4-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: add support for multiple scan types per channel
David Lechner [Thu, 30 May 2024 15:14:10 +0000 (10:14 -0500)]
iio: add support for multiple scan types per channel

This adds new fields to the iio_channel structure to support multiple
scan types per channel. This is useful for devices that support multiple
resolution modes or other modes that require different data formats of
the raw data.

To make use of this, drivers need to implement the new callback
get_current_scan_type() to resolve the scan type for a given channel
based on the current state of the driver. There is a new scan_type_ext
field in the iio_channel structure that should be used to store the
scan types for any channel that has more than one. There is also a new
flag has_ext_scan_type that acts as a type discriminator for the
scan_type/ext_scan_type union. A union is used so that we don't grow
the size of the iio_channel structure and also makes it clear that
scan_type and ext_scan_type are mutually exclusive.

The buffer code is the only code in the IIO core code that is using the
scan_type field. This patch updates the buffer code to use the new
iio_channel_validate_scan_type() function to ensure it is returning the
correct scan type for the current state of the device when reading the
sysfs attributes. The buffer validation code is also update to validate
any additional scan types that are set in the scan_type_ext field. Part
of that code is refactored to a new function to avoid duplication.

Some userspace tools may need to be updated to re-read the scan type
after writing any other attribute. During testing, we noticed that we
had to restart iiod to get it to re-read the scan type after enabling
oversampling on the ad7380 driver.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-3-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: buffer: use struct iio_scan_type to simplify code
David Lechner [Thu, 30 May 2024 15:14:09 +0000 (10:14 -0500)]
iio: buffer: use struct iio_scan_type to simplify code

By using struct iio_scan_type, we can simplify the code by removing
lots of duplicate pointer dereferences. This make the code a bit easier
to read.

This also prepares for a future where channels may have more than one
scan_type.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-2-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: introduce struct iio_scan_type
David Lechner [Thu, 30 May 2024 15:14:08 +0000 (10:14 -0500)]
iio: introduce struct iio_scan_type

This gives the channel scan_type a named type so that it can be used
to simplify code in later commits.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-1-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: add support for ad738x-4 4 channels variants
Julien Stephan [Tue, 28 May 2024 14:20:34 +0000 (16:20 +0200)]
iio: adc: ad7380: add support for ad738x-4 4 channels variants

Add support for ad7380/1/2/3-4 parts which are 4 channels
variants from ad7380/1/2/3

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-7-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: ad7380: add support for ad738x-4 4 channels variants
Julien Stephan [Tue, 28 May 2024 14:20:33 +0000 (16:20 +0200)]
dt-bindings: iio: adc: ad7380: add support for ad738x-4 4 channels variants

Add compatible support for ad7380/1/3/4-4 parts which are 4 channels
variants from ad7380/1/3/4

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-6-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: prepare for parts with more channels
Julien Stephan [Tue, 28 May 2024 14:20:32 +0000 (16:20 +0200)]
iio: adc: ad7380: prepare for parts with more channels

The current driver supports only parts with 2 channels.
In order to prepare the support of new compatible ADCs with more
channels, this commit:
  - defines MAX_NUM_CHANNEL to specify the maximum number of
    channels currently supported by the driver
  - adds available_scan_mask member in ad7380_chip_info structure
  - fixes spi xfer struct len depending on number of channels
  - fixes scan_data.raw buffer size to handle more channels
  - adds a timing specifications structure in ad7380_chip_info structure

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-5-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: add support for pseudo-differential parts
David Lechner [Tue, 28 May 2024 14:20:31 +0000 (16:20 +0200)]
iio: adc: ad7380: add support for pseudo-differential parts

Add support for AD7383, AD7384 pseudo-differential compatible parts.
Pseudo differential parts require common mode voltage supplies so add
the support for them and add the support of IIO_CHAN_INFO_OFFSET to
retrieve the offset

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-4-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: ad7380: add pseudo-differential parts
David Lechner [Tue, 28 May 2024 14:20:30 +0000 (16:20 +0200)]
dt-bindings: iio: adc: ad7380: add pseudo-differential parts

Adding AD7383 and AD7384 compatible parts that are pseudo-differential.

Pseudo-differential require common mode voltage supplies, so add them
conditionally

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-3-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7380: new driver for AD7380 ADCs
David Lechner [Tue, 28 May 2024 14:20:29 +0000 (16:20 +0200)]
iio: adc: ad7380: new driver for AD7380 ADCs

This adds a new driver for the AD7380 family ADCs.

The driver currently implements basic support for the AD7380, AD7381,
2-channel differential ADCs. Support for additional single-ended,
pseudo-differential and 4-channel chips that use the same register map
as well as additional features of the chip will be added in future patches.

[Julien Stephan: fix rx/tx buffer for regmap access]
[Julien Stephan: fix scale issue]
[Julien Stephan: use the new iio_device_claim_direct_scoped
instead of iio_device_claim_direct_mode]

Co-developed-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
[Julien Stephan: add datasheet links of supported parts]
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-2-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: Add binding for AD7380 ADCs
David Lechner [Tue, 28 May 2024 14:20:28 +0000 (16:20 +0200)]
dt-bindings: iio: adc: Add binding for AD7380 ADCs

This adds a binding specification for the Analog Devices Inc. AD7380
family of ADCs.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240528-adding-new-ad738x-driver-v7-1-4cd70a4c12c8@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: adi-axi-adc: make sure DRP is locked on enable
Nuno Sa [Fri, 31 May 2024 09:41:55 +0000 (11:41 +0200)]
iio: adc: adi-axi-adc: make sure DRP is locked on enable

When enabling the core, make sure DRP (Dynamic Reconfiguration Port)
is locked. Most of the designs don't really use it but we still get the
lock bit set. So let's do it all the time so the code is generic.

While at it reduce the timeout time to 1 microsecond as it seems to be
enough and goes in line with what we have on the similar DAC core
(adi-axi-dac).

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240531-dev-axi-adc-drp-v3-2-e3fa79447c67@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: adi-axi-adc: don't allow concurrent enable/disable calls
Nuno Sa [Fri, 31 May 2024 09:41:54 +0000 (11:41 +0200)]
iio: adc: adi-axi-adc: don't allow concurrent enable/disable calls

Add proper mutex guards as we should not be able to disable
the core in the middle of enabling it.

Note there's no need to rush in backporting this as the only user of the
backend does not do anything crazy..

Fixes: 794ef0e57854 ("iio: adc: adi-axi-adc: move to backend framework")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240531-dev-axi-adc-drp-v3-1-e3fa79447c67@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agostaging: iio: adt7316: remove unused struct 'adt7316_limit_regs'
Dr. David Alan Gilbert [Wed, 29 May 2024 16:00:55 +0000 (17:00 +0100)]
staging: iio: adt7316: remove unused struct 'adt7316_limit_regs'

'adt7316_limit_regs' has never been used since the original
commit 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9
driver").

The comment above it is a copy-and-paste from a different struct.

Remove both the struct and the comment.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20240529160055.28489-1-linux@treblig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: frequency: adrf6780: rm clk provider include
Antoniu Miclaus [Thu, 30 May 2024 09:28:34 +0000 (12:28 +0300)]
iio: frequency: adrf6780: rm clk provider include

The driver has no clock provider implementation, therefore remove the
include.

Fixes: 63aaf6d06d87 ("iio: frequency: adrf6780: add support for ADRF6780")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20240530092835.36892-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: imu: bmi323: Use iio read_acpi_mount_matrix() helper
Denis Benato [Thu, 23 May 2024 17:47:36 +0000 (19:47 +0200)]
iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper

bmi150-accel and bmi323-imu are declared in an almost identical way in the ACPI and in some devices such as the Asus RC71L the "ROTM" property can be found: parse and use the ACPI-defined mount-matrix.

Co-developed-by: Luke D. Jones <luke@ljones.dev>
Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Link: https://lore.kernel.org/r/20240523174736.16692-2-benato.denis96@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7944: remove unused parameter
David Lechner [Fri, 24 May 2024 20:38:04 +0000 (15:38 -0500)]
iio: adc: ad7944: remove unused parameter

In the ad7944 driver, the ad7944_convert_and_acquire() had an unused
`chan` parameter. This patch removes the parameter.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240524-iio-ad7944-remove-unused-parameter-v1-1-fd824d7122a0@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: sort Makefile
David Lechner [Thu, 23 May 2024 19:24:10 +0000 (14:24 -0500)]
iio: adc: sort Makefile

The Makefile for IIO ADC drivers is intended to be sorted alphabetically.
I can be tricky to keep it sorted when adding new drivers when not all
of the existing drivers are sorted. So let's sort everything now to make
it easier to keep it sorted in the future.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240523192412.3220547-1-dlechner@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: dac: ad3552r: uniform structure names
Angelo Dureghello [Wed, 22 May 2024 15:01:41 +0000 (17:01 +0200)]
iio: dac: ad3552r: uniform structure names

Use same driver file name (ad3552r) for structure names used
for all variants.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-7-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: dac: ad3552r: change AD3552R_NUM_CH define name
Angelo Dureghello [Wed, 22 May 2024 15:01:40 +0000 (17:01 +0200)]
iio: dac: ad3552r: change AD3552R_NUM_CH define name

After model data and num_hw_channles introduction, we have:

ad3552r_desc, num_ch: used to keep channel number set in fdt,
ad35xxr_model_data, num_hw_channels: for max channel checks,
AD3552R_NUM_CH: just actually used to define the max array size
on allocated arrays.

Renaming AD3552R_NUM_CH to a more consistent name, as AD3552R_MAX_CH.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-6-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: dac: ad3552r: add support for ad3541r and ad3551r
Angelo Dureghello [Wed, 22 May 2024 15:01:39 +0000 (17:01 +0200)]
iio: dac: ad3552r: add support for ad3541r and ad3551r

Add support for single-output DAC variants.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-5-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: dac: ad3552r: add model data structure
Angelo Dureghello [Wed, 22 May 2024 15:01:38 +0000 (17:01 +0200)]
iio: dac: ad3552r: add model data structure

Add a "model data" structure to keep useful hardware-related
information as from datasheet, avoiding id-based conditional
choices later on.

Removed id-based checks and filled model-specific structures
with device specific features, In particular, num_hw_channels
is introduced to keep the number of hardware implemented
channels, since 1-channel versions of the DACs are added
in this same patchset.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-4-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: dac: add ad35xxr single output variants
Angelo Dureghello [Wed, 22 May 2024 15:01:37 +0000 (17:01 +0200)]
dt-bindings: iio: dac: add ad35xxr single output variants

Add support for ad3541r and ad3551r single output variants.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-3-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: dac: fix ad3552r gain parameter names
Angelo Dureghello [Wed, 22 May 2024 15:01:36 +0000 (17:01 +0200)]
dt-bindings: iio: dac: fix ad3552r gain parameter names

The adi,gain-scaling-p/n values are an inverted log2,
so initial naming was set correctly, but the driver uses just
adi,gain-scaling-p/n, and if fdt is created accordingly with
the fdt bindings documentation, driver fails the probe.

Observing that:
- the Linux driver is the only consumer,
- there are no upstreamed dts nodes related to ad3552r,

the fix to the documentation side is preferred and less-risk.

Fixes: b0a96c5f599e ("dt-bindings: iio: dac: Add adi,ad3552r.yaml")
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522150141.1776196-2-adureghello@baylibre.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad9467: change struct members padding
Nuno Sa [Wed, 22 May 2024 12:54:06 +0000 (14:54 +0200)]
iio: adc: ad9467: change struct members padding

Using tabs and maintaining the start of the variables aligned is a pain and
may lead to lot's of unrelated changes when adding new members. Hence,
let's change things now and just have a simple space.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522-dev-ad9467-dma-v2-2-a37bec463632@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad9467: use DMA safe buffer for spi
Nuno Sa [Wed, 22 May 2024 12:54:05 +0000 (14:54 +0200)]
iio: adc: ad9467: use DMA safe buffer for spi

Make sure we use a DMA safe buffer (IIO_DMA_MINALIGN) for all the spi
transfers. Only relevant for writes since for reads
spi_write_then_read() is used which does not require DMA safe buffers.

Also note that for consistency, ad9467_spi_read() is also taking struct
ad9467_state as a parameter (even if not really needed).

Fixes: ad6797120238 ("iio: adc: ad9467: add support AD9467 ADC")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240522-dev-ad9467-dma-v2-1-a37bec463632@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: light: stk3310: support more stk3311 variants
Barnabás Czémán [Tue, 21 May 2024 15:34:53 +0000 (17:34 +0200)]
iio: light: stk3310: support more stk3311 variants

Add support for more stk3311 variants like stk3311-a
and stk3311-s34, they are register compatible but they
have different chip ids.

Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
Link: https://lore.kernel.org/r/20240521-stk3311-v1-3-07a4966b355a@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: light: stk3310: make chip id check expandable
Barnabás Czémán [Tue, 21 May 2024 15:34:52 +0000 (17:34 +0200)]
iio: light: stk3310: make chip id check expandable

Modify chip id check for support easier additions
for compatible variants.

Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
Link: https://lore.kernel.org/r/20240521-stk3311-v1-2-07a4966b355a@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: light: stk3310: relax failure to match id
Barnabás Czémán [Tue, 21 May 2024 15:34:51 +0000 (17:34 +0200)]
iio: light: stk3310: relax failure to match id

Relax failure to match ID to a warning rather than probe fail.
This add abilty to use other compatible variants when chip id
is not defined in the driver.

Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
Link: https://lore.kernel.org/r/20240521-stk3311-v1-1-07a4966b355a@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: light: rohm-bu27034: remove unused struct 'bu27034_result'
Dr. David Alan Gilbert [Wed, 22 May 2024 23:04:57 +0000 (00:04 +0100)]
iio: light: rohm-bu27034: remove unused struct 'bu27034_result'

'bu27034_result' is unused since the original
commit e52afbd61039 ("iio: light: ROHM BU27034 Ambient Light Sensor").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Acked-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/20240522230457.478156-4-linux@treblig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: pac1934: remove unused struct 'samp_rate_mapping'
Dr. David Alan Gilbert [Wed, 22 May 2024 23:04:56 +0000 (00:04 +0100)]
iio: adc: pac1934: remove unused struct 'samp_rate_mapping'

'samp_rate_mapping' has been unused since the original
commit 0fb528c8255b ("iio: adc: adding support for PAC193x").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20240522230457.478156-3-linux@treblig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: accel: bmi088: remove unused struct 'bmi088_scale_info'
Dr. David Alan Gilbert [Wed, 22 May 2024 23:04:55 +0000 (00:04 +0100)]
iio: accel: bmi088: remove unused struct 'bmi088_scale_info'

'bmi088_scale_info' has been unused since the original
commit c19ae6be7555 ("iio: accel: Add support for the Bosch-Sensortec
BMI088").

Remove it.

Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20240522230457.478156-2-linux@treblig.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7192: Add AD7194 support
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:22 +0000 (15:02 +0300)]
iio: adc: ad7192: Add AD7194 support

Unlike the other AD719Xs, AD7194 has configurable channels. The user can
dynamically configure them in the devicetree.

Add sigma_delta_info member to chip_info structure. Since AD7194 is the
only chip that has no channel sequencer, num_slots should remain
undefined.

Also modify config AD7192 description for better scaling.

Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Link: https://lore.kernel.org/r/20240514120222.56488-7-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: ad7192: Add AD7194 support
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:21 +0000 (15:02 +0300)]
dt-bindings: iio: adc: ad7192: Add AD7194 support

Unlike the other AD719Xs, AD7194 has configurable channels. The user can
dynamically configure them in the devicetree.

Also add an example for AD7194 devicetree.

Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240514120222.56488-6-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: Add single-channel property
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:20 +0000 (15:02 +0300)]
dt-bindings: iio: adc: Add single-channel property

Devices that have both single-ended channels and differential channels
cause a bit of confusion when the channels are configured in the
devicetree.

Clarify difference between these two types of channels for such devices
by adding single-channel property alongside diff-channels. They should
be mutually exclusive.

Devices that have only single-ended channels can still use reg property
to reference a channel like before.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240514120222.56488-5-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7192: Add aincom supply
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:19 +0000 (15:02 +0300)]
iio: adc: ad7192: Add aincom supply

AINCOM should actually be a supply. AINx inputs are referenced to AINCOM
in pseudo-differential operation mode. AINCOM voltage represents the
offset of corresponding channels.

Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Link: https://lore.kernel.org/r/20240514120222.56488-4-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: adc: ad7192: Add aincom supply
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:18 +0000 (15:02 +0300)]
dt-bindings: iio: adc: ad7192: Add aincom supply

AINCOM should actually be a supply. AINx inputs are referenced to AINCOM
in pseudo-differential operation mode. AINCOM voltage represents the
offset of corresponding channels.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Link: https://lore.kernel.org/r/20240514120222.56488-3-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: adc: ad7192: Use standard attribute
Alisa-Dariana Roman [Tue, 14 May 2024 12:02:17 +0000 (15:02 +0300)]
iio: adc: ad7192: Use standard attribute

Replace custom attribute filter_low_pass_3db_frequency_available with
standard attribute.

Store the available values in ad7192_state struct.

The function that used to compute those values replaced by
ad7192_update_filter_freq_avail().

Function ad7192_show_filter_avail() is no longer needed.

Note that the initial available values are hardcoded.

Also moved the mutex lock and unlock in order to protect the whole
switch statement since each branch modifies the state of the device.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Link: https://lore.kernel.org/r/20240514120222.56488-2-alisa.roman@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Introduce new cleanup routines
Vasileios Amoiridis [Sun, 12 May 2024 23:05:21 +0000 (01:05 +0200)]
iio: pressure: bmp280: Introduce new cleanup routines

Introduce new linux/cleanup.h with the guard(mutex) functionality.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240512230524.53990-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Refactorize reading functions
Vasileios Amoiridis [Sun, 12 May 2024 23:05:20 +0000 (01:05 +0200)]
iio: pressure: bmp280: Refactorize reading functions

For BMP18x, BMP28x, BME280, BMP38x the reading of the pressure
value requires an update of the t_fine variable which happens
through reading the temperature value.

So all the bmpxxx_read_press() functions of the above sensors
are internally calling the equivalent bmpxxx_read_temp() function
in order to update the t_fine value. By just looking at the code
this functionality is a bit hidden and is not easy to understand
why those channels are not independent.

This commit tries to clear these things a bit by splitting the
bmpxxx_{read/compensate}_{temp/press/humid}() to the following:

i. bmpxxx_read_{temp/press/humid}_adc(): read the raw value from
the sensor.

ii. bmpxx_calc_t_fine(): calculate the t_fine variable.

iii. bmpxxx_get_t_fine(): get the t_fine variable.

iv. bmpxxx_compensate_{temp/press/humid}(): compensate the adc
values and return the calculated value.

v. bmpxxx_read_{temp/press/humid}(): combine calls of the
aforementioned functions to return the requested value.

Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240512230524.53990-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Use unsigned data types for raw sensor data
Vasileios Amoiridis [Wed, 8 May 2024 16:52:02 +0000 (18:52 +0200)]
iio: pressure: bmp280: Use unsigned data types for raw sensor data

The raw sensor data that have not been compensated yet cannot be
signed values, so use unsigned ones. Also, compensated pressure
values cannot be negative so use unsigned also there.

Also, drop redundant cast of data->t_fine variable from s32 to s32.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240508165207.145554-5-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Make error checks consistent
Vasileios Amoiridis [Wed, 8 May 2024 16:52:01 +0000 (18:52 +0200)]
iio: pressure: bmp280: Make error checks consistent

The form 'if (ret)' is used in this driver in order to check
for returned error values. There are also some places that
'if (ret < 0)' is used but for no specific reason. Change
them to 'if (ret)' to make the driver more consistent.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240508165207.145554-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Remove, add and update error messages
Vasileios Amoiridis [Wed, 8 May 2024 16:52:00 +0000 (18:52 +0200)]
iio: pressure: bmp280: Remove, add and update error messages

Remove duplicate error messages, add missing error messages and
update redundant ones.

Add one missing error check.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240508165207.145554-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Remove dead error checks
Vasileios Amoiridis [Wed, 8 May 2024 16:51:59 +0000 (18:51 +0200)]
iio: pressure: bmp280: Remove dead error checks

The ret value is being checked already in all the previous
paths which exit in case of error, so this path can never
become true.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240508165207.145554-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: Drop explicit initialization of struct i2c_device_id::driver_data to 0
Uwe Kleine-König [Wed, 8 May 2024 07:29:27 +0000 (09:29 +0200)]
iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0

These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.

This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.

While add it, also remove commas after the sentinel entries.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20240508072928.2135858-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Add more intuitive name for bmp180_measure()
Vasileios Amoiridis [Mon, 29 Apr 2024 19:00:40 +0000 (21:00 +0200)]
iio: pressure: bmp280: Add more intuitive name for bmp180_measure()

The bmp180_measure() function essentially waits for the end of the
current conversion in order to read the values from the sensors. The
name bmp180_measure() could be misinterpreted because it could be
translated as "measure sensor values" even though it was probably
trying to say "measure time for eoc". Give a more intuitive name
to this function to be less confusing.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240429190046.24252-5-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Add identifier names in function definitions
Vasileios Amoiridis [Mon, 29 Apr 2024 19:00:39 +0000 (21:00 +0200)]
iio: pressure: bmp280: Add identifier names in function definitions

checkpatch.pl complained about missing identifier names in the input
variables for some function definitions.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240429190046.24252-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Use BME prefix for BME280 specifics
Vasileios Amoiridis [Mon, 29 Apr 2024 19:00:38 +0000 (21:00 +0200)]
iio: pressure: bmp280: Use BME prefix for BME280 specifics

Change the rest of the defines and function names that are
used specifically by the BME280 humidity sensor to BME280
as it is done for the rest of the BMP{0,1,3,5}80 sensors.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240429190046.24252-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: pressure: bmp280: Improve indentation and line wrapping
Vasileios Amoiridis [Mon, 29 Apr 2024 19:00:37 +0000 (21:00 +0200)]
iio: pressure: bmp280: Improve indentation and line wrapping

Fix indentations that are not following the standards, remove
extra white lines and add missing white lines.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://lore.kernel.org/r/20240429190046.24252-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: test: gts: test available times and gains sorting
Matti Vaittinen [Tue, 30 Apr 2024 12:45:21 +0000 (15:45 +0300)]
iio: test: gts: test available times and gains sorting

The iio_gts helpers build available times and scales tables based on the
times and gains arrays given from the driver. The driver should be able
to list all valid register values so that conversion from register valu
to correct gain/time works for all supported register values.

It might be more convenient for drivers to list these times and gains in
the order where they're listed in the data-sheet than ascending order.

However, for user who requests the supported scales / times it is more
convenient to get the results in asscending order. Also, listing
duplicated values is not meaning for the user.

Hence the GTS heler should do sorting and deduplication of the scales
and times when it builds the tables listing the available times/scales.
Note, currently duplicated gain values aren't handled by GTS-helpers.

Unsort the gain and time arrays in the test code, and add duplicates to
time array in order to test the sorting and deduplicating works.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/365cc6de3c17a457db738f5fdf8dd3bd6f50d5f2.1714480171.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: Fix the sorting functionality in iio_gts_build_avail_time_table
Chenyuan Yang [Tue, 30 Apr 2024 12:44:53 +0000 (15:44 +0300)]
iio: Fix the sorting functionality in iio_gts_build_avail_time_table

The sorting in iio_gts_build_avail_time_table is not working as intended.
It could result in an out-of-bounds access when the time is zero.

Here are more details:

1. When the gts->itime_table[i].time_us is zero, e.g., the time
sequence is `3, 0, 1`, the inner for-loop will not terminate and do
out-of-bound writes. This is because once `times[j] > new`, the value
`new` will be added in the current position and the `times[j]` will be
moved to `j+1` position, which makes the if-condition always hold.
Meanwhile, idx will be added one, making the loop keep running without
termination and out-of-bound write.
2. If none of the gts->itime_table[i].time_us is zero, the elements
will just be copied without being sorted as described in the comment
"Sort times from all tables to one and remove duplicates".

For more details, please refer to
https://lore.kernel.org/all/6dd0d822-046c-4dd2-9532-79d7ab96ec05@gmail.com.

Reported-by: Chenyuan Yang <chenyuan0y@gmail.com>
Suggested-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers")
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
Co-developed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/d501ade8c1f7b202d34c6404eda423489cab1df5.1714480171.git.mazziesaccount@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agodt-bindings: iio: imu: bmi160: add bmi120
Danila Tikhonov [Sun, 5 May 2024 05:36:55 +0000 (07:36 +0200)]
dt-bindings: iio: imu: bmi160: add bmi120

Document bosch,bmi120 compatible.

Signed-off-by: Danila Tikhonov <danila@jiaxyga.com>
Signed-off-by: Barnbás Czémán <trabarni@gmail.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240505-bmi120-v3-2-15cee3d0b2ef@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: imu: bmi160: add support for bmi120
Danila Tikhonov [Sun, 5 May 2024 05:36:54 +0000 (07:36 +0200)]
iio: imu: bmi160: add support for bmi120

Add support for bmi120 low power variant of bmi160.
Relax failure to match ID to a warning rather than probe fail.
This allows for fallback compatibles, whilst retaining a useful
debugging message if they turn out not to be so compatible due to
badly behaved firmware.

Signed-off-by: Danila Tikhonov <danila@jiaxyga.com>
Co-developed-by: Barnabás Czémán <trabarni@gmail.com>
Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
Link: https://lore.kernel.org/r/20240505-bmi120-v3-1-15cee3d0b2ef@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: light: gp2ap020a00f: Remove some unused field in struct gp2ap020a00f_data
Christophe JAILLET [Wed, 1 May 2024 12:55:17 +0000 (14:55 +0200)]
iio: light: gp2ap020a00f: Remove some unused field in struct gp2ap020a00f_data

In "struct gp2ap020a00f_data", the 'pdata' field is unused.

Moreover the "struct gp2ap020a00f_platform_data" is defined nowhere.
Neither in this file, nor in a global .h file, so it is completely
pointless.

So, remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/57e9f29c7062d1bb846064bf6dbd7a8385a855e7.1714568099.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: tmag5273: Remove some unused field in struct tmag5273_data
Christophe JAILLET [Wed, 1 May 2024 11:28:50 +0000 (13:28 +0200)]
iio: tmag5273: Remove some unused field in struct tmag5273_data

In "struct tmag5273_data", the 'scale' and 'vcc' fields are unused.
Remove them.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Gerald Loacker <gerald.loacker@wolfvision.net>
Link: https://lore.kernel.org/r/7bd16d7fea12c64b6b3dc3cd32839cfce145bcf3.1714562912.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: multiplexer: Remove an unused field in struct mux
Christophe JAILLET [Wed, 1 May 2024 09:41:54 +0000 (11:41 +0200)]
iio: multiplexer: Remove an unused field in struct mux

In "struct mux", the 'indio_dev' field is unused.
Remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/7bb04abdc2815caf090a6c9ecab2a51d837792a7.1714556499.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: temperature: max30208: Remove an unused field in struct max30208_data
Christophe JAILLET [Wed, 1 May 2024 09:19:41 +0000 (11:19 +0200)]
iio: temperature: max30208: Remove an unused field in struct max30208_data

In "struct max30208_data", the 'indio_dev' field is unused.
Remove it.

Found with cppcheck, unusedStructMember.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/73f9f540ecdc7c10e833e6fc782324ae7d34ba9c.1714555144.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoiio: adc: ad7606: using claim_direct_scoped for code simplification
Jorge Harrisonn [Wed, 1 May 2024 21:57:23 +0000 (18:57 -0300)]
iio: adc: ad7606: using claim_direct_scoped for code simplification

Using iio_device_claim_direct_scoped instead of calling `iio_device
_claim_direct_modeand later callingiio_device_release_direct_mode`

This should make code cleaner and error handling easier

Co-authored-by: Lais Nuto <laisnuto@usp.br>
Signed-off-by: Lais Nuto <laisnuto@usp.br>
Signed-off-by: Jorge Harrisonn <jorge.harrisonn@usp.br>
Link: https://lore.kernel.org/r/20240501215724.26655-2-jorge.harrisonn@usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
14 months agoLinux 6.10-rc1
Linus Torvalds [Sun, 26 May 2024 22:20:12 +0000 (15:20 -0700)]
Linux 6.10-rc1

14 months agomm: percpu: Include smp.h in alloc_tag.h
Kent Overstreet [Fri, 24 May 2024 15:42:09 +0000 (11:42 -0400)]
mm: percpu: Include smp.h in alloc_tag.h

percpu.h depends on smp.h, but doesn't include it directly because of
circular header dependency issues; percpu.h is needed in a bunch of low
level headers.

This fixes a randconfig build error on mips:

  include/linux/alloc_tag.h: In function '__alloc_tag_ref_set':
  include/asm-generic/percpu.h:31:40: error: implicit declaration of function 'raw_smp_processor_id' [-Werror=implicit-function-declaration]

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 24e44cc22aa3 ("mm: percpu: enable per-cpu allocation tagging")
Closes: https://lore.kernel.org/oe-kbuild-all/202405210052.DIrMXJNz-lkp@intel.com/
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 months agoMerge tag 'perf-tools-fixes-for-v6.10-1-2024-05-26' of git://git.kernel.org/pub/scm...
Linus Torvalds [Sun, 26 May 2024 16:54:26 +0000 (09:54 -0700)]
Merge tag 'perf-tools-fixes-for-v6.10-1-2024-05-26' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools

Pull perf tool fix from Arnaldo Carvalho de Melo:
 "Revert a patch causing a regression.

  This made a simple 'perf record -e cycles:pp make -j199' stop working
  on the Ampere ARM64 system Linus uses to test ARM64 kernels".

* tag 'perf-tools-fixes-for-v6.10-1-2024-05-26' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
  Revert "perf parse-events: Prefer sysfs/JSON hardware events over legacy"

14 months agoRevert "perf parse-events: Prefer sysfs/JSON hardware events over legacy"
Arnaldo Carvalho de Melo [Sun, 26 May 2024 11:13:21 +0000 (08:13 -0300)]
Revert "perf parse-events: Prefer sysfs/JSON hardware events over legacy"

This reverts commit 617824a7f0f73e4de325cf8add58e55b28c12493.

This made a simple 'perf record -e cycles:pp make -j199' stop working on
the Ampere ARM64 system Linus uses to test ARM64 kernels, as discussed
at length in the threads in the Link tags below.

The fix provided by Ian wasn't acceptable and work to fix this will take
time we don't have at this point, so lets revert this and work on it on
the next devel cycle.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Cc: Ethan Adams <j.ethan.adams@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Tycho Andersen <tycho@tycho.pizza>
Cc: Yang Jihong <yangjihong@bytedance.com>
Link: https://lore.kernel.org/lkml/CAHk-=wi5Ri=yR2jBVk-4HzTzpoAWOgstr1LEvg_-OXtJvXXJOA@mail.gmail.com
Link: https://lore.kernel.org/lkml/CAHk-=wiWvtFyedDNpoV7a8Fq_FpbB+F5KmWK2xPY3QoYseOf_A@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
14 months agoMerge tag '6.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sun, 26 May 2024 05:33:10 +0000 (22:33 -0700)]
Merge tag '6.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - two important netfs integration fixes - including for a data
   corruption and also fixes for multiple xfstests

 - reenable swap support over SMB3

* tag '6.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Fix missing set of remote_i_size
  cifs: Fix smb3_insert_range() to move the zero_point
  cifs: update internal version number
  smb3: reenable swapfiles over SMB3 mounts

14 months agoMerge tag 'mm-hotfixes-stable-2024-05-25-09-13' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 25 May 2024 22:10:33 +0000 (15:10 -0700)]
Merge tag 'mm-hotfixes-stable-2024-05-25-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton:
 "16 hotfixes, 11 of which are cc:stable.

  A few nilfs2 fixes, the remainder are for MM: a couple of selftests
  fixes, various singletons fixing various issues in various parts"

* tag 'mm-hotfixes-stable-2024-05-25-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mm/ksm: fix possible UAF of stable_node
  mm/memory-failure: fix handling of dissolved but not taken off from buddy pages
  mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again
  nilfs2: fix potential hang in nilfs_detach_log_writer()
  nilfs2: fix unexpected freezing of nilfs_segctor_sync()
  nilfs2: fix use-after-free of timer for log writer thread
  selftests/mm: fix build warnings on ppc64
  arm64: patching: fix handling of execmem addresses
  selftests/mm: compaction_test: fix bogus test success and reduce probability of OOM-killer invocation
  selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
  selftests/mm: compaction_test: fix bogus test success on Aarch64
  mailmap: update email address for Satya Priya
  mm/huge_memory: don't unpoison huge_zero_folio
  kasan, fortify: properly rename memintrinsics
  lib: add version into /proc/allocinfo output
  mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL

14 months agoMerge tag 'irq-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 25 May 2024 21:48:40 +0000 (14:48 -0700)]
Merge tag 'irq-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fixes from Ingo Molnar:

 - Fix x86 IRQ vector leak caused by a CPU offlining race

 - Fix build failure in the riscv-imsic irqchip driver
   caused by an API-change semantic conflict

 - Fix use-after-free in irq_find_at_or_after()

* tag 'irq-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  genirq/irqdesc: Prevent use-after-free in irq_find_at_or_after()
  genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline
  irqchip/riscv-imsic: Fixup riscv_ipi_set_virq_range() conflict

14 months agoMerge tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 25 May 2024 21:40:09 +0000 (14:40 -0700)]
Merge tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

 - Fix regressions of the new x86 CPU VFM (vendor/family/model)
   enumeration/matching code

 - Fix crash kernel detection on buggy firmware with
   non-compliant ACPI MADT tables

 - Address Kconfig warning

* tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL
  crypto: x86/aes-xts - switch to new Intel CPU model defines
  x86/topology: Handle bogus ACPI tables correctly
  x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y

14 months agoMerge tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi
Linus Torvalds [Sat, 25 May 2024 21:32:29 +0000 (14:32 -0700)]
Merge tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi

Pull ipmi updates from Corey Minyard:
 "Mostly updates for deprecated interfaces, platform.remove and
  converting from a tasklet to a BH workqueue.

  Also use HAS_IOPORT for disabling inb()/outb()"

* tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: kcs_bmc_npcm7xx: Convert to platform remove callback returning void
  ipmi: kcs_bmc_aspeed: Convert to platform remove callback returning void
  ipmi: ipmi_ssif: Convert to platform remove callback returning void
  ipmi: ipmi_si_platform: Convert to platform remove callback returning void
  ipmi: ipmi_powernv: Convert to platform remove callback returning void
  ipmi: bt-bmc: Convert to platform remove callback returning void
  char: ipmi: handle HAS_IOPORT dependencies
  ipmi: Convert from tasklet to BH workqueue