Commit Graph

1165 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Sang-Heon Jeon
75056737b6 iio: light: tsl2583: remove tsl2583_set_pm_runtime_busy() helper
tsl2583_set_pm_runtime_busy() 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.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sang-Heon Jeon <ekffu200098@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
7f61f41a3f iio: light: isl29028: remove isl29028_set_pm_runtime_busy() helper
isl29028_set_pm_runtime_busy() 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.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sang-Heon Jeon <ekffu200098@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
42e8791841 iio: light: tsl2583: return zero in write_raw() on success
tsl2583_write_raw() returns the value of pm_runtime_put_autosuspend(),
which is 1 if the device is already runtime suspended.

In that case write() on the sysfs attribute returns 1 instead of the
number of bytes written. Make tsl2583_write_raw() always return zero
on success.

Fixes: 371894f5d1 ("iio: tsl2583: add runtime power management support")
Signed-off-by: Sang-Heon Jeon <ekffu200098@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
55b7562282 iio: light: isl29028: return zero in write_raw() on success
isl29028_write_raw() returns the value of pm_runtime_put_autosuspend(),
which is 1 if the device is already runtime suspended.

In that case write() on the sysfs attribute returns 1 instead of the
number of bytes written. Make isl29028_write_raw() always return zero
on success.

Fixes: 2db5054ac2 ("staging: iio: isl29028: add runtime power management support")
Signed-off-by: Sang-Heon Jeon <ekffu200098@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
Yuanshen Cao
ac75550ab5 iio: light: tsl2772: fix ALS calibscale readback
The read_raw() implementation uses IIO_LIGHT to distinguish between the
ambient light and proximity channels when handling
IIO_CHAN_INFO_CALIBSCALE.

However, the ALS channel is registered as IIO_INTENSITY, while
write_raw() correctly writes to IIO_INTENSITY. As a result, reading
in_intensity0_calibscale incorrectly returns the proximity gain instead
of the ALS gain.

This causes the following user-visible behavior:
- Writing in_intensity0_calibscale appears to have no effect because the
  readback reports the proximity gain.
- Writing in_proximity0_calibscale causes both in_proximity0_calibscale
  and in_intensity0_calibscale to report the same value.

Fix this by checking for IIO_INTENSITY in read_raw(), matching the
channel definition and the existing write_raw() implementation.

Fixes: 3c97c08b57 ("staging: iio: add TAOS tsl2x7x driver")
Signed-off-by: Yuanshen Cao <alex.caoys@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-08-03 22:32:23 +01:00
Aldo Conte
810634c1f8 iio: light: cm3323: use dev_err_probe() in probe path
Replace dev_err() calls with dev_err_probe() in cm3323_init() and
cm3323_probe(). cm3323_init() is called by cm3323_probe(),  so using
dev_err_probe() ensures that deferred probing is handled
correctly and simplifies error paths.

Remove the redundant error message in cm3323_probe().

Tested on a Raspberry Pi 3B using i2c-stub. The driver probes
successfully and successfully read integration_time after this change.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Suggested-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-27 22:13:08 +01:00
Pan Chuang
9cf89c342b iio: light: Remove redundant dev_err()/dev_err_probe()
Since commit
55b48e23f5 ("genirq/devres: Add error handling in devm_request_*_irq()"),
devm_request_irq() and devm_request_threaded_irq() automatically log
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() and dev_err_probe() calls.

Standardize error check on if (ret) rather than if (ret < 0).

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-27 22:13:08 +01:00
Daniel Schaefer
cad928dad9 iio: hid-sensor: als: scale each channel individually
Some sensors have multiple channels (not just brightness but color ALS
sensors) with different scaling factors.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Link: https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/413
Tested-by: Sven Vainküla <sven@xn--vainkla-r2a.ee> #Asus ProArt PX13 laptop.
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-27 22:12:55 +01:00
Joshua Crofts
176790d0d6 iio: light: opt3001: split opt3001_get_processed() logic
Split the logic inside the opt3001_get_processed() function, as the
current flow is hard to read, mixing IRQ and non-IRQ code blocks.

Separate the IRQ code path into its own function, same for the
non-IRQ path.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-20 02:47:44 +01:00
Colin Ian King
091e7a67a9 iio: light: vcnl4000: make read-only const array regulator_names static
Don't populate the read-only const array regulator_names on the stack
at run time, instead make it static const char * const

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-20 02:40:34 +01:00
Chengrui Liu
0777fb25ed iio: light: tsl2583: migrate to sysfs_emit() and sysfs_emit_at()
Replace sprintf() with sysfs_emit() for single-value sysfs show
functions, and use sysfs_emit_at() for lux_table_show() which
concatenates multiple values. This ensures buffer safety and
follows the modern kernel sysfs API.

Signed-off-by: Chengrui Liu <OrangeBlack0765@outlook.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-19 23:16:22 +01:00
Linus Torvalds
bffa972b3f Android/IIO bugfixes for 7.2-rc3
Here is a set of bugfixes for 7.2-rc3 that resolve a bunch of reported
 issues in just the binder and iio codebases.  Included in here are:
   - binder driver bugfixes for both the rust and c versions for reported
     problems
   - lots and lots of iio driver bugfixes for lots of reported issues
     (including a hid sensor driver bugfix)
 
 Full details are in the shortlog, all of these have been in linux-next
 with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCalNPWw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yltzACdFC2/ouvc1ea1jGFBP1ZN4lKU6gAAn1ak5lRK
 30pEMSmJwYteOj8AlpuE
 =ZIWT
 -----END PGP SIGNATURE-----

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

Pull Android/IIO fixes from Greg KH:
 "Here is a set of bugfixes for 7.2-rc3 that resolve a bunch of reported
  issues in just the binder and iio codebases. Included in here are:

   - binder driver bugfixes for both the rust and c versions for
     reported problems

   - lots and lots of iio driver bugfixes for lots of reported issues
     (including a hid sensor driver bugfix)

  Full details are in the shortlog, all of these have been in linux-next
  with no reported issues"

* tag 'char-misc-7.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (36 commits)
  iio: event: Fix event FIFO reset race
  iio: imu: inv_icm42600: fix timestamp clock period by using lower value
  iio: light: al3010: fix incorrect scale for the highest gain range
  iio: adc: nxp-sar-adc: Fix the delay calculation in nxp_sar_adc_wait_for()
  iio: light: tsl2591: return actual error from probe IRQ failure
  iio: imu: inv_icm42600: fix timestamping by limiting FIFO reading
  iio: imu: st_lsm6dsx: deselect shub page before reading whoami
  rust_binder: clear freeze listener on node removal
  rust_binder: reject context manager self-transaction
  rust_binder: use a u64 stride when cleaning up the offsets array
  binder: fix UAF in binder_free_transaction()
  binder: fix UAF in binder_thread_release()
  rust_binder: synchronize Rust Binder stats with freeze commands
  binder: cache secctx size before release zeroes it
  rust_binder: fix BINDER_GET_EXTENDED_ERROR
  iio: adc: ad7779: add missing 'select IIO_TRIGGERED_BUFFER' to Kconfig
  iio: adc: ad4130: add missing `select IIO_TRIGGERED_BUFFER` to Kconfig
  iio: adc: ti-ads124s08: Return reset GPIO lookup errors
  iio: temperature: Build mlx90635 with CONFIG_MLX90635
  iio: light: al3320a: add missing REGMAP_I2C to Kconfig
  ...
2026-07-12 12:37:28 -07:00
Laxman Acharya Padhya
a41000ba3a iio: light: gp2ap002: Disable regulators on resume failure
If enabling VIO fails after VDD has been enabled, runtime resume
returns without disabling VDD. Likewise, if device reinitialization
fails, both supplies remain enabled. The runtime PM core keeps the
device suspended when its resume callback fails, so the supplies must
be restored to the suspended state.

Disable the supplies enabled by the callback before returning an error.

Fixes: 97d642e230 ("iio: light: Add a driver for Sharp GP2AP002x00F")
Assisted-by: Codex:gpt-5
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-11 23:45:35 +01:00
Pengpeng Hou
daf79105f9 iio: light: rpr0521: Propagate regcache_sync() errors
rpr0521_runtime_suspend() powers the device down and marks the regmap
cache dirty. rpr0521_runtime_resume() syncs the cache before restoring
enabled ALS/PXS channels, but currently ignores a regcache_sync()
failure and can still return success.

Return the regcache_sync() error so resume does not hide a failed
register restore.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-11 23:38:55 +01:00
Pengpeng Hou
7a2ccd0a17 iio: light: vcnl4035: Propagate regcache_sync() errors
vcnl4035_runtime_suspend() marks the regmap cache dirty before runtime
suspend. vcnl4035_runtime_resume() then syncs the cache before re-
enabling ALS, but currently ignores a regcache_sync() failure and can
still report resume success.

Return the regcache_sync() error so the PM core sees the failed register
restore.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-07-11 23:36:34 +01:00
Sanjay Chitroda
636deb551c iio: hid-sensors: align function parenthesis for readability
Adjust alignment of parentheses across HID sensor IIO drivers to
improve readability and maintain consistency with kernel coding style.

While updating the formatting, group related arguments consistently in
multi-line function signatures where appropriate.

No functional change intended.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-07 03:12:50 +01:00
Jonathan Cameron
0932390705 Linux 7.2-rc2
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmpK+lYeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGsv8H/Rn7Hr3Hp8t6au8B
 xQueZThJWjqQ4v8pyLnXF6OomKiDR24OTXMCrFgDkcmZ7RK2ALqowI3tQVwLUTuI
 yUN0qL2z2y+LyTcO0CYf3Lple8KlgLAXYMsv7pGLsOvhS7BW2jW97/bcbpUNxoHb
 eghxqbIEnyRImUbbyg+nW7VVk65RKdPUNkBPXfQ2NMVwe+SDE5Rl+NXNVqDNjGad
 soDTUBrD9yXkWX+4s0myleE62UzzH5nYgGPQeQgYmzWgq7LybH6WBlbQK9D7ODJR
 Cw3LCq1hwZZ2w04Yx+XwMHquGJYHW8L2pj77h95uhzksz8buKnM0AGwBCTC6RMoi
 AyUQvdc=
 =JUWl
 -----END PGP SIGNATURE-----

Merge tag 'v7.2-rc2' into togreg

Linux 7.2-rc2

Done to resolve conflicts with header reorg around mod_devicetable.h
and provide a base for other inflight series that touch the includes.
2026-07-06 16:59:47 +01:00
Jonathan Cameron
4c0ecdbdc0 Merge branch 'iio-inkern-namespace-ib' into togreg
Namespace introduction that may need to be merged into other
trees, hence handled as an immutable branch.
2026-07-05 02:00:22 +01:00
Romain Gantois
ebf1d03dab iio: inkern: Use namespaced exports
Use namespaced exports for IIO consumer API functions.

This will make it easier to manage the IIO export surface. Consumer drivers
will only be provided access to a specific set of functions, thereby
restricting usage of internal IIO functions by other parts of the kernel.

This change cannot be split into several parts without breaking
bisectability, thus all of the affected drivers are modified at once.

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for power-supply
Acked-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-05 01:37:19 +01:00
Vidhu Sarwal
aa411adc6c iio: light: al3010: fix incorrect scale for the highest gain range
al3010_scales[] encodes the highest gain range as {0, 1187200}.
For IIO_VAL_INT_PLUS_MICRO, the fractional part must be less than
1000000, so the scale 1.1872 should instead be represented as
{ 1, 187200 }.

Since write_raw() compares the value from userspace against this
table, writing the advertised 1.1872 scale never matches the malformed
entry and returns -EINVAL. As a result, the highest gain range cannot
be selected. Reading the scale in that state also reports the malformed
value.

Fixes: c36b5195ab ("iio: light: add Dyna-Image AL3010 driver")
Signed-off-by: Vidhu Sarwal <vidhu.linux@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-05 00:04:18 +01:00
Stepan Ionichev
a00ffd1567 iio: light: tsl2591: return actual error from probe IRQ failure
When devm_request_threaded_irq() fails, probe logs the error and
then returns -EINVAL, dropping the real error code and breaking the
deferred-probe flow for -EPROBE_DEFER.

Return ret directly; the IRQ subsystem already prints on failure.

Fixes: 2335f0d7c7 ("iio: light: Added AMS tsl2591 driver implementation")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-05 00:02:10 +01:00
Uwe Kleine-König (The Capable Hub)
995832b2ce Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files)
Replace the #include of <linux/mod_devicetable.h> by the more specific
<linux/device-id/*.h> where applicable. For most cases the include
can be dropped completely, only a few drivers need one or two headers
added.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-07-03 07:38:17 +02:00
Sanjay Chitroda
7d362d3393 iio: light: hid-sensor-als: Avoid race between callback setup and device exposure
The driver currently exposes the IIO device to userspace before
completing sensor hub callback registration, and similarly removes
callbacks while the device can still be accessed during teardown.

This creates a timing window where userspace may enable the buffer
before callbacks are available. In such cases:
- samples can be dropped,
- buffered reads may observe stale or no data.

Reorder probe and remove paths to ensure callbacks are active before
device exposure and are removed after device is no longer accessible.

This avoids a race window leading to data loss.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-02 20:35:46 +01:00
Sanjay Chitroda
49e6634719 iio: light: hid-sensor-prox: Avoid race between callback setup and device exposure
The driver currently exposes the IIO device to userspace before
completing sensor hub callback registration, and similarly removes
callbacks while the device can still be accessed during teardown.

This creates a timing window where userspace may enable the buffer
before callbacks are available. In such cases:
- samples can be dropped,
- buffered reads may observe stale or no data.

Reorder probe and remove paths to ensure callbacks are active before
device exposure and are removed after device is no longer accessible.

This avoids a race window leading to data loss.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-02 20:35:46 +01:00
Joshua Crofts
9efcc9ba9b iio: light: al3320a: add missing REGMAP_I2C to Kconfig
The Kconfig entry for the al3320a is missing a `select REGMAP_I2C`,
causing build failures.

Fixes: 1850e6ae7f ("iio: light: al3320a: Implement regmap support")
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-01 02:10:46 +01:00
Joshua Crofts
84486e3bbd iio: light: al3010: add missing REGMAP_I2C to Kconfig
The KConfig entry for the AL3010 is missing a `select REGMAP_I2C`,
causing build failures.

Fixes: 0e5e21e23d ("iio: light: al3010: Implement regmap support")
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-01 02:10:37 +01:00
Joshua Crofts
a2d30022b7 iio: light: al3000a: add missing REGMAP_I2C to Kconfig
The KConfig entry for the al3000a is missing a `select REGMAP_I2C`,
causing build failures.

Fixes: d531b9f789 ("iio: light: Add support for AL3000a illuminance sensor")
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: David Heidelberg <david@ixit.cz>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-07-01 02:10:23 +01:00
Uwe Kleine-König (The Capable Hub)
0a20c840d6 iio: Initialize spi_device_id arrays using member names
While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
spi_device_id that replaces .driver_data by an anonymous union.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:56 +01:00
Joshua Crofts
cf12f69291 iio: light: opt3001: add comment to mutex
Add comment to mutex per checkpatch.pl report. While we're at it, add
a comment to bool ok_to_ignore_lock.

No functional change.

Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:54 +01:00
Joshua Crofts
a4e80b835f iio: light: opt3001: switch driver to managed resources
Move the driver to use devm_* functions to automate resource
management and simplify error handling. This also allows removal
of the opt3001_remove() function.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:54 +01:00
Joshua Crofts
1bff00e98c iio: light: opt3001: move driver to guard(mutex)() use
Move driver to use guard(mutex)() macro, to facilitate automatic
locking/unlocking of resources. This modernizes the driver and
improves code style.

While at it, remove unnecessary gotos and return variables.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:54 +01:00
Joshua Crofts
960642100c iio: light: opt3001: localize for loop iterator
Localize loop iterator to tighten scope and improve code style
per checkpatch.pl report.

No functional change.

Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:54 +01:00
Joshua Crofts
9b77844951 iio: light: opt3001: ensure correct parenthesis alignment
Ensure correct parenthesis alignment per checkpatch.pl report.

No functional change.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Maxwell Doose <m32285159@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-06-30 00:15:54 +01:00