summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)AuthorFilesLines
2024-11-19Merge tag 'locking-core-2024-11-18' of ↵Linus Torvalds1-1/+2
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull locking updates from Ingo Molnar: "Lockdep: - Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING (Sebastian Andrzej Siewior) - Add lockdep_cleanup_dead_cpu() (David Woodhouse) futexes: - Use atomic64_inc_return() in get_inode_sequence_number() (Uros Bizjak) - Use atomic64_try_cmpxchg_relaxed() in get_inode_sequence_number() (Uros Bizjak) RT locking: - Add sparse annotation PREEMPT_RT's locking (Sebastian Andrzej Siewior) spinlocks: - Use atomic_try_cmpxchg_release() in osq_unlock() (Uros Bizjak) atomics: - x86: Use ALT_OUTPUT_SP() for __alternative_atomic64() (Uros Bizjak) - x86: Use ALT_OUTPUT_SP() for __arch_{,try_}cmpxchg64_emu() (Uros Bizjak) KCSAN, seqlocks: - Support seqcount_latch_t (Marco Elver) <linux/cleanup.h>: - Add if_not_guard() conditional guard helper (David Lechner) - Adjust scoped_guard() macros to avoid potential warning (Przemek Kitszel) - Remove address space of returned pointer (Uros Bizjak) WW mutexes: - locking/ww_mutex: Adjust to lockdep nest_lock requirements (Thomas Hellström) Rust integration: - Fix raw_spin_lock initialization on PREEMPT_RT (Eder Zulian) Misc cleanups & fixes: - lockdep: Fix wait-type check related warnings (Ahmed Ehab) - lockdep: Use info level for initial info messages (Jiri Slaby) - spinlocks: Make __raw_* lock ops static (Geert Uytterhoeven) - pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase (Qiuxu Zhuo) - iio: magnetometer: Fix if () scoped_guard() formatting (Stephen Rothwell) - rtmutex: Fix misleading comment (Peter Zijlstra) - percpu-rw-semaphores: Fix grammar in percpu-rw-semaphore.rst (Xiu Jianfeng)" * tag 'locking-core-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (29 commits) locking/Documentation: Fix grammar in percpu-rw-semaphore.rst iio: magnetometer: fix if () scoped_guard() formatting rust: helpers: Avoid raw_spin_lock initialization for PREEMPT_RT kcsan, seqlock: Fix incorrect assumption in read_seqbegin() seqlock, treewide: Switch to non-raw seqcount_latch interface kcsan, seqlock: Support seqcount_latch_t time/sched_clock: Broaden sched_clock()'s instrumentation coverage time/sched_clock: Swap update_clock_read_data() latch writes locking/atomic/x86: Use ALT_OUTPUT_SP() for __arch_{,try_}cmpxchg64_emu() locking/atomic/x86: Use ALT_OUTPUT_SP() for __alternative_atomic64() cleanup: Add conditional guard helper cleanup: Adjust scoped_guard() macros to avoid potential warning locking/osq_lock: Use atomic_try_cmpxchg_release() in osq_unlock() cleanup: Remove address space of returned pointer locking/rtmutex: Fix misleading comment locking/rt: Annotate unlock followed by lock for sparse. locking/rt: Add sparse annotation for RCU. locking/rt: Remove one __cond_lock() in RT's spin_trylock_irqsave() locking/rt: Add sparse annotation PREEMPT_RT's sleeping locks. locking/pvqspinlock: Convert fields of 'enum vcpu_state' to uppercase ...
2024-11-11iio: magnetometer: fix if () scoped_guard() formattingStephen Rothwell1-1/+2
Add mising braces after an if condition that contains scoped_guard(). This style is both preferred and necessary here, to fix warning after scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning") to have if-else inside of the macro. Current (no braces) use in af8133j_set_scale() yields the following warnings: af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else] af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else] Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning") Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20241108154258.21411-1-przemyslaw.kitszel@intel.com
2024-11-09Merge tag 'iio-for-6.13b' of ↵Greg Kroah-Hartman137-2151/+7503
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: IIO: 2nd set of new device support, features and cleanup for 6.13 Alongside new drivers and device support there are several large cleanups going on across the IIO tree and we see part of some of those in this pull request. Merged char-misc-next at point of 6.12-rc6 merge to avoid a conflict with a fix for the ad7380 merged earlier this cycle. Note that I previously messed this merge up and had to reconstruct it this morning so a coherent pull request was possible. The new stuff is all the same as has been in linux-next for some time with the exception of the kernel-doc related __private ordering fix that went in yesterday. New device support ================== adi,ad7380 - Support for adaq4370-4 and adaq4370 quad channel ADCs. adi,ad7606 - Various cleanups preceeding support of AD7607, AD7608 and AD7609 ADCs. adi,ad7779 - New driver supproting AD7770, AD7771 and AD7779 ADCs. allegro,als31300 - New driver for this 3D Linear Hall Effect sensor. bosch,bmi270 - Add support BMI260 which is similar but requires a different firmware image. bosch,smi240 - New driver for this IMU. ti,opt3001 - Add support opt3002 light sensor which has a wider spectral range than the opt3001. vishay,veml3235 - New driver for this ambient light sensor. Features ======== hid-sensors - Add support Human Proximity Range and Attention detection (requiring a new classification style channel type) adi,ad3552r - Add backend support and related platform driver to support use with an FPGA IP to allow QSPI + DDR bus operation and much higher data aquisition rates. (various rework preceeded this feature) adi,ad7606 - Various cleanup prior to enabling use with an IIO Backend and PWM trigger enabling much higher speed data capture. bosch,bme680 - Support control of preheat current - Support triggered buffer capture - Add SCALE and RAW channels (needed to enable the buffered capture). bosch,bmp280 - Enable sleeping to save power. - Add interrupt support for bmp3xx and bmp5xx devices. Also update bmp085 to new approach. - Enable data ready trigger. bosch,bmi270 - Add triggered buffer support - Add scale and sampling frequency control. vishay,veml6070 - Support integration time via DT binding for an external resistor value. Cleanup and minor fixes ======================= core - Fix a longstanding issue with event codes for differential channels. Note that not all drivers are yet fixed, but macros have been added to avoid potential repeats of this in future. - Tidy up handling in iio_read_acpi_mount matrix. - Mark iio_dev::priv with __private. Later move the marking before the field name to avoid a kernel-doc issue. treewide - Drop some pointless default n entries in Kconfig. - Add an iio_get_acpi_device_name_and_data() handler to replace some commonly repeated code. - simplify use of 'state' in write_event_config() callback as it is effectively a boolean. Once done make it a boolean (lots of drivers were updated to enable this) - some more use of devm_regulator_get_enable_read_voltage( to replace open coded versions. Where this enables it convert all of remove handling to devm based and drop the remove callback. - check returns from devm_mutex_init() accel drivers - Use aligned_s64 instead of s64 __aligned(8) adi,ad5791 - Add some missing GPIOs and power supplies that presumably were always hard wired on previous boards. - Refactor to use chip_info in device id tables. - Convert probe entirely to devm based simplify code and allowing remove() callback to be dropped. adi,ad7192 - Check return from spi_get_device_match_data() adi,ad74413r - Don't keep an unnecessary copy of the gpio after probe. - Use devm_regulator_get_enable_read_voltage() instead of open coding. - Apply cleanup.h approach to reduce complexity. adi,dac8460 - Fix a wrong compaitble ID due to a stray space. - Add an spi_device_id table. bosch,bmc150 - Drop some likely false ACPI IDs. - Drop left over unused ACPI specific code. bosch,bme680 - Add mising regmap.h include. - Reduce excessive sleep on startup. - Drop some cammelcase usage. - Use fsleep - Generalize read functions to allow for reuse. - Use s16 variable to avoid some incorrect casting bosch,bmg150 - Drop some likely false ACPI IDs. bosch,bmi270 - Drop unused FREQUENCY and SCALE attributes that always returned an error (they wil be back impelmented correctly). - Factor out the chip specific data into a structure to enable simple support for additional devices. isil,isl29018 - Drop ACPI_PTR() and CONFIG_ACPI guards as not worth the trouble for very minor saving. invensense,mpu6050 - Use much simpler test for ACPI firmware. kionix,kxcjk-1013 - Drop unnecessary ACPI entry in the i2c_device_id table. - Drop support KX022-1020 to fix a bug that was introduced with that change. Hopefully a fixed version will replace it soon. - Drop CONFIG guards for PM in favor of pm_ptr() and the compiler removing dead code. - Switch from enum to chip_info structure and add ODR times to that structure. - Deduplicate one of those ODR structures - Drop ACPI_PTR() and move ID table out of config guards. - Minor additional cleanup. liteon,ltr401 - Drop some likely false ACPI Ids and add LTER0303 which is know to be in use. microchip,pac1934 - Use much simpler test for ACPI firmware. vishay,veml6070 - Use unsigned int instead of just unsigned. - Use FIELD_PREP to make setting of field value explicit. Various other minor fixes to documentation * tag 'iio-for-6.13b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (153 commits) iio: Move __private marking before struct element priv in struct iio_dev docs: iio: ad7380: add adaq4370-4 and adaq4380-4 iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4 iio: adc: ad7380: use local dev variable to shorten long lines iio: adc: ad7380: fix oversampling formula dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts iio: chemical: bme680: Add support for preheat current iio: chemical: bme680: Add triggered buffer support iio: chemical: bme680: Add SCALE and RAW channels iio: chemical: bme680: refactorize set_mode() mode iio: events: make IIO_EVENT_CODE macro private iio: accel: mma9553: use specialized event code macros iio: dummy: use specialized event code macros iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helper iio: events.h: add event identifier macros for differential channel iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect driver dt-bindings: iio: magnetometer: document the Allegro MicroSystems ALS31300 3-D Linear Hall Effect Sensor dt-bindings: vendor-prefixes: Add Allegro MicroSystems, Inc iio: light: apds9960: remove useless return iio: light: apds9960: convert als_int and pxs_int to bool ...
2024-11-09iio: adc: ad7380: add support for adaq4370-4 and adaq4380-4Julien Stephan1-4/+126
adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data acquisition signal chain μModule solutions compatible with the ad738x family, with the following differences: - pin selectable gain in front of each 4 adc - internal reference is 3V derived from refin-supply (5V) - additional supplies This implies that IIO_CHAN_INFO_SCALE can not be shared by type for these new devices. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-4-864ff02babae@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09iio: adc: ad7380: use local dev variable to shorten long linesJulien Stephan1-17/+16
Use local dev variable in the probe function to shorten long lines. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-3-864ff02babae@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09iio: adc: ad7380: fix oversampling formulaJulien Stephan1-3/+12
The formula in the datasheet for oversampling time conversion seems to be valid when device is at full speed using the maximum number of SDO lines. The driver currently support only 1 SDO line. The correct formula is: t_convert = T_CONVERT_0_NS + T_CONVERT_X_NS*(x - 1)*num_channel/number_of_sdo_lines. It will produce larger delays than what is currently set, but some devices actually require it. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20241030-ad7380-add-adaq4380-4-support-v4-2-864ff02babae@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-09Merge commit '9365f0de4303f82ed4c2db1c39d3de824b249d80' into HEADJonathan Cameron5-62/+84
Merge v6.12-rc6 via char-misc-next to get some fixes needed for next few patches in IIO.
2024-11-08Merge tag 'iio-fixes-for-6.12c' of ↵Greg Kroah-Hartman12-16/+16
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: IIO: 3rd set of fixes for the 6.12 cycle Usual mixed bag of new issues from this cycle and ancient bugs recently noticed. core - Fix wrong fwnode handle if __fwnode_iio_channel_get_by_name() looks at parents of the provider node. core,backend - Fix a wrong pointer error check. gts library - Fix plausible corner case where the value returned was not set. - Avoid near infinite loop if the size of the table is 0. (neither are an issue for current drivers). adi,ad4000 - Fix reading of unsigned channels that were returning garbage. adi,ad7780 - Prevent a division by zero. adi,ad7923 - Fix buffer overflows in arrays that were not resized when devices with more channels were added to the driver. adi,adxl380 - Check only for negative error codes rather than including the positive channel read values in an error check. invense,common - Fix an issue where changing the sampling rate to another value and back again whilst the FIFO was off would not update things correctly. kionix,kx022a - Fix failure to sign extend value read from device. * tag 'iio-fixes-for-6.12c' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name() iio: accel: adxl380: fix raw sample read iio: accel: kx022a: Fix raw read format iio: gts: fix infinite loop for gain_to_scaletables() iio: gts: Fix uninitialized symbol 'ret' iio: adc: ad4000: fix reading unsigned data ad7780: fix division by zero in ad7780_write_raw() iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer iio: backend: fix wrong pointer passed to IS_ERR() iio: invensense: fix multiple odr switch when FIFO is off
2024-11-05Merge 6.12-rc6 into char-misc-nextGreg Kroah-Hartman5-62/+84
We need the char/misc/iio fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-03iio: chemical: bme680: Add support for preheat currentVasileios Amoiridis2-0/+42
Add functionality to inject a specified amount of current to the heating plate before the start of the gas measurement to allow the sensor to reach faster to the requested temperature. Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com> Link: https://patch.msgid.link/20241102131311.36210-5-vassilisamir@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03iio: chemical: bme680: Add triggered buffer supportVasileios Amoiridis3-1/+139
Add triggered buffer and soft timestamp support. The available scan mask enables all the channels of the sensor in order to follow the operation of the sensor. The sensor basically starts to capture from all channels as long as it enters into FORCED mode. The bulk read, reads a total of 15 registers from the sensor, 0x1D..0x2B. Even though some of those registers are not reported in the register map of the device, this is how the BME680 Sensor API [1] proposes to do it. This allows to have one bulk read instead of multiple ones. Link: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L1200 Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com> Link: https://patch.msgid.link/20241102131311.36210-4-vassilisamir@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-03iio: chemical: bme680: Add SCALE and RAW channelsVasileios Amoiridis1-0/+51
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>
2024-11-03iio: chemical: bme680: refactorize set_mode() modeVasileios Amoiridis2-19/+14
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>
2024-11-03iio: accel: mma9553: use specialized event code macrosDavid Lechner1-13/+11
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>
2024-11-03iio: dummy: use specialized event code macrosDavid Lechner1-16/+14
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>
2024-11-03iio: adc: ad7280a: use IIO_DIFF_EVENT_CODE macro helperJulien Stephan1-8/+6
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>
2024-11-03iio: magnetometer: add Allegro MicroSystems ALS31300 3-D Linear Hall Effect ↵Neil Armstrong3-0/+508
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>
2024-11-03iio: light: apds9960: remove useless returnJulien Stephan1-2/+0
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>
2024-11-03iio: light: apds9960: convert als_int and pxs_int to boolJulien Stephan1-2/+2
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>
2024-11-03iio: light: apds9306: simplifies if branch in apds9306_write_event_configJulien Stephan1-4/+1
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>
2024-11-03iio: light: apds9300: use bool for event stateJulien Stephan1-9/+9
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>
2024-11-03iio: imu: st_lsm6dsx: use bool for event stateJulien Stephan1-1/+1
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>
2024-11-03iio: imu: bmi323: use bool for event stateJulien Stephan1-4/+4
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>
2024-11-03iio: accel: sca3000: use bool for event stateJulien Stephan1-2/+2
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>
2024-11-03iio: accel: mma9551: use bool for event stateJulien Stephan1-3/+3
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>
2024-11-03iio: fix write_event_config signatureJulien Stephan64-65/+71
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>
2024-11-03iio: light: adux1020: write_event_config: use local variable for interrupt valueJulien Stephan1-5/+4
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>
2024-11-03iio: proximity: sx9500: simplify code in write_event_config callbackJulien Stephan1-2/+2
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>
2024-11-03iio: proximity: irsd200: simplify code in write_event_config callbackJulien Stephan1-1/+1
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>
2024-11-03iio: light: tsl2772: simplify code in write_event_config callbackJulien Stephan1-2/+2
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>
2024-11-03iio: proximity: hx9023s: simplify code in write_event_config callbackJulien Stephan1-1/+1
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>
2024-11-03iio: light: ltr390: simplify code in write_event_config callbackJulien Stephan1-4/+1
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>
2024-11-03iio: hid-sensor-prox: Add support for more channelsRicardo Ribalda1-76/+104
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>
2024-11-03iio: hid-sensors-prox: Make proximity channel indexedRicardo Ribalda1-0/+1
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>
2024-11-03iio: Add channel type for attentionRicardo Ribalda1-0/+1
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>
2024-11-03iio: hid-sensors-prox: Factor-in hid_sensor_push_dataRicardo Ribalda1-12/+4
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>
2024-11-03iio: Mark iio_dev::priv member with __privateAndy Shevchenko1-1/+1
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>
2024-11-03iio: accel: kxcjk-1013: Deduplicate ODR startup time arrayAndy Shevchenko1-21/+4
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>
2024-11-03iio: light: veml6070: add support for integration timeJavier Carrasco1-8/+123
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>
2024-11-03iio: dac: ad5791: Use devm_iio_device_registerAxel Haslam1-14/+1
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>
2024-11-03iio: dac: ad5791: Use devm_regulator_get_enable_read_voltageAxel Haslam1-44/+14
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>
2024-11-03iio: dac: ad5791: Add reset, clr and ldac gpiosAxel Haslam1-3/+31
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>
2024-11-03iio: dac: ad5791: Include chip_info in device match tablesAxel Haslam1-57/+53
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>
2024-11-03iio: dac: adi-axi-dac: add registering of child fdt nodeAngelo Dureghello1-0/+56
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>
2024-11-03iio: dac: ad3552r: add high-speed platform driverAngelo Dureghello5-1/+574
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>
2024-11-02iio: Fix fwnode_handle in __fwnode_iio_channel_get_by_name()Zicheng Qu1-1/+1
In the fwnode_iio_channel_get_by_name(), iterating over parent nodes to acquire IIO channels via fwnode_for_each_parent_node(). The variable chan was mistakenly attempted on the original node instead of the current parent node. This patch corrects the logic to ensure that __fwnode_iio_channel_get_by_name() is called with the correct parent node. Cc: stable@vger.kernel.org # v6.6+ Fixes: 1e64b9c5f9a0 ("iio: inkern: move to fwnode properties") Signed-off-by: Zicheng Qu <quzicheng@huawei.com> Link: https://patch.msgid.link/20241102092525.2389952-1-quzicheng@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-01iio: accel: adxl380: fix raw sample readAntoniu Miclaus1-1/+1
The adxl380_read_chn function returns either a negative value in case an error occurs or the actual sample. Check only for negative values after a channel is read. Fixes: df36de13677a ("iio: accel: add ADXL380 driver") Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Link: https://patch.msgid.link/20241101095202.20121-1-antoniu.miclaus@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2024-11-01iio: dac: ad3552r: extract common code (no changes in behavior intended)Angelo Dureghello4-372/+501
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>
2024-11-01iio: dac: ad3552r: changes to use FIELD_PREPAngelo Dureghello1-117/+50
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>
2024-11-01iio: dac: adi-axi-dac: extend featuresAngelo Dureghello1-14/+242
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>