summaryrefslogtreecommitdiff
path: root/drivers/iio/adc
AgeCommit message (Collapse)Author
13 daysMerge tag 'mm-nonmm-stable-2025-05-31-15-28' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull non-MM updates from Andrew Morton: - "hung_task: extend blocking task stacktrace dump to semaphore" from Lance Yang enhances the hung task detector. The detector presently dumps the blocking tasks's stack when it is blocked on a mutex. Lance's series extends this to semaphores - "nilfs2: improve sanity checks in dirty state propagation" from Wentao Liang addresses a couple of minor flaws in nilfs2 - "scripts/gdb: Fixes related to lx_per_cpu()" from Illia Ostapyshyn fixes a couple of issues in the gdb scripts - "Support kdump with LUKS encryption by reusing LUKS volume keys" from Coiby Xu addresses a usability problem with kdump. When the dump device is LUKS-encrypted, the kdump kernel may not have the keys to the encrypted filesystem. A full writeup of this is in the series [0/N] cover letter - "sysfs: add counters for lockups and stalls" from Max Kellermann adds /sys/kernel/hardlockup_count and /sys/kernel/hardlockup_count and /sys/kernel/rcu_stall_count - "fork: Page operation cleanups in the fork code" from Pasha Tatashin implements a number of code cleanups in fork.c - "scripts/gdb/symbols: determine KASLR offset on s390 during early boot" from Ilya Leoshkevich fixes some s390 issues in the gdb scripts * tag 'mm-nonmm-stable-2025-05-31-15-28' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (67 commits) llist: make llist_add_batch() a static inline delayacct: remove redundant code and adjust indentation squashfs: add optional full compressed block caching crash_dump, nvme: select CONFIGFS_FS as built-in scripts/gdb/symbols: determine KASLR offset on s390 during early boot scripts/gdb/symbols: factor out pagination_off() scripts/gdb/symbols: factor out get_vmlinux() kernel/panic.c: format kernel-doc comments mailmap: update and consolidate Casey Connolly's name and email nilfs2: remove wbc->for_reclaim handling fork: define a local GFP_VMAP_STACK fork: check charging success before zeroing stack fork: clean-up naming of vm_stack/vm_struct variables in vmap stacks code fork: clean-up ifdef logic around stack allocation kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count kernel/watchdog: add /sys/kernel/{hard,soft}lockup_count x86/crash: make the page that stores the dm crypt keys inaccessible x86/crash: pass dm crypt keys to kdump kernel Revert "x86/mm: Remove unused __set_memory_prot()" crash_dump: retrieve dm crypt keys in kdump kernel ...
2025-05-27Merge tag 'irq-cleanups-2025-05-25' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull irq cleanups from Thomas Gleixner: "A set of cleanups for the generic interrupt subsystem: - Consolidate on one set of functions for the interrupt domain code to get rid of pointlessly duplicated code with only marginal different semantics. - Update the documentation accordingly and consolidate the coding style of the irqdomain header" * tag 'irq-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) irqdomain: Consolidate coding style irqdomain: Fix kernel-doc and add it to Documentation Documentation: irqdomain: Update it Documentation: irq-domain.rst: Simple improvements Documentation: irq/concepts: Minor improvements Documentation: irq/concepts: Add commas and reflow irqdomain: Improve kernel-docs of functions irqdomain: Make struct irq_domain_info variables const irqdomain: Use irq_domain_instantiate()'s return value as initializers irqdomain: Drop irq_linear_revmap() pinctrl: keembay: Switch to irq_find_mapping() irqchip/armada-370-xp: Switch to irq_find_mapping() gpu: ipu-v3: Switch to irq_find_mapping() gpio: idt3243x: Switch to irq_find_mapping() sh: Switch to irq_find_mapping() powerpc: Switch to irq_find_mapping() irqdomain: Drop irq_domain_add_*() functions powerpc: Switch irq_domain_add_nomap() to use fwnode thermal: Switch to irq_domain_create_linear() soc: Switch to irq_domain_create_*() ...
2025-05-21mailmap: update and consolidate Casey Connolly's name and emailCasey Connolly
I've used several email addresses and a previous name to contribute. Consolidate all of these to my primary email and update my name. Link: https://lkml.kernel.org/r/20250517223237.15647-2-casey.connolly@linaro.org Signed-off-by: Casey Connolly <casey.connolly@linaro.org> Cc: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-05-16iio: Switch to irq_domain_create_simple()Jiri Slaby (SUSE)
irq_domain_add_simple() is going away as being obsolete now. Switch to the preferred irq_domain_create_simple(). That differs in the first parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter. Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW). [ tglx: Fix up subject prefix ] Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250319092951.37667-21-jirislaby@kernel.org
2025-04-21iio: adc: ad7606: fix serial register accessAngelo Dureghello
Fix register read/write routine as per datasheet. When reading multiple consecutive registers, only the first one is read properly. This is due to missing chip select deassert and assert again between first and second 16bit transfer, as shown in the datasheet AD7606C-16, rev 0, figure 110. Fixes: f2a22e1e172f ("iio: adc: ad7606: Add support for software mode for ad7616") Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250418-wip-bl-ad7606-fix-reg-access-v3-1-d5eeb440c738@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-18iio: adc: ad7266: Fix potential timestamp alignment issue.Jonathan Cameron
On architectures where an s64 is only 32-bit aligned insufficient padding would be left between the earlier elements and the timestamp. Use aligned_s64 to enforce the correct placement and ensure the storage is large enough. Fixes: 54e018da3141 ("iio:ad7266: Mark transfer buffer as __be16") # aligned_s64 is much newer. Reported-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250413103443.2420727-2-jic23@kernel.org Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-18iio: adc: ad7768-1: Fix insufficient alignment of timestamp.Jonathan Cameron
On architectures where an s64 is not 64-bit aligned, this may result insufficient alignment of the timestamp and the structure being too small. Use aligned_s64 to force the alignment. Fixes: a1caeebab07e ("iio: adc: ad7768-1: Fix too small buffer passed to iio_push_to_buffers_with_timestamp()") # aligned_s64 newer Reported-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250413103443.2420727-3-jic23@kernel.org Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-18iio: adc: dln2: Use aligned_s64 for timestampJonathan Cameron
Here the lack of marking allows the overall structure to not be sufficiently aligned resulting in misplacement of the timestamp in iio_push_to_buffers_with_timestamp(). Use aligned_s64 to force the alignment on all architectures. Fixes: 7c0299e879dd ("iio: adc: Add support for DLN2 ADC") Reported-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250413103443.2420727-4-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-12iio: adc: qcom-spmi-iadc: Fix wakeup source leaks on device unbindKrzysztof Kozlowski
Device can be unbound, so driver must also release memory for the wakeup source. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250406-b4-device-wakeup-leak-iio-v1-2-2d7d322a4a93@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-07iio: adc: ad7380: fix event threshold shiftDavid Lechner
Add required bit shift to the event threshold read function to get correct scaling. When alert support was added, the write function correctly included the required shift needed to convert the threshold register value to the same scale as the raw ADC value. However, the shift got missed in the read function. Fixes: 27d1a4dbe1e1 ("iio: adc: ad7380: add alert support") Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Julien Stephan <jstephan@baylibre.com> Link: https://patch.msgid.link/20250402-iio-adc-ad7380-fix-event-threshold-shift-v1-1-ad4975c296b2@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-07iio: adc: ad7606: check for NULL before calling sw_mode_config()David Lechner
Check that the sw_mode_config function pointer is not NULL before calling it. Not all buses define this callback, which resulted in a NULL pointer dereference. Fixes: e571c1902116 ("iio: adc: ad7606: move scale_setup as function pointer on chip-info") Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250318-iio-adc-ad7606-improvements-v2-1-4b605427774c@baylibre.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-07iio: adc: ad7380: disable offload before using SPI busDavid Lechner
Move disabling of the SPI offload before attempting to use the SPI bus to write a register in ad7380_offload_buffer_predisable(). This caused a crash in the spi_engine_irq() interrupt handler due to being in an invalid state. Fixes: bbeaec81a03e ("iio: ad7380: add support for SPI offload") Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250320-iio-adc-ad7380-fix-spi-offload-buffer-predisable-v1-1-6912ac8c0ae0@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-07iio: adc: rockchip: Fix clock initialization sequenceSimon Xue
clock_set_rate should be executed after devm_clk_get_enabled. Fixes: 97ad10bb2901 ("iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled") Signed-off-by: Simon Xue <xxm@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20250312062016.137821-1-xxm@rock-chips.com Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-04-01Merge tag 'char-misc-6.15-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char / misc / IIO driver updates from Greg KH: "Here is the big set of char, misc, iio, and other smaller driver subsystems for 6.15-rc1. Lots of stuff in here, including: - loads of IIO changes and driver updates - counter driver updates - w1 driver updates - faux conversions for some drivers that were abusing the platform bus interface - coresight driver updates - rust miscdevice binding updates based on real-world-use - other minor driver updates All of these have been in linux-next with no reported issues for quite a while" * tag 'char-misc-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (292 commits) samples: rust_misc_device: fix markup in top-level docs Coresight: Fix a NULL vs IS_ERR() bug in probe misc: lis3lv02d: convert to use faux_device tlclk: convert to use faux_device regulator: dummy: convert to use the faux device interface bus: mhi: host: Fix race between unprepare and queue_buf coresight: configfs: Constify struct config_item_type doc: iio: ad7380: describe offload support iio: ad7380: add support for SPI offload iio: light: Add check for array bounds in veml6075_read_int_time_ms iio: adc: ti-ads7924 Drop unnecessary function parameters staging: iio: ad9834: Use devm_regulator_get_enable() staging: iio: ad9832: Use devm_regulator_get_enable() iio: gyro: bmg160_spi: add of_match_table dt-bindings: iio: adc: Add i.MX94 and i.MX95 support iio: adc: ad7768-1: remove unnecessary locking Documentation: ABI: add wideband filter type to sysfs-bus-iio iio: adc: ad7768-1: set MOSI idle state to prevent accidental reset iio: adc: ad7768-1: Fix conversion result sign iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config() ...
2025-03-29Merge tag 'pinctrl-v6.15-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control updates from Linus Walleij: "Core changes: - None really. New drivers: - AMD ISP411 "AMD ISP" driver - Exynos 2200 and 7870 SoC subdrivers - Sophgo RISC-V SG2042 and SG2044 subdrivers - Amlogic A4 subdriver - Rockchip RK3528 subdriver - Broadcom BCM21664 subdriver - Allwinner A523/T527 subdriver - Ingenic X1600 subdriver - Microchip SAMA7D65 subdriver, essentially a re-branded Atmel AT91 PIO4 driver, but nowadays a Microschip SoC line Improvements: - Bring in the devm_kmemdup_array() helper and use it throughout, also bring in changes to other subsystems for this to establish this helper - Support EGPIO on the Qualcomm SA8775P SoC - Extend EINT support in the Mediatek driver" * tag 'pinctrl-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (101 commits) pinctrl: mediatek: Add EINT support for multiple addresses pinctrl: amlogic-a4: Drop surplus semicolon pinctrl: nuvoton: Reduce use of OF-specific APIs pinctrl: nuvoton: Convert to use struct group_desc pinctrl: nuvoton: Make use of struct pinfunction and PINCTRL_PINFUNCTION() pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP() pinctrl: npcm8xx: Fix incorrect struct npcm8xx_pincfg assignment pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group() pinctrl: PINCTRL_AMDISP should depend on DRM_AMD_ISP pinctrl: qcom: sa8775p: Enable egpio function dt-bindings: pinctrl: qcom: Add egpio function for sa8775p pinctrl: qcom: tlmm-test: Validate irq_enable delivers edge irqs pinctrl: qcom: Clear latched interrupt status when changing IRQ type dt-bindings: pinctrl: airoha: Add missing gpio-ranges property pinctrl: bcm281xx: Add missing assignment in bcm21664_pinctrl_lock_all() pinctrl: amd: isp411: Fix IS_ERR() vs NULL check in probe() dt-bindings: pinctrl: at91-pio4: add microchip,sama7d65-pinctrl pinctrl: tegra: Set SFIO mode to Mux Register pinctrl-tegra: Restore SFSEL bit when freeing pins pinctrl: tegra: Add descriptions for SoC data fields ...
2025-03-25Merge tag 'timers-cleanups-2025-03-23' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer cleanups from Thomas Gleixner: "A treewide hrtimer timer cleanup hrtimers are initialized with hrtimer_init() and a subsequent store to the callback pointer. This turned out to be suboptimal for the upcoming Rust integration and is obviously a silly implementation to begin with. This cleanup replaces the hrtimer_init(T); T->function = cb; sequence with hrtimer_setup(T, cb); The conversion was done with Coccinelle and a few manual fixups. Once the conversion has completely landed in mainline, hrtimer_init() will be removed and the hrtimer::function becomes a private member" * tag 'timers-cleanups-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits) wifi: rt2x00: Switch to use hrtimer_update_function() io_uring: Use helper function hrtimer_update_function() serial: xilinx_uartps: Use helper function hrtimer_update_function() ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup() RDMA: Switch to use hrtimer_setup() virtio: mem: Switch to use hrtimer_setup() drm/vmwgfx: Switch to use hrtimer_setup() drm/xe/oa: Switch to use hrtimer_setup() drm/vkms: Switch to use hrtimer_setup() drm/msm: Switch to use hrtimer_setup() drm/i915/request: Switch to use hrtimer_setup() drm/i915/uncore: Switch to use hrtimer_setup() drm/i915/pmu: Switch to use hrtimer_setup() drm/i915/perf: Switch to use hrtimer_setup() drm/i915/gvt: Switch to use hrtimer_setup() drm/i915/huc: Switch to use hrtimer_setup() drm/amdgpu: Switch to use hrtimer_setup() stm class: heartbeat: Switch to use hrtimer_setup() i2c: Switch to use hrtimer_setup() iio: Switch to use hrtimer_setup() ...
2025-03-14Merge tag 'iio-for-6.15a' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next Jonathan writes: IIO: New device support, features and cleanup for the 6.15 cycle. The usual mixture of new drivers, support in existing drivers for new devices, a range of features and general subsystem cleanup. Two merges of immutable branches in here: * SPI offload support. Culmination of a long effort to bring the ability to offload triggered sequences of SPI operations to specific hardware, allow high datarate acquisition over an SPI bus (if you have the right hardware / FPGA firmware) * GPIO set-array-helper - enables code simplification. New device support ================== adi,ad3552r-hs: - Add support for AD3541r and AD3542r via newly supported FPGA HDL. adi,ad4030 - New driver supporting the AD4030, AD4630 AD4630-16, AD4640-24, AD4632-16, AD4632-24 1 and 2 channel high precision SPI ADCs. adi,ad4851 - New driver and backend support for the AD4851, AD4852, AD4853, AD4854, AD4855, AD4846, AD4857, AD4858 and AD4858I high speed multichannel simultaneous sampling ADCs. adi,ad7191 - New driver for this 24-bit ADC for precision bridge applications, adi,ad7380 - Add support for the adaq4381-4 which is a 14-bit version of the already supported adaq4380-1 adi,adis16550 - New driver using the ADIS library (which needed extensions) for this IMU. brcm,apds9160 - New driver for this proximity and ambient light sensor. dynaimage,al3000a - New driver for this illuminance sensor. mcube,mc3230 - Add support for the mc3510c accelerometer with a different scale to existing supported parts (some rework preceded this) nxp,imx93 - Add compatibles for imx94 and imx95 which are fully compatible with imx93. rockchip,saradc - Add support for the RK3528 ADC - Add support for the RK3562 ADC silab,si7210 - New driver to support this I2C Hall effect magnetic position sensor. ti,ads7138 - New driver supporting the ADS7128 and AD7138 I2C ADCs. Staging driver drop =================== adi,adis16240 - Drop this impact sensor. Interesting part but complex hence never left staging due to ABI challenges. No longer readily available so drop driver. New features ============ Documentation - A really nice overview document introduce ADC terminology and how it maps to IIO. core - New description for FAULT events, used in the ad7173. - filter_type ABI used in ad4130. buffer-dmaengine - Split DMA channel request from buffer allocation (for SPI offload) - Add a new _with_handle setup variant. (for SPI offload) adi,adf4371 - Add control of reference clock type and support for frequency doubling where appropriate. adi,ad4695 - Support SPI offload. - Support oversampling control. adi,ad5791 - Support SPI offload. adi,ad7124 - Add channel calibration support. adi,ad7380: - Alert support (threshold interrupts) - SPI offload support. adi,ad7606 - Support writing registers when using backend enabling software control of modes. adi,ad7944 - Support SPI offload. adi,ad9832 - Use devm_regulator_get_enable() to simplify code. adi,ad9834 - Use devm_regulator_get_enable() to simplify code. adi,adxl345 - Improve IRQ handling code. - Add debug access to registers. bosch,bmi270 - Add temperature channel support. - Add data ready trigger. google,cross_ec - Add trace events. mcube,mc3230 - Add mount matrix support - Add an OF match table. Cleanup and minor bug fixes =========================== Tree wide: - Stop using iio_device_claim_direct_scoped() and introduce sparse friendly iio_device_claim/release_direct() The conditional scoped cleanup has proved hard to deal with, requiring workarounds for various compiler issues and in is rather non-intuitive so abandon that experiment. One of the attractions of that approach was that it made it much harder to have unbalanced claim/release bugs so instead introduce a conditional-lock style boolean returning new pair of functions. These are inline in the header and have __acquire and __release calls allowing sparse to detect lack of balance. There are occasional false positives but so far those have reflected complex code paths that benefited from cleanup anyway. The first set of driver conversions are in this pull request, more to follow next cycle. Various related cleanup in drivers. Removal of the _scoped code is completed and the definition removed. - Use of str_enable_disable() and similar helpers. - Don't set regmap cache to REGCACHE_NONE as that's the default anyway. - Change some caches from RBTREE to MAPLE reflecting best practice. - Use the new gpiod_multi_set_value_cansleep() - Make sure to grab direct mode for some calibrations paths. - Avoid using memcmp on structures when checking for matching channel configs. Instead just match field by field. dt-bindings: - Fix up indentation inconsistencies. gts-helper: - Simplify building of available scale table. adi,ad-sigma-delta - Make sure to disable channel after calibration done. - Add error handling in configuring channel during calibration. adi,ad2s1201 - use a bitmap_write() rather than directly accessing underlying storage. adi,ad3552r-hs - Fix a wrong error message. - Make sure to use instruction mode for configuration. adi,ad4695 - Add a conversion to ensure exit from conversion mode. - Use custom regmap to handle required sclk rate change. - Fix an out of bounds array access - Simplify oversampling ratio handling. adi,ad4851 - Fix a sign bug. adi,ad5791 - Fix wrong exported number of storage bits. adi,ad7124 - Disable all channels at probe to avoid strange initial configurations. adi,ad7173 - Rework to allow static const struct ad_sigma_delta without need to make a copy. adi,ad7623 - Drop a BSD license tag that the authors consider unnecessary. adi,ad7768-1 - Fix channels sign description exposed to user space. - Set MOSI idle state to avoid accidental device reset. - Avoid some overkill locking. adi,axi-dac - Check if device interface is busy when enabling data stream. - Add control of bus mode. bosch,bmi270 - Move a struct definition to a c file as only used there. vishay,veml6030 - Enable regmap cache to reduce bus traffic. - Fix ABI bug around scale reporting. vishay,vem6075 - Check array bounds to harden against broken hardware. Various other minor tweaks and fixes not called out. * * tag 'iio-for-6.15a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (223 commits) doc: iio: ad7380: describe offload support iio: ad7380: add support for SPI offload iio: light: Add check for array bounds in veml6075_read_int_time_ms iio: adc: ti-ads7924 Drop unnecessary function parameters staging: iio: ad9834: Use devm_regulator_get_enable() staging: iio: ad9832: Use devm_regulator_get_enable() iio: gyro: bmg160_spi: add of_match_table dt-bindings: iio: adc: Add i.MX94 and i.MX95 support iio: adc: ad7768-1: remove unnecessary locking Documentation: ABI: add wideband filter type to sysfs-bus-iio iio: adc: ad7768-1: set MOSI idle state to prevent accidental reset iio: adc: ad7768-1: Fix conversion result sign iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ad7124_parse_channel_config() iio: adc: ad7124: Implement system calibration iio: adc: ad7124: Implement internal calibration at probe time iio: adc: ad_sigma_delta: Add error checking for ad_sigma_delta_set_channel() iio: adc: ad4130: Adapt internal names to match official filter_type ABI iio: adc: ad7173: Fix comparison of channel configs iio: adc: ad7124: Fix comparison of channel configs iio: adc: ad4130: Fix comparison of channel setups ...
2025-03-11iio: ad7380: add support for SPI offloadAngelo Dureghello
Add support for SPI offload to the ad7380 driver. SPI offload allows sampling data at the max sample rate (2MSPS with one SDO line). This is developed and tested against the ADI example FPGA design for this family of ADCs [1]. [1]: http://analogdevicesinc.github.io/hdl/projects/ad738x_fmc/index.html Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250310-wip-bl-spi-offload-ad7380-v4-1-b184b37b7c72@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ti-ads7924 Drop unnecessary function parametersMatti Vaittinen
Device pointer is the only variable which is used by the ads7924_get_channels_config() and which is declared outside this function. Still, the function gets the iio_device and i2c_client as parameters. The sole caller of this function (probe) already has the device pointer which it can directly pass to the function. Simplify code by passing the device pointer directly as a parameter instead of digging it from the iio_device's private data. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/2bb4c61122eca2f3a35f6087e7d9815675013f66.1740993491.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7768-1: remove unnecessary lockingJonathan Santos
The current locking is only preventing a triggered buffer Transfer and a debugfs register access from happening at the same time. If a register access happens during a buffered read, the action is doomed to fail anyway, since we need to write a magic value to exit continuous read mode. Remove locking from the trigger handler and use iio_device_claim_direct() instead in the register access function. Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Link: https://patch.msgid.link/d0450b7c5d8467e54913ef905f6147baa2b866b3.1741268122.git.Jonathan.Santos@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7768-1: set MOSI idle state to prevent accidental resetJonathan Santos
Datasheet recommends Setting the MOSI idle state to high in order to prevent accidental reset of the device when SCLK is free running. This happens when the controller clocks out a 1 followed by 63 zeros while the CS is held low. Check if SPI controller supports SPI_MOSI_IDLE_HIGH flag and set it. Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Link: https://patch.msgid.link/c2a2b0f3d54829079763a5511359a1fa80516cfb.1741268122.git.Jonathan.Santos@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7768-1: Fix conversion result signSergiu Cuciurean
The ad7768-1 ADC output code is two's complement, meaning that the voltage conversion result is a signed value.. Since the value is a 24 bit one, stored in a 32 bit variable, the sign should be extended in order to get the correct representation. Also the channel description has been updated to signed representation, to match the ADC specifications. Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt@analog.com> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Cc: <Stable@vger.kernel.org> Link: https://patch.msgid.link/505994d3b71c2aa38ba714d909a68e021f12124c.1741268122.git.Jonathan.Santos@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7124: Benefit of dev = indio_dev->dev.parent in ↵Uwe Kleine-König
ad7124_parse_channel_config() Since commit a6eaf02b8274 ("iio: adc: ad7124: Switch from of specific to fwnode based property handling") the function ad7124_parse_channel_config() has a parameter `dev` that holds the value `indio_dev->dev.parent`. Make use of that to shorten two code lines. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/v7l2skqj65vbku3ebjsfndfj3atl6iqpodamios2do6q6kcagf@whmuir6fwede Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7124: Implement system calibrationUwe Kleine-König
Allow triggering both zero-scale and full-scale calibration via sysfs in the same way as it's done for ad7173. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-18-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7124: Implement internal calibration at probe timeUwe Kleine-König
Use the calibration function provided by the ad_sigma_delta shim to calibrate all channels at probe time. For measurements with gain 1 (i.e. if CONFIG_x.PGA = 0) full-scale calibrations are not supported and the reset default value of the GAIN register is supposed to be used then. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-17-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad_sigma_delta: Add error checking for ad_sigma_delta_set_channel()Uwe Kleine-König
All other calls to ad_sigma_delta_set_channel() in ad_sigma_delta.c check the return value afterwards. Do it for all calls. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-16-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad4130: Adapt internal names to match official filter_type ABIUwe Kleine-König
Recently the interface to to select a filter was officially blessed to use "filter_type". Adapt the naming of several functions accordingly to make the new standard more present and so make the driver a better template for other drivers. Apart from the comment update this is just s/filter_mode/filter_type/. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-15-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7173: Fix comparison of channel configsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7173_channel_config::config_props is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-14-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7124: Fix comparison of channel configsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad7124_channel_config::config_props is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 7b8d045e497a ("iio: adc: ad7124: allow more than 8 channels") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-13-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad4130: Fix comparison of channel setupsUwe Kleine-König
Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a static_assert guard to (somewhat) ensure that when struct ad4130_setup_info is expanded, the comparison is adapted, too. This issue is somewhat theoretic, but using memcmp() on a struct is a bad pattern that is worth fixing. Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-12-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad_sigma_delta: Disable channel after calibrationUwe Kleine-König
The function ad_sd_calibrate() enables the channel to calibrate at function entry but doesn't disable it on exit. This is problematic because if two (or more) channels are calibrated in a row, the second calibration isn't executed as intended as the first (still enabled) channel is recalibrated and after the first irq (i.e. when the calibration of the first channel completed) the calibration is aborted. This currently affects ad7173 only, as the other drivers using ad_sd_calibrate() never have more than one channel enabled at a time. To fix this, disable the calibrated channel after calibration. Fixes: 031bdc8aee01 ("iio: adc: ad7173: add calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20250303114659.1672695-11-u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-11iio: adc: ad7191: add AD7191Alisa-Dariana Roman
AD7191 is a pin-programmable, ultra-low noise 24-bit sigma-delta ADC designed for precision bridge sensor measurements. It features two differential analog input channels, selectable output rates, programmable gain, internal temperature sensor and simultaneous 50Hz/60Hz rejection. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com> Reviewed-by: David Lechner<dlechner@baylibre.com> Link: https://patch.msgid.link/20250228141327.262488-3-alisa.roman@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-05iio: adc: ad7192: Grab direct mode for calibrationUwe Kleine-König
While a calibration is running, better don't make the device do anything else. To enforce that, grab direct mode during calibration. Fixes: 42776c14c692 ("staging: iio: adc: ad7192: Add system calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/8aade802afca6a89641e24c1ae1d4b8d82cff58d.1740655250.git.u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-05iio: adc: ad7173: Grab direct mode for calibrationUwe Kleine-König
While a calibration is running, better don't make the device do anything else. To enforce that, grab direct mode during calibration. Fixes: 031bdc8aee01 ("iio: adc: ad7173: add calibration support") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/8319fa2dc881c9899d60db4eba7fe8e984716617.1740655250.git.u.kleine-koenig@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad7380: add adaq4381-4 supportJulien Stephan
adaq4381-4 is the 14 bits version of adaq4380-1 chip. Add support for it. Signed-off-by: Julien Stephan <jstephan@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250226-ad7380-add-adaq4381-4-support-v1-1-f350ab872d37@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: rockchip_saradc: add rk3562Simon Xue
rk3562 is using v2 saradc with 8 channels. Signed-off-by: Simon Xue <xxm@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Link: https://patch.msgid.link/20250227110343.2342017-2-kever.yang@rock-chips.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4030: fix error pointer dereference in probe()Dan Carpenter
The intention here was obviously to return an error if devm_regmap_init() fails, but the return statement was accidentally left out. This leads to an error pointer dereference when we call: ret = ad4030_detect_chip_info(st); Add the return statement. Fixes: ec25cf6f1ee3 ("iio: adc: ad4030: add support for ad4632-16 and ad4632-24") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/cc67cee7-9c65-46d2-aae3-f860fc3cc461@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: rockchip_saradc: Add support for RK3528Jonas Karlman
The Successive Approximation ADC (SARADC) in RK3528 uses the v2 controller and support: - 10-bit resolution - Up to 1MS/s sampling rate - 4 single-ended input channels - Current consumption: 0.5mA @ 1MS/s Add support for the 4 channels of 10-bit resolution supported by SARADC in RK3528. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20250227184058.2964204-3-jonas@kwiboo.se Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4851: Fix signedness bug in ad4851_calibrate()Dan Carpenter
The "c" variable is used to store error codes from ad4851_find_opt() so it has to be signed for the error handling to work. Change it to type int. Fixes: 6250803fe2ec ("iio: adc: ad4851: add ad485x driver") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/f5e260e9-d7a8-4dae-b7ea-f1bbb1760e60@stanley.mountain Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: Include cleanup.h when using guard()Matti Vaittinen
Directly include the cleanup.h for the guard() instead of relying it to be included via other files. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/5b352ce7241e5904a317dd26950c7cd4daa59fc0.1740748394.git.mazziesaccount@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4695: simplify getting oversampling_ratioDavid Lechner
We already have a local variable that holds a pointer to st->channels_cfg[chan->scan_index]. Use that to simplify the code. Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-2-57fef8c7a3fd@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: ad4695: fix out of bounds array accessDavid Lechner
Fix some out of bounds array access of st->channels_cfg in the ad4695 driver. This array only has elements for voltage channels, but it was also being accessed for the temperature channel in a few cases causing reading past the end of the array. In some cases, this was harmless because the value was read but not used. However, the in_temp_sampling_frequency attribute shares code with the in_voltageY_sampling_frequency attributes and was trying to read the oversampling ratio from the st->channels_cfg array. This resulted in a garbage value being used in the calculation and the resulting in_temp_sampling_frequency value was incorrect. To fix, make sure we always check that we are dealing with a voltage channel before accessing the st->channels_cfg array and use an oversampling ratio of 1 for the temperature channel (multiplicative identity value) since that channel doesn't support oversampling. Fixes: 67d63185db79 ("iio: adc: ad4695: add offload-based oversampling support") Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250218-iio-adc-ad4695-fix-out-of-bounds-array-access-v1-1-57fef8c7a3fd@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: adi-axi-adc: replace of.h with mod_devicetable.hNuno Sá
Don't use of.h in order to include mod_devicetable.h. Use it directly as there no direct dependency on OF. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250218-dev-axi-adc-fix-headers-v1-1-5ddc79221d8c@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
Single patch for all the relatively simple cases. These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Olivier Moysan <olivier.moysan@foss.st.com> Cc: Phil Reid <preid@electromag.com.au> Reviewed-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-30-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max11410: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-27-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max11410: Factor out writing of sampling frequency to simplify ↵Jonathan Cameron
errro paths. Introduce __max11410_write_samp_freq() helper and use guard() to avoid need for manual unlock of the mutex. This allows direct returns and simplifies the resulting error handling. Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-26-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max1027: Switch to sparse friendly iio_device_claim/release_direct()Jonathan Cameron
These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20250217141630.897334-25-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: max1027: Move claim of direct mode up one level and use guard()Jonathan Cameron
Move iio_device_claim_direct_mode() into the read_raw() callback and use guard() to release a mutex. This enables simpler error handling via direct returns. Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20250217141630.897334-24-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: at91-sama5d2: Switch to sparse friendly ↵Jonathan Cameron
iio_device_claim/release_direct() These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://patch.msgid.link/20250217141630.897334-23-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2025-03-04iio: adc: at91-sama5d2: Move claim of direct mode up a level and use guard()Jonathan Cameron
Move iio_device_claim_direct_mode() up one layer in the call stack, and use guard() for scope based unlocking to simplify error handling by allowing direct returns. Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> Link: https://patch.msgid.link/20250217141630.897334-22-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>