Commit Graph

7819 Commits

Author SHA1 Message Date
Greg Kroah-Hartman
895b4fae93 Merge 6.11-rc7 into char-misc-next
We need the char-misc fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-09 08:36:23 +02:00
Chris Morgan
5ba0cb9258 iio: adc: axp20x_adc: add support for AXP717 ADC
Add support for the AXP717 ADC. The AXP717 differs from other ADCs
in this series by utilizing a 14 bit ADC for all channels (a full 16
bits with the first 2 digits reserved). It also differs by lacking a
battery discharge current channel.

Note that while the current charge channel itself is included in this
driver for the AXP717 and listed in the datasheet, no scale or offset
was given for this channel. For now no scale or offset is provided in
this driver.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://patch.msgid.link/20240821215456.962564-13-macroalpha82@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-07 14:28:37 +01:00
Chris Morgan
c7ac44751d iio: adc: axp20x_adc: Add adc_en1 and adc_en2 to axp_data
Add the register for adc_en1 and adc_en2 to the axp_data struct. This
allows us to specify a different register to enable the adc channels
for different devices such as the AXP717.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240821215456.962564-2-macroalpha82@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-07 14:27:32 +01:00
Jonathan Cameron
09e3bdfe49 iio: adc: standardize on formatting for id match tables
This is a frequent minor comment in reviews, so start cleaning up
existing drivers in the hope we get fewer cases of cut and paste.

There are not kernel wide rules for these, but for IIO the style
that I prefer (and hence most common) is:

- Space after { and before }
- No comma after terminator { }

This may cause merge conflicts but they should be trivial to resolve
hence I have not broken this into per driver patches.

Link: https://patch.msgid.link/20240818180912.719399-1-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-05 19:27:13 +01:00
shuaijie wang
07b241262d iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor
AW96103 is a low power consumption capacitive touch and proximity controller.
Each channel can be independently config as sensor input, shield output.

Channel Information:
  aw96103: 3-channel
  aw96105: 5-channel

Signed-off-by: shuaijie wang <wangshuaijie@awinic.com>
Link: https://patch.msgid.link/20240827080229.1431784-3-wangshuaijie@awinic.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-05 19:27:06 +01:00
Thomas Bonnefille
d1022ff5f9 iio: adc: sophgo-saradc: Add driver for Sophgo CV1800B SARADC
This adds a driver for the Sophgo CV1800B SARADC.

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
Link: https://patch.msgid.link/20240829-sg2002-adc-v5-2-aacb381e869b@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 20:05:03 +01:00
Andy Shevchenko
da83fd152e iio: imu: st_lsm6dsx: Remove useless dev_fwnode() calls
The device property APIs designed that way that they will return an error when
there is no valid fwnode provided. Moreover, the check for NULL of dev_fwnode()
is not fully correct as in some (currently rare) cases it may contain an error
pointer. This is not a problem anyway (see keyword 'valid' above) that's why
the code works properly even without this change.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240826212344.866928-3-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:44 +01:00
Andy Shevchenko
17601ab9d7 iio: imu: st_lsm6dsx: Use iio_read_acpi_mount_matrix() helper
Replace the duplicate ACPI "ROTM" data parsing code with the new
shared iio_read_acpi_mount_matrix() helper.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240826212344.866928-2-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:44 +01:00
Rob Herring (Arm)
2f1dddc922 iio: adc: mcp320x: Drop vendorless compatible strings
The vendorless compatible strings are deprecated and weren't retained
when the binding was converted to schema. As a result, they are listed
as undocumented when running "make dt_compatible_check". Rather than add
them back to the schema, let's just drop them as they are unnecessary.
Furthermore, they are unnecessary as the SPI matching will strip the
vendor prefix on compatible string and match that against the
spi_device_id table.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240826191728.1415189-1-robh@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:44 +01:00
Bartosz Golaszewski
631598c419 iio: dac: ad5449: drop support for platform data
There are no longer any users of the platform data struct. Remove
support for it from the driver.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://patch.msgid.link/20240814092629.9862-1-brgl@bgdev.pl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:44 +01:00
Javier Carrasco
31c022a4f4 iio: adc: xilinx-ams: use device_* to iterate over device child nodes
Use `device_for_each_child_node_scoped()` in `ams_parse_firmware()`
to explicitly state device child node access, and simplify the child
node handling as it is not required outside the loop.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Link: https://patch.msgid.link/20240820-device_child_node_access-v3-1-1ee09bdedb9e@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:44 +01:00
David Lechner
7763e40f35 iio: adc: ad4695: implement calibration support
The AD4695 has a calibration feature that allows the user to compensate
for variations in the analog front end. This implements this feature in
the driver using the standard `calibgain` and `calibbias` attributes.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240820-ad4695-gain-offset-v1-2-c8f6e3b47551@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
David Lechner
2ba49fc41b iio: adc: ad4695: add 2nd regmap for 16-bit registers
The AD4695 and similar chips have some multibyte registers that have
to be read/written in a single operation. So we need to add a 2nd regmap
for these registers.

These registers are removed from the 8-bit regmap allowable ranges and
AD4695_MAX_REG is dropped since it would be ambiguous now.

debugfs register access is also updated to automatically use the correct
regmap depending on the register address.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240820-ad4695-gain-offset-v1-1-c8f6e3b47551@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Denis Benato
16531118ba iio: bmi323: peripheral in lowest power state on suspend
The bmi323 is mounted on some devices that are powered
by an internal battery: help in reducing system overall power drain
while the system is in s2idle or the imu driver is not loaded
by resetting it in its lowest power draining state.

Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Link: https://patch.msgid.link/20240824141122.334620-2-benato.denis96@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Andy Shevchenko
525e9cd5ac iio: accel: bmc150: Improve bmc150_apply_bosc0200_acpi_orientation()
By using ACPI_HANDLE() the handler argument can be retrieved directly.
Replace ACPI_COMPANION() + dereference with ACPI_HANDLE().

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240823230107.745900-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Andy Shevchenko
3f131813d7 iio: accel: bmc150: use fwnode_irq_get_byname()
Use the generic fwnode_irq_get_byname() in place of of_irq_get_byname()
to get the IRQ number from the interrupt pin.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240823230056.745872-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Andy Shevchenko
dae65fc2bc iio: proximity: cros_ec_mkbp_proximity: Switch to including mod_devicetable.h for struct of_device_id definition
of.h was only included for this definition, so include the correct header
instead.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240823220718.743596-1-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Danila Tikhonov
89cf93bfb3 iio: magnetometer: ak8975: Add AK09118 support
Add additional AK09118 to the magnetometer driver which has the same
register mapping and scaling as the AK09112 device.

Signed-off-by: Danila Tikhonov <danila@jiaxyga.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://patch.msgid.link/20240819-ak09918-v4-4-f0734d14cfb9@mainlining.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Barnabás Czémán
129464e86c iio: magnetometer: ak8975: Fix reading for ak099xx sensors
Move ST2 reading with overflow handling after measurement data
reading.
ST2 register read have to be read after read measurment data,
because it means end of the reading and realease the lock on the data.
Remove ST2 read skip on interrupt based waiting because ST2 required to
be read out at and of the axis read.

Fixes: 57e73a423b ("iio: ak8975: add ak09911 and ak09912 support")
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://patch.msgid.link/20240819-ak09918-v4-2-f0734d14cfb9@mainlining.org
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:43 +01:00
Barnabás Czémán
3b92fc43bf iio: magnetometer: ak8975: Relax failure on unknown id
Relax failure when driver gets an unknown device id for
allow probe for register compatible devices.

Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
Link: https://patch.msgid.link/20240819-ak09918-v4-1-f0734d14cfb9@mainlining.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-09-03 18:49:42 +01:00
Yang Ruibin
c4b43d8336 drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
The debugfs_create_dir() function returns error pointers.
It never returns NULL. So use IS_ERR() to check it.

Signed-off-by: Yang Ruibin <11162571@vivo.com>
Link: https://patch.msgid.link/20240821083911.3411-1-11162571@vivo.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-21 21:32:52 +01:00
Andreas Klinger
d35099d3c6 iio: sgp40: retain documentation in driver
Retain documentation on how the voc index is actually calculated in
driver code as it'll be removed in Documentation.

This is a follow up on patch "[PATCH] iio: ABI: remove duplicate
in_resistance_calibbias" from David.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Link: https://patch.msgid.link/ZsWdFOIkDtEB9WGO@mail.your-server.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-21 21:28:02 +01:00
Abhash Jha
4bd7e5ce51 iio: light: ltr390: Calculate 'counts_per_uvi' dynamically
counts_per_uvi depends on the current value of gain and resolution.
Hence, we cannot use the hardcoded value 96.
The `counts_per_uvi` function gives the count based on the current gain
and resolution (integration time).

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240814113135.14575-3-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:38:14 +01:00
Abhash Jha
14e0d914a8 iio: light: ltr390: Add ALS channel and support for gain and resolution
Add new ALS channel and allow reading lux and scale values.
Also provide gain and resolution configuration for ALS channel.
Add automatic mode switching between the UVS and ALS channel
based on which channel is being accessed.
The default mode in which the sensor start is ALS mode.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240814113135.14575-2-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:38:14 +01:00
David Lechner
6cc7e4bf2e iio: adc: ad4695: implement triggered buffer
This implements buffered reads for the ad4695 driver using the typical
triggered buffer implementation, including adding a soft timestamp
channel.

The chip has 4 different modes for doing conversions. The driver is
using the advanced sequencer mode since that is the only mode that
allows individual configuration of all aspects each channel (e.g.
bipolar config currently and oversampling to be added in the future).

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20240813-iio-adc-ad4695-buffered-read-v2-1-9bb19fc1924b@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:37:37 +01:00
Dan Carpenter
d3bde2243d iio: proximity: hx9023s: Fix error code in hx9023s_property_get()
If we're returning because "reg >= HX9023S_CH_NUM" then set the error code
to -ENIVAL instead of success.

Fixes: 60df548277 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/49b5a9bc-e5ca-43a7-a665-313eb06fbe27@stanley.mountain
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:37:37 +01:00
Marek Vasut
076c4d18de iio: light: noa1305: Fix up integration time look up
The current code is always iterating over two fields in the
noa1305_int_time_available array. Fix iteration limit, which
has to be halved to avoid out of bounds access in case the
value that is being looked up is not in the array.

Fixes: 025f23cfeb ("iio: light: noa1305: Make integration time configurable")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://patch.msgid.link/20240814191946.81386-1-marex@denx.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:37:37 +01:00
Joshua Felmeden
c524fbca67 iio: humidity: Add support for ENS210
Add support for ENS210/ENS210A/ENS211/ENS212/ENS213A/ENS215.

The ENS21x is a family of temperature and relative humidity sensors with
accuracies tailored to the needs of specific applications.

Signed-off-by: Joshua Felmeden <jfelmeden@thegoodpenguin.co.uk>
Link: https://patch.msgid.link/20240805-ens21x-v6-2-5bb576ef26a6@thegoodpenguin.co.uk
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:37:37 +01:00
Jean-Baptiste Maneyrol
0a3b517c80 iio: imu: inv_mpu6050: fix interrupt status read for old buggy chips
Interrupt status read seems to be broken on some old MPU-6050 like
chips. Fix by reverting to previous driver behavior bypassing interrupt
status read. This is working because these chips are not supporting
WoM and data ready is the only interrupt source.

Fixes: 5537f653d9 ("iio: imu: inv_mpu6050: add new interrupt handler for WoM events")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Tested-by: Svyatoslav Ryhel <clamor95@gmail.com> # LG P895
Tested-by: Andreas Westman Dorcsak <hedmoo@yahoo.com> # LG P880
Link: https://patch.msgid.link/20240814143735.327302-1-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 15:31:41 +01:00
Dumitru Ceclan
f242967f4d iio: adc: ad7173: fix GPIO device info
Models AD4114/5/6 have .higher_gpio_bits = true. This is not correct as
the only models that have the GPIO bits to a higher position are AD4111/2.

Fix by removing the higher_gpio_bits = true from the AD4114/5/6 models.

Fixes: 13d12e3ad1 ("iio: adc: ad7173: Add support for AD411x devices")
Signed-off-by: Dumitru Ceclan <dumitru.ceclan@analog.com>
Link: https://patch.msgid.link/20240809134909.26829-1-dumitru.ceclan@analog.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-17 11:20:02 +01:00
Nuno Sa
7a8b585d4a iio: imu: adis16460: drop ifdef around CONFIG_DEBUG_FS
Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present.
Since this is known at compile time, it allows the compiler to drop any
unused code. Therefore no need to wrap the code with #ifdef.

While at it make adis16460_debugfs_init() void as the return code is
ignored.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-4-d3adb6996518@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:39:57 +01:00
Nuno Sa
7d6c97ba52 iio: imu: adis16400: drop ifdef around CONFIG_DEBUG_FS
Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present.
Since this is known at compile time, it allows the compiler to drop any
unused code. Therefore no need to wrap the code with #ifdef.

While at it make adis16400_debugfs_init() void as the return code is
ignored.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-3-d3adb6996518@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:39:57 +01:00
Nuno Sa
7f5d956d3f iio: imu: adis16480: drop ifdef around CONFIG_DEBUG_FS
Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present.
Since this is known at compile time, it allows the compiler to drop any
unused code. Therefore no need to wrap the code with #ifdef.

While at it make adis16480_debugfs_init() void as the return code is
ignored.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-2-d3adb6996518@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:39:57 +01:00
Nuno Sa
cec920f67e iio: imu: adis16475: drop ifdef around CONFIG_DEBUG_FS
Use IS_ENABLED(CONFIG_DEBUG_FS) to return early in case debugfs is not
present. Since this is known at compile time, it allows the compiler to
drop any unused code. Therefore no need to wrap the code with #ifdef.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-1-d3adb6996518@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:39:57 +01:00
Dan Carpenter
c5d2291a30 iio: adc: pac1921: add missing error return in probe()
This error path was intended to return, and not just print an error.  The
current code will lead to an error pointer dereference.

Fixes: 371f778b83 ("iio: adc: add support for pac1921")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/1fa4ab12-0939-477d-bc92-306fd32e4fd9@stanley.mountain
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:34:27 +01:00
Colin Ian King
f2271ba6f0 iio: Fix spelling mistake "avaialable" -> "available"
There is a spelling mistake in a dev_warn message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://patch.msgid.link/20240807094745.4174785-1-colin.i.king@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:23:39 +01:00
Dan Carpenter
4f6ca3464d iio: dac: ltc2664: Fix off by one in ltc2664_channel_config()
This comparison should be >= ARRAY_SIZE() instead of >.  The "mspan"
variable is later used as an array index into ltc2664_mspan_lut[] so
this is an off by one bug.

Fixes: 4cc2fc445d ("iio: dac: ltc2664: Add driver for LTC2664 and LTC2672")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/5727ab54-6280-466e-b107-1b6006e5ab29@stanley.mountain
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:22:11 +01:00
Denis Benato
b09999ee1e iio: bmi323: suspend and resume triggering on relevant pm operations
Prevent triggers from stop working after the device has entered sleep:
use iio_device_suspend_triggering and iio_device_resume_triggering helpers.

Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Link: https://patch.msgid.link/20240807185619.7261-3-benato.denis96@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:19:36 +01:00
Denis Benato
2837efdc7c iio: trigger: allow devices to suspend/resume theirs associated trigger
When a machine enters a sleep state while a trigger is associated to
an iio device that trigger is not resumed after exiting the sleep state:
provide iio device drivers a way to suspend and resume
the associated trigger to solve the aforementioned bug.

Each iio driver supporting external triggers is expected to call
iio_device_suspend_triggering before suspending,
and iio_device_resume_triggering upon resuming.

Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Link: https://patch.msgid.link/20240807185619.7261-2-benato.denis96@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:19:36 +01:00
Abhash Jha
06e91ad344 iio: light: apds9960: Add proximity and gesture offset calibration
Proximity and gesture offset registers perform offset correction to
improve cross-talk performance. Added `calibbias` to the proximity
and gesture channels.
Provided facility to set calibbias based on the channel number.

Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>
Link: https://patch.msgid.link/20240804134212.51682-2-abhashkumarjha123@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:35 +01:00
Olivier Moysan
6fc839dc32 iio: adc: stm32-dfsdm: add scaling support to dfsdm
Add scaling support to STM32 DFSDM.

When used in an analog context, a DFSDM filter typically converts the data
from a sigma delta modulator. The IIO device associated to the DFSDM
filter provides these data as raw data.
The IIO device can provide scaling information (voltage and offset) to
allow conversion of raw data into physical values.

With the new binding based on IIO backend framework, the sigma delta
modulators are defined as backends providing scaling information.

The scaling is not supported with legacy binding.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240730084640.1307938-10-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Olivier Moysan
bd71b6d0ba iio: add iio backend support to sd modulator
The legacy sd modulator driver registers the sigma delta modulator as
an IIO channel provider. This implementation is not convenient when the
SD modulator has to be cascaded with another IIO device. The scaling
information is distributed across devices, which makes it difficult to
report consistent scaling data on IIO devices.

The solution is to expose these cascaded IIO devices as an aggregate
device, which report global scaling information.
Add IIO backend support to SD modulator to allow scaling information
management.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20240730084640.1307938-9-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Olivier Moysan
3208fa0cd9 iio: adc: stm32-dfsdm: adopt generic channels bindings
Move to generic channels binding to ease new backend framework adoption
and prepare the convergence with MDF IP support on STM32MP2 SoC family.

Legacy binding:
DFSDM is an IIO channel consumer.
SD modulator is an IIO channels provider.
The channel phandles are provided in DT through io-channels property
and channel indexes through st,adc-channels property.

New binding:
DFSDM is an IIO channel provider.
The channel indexes are given by reg property in channel child node.

This new binding is intended to be used with SD modulator IIO backends.
It does not support SD modulator legacy IIO devices.
The st,adc-channels property presence is used to discriminate
between legacy and backend bindings.

The support of the DFSDM legacy channels and SD modulator IIO devices
is kept for backward compatibility.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20240730084640.1307938-8-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Olivier Moysan
c464cc610f iio: add child nodes support in iio backend framework
Add an API to support IIO generic channels binding:
http://devicetree.org/schemas/iio/adc/adc.yaml#
This new API is needed, as generic channel DT node isn't populated as a
device.
Add devm_iio_backend_fwnode_get() to allow an IIO device backend
consumer to reference backend phandles in its child nodes.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240730084640.1307938-4-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Olivier Moysan
2530d7d44c iio: add enable and disable services to iio backend framework
Add iio_backend_disable() and iio_backend_enable() APIs to allow
IIO backend consumer to request backend disabling and enabling.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240730084640.1307938-3-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Olivier Moysan
0737158aab iio: add read scale and offset services to iio backend framework
Add iio_backend_read_scale() and iio_backend_read_offset() services
to read channel scale and offset from an IIO backbend device.

Also add a read_raw callback which replicates the read_raw callback of
the IIO framework, and is intended to request miscellaneous channel
attributes from the backend device.
Both scale and offset helpers use this callback.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240730084640.1307938-2-olivier.moysan@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Krzysztof Kozlowski
da6e3160df iio: magnetometer: ak8975: drop incorrect AK09116 compatible
All compatibles in this binding without prefixes were deprecated, so
adding a new deprecated one after some time is not allowed, because it
defies the core logic of deprecating things.

Drop the AK09916 vendorless compatible.

Fixes: 76e28aa97f ("iio: magnetometer: ak8975: add AK09116 support")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240806053016.6401-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:34 +01:00
Nuno Sa
69eac4e1e2 iio: dac: ad9739a: add backend debugfs interface
Call iio_backend_debugfs_add() to add (if available) the backend debug
interface.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240806-dev-backend-dac-direct-reg-access-v1-2-b84a6e8ee8a0@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:33 +01:00
Nuno Sa
24a9453c03 iio: dac: adi-axi-dac: support debugfs direct_reg_access
Make it possible to read/write registers on the backend using the
debugfs interface for it.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240806-dev-backend-dac-direct-reg-access-v1-1-b84a6e8ee8a0@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:33 +01:00
Matteo Martelli
1e2ae3ce23 iio: remove unneeded assignment in __iio_format_value
Trivial cleanup in __iio_format_value() for the IIO_VAL_FRACTIONAL case
where tmp1 = vals[1] assignment is unneeded and irrelevant since tmp1 is
immediately overwritten by the subsequent div_s64_rem() call.

Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/20240730-iio-clean-fmt-value-v1-1-3e1c3deafc33@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-08-10 11:17:33 +01:00