linux-2.6-microblaze.git
7 months agoiio: chemical: bme680: Add SCALE and RAW channels
Vasileios Amoiridis [Sat, 2 Nov 2024 13:13:06 +0000 (14:13 +0100)]
iio: chemical: bme680: Add SCALE and RAW channels

Add SCALE,RAW channels to the device. Even though PROCESSED should be
kept for backwards compatibility add comment to avoid using it if the
value is not actually reported in IIO values.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: refactorize set_mode() mode
Vasileios Amoiridis [Sat, 2 Nov 2024 13:13:05 +0000 (14:13 +0100)]
iio: chemical: bme680: refactorize set_mode() mode

Refactorize the set_mode() function to use an external enum that
describes the possible modes of the BME680 device instead of using
true/false variables for selecting SLEEPING/FORCED mode.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241102131311.36210-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: events: make IIO_EVENT_CODE macro private
David Lechner [Fri, 1 Nov 2024 22:17:10 +0000 (17:17 -0500)]
iio: events: make IIO_EVENT_CODE macro private

Make IIO_EVENT_CODE "private" by adding a leading underscore.

There are no more users of this macro in the kernel so we can make it
"private" and encourage developers to use the specialized versions of
the macro instead.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-3-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: mma9553: use specialized event code macros
David Lechner [Fri, 1 Nov 2024 22:17:09 +0000 (17:17 -0500)]
iio: accel: mma9553: use specialized event code macros

Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-2-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dummy: use specialized event code macros
David Lechner [Fri, 1 Nov 2024 22:17:08 +0000 (17:17 -0500)]
iio: dummy: use specialized event code macros

Simplify the code by using IIO_UNMOD_EVENT_CODE and IIO_MOD_EVENT_CODE
instead of IIO_EVENT_CODE.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241101-iio-fix-event-macro-use-v1-1-0000c5d09f6d@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper
Julien Stephan [Mon, 28 Oct 2024 16:38:12 +0000 (17:38 +0100)]
iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper

The IIO_DIFF_EVENT_CODE macro helper was introduced to provide a more
specific alternative to the generic IIO_EVENT_CODE macro for handling
differential channels. This commit updates the code to use
IIO_DIFF_EVENT_CODE for better clarity and maintainability.

However, the current implementation incorrectly sets both chan1 and
chan2 to 0. To maintain compatibility and avoid breaking existing
user space applications, this behavior is preserved for now.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-2-b452c90f7ea6@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: events.h: add event identifier macros for differential channel
Julien Stephan [Mon, 28 Oct 2024 16:38:11 +0000 (17:38 +0100)]
iio: events.h: add event identifier macros for differential channel

Currently, there are 3 helper macros in iio/events.h to create event
identifiers:
- IIO_EVENT_CODE : create generic event identifier for differential and non
  differential channels
- IIO_MOD_EVENT_CODE : create event identifier for modified (non
  differential) channels
- IIO_UNMOD_EVENT_CODE : create event identifier for unmodified (non
  differential) channels

For differential channels, drivers are expected to use IIO_EVENT_CODE.
However, only one driver in drivers/iio currently uses it correctly,
leading to inconsistent event identifiers for differential channels that
don’t match the intended attributes (such as max1363.c that supports
differential channels, but only uses IIO_UNMOD_EVENT_CODE).

To prevent such issues in future drivers, a new helper macro,
IIO_DIFF_EVENT_CODE, is introduced to specifically create event identifiers
for differential channels. Only one helper is needed for differential
channels since they cannot have modifiers.

Additionally, the descriptions for IIO_MOD_EVENT_CODE and
IIO_UNMOD_EVENT_CODE have been updated to clarify that they are intended
for non-differential channels,

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-iio-add-macro-for-even-identifier-for-differential-channels-v1-1-b452c90f7ea6@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver
Neil Armstrong [Wed, 30 Oct 2024 15:30:24 +0000 (16:30 +0100)]
iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver

The Allegro MicroSystems ALS31300 is a 3-D Linear Hall Effect Sensor
mainly used for 3D head-on motion sensing applications.

The device is configured over I2C, and as part of the Sensor data the
temperature core is also provided.

While the device provides an IRQ gpio, it depends on a configuration
programmed into the internal EEPROM, thus only the default mode is
supported and buffered input via trigger is also supported to allow
streaming values with the same sensing timestamp.

The device can be configured with different sensitivities in factory,
but the sensitivity value used to calculate value into the Gauss
unit is not available from registers, thus the sensitivity is provided
by the compatible/device-id string which is based on the part number
as described in the datasheet page 2.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-3-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear...
Neil Armstrong [Wed, 30 Oct 2024 15:30:23 +0000 (16:30 +0100)]
dt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor

Document the bindings for the Allegro MicroSystems ALS31300 3-D Linear
Hall Effect Sensor controller by an I2C interface, mainly used in 3D
head-on motion sensing applications.

The device can be configured with different sensitivities in factory,
but the sensitivity value used to calculate value into the Gauss unit
is not available from registers, thus the sensitivity is provided by
the compatible/device-id string which is based on the part number as
described in the datasheet page 2.

Datasheet: https://www.allegromicro.com/-/media/files/datasheets/als31300-datasheet.pdf
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-2-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc
Neil Armstrong [Wed, 30 Oct 2024 15:30:22 +0000 (16:30 +0100)]
dt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc

Link: https://www.allegromicro.com/en/about-allegro
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20241030-topic-input-upstream-als31300-v4-1-494297c9e50a@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: apds9960: remove useless return
Julien Stephan [Thu, 31 Oct 2024 15:27:10 +0000 (16:27 +0100)]
iio: light: apds9960: remove useless return

return 0 statement at the end of apds9960_read_event_config is useless.
Remove it.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-15-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: apds9960: convert als_int and pxs_int to bool
Julien Stephan [Thu, 31 Oct 2024 15:27:09 +0000 (16:27 +0100)]
iio: light: apds9960: convert als_int and pxs_int to bool

Since the write_event_config callback now uses a bool for the state
parameter, update type of als_int and pxs_int to bool.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-14-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: apds9306: simplifies if branch in apds9306_write_event_config
Julien Stephan [Thu, 31 Oct 2024 15:27:08 +0000 (16:27 +0100)]
iio: light: apds9306: simplifies if branch in apds9306_write_event_config

Simplifies the regmap_wite if branch in apds9306_write_event_config.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-13-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: apds9300: use bool for event state
Julien Stephan [Thu, 31 Oct 2024 15:27:07 +0000 (16:27 +0100)]
iio: light: apds9300: use bool for event state

Since the write_event_config callback now uses a bool for the state
parameter, update apds9300_set_intr_state accordingly and change intr_en
to bool.

Also update apds9300_set_power_state and power_state for consistency.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-12-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: st_lsm6dsx: use bool for event state
Julien Stephan [Thu, 31 Oct 2024 15:27:06 +0000 (16:27 +0100)]
iio: imu: st_lsm6dsx: use bool for event state

Since the write_event_config callback now uses a bool for the state
parameter, update the signature of the function it calls accordingly.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-11-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: bmi323: use bool for event state
Julien Stephan [Thu, 31 Oct 2024 15:27:05 +0000 (16:27 +0100)]
iio: imu: bmi323: use bool for event state

Since the write_event_config callback now uses a bool for the state
parameter, update the signatures of the functions it calls accordingly.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-10-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: sca3000: use bool for event state
Julien Stephan [Thu, 31 Oct 2024 15:27:04 +0000 (16:27 +0100)]
iio: accel: sca3000: use bool for event state

Since the write_event_config callback now uses a bool for the state
parameter, update the signatures of the functions it calls accordingly.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-9-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: mma9551: use bool for event state
Julien Stephan [Thu, 31 Oct 2024 15:27:03 +0000 (16:27 +0100)]
iio: accel: mma9551: use bool for event state

Since the write_event_config callback now uses a bool for the state
parameter, update the signature of the function it calls accordingly,
and use a bool array for event_enabled.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-8-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: fix write_event_config signature
Julien Stephan [Thu, 31 Oct 2024 15:27:02 +0000 (16:27 +0100)]
iio: fix write_event_config signature

write_event_config callback use an int for state, but it is actually a
boolean. iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to write_event_config.

Fix signature and update all iio drivers to use the new signature.

This patch has been partially written using coccinelle with the
following script:

$ cat iio-bool.cocci
// Options: --all-includes

virtual patch

@c1@
identifier iioinfo;
identifier wecfunc;
@@
 static const struct iio_info iioinfo = {
        ...,
        .write_event_config =
(
 wecfunc
|
 &wecfunc
),
        ...,
 };

@@
identifier c1.wecfunc;
identifier indio_dev, chan, type, dir, state;
@@
 int wecfunc(struct iio_dev *indio_dev, const struct iio_chan_spec *chan, enum iio_event_type type, enum iio_event_direction dir,
-int
+bool
 state) {
  ...
 }

make coccicheck MODE=patch COCCI=iio-bool.cocci M=drivers/iio

Unfortunately, this script didn't match all files:
* all write_event_config callbacks using iio_device_claim_direct_scoped
  were not detected and not patched.
* all files that do not assign and declare the write_event_config
  callback in the same file.

iio.h was also manually updated.

The patch was build tested using allmodconfig config.

cc: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-7-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: adux1020: write_event_config: use local variable for interrupt value
Julien Stephan [Thu, 31 Oct 2024 15:27:01 +0000 (16:27 +0100)]
iio: light: adux1020: write_event_config: use local variable for interrupt value

state parameter is currently an int, but it is actually a boolean.
iio_ev_state_store is actually using kstrtobool to check user input,
then gives the converted boolean value to write_event_config.  The code
in adux1020_write_event_config re-uses state parameter to store an
integer value. To prepare for updating the write_event_config signature
to use a boolean for state, introduce a new local int variable.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-6-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: sx9500: simplify code in write_event_config callback
Julien Stephan [Thu, 31 Oct 2024 15:27:00 +0000 (16:27 +0100)]
iio: proximity: sx9500: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-5-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: irsd200: simplify code in write_event_config callback
Julien Stephan [Thu, 31 Oct 2024 15:26:59 +0000 (16:26 +0100)]
iio: proximity: irsd200: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-4-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: tsl2772: simplify code in write_event_config callback
Julien Stephan [Thu, 31 Oct 2024 15:26:58 +0000 (16:26 +0100)]
iio: light: tsl2772: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-3-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: proximity: hx9023s: simplify code in write_event_config callback
Julien Stephan [Thu, 31 Oct 2024 15:26:57 +0000 (16:26 +0100)]
iio: proximity: hx9023s: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-2-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: ltr390: simplify code in write_event_config callback
Julien Stephan [Thu, 31 Oct 2024 15:26:56 +0000 (16:26 +0100)]
iio: light: ltr390: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241031-iio-fix-write-event-config-signature-v2-1-2bcacbb517a2@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensor-prox: Add support for more channels
Ricardo Ribalda [Fri, 1 Nov 2024 07:46:31 +0000 (07:46 +0000)]
iio: hid-sensor-prox: Add support for more channels

Egis620 supports 3 channels: presense, proximity and attention.

Modify the driver so it can read those channels as well.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241101-hpd-v3-5-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensors-prox: Make proximity channel indexed
Ricardo Ribalda [Fri, 1 Nov 2024 07:46:30 +0000 (07:46 +0000)]
iio: hid-sensors-prox: Make proximity channel indexed

We are going to introduce more proximity channels. Make proximity a
indexed channel now, in a simple patch, so the change can be easily
bisected if there are any issues.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241101-hpd-v3-4-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: Add channel type for attention
Ricardo Ribalda [Fri, 1 Nov 2024 07:46:29 +0000 (07:46 +0000)]
iio: Add channel type for attention

Add a new channel type representing if the user's attention state to the
the system. This usually means if the user is looking at the screen or
not.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241101-hpd-v3-3-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensors-prox: Factor-in hid_sensor_push_data
Ricardo Ribalda [Fri, 1 Nov 2024 07:46:28 +0000 (07:46 +0000)]
iio: hid-sensors-prox: Factor-in hid_sensor_push_data

The function is only called from one place and it is a one-liner.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241101-hpd-v3-2-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: hid-sensors: Add proximity and attention IDs
Ricardo Ribalda [Fri, 1 Nov 2024 07:46:27 +0000 (07:46 +0000)]
iio: hid-sensors: Add proximity and attention IDs

The HID Usage Table at https://usb.org/sites/default/files/hut1_5.pdf
reserves:

- 0x4b2 for Human Proximity Range
Distance between a human and the computer. Default unit of
measure is meters;
https://www.usb.org/sites/default/files/hutrr39b_0.pdf

- 0x4bd for Human Attention Detected
Human-Presence sensors detect the presence of humans in the sensor’s
field-of-view using diverse and evolving technologies. Some presence
sensors are implemented with low resolution video cameras, which can
additionally track a subject’s attention (i.e. if the
user is ‘looking’ at the system with the integrated sensor).
A Human-Presence sensor, providing a Host with the user’s attention
state, allows the Host to optimize its behavior. For example, to
brighten/dim the system display, based on the user’s attention to the
system (potentially prolonging battery life). Default unit is
true/false;
https://www.usb.org/sites/default/files/hutrr107-humanpresenceattention_1.pdf

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Link: https://patch.msgid.link/20241101-hpd-v3-1-e9c80b7c7164@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: Mark iio_dev::priv member with __private
Andy Shevchenko [Fri, 1 Nov 2024 10:53:42 +0000 (12:53 +0200)]
iio: Mark iio_dev::priv member with __private

The member is not supposed to be accessed directly, mark it with
__private to catch the misuses up.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241101105342.3645018-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Deduplicate ODR startup time array
Andy Shevchenko [Fri, 1 Nov 2024 08:08:29 +0000 (10:08 +0200)]
iio: accel: kxcjk-1013: Deduplicate ODR startup time array

The content of kxcj91008_odr_start_up_times and kxcjk1013_odr_start_up_times
is identical, deduplicate it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241101081203.3360421-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: veml6070: add support for integration time
Javier Carrasco [Wed, 30 Oct 2024 23:09:58 +0000 (00:09 +0100)]
iio: light: veml6070: add support for integration time

The integration time of the veml6070 depends on an external resistor
(called Rset in the datasheet) and the value configured in the IT
field of the command register, whose supported values are 1/2x, 1x,
2x and 4x.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241031-veml6070-integration-time-v4-2-c66da6788256@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: light: veml6075: document vishay,rset-ohms
Javier Carrasco [Wed, 30 Oct 2024 23:09:57 +0000 (00:09 +0100)]
dt-bindings: iio: light: veml6075: document vishay,rset-ohms

The veml6070 provides a configurable integration time by means of an
external resistor (Rset in the datasheet) with values between 75 and
1200 kohms.

Document vishay,rset-ohms to select the integration time.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241031-veml6070-integration-time-v4-1-c66da6788256@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5791: Use devm_iio_device_register
Axel Haslam [Thu, 31 Oct 2024 07:17:46 +0000 (08:17 +0100)]
iio: dac: ad5791: Use devm_iio_device_register

Use devm_iio_device_register to automatically free the iio device.
since this is the last remaining resource that was not automatically
freed, we can drop the ".remove" callback.

Suggested-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-7-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5791: Use devm_regulator_get_enable_read_voltage
Axel Haslam [Thu, 31 Oct 2024 07:17:45 +0000 (08:17 +0100)]
iio: dac: ad5791: Use devm_regulator_get_enable_read_voltage

Simplify probe by using of the devm_regulator_get_enable_read_voltage.

Suggested-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-6-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5791: Add reset, clr and ldac gpios
Axel Haslam [Thu, 31 Oct 2024 07:17:44 +0000 (08:17 +0100)]
iio: dac: ad5791: Add reset, clr and ldac gpios

The ad7591 has reset, clr and ldac gpios. For the DAC to output data
continuously written to the data register the state of these gpios needs
to be set by the driver.

Add these gpios to the driver making them optional in case they are fixed
on the pcb.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-5-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5791: Include chip_info in device match tables
Axel Haslam [Thu, 31 Oct 2024 07:17:43 +0000 (08:17 +0100)]
iio: dac: ad5791: Include chip_info in device match tables

Include a chip info struct in device SPI and device OF match tables to
provide channel definitions for each particular ADC model and drop
device enum.

Suggested-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-4-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: dac: ad5791: Add required voltage supplies
Axel Haslam [Thu, 31 Oct 2024 07:17:42 +0000 (08:17 +0100)]
dt-bindings: iio: dac: ad5791: Add required voltage supplies

Vcc, iovcc, vrefp, and vrefn are needed for the DAC to work.
Add them as required bindings for ad5791.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-3-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: dac: ad5791: Add optional reset, clr and ldac gpios
Axel Haslam [Thu, 31 Oct 2024 07:17:41 +0000 (08:17 +0100)]
dt-bindings: iio: dac: ad5791: Add optional reset, clr and ldac gpios

Depending on board layout, the ad57xx may need control of reset, clear,
and ldac pins by the host driver. Add optional bindings for these gpios.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Link: https://patch.msgid.link/20241031071746.848694-2-ahaslam@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: adi-axi-dac: add registering of child fdt node
Angelo Dureghello [Mon, 28 Oct 2024 21:45:35 +0000 (22:45 +0100)]
iio: dac: adi-axi-dac: add registering of child fdt node

Change to obtain the fdt use case as reported in the
adi,ad3552r.yaml file in this patchset.

The DAC device is defined as a child node of the backend.
Registering the child fdt node as a platform devices.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-8-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad3552r: add high-speed platform driver
Angelo Dureghello [Mon, 28 Oct 2024 21:45:34 +0000 (22:45 +0100)]
iio: dac: ad3552r: add high-speed platform driver

Add High Speed ad3552r platform driver.

The ad3552r DAC is controlled by a custom (fpga-based) DAC IP
through the current AXI backend, or similar alternative IIO backend.

Compared to the existing driver (ad3552r.c), that is a simple SPI
driver, this driver is coupled with a DAC IIO backend that finally
controls the ad3552r by a fpga-based "QSPI+DDR" interface, to reach
maximum transfer rate of 33MUPS using dma stream capabilities.

All commands involving QSPI bus read/write are delegated to the backend
through the provided APIs for bus read/write.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-7-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad3552r: extract common code (no changes in behavior intended)
Angelo Dureghello [Mon, 28 Oct 2024 21:45:33 +0000 (22:45 +0100)]
iio: dac: ad3552r: extract common code (no changes in behavior intended)

Extracting common code, to share common code to be used later
by the AXI driver version (ad3552r-axi.c).

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-6-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad3552r: changes to use FIELD_PREP
Angelo Dureghello [Mon, 28 Oct 2024 21:45:32 +0000 (22:45 +0100)]
iio: dac: ad3552r: changes to use FIELD_PREP

Changes to use FIELD_PREP, so that driver-specific ad3552r_field_prep
is removed. Variables (arrays) that was used to call ad3552r_field_prep
are removed too.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-5-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: adi-axi-dac: extend features
Angelo Dureghello [Mon, 28 Oct 2024 21:45:31 +0000 (22:45 +0100)]
iio: dac: adi-axi-dac: extend features

Extend AXI-DAC backend with new features required to interface
to the ad3552r DAC. Mainly, a new compatible string is added to
support the ad3552r-axi DAC IP, very similar to the generic DAC
IP but with some customizations to work with the ad3552r.

Then, a series of generic functions has been added to match with
ad3552r needs. Function names has been kept generic as much as
possible, to allow re-utilization from other frontend drivers.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-4-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: backend: extend features
Angelo Dureghello [Mon, 28 Oct 2024 21:45:30 +0000 (22:45 +0100)]
iio: backend: extend features

Extend backend features with new calls needed later on this
patchset from axi version of ad3552r.

The follwoing calls are added:

iio_backend_ddr_enable()
enable ddr bus transfer
iio_backend_ddr_disable()
disable ddr bus transfer
iio_backend_data_stream_enable()
enable data stream over bus interface
iio_backend_data_stream_disable()
disable data stream over bus interface
iio_backend_data_transfer_addr()
define the target register address where the DAC sample
will be written.

Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-3-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: dac: adi-axi-dac: add ad3552r axi variant
Angelo Dureghello [Mon, 28 Oct 2024 21:45:29 +0000 (22:45 +0100)]
dt-bindings: iio: dac: adi-axi-dac: add ad3552r axi variant

Add a new compatible and related bindigns for the fpga-based
"ad3552r" AXI IP core, a variant of the generic AXI DAC IP.

The AXI "ad3552r" IP is a very similar HDL (fpga) variant of the
generic AXI "DAC" IP, intended to control ad3552r and similar chips,
mainly to reach high speed transfer rates using a QSPI DDR
(dobule-data-rate) interface.

The ad3552r device is defined as a child of the AXI DAC, that in
this case is acting as an SPI controller.

Note, #io-backend is present because it is possible (in theory anyway)
to use a separate controller for the control path than that used
for the datapath.

Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-2-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: dac: ad3552r: add iio backend support
Angelo Dureghello [Mon, 28 Oct 2024 21:45:28 +0000 (22:45 +0100)]
dt-bindings: iio: dac: ad3552r: add iio backend support

There is a version of AXI DAC IP block (for FPGAs) that provides
a physical QSPI bus for AD3552R and similar chips, so supporting
spi-controller functionalities.

For this case, the binding is modified to include some additional
properties.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-1-f6960b4f9719@kernel-space.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: use s16 variable for temp value to avoid casting
Vasileios Amoiridis [Wed, 30 Oct 2024 23:54:24 +0000 (00:54 +0100)]
iio: chemical: bme680: use s16 variable for temp value to avoid casting

Use local s16 variable for the temperature channel to avoid casting it
later before passing it to the bme680_read_temp() function. This way,
possible endianness and initialization issues are avoided.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241030235424.214935-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: pac1921: Check for error code from devm_mutex_init() call
Andy Shevchenko [Wed, 30 Oct 2024 16:19:19 +0000 (18:19 +0200)]
iio: adc: pac1921: Check for error code from devm_mutex_init() call

Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: 371f778b83cd ("iio: adc: add support for pac1921")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/20241030162013.2100253-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: adc: ad4000: Check for error code from devm_mutex_init() call
Andy Shevchenko [Wed, 30 Oct 2024 16:19:18 +0000 (18:19 +0200)]
iio: adc: ad4000: Check for error code from devm_mutex_init() call

Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: 938fd562b974 ("iio: adc: Add support for AD4000")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241030162013.2100253-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: bmi270: Add support for BMI260
Justin Weiss [Sun, 27 Oct 2024 17:20:25 +0000 (10:20 -0700)]
iio: imu: bmi270: Add support for BMI260

Adds support for the Bosch BMI260 6-axis IMU to the Bosch BMI270
driver. Setup and operation is nearly identical to the Bosch BMI270,
but has a different chip ID and requires different firmware.

Firmware is requested and loaded from userspace.

Adds ACPI ID BMI0160, used by several devices including the GPD Win
Mini, Aya Neo AIR Pro, and OXP Mini Pro.

GPD Win Mini:

Device (BMI2)
{
    Name (_ADR, Zero)  // _ADR: Address
    Name (_HID, "BMI0160")  // _HID: Hardware ID
    Name (_CID, "BMI0160")  // _CID: Compatible ID
    Name (_DDN, "Accelerometer")  // _DDN: DOS Device Name
    Name (_UID, One)  // _UID: Unique ID
    Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
    {
        Name (RBUF, ResourceTemplate ()
        {
            I2cSerialBusV2 (0x0068, ControllerInitiated, 0x00061A80,
                AddressingMode7Bit, "\\_SB.I2CB",
                0x00, ResourceConsumer, , Exclusive,
                )
            GpioInt (Edge, ActiveLow, Exclusive, PullDefault, 0x0000,
                "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                )
                {   // Pin list
                    0x008B
                }
        })
        Return (RBUF) /* \_SB_.I2CB.BMI2._CRS.RBUF */
    }
    ...
}

Signed-off-by: Justin Weiss <justin@justinweiss.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241027172029.160134-5-justin@justinweiss.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: imu: bmi270: Add Bosch BMI260
Justin Weiss [Sun, 27 Oct 2024 17:20:24 +0000 (10:20 -0700)]
dt-bindings: iio: imu: bmi270: Add Bosch BMI260

The BMI260's register map, configuration, and capabilities are nearly
identical to the BMI270, but the devices have different chip IDs and
require different initialization firmware.

Signed-off-by: Justin Weiss <justin@justinweiss.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20241027172029.160134-4-justin@justinweiss.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: bmi270: Add scale and sampling frequency to BMI270 IMU
Justin Weiss [Sun, 27 Oct 2024 17:20:23 +0000 (10:20 -0700)]
iio: imu: bmi270: Add scale and sampling frequency to BMI270 IMU

Add read and write functions and create _available entries.

Signed-off-by: Justin Weiss <justin@justinweiss.com>
Link: https://patch.msgid.link/20241027172029.160134-3-justin@justinweiss.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: bmi270: Add triggered buffer for Bosch BMI270 IMU
Justin Weiss [Sun, 27 Oct 2024 17:20:22 +0000 (10:20 -0700)]
iio: imu: bmi270: Add triggered buffer for Bosch BMI270 IMU

Set up a triggered buffer for the accel and angl_vel values.

Signed-off-by: Justin Weiss <justin@justinweiss.com>
Link: https://patch.msgid.link/20241027172029.160134-2-justin@justinweiss.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: generalize read_*() functions
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:10 +0000 (21:53 +0200)]
iio: chemical: bme680: generalize read_*() functions

Remove the IIO specific scaling measurement units from the read functions
and add them inside the ->read_raw() function to keep the read_*() generic.
This way they can be used in other parts of the driver.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-8-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: Fix indentation and unnecessary spaces
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:09 +0000 (21:53 +0200)]
iio: chemical: bme680: Fix indentation and unnecessary spaces

Fix indentation issues, line breaking and unnecessary spaces
reported by checkpatch.pl. Reduce type casts by defining constants
to be LL.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-7-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: move to fsleep()
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:08 +0000 (21:53 +0200)]
iio: chemical: bme680: move to fsleep()

Use the new fsleep() function in the remaining driver instances.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-6-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: avoid using camel case
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:06 +0000 (21:53 +0200)]
iio: chemical: bme680: avoid using camel case

Rename camel case variable, as checkpatch.pl complains.

While at it, fix also the indentation of the array for readability.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-4-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: optimize startup time
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:05 +0000 (21:53 +0200)]
iio: chemical: bme680: optimize startup time

According to datasheet's Section 1.1, Table 1, the startup time for the
device is 2ms and not 5ms.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-3-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: chemical: bme680: Add missing regmap.h include
Vasileios Amoiridis [Mon, 21 Oct 2024 19:53:04 +0000 (21:53 +0200)]
iio: chemical: bme680: Add missing regmap.h include

Add the linux/regmap.h header since the struct regmap_config is used
in this file.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241021195316.58911-2-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: add support for veml3235
Javier Carrasco [Wed, 23 Oct 2024 18:59:59 +0000 (20:59 +0200)]
iio: light: add support for veml3235

The Vishay veml3235 is a low-power ambient light sensor with I2C
interface. It provides a minimum detectable intensity of
0.0021 lx/cnt, configurable integration time and gain, and an additional
white channel to distinguish between different light sources.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241023-veml3235-v3-2-8490f2622f9a@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agodt-bindings: iio: light: veml6030: add veml3235
Javier Carrasco [Wed, 23 Oct 2024 18:59:58 +0000 (20:59 +0200)]
dt-bindings: iio: light: veml6030: add veml3235

The veml3235 is another Vishay ambient light sensor that shares similar
properties with the other sensors covered by this bindings. In this
case, only the compatible, reg, and vdd-supply properties are required,
and the device does not have an interrupt line, like the already
supported veml7700.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20241023-veml3235-v3-1-8490f2622f9a@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5770r: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:15 +0000 (18:54 -0500)]
iio: dac: ad5770r: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-11-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5761: drop driver remove callback
David Lechner [Wed, 23 Oct 2024 23:54:14 +0000 (18:54 -0500)]
iio: dac: ad5761: drop driver remove callback

Drop use of the driver remove callback in the ad5761 driver.

By making use of a a devm_ helper, we can avoid the need for the remove
callback entirely.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-10-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5761: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:13 +0000 (18:54 -0500)]
iio: dac: ad5761: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Error returns are updated to use dev_err_probe().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-9-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5624r: drop driver remove callback
David Lechner [Wed, 23 Oct 2024 23:54:12 +0000 (18:54 -0500)]
iio: dac: ad5624r: drop driver remove callback

Drop use of the driver remove callback in the ad5624r_spi driver.

By making use of a a devm_ helper, we can avoid the need for the remove
callback entirely.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-8-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5624r: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:11 +0000 (18:54 -0500)]
iio: dac: ad5624r: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-7-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5504: drop driver remove callback
David Lechner [Wed, 23 Oct 2024 23:54:10 +0000 (18:54 -0500)]
iio: dac: ad5504: drop driver remove callback

Drop use of the driver remove callback in the ad5504 driver.

By making use of a a devm_ helper, we can avoid the need for the remove
callback entirely.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-6-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5504: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:09 +0000 (18:54 -0500)]
iio: dac: ad5504: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-5-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5446: drop driver remove callbacks
David Lechner [Wed, 23 Oct 2024 23:54:08 +0000 (18:54 -0500)]
iio: dac: ad5446: drop driver remove callbacks

Drop use of the driver remove callbacks in the ad5446 driver.

By making use of a a devm_ helper, we can avoid the need for the remove
callbacks entirely.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-4-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5446: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:07 +0000 (18:54 -0500)]
iio: dac: ad5446: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Also simplify == NULL check while we are touching that line.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-3-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5380: drop driver remove callbacks
David Lechner [Wed, 23 Oct 2024 23:54:06 +0000 (18:54 -0500)]
iio: dac: ad5380: drop driver remove callbacks

Drop use of the driver remove callbacks in the ad5380 driver.

By making use of a few more devm_ helpers, we can avoid the need for
remove callbacks entirely.

Also make use of dev_err_probe() while at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-2-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: dac: ad5380: use devm_regulator_get_enable_read_voltage()
David Lechner [Wed, 23 Oct 2024 23:54:05 +0000 (18:54 -0500)]
iio: dac: ad5380: use devm_regulator_get_enable_read_voltage()

Simplify the code by using devm_regulator_get_enable_read_voltage().

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-regulator-refactor-round-5-v1-1-d0bd396b3f50@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: gyro: bmg160_core: remove trailing tab
Julien Stephan [Wed, 23 Oct 2024 13:39:40 +0000 (15:39 +0200)]
iio: gyro: bmg160_core: remove trailing tab

Remove trailing tab

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241023-iio-gyro-bmg160_core-remove-trailing-tab-v1-1-9343c7dc4110@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: stk3310: simplify code in write_event_config callback
Julien Stephan [Thu, 24 Oct 2024 09:11:28 +0000 (11:11 +0200)]
iio: light: stk3310: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-6-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: imu: inv_mpu6050: simplify code in write_event_config callback
Julien Stephan [Thu, 24 Oct 2024 09:11:27 +0000 (11:11 +0200)]
iio: imu: inv_mpu6050: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-5-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: veml6030: simplify code in write_event_config callback
Julien Stephan [Thu, 24 Oct 2024 09:11:26 +0000 (11:11 +0200)]
iio: light: veml6030: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-4-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: ltr501: simplify code in write_event_config callback
Julien Stephan [Thu, 24 Oct 2024 09:11:25 +0000 (11:11 +0200)]
iio: light: ltr501: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-3-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: bh1745: simplify code in write_event_config callback
Julien Stephan [Thu, 24 Oct 2024 09:11:23 +0000 (11:11 +0200)]
iio: light: bh1745: simplify code in write_event_config callback

iio_ev_state_store is actually using kstrtobool to check user
input, then gives the converted boolean value to the write_event_config
callback.

Remove useless code in write_event_config callback.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
Link: https://patch.msgid.link/20241024-iio-fix-write-event-config-signature-v1-1-7d29e5a31b00@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: ltr501: Replace a variant of iio_get_acpi_device_name_and_data()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:13 +0000 (22:05 +0300)]
iio: light: ltr501: Replace a variant of iio_get_acpi_device_name_and_data()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace a variant of iio_get_acpi_device_name_and_data().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-25-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: ltr501: Add LTER0303 to the supported devices
Andy Shevchenko [Thu, 24 Oct 2024 19:05:12 +0000 (22:05 +0300)]
iio: light: ltr501: Add LTER0303 to the supported devices

It has been found that the (non-vendor issued) ACPI ID for Lite-On
LTR303 is present in Microsoft catalog. Add it to the list of the
supported devices.

Link: https://www.catalog.update.microsoft.com/Search.aspx?q=lter0303
Closes: https://lore.kernel.org/r/9cdda3e0-d56e-466f-911f-96ffd6f602c8@redhat.com
Reported-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-24-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: ltr501: Drop most likely fake ACPI IDs
Andy Shevchenko [Thu, 24 Oct 2024 19:05:11 +0000 (22:05 +0300)]
iio: light: ltr501: Drop most likely fake ACPI IDs

The commits in question do not proove that ACPI IDs exist.
Quite likely it was a cargo cult addition while doing that
for DT-based enumeration. Drop most likely fake ACPI IDs.

The to be removed IDs has been checked against the following resources:
1) DuckDuckGo
2) Google
3) MS catalog: https://www.catalog.update.microsoft.com/Search.aspx
This gives no useful results in regard to DSDT, moreover, the official
vendor ID in the registry for Lite-On is LCI.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-23-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards
Andy Shevchenko [Thu, 24 Oct 2024 19:05:10 +0000 (22:05 +0300)]
iio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong.  Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-22-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:09 +0000 (22:05 +0300)]
iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace a variant of iio_get_acpi_device_name_and_data().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-21-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: gyro: bmg160: Replace custom implementation of iio_get_acpi_device_name()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:08 +0000 (22:05 +0300)]
iio: gyro: bmg160: Replace custom implementation of iio_get_acpi_device_name()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace custom implementation of iio_get_acpi_device_name().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-20-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: mma9553: Replace custom implementation of iio_get_acpi_device_name()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:07 +0000 (22:05 +0300)]
iio: accel: mma9553: Replace custom implementation of iio_get_acpi_device_name()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace custom implementation of iio_get_acpi_device_name().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-19-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: mma9551: Replace custom implementation of iio_get_acpi_device_name()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:06 +0000 (22:05 +0300)]
iio: accel: mma9551: Replace custom implementation of iio_get_acpi_device_name()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace custom implementation of iio_get_acpi_device_name().

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-18-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: drop ACPI_PTR() and move ID out of CONFIG_ACPI guards
Andy Shevchenko [Thu, 24 Oct 2024 19:05:05 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: drop ACPI_PTR() and move ID out of CONFIG_ACPI guards

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also added linux/mod_devicetable.h for
struct acpi_device_id definition.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-17-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Replace a variant of iio_get_acpi_device_name_and_data()
Andy Shevchenko [Thu, 24 Oct 2024 19:05:04 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Replace a variant of iio_get_acpi_device_name_and_data()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace a variant of iio_get_acpi_device_name_and_data().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-16-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Get rid of enum kx_chipset
Andy Shevchenko [Thu, 24 Oct 2024 19:05:03 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Get rid of enum kx_chipset

Instead of using enum, out of which only a couple of values
are being actually used, make a comparisons against pointer
to the respective chip_info structures.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-15-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Convert ODR times array to variable in chip_info
Andy Shevchenko [Thu, 24 Oct 2024 19:05:02 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Convert ODR times array to variable in chip_info

Convert odr_start_up_times array to the variable in chip_info.
Tweak whitespace for readablity whilst here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-14-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Move odr_start_up_times up in the code
Andy Shevchenko [Thu, 24 Oct 2024 19:05:01 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Move odr_start_up_times up in the code

Move odr_start_up_times up in the code in a preparation of
the further cleaning up changes.

While at it, make it clear what values from enum are being used for
the respective array entries.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-13-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Start using chip_info variables instead of enum
Andy Shevchenko [Thu, 24 Oct 2024 19:05:00 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Start using chip_info variables instead of enum

Instead of having a enum and keeping IDs as driver data pointers,
just have a chip_info struct per supported device.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-12-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Rename kxcjk1013_info
Andy Shevchenko [Thu, 24 Oct 2024 19:04:59 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Rename kxcjk1013_info

Rename kxcjk1013_info to kxcjk1013_iio_info in preparatory of
further cleaning up changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-11-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Use local variable for regs
Andy Shevchenko [Thu, 24 Oct 2024 19:04:58 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Use local variable for regs

Use local variable for regs in preparatory of further cleaning up changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-10-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Switch from CONFIG_PM guards to pm_ptr() etc
Andy Shevchenko [Thu, 24 Oct 2024 19:04:57 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Switch from CONFIG_PM guards to pm_ptr() etc

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.

Removing instances of this approach from IIO also stops them being
copied into new drivers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Revert "Add support for KX022-1020"
Andy Shevchenko [Thu, 24 Oct 2024 19:04:56 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Revert "Add support for KX022-1020"

The mentioned change effectively broke the ODR startup timeouts
settungs for KX023-1025 case. Let's revert it for now and see
how we can handle it with the better approach after switching
the driver to use data structure instead of enum.

This reverts commit d5cbe1502043124ff8af8136b80f93758c4a61e0.

Fixes: d5cbe1502043 ("iio: accel: kxcjk-1013: Add support for KX022-1020")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-8-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: accel: kxcjk-1013: Remove redundant I²C ID
Andy Shevchenko [Thu, 24 Oct 2024 19:04:55 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Remove redundant I²C ID

The ACPI IDs are defined in the respective ID tables. Puting them
to the I²C ID legacy table has no meaning. Remove that ID.

Fixes: 3bfa74f86006 ("iio:kxcjk-1013: Add support for SMO8500 device")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-7-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
7 months agoiio: acpi: Add iio_get_acpi_device_name_and_data() helper function
Andy Shevchenko [Thu, 24 Oct 2024 19:04:54 +0000 (22:04 +0300)]
iio: acpi: Add iio_get_acpi_device_name_and_data() helper function

A few drivers duplicate the code to retrieve ACPI device instance name.
Some of them want an associated driver data as well.

In order of deduplication introduce the common helper functions.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20241024191200.229894-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>