summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
16 hoursMerge branch 'headers' of git://git.infradead.org/users/willy/pagecache.gitMark Brown
# Conflicts: # net/ceph/osd_client.c
16 hoursMerge branch 'togreg' of ↵Mark Brown
ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git # Conflicts: # drivers/iio/adc/ade9000.c
17 hoursMerge branch 'for-mfd-next' of ↵Mark Brown
ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
26 hoursiio: adc: ad4030: fix invalid oversampling_ratio validationSalah Triki
In ad4030_set_avg_frame_len(), the logarithm is calculated before input validation. Passing zero or negative values leads to an undefined result from ilog2(). Validate that the input is strictly positive prior to computing its logarithm. Fixes: 949abd1ca5a4 ("iio: adc: ad4030: add averaging support") Assisted-by: LLM Signed-off-by: Salah Triki <salah.triki@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
28 hoursiio: adc: ad7173: Fix digital filter configurationMarcelo Schmitt
Filter enable and filter type selection masks were swapped on data preparation for filter configuration register write. Use the correct masks to set each property of post filter configuration. Fixes: ff06b39be1a1 ("iio: adc: ad7173: support changing filter type") Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: adc: stm32-adc: fix possible division by zero in processed channelFabrice Gasnier
In case the conversion has failed or returned zero, processing *val can lead to a division by zero. Need to check for errors, or converted value is zero, before processing the data. In case the converted value is zero, e.g. the Vrefint channel, this should be considered as invalid in all cases. Fixes: 0e346b2cfa85 ("iio: adc: stm32-adc: add vrefint calibration support") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/all/20260911161555.244F31F000FF@smtp.kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: adc: stm32-adc: fix check on internal channel availabilityFabrice Gasnier
If an unsupported internal channel like vddgpu is requested, the driver prints a warning but falls through and assigns it a valid int_ch below. This causes a problem later during setup: stm32_adc_int_ch_enable() { ... case STM32_ADC_INT_CH_VDDGPU: stm32_adc_set_bits(adc, adc->cfg->regs->or_vddgpu.reg, adc->cfg->regs->or_vddgpu.mask); ... } Because the register offset is uninitialized (0), this performs a read-modify-write on offset 0, which corresponds to the ISR register. Fix this by returning before a valid int_ch is assigned. Choice is made to keep current driver behavior to warn about the channel name. Fixes: cf0fb80ae167 ("iio: adc: stm32-adc: add stm32mp13 support") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/all/20260911162602.D323F1F000FF@smtp.kernel.org/ Cc: stable@vger.kernel.org Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: proximity: isl29501: Fix return type of isl29501_register_writeSalah Triki
isl29501_register_write() was returning a u32 instead of an int. Since the function returns negative error codes (such as -ERANGE or return values from i2c_smbus_write_byte_data()), returning an unsigned integer type prevents callers from correctly checking for negative error conditions. Fix this by changing the function return type from u32 to int. This was found through manual code review. Fixes: 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.") Signed-off-by: Salah Triki <salah.triki@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: imu: inv_icm42607: restore runtime PM on system resume errorsLinmao Li
pm_runtime_force_suspend() leaves runtime PM disabled after it succeeds and expects pm_runtime_force_resume() to restore runtime PM management during system resume. The resume callback returns early if enabling the vddio regulator or synchronizing the register cache fails, skipping the matching pm_runtime_force_resume() call. Runtime PM consequently remains disabled after the system has resumed, so runtime autosuspend can no longer turn off sensors enabled afterward. Call pm_runtime_force_resume() on both error paths. Keep the first error as the return value and report a runtime PM restore failure separately. Fixes: 3007c1530f96 ("iio: imu: inv_icm42607: Add PM support for icm42607") Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Tested-by: Kanak Shilledar <kanak.shilledar@axis.com> Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: imu: inv_icm42607: propagate runtime suspend errorsLinmao Li
The runtime suspend callback returns success when updating PWR_MGMT0 fails. The PM core then marks the device suspended even though the shutdown outcome is unknown. If the write did not reach the sensor, the sensors remain running and draw power while the device is idle. The condition need not persist. If the bus error clears, a later sensor access either reads the current PWR_MGMT0 value from hardware or retries programming the requested enabled mode, allowing normal operation to resume. Return the underlying errno to the PM core. -EAGAIN and -EBUSY retain their transient-error semantics; other errors put runtime PM into an error state and cause later PM acquires to fail until the status is explicitly reset. In the normal idle case, a successful system suspend can perform that reset. This leaves the transient-versus-fatal classification to the PM core and matches the sibling ICM-42600 driver. Keep a void wrapper for the managed teardown action, where errors can only be logged. Fixes: 3007c1530f96 ("iio: imu: inv_icm42607: Add PM support for icm42607") Signed-off-by: Linmao Li <lilinmao@kylinos.cn> Tested-by: Kanak Shilledar <kanak.shilledar@axis.com> Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
29 hoursiio: adc: pac1934: check ACPI label duplicationSlavin Liu
A label duplication failure currently reaches the terminating-byte write. Release the ACPI result and abort before accessing the missing label; earlier labels are managed by devres. Detected by static analysis and reviewed with AI-assisted source auditing. Fixes: 0fb528c8255b ("iio: adc: adding support for PAC193x") Assisted-by: LLM Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: ltc2497: add 2x conversion speed modeAndrei Stancovici
The LTC2499 can convert at twice the output rate by disabling the offset auto-calibration. Expose it through sampling_frequency and sampling_frequency_available on the voltage channels. The part ignores the setting while measuring temperature, so the temperature channel does not carry the attribute. The wait before a result is read is keyed on the conversion currently in flight, whose duration is fixed by the mode that was active when it started rather than by the mode just selected. Otherwise the first read after a 1x -> 2x switch can reprogram the part while a 1x conversion is still running, which the part NACKs. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/2499fe.pdf Signed-off-by: Andrei Stancovici <andrei.stancovici@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: ltc2497: add LTC2499 internal temperature channelAndrei Stancovici
The LTC2499 includes an internal temperature sensor. Expose it as an IIO_TEMP channel with raw, scale and offset. Scale and offset are derived from the reference voltage, so reading them returns an error if firmware does not describe a vref-supply. As this is a new feature on a part that already works without it, failing probe is not an option. Selecting the sensor needs a second command byte, and the part keeps the configuration it last latched unless that byte is sent again. Voltage reads on this part therefore also send the second byte. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/2499fe.pdf Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Andrei Stancovici <andrei.stancovici@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: dac: ad3530r: add support for AD3536RKim Seer Paller
The AD3536R is the 12-bit variant of the AD3532R, a 16-channel buffered voltage output DAC with an on-chip 2.5V reference and an identical register map. Add a chip_info entry for it and the corresponding SPI and OF device ID table entries. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad3532r.pdf Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: light: veml6031x00: add support for events and triggerJavier Carrasco
The device provides a shared interrupt line to notify events and data ready. Add support for configurations with and without an interrupt line, providing events and trigger support when an interrupt line is available. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: light: veml6031x00: add support for triggered buffersJavier Carrasco
Add triggered buffer functionality for the two channels the device provides (ALS and IR). Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: light: add support for veml6031x00 ALS seriesJavier Carrasco
Support device identification, raw ALS and IR readings, and configuration of the scale and integration time. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: accel: adxl367: resolve interrupt mapping before device setupAntoniu Miclaus
adxl367_set_int_map_reg() uses fwnode_irq_get_byname(), which can return -EPROBE_DEFER. Running it after adxl367_setup() made every deferred probe repeat the reset and power the device up needlessly. Move it ahead of the regulator enable and reset; the lookup only reads firmware properties, so a deferral now returns before any hardware access. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: ti-ads1015: Add support for labelFlaviu Nistor
Add support for label sysfs attribute similar to other ADC devices. This is particularly useful because the label can match the schematic signal name, identifying channel voltages easier if label is defined via device tree. Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: use devm-managed IIO device registrationMohammad Shahid
Use devm_iio_device_register() to automatically unregister the IIO device when the device is detached. This removes the manual iio_device_unregister() call and makes the iproc_adc_remove() callback unnecessary. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: use devm-managed mutex initializationMohammad Shahid
Use devm_mutex_init() to tie the mutex lifetime to the device and improve debugging when CONFIG_DEBUG_MUTEXES is enabled. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: use devm-managed ADC cleanupMohammad Shahid
Use devm_add_action_or_reset() to disable the ADC automatically when the device is detached or probe fails. This removes the manual ADC cleanup from the remove and error paths and ties the ADC cleanup to the device lifetime. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: use devm-managed clockMohammad Shahid
Convert the ADC clock to use devm-managed APIs to simplify resource cleanup. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: fix include dependenciesMohammad Shahid
Add the headers required directly by the driver for the APIs and types it uses. Remove the unused linux/io.h header now that register access is handled through regmap APIs. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
5 daysiio: adc: bcm_iproc_adc: sort headers alphabeticallyMohammad Shahid
Sort the Linux kernel headers alphabetically to improve consistency and make the include list easier to maintain. Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: max14001: add missing MODULE_DEVICE_TABLE macroJoshua Crofts
The MAX14001 has an SPI ID table, but does not export it with the MODULE_DEVICE_TABLE(spi, ...) macro. Because of this, SPI-based module autoloading fails on systems that don't use devicetree (e.g. via spi_board_info). Add the missing macro to export the alias information. Fixes: 59795109fa67 ("iio: adc: max14001: New driver") Cc: stable@vger.kernel.org Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: light: isl29028: fix runtime PM reference leak on error pathsFabio Cesari
isl29028_read_raw() and isl29028_write_raw() take a runtime PM reference with pm_runtime_resume_and_get() but return directly on their error paths without dropping it. The usage count never balances again and the device stops entering autosuspend for good. In isl29028_read_raw() this needs a regmap access to fail; in isl29028_write_raw() one rejected sysfs write is enough, for example echo 200 > in_proximity_sampling_frequency which is outside the [1:100] range and returns -EINVAL with the reference still held. Take the reference with PM_RUNTIME_ACQUIRE_AUTOSUSPEND() instead, so it is released on every return path. This also stops the return value of pm_runtime_put_autosuspend() from reaching userspace. That value only says whether the device could be suspended right away, so -EAGAIN or -EPERM turns a successful access into a failure, and with CONFIG_PM=n the stub returns -ENOSYS on every access. Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management support") Suggested-by: Joshua Crofts <joshua.crofts1@gmail.com> Cc: stable@vger.kernel.org Assisted-by: LLM coccinelle Signed-off-by: Fabio Cesari <fabio.cesari@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: expose sampling frequencyCosmin Tanislav
Expose the sampling frequency as a per-channel IIO_CHAN_INFO_SAMP_FREQ to let userspace control conversion time. Each channel conversion takes a fixed 13 ADCLK cycles plus the sample time programmed in ADSSTRn, giving a rate of ADCLK / (13 + ADSSTRn). Read the ADCLK rate from the "adclk" clock to derive the frequency. Claim direct mode while writing so the rate cannot change during a capture. Program the sample time into ADSSTRn for each enabled channel on single reads and on buffer enable. Wait for the maximum amount of time a conversion can take + 1 jiffy for the completion event to come after triggering a single read. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: implement DMA buffer supportCosmin Tanislav
Implement buffered capture using a cyclic DMA transfer into a kfifo buffer to support continuous high-rate sampling. On buffer enable, switch the ADC to continuous conversion mode and start a cyclic DMA transfer over the active channels. Because the DMA controller does not support native scatter-gather, and because of the cyclic DMA setup, transfers must be done in widths covering all the enabled channels. Since DMA transfer width must be a power of two and aligned to its size, cover the smallest power-of-two-aligned group of channel registers spanning the enabled channels. Split the cyclic buffer into fixed-size periods. On each period completion, bump a pending counter and wake a consumer kthread from the DMA callback. For every completed period, gather the enabled channels out of the DMA layout into the scan layout the IIO core expects and push each scan with iio_push_to_buffers(). If the consumer kthread falls behind by a full buffer, drop the oldest periods. Because the DMA transfer must cover all channels between the first and last enabled ones, skip disabled channels while compacting. Also, the DMA controller transfers data in 32-bit words, but the ADC's data registers are 16-bit wide, causing adjacent channel data to be swapped. Swap consecutive channels while compacting to account for this. Allocate the DMA buffer via dma_alloc_noncoherent() and synchronise it per period to allow it to be cached by the CPU while compacting. Disable the completion IRQ for the duration of the DMA transfer, as the ICU does not mask this event from reaching the GIC even if it is being used to drive the DMA capture. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: claim direct mode on single readsCosmin Tanislav
Claim direct mode around the single read to prevent it from conflicting with an ongoing buffered read. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: store the physical address in private stateCosmin Tanislav
To prepare for adding support for DMA-based transfers, store the physical address of the device in struct rzt2h_adc::phys_base. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: store IRQ in private stateCosmin Tanislav
To prepare for adding support for DMA transfers, store the IRQ in private state to disable it while DMA is in progress. The RZ/T2H ICU does not mask the interrupts itself when they are being used for DMA transfers. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: rzt2h: remove unused struct rzt2h_adc::max_channelsCosmin Tanislav
struct rzt2h_adc::max_channels is unused, and is probably a leftover of the devm_iio_adc_device_alloc_chaninfo_se() conversion done after the initial submission. Remove it and the logic used to set it. Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: add settlingtime attributeDavid Lechner (TI)
Add per-channel sysfs attributes for settlingtime and settlingtime_available. These allow adjusting the total settling time for each channel. The value consists of a fixed t_latency time (based on the selected filter_type, oversampling_ratio and sampling_frequency) plus a user-configurable t_delay that determines the value to write to the DELAY field in the registers. The allowable values are non-linear integer multiples, so the step size is just the smallest step size. Writing the attribute will match the closest matching value for the DELAY field with a time equal to or greater than the requested settling time (unless the requested time is larger than the maximum allowable settling time). Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: add filter supportDavid Lechner (TI)
Add support for filter_type, oversampling_ratio and sampling_frequency attributes to the ti-ads112c14 driver. On these chips, these three controls are interdependent and the SPEED_MODE register value has a different meaning depending on the filter type, which makes the interactions a bit complex. As such, the expectation is that the user will set the filter type first, then depending on the filter type, either set the oversampling ratio or the sampling frequency and finally the other of these two. Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: support external clockDavid Lechner (TI)
Add support for an external clock source to the TI ADS112C14 ADC driver. The unused fclk_Hz field is added in preparation for filter support. Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: add burnout current supportDavid Lechner (TI)
Add a custom attribute via ext_info when a channel has a burnout current specified in the devicetree. This adds an in_{voltageY,resistanceY, voltageY-voltageX}_burnoutraw sysfs attribute for the channel that performs a single conversion (same as _raw attribute) except that it enables the burnout current. The chip also has a restriction that input chopping cannot be enabled when burnout current is enabled, so we also disable input chopping when burnout current is active. Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: add continuous mode supportDavid Lechner (TI)
Add support for continuous mode in the TI ADS112C14 ADC driver. In this mode the ADC itself is starting each conversion, so we add a trigger based on the DRDY interrupt to read each sample. This mode is also limited in that only one channel can be enabled at a time since the chip does not have a sequencer or simultaneous sampling capability. Continuous mode will only be used when this new trigger is the current trigger. Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: create data read helper functionsDavid Lechner (TI)
Refactor a few bits of code into helper functions. These will be reused when continuous mode support is added in a later patch. Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
8 daysiio: adc: ti-ads112c14: add DRDY interrupt supportDavid Lechner (TI)
Add handling for the DRDY interrupt to wait for data ready events rather than polling (only when it is wired up). Signed-off-by: David Lechner (TI) <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
11 daysMerge tag 'iio-fixes-for-7.3a' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-linus Jonathan writes: IIO: 1st set of fixes for the 7.3 cycle. A couple of core fixes, the rest usual mix of driver issues that surfaced from merge window until now. core - buffer: Ensure that when using the iio_push_to_buffers_with_ts_unaligned() that the full buffer is zeroed. - trigger: Cancel reenable_work() before freeing the trigger that might be re-enabled. dma-buffer - Fix wrong sizing for a mapped sg_list. If an IOMMU was using a fused entry the mapping might walk off the end. adi,ade9000 - Wait for power up before requesting interrupts. - Fix overlap in scan index for current and voltage channels. - Ensure Phase C dip event included in IRQ1 handler. adi,adf4377 - Initialize all of a clk_init_data. adi,adis* - Ensure debugfs reads are finished before unbind. adi,axi-adc - Initialize mutex. adi,admv1013 - Ensure mutex is intialized before notifier that might use it is registered. - Fix wrong channel field used for read_raw. allwinner,sun4i - Drop a pm_runtime_put() when there was no get. - Ensure correct cleanup on driver probe fail due to any issues with the thermal zone. aspeed,adc, - Don't eat reset deassert errors. awinic,aw96103 - Make sure firmware length is validated rather than blindly trusting it. bosch,bmp280 - Fix out of bounds lookup of sampling frequency due to indexing based on elements in matrix rather than just the correct dimension. invensense,timestamp library - Ensure time estimate doesn't invert wrt to current time in a corner case occasionally seen. kionix,kx022a - Off by one in array boundary check. - Close a memory leak and state corruption in error path. maxim,max1363 - Sign extend bipolar values to ensure correct reporting to userspace. maxim,max30102 - Fix NULL dereference by checking there is data in the FIFO before trying to do anything with it. microchip,mcp47a1 - Ensure highest possible value actually settable. pulsed-light,lidar-lite - Don't leak the IIO device registration if runtime pm setup fails particularly as it was being freed. rockchip,saradc - Fix wrong fallback compatible for rv1106 that lead to trying to use too many channels (correct support will follow next merge window) rohm,bd79124 - Correct limit used for rising alarms. - Fix which registers related to limits are used in initialization. - Apply GPIO mask to allow subset of GPIOs to be toggled. - Add missing regmap error handling in a few places. - Ensures scale is read only. rohm,bm1390 - Don't silently eat a data read error. rohm,bu27034 - Don't silently eat error when reading gain. - Ensure we infinite delay doesn't happen on error. semtech,sx9324 - Fix wrong proximity channel resolution. sharp,gp2ap020a00f - Make sure to drain irq_work in remove path. st,vl5310x - Ensure direct mode is claimed for read_raw avoiding corruption of buffered accesses. vishay,vcnl3020 - Use write bits for ISR mask and ensure right event reported. vti,sca3000 - Fix up a condition check for the frequency divider. xilinx,xadc - Swap registration of cleanup of work with that of irq to ensure that no irqs can cause work that has been freed to be queued. x-powers,axp288 - Add bias override quirk for Haier HV103H. Fix because we used to always override then moved to trusting the firmware setup - which fixed some boards, but broke others. * tag 'iio-fixes-for-7.3a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (42 commits) iio: proximity: vcnl3020: fix ISR bitmask check in IRQ handler iio: proximity: vl53l0x-i2c: claim direct mode for raw reads iio: dac: mcp47a1: Allow full-scale output iio: accel: kionix-kx022a: Prevent memory leak and fix state iio: light: rohm-bu27034: Fix infinite delay on error iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls iio: adc: axp288: Add TS bias override for Haier HV103H dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list iio: inv_sensors: fix estimated value larger than interrupt timestamp iio: adc: aspeed: propagate reset deassert errors iio: buffer-dmaengine: fix sg entry iteration when building dma_vecs iio: proximity: pulsedlight: fix iio_device left registered on PM setup failure iio: trigger: cancel reenable_work before freeing trigger iio: frequency: admv1013: fix wrong channel field used in admv1013_read_raw() iio: accel: sca3000: fix frequency divider condition check iio: admv1013: initialize callback mutex before registering notifier iio: gyro: adis16136: fix unprotected debugfs reads iio: imu: adis16400: fix unprotected debugfs reads ...
12 daysmfd: lm3533: Convert to use OF bindingsSvyatoslav Ryhel
Since there are no users of this driver via platform data, remove the platform data support and switch to using Device Tree bindings. Previously, all cell devices were linked to the parent device. This could cause problems further down the line because the LM3533 has multiple cells of the same type. Using a single phandle to the parent could cause confusion when attempting to reference or call the correct child node. Since this commit adds a dedicated node for every cell, remove linking of the cell to the parent node. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> #for backlight Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> #for-iio Link: https://patch.msgid.link/20260731113632.158440-9-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
12 daysiio: light: lm3533-als: Remove redundant pdata helpersSvyatoslav Ryhel
The lm3533_als_set_input_mode() and lm3533_als_set_resistor() functions are used only in lm3533_als_setup(). Incorporate their code into lm3533_als_setup() directly to simplify driver readability. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Jonathan Cameron <jic23@kernel.org> Link: https://patch.msgid.link/20260731113632.158440-6-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
12 daysmfd: lm3533: Pass only regmap and light sensor presence to child devicesSvyatoslav Ryhel
Instead of passing the entire lm3533 core data structure, only pass the regmap and the light sensor presence flag to child devices. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> #for-iio Link: https://patch.msgid.link/20260731113632.158440-5-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
12 daysmfd: lm3533: Remove driver specific regmap wrappersSvyatoslav Ryhel
Remove driver-specific regmap wrappers in favor of using regmap helpers directly. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> Link: https://patch.msgid.link/20260731113632.158440-3-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
12 daysiio: imu: adis16400: Check return value of spi_setup()Salah Triki
In adis16400_initial_setup(), the return value of spi_setup() was ignored. If SPI configuration fails, the driver would proceed with the initialization anyway, leading to undefined behavior or silent failures during device setup. Check the return value of spi_setup() and return the error code immediately if it fails. Fixes: cd888a17f95f ("staging:iio:adis16400: Use adis library") Signed-off-by: Salah Triki <salah.triki@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
12 daysiio: accel: kionix-kx022a: Fix IPOL macro nameMatti Vaittinen
The "interrupt polarity high"-macro for KX022A variant is defined as: "#define KX022A_MASK_IPOL KX022A_MASK_IPOL1" However, the KX022A_MASK_IPOL1 is not defined anywhere, so actually using the KX022A_IPOL_HIGH would produce a compile error. Fix the define by using correct mask. Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer") Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
12 daysiio: dac: Add AD5529R DAC driver supportJanani Sunil
Add support for AD5529R 16-channel, 12/16 bit Digital to Analog Converter from Analog Devices. The device communicates over SPI and supports per-channel output range configuration. An optional external 4.096V reference can be used in place of the internal reference. Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ad5529r.pdf Signed-off-by: Janani Sunil <janani.sunil@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
12 daysiio: imu: inv_icm42600: fix odr change not caught in certain casesJean-Baptiste Maneyrol
When using both accel and gyro with different frequencies, the ODR change flag in the FIFO header can be sometime in a packet with invalid data. Since we are ignoring these packets, we miss the ODR change and any further change are blocked until sensor is turned off. Fix this by moving the packet data validity check after the ODR change flag check. Fixes: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
12 daysiio: dac: ad3530r: add support for AD5710R/AD5711RKim Seer Paller
Add support for the AD5710R/AD5711R, 8-channel 16-/12-bit configurable IDAC/VDAC parts. They share the AD3530R register map and access model, so fold them into this driver. Each channel is configured as voltage or current output from its DT channel@N node via adi,ch-func, building the iio_chan_spec dynamically. Voltage channels enable VMODE_EN and report the reference-derived scale, current channels report the 50 mA internal Iref scale. The powerdown mode is read-only and derived from the channel's configured type. Signed-off-by: Kim Seer Paller <kimseer.paller@analog.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>