Commit Graph

10139 Commits

Author SHA1 Message Date
Kees Cook
3a2c4d55e3 treewide: refresh kmalloc_obj() conversions
This is another run of the Coccinelle script for converting kmalloc()
family of allocations to kmalloc_obj() via the existing rules in
scripts/coccinelle/api/kmalloc_objs.cocci

This catches both the set of kmalloc() uses added since the first
kmalloc_obj() conversions in v7.0 and adds a large group missed in the
first pass due to Coccinelle not interacting well with the cleanup.h
scoped_...() family of macros[1]. I worked around this with spatch's
"--macro-file" argument to a file with all the scoped_...() macros mapped
to Coccinelle's YACFE_ITERATOR[2] as that was the closest viable control
flow indicator I could find.

Build tested allmodconfig on x86, arm64, arm, loongarch, mips, powerpc,
riscv, and s390 with no new warnings.

Link: https://lore.kernel.org/lkml/202609021314.8A9C0B8@keescook/ [1]
Link: https://github.com/coccinelle/coccinelle/blob/master/standard.h [2]
Signed-off-by: Kees Cook <kees+treewide@kernel.org>
2026-09-04 21:37:00 -07:00
Linus Torvalds
b81e341319 More thermal control updates for 7.3-rc1
- Fix missing bitfield include headers in Armada and QCom SPM BMG
    drivers (Daniel Lezcano)
 
  - Fix missed file when manually applying a change after a conflict
    resolution for the QCom SPMI ADC TM5 Gen3 (Daniel Lezcano)
 
  - Move thermal_zone_device_enable() to the right place in order to
    prevent calling it if the thermal zone registration failed (Dan
    Carpenter)
 
  - Improve bitfield manipulations on Armada (Bryan B. Lima)
 
  - Remove unneeded 'fast_io' on Sun8i and Armada (Wolfram Sang)
 
  - Fix wrong boundary when clamping the low values in the set_trips()
    callback and fix wrong mask when setting the temperature interval on
    Airoha (Christian Marangi)
 
  - Make use of the regmap API to support Airoha AN7583 (Christian
    Marangi)
 
  - Fix adc_tm5_get_temp() return check value on the QCom SPMI ADC
    sensor (Rakesh Kota)
 
  - Fix unbalanced clock enablement when the resume fails on the iMX
    driver (Can Peng)
 
  - Add Qualcomm Master BandGap thermal monitor support (Satya Priya
    Kakitapalli)
 
  - Add Maili Temperature bindings compatible (Haritha S K)
 
  - Add a devm action to clean hardware interrupts, sampling, and
    control registers on Spacemit K1 (Pei Xiao)
 
  - Fix trivial typo in a thermal OF code comment (Marek Vasut)
 
  - Remove unnecessary print on Qcom SPMI ADC driver when a call to
    devm_request_threaded_irq() fails as this one already prints a
    message (Jishnu Prakash)
 
  - Add support for QCom PMIC5 Gen3 ADC by using auxiliary driver and
    shared interrupt with the IIO driver (Jishnu Prakash)
 
  - Make resets optional on MT8196 and add the corresponding property in
    the DT bindings (AngeloGioacchino Del Regno)
 
  - Fix clock staying enabled on failing resume operation on Qoriq (Can
    Peng)
 
  - Fix wrong closing brace position in thermal library header (Andreas
    Haufler)
 
  - Fix low and high trip point validation by moving the check after the
    clamp on the spacemit driver (surendra)
 
  - Remove redundant error messages on IRQ request failure (Pan Chuang)
 
  - Add IIO_CONSUMER namespace import to the qcom-spmi-mbg-tm thermal
    driver to avoid modpost warnings that would appear after merging the
    iio tree against the thermal updates (Nathan Chancellor)
 
  - Revert two recent cosmetic updates of the thermal core conflicting
    with driver core plans to eliminate class_create() (Rafael Wysocki)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmqPL7YSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO1IigH/iBFLcPxeH8fHHMHGNyOwYB2mEJ5NUyO
 nJCxvNdmoLqtj12xpfhzSviK0rczFcJD4YGztH7ExbP30gPR3mhG8fo2nEDp8JUK
 EOqzo9rzGwENIt1FFGmh6r/e0KMJNP8UwWQr17NJEcoRfrAEEN1kZ5Xl40excQHB
 WtKWfYWaICZwmt1u3v2QEWFZJEPovTb9d1Z1ekCdYdmKHq1kn4CCYWhSdFPyCPpL
 QjDaIoN2TuRRe5jMEtBqRtdjWo1UyCjc5I+Vz9+mCCOlgMWagizP4Qc+qsBJ9UfA
 vY46s+RFTyISIQ9eHnHdiIYdLlnoweS5wsGqiBXmncrvVOH8u3GBYfw=
 =e7sH
 -----END PGP SIGNATURE-----

Merge tag 'thermal-7.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more thermal control updates from Rafael Wysocki:
 "This mostly consists of assorted updates of thermal drivers, including
  new hardware support (Airoha AN7583, Qualcomm Master BandGap thermal
  monitor, QCom PMIC5 Gen3 ADC), but it also includes two reverts of
  recent cosmetic thermal core updates that went against driver core
  plans to eliminate class_create():

   - Fix missing bitfield include headers in Armada and QCom SPM BMG
     drivers (Daniel Lezcano)

   - Fix missed file when manually applying a change after a conflict
     resolution for the QCom SPMI ADC TM5 Gen3 (Daniel Lezcano)

   - Move thermal_zone_device_enable() to the right place in order to
     prevent calling it if the thermal zone registration failed (Dan
     Carpenter)

   - Improve bitfield manipulations on Armada (Bryan B. Lima)

   - Remove unneeded 'fast_io' on Sun8i and Armada (Wolfram Sang)

   - Fix wrong boundary when clamping the low values in the set_trips()
     callback and fix wrong mask when setting the temperature interval
     on Airoha (Christian Marangi)

   - Make use of the regmap API to support Airoha AN7583 (Christian
     Marangi)

   - Fix adc_tm5_get_temp() return check value on the QCom SPMI ADC
     sensor (Rakesh Kota)

   - Fix unbalanced clock enablement when the resume fails on the iMX
     driver (Can Peng)

   - Add Qualcomm Master BandGap thermal monitor support (Satya Priya
     Kakitapalli)

   - Add Maili Temperature bindings compatible (Haritha S K)

   - Add a devm action to clean hardware interrupts, sampling, and
     control registers on Spacemit K1 (Pei Xiao)

   - Fix trivial typo in a thermal OF code comment (Marek Vasut)

   - Remove unnecessary print on Qcom SPMI ADC driver when a call to
     devm_request_threaded_irq() fails as this one already prints a
     message (Jishnu Prakash)

   - Add support for QCom PMIC5 Gen3 ADC by using auxiliary driver and
     shared interrupt with the IIO driver (Jishnu Prakash)

   - Make resets optional on MT8196 and add the corresponding property
     in the DT bindings (AngeloGioacchino Del Regno)

   - Fix clock staying enabled on failing resume operation on Qoriq (Can
     Peng)

   - Fix wrong closing brace position in thermal library header (Andreas
     Haufler)

   - Fix low and high trip point validation by moving the check after
     the clamp on the spacemit driver (surendra)

   - Remove redundant error messages on IRQ request failure (Pan Chuang)

   - Add IIO_CONSUMER namespace import to the qcom-spmi-mbg-tm thermal
     driver to avoid modpost warnings that would appear after merging
     the iio tree against the thermal updates (Nathan Chancellor)

   - Revert two recent cosmetic updates of the thermal core conflicting
     with driver core plans to eliminate class_create() (Rafael
     Wysocki)"

* tag 'thermal-7.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits)
  thermal/drivers/qcom-spmi-mbg-tm: Add module namespace import for IIO_CONSUMER
  Revert "thermal/core: Allocate the thermal class dynamically"
  Revert "thermal/core: Use the thermal class pointer as init guard"
  thermal/drivers/armada: Fix missing bitfields include
  thermal/drivers/qcom/spm mbg tm: Fix missing bitfield header
  thermal/drivers/qcom: Fix missing spmi adc tm5 gen3 file
  thermal/drivers: Remove redundant error messages on IRQ request failure
  thermal/drivers/spacemit: Validate clamped trip thresholds
  tools/lib/thermal: Fix misplaced extern "C" closing brace
  thermal/drivers/qoriq: Disable clock on resume failure
  thermal/drivers/mediatek/lvts_thermal: Make reset optional for MT8196
  dt-bindings: thermal: mediatek: Make resets optional for MT8196
  thermal/drivers/qcom: add support for PMIC5 Gen3 ADC thermal monitoring
  iio: adc: qcom-spmi-adc5-gen3: Share SDAM0 IRQ with ADC_TM auxiliary driver
  iio: adc: qcom-spmi-adc5-gen3: Remove an unnecessary print
  thermal/of: Fix trivial enabled typo
  thermal/drivers/spacemit/k1: Add shutdown action and reorder registration order
  dt-bindings: thermal: qcom-tsens: Document the Maili Temperature Sensor
  thermal/drivers/qcom: Add support for Qualcomm MBG thermal monitoring
  dt-bindings: thermal: Add Qualcomm MBG thermal monitor support
  ...
2026-08-26 14:21:30 -07:00
Linus Torvalds
93e4b3076b Char/Misc/IIO/etc driver update for 7.3-rc1
Here is the big set of char, misc, iio, counter, fpga, and other small
 driver subsystems for 7.3-rc1.
 
 Overall, due to some driver removals we only added a bit more code than
 removed, which was a nice change.  Highlights in this merge request are:
   - Loads of IIO driver updates and additions
   - binder driver updates (more on that below...)
   - Removal of the SGI XP and GRU drivers as they are not used anymore
     and turn out to be pretty insecure overall
   - Removal of the obsolete ibmasm driver as it's not being used anymore
   - Coresight driver updates and additions
   - Mei driver udpates
   - Counter driver updates
   - FPGA driver updates
   - ICC driver updates
   - lots and lots of other tiny driver updates to resolve reported
     issues
 
 All of these have been in linux-next for a while, with the only reported
 issues being some major merge conflicts.  Miguel pointed out some of
 these with the Rust tree merge, which is the majority of them.  I'll
 follow up with a diffstat of the merge resolution I made against your
 most recent tree, which works for me.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCao143A8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymtUgCeKB62gT1JfA86cg3NDB1opp+10N0An3oBBegQ
 IJLqJgK45dTNtMGBwGFV
 =68af
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc/IIO/etc driver updates from Greg KH:
 "Here is the big set of char, misc, iio, counter, fpga, and other small
  driver subsystems for 7.3-rc1.

  Overall, due to some driver removals we only added a bit more code
  than removed, which was a nice change. Highlights in this merge
  request are:

   - Loads of IIO driver updates and additions

   - binder driver updates (more on that below...)

   - Removal of the SGI XP and GRU drivers as they are not used anymore
     and turn out to be pretty insecure overall

   - Removal of the obsolete ibmasm driver as it's not being used
     anymore

   - Coresight driver updates and additions

   - Mei driver udpates

   - Counter driver updates

   - FPGA driver updates

   - ICC driver updates

   - lots and lots of other tiny driver updates to resolve reported
     issues

  All of these have been in linux-next for a while"

* tag 'char-misc-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (513 commits)
  iio: chemical: atlas-sensor: use iio_trigger_poll_nested() to fix remove UAF
  iio: adc: pac1921: fix wrong channel used in trigger handler read
  iio: light: gp2ap002: re-enable irq if runtime suspend fails
  iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes
  iio: light: apds9306: fix PM reference leak in apds9306_read_data()
  iio: gyro: mpu3050: fix sign of raw angular velocity readings
  iio: srf04: fix pm_runtime handling on probe error path
  iio: adc: ad4080: configure backend data size
  iio: adc: adi-axi-adc: add data size support for AD408X backend
  iio: chemical: atlas-sensor: fix PM reference leak in buffer postenable
  iio: dac: ad5446: fix OF module device table
  iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask
  iio: light: opt4001: Reject integration times with a non-zero seconds part
  iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem()
  iio: light: opt4001: Fix power down clearing bits of the wrong register
  iio: light: opt4060: Fix incorrect register name in threshold read error message
  iio: light: opt4060: Fix pointer type passed to div_u64_rem()
  iio: light: opt4060: Reject integration times with a non-zero seconds part
  iio: light: ltrf216a: fix runtime PM reference leak in error path
  iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
  ...
2026-08-25 09:38:50 -07:00
Greg Kroah-Hartman
258ad62593 IIO new device support, features, cleanup for 7.3
Includes a merge of 7.2-rc2 to pick up the changes around
 mod_devicetable.h and reduce resulting conflicts around includes.
 
 New device support
 ------------------
 
 adi,ad3530R
 - Add support for the AD3532R and AD3532 16 channel DACs.
 adi,ad4080
 - Add support for the AD4883 ADC.
 adi,ad5686
 - Add support for AD5313R, AD5317R, AD5674, AD5687R, AD5689, AD5689R DACs
   over SPI
 - Add support for AD5316R, AD5674, AD5697R and AD5696 DACs over I2C
 - Significant driver refactoring prior to these additions, partly to reduce
   bus traffic and to add triggered buffer and gain control support. An
   earlier set added support for missing supplies, reset and LDAC GPIO.
 adi,adf41513
 - New driver to support this PLL frequency synthesizer that runs up to
   26.5 GHz.
 - Included infrastructure to handle higher precision attributes with
   extensive tests
 adi,ltc2378-20
 - New driver supporting LTC2338, LTC2364, LTC2367, LTC2368, LT2369, LTC2370
   LTC2376, LTC2377, LTC2378, LTC2379 and LTC23980 ADCs with both high speed
   capture via appropriate backend and conventional triggered buffer SPI
   capture.
 invensense,icm42607
 - New driver for this IMU.
 mediateck,mt6323
 - New driver for this PMIC ADC.
 microchip,mcp47a1
 - New driver for this I2C 6 bit DAC.
 nxp,mcf54415-dac
 - New driver for this DAC found in NXP SoCs.
 qst,qmc5884l
 - New driver for this 3 axis magnetometer. Included dt vendor entry for qst.
 qst,qmc6308
 - New driver for this 3 axis magnetometer.
 sensiron,slf3s
 - New driver for this liquid flow sensor. Includes adding IIO_VOLUMEFLOW
   channel type.
 st,vl53l1x
 - Refactors to improve readability.
 ti,ads112c14
 - New driver supporting the ADS112C14 and ADS122C14 ADCs. These bring
   some new ABI for input chopping, particular useful for resistive sensors
   like thermocouples or Wheatstone bridges.
 - Support CRC8 detection of corruption on the bus.
 - Support buffered reads.
 ti,tmp117
 - (trivial) Add support for the tmp119 temperature sensor.
 xilinx,versal-sysmon
 - New ADC driver for this block found on various FPGAs including various
   bus interfaces, threshold and oversampling support.
 
 dt binding updates
 ------------------
 new shared bindings
 - excitation-channels and excitation-current-nanoamp allow per channel
   specification of currents used for resistive sensor measurement.
 - reference-sources property to allow selection of a per channel reference.
 rockchip,saradc
 - Add RV1106 which is compatible with the RV3588.
 
 Features
 --------
 
 buffer-dmaengine
 - Allow cyclic buffers, useful for repeating sequence generation with DACs.
 devantech,dmard09
 - Implement read back of channel scale - previously interface always
   returned an error.
 hid,sensors-als
 - Enable separate channel scaling for hardware that supports it.
 invensense,timestamp library
 - Various precision improvements.
 invensense,icm42600
 - Add support for hwfifo watermark interfaces.
 taos,tcs3472
 - Support wait time and sampling frequency control.
 
 Cleanups, minor fixes
 ---------------------
 
 Minor cleanups not mentioned at all in this summary such
 as white space fixes or typos.
 
 Affecting various drivers
 - Cleanup of conditionals that had no affect.
 - Drop some runtime pm local wrappers as now runtime_pm does the
   mark_last_busy part inside the put, these provide no useful code
   deduplication or readability advantages over directly calling the
   runtime_pm functions.
 - Return 0 from write_raw() on success.
 - Use of dev_err_probe() to simplify code and sometimes provide useful
   info for deferred probe debugging.
 - Drop some redundant error prints where the called function already
   provides information on errors.
 - Make some read only arrays in functions static.
 - Fix up missing handling of regcache_sync() errors.
 - Drop some false kernel-doc markings.
 - Add missing MODULE_DEVICE_TABLE for some of_match_id tables.
 - Use local variables for things like the struct device to shorten and
   improve readability of code.
 - Drop some unused structure elements.
 - Reorder dds.h macro parameters to be inline with others.
 - Header reorders and IWYU. Often part of a more significant series.
 - Remove abstractions designed to allow a driver to support multiple device
   types, when they have been around a long time and only the original part
   showed up.
 - Initialize spi_device_id arrays using member names following dropping of
   driver data from drivers that didn't actually use it.
 - Catch up with i2c_device_id tables added since previous effort to use
   named initializers for all those.
 - Use kernel types in a few places instead of standard C ones or bare
   unsigned.
 
 Misc
 - Update Xilinx AMS maintainer.
 - Update email address for Maxwell Doose.
 - Update email address for Siratul Islam.
 - Update email address for Tomasz Duszynski and re-add Tomasz to
   various maintainer entries.
 Docs
 - Encourage use of differential channel naming even when there is no
   flexibility in input to differential pair mapping. Intended to
   provide a strong signal to userspace that a channel is differential.
 adi,ad_sigma_delta
 - Allow COMPILE_TEST without any users.
 adi,ad2s1201
 - Refactor trigger handler to avoid mix of guard() and goto.
 adi,ad5686
 - Avoid potential NULL dereference is user forces a driver bind.
 adi,ad5696
 - Add a couple of missing entries to the of_match_id table and update
   binding to match.
 atmel,ad91_adc
 - Use const char * for DT string property allowing a cast to be dropped.
 avia,hx711
 - Various refactors and cleanup to enable support of additional parts
   (to come)
 - Add missing supply and gpio dt-bindings.
 bosch,bmc150
 - Harden against device reporting too large a FIFO sample count.
 - Use FIELD_PREP() / FIELD_GET() to improve readability.
 freescale,fxls8962af
 - Harden against device reporting too large a FIFO sample count.
 hid-sensors-*
 - Reorder probe to not expose userspace interfaces until the rest of
   the setup is done to avoid potentially dropping data.
 honeywell,abp2030pa
 - Drop an unreachable return.
 invensens,icm45600
 - Harden against bad value of FIFO sample count from device.
 - Use i2c_match_data if firmware table sourced match data isn't available.
 nxp,mpl1115
 - Ensure runtime_pm is balanced on error in probe.
 rohm,bm1390
 - Make the driver slightly more likely to recover from transient errors.
 sensiron,sgp30
 - Handle thread creation errors.
 st,lsm6dsx
 - Update the enable mask when doing sensor fusion to avoid incorrect fifo
   data handling.
 st,stm32-dfsdm
 - Treat dt flags as booleans.
 ti,ads1015
 - Switch to devm helpers which simplified code and closed a resource leak.
 ti,opt3001
 - Split complicated opt3001_get_processed() logic into irq an no irq
   helper functions.
 - Use devm to simplify code.
 - Use guard() to simplify code.
 - Reorder probe so final call exposes userspace interfaces.
 - Various other more minor cleanup
 taos,tsl2772
 - Fix calibscale readback to check right channel type.
 taos,tsl2583
 - Use sysfs_emit() and sysfs_emit_at() to replace open coded equivalents.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmp1Pm8RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoioNRAAi338gJ/xvG3rZlPr1RrTEgmsWaMqxxpr
 FWxFApdjAGvINn6SGwcWWkdfmB+OYg8sbhLLGkOx07e9R/GbS0y3j2kODvZHodZz
 k3wYXEy12HwuMgQRQWR+rNIke6bJdJFI10saJTfIRr3if7GkVvBTqd9exfoD2vGa
 Xzj12YN6ZcRiv8eWgju4yqQuVomMkRigd2mDHwvN4H9/ZylBRMgGIHhteWoPjx3y
 hs6lLeqc8lfocz1Azslb0ZEDPJ4+zPCO9eCBZ+1ZMwrzKUeqCfMYDQdE9TVUswpG
 aHlr5E+R2PlpLn4Ijk0faFJUZYFaOFIn3II3ZZfzzgFop2C0cVORYuIf7bgDRsaD
 zrLj2ybzSr/7+aAK2ry3hoVrxh9mkbv6G0Lf7bvFhQaXltJJBVQi98pU13p2AoFj
 BT8+pHOwgKUsF+LyxNqch6LyLDEzNw0P3Fl7SmrH/k2RVfj/L4+8PMOAijBTLpCC
 3J4k17laTYWJZ8sFpyBEXYyhgp6SZqr2UIIcizrc1nIUK+mJI2/XBVbtsBY/6jW8
 7RM07TNqkm+ZhsV58YiMfKdDuqPiQpCp5TYjVcxjjmOK4aE5bFSbyzi5SvAcG6oG
 C2l9k5vgZEpti6ZkFBj4qNUK0cVXinDWqHhlAXF7wjKCj69yEFLCtl+de//A0I+v
 3FBEkBCsq+M=
 =4ayG
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-7.3a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO new device support, features, cleanup for 7.3

Includes a merge of 7.2-rc2 to pick up the changes around
mod_devicetable.h and reduce resulting conflicts around includes.

New device support
------------------

adi,ad3530R
- Add support for the AD3532R and AD3532 16 channel DACs.
adi,ad4080
- Add support for the AD4883 ADC.
adi,ad5686
- Add support for AD5313R, AD5317R, AD5674, AD5687R, AD5689, AD5689R DACs
  over SPI
- Add support for AD5316R, AD5674, AD5697R and AD5696 DACs over I2C
- Significant driver refactoring prior to these additions, partly to reduce
  bus traffic and to add triggered buffer and gain control support. An
  earlier set added support for missing supplies, reset and LDAC GPIO.
adi,adf41513
- New driver to support this PLL frequency synthesizer that runs up to
  26.5 GHz.
- Included infrastructure to handle higher precision attributes with
  extensive tests
adi,ltc2378-20
- New driver supporting LTC2338, LTC2364, LTC2367, LTC2368, LT2369, LTC2370
  LTC2376, LTC2377, LTC2378, LTC2379 and LTC23980 ADCs with both high speed
  capture via appropriate backend and conventional triggered buffer SPI
  capture.
invensense,icm42607
- New driver for this IMU.
mediateck,mt6323
- New driver for this PMIC ADC.
microchip,mcp47a1
- New driver for this I2C 6 bit DAC.
nxp,mcf54415-dac
- New driver for this DAC found in NXP SoCs.
qst,qmc5884l
- New driver for this 3 axis magnetometer. Included dt vendor entry for qst.
qst,qmc6308
- New driver for this 3 axis magnetometer.
sensiron,slf3s
- New driver for this liquid flow sensor. Includes adding IIO_VOLUMEFLOW
  channel type.
st,vl53l1x
- Refactors to improve readability.
ti,ads112c14
- New driver supporting the ADS112C14 and ADS122C14 ADCs. These bring
  some new ABI for input chopping, particular useful for resistive sensors
  like thermocouples or Wheatstone bridges.
- Support CRC8 detection of corruption on the bus.
- Support buffered reads.
ti,tmp117
- (trivial) Add support for the tmp119 temperature sensor.
xilinx,versal-sysmon
- New ADC driver for this block found on various FPGAs including various
  bus interfaces, threshold and oversampling support.

dt binding updates
------------------
new shared bindings
- excitation-channels and excitation-current-nanoamp allow per channel
  specification of currents used for resistive sensor measurement.
- reference-sources property to allow selection of a per channel reference.
rockchip,saradc
- Add RV1106 which is compatible with the RV3588.

Features
--------

buffer-dmaengine
- Allow cyclic buffers, useful for repeating sequence generation with DACs.
devantech,dmard09
- Implement read back of channel scale - previously interface always
  returned an error.
hid,sensors-als
- Enable separate channel scaling for hardware that supports it.
invensense,timestamp library
- Various precision improvements.
invensense,icm42600
- Add support for hwfifo watermark interfaces.
taos,tcs3472
- Support wait time and sampling frequency control.

Cleanups, minor fixes
---------------------

Minor cleanups not mentioned at all in this summary such
as white space fixes or typos.

Affecting various drivers
- Cleanup of conditionals that had no affect.
- Drop some runtime pm local wrappers as now runtime_pm does the
  mark_last_busy part inside the put, these provide no useful code
  deduplication or readability advantages over directly calling the
  runtime_pm functions.
- Return 0 from write_raw() on success.
- Use of dev_err_probe() to simplify code and sometimes provide useful
  info for deferred probe debugging.
- Drop some redundant error prints where the called function already
  provides information on errors.
- Make some read only arrays in functions static.
- Fix up missing handling of regcache_sync() errors.
- Drop some false kernel-doc markings.
- Add missing MODULE_DEVICE_TABLE for some of_match_id tables.
- Use local variables for things like the struct device to shorten and
  improve readability of code.
- Drop some unused structure elements.
- Reorder dds.h macro parameters to be inline with others.
- Header reorders and IWYU. Often part of a more significant series.
- Remove abstractions designed to allow a driver to support multiple device
  types, when they have been around a long time and only the original part
  showed up.
- Initialize spi_device_id arrays using member names following dropping of
  driver data from drivers that didn't actually use it.
- Catch up with i2c_device_id tables added since previous effort to use
  named initializers for all those.
- Use kernel types in a few places instead of standard C ones or bare
  unsigned.

Misc
- Update Xilinx AMS maintainer.
- Update email address for Maxwell Doose.
- Update email address for Siratul Islam.
- Update email address for Tomasz Duszynski and re-add Tomasz to
  various maintainer entries.
Docs
- Encourage use of differential channel naming even when there is no
  flexibility in input to differential pair mapping. Intended to
  provide a strong signal to userspace that a channel is differential.
adi,ad_sigma_delta
- Allow COMPILE_TEST without any users.
adi,ad2s1201
- Refactor trigger handler to avoid mix of guard() and goto.
adi,ad5686
- Avoid potential NULL dereference is user forces a driver bind.
adi,ad5696
- Add a couple of missing entries to the of_match_id table and update
  binding to match.
atmel,ad91_adc
- Use const char * for DT string property allowing a cast to be dropped.
avia,hx711
- Various refactors and cleanup to enable support of additional parts
  (to come)
- Add missing supply and gpio dt-bindings.
bosch,bmc150
- Harden against device reporting too large a FIFO sample count.
- Use FIELD_PREP() / FIELD_GET() to improve readability.
freescale,fxls8962af
- Harden against device reporting too large a FIFO sample count.
hid-sensors-*
- Reorder probe to not expose userspace interfaces until the rest of
  the setup is done to avoid potentially dropping data.
honeywell,abp2030pa
- Drop an unreachable return.
invensens,icm45600
- Harden against bad value of FIFO sample count from device.
- Use i2c_match_data if firmware table sourced match data isn't available.
nxp,mpl1115
- Ensure runtime_pm is balanced on error in probe.
rohm,bm1390
- Make the driver slightly more likely to recover from transient errors.
sensiron,sgp30
- Handle thread creation errors.
st,lsm6dsx
- Update the enable mask when doing sensor fusion to avoid incorrect fifo
  data handling.
st,stm32-dfsdm
- Treat dt flags as booleans.
ti,ads1015
- Switch to devm helpers which simplified code and closed a resource leak.
ti,opt3001
- Split complicated opt3001_get_processed() logic into irq an no irq
  helper functions.
- Use devm to simplify code.
- Use guard() to simplify code.
- Reorder probe so final call exposes userspace interfaces.
- Various other more minor cleanup
taos,tsl2772
- Fix calibscale readback to check right channel type.
taos,tsl2583
- Use sysfs_emit() and sysfs_emit_at() to replace open coded equivalents.

* tag 'iio-for-7.3a' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (232 commits)
  iio: dac: mcp47a1: add support for new device
  dt-bindings: iio: dac: add support for mcp47a1
  iio: Update email for Maxwell Doose
  iio: imu: st_lsm6dsx: Update enable mask when using sensor fusion
  iio: light: cm32181: return zero after writing calibscale
  iio: flow: add Sensirion SLF3S liquid flow sensor driver
  iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
  dt-bindings: iio: flow: add Sensirion SLF3S liquid flow sensor
  iio: types: add IIO_VOLUMEFLOW channel type
  iio: ABI: Encourage differential voltage ABI usage
  iio: adc: ltc2378: Add support for LTC2338-18
  iio: adc: ltc2378: Enable triggered buffer data capture
  iio: adc: ltc2378: Enable high-speed data capture
  iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
  dt-bindings: iio: adc: Add ltc2378
  iio: magnetometer: ak8974: remove conditional return with no effect
  iio: light: tsl2583: remove conditional return with no effect
  iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper
  iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper
  iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper
  ...
2026-08-19 09:45:01 +02:00
Greg Kroah-Hartman
05fa77078b IIO: 2nd set of fixes for the 7.2 cycle.
Given timing these are probably now merge window material.
 
 Usual mixed bunch of ancient issues and newer ones.
 
 core,buffer
 - Fix a potential UAF in release on anonymous buffers.
 - Make sure DMA fence lock lifetime matches that of the DMA fence.
 - Make IIO DMA fence release RCU safe.
 various
 - Kconfig missing REGMAP* related selects.
 - Unbalance of runtime pm or regulators in error paths.
 
 adi,ad3552r-hs
 - Fixing wrong buffers size for string printing.
 adi,ad4080
 - Fix 16-bit part support by adding path to tell the backend what
   the data size is - avoiding corrupted data capture.
 adi,ad5446
 - Wrong MODULE_DEVICE_TABLE() type due to case error.
 atlas,sensor
 - Drop use of irq_work() in favour of iio_trigger_poll_nested() avoiding
   a possible UAF.
 hid-temperature
 - Potential release ordering issue due to mixed devm and not that
   can lead to long timeouts.
 infineon,dps310
 - Fix NULL dereference on ACPI platforms.
 invense,mpu3050
 - Fix sign of raw angular velocity readings.
 mitsubishi,m62332
 - Fix a regulator reference counting issue when switching channels.
 sharp,gp2ap002
 - Unbalanced runtime PM on repeated event writes.
 - Reenable irq if runtime suspend fails.
 ti,ads7138
 - Disable statistics gathering whilst reading conversions results
   to avoid data corruption.
 ti,opt4001
 - Ensure integration times with integer part are rejected rather than
   ignoring the integer part of the value.
 - Fix use of wrong register.
 - Pointer type mismatch to div_u64_rem()
 - Fix reversed GENMASK() arguements.
 ti,opt4060
 - Ensure integration times with integer part are rejected rather than
   ignoring the integer part of the value.
 - Pointer type mismatch to div_u64_rem()
 - Wrong register name in an error print.
 ti,pac1921
 - Fix wrong channel used in the trigger handler for some combinations
   of enabled channels.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmp2YZMRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohoXg//bpUQOCkNkpSK1ZZsB37N6bE8vru1UenU
 a2W8A6KW22BWQ3ibrmt/rm/5kwlx9BM8v+CuU11pbtFpsa5whF3errsRYf1KiQCC
 axbQhPgXlt09YYeDFgOXCkcrfVzW/PAqUmWsaKRPXkCQ5DKT6JNxKa4tIvwdDceL
 5+bq7AeU5w2k5kw91Ro/XCCdy0eRO1yWOJz1rDsDD68s4a+yMyhPzljyz5z/0ngT
 sX/AMEf0Ykcs8rdr7hi6GTPI5+x0bMlWWI1RLLDpvsgNU575CRFrktYwtz6HVD5b
 2p8fdHWJRLZOhMZV+VEqhEpkwXsEF7YBIj6/jgyOHo1tYGwKPeWNz9KJ5n13mLbx
 kqI/lyK/DMX8llMPkoFtjqqT0meY6KOApiySCzGd3+r00D9OWvX4NWvC/kuwezyI
 7xt9mjJpco5vj2GL4mPjSEOXbgylidCErSz4QaM9URZopp1xa7ID5ELEiH0bjvr0
 4v551XYEubeKxHWsvrk5uDQfrbeW0OFGYxe6Y7nNkWTVItIkbO9cLvqgqh2aeeID
 Vhdpr9Z4cHS6kXX7LzXYeWV6DMgSRJRgidKHWwXSIZtw3afc3VOai0LYho+9aLTq
 L4RB6BZ7yUPvNkZlloX7/wWc7CpVX6VF9J9s7speyB5UXL4kKvPzcETrQnqruq8O
 BCAFbiMn7Tg=
 =N4R+
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-7.2b-take2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO: 2nd set of fixes for the 7.2 cycle.

Given timing these are probably now merge window material.

Usual mixed bunch of ancient issues and newer ones.

core,buffer
- Fix a potential UAF in release on anonymous buffers.
- Make sure DMA fence lock lifetime matches that of the DMA fence.
- Make IIO DMA fence release RCU safe.
various
- Kconfig missing REGMAP* related selects.
- Unbalance of runtime pm or regulators in error paths.

adi,ad3552r-hs
- Fixing wrong buffers size for string printing.
adi,ad4080
- Fix 16-bit part support by adding path to tell the backend what
  the data size is - avoiding corrupted data capture.
adi,ad5446
- Wrong MODULE_DEVICE_TABLE() type due to case error.
atlas,sensor
- Drop use of irq_work() in favour of iio_trigger_poll_nested() avoiding
  a possible UAF.
hid-temperature
- Potential release ordering issue due to mixed devm and not that
  can lead to long timeouts.
infineon,dps310
- Fix NULL dereference on ACPI platforms.
invense,mpu3050
- Fix sign of raw angular velocity readings.
mitsubishi,m62332
- Fix a regulator reference counting issue when switching channels.
sharp,gp2ap002
- Unbalanced runtime PM on repeated event writes.
- Reenable irq if runtime suspend fails.
ti,ads7138
- Disable statistics gathering whilst reading conversions results
  to avoid data corruption.
ti,opt4001
- Ensure integration times with integer part are rejected rather than
  ignoring the integer part of the value.
- Fix use of wrong register.
- Pointer type mismatch to div_u64_rem()
- Fix reversed GENMASK() arguements.
ti,opt4060
- Ensure integration times with integer part are rejected rather than
  ignoring the integer part of the value.
- Pointer type mismatch to div_u64_rem()
- Wrong register name in an error print.
ti,pac1921
- Fix wrong channel used in the trigger handler for some combinations
  of enabled channels.

* tag 'iio-fixes-for-7.2b-take2' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (31 commits)
  iio: chemical: atlas-sensor: use iio_trigger_poll_nested() to fix remove UAF
  iio: adc: pac1921: fix wrong channel used in trigger handler read
  iio: light: gp2ap002: re-enable irq if runtime suspend fails
  iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes
  iio: light: apds9306: fix PM reference leak in apds9306_read_data()
  iio: gyro: mpu3050: fix sign of raw angular velocity readings
  iio: srf04: fix pm_runtime handling on probe error path
  iio: adc: ad4080: configure backend data size
  iio: adc: adi-axi-adc: add data size support for AD408X backend
  iio: chemical: atlas-sensor: fix PM reference leak in buffer postenable
  iio: dac: ad5446: fix OF module device table
  iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask
  iio: light: opt4001: Reject integration times with a non-zero seconds part
  iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem()
  iio: light: opt4001: Fix power down clearing bits of the wrong register
  iio: light: opt4060: Fix incorrect register name in threshold read error message
  iio: light: opt4060: Fix pointer type passed to div_u64_rem()
  iio: light: opt4060: Reject integration times with a non-zero seconds part
  iio: light: ltrf216a: fix runtime PM reference leak in error path
  iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
  ...
2026-08-19 09:43:39 +02:00
Bartosz Golaszewski
146cc263e4 Linux 7.2
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmqCLGoeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGJzYH/0SFjcgnk1Z3Km+3
 2kEeGAMETajW41W7+5QQkuHk83UXDxigDRoD857/d8utK90GrZAoTMS9/6zF3tra
 ht4G1yc2x7/xgVLkWii54d/sp1LEWTRDntN95fzYZwbeAXwd0AcYBlKXZYHKl4t/
 4yZCgYPmYTkewaYdbyWNPiZvCwhBUl5k1E9i/drh5IJXdgXRcqoO86FY9JX+Ks9x
 r0g+d6RIiSbDfwzgRpkBn0TRnqzh2OeBfgyrsgGZO2axwlKcA7SP0vwwT6c6nOUI
 s8F2xXrqrUI75JbSI4YbdwOSvktwbtkz83idlRAYBOdxof3LJ6i2YaxrT8iG+KUH
 l7+e18M=
 =eQMh
 -----END PGP SIGNATURE-----

Merge tag 'v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-next

Linux 7.2
2026-08-18 14:21:04 +02:00
Rafael J. Wysocki
ccda015d76 - Move thermal_zone_device_enable() to the right place in order to
prevent calling it if the thermal zone registration failed (Dan
   Carpenter)
 
 - Improve bitfield manipulations on Armada (Bryan B. Lima)
 
 - Remove unneeded 'fast_io' on Sun8i and Armada (Wolfram Sang)
 
 - Fix wrong boundary when clamping the low values in the set_trips()
   callback and fix wrong mask when setting the temperature interval on
   Airoha (Christian Marangi)
 
 - Make use of the regmap API in order to support the Airoha AN7583
   (Christian Marangi)
 
 - Fix adc_tm5_get_temp() return check value on the QCom SPMI ADC
   sensor (Rakesh Kota)
 
 - Fix unbalanced clock enablement when the resume fails on the iMX
   driver (Can Peng)
 
 - Add Qualcomm Master BandGap thermal monitor support (Satya Priya
   Kakitapalli)
 
 - Add Maili Temperature bindings compatible (Haritha S K)
 
 - Add a devm action to clean hardware interrupts, sampling, and
   control registers on Spacemit K1 (Pei Xiao)
 
 - Fix trivial typo in an OF code comment (Marek Vasut)
 
 - Remove unecessary print on Qcom SPMI ADC driver when a call to
   devm_request_threaded_irq() fails as this one already prints a
   message (Jishnu Prakash)
 
 - Add support for QCom PMIC5 Gen3 ADC by using auxialiary driver and
   shared interrupt with the IIO driver (Jishnu Prakash)
 
 - Make resets optional on MT8196 and add the corresponding property in
   the DT bindings (AngeloGioacchino Del Regno)
 
 - Fix clock staying enabled with the resume operation fails on Qoriq
   (Can Peng)
 
 - Fix wrong closing brace position in thermal library header (Andreas
   Haufler)
 
 - Fix low and high trip point validation by moving the check after the
   clamp on the spacemit driver (surendra)
 
 - Remove redundant error messages on IRQ request failure (Pan Chuang)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEGn3N4YVz0WNVyHskqDIjiipP6E8FAmp2NLQACgkQqDIjiipP
 6E98UAf/SqeabRuCefz1qn4zdjQHL4jiIEHrhRvXLSPb2ooVhzZYpOP5sUXFG1W5
 XxncjSyo7ZJKhVXrCd7II7GW6+3TqujM+MWpcYBerGsrLH0YudcOkAl8gTkhSXfV
 ZfuKbSYR+mrLyWbszIzbyknaGFFt4xdkusTldhWA80dHb1G5o055/unVtVEDDn65
 ciLmZqHBW+r0ureVhu6FJ5FNozCKfX4hXZOsX95FvIJEBvlDORHZmCEsaxbD1bem
 mMcs2tU74s2eJtRmKuq7A2ddw23dUTxTUciiCh6r5h/dI0MTxaEZUpF5TjXvfEQE
 Ick0gsWEc77263AS/2WAoTodQfBP5A==
 =8Vte
 -----END PGP SIGNATURE-----

Merge tag 'thermal-v7.3-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux

Pull thermal driver updates for 7.3-rc1 from Daniel Lezcano:

"- Move thermal_zone_device_enable() to the right place in order to
   prevent calling it if the thermal zone registration failed (Dan
   Carpenter)

 - Improve bitfield manipulations on Armada (Bryan B. Lima)

 - Remove unneeded 'fast_io' on Sun8i and Armada (Wolfram Sang)

 - Fix wrong boundary when clamping the low values in the set_trips()
   callback and fix wrong mask when setting the temperature interval on
   Airoha (Christian Marangi)

 - Make use of the regmap API in order to support the Airoha AN7583
   (Christian Marangi)

 - Fix adc_tm5_get_temp() return check value on the QCom SPMI ADC
   sensor (Rakesh Kota)

 - Fix unbalanced clock enablement when the resume fails on the iMX
   driver (Can Peng)

 - Add Qualcomm Master BandGap thermal monitor support (Satya Priya
   Kakitapalli)

 - Add Maili Temperature bindings compatible (Haritha S K)

 - Add a devm action to clean hardware interrupts, sampling, and
   control registers on Spacemit K1 (Pei Xiao)

 - Fix trivial typo in an OF code comment (Marek Vasut)

 - Remove unecessary print on Qcom SPMI ADC driver when a call to
   devm_request_threaded_irq() fails as this one already prints a
   message (Jishnu Prakash)

 - Add support for QCom PMIC5 Gen3 ADC by using auxialiary driver and
   shared interrupt with the IIO driver (Jishnu Prakash)

 - Make resets optional on MT8196 and add the corresponding property in
   the DT bindings (AngeloGioacchino Del Regno)

 - Fix clock staying enabled with the resume operation fails on Qoriq
   (Can Peng)

 - Fix wrong closing brace position in thermal library header (Andreas
   Haufler)

 - Fix low and high trip point validation by moving the check after the
   clamp on the spacemit driver (surendra)

 - Remove redundant error messages on IRQ request failure (Pan Chuang)

* tag 'thermal-v7.3-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (26 commits)
  thermal/drivers: Remove redundant error messages on IRQ request failure
  thermal/drivers/spacemit: Validate clamped trip thresholds
  tools/lib/thermal: Fix misplaced extern "C" closing brace
  thermal/drivers/qoriq: Disable clock on resume failure
  thermal/drivers/mediatek/lvts_thermal: Make reset optional for MT8196
  dt-bindings: thermal: mediatek: Make resets optional for MT8196
  thermal/drivers/qcom: add support for PMIC5 Gen3 ADC thermal monitoring
  iio: adc: qcom-spmi-adc5-gen3: Share SDAM0 IRQ with ADC_TM auxiliary driver
  iio: adc: qcom-spmi-adc5-gen3: Remove an unnecessary print
  thermal/of: Fix trivial enabled typo
  thermal/drivers/spacemit/k1: Add shutdown action and reorder registration order
  dt-bindings: thermal: qcom-tsens: Document the Maili Temperature Sensor
  thermal/drivers/qcom: Add support for Qualcomm MBG thermal monitoring
  dt-bindings: thermal: Add Qualcomm MBG thermal monitor support
  thermal/drivers/imx: Disable clock on runtime resume failure
  thermal/drivers/qcom-spmi-adc-tm5: Drop IIO_VAL_INT check in adc_tm5_get_temp
  thermal/drivers/airoha: Add support for AN7583 Thermal Sensor
  dt-bindings: arm: airoha: Add the chip-scu node for AN7583 SoC
  thermal/drivers/airoha: Generalize get_thermal_ADC and set_mux function
  thermal/drivers/airoha: Generalize probe function
  ...
2026-08-10 12:53:41 +02:00
Fan Wu
be61c8c625 iio: chemical: atlas-sensor: use iio_trigger_poll_nested() to fix remove UAF
The atlas driver requests its hardware data-ready IRQ with
devm_request_threaded_irq(); its threaded handler queues an irq_work,
atlas_work_handler(), that calls iio_trigger_poll(data->trig).

The IRQ is devm-managed, so free_irq() runs from the devres unwind after
atlas_remove() returns without flushing that irq_work.  Once a buffer is
enabled, conversion-complete IRQs keep firing and queueing it; a pending
irq_work can therefore run after the unwind has freed atlas_data/indio_dev
and the trigger, when atlas_work_handler() derives the atlas_data pointer
via container_of() and dereferences data->trig, a use-after-free.

Call iio_trigger_poll_nested() directly from the threaded handler instead
of bouncing through irq_work.  free_irq() then drains the threaded handler,
closing the window; other iio drivers with a threaded data-ready IRQ do the
same (e.g. bmi270).

This issue was found by an in-house static analysis tool.

Fixes: 7103b99b03 ("iio: chemical: atlas-ph-sensor: reorg driver to allow multiple chips")
Cc: stable@vger.kernel.org # v6.4+
Assisted-by: Codex:gpt-5.6
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Cong Nguyen
3364c56b20 iio: adc: pac1921: fix wrong channel used in trigger handler read
pac1921_trigger_handler() walks the enabled channels with
iio_for_each_active_channel(), which yields the scan index (bit) of each
active channel, while ch is a separate counter used to pack the samples
contiguously into the scan buffer.

The register to read was looked up with the packing counter instead of
the scan index:

	ret = pac1921_read_res(priv, idev->channels[ch].address, &val);

pac1921_channels[] is ordered by scan index, so channels[bit] is the
channel that is actually enabled, whereas channels[ch] is merely the
ch-th array entry. These coincide only when the enabled channels form a
contiguous prefix (e.g. all channels enabled). With a sparse scan mask -
for example when only the power channel (scan index 3) is enabled - the
handler reads the wrong register (VBUS instead of VPOWER) and pushes it
to userspace as the enabled channel's data.

Index the channel array by the scan index (bit) to read the correct
register, keeping ch only for contiguous packing into the scan buffer.

Fixes: 371f778b83 ("iio: adc: add support for pac1921")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
Acked-by: Matteo Martelli <matteomartelli3@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Nikhil Gautam
5d89e7cbac iio: light: gp2ap002: re-enable irq if runtime suspend fails
gp2ap002_runtime_suspend() disables the irq before writing OPMOD. If
the write fails, the callback returns an error with the irq still
disabled while the PM core marks the device active again.

re-enable the irq before returning the error so the irq state matches
the active state the PM core restores.

Fixes: 97d642e230 ("iio: light: Add a driver for Sharp GP2AP002x00F")
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Nikhil Gautam
579c049b4c iio: light: gp2ap002: Fix unbalanced runtime PM on repeated event writes
The IIO core does not filter duplicate writes to the event enable
attribute, so writing the same value twice invokes
write_event_config() twice. Enabling twice leaks a runtime PM
reference, preventing the device from ever suspending again;
disabling twice underflows the usage count and triggers a
"Runtime PM usage count underflow" warning.

Bail out early when the requested state matches the current state.
While at it, switch to pm_runtime_resume_and_get() so a failed
resume is propagated to userspace instead of silently marking the
event enabled.

Fixes: 97d642e230 ("iio: light: Add a driver for Sharp GP2AP002x00F")
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Moksh Panicker
d378fceaaf iio: light: apds9306: fix PM reference leak in apds9306_read_data()
apds9306_read_data() calls pm_runtime_resume_and_get() but several
error paths return directly without calling pm_runtime_put_autosuspend(),
leaking the runtime PM reference and preventing the device from
autosuspending.

Use PM_RUNTIME_ACQUIRE_AUTOSUSPEND() and PM_RUNTIME_ACQUIRE_ERR() to
automatically handle runtime PM reference release on all return paths.

Fixes: 620d1e6c7a ("iio: light: Add support for APDS9306 Light Sensor")
Signed-off-by: Moksh Panicker <mokshpanicker.7@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Cong Nguyen
06fab97602 iio: gyro: mpu3050: fix sign of raw angular velocity readings
The MPU-3050 gyroscope output registers hold 16-bit two's complement
values; the angular velocity channels are declared with .sign = 's'.
When mpu3050_read_raw() handles IIO_CHAN_INFO_RAW it reads the register
via a big-endian regmap_bulk_read() and assigns it with:

	*val = be16_to_cpu(raw_val);

be16_to_cpu() yields an unsigned 16-bit quantity, so negative rates
(bit 15 set) are reported to userspace as large positive integers
(e.g. -1 becomes 65535) instead of the correct negative value.

Cast to s16 before the assignment, matching the temperature channel a
few lines above which already handles the sign correctly.

Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Cong Nguyen
a40b2e7a17 iio: srf04: fix pm_runtime handling on probe error path
When pm_runtime_set_active() fails during probe, the driver logs the
error and unregisters the IIO device, but then falls through and still
calls pm_runtime_enable() before returning the error.

Since probe returns an error, srf04_remove() is never called, so
runtime PM is left enabled without a matching pm_runtime_disable().
This leaks the enable and triggers an "Unbalanced pm_runtime_enable!"
warning on a subsequent bind of the device.

Return the error right after unregistering the IIO device so that
runtime PM is not enabled on the failure path.

Fixes: 2251157b33 ("iio: srf04: add power management feature")
Cc: stable@vger.kernel.org
Signed-off-by: Cong Nguyen <congnt264@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Antoniu Miclaus
d39afd249d iio: adc: ad4080: configure backend data size
The AXI backend needs to know the ADC word width in order to pack the
sample data correctly on the bus. During channel setup, program the
backend packet format via iio_backend_data_size_set() using the channel
resolution, so the data is transferred according to the device's
realbits.

The backend packet format field defaults to 20-bit packing, so the
20-bit parts (AD4080/AD4081/AD4082, AD4880) were unaffected. The 16-bit
(AD4083/AD4084/AD4085, AD4884) and 14-bit (AD4086/AD4087/AD4088) parts,
however, were left packing data at the wrong width, producing corrupt
buffered captures.

Fixes: 6c3e726573 ("iio: adc: ad4080: add support for AD4084")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Antoniu Miclaus
60f6f7fd5f iio: adc: adi-axi-adc: add data size support for AD408X backend
The AD408X AXI core can pack the sample data on the bus using different
word widths. Expose this through the data_size_set backend operation so
that frontends can program the packet format field (bits 3:2 of the
CNTRL_3 register) according to the ADC resolution: 20-bit, 16-bit and
14-bit map to packet format values 0, 1 and 2 respectively.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:05 +01:00
Moksh Panicker
bcd3f72e26 iio: chemical: atlas-sensor: fix PM reference leak in buffer postenable
atlas_buffer_postenable() acquires a runtime PM reference with
pm_runtime_resume_and_get() but returns the result of
atlas_set_interrupt() directly. If atlas_set_interrupt() fails,
the runtime PM reference is leaked and the device can never
autosuspend.

Add pm_runtime_put_autosuspend() on the error path to balance
the reference.

Fixes: 0e4f336f50 ("iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()")
Cc: stable@vger.kernel.org
Signed-off-by: Moksh Panicker <mokshpanicker.7@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Can Peng
a3c03cf36a iio: dac: ad5446: fix OF module device table
The ad5446 I2C driver exports its OF match table with
MODULE_DEVICE_TABLE(OF, ...).

The device table type is used by modpost when generating module aliases,
and scripts/mod/file2alias.c matches the lowercase "of" type.  Using
"OF" prevents the OF table from being recognized, so no OF module alias is
generated for the I2C driver.

Use the lowercase "of" type so OF-based module autoloading works.

Fixes: 876d940240 ("iio: dac: ad5446: Separate I2C/SPI into different drivers")
Signed-off-by: Can Peng <pengcan@kylinos.cn>
Reviewed-by: Joshua Crofts <joshua.crofts1@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>
2026-08-07 23:51:04 +01:00
Nikhil Gautam
d64bfd9f33 iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask
GENMASK(h, l) requires h >= l, but OPT4001_CTRL_FAULT_COUNT is defined
as GENMASK(0, 1). The define is currently unused so there is no
functional impact, but fix it before anyone builds on it, and add the
_MASK suffix for consistency with the neighbouring definitions.

Fixes: 9a96084182 ("iio: light: Add support for TI OPT4001 light sensor")
Signed-off-by: Nikhil Gautam <nikhilgtr@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>
2026-08-07 23:51:04 +01:00
Nikhil Gautam
d0f21621f8 iio: light: opt4001: Reject integration times with a non-zero seconds part
opt4001_write_raw() only looks at val2 when setting the integration
time, so a write such as 1.000600 is silently accepted as 600 us.
Return -EINVAL if val is non-zero.

Fixes: 9a96084182 ("iio: light: Add support for TI OPT4001 light sensor")
Signed-off-by: Nikhil Gautam <nikhilgtr@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>
2026-08-07 23:51:04 +01:00
Nikhil Gautam
afa28741c9 iio: light: opt4001: Fix incompatible pointer type passed to div_u64_rem()
div_u64_rem() takes a u32 * for the remainder but is passed val2, which
is an int *. There is no functional impact as int and u32 have the same
size and representation on all supported architectures and the remainder
is always smaller than the divisor, so it fits in the positive range of
int. Fix the type mismatch by using a local u32 for the remainder and
assigning the result to *val2.

Fixes: 9a96084182 ("iio: light: Add support for TI OPT4001 light sensor")
Signed-off-by: Nikhil Gautam <nikhilgtr@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>
2026-08-07 23:51:04 +01:00
Nikhil Gautam
3b2cd82c52 iio: light: opt4001: Fix power down clearing bits of the wrong register
opt4001_power_down() intends to clear the operating mode bits in the
CTRL register but reads OPT4001_DEVICE_ID instead of OPT4001_CTRL, so
the value written back to CTRL contains device ID bits rather than the
current configuration.

Fix and simplify this by using regmap_clear_bits() on the CTRL register
directly in the devm action, and drop opt4001_power_down() which has no
other users.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Fixes: 9a96084182 ("iio: light: Add support for TI OPT4001 light sensor")
Signed-off-by: Nikhil Gautam <nikhilgtr@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>
2026-08-07 23:51:04 +01:00
Vidhu Sarwal
ad36763821 iio: light: opt4060: Fix incorrect register name in threshold read error message
opt4060_get_thresholds() correctly reads OPT4060_THRESHOLD_HIGH, but
logs "Failed to read THRESHOLD_LOW." if the read fails. This is a
copy-and-paste mistake, as the preceding low-threshold read already uses
the correct error message.

Update the error message to reference OPT4060_THRESHOLD_HIGH.

Fixes: 0c6db4506a ("iio: light: Add support for TI OPT4060 color sensor")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Vidhu Sarwal
0ba0ed0d42 iio: light: opt4060: Fix pointer type passed to div_u64_rem()
div_u64_rem() expects a u32 * for the remainder, but
opt4060_read_ev_period() passes val2, which is declared as an
int *. While this has no functional impact, it triggers a pointer type
mismatch.

There is no behavioural change because int and u32 have the same
size and representation on all supported architectures, and the
remainder is always less than MICRO, so it fits within the positive
range of int.

Use a local u32 to receive the remainder before assigning it to
*val2.

Fixes: 0c6db4506a ("iio: light: Add support for TI OPT4060 color sensor")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Vidhu Sarwal
b7e6e9af0d iio: light: opt4060: Reject integration times with a non-zero seconds part
When setting the integration time, opt4060_write_raw() only uses
val2 and ignores val. As a result, a write such as 1.000600 is
accepted and programmed as 600 us, silently discarding the whole
seconds part.

Since all supported integration times are less than one second, any
non-zero val represents an invalid input. Reject such values instead
of silently accepting them.

Fixes: 0c6db4506a ("iio: light: Add support for TI OPT4060 color sensor")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Vidhu Sarwal
c132aef0e7 iio: light: ltrf216a: fix runtime PM reference leak in error path
ltrf216a_get_lux() acquires a runtime PM reference by calling
ltrf216a_set_power_state(data, true). However, if
ltrf216a_read_data() fails, the function returns immediately without
dropping the reference.

This leaves the runtime PM usage count unbalanced, preventing the device
from autosuspending after a failed read.

Fix this by releasing the runtime PM reference before returning from the
error path.

Fixes: 83f0bcd40d ("iio: light: Add support for ltrf216a sensor")
Signed-off-by: Vidhu Sarwal <vidhu.linux@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>
2026-08-07 23:51:04 +01:00
Rupesh Majhi
26e9213898 iio: pressure: dps310: fix NULL pointer dereference on ACPI probe
When the device is enumerated through its ACPI HID (IFX3100),
i2c_client_get_device_id() returns NULL: the ACPI-derived client name
does not match the driver's i2c_device_id table. dps310_probe() then
dereferences that NULL pointer in "iio->name = id->name" and crashes the
kernel during probe.

The IIO device name is always "dps310", so set it directly and drop the
now-unused device-id lookup.

Fixes: 72ff282819 ("iio: pressure: dps310: Add ACPI HID table")
Cc: stable@vger.kernel.org
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Lars-Peter Clausen
8662e56c31 iio: buffer: Make IIO DMA fence release RCU-safe
The `dma_fence` documentation states that if a custom release
implementation is provided, the `dma_fence` object must be freed in an
RCU-safe way. The current `iio_dma_fence` implementation uses `kfree()`,
which might result in a use-after-free.

Remove the custom `release` implementation. This makes the DMA fence core
fall back to `dma_fence_free()`, which calls `kfree_rcu()` on the fence.
This requires that the fence be the first member of `struct iio_dma_fence`.

Using the default release method for extended DMA fence structures is a
common pattern.

Reported-by: codex:gpt-5.6
Fixes: 3e26d9f08f ("iio: core: Add new DMABUF interface infrastructure")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:04 +01:00
Lars-Peter Clausen
f25ec4627d iio: buffer: Tie IIO dma fence lock lifetime to the fence
The `iio_dma_fence` implementation currently uses a lock embedded in the
`iio_dmabuf_priv`. But the `iio_dma_fence` can outlive the
`iio_dmabuf_priv`, which can cause a use-after-free.

Tie the lifetime of the lock to the lifetime of the fence by embedding them
in the same struct.

We can't just hold a reference to the `iio_dmabuf_priv` from the
`iio_dma_fence` since `iio_buffer_dmabuf_release()` might sleep and the
fence release callback is not allowed to sleep.

Note that the `dma_fence` framework now has an internal lock that gets used
when the passing `NULL` for `lock` in `dma_fence_init()`, but in order to
allow this patch to be backportable use an external lock.

Reported-by: codex:gpt-5.6
Fixes: 3e26d9f08f ("iio: core: Add new DMABUF interface infrastructure")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:03 +01:00
Lars-Peter Clausen
6288b593e7 iio: buffer: Fix potential use-after-free in anonymous buffer release
An anonymous buffer handle holds a reference to the underlying IIO device.
The reference is dropped in the buffer handle's release function. If the
device has been removed, either through unbind or hot-unplug, the buffer
handle might hold the last reference.

The release function takes the mutex for the buffer using a guard, which
means the unlock happens after all the code in the function, including
`iio_device_put()`. If the anonymous buffer holds the last reference this
might free both the IIO device and the buffer, which contains the mutex,
leading to use-after-free when the mutex is unlocked.

Fix this by using a scoped guard just around the buffer dmabuf list access,
making sure the mutex is unlocked before releasing the IIO device.

Version 10 of the patch that introduced this issue used this exact scheme
of first unlocking and then dropping the reference [1]. During review it
was suggested to use a guard instead, and version 11 made that change [2].

Reported-by: codex:gpt-5.6
Fixes: 3e26d9f08f ("iio: core: Add new DMABUF interface infrastructure")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/linux-iio/20240605110845.86740-4-paul@crapouillou.net #[1]
Link: https://lore.kernel.org/linux-iio/20240618100302.72886-4-paul@crapouillou.net #[2]
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:03 +01:00
Babanpreet Singh
f2c5c76306 iio: dac: ad3552r-hs: fix scnprintf() buffer bound in data source show
ad3552r_hs_show_data_source_avail() formats the available data source
names into a 128-byte stack buffer, but bounds each scnprintf() with
PAGE_SIZE instead of the buffer size, so the bound does not protect
the destination at all.

This cannot overflow today - dbgfs_attr_source[] has two entries,
"normal" and "ramp-16bit", 18 bytes formatted - but the bound stops
protecting the stack the day the table grows. Use sizeof(buf) so the
bound matches the destination.

Found by smatch:

  drivers/iio/dac/ad3552r-hs.c:593 ad3552r_hs_show_data_source_avail()
  error: scnprintf() 'buf[len]' too small (128 vs 4096)

Fixes: b1c5d68ea6 ("iio: dac: ad3552r-hs: add support for internal ramp")
Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:03 +01:00
Joshua Crofts
739aac8763 iio: dac: mcp47feb02: add missing 'select REGMAP_I2C' to Kconfig
The Kconfig entry for the MCP47FEB02 is missing a 'select REGMAP_I2C',
causing build failures.

Fixes: bf394cc803 ("iio: dac: adding support for Microchip MCP47FEB02")
Cc: stable@vger.kernel.org
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:51:03 +01:00
Paul Geurts
bcb721c1bc iio: ti-ads7138: Disable STATS_EN bit while reading conversion results
There is a data race in reading the STATS registers, resulting in wrong
data being read. When the data in the RECENT register switches between
0x24F0 and 0x2500, occasionally value 0x2400 or 0x25F0 is read. This
happens when the value is updated in between reading MSB and LSB.

The data sheet says: "Until a new conversion result is available,
previous values can be read from the statistics registers. Before
reading the statistics registers, set STATS_EN to 0 to prevent any
updates to this register block." As the STATS_EN is currently not
cleared, the values of the stats registers might change mid read,
giving faulty values.

Disable the STATS_EN bit before reading one of the statistics registers to
make sure the device does not update the register mid read. This is
applicable to registers MAX_CHn_xSB, MIN_CHn_xSB and RECENT_CHn_xSB.

This means reading one of the statistics registers resets the MAX and
MIN registers. This is unfortunate, but necessary to get correct data
from the device.

Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
Fixes: 024b08fee3 ("iio: adc: Add driver for ADS7128 / ADS7138")
Reviewed-by: David Lechner <dlechner@baylibre.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-07 23:49:34 +01:00
Jishnu Prakash
b39f9b4b21
iio: adc: qcom-spmi-adc5-gen3: Share SDAM0 IRQ with ADC_TM auxiliary driver
The SDAM0 IRQ can be triggered for both EOC (end of conversion) events for
immediate ADC reads done in this driver and for threshold violation events,
based on ADC_TM thresholds configured from the auxiliary ADC_TM driver on
TM channels on the first SDAM.

At present, this interrupt is handled only in the ISR in the main ADC driver.
When the ISR is triggered for an ADC_TM event, this driver notifies the ADC_TM
driver by calling a notifier callback exposed from it for this purpose.

To simplify the interrupt handling in both drivers, share the interrupt between
the drivers. With this, ADC_TM interrupts on SDAM0 will be handled directly in
the ADC_TM driver, so remove the notifier callback and all TM interrupt
handling in the main ADC ISR.

Signed-off-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Link: https://patch.msgid.link/20260722-gen3_adc_tm-v4-2-011981f756c8@oss.qualcomm.com
2026-08-07 17:18:44 +02:00
Jishnu Prakash
7680af9184
iio: adc: qcom-spmi-adc5-gen3: Remove an unnecessary print
devm_request_threaded_irq() internally prints an error message using
dev_err_probe() in case of any errors. Remove the error print in the
devm_request_threaded_irq() failure path as it is not needed.

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jishnu Prakash <jishnu.prakash@oss.qualcomm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Link: https://patch.msgid.link/20260722-gen3_adc_tm-v4-1-011981f756c8@oss.qualcomm.com
2026-08-07 17:18:42 +02:00
Joshua Crofts
350d1fb920 iio: dac: mcp47a1: add support for new device
The Microchip MCP47A1 is a 6-bit volatile Digital-to-Analog converter
which communicates via I2C.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 01:09:56 +01:00
Francesco Lavra
4a56c646e1 iio: imu: st_lsm6dsx: Update enable mask when using sensor fusion
The enable_mask struct member keeps track of which sensors are enabled in
the IMU. When enabling and disabling the sensor fusion functionality, the
driver does not properly update this struct member. This prevents a correct
calculation of the number of samples that should be read from the hardware
FIFO; as a result, reads from the FIFO can be unnecessarily split into
multiple transactions, some of which can read past the FIFO length.

Fixes: cd4e1141bf ("iio: imu: st_lsm6dsx: Add support for rotation sensor")
Signed-off-by: Francesco Lavra <flavra@baylibre.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 00:03:28 +01:00
Giorgi Tchankvetadze
8756acd309 iio: light: cm32181: return zero after writing calibscale
The write_raw callback is documented to return 0 on success or a
negative error code.  However, the IIO_CHAN_INFO_CALIBSCALE case
returns 'val' (the user-supplied value) instead of 0.

Fix it by returning 0 on success, matching the behavior of other
calibscale implementations in the subsystem.

Fixes: 971672c0b3 ("iio: add Capella CM32181 ambient light sensor driver.")
Signed-off-by: Giorgi Tchankvetadze <giorgi@tchankvetadze.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 00:03:28 +01:00
Wadim Mueller
d240b0b8a1 iio: flow: add Sensirion SLF3S liquid flow sensor driver
Add a driver for the Sensirion SLF3S family of digital
liquid-flow sensors on I2C.  Currently supported variants are
SLF3S-0600F, SLF3S-1300F and SLF3S-4000B; they share the same
register map and differ only in flow-scale factor and calibrated
measurement range.  The variant (and therefore the scale) is
auto-detected from the product-information register at probe time;
a sensor reporting an unknown sub-type falls back to the variant
named in the device tree / I2C table, so a drop-in replacement part
keeps working on a kernel that does not know its sub-type yet.

Each measurement frame returns a 16-bit signed flow value, a
16-bit signed temperature reading and a status word, each
protected by a CRC-8 byte.  The driver exposes the flow rate as
IIO_VOLUMEFLOW and the temperature as IIO_TEMP via the standard
IIO read_raw / read_scale interface.

The volume-flow scale is reported in m^3/s.  As the per-LSB scale
is on the order of 1e-12 m^3/s, it is emitted as a 64-bit
fixed-point value with femto (1e-15) resolution
(IIO_VAL_DECIMAL64_FEMTO) so the small SI value keeps full
precision.  This relies on the IIO_VAL_DECIMAL64_FEMTO format type
added earlier in this series.

The active calibration medium can be switched at runtime between
the factory-calibrated water and isopropyl-alcohol modes via the
in_volumeflow_medium sysfs attribute; the sensor starts in water
mode after probe.

The sensor has no low-power state of its own, so system suspend
stops the measurement and disables the vdd supply; resume powers
the sensor back up, waits out the power-up time and restarts the
measurement with the previously active medium, following the
scd30/scd4x precedent.

This driver also creates the drivers/iio/flow/ subdirectory and
the corresponding Kconfig/Makefile glue.

Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 00:03:28 +01:00
Wadim Mueller
1647a1b673 iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
Extend the IIO_VAL_DECIMAL64_* family with a femto-scaled variant
(scale 15), following the existing MILLI/MICRO/NANO/PICO pattern. Both
the read formatting path in __iio_format_value() and the write parsing
path in iio_write_channel_info() (via kstrtodec64()) already derive
their scale from "type - IIO_VAL_DECIMAL64_BASE", so the new type only
needs to be added to the respective switch cases.

This is needed by drivers reporting very small SI quantities where the
existing pico scale loses precision. For example the Sensirion SLF3S
liquid flow sensor reports its volume-flow scale in m^3/s, where the
SLF3S-0600F scale is ~1.667e-12 m^3/s: at pico scale only a single
significant digit survives, whereas femto scale preserves the full
sensor resolution.

Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
Reviewed-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 00:03:28 +01:00
Wadim Mueller
22bba9dfd2 iio: types: add IIO_VOLUMEFLOW channel type
Add a new IIO channel type for liquid volumetric flow sensors.  The
unit exposed via the standard _scale attribute is cubic metres per
second (m^3/s), following the SI convention used by the other IIO
channel types.

Update iio-core's name table, the iio_event_monitor whitelist and
the sysfs-bus-iio ABI document to match.  The new _scale attribute is
folded into the existing shared _scale block; only the per-type _raw
needs a fresh entry.

Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-05 00:02:55 +01:00
Marcelo Schmitt
d9166f1a99 iio: adc: ltc2378: Add support for LTC2338-18
LTC2338-18 is similar to LTC2378-18, differentiating from the already
supported part mainly on the embedment of an internal voltage reference and
addition of a resistor divider network connected to the input signal path.
Extend the device driver, handling the internal reference and input signal
attenuation, enabling it to also support LTC2338-18.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:33 +01:00
Marcelo Schmitt
54355e3b18 iio: adc: ltc2378: Enable triggered buffer data capture
Enable users to run triggered data captures with LTC2378 and similar ADCs.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:33 +01:00
Marcelo Schmitt
b587716e8c iio: adc: ltc2378: Enable high-speed data capture
Make use of SPI transfer offloading to speed up data capture, enabling data
acquisition at faster sample rates (up to 2 MSPS).

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:33 +01:00
Marcelo Schmitt
469eafdc69 iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Support for LTC2378-20 and similar analog-to-digital converters.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:33 +01:00
Sang-Heon Jeon
017e71cbe0 iio: magnetometer: ak8974: remove conditional return with no effect
Both branches of the check return the same value, so the check has no
effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:32 +01:00
Sang-Heon Jeon
0addd3b688 iio: light: tsl2583: remove conditional return with no effect
Both branches of the check return the same value, so the check has no
effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:32 +01:00
Sang-Heon Jeon
14ba50c036 iio: adc: rcar-gyroadc: remove rcar_gyroadc_set_power() helper
rcar_gyroadc_set_power() just calls pm_runtime_resume_and_get() or
pm_runtime_put_autosuspend() depending on its bool argument. Call them
directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:32 +01:00
Sang-Heon Jeon
9bd7d3ea05 iio: light: vcnl4000: remove vcnl4000_set_pm_runtime_state() helper
vcnl4000_set_pm_runtime_state() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:32 +01:00
Sang-Heon Jeon
434291cc8a iio: light: vcnl4035: remove vcnl4035_set_pm_runtime_state() helper
vcnl4035_set_pm_runtime_state() just calls pm_runtime_resume_and_get()
or pm_runtime_put_autosuspend() depending on its bool argument. Call
them directly and remove the helper.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:32 +01:00