]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 months agoiio: light: veml6030: drop processed info for white channel
Javier Carrasco [Tue, 1 Oct 2024 20:21:19 +0000 (22:21 +0200)]
iio: light: veml6030: drop processed info for white channel

The resolution of the WHITE channel is not provided by the manufacturer,
neither in the datasheet nor in the application note (even their
proprietary application only processes the ALS channel, giving raw
values for WHITE).

The current implementation assumes that both resolutions are identical,
which is extremely unlikely, especially for photodiodes with different
spectral responses.

Drop the processed information as it is meaningless.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-6-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6030: use read_avail() for available attributes
Javier Carrasco [Tue, 1 Oct 2024 20:21:18 +0000 (22:21 +0200)]
iio: light: veml6030: use read_avail() for available attributes

Drop custom attributes by using the standard read_avail() callback to
read scale and integration time. When at it, add the integration time
and scale attributes fro the WHITE channel, as they modify its value as
well. To avoid breaking the current ABI, these attributes must be kept
as separate for both channels even though they are shared under the
hood.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-5-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6030: add support for a regulator
Javier Carrasco [Tue, 1 Oct 2024 20:21:17 +0000 (22:21 +0200)]
iio: light: veml6030: add support for a regulator

Use the device managed function from the regulator API to get and enable
a regulator powering the device.

Use "vdd" as the ID to account for the provided name in the datasheet.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-4-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: light: veml6030: add vdd-supply property
Javier Carrasco [Tue, 1 Oct 2024 20:21:16 +0000 (22:21 +0200)]
dt-bindings: iio: light: veml6030: add vdd-supply property

Add vdd-supply to account for the sensor's power source.

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-3-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6030: use dev_err_probe()
Javier Carrasco [Tue, 1 Oct 2024 20:21:15 +0000 (22:21 +0200)]
iio: light: veml6030: use dev_err_probe()

Use the more convenient dev_err_probe() to get rid of the dev_err() +
return sequence in the probe error paths.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-2-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6030: add set up delay after any power on sequence
Javier Carrasco [Tue, 1 Oct 2024 20:21:14 +0000 (22:21 +0200)]
iio: light: veml6030: add set up delay after any power on sequence

The veml6030 requires a delay of 4 ms after activating the sensor. That
is done correctly during the hw initialization, but it's missing after
resuming.

Move the delay to the power on function to make sure that it is always
observerd. When at it, use fsleep() instead of usleep_range() as such a
narrow range is not required.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241001-veml6035-v3-1-d789f6ff147c@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: bmp280: Use char instead of s32 for data buffer
Vasileios Amoiridis [Mon, 30 Sep 2024 20:23:53 +0000 (22:23 +0200)]
iio: pressure: bmp280: Use char instead of s32 for data buffer

As it was reported and discussed here [1], storing the sensor data in an
endian aware s32 buffer is not optimal. Advertising the timestamp as an
addition of 2 s32 variables which is also implied is again not the best
practice. For that reason, change the s32 sensor_data buffer to a u8
buffer and align it properly.

[1]: https://lore.kernel.org/linux-iio/73d13cc0-afb9-4306-b498-5d821728c3ba@stanley.mountain/

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20240930202353.38203-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: bmp280: Use unsigned type for raw values
Vasileios Amoiridis [Mon, 30 Sep 2024 20:23:52 +0000 (22:23 +0200)]
iio: pressure: bmp280: Use unsigned type for raw values

The adc values coming directly from the sensor in the BM{E,P}{2,3}xx
sensors are unsigned values so treat them as such.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20240930202353.38203-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: dac: ad3552r: fix maximum spi speed
Angelo Dureghello [Thu, 3 Oct 2024 17:29:01 +0000 (19:29 +0200)]
dt-bindings: iio: dac: ad3552r: fix maximum spi speed

Fix maximum SPI clock speed, as per datasheet (Rev. B, page 6).

Fixes: b0a96c5f599e ("dt-bindings: iio: dac: Add adi,ad3552r.yaml")
Cc: stable@vger.kernel.org
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241003-wip-bl-ad3552r-axi-v0-iio-testing-v4-4-ceb157487329@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoMAINTAINERS: iio: imu: add entry for InvenSense MPU-6050 driver
Jean-Baptiste Maneyrol [Thu, 3 Oct 2024 13:38:24 +0000 (15:38 +0200)]
MAINTAINERS: iio: imu: add entry for InvenSense MPU-6050 driver

Add entry for inv_mpu6050 iio driver supporting InvenSense MPU-6xxx
and ICM-206xxx devices.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-3-ca5a4928eb22@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: imu: migrate InvenSense email to TDK group domain
Jean-Baptiste Maneyrol [Thu, 3 Oct 2024 13:38:23 +0000 (15:38 +0200)]
dt-bindings: iio: imu: migrate InvenSense email to TDK group domain

Migrate maintainer email to TDK domain.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-2-ca5a4928eb22@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoMAINTAINERS: iio: migrate invensense email address to tdk domain
Jean-Baptiste Maneyrol [Thu, 3 Oct 2024 13:38:22 +0000 (15:38 +0200)]
MAINTAINERS: iio: migrate invensense email address to tdk domain

InvenSense is part of TDK group. Update email address to use the
TDK domain.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241003-invn-maintainers-email-update-v2-1-ca5a4928eb22@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoMAINTAINERS: add the GE HealthCare PMC ADC driver entry
Herve Codina [Thu, 3 Oct 2024 11:46:41 +0000 (13:46 +0200)]
MAINTAINERS: add the GE HealthCare PMC ADC driver entry

After contributing the driver, add myself as the maintainer for the
GE HealthCare PCM ADC IIO driver.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Tested-by: Ian Ray <ian.ray@gehealthcare.com>
Link: https://patch.msgid.link/20241003114641.672086-5-herve.codina@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: Add support for the GE HealthCare PMC ADC
Herve Codina [Thu, 3 Oct 2024 11:46:40 +0000 (13:46 +0200)]
iio: adc: Add support for the GE HealthCare PMC ADC

The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel
(voltage and current), 16-Bit ADC with an I2C Interface.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Tested-by: Ian Ray <ian.ray@gehealthcare.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241003114641.672086-4-herve.codina@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: adc: Add the GE HealthCare PMC ADC
Herve Codina [Thu, 3 Oct 2024 11:46:39 +0000 (13:46 +0200)]
dt-bindings: iio: adc: Add the GE HealthCare PMC ADC

The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel
(voltage and current), 16-Bit ADC with an I2C Interface.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Tested-by: Ian Ray <ian.ray@gehealthcare.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20241003114641.672086-3-herve.codina@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: vendor-prefixes: Add an entry for GE HealthCare
Herve Codina [Thu, 3 Oct 2024 11:46:38 +0000 (13:46 +0200)]
dt-bindings: vendor-prefixes: Add an entry for GE HealthCare

Add the "gehc" entry for GE HealthCare.
https://www.gehealthcare.com

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Ian Ray <ian.ray@gehealthcare.com>
Link: https://patch.msgid.link/20241003114641.672086-2-herve.codina@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodocs: iio: fix grammatical error
Ivin Joel Abraham [Wed, 2 Oct 2024 10:03:41 +0000 (15:33 +0530)]
docs: iio: fix grammatical error

Clarify the instruction for disabling autocalibration by adding the word
"by"

Signed-off-by: Ivin Joel Abraham <ivinjabraham@gmail.com>
Link: https://patch.msgid.link/20241002100341.110435-1-ivinjabraham@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: Sort includes in alphabetical order
Guillaume Stols [Fri, 4 Oct 2024 21:48:39 +0000 (21:48 +0000)]
iio: adc: ad7606: Sort includes in alphabetical order

Some of the includes were not in alphabetical order, this commit fixes
it.

Signed-off-by: Guillaume Stols <gstols@baylibre.com>
Link: https://patch.msgid.link/20241004-ad7606_add_iio_backend_support-v3-5-38757012ce82@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: Fix typo in the driver name
Guillaume Stols [Fri, 4 Oct 2024 21:48:35 +0000 (21:48 +0000)]
iio: adc: ad7606: Fix typo in the driver name

The parallel driver's name is ad7606_par and not ad7606_parallel.

Fixes: 0046a46a8f93 ("staging/ad7606: Actually build the interface modules")
Signed-off-by: Guillaume Stols <gstols@baylibre.com>
Link: https://patch.msgid.link/20241004-ad7606_add_iio_backend_support-v3-1-38757012ce82@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: qcom-spmi-adc5: Tidy up adc5_get_fw_data() error messages
Bjorn Andersson [Fri, 4 Oct 2024 23:11:01 +0000 (16:11 -0700)]
iio: adc: qcom-spmi-adc5: Tidy up adc5_get_fw_data() error messages

In the event that no channels (child nodes) are defined, the adc5 driver
will provide a generic error message indicating that adc5_get_fw_data()
returned -EINVAL. In all other error cases we get two error messages,
one helpful and the generic one.

Add a specific error message for the no channels case, and drop the
generic one, in order to improve the generates log prints in both cases.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://patch.msgid.link/20241004-spmi-adc5-no-channel-error-v1-1-1a43d13ae967@oss.qualcomm.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pac1921: remove unnecessary explicit casts
Matteo Martelli [Mon, 30 Sep 2024 09:49:01 +0000 (11:49 +0200)]
iio: pac1921: remove unnecessary explicit casts

Many explicit casts were introduced to address Wconversion and
Wsign-compare warnings. Remove them to improve readability.

Link: https://lore.kernel.org/linux-iio/1fa4ab12-0939-477d-bc92-306fd32e4fd9@stanley.mountain/
Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/20240930-iio-pac1921-nocast-v2-1-cc349e137f75@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: use dev_err_probe in probe function
Javier Carrasco [Sun, 29 Sep 2024 20:38:52 +0000 (22:38 +0200)]
iio: light: veml6070: use dev_err_probe in probe function

Drop the common 'dev_err() + return' combination in the probe function
and use 'return dev_err_probe()' instead.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-7-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: add devicetree support
Javier Carrasco [Sun, 29 Sep 2024 20:38:51 +0000 (22:38 +0200)]
iio: light: veml6070: add devicetree support

Register the compatible from the dt-bindings.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-6-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: light: vishay,veml6075: add vishay,veml6070
Javier Carrasco [Sun, 29 Sep 2024 20:38:50 +0000 (22:38 +0200)]
dt-bindings: iio: light: vishay,veml6075: add vishay,veml6070

This UVA device with I2C has the same properties as the veml6075, and
the same dt-bindings can cover it too.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-5-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: add support for a regulator
Javier Carrasco [Sun, 29 Sep 2024 20:38:49 +0000 (22:38 +0200)]
iio: light: veml6070: add support for a regulator

Add support for a device-managed regulator with the reference name
provided in the datasheet (vdd).

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-4-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: use device managed iio_device_register
Javier Carrasco [Sun, 29 Sep 2024 20:38:48 +0000 (22:38 +0200)]
iio: light: veml6070: use device managed iio_device_register

Simplify the code by using devm_iio_device_register(), which removes the
need for a 'remove' function, as there are no more actions to take.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-3-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: use guard to handle mutex
Javier Carrasco [Sun, 29 Sep 2024 20:38:47 +0000 (22:38 +0200)]
iio: light: veml6070: use guard to handle mutex

Simplify the mutext handling by using a guard to automate the mutex
unlocking.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-2-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6070: add action for i2c_unregister_device
Javier Carrasco [Sun, 29 Sep 2024 20:38:46 +0000 (22:38 +0200)]
iio: light: veml6070: add action for i2c_unregister_device

Simplify the code by adding an action to call i2c_unregister_device(),
which removes the need for a 'fail' label, gotos to it, and an explicit
call in veml6070_remove().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240929-veml6070-cleanup-v1-1-a9350341a646@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: ad5770r: Convert to get_unaligned_le16
Abhash Jha [Sat, 28 Sep 2024 16:18:05 +0000 (21:48 +0530)]
iio: dac: ad5770r: Convert to get_unaligned_le16

Convert the manual shifting to use `get_unaligned_le16` api.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240928161805.165543-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: mt6360-adc: Converted to use get_unaligned_be16()
Abhash Jha [Sat, 28 Sep 2024 16:11:08 +0000 (21:41 +0530)]
iio: adc: mt6360-adc: Converted to use get_unaligned_be16()

Changed the manual shifting and adding of bytes to use
get_unaligned_be16() api instead.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240928161108.163647-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: Fix typos in comments across various files
Yu Jiaoliang [Thu, 26 Sep 2024 03:43:54 +0000 (11:43 +0800)]
iio: adc: Fix typos in comments across various files

This commit fixes several typographical errors in comments within
the drivers/iio/adc directory. No functional changes are made.

Detected using codespell.

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
Link: https://patch.msgid.link/20240926034411.3482986-1-yujiaoliang@vivo.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltrf216a: Document device name for compatible
Shreeya Patel [Mon, 23 Sep 2024 13:15:27 +0000 (18:45 +0530)]
iio: light: ltrf216a: Document device name for compatible

Compatible 'ltr,ltrf216a' is used by Valve's Steamdeck device
via the ACPI + PRP0001 mechanism.
Document this info alongside the compatible.

Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Link: https://patch.msgid.link/20240923131527.1408691-1-shreeya.patel@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: imu: inv_mpu6050: add support for IAM-20680HT/HP
Jean-Baptiste Maneyrol [Mon, 23 Sep 2024 14:53:22 +0000 (16:53 +0200)]
iio: imu: inv_mpu6050: add support for IAM-20680HT/HP

IAM-20680HT & HP are 2 variants of IAM-20680 with better specs,
wider temperature range, and a bigger FIFO (4k).

Fully compatible with IAM-20680, FIFO is 512 bytes by default and
with correct register setting we expand it to full 4k.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20240923-inv-mpu6050-add-iam20680-ht-hp-v2-2-48290e0b9931@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: imu: mpu6050: Add iam20680ht/hp bindings to mpu6050
Jean-Baptiste Maneyrol [Mon, 23 Sep 2024 14:53:21 +0000 (16:53 +0200)]
dt-bindings: iio: imu: mpu6050: Add iam20680ht/hp bindings to mpu6050

IAM-20680HT & HP are 2 variants of IAM-20680 that are backwards compatible.
They just have better specs, temperature range and a bigger FIFO.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240923-inv-mpu6050-add-iam20680-ht-hp-v2-1-48290e0b9931@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad5755: use scoped device_for_each_child_node()
Javier Carrasco [Thu, 26 Sep 2024 16:08:40 +0000 (18:08 +0200)]
iio: adc: ad5755: use scoped device_for_each_child_node()

Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path, in
this particular case dropping the jump to error_out as well.

This prevents possible memory leaks if new error paths are added without
the required call to fwnode_handle_put().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-4-64ca8a424578@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: sun20i-gpadc: use scoped device_for_each_child_node()
Javier Carrasco [Thu, 26 Sep 2024 16:08:39 +0000 (18:08 +0200)]
iio: adc: sun20i-gpadc: use scoped device_for_each_child_node()

Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path.

This prevents possible memory leaks if new error paths are added without
the required call to fwnode_handle_put().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-3-64ca8a424578@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: qcom-spmi-vadc: use scoped device_for_each_child_node()
Javier Carrasco [Thu, 26 Sep 2024 16:08:38 +0000 (18:08 +0200)]
iio: adc: qcom-spmi-vadc: use scoped device_for_each_child_node()

Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path.

This prevents possible memory leaks if new error paths are added without
the required call to fwnode_handle_put().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-2-64ca8a424578@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node()
Javier Carrasco [Thu, 26 Sep 2024 16:08:37 +0000 (18:08 +0200)]
iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node()

Switch to device_for_each_child_node_scoped() to simplify the code by
removing the need for calls to fwnode_handle_put() in the error path.

This prevents possible memory leaks if new error paths are added without
the required call to fwnode_handle_put().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240926-iio_device_for_each_child_node_scoped-v1-1-64ca8a424578@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ti-ads1119: Drop explicit initialization of struct i2c_device_id::driver_da...
Uwe Kleine-König [Fri, 20 Sep 2024 15:34:29 +0000 (17:34 +0200)]
iio: adc: ti-ads1119: 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: João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
Link: https://patch.msgid.link/20240920153430.503212-11-u.kleine-koenig@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltr390: Replaced mask values with GENMASK()
Abhash Jha [Sat, 14 Sep 2024 18:22:39 +0000 (23:52 +0530)]
iio: light: ltr390: Replaced mask values with GENMASK()

Changed the hardcoded mask values for GAIN_MASK and INT_TIME_MASK to use
GENMASK() instead.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240914182239.507953-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltr390: Add interrupt persistance support
Abhash Jha [Sat, 14 Sep 2024 18:12:46 +0000 (23:42 +0530)]
iio: light: ltr390: Add interrupt persistance support

Added support to configure the threshold interrupt persistance value by
providing IIO_EV_INFO_PERIOD attribute. The value written to the
attribute should be in miliseconds and should be greater than the
sampling rate of the sensor.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240914181246.504450-5-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltr390: Interrupts and threshold event support
Abhash Jha [Sat, 14 Sep 2024 18:12:45 +0000 (23:42 +0530)]
iio: light: ltr390: Interrupts and threshold event support

Added support for threshold events for both the ALS and UVI channels.
The events are reported when the threshold interrupt is triggered. Both
rising and falling threshold types are supported.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240914181246.504450-4-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltr390: Suspend and Resume support
Abhash Jha [Sat, 14 Sep 2024 18:12:44 +0000 (23:42 +0530)]
iio: light: ltr390: Suspend and Resume support

Added support for suspend and resume PM ops.
We suspend the sensor by clearing the ALS_UVS_EN bit in the MAIN CONTROL
register. And we resume it by setting that bit.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240914181246.504450-3-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: ltr390: Added configurable sampling frequency support
Abhash Jha [Sat, 14 Sep 2024 18:12:43 +0000 (23:42 +0530)]
iio: light: ltr390: Added configurable sampling frequency support

Provided configurable sampling frequency(Measurement rate) support.
Also exposed the available sampling frequency values using read_avail
callback.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240914181246.504450-2-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: max1363: Convert to get_unaligned_be16
Abhash Jha [Fri, 20 Sep 2024 18:14:37 +0000 (23:44 +0530)]
iio: adc: max1363: Convert to get_unaligned_be16

Converted manual shifting and or to use `get_unaligned_be16` api
instead.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240920181437.20194-1-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agostaging: iio: Fix alignment warning
Hridesh MG [Wed, 18 Sep 2024 17:43:19 +0000 (23:13 +0530)]
staging: iio: Fix alignment warning

Reported by checkpatch:

CHECK: Alignment should match open parenthesis

Signed-off-by: Hridesh MG <hridesh699@gmail.com>
Acked-by: Steven Davis <goldside000@outlook.com>
Link: https://patch.msgid.link/20240918174320.614642-1-hridesh699@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: add support for AD7606C-{16,18} parts
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:43 +0000 (16:04 +0300)]
iio: adc: ad7606: add support for AD7606C-{16,18} parts

The AD7606C-16 and AD7606C-18 are pretty similar with the AD7606B.
The main difference between AD7606C-16 & AD7606C-18 is the precision in
bits (16 vs 18).
Because of that, some scales need to be defined for the 18-bit variants, as
they need to be computed against 2**18 (vs 2**16 for the 16 bit-variants).

Because the AD7606C-16,18 also supports bipolar & differential channels,
for SW-mode, the default range of 10 V or ±10V should be set at probe.
On reset, the default range (in the registers) is set to value 0x3 which
corresponds to '±10 V single-ended range', regardless of bipolar or
differential configuration.

Aside from the scale/ranges, the AD7606C-16 is similar to the AD7606B.

The AD7606C-18 variant offers 18-bit precision. Because of this, the
requirement to use this chip is that the SPI controller supports padding
of 18-bit sequences to 32-bit arrays.

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

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-9-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: adc: add docs for AD7606C-{16,18} parts
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:42 +0000 (16:04 +0300)]
dt-bindings: iio: adc: add docs for AD7606C-{16,18} parts

The driver will support the AD7606C-16 and AD7606C-18.
This change adds the compatible strings for these devices.

The AD7606C-16,18 channels also support these (individually configurable)
types of channels:
 - bipolar single-ended
 - unipolar single-ended
 - bipolar differential

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-8-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: adc: document diff-channels corner case for some ADCs
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:41 +0000 (16:04 +0300)]
dt-bindings: iio: adc: document diff-channels corner case for some ADCs

Some ADCs have channels with negative and positive inputs, which can be
used to measure differential voltage levels. These inputs/pins are
dedicated (to the given channel) and cannot be muxed as with other ADCs.

For those types of setups, the 'diff-channels' property can be specified to
be used with the channel number (or reg property) for both negative and
positive inputs/pins.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-7-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: rework available attributes for SW channels
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:40 +0000 (16:04 +0300)]
iio: adc: ad7606: rework available attributes for SW channels

For SW mode, the oversampling and scales attributes are always present.
So, they can be implemented via a 'read_avail' hook in iio_info.

For HW mode, it's a bit tricky, as these attributes get assigned based on
GPIO definitions.

So, for SW mode, we define a separate AD7606_SW_CHANNEL() macro, and use
that for the SW channels.
And 'ad7606_info_os_range_and_debug' can be renamed to
'ad7606_info_sw_mode' as it is only used for SW mode.

For the 'read_avail' hook, we'll need to allocate the SW scales, so that
they are just returned userspace without any extra processing.
The allocation will happen when then ad7606_state struct is allocated.
The oversampling available parameters don't need any extra processing; they
can just be passed back to userspace (as they are).

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-6-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: wrap channel ranges & scales into struct
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:39 +0000 (16:04 +0300)]
iio: adc: ad7606: wrap channel ranges & scales into struct

With the addition of AD7606C-16,18 which have differential & bipolar
channels (and ranges), which can vary from channel to channel, we'll need
to keep more information about each channel range.

To do that, we'll add a 'struct ad7606_chan_scale' type to hold just
configuration for each channel.
This includes the scales per channel (which can be different with
AD7606C-16,18), as well as the range for each channel.
This driver was already keeping the range value for each channel before,
and since this is couple with the scales, it also makes sense to put them
in the same struct.

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-5-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: move scale_setup as function pointer on chip-info
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:38 +0000 (16:04 +0300)]
iio: adc: ad7606: move scale_setup as function pointer on chip-info

Up until now, all ADCs were 16-bit precision.
With the addition of the AD7606C some things will change. For one thing,
we'll need to setup available-scales for each channel. Also for the 18-bit
precision variants, the scales will be different.

This change adds a function-pointer to the chip-info struct to be able to
set this up (differently) for the new parts. For the current parts, the
scales are the same (for all parts) between HW and SW modes.

Also creating a 'ad7606_sw_mode_setup()' function that must be called
before the scale_setup callback. This is needed in case SW mode is enabled
for some ADCs.

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-4-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: move 'val' pointer to ad7606_scan_direct()
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:37 +0000 (16:04 +0300)]
iio: adc: ad7606: move 'val' pointer to ad7606_scan_direct()

The ad7606_scan_direct() function returns 'int', which is fine for 16-bit
samples.
But when going to 18-bit samples, these need to be implemented as 32-bit
(or int) type.

In that case when getting samples (which can be negative), we'd get random
error codes.
So, the easiest thing is to just move the 'val' pointer to
'ad7606_scan_direct()'. This doesn't qualify as a fix, it's just a
preparation for 18-bit ADCs (of the AD7606 family).

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-3-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7606: add 'bits' parameter to channels macros
Alexandru Ardelean [Thu, 19 Sep 2024 13:04:36 +0000 (16:04 +0300)]
iio: adc: ad7606: add 'bits' parameter to channels macros

There are some newer additions to the AD7606 family, which support 18 bit
precision. Up until now, all chips were 16 bit.

This change adds a 'bits' parameter to the AD760X_CHANNEL macro and renames
'ad7606_channels' -> 'ad7606_channels_16bit' for the current devices.

The AD7606_SW_CHANNEL() macro is also introduced, as a short-hand for IIO
channels in SW mode.

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240919130444.2100447-2-aardelean@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: adc: amlogic,meson-saradc: also allow meson8-saradc to have amlogic...
Neil Armstrong [Wed, 11 Sep 2024 15:29:53 +0000 (17:29 +0200)]
dt-bindings: iio: adc: amlogic,meson-saradc: also allow meson8-saradc to have amlogic,hhi-sysctrl property

The SARADC on the Amlogic Meson8 SoC also requires the amlogic,hhi-sysctrl,
property, document it by adding the amlogic,meson8-saradc compatible in the
adequate allOf:if:compatible:contains:enums along meson8b and meson8m2.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240911-topic-amlogic-arm32-upstream-bindings-fixes-amlogic-hhi-sysctrl-v1-1-b8c3180b2fba@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: support the ad8460 Waveform DAC
Mariel Tinaco [Thu, 12 Sep 2024 09:54:35 +0000 (17:54 +0800)]
iio: dac: support the ad8460 Waveform DAC

The AD8460 is a “bits in, power out” high voltage, high-power,
high-speed driver optimized for large output current (up to ±1 A)
and high slew rate (up to ±1800 V/μs) at high voltage (up to ±40 V)
into capacitive loads.

A digital engine implements user-configurable features: modes for
digital input, programmable supply current, and fault monitoring
and programmable protection settings for output current,
output voltage, and junction temperature. The AD8460 operates on
high voltage dual supplies up to ±55 V and a single low voltage
supply of 5 V.

Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
Link: https://patch.msgid.link/20240912095435.18639-3-Mariel.Tinaco@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: dac: add docs for ad8460
Mariel Tinaco [Thu, 12 Sep 2024 09:54:34 +0000 (17:54 +0800)]
dt-bindings: iio: dac: add docs for ad8460

This adds the bindings documentation for the 14-bit
High Voltage, High Current, Waveform Generator
Digital-to-Analog converter.

Signed-off-by: Mariel Tinaco <Mariel.Tinaco@analog.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://patch.msgid.link/20240912095435.18639-2-Mariel.Tinaco@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: veml6030: make use of regmap_set_bits()
Javier Carrasco [Fri, 13 Sep 2024 13:18:59 +0000 (15:18 +0200)]
iio: light: veml6030: make use of regmap_set_bits()

Instead of using regmap_update_bits() and passing
val == 1 == VEML6030_ALS_SD, use regmap_set_bits().

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240913-veml6035-v1-4-0b09c0c90418@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: light: veml6030: rename to add manufacturer
Javier Carrasco [Fri, 13 Sep 2024 13:18:56 +0000 (15:18 +0200)]
dt-bindings: iio: light: veml6030: rename to add manufacturer

Follow the common pattern manufacturer,devicename.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20240913-veml6035-v1-1-0b09c0c90418@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: imu: kmx61: Drop most likely fake ACPI ID
Andy Shevchenko [Wed, 11 Sep 2024 21:31:10 +0000 (00:31 +0300)]
iio: imu: kmx61: Drop most likely fake ACPI ID

The commit in question does not proove that ACPI ID exists.
Quite likely it was a cargo cult addition while doint that
for DT-based enumeration.  Drop most likely fake ACPI ID.

Googling for KMX61021L gives no useful results in regard to DSDT.
Moreover, the official vendor ID in the registry for Kionix is KIOX.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patch.msgid.link/20240911213110.2893562-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: al3010: Fix an error handling path in al3010_probe()
Christophe JAILLET [Tue, 10 Sep 2024 18:36:06 +0000 (20:36 +0200)]
iio: light: al3010: Fix an error handling path in al3010_probe()

If i2c_smbus_write_byte_data() fails in al3010_init(),
al3010_set_pwr(false) is not called.

In order to avoid such a situation, move the devm_add_action_or_reset()
witch calls al3010_set_pwr(false) right after a successful
al3010_set_pwr(true).

Fixes: c36b5195ab70 ("iio: light: add Dyna-Image AL3010 driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/ee5d10a2dd2b70f29772d5df33774d3974a80f30.1725993353.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: proximity: vl53l0x-i2c: Added continuous mode support
Abhash Jha [Mon, 9 Sep 2024 10:15:07 +0000 (15:45 +0530)]
iio: proximity: vl53l0x-i2c: Added continuous mode support

The continuous mode of the sensor is enabled in the buffer_postenable.
Replaced the original irq handler with a threaded irq handler to perform
i2c reads during continuous mode.
The continuous mode is disabled by disabling the buffer.
Added a trigger for this device to be used for continuous mode.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240909101508.263085-3-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: proximity: vl53l0x-i2c: Added sensor ID check
Abhash Jha [Mon, 9 Sep 2024 10:15:06 +0000 (15:45 +0530)]
iio: proximity: vl53l0x-i2c: Added sensor ID check

The commit adds a check for the sensor's model ID. We read the model
identification register (0xC0) and expect a value of 0xEE.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240909101508.263085-2-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: imu: Add i2c driver for bmi270 imu
Alex Lanzano [Thu, 12 Sep 2024 21:07:19 +0000 (17:07 -0400)]
iio: imu: Add i2c driver for bmi270 imu

Add initial i2c support for the Bosch BMI270 6-axis IMU.
Provides raw read access to acceleration and angle velocity measurements
via iio channels. Device configuration requires firmware provided by
Bosch and is requested and load from userspace.

Signed-off-by: Alex Lanzano <lanzano.alex@gmail.com>
Link: https://patch.msgid.link/20240912210749.3080157-3-lanzano.alex@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: imu: add bmi270 bindings
Alex Lanzano [Thu, 12 Sep 2024 21:07:18 +0000 (17:07 -0400)]
dt-bindings: iio: imu: add bmi270 bindings

Add device tree bindings for the bmi270 IMU

Signed-off-by: Alex Lanzano <lanzano.alex@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240912210749.3080157-2-lanzano.alex@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: iio: temperature: tmp006: document interrupt
Antoni Pokusinski [Sun, 8 Sep 2024 17:21:55 +0000 (19:21 +0200)]
dt-bindings: iio: temperature: tmp006: document interrupt

TMP006 sensor has a DRDY (data ready) active-low interrupt which
indicates that a new measurement is ready to be read.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240908172153.177406-3-apokusinski01@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: temperature: tmp006: add triggered buffer support
Antoni Pokusinski [Sun, 8 Sep 2024 17:21:53 +0000 (19:21 +0200)]
iio: temperature: tmp006: add triggered buffer support

Add support for continuous data capture using triggered buffers for the
tmp006 sensor. The device features a "data ready" interrupt line which
is pulled down once a new measurement is ready to be read.

Signed-off-by: Antoni Pokusinski <apokusinski01@gmail.com>
Link: https://patch.msgid.link/20240908172153.177406-2-apokusinski01@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7173: add support for ad4113
Dumitru Ceclan [Mon, 12 Aug 2024 08:13:16 +0000 (11:13 +0300)]
iio: adc: ad7173: add support for ad4113

This commit adds support for the AD4113 ADC.
The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital
converter (ADC) that integrates an analog front end (AFE) for four
fully differential or eight single-ended inputs.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Link: https://patch.msgid.link/20240812-ad4113-v3-3-046e785dd253@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7173: order chipID by value
Dumitru Ceclan [Mon, 12 Aug 2024 08:13:15 +0000 (11:13 +0300)]
iio: adc: ad7173: order chipID by value

The chipIDs defines were supposed to be ordered by value, one was out of
order. Fix the order.

Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Link: https://patch.msgid.link/20240812-ad4113-v3-2-046e785dd253@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agodt-bindings: adc: ad7173: add support for ad4113
Dumitru Ceclan [Mon, 12 Aug 2024 08:13:14 +0000 (11:13 +0300)]
dt-bindings: adc: ad7173: add support for ad4113

This commit adds bindings support for AD4113.

The AD4113 is a low power, low noise, 16-bit, Σ-Δ analog-to-digital
converter (ADC) that integrates an analog front end (AFE) for four
fully differential or eight single-ended inputs.

Added ad4113 to the compatible list and the "avdd2-supply: false"
restriction.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Link: https://patch.msgid.link/20240812-ad4113-v3-1-046e785dd253@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: Convert to IIO_MAP()
Christophe JAILLET [Sat, 7 Sep 2024 17:24:47 +0000 (19:24 +0200)]
iio: adc: Convert to IIO_MAP()

Use IIO_MAP() instead of hand-writing it. It is much less verbose.

The change has been do with the following coccinelle script:

@@
identifier STRUCT_NAME;
constant NAME, CHANNEL, LABEL;
@@

static const struct iio_map STRUCT_NAME[] = {
...,
- {
- .consumer_dev_name = NAME,
- .consumer_channel = CHANNEL,
- .adc_channel_label = LABEL,
- },
+ IIO_MAP(LABEL, NAME, CHANNEL),
...
};

@@
identifier STRUCT_NAME;
constant NAME, LABEL;
@@

static const struct iio_map STRUCT_NAME[] = {
...,
- {
- .consumer_dev_name = NAME,
- .adc_channel_label = LABEL,
- },
+ IIO_MAP(LABEL, NAME, NULL),
...
};

--
Compile tested only

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/48f08224fab5a7595f650dbcef012d7cac3f972b.1725729801.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: Constify struct iio_map
Christophe JAILLET [Sat, 7 Sep 2024 17:24:46 +0000 (19:24 +0200)]
iio: adc: Constify struct iio_map

'struct iio_map' are not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do it, the prototype of iio_map_array_register() and
devm_iio_map_array_register(), and a few structures that hold a
"struct iio_map *" need to be adjusted.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  21086     760       0   21846    5556 drivers/iio/adc/axp20x_adc.o

After:
=====
   text    data     bss     dec     hex filename
  21470     360       0   21830    5546 drivers/iio/adc/axp20x_adc.o
  33842    1697     384   35923    8c53 drivers/iio/addac/ad74413r.o

--
Compile tested only

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/5729dc3cc3892ecf0d8ea28c5f7307b34e27493e.1725729801.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: imu: inv_mpu6050: Use upper_16_bits()/lower_16_bits() helpers
Andy Shevchenko [Wed, 4 Sep 2024 18:45:43 +0000 (21:45 +0300)]
iio: imu: inv_mpu6050: Use upper_16_bits()/lower_16_bits() helpers

Use upper_16_bits()/lower_16_bits() helpers instead of open-coding them.
This is easier to scan quickly compared to bitwise manipulation, and
it is pleasingly symmetric.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20240904184543.1219866-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: cm32181: Remove duplicate ACPI handle check
Andy Shevchenko [Wed, 4 Sep 2024 18:36:46 +0000 (21:36 +0300)]
iio: light: cm32181: Remove duplicate ACPI handle check

cm32181_acpi_parse_cpm_tables() is a no-op if ACPI handle
is not available. Remove duplicate ACPI handle check at
the caller side.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240904183646.1219485-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: bmp280: Remove config error check for IIR filter updates
Vasileios Amoiridis [Mon, 2 Sep 2024 18:42:18 +0000 (20:42 +0200)]
iio: pressure: bmp280: Remove config error check for IIR filter updates

When there is a change in the configuration of the BMP3xx device, several
steps take place. These steps include:

1) Update the OSR settings and check if there was an update
2) Update the ODR settings and check if there was an update
3) Update the IIR settings and check if there was an update
4) Check if there was an update with the following procedure:
a) Set sensor to SLEEP mode and after to NORMAL mode to trigger
   a new measurement.
b) Wait the maximum amount possible depending on the OSR settings
c) Check the configuration error register if there was an error
   during the configuration of the sensor.

This check is necessary, because there could be a case where the OSR is
too high for the requested ODR so either the ODR needs to be slower or the
OSR needs to be less. This is something that is checked internally by the
sensor when it runs in NORMAL mode.

In the BMP58x devices the previous steps are done internally by the sensor.

The IIR filter settings do not depend on the OSR or ODR settings, and there
is no need to run a check in case they change.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20240902184222.24874-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: bmp280: Add support for bmp280 soft reset
Vasileios Amoiridis [Mon, 2 Sep 2024 18:42:17 +0000 (20:42 +0200)]
iio: pressure: bmp280: Add support for bmp280 soft reset

The BM(P/E)28x devices have an option for soft reset which is also
recommended by the Bosch Sensortech BME2 Sensor API to be used before the
initial configuration of the device.

Link: https://github.com/boschsensortec/BME280_SensorAPI/blob/bme280_v3.5.1/bme280.c#L429
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20240902184222.24874-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: bmp280: Use bulk read for humidity calibration data
Vasileios Amoiridis [Mon, 2 Sep 2024 18:42:16 +0000 (20:42 +0200)]
iio: pressure: bmp280: Use bulk read for humidity calibration data

Convert individual reads to a bulk read for the humidity calibration data.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20240902184222.24874-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: event_monitor: Fix missing free in main
zhang jiao [Wed, 4 Sep 2024 08:05:33 +0000 (16:05 +0800)]
iio: event_monitor: Fix missing free in main

Free string allocated by asprintf().

Signed-off-by: zhang jiao <zhangjiao2@cmss.chinamobile.com>
Link: https://patch.msgid.link/20240904080533.104279-1-zhangjiao2@cmss.chinamobile.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: pressure: hid-sensor-press: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:07 +0000 (01:17 +0300)]
iio: pressure: hid-sensor-press: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-23-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: position: hid-sensor-custom-intel-hinge: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:06 +0000 (01:17 +0300)]
iio: position: hid-sensor-custom-intel-hinge: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-22-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: orientation: hid-sensor-rotation: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:05 +0000 (01:17 +0300)]
iio: orientation: hid-sensor-rotation: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-21-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: orientation: hid-sensor-incl-3d: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:04 +0000 (01:17 +0300)]
iio: orientation: hid-sensor-incl-3d: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-20-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: magnetometer: hid-sensor-magn-3d: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:03 +0000 (01:17 +0300)]
iio: magnetometer: hid-sensor-magn-3d: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-19-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: lm3533-als: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:02 +0000 (01:17 +0300)]
iio: light: lm3533-als: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20240902222824.1145571-18-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: hid-sensor-prox: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:01 +0000 (01:17 +0300)]
iio: light: hid-sensor-prox: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-17-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: light: hid-sensor-als: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:17:00 +0000 (01:17 +0300)]
iio: light: hid-sensor-als: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-16-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:59 +0000 (01:16 +0300)]
iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-15-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: gyro: hid-sensor-gyro-3d: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:58 +0000 (01:16 +0300)]
iio: gyro: hid-sensor-gyro-3d: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-14-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: frequency: adf4350: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:57 +0000 (01:16 +0300)]
iio: frequency: adf4350: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-13-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: frequency: ad9523: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:56 +0000 (01:16 +0300)]
iio: frequency: ad9523: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-12-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: max517: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:55 +0000 (01:16 +0300)]
iio: dac: max517: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-11-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: m62332: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:54 +0000 (01:16 +0300)]
iio: dac: m62332: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-10-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: ad5791: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:53 +0000 (01:16 +0300)]
iio: dac: ad5791: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-9-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: dac: ad5504: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:52 +0000 (01:16 +0300)]
iio: dac: ad5504: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-8-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ltc2497: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:51 +0000 (01:16 +0300)]
iio: adc: ltc2497: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

While at it, drop duplicate NULL check that iio_map_array_register()
already has.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-7-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7793: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:50 +0000 (01:16 +0300)]
iio: adc: ad7793: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-6-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7887: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:49 +0000 (01:16 +0300)]
iio: adc: ad7887: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-5-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7791: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:48 +0000 (01:16 +0300)]
iio: adc: ad7791: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-4-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: adc: ad7266: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:47 +0000 (01:16 +0300)]
iio: adc: ad7266: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-3-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
9 months agoiio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata()
Andy Shevchenko [Mon, 2 Sep 2024 22:16:46 +0000 (01:16 +0300)]
iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-2-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>