summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)Author
2026-11-16Merge tag 'char-misc-7.4-rc4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc/iio driver fixes from Greg KH: "Here are a bunch of char, misc, and iio driver fixes for reported problems for 7.4-rc4. Included in here are: - usual collection of lots of IIO driver fixes for issues - binder driver fix - iio, w1, and comedi driver fixes found and fixed by Josef - comedi driver fix for a reported problem - other misc driver fixes All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-7.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (68 commits) iio: hid-sensors: fix fractional part for unit exponents -7 and -8 iio: trigger: free the trigger ID after device_del() iio: hid-sensors: fix a division by zero iio: humidity: hid-sensor-humidity: Use per-instance callbacks iio: temperature: hid-sensor-temperature: Use per-instance callbacks comedi: comedi_bond: Fix leak of opened device references mei: me: add ice lake point LP iTouch DID mei: lb: read the MTU once rust_binder: push BR_TRANSACTION_COMPLETE before BR_FAILED_REPLY misc: ibmvmc: initialize HMC state before device registration w1: w1_therm: leave the slaves of other families alone w1: w1_therm: lock the list of slaves for the bulk read w1: don't hold list_mutex while a slave is torn down w1: netlink: drop the slave after the bus is unlocked w1: ds2805: use the bus mutex to talk on the bus w1: ds28e04: use the bus mutex to talk on the bus w1: ds2482: set the strong pull-up with its byte w1: remove the master's files before taking its locks w1: use the bus mutex for the "rw" file misc: bcm-vk: fix DMA allocation memory leak ...
2026-11-11iio: hid-sensors: fix fractional part for unit exponents -7 and -8Srinivas Pandruvada
split_micro_fraction() scales the remainder to micro units by multiplying it by 10^(6 - exp). The unit exponent of a HID field goes down to -8, so exp can be 7 or 8 here. Then the argument of int_pow() is negative, which the unsigned parameter turns into a huge power of ten: 0 modulo 2^64. As a result, the fractional part of a value read from the hysteresis attributes is always reported as 0. Divide by 10^(exp - 6) in these two cases. This matches the reverse conversion in convert_to_vtf_format(). Fixes: 73c6768b710a ("iio: hid-sensors: Common attribute and trigger") Cc: stable@vger.kernel.org Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Tested-by: Semyon Maryasin <simeon@maryasin.name> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-11iio: trigger: free the trigger ID after device_del()Changyul Lee
iio_trigger_unregister() returns the trigger ID to iio_trigger_ida before device_del() removes the "trigger<N>" device. A trigger registered in between can get the same ID, and its device_add() fails: sysfs: cannot create duplicate filename '/bus/iio/devices/trigger0' For example, adding a sysfs trigger while an hrtimer trigger is being removed through configfs, or the other way around, hits this because the two paths do not share a lock. Free the ID after device_del(), as the error path of iio_trigger_register() already does, and drop the "Possible issue in here" comment. Fixes: 1637db44413e ("Staging: IIO: Trigger support added to core.") Signed-off-by: Changyul Lee <lcy8047@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-11iio: hid-sensors: fix a division by zeroJosef Bacik
convert_to_vtf_format() divides the micro part of a value by 10^(6 + exp). The unit exponent of a HID field is a nibble and goes down to -8. For -7 and -8 the argument of int_pow() is negative, which the unsigned parameter turns into a huge power of ten: 0 modulo 2^64. The division by it is a divide error. The exponent comes from the report descriptor of the sensor hub, the value from a write to the hysteresis attribute of the IIO device. Multiply by 10^(-exp - 6) in these two cases. Fixes: 73c6768b710a ("iio: hid-sensors: Common attribute and trigger") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-11iio: humidity: hid-sensor-humidity: Use per-instance callbacksChristopher Hoover
hid-sensor-humidity keeps a single static struct hid_sensor_hub_callbacks for all instances and overwrites its pdev in every probe, so with two humidity sensors, input reports for one are delivered with the other's platform device, and a NULL dereference follows once that device is removed. The same bug was found in hid-sensor-temperature, which shares this code. Keep the callbacks in struct hid_humidity_state, as the other HID sensor drivers (accel, gyro, als, ...) do. Fixes: d7ed89d5aadf ("iio: hid: Add humidity sensor support") Cc: stable@vger.kernel.org Signed-off-by: Christopher Hoover <ch@murgatroid.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-11iio: temperature: hid-sensor-temperature: Use per-instance callbacksChristopher Hoover
hid-sensor-temperature keeps a single static struct hid_sensor_hub_callbacks for all instances and overwrites its pdev in every probe. With two temperature sensors, input reports for one are delivered with the other's platform device; once that device is removed, platform_get_drvdata() returns NULL and temperature_capture_sample() dereferences it: BUG: kernel NULL pointer dereference, address: 00000000000003a8 RIP: 0010:temperature_capture_sample+0xd/0x50 [hid_sensor_temperature] The oops happens in sensor_hub_raw_event() with the hub's spinlock held, so the hub's removal then hangs. It reproduces with two uhid devices that each declare a temperature sensor, one destroyed while the other still sends input reports. Keep the callbacks in struct temperature_state, as the other HID sensor drivers (accel, gyro, als, ...) do. Fixes: 59d0f2da3569 ("iio: hid: Add temperature sensor support") Cc: stable@vger.kernel.org Signed-off-by: Christopher Hoover <ch@murgatroid.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-05treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() familyKees Cook
Mirroring the earlier kmalloc_obj() conversion, convert the device-managed allocators over to the type-based API using the now updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived from the type rather than written out as a sizeof(), and the result is a pointer to that type rather than void *, so a mismatch between the size requested and the variable assigned becomes a build error instead of being silently accepted. The conversions break down as: 6713 devm_kzalloc_obj() 1749 devm_kzalloc_objs() 307 devm_kzalloc_flex() 91 devm_kmalloc_objs() 82 devm_kmalloc_obj() 2 devm_kmalloc_flex() The rules deliberately leave alone allocations sized by a string or a byte-sized type, or assigned to a pointer to a byte-sized type, since those are byte buffers rather than objects. Allocations sized by a multi-byte integer type are only converted when they are assigned to a pointer to that same type, and allocations of pointers to integers or of void pointers are left alone too. After this change, 528 files still call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or devm_kmalloc_array(). Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC 16.2.0 with no new warnings. Signed-off-by: Kees Cook <kees+treewide@kernel.org>
2026-11-02iio: hid-sensor: Fix scale for magnetic north headingMaximilian Czirr
hid_sensor_format_scale() applies the HID unit exponent only when the usage and unit match an entry in unit_conversion[]. Rotation-from-north support uses HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, but that usage has no entry in the conversion table. As a result, the unit exponent is ignored and the heading can be exposed with a scale of 1 instead of the scale specified by the HID descriptor. Add a unitless conversion entry so the HID unit exponent is applied to the magnetic north heading. A sensor reporting an exponent of -5 then correctly exposes a scale of 0.00001 instead of 1. Fixes: abea9c62c32f ("iio: hid-sensor-magn-3d: Add support for rotation from north") Cc: stable@vger.kernel.org Signed-off-by: Maximilian Czirr <maxx-cz@web.de> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: afe: rescale: expose offset if rescaler or source has oneAndrea Amer
A rescale channel advertises IIO_CHAN_INFO_OFFSET only when its own offset is non-zero. A child rescale therefore hides a source offset, and consumers apply raw * scale and drop it, even though rescale_read_raw() folds the source offset in. Expose the attribute when either the rescaler or the source channel provides an offset. Fixes: a29c3283653b ("iio: afe: rescale: add offset support") Signed-off-by: Andrea Amer <and.amer@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: accel: kxsd9: Fix potential use-after-free on removalGuangshuo Li
Unregistering an IIO device with an active triggered buffer detaches its poll function. Freeing the poll function first can therefore make iio_device_unregister() access freed memory. Unregister the device before cleaning up the triggered buffer. This issue was found by our static analysis tool under development. Fixes: 0427a106a98a ("iio: accel: kxsd9: Add triggered buffer handling") Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn> Reviewed-by: Joshua Crofts <crofts@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: adc: qcom-spmi-adc5-gen3: Reuse IIO device ID for ADC_TM aux deviceLoic Poulain
adc5_gen3_add_aux_tm_device() never sets the auxiliary device id, so every ADC5 Gen3 instance with at least one qcom,adc-tm channel tries to register the same device name. With ADC_TM channels on more than one PMIC, the second instance to probe fails: sysfs: cannot create duplicate filename '/bus/auxiliary/devices/qcom_spmi_adc5_gen3.adc5_tm_gen3.0' ... auxiliary qcom_spmi_adc5_gen3.adc5_tm_gen3.0: adding auxiliary device failed!: -17 qcom-spmi-adc5-gen3 c400000.spmi:pmic@8:adc@7200: error -EEXIST: Failed to add auxiliary TM device The ADC probe then fails as a whole, so that PMIC loses both its IIO channels and its thermal zones. This shows up on Nord, which has thermistor channels on two PMAU0102 PMICs. Each ADC instance already has a unique IIO device ID. Use it as the auxiliary device id instead of allocating one from a separate driver-wide IDA, which removes the custom ID allocation and release handling. The ADC_TM driver matches on the device name only, so the instance number does not affect binding. Fixes: baff45179e90 ("iio: adc: Add support for QCOM PMIC5 Gen3 ADC") Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com> Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: light: hid-sensor-als: Don't read past the end of short fieldsDaniel Schaefer
Reports are not guaranteed to be 4 bytes. On color ALS sensors there are fields that can be shorter than 4 bytes: 16-bit illuminance, color temperature and chromaticity x/y. I don't have such a sensor right now, but I have emulated one in firmware. With this patch, no garbage data is read from the next report: before: 05dc02bc 05dc02bc 190005dc 0ce41900 00000ce4 after: 000002bc 000002bc 000005dc 00001900 00000ce4 Same fix as commit ad02ca57e44e ("iio: hid-sensor-prox: Add support for 16-bit report size"). Fixes: ed5514c925a0 ("iio: hid-sensors: Added ALS") Signed-off-by: Daniel Schaefer <dhs@frame.work> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: accel: adxl380: don't stay in standby on -EINVALJosef Bacik
adxl380_set_act_inact_threshold() puts the sensor into standby, writes the threshold and switches the measurement on again. A threshold above 8191 is refused in between, and the sensor stays in standby: no samples and no events until the next write that succeeds. adxl380_set_range() has the same problem and a worse one. It rescales both thresholds for the new range. If one no longer fits it returns -EINVAL with the sensor in standby, the new range in the chip, the old one in st->range and rescaled thresholds in the driver's state: from the next successful write on the samples are reported with the wrong scale. Switch the measurement on again if the threshold is refused. In adxl380_set_range() see whether the thresholds fit before anything is changed. Fixes: df36de13677a ("iio: accel: add ADXL380 driver") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: adc: check the result of ad_sd_init()Josef Bacik
ad_sd_init() asks for the optional "rdy" GPIO and returns the error if that fails, for instance -EPROBE_DEFER. The binding of the AD7780 describes such a GPIO. ad7780, ad7791, ad7793 and max11205 ignore the result. The function has then returned before it set the driver data of the IIO device, which devm_ad_sd_setup_buffer_and_trigger() dereferences a few lines further down in these probe functions, and sigma_delta->rdy_gpiod holds an ERR_PTR() which ad_sigma_delta_clear_pending_event() takes for a GPIO. Return the error, as the other users of the library do. Fixes: a87ef09b1fdf ("iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: adc: ad7923: add the AD7927 to the SPI ID tableJosef Bacik
The binding describes the AD7927 as compatible = "adi,ad7927", "adi,ad7928"; The OF match takes the second string. The modalias of the SPI device is made from the first one, "ad7927", which is not in the spi_device_id table: spi_get_device_id() returns NULL and ad7923_probe() dereferences it for the chip information. The module is not loaded automatically either, as the uevent of an SPI device says "spi:ad7927". Add the name, with the data of the AD7928. Fixes: 1140f96cd4af ("dt-bindings: iio: adc: ad7923: adjust documentation") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: addac: ad74413r: fix the values of set_multipleJosef Bacik
ad74413r_gpio_set_multiple() walks over the lines in the mask and looks up the new value of each with if (*bits & offset) offset is the number of the line, not a bit mask. Line 0 is always driven low, line 1 gets the value meant for line 0, line 2 the one meant for line 1, and line 3 is driven high if either of these two is. Test the bit which belongs to the line. Fixes: fea251b6a5db ("iio: addac: add AD74413R driver") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: sx9310: use the data of the I2C tableJosef Bacik
sx9310_check_whoami() takes the chip information from device_get_match_data(), which only looks at the OF and ACPI tables, and dereferences it. For a client which was bound through the i2c_device_id table, for instance one created with echo sx9310 0x28 > /sys/bus/i2c/devices/i2c-1/new_device it returns NULL, and the kernel oopses as soon as something at that address answers the read of the WHOAMI register. The I2C table has the same pointers. Use i2c_get_match_data(), which falls back to it. Fixes: 21fd3b1373f6 ("iio: proximity: sx9310: Convert enum->pointer for match data table") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: proximity: sx9500: ignore event config writes that don't change stateArnav Kapoor
sx9500_write_event_config() adjusts the channel and close/far user counts on every write, even when the event is already in the requested state. Writing 0 to a disabled event and then 1 leaves the counts at 0, so the channel and its interrupts stay off while the event reads as enabled. As channel_users[] is shared with raw reads, those can then wait forever for a conversion. Writing 1 twice and then 0 has the opposite effect. Return early when the state doesn't change, as sx_common_write_event_config() does. Fixes: 4193c0f1d863 ("iio: driver for Semtech SX9500 proximity solution") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: dac: mcp4725: Update the cached DAC value only on successBaek Kyu, Kim
mcp4725_write_raw() updates dac_value even if mcp4725_set_value() rejects the requested value or reports an I2C transfer error. After writing 1000, a rejected write of 4096 returns -EINVAL without an I2C transfer, but out_voltage0_raw reports 4096. A later powerdown exit sends 00 00 instead of the 03 e8 frame for the last successful value. The EEPROM store path uses the same cache. Return the setter error before updating dac_value. This keeps the last successful software value for readback, powerdown exit and EEPROM writes. Fixes: cf35ad61aca2 ("iio: add mcp4725 I2C DAC driver") Signed-off-by: Baek Kyu, Kim <pocj8ur4in@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: proximity: sx9360: fix sampling frequency write and available rangeArnav Kapoor
GNRL_CTRL1/2 hold the scan period in units of 8192 / FOSC, but sx9360_set_samp_freq() computes freq * 8192 / FOSC and mis-scales val2, which is in micro units. Any integer frequency then programs a period of 0, and fractional parts above ~0.26 Hz overflow the int, writing 0x10 to GNRL_CTRL1 outside the SCANPERIOD field. Compute FOSC / (freq * 8192), rounded to the closest value, and reject frequencies outside the 1..2047 period range. The available range doesn't match the limits in the comments next to it either: 4 MHz / 8192 is 488.28125 Hz, not 448.28125 Hz, 4 MHz / (8192 * 2047) is 0.238535 Hz, and (max - min) / 2047 is 0.238419 Hz. Use those values. Fixes: 1cdb4c47f7f5 ("iio:proximity:sx9360: Add sx9360 support") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: dac: mcp47feb02: reject out-of-range raw valuesDavid Carlier
mcp47feb02_write_raw() writes the user supplied raw value to the DAC register without checking it against the chip resolution. The parts are 8, 10 or 12 bit, and the bits above the resolution are not implemented, so writing 300 to out_voltage0_raw on an 8-bit part sets the output to code 44 instead of failing, and -1 is written as 0xffff. The out-of-range value is also cached in dac_data, so it is written back on resume and stored to EEPROM by store_eeprom. Return -EINVAL for values outside [0, 2^resolution - 1]. Fixes: bf394cc80369 ("iio: dac: adding support for Microchip MCP47FEB02") Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: David Carlier <devnexen@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: adc: mcp3564: reject devices without match dataArnav Kapoor
When the chip can't be identified from its ID registers, the driver falls back to spi_get_device_match_data() and dereferences the result unconditionally. That returns NULL for a device bound through driver_override whose name isn't in the id table, causing an oops. Return -ENODATA in that case. Fixes: 33ec3e5fc1ea ("iio: adc: adding support for MCP3564 ADC") Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr changeJean-Baptiste Maneyrol
For getting all odr change events, we need to parse all FIFO frames in each iio device. Fix this correctly by sending effectively all frames to all iio devices. Previously only batches of frames containing a matching sensor event were sent to the corresponding iio device. Fixes: f670d4d34773 ("iio: imu: inv_icm42600: fix odr change not caught in certain cases") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: inv_sensors: do not compute period estimation when updating odrJean-Baptiste Maneyrol
When odr is updated, the delta between the interrupts will change and it will lead to a bad period estimation. Avoid this by preventing the period estimation in this case. Fixes: 82bd09ce4fd3 ("iio: inv_sensors: improve period measurement by using a longer delay") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: inv_sensors: prevent timestamps going back in time in transitionsJean-Baptiste Maneyrol
Ensure when computing first timestamp and when applying odr change, that the next timestamp will not be lower than the previous one. This way there is no risk to have a timestamp going back in time, meaning being lower than the previous one. It already can never happen without a transition because we are generating timestamps by adding the period to the last timestamp. Fixes: 0ecc363ccea7 ("iio: make invensense timestamp module generic") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: proximity: sx9324: fix out-of-bounds read of scan period tableArnav Kapoor
The scan period of the SX9324 is selected by the 5 bit wide SX9324_REG_GNRL_CTRL0_SCANPERIOD field, so it has 32 possible values. sx9324_scan_period_table[] however only has 16 entries, it was copied over from the SX9310 driver where the field is only 4 bits wide. sx9324_wait_for_sample() indexes the table with the raw field value, so all the codes from 16 to 31 read past the end of the array. The default value of the register is SX9324_REG_GNRL_CTRL0_SCANPERIOD_100MS (0x16, i.e. 22), so the out-of-bounds read happens with the default configuration of the device. It is only avoided when the device has an interrupt line, as the wait is only done in the polling case. The value read is then used as the duration of an msleep() call, so the sensor is polled with a completely random delay. Fill the table with the scan periods of all 32 codes, which are the periods documented for the corresponding sx9324_samp_freq_table[] entries, and add a static assertion to keep both tables in sync. Fixes: 4c18a890dff8 ("iio:proximity:sx9324: Add SX9324 support") Cc: stable@vger.kernel.org Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: light: tsl2591: don't divide by zeroJan Remes
The TSL2591 has two raw light channels - CH0 and CH1. The algorithm for calculating illumination from the raw channels requires division by CH0 (which can be zero) and by "counts per lux" (CPL) value which is also zero for (gain = LOW, integration time <= 400 ms). Furthermore, the algorithm assumes CH0 > CH1, which can be violated in almost complete darkness. As a result, reading from 'in_illuminance_input' results in division-by-zero whenever CH0 is 0 (complete darkness) or whenever the parameters result in CPL being zero. This results in kernel oops on x86_64 and in reading the value as 0 on arm64. Fix that by: - reporting CH0 <= CH1 as zero (catches also CH0 = 0) - updating the lux algorithm to only do the division at the end Fixes: 2335f0d7c790 ("iio: light: Added AMS tsl2591 driver implementation") Cc: stable@vger.kernel.org Reported-by: Martin Triska <martin.triska@mycroftmind.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jan Remes <jan.remes@mycroftmind.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: adc: aspeed: Use syscon phandle for trimming data when availableBilly Tsai
aspeed_adc_set_trim_data() locates the SCU holding the ADC's reference-voltage trimming data with of_find_node_by_name(NULL, "syscon"), a global search that matches the first device-tree node named "syscon" regardless of which SCU instance it actually is. On AST2700, which splits its SCU into "syscon0" (soc0) and "syscon1" (soc1), both nodes share the same node name "syscon" and only differ by label and unit address, so the lookup always resolves to syscon0 even though the ADC's trimming data lives in syscon1. Use the new "aspeed,trim-syscon" phandle property when present to look up the correct regmap directly, falling back to the old global by-name search when the property is absent so existing device trees keep working. Fixes: 9d8b88ffb773 ("iio: adc: aspeed: Add AST2700 ADC support") Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: temperature: mlx90614: Fix dual channel probe condition checkSalah Triki
In mlx90614_probe_num_ir_sensors(), the check on chip_info->dual_channel is inverted. Currently, if dual_channel is true (MLX90614), the function returns 0 immediately without checking op_eeprom_config1. This forces all MLX90614 devices to be registered as single sensor (num_channels = 2), making the second object temperature channel inaccessible. Conversely, if dual_channel is false (MLX90615), the function skips the early return and performs an unnecessary SMBus read on EEPROM CONFIG1 even though MLX90615 does not support dual channel operation. Fix this by negating the condition so that single-channel chips return early with 0, while dual-channel capable chips (MLX90614) proceed to read the EEPROM configuration register to detect whether 1 or 2 object channels are present. Fixes: 3d5ead238bc8 ("iio: mlx90614: Factor our register IO and constants into model specific descriptor") Signed-off-by: Salah Triki <salah.triki@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: humidity: am2315: fix negative temperature decodingVidhu Sarwal
The AM2315/AM2320 report temperature as a sign-magnitude value, with bit 15 as the sign and bits 14-0 as the magnitude. am2315_read_data() stores the raw value directly in an s16, causing negative temperatures to be interpreted as two's complement. Both the read_raw and the triggered buffer paths are affected. Decode the sign bit before storing the temperature value. Positive readings are unaffected. Fixes: 366a3270c1c5 ("iio: humidity: Add support for AM2315") 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-11-02iio: trigger: Return an error when the trigger has no free irqKarl Mehltretter
iio_trigger_attach_poll_func() prints an error when all CONFIG_IIO_CONSUMERS_PER_TRIGGER irqs of the trigger are in use, but returns 0. The buffer of the extra consumer is enabled without a poll function. Disabling that buffer calls clear_bit() with a negative bit number and drops a module reference for the second time. On arm and arm64 the clear_bit() goes about 512 MB past the pool bitmap. That is an oops if the address is not mapped, and a bit cleared in unrelated memory if it is. Return the error from iio_trigger_get_irq(). Fixes: 995438233579 ("iio: Fix error handling in iio_trigger_attach_poll_func") Cc: stable@vger.kernel.org Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: dac: ad5758: Fix the 4 mA to 20 mA current rangeArka Mondal
Range code 1010 selects 4 mA to 20 mA (data sheet Rev. B, Table 32), but the driver describes it as 4 uA to 24 mA. With the reported scale and offset, userspace converts raw code 0 to about 0 mA instead of 4 mA, and full scale to about 23 mA instead of 20 mA. Describe the range as 4000 to 20000 uA and rename the enum entry to match. A device tree that still has <4 24000> no longer matches any entry in the table, so probe fails with "range invalid". Fixes: 28d1a7ac2a0d ("iio: dac: Add AD5758 support") Signed-off-by: Arka Mondal <arka@arkamondal.net> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: accel: adxl313: add missing buffer selections in KconfigAlexis Bouzigues
The FIFO support added to the ADXL313 core uses devm_iio_kfifo_buffer_setup() and iio_push_to_buffers(), but its Kconfig entry does not select the required buffer support. Enabling either frontend without IIO_BUFFER or IIO_KFIFO_BUF causes undefined references to devm_iio_kfifo_buffer_setup_ext() and iio_push_to_buffers(). Select IIO_BUFFER and IIO_KFIFO_BUF from the shared ADXL313 core symbol so both the I2C and SPI frontends have the required dependencies. Fixes: ff8093fa6ba4 ("iio: accel: adxl313: add buffered FIFO watermark with interrupt handling") Cc: stable@vger.kernel.org Signed-off-by: Alexis Bouzigues <BouziguesAlexis@JohnDeere.com> Tested-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: common: cros_ec_sensors: use sensor_scale union member for CALIBSCALEArnav Kapoor
The IIO_CHAN_INFO_CALIBSCALE read and write paths send MOTIONSENSE_CMD_SENSOR_SCALE, but set the flags through the sensor_offset member of the request union, while the scale values in the write path are filled through sensor_scale. This only works because the sensor_offset and sensor_scale structs of struct ec_params_motion_sense happen to place flags at the same offset. Use the sensor_scale member that matches the command, so all fields of the request are set through the same struct. No functional change. Fixes: ed1f2e85da79 ("iio: cros_ec: Add calibscale for 3d MEMS") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: magnetometer: tlv493d: fix magnetic field scaleViral Patel
The TLV493D-A1B6 datasheet specifies a magnetic resolution of 98 uT/LSB (0.098 mT/LSB). IIO reports magnetic field in Gauss (1 mT = 10 G), so the scale should be 0.98 G/LSB. The driver currently reports 98/1000 = 0.098 G/LSB, which under-reports the magnetic field by a factor of 10. The comment also gives the resolution as 0.0098 mT (9.8 uT), mixing up units. Correct the scale value and the comment. Fixes: 106511d280c7 ("iio: magnetometer: add support for Infineon TLV493D 3D Magentic sensor") Signed-off-by: Viral Patel <viral8854@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-11-02iio: magnetometer: mmc5633: leave cache-only mode before the cache syncShashank Mohan Jain
mmc5633_resume() marks the register cache dirty and calls regcache_sync_region() while the regmap is still in cache-only mode. It calls regcache_cache_only(false) only after the sync. This ordering has been wrong since the driver was added; it happened to work until regmap started rejecting a sync in cache-only mode. Since commit afc8e3ee8307 ("regcache: Validate cache_only state in regcache_sync_region()") a sync in cache-only mode is refused with a WARN and -EINVAL. Every resume now gives WARNING: drivers/base/regmap/regcache.c:536 at regcache_sync_region+0x1a4/0x1c0 ... mmc5633_resume+0x2d/0x70 dpm_run_callback+0x7d/0x1c0 device_resume+0x175/0x270 ... mmc5633_i2c 1-0030: Failed to restore control registers and the control registers are not written. If the chip lost its state during suspend, it runs with the reset value of CTRL1 while the cache, and with it the sampling frequency attribute, still has the configured value. Writing the same frequency again does not repair this, because regmap_update_bits() finds no difference to the cache. Leave cache-only mode first, then mark the cache dirty and sync it. Reproduced in qemu with the I2C driver bound to an i2c-stub device: set in_magn_sampling_frequency to 3.5 (CTRL1 = 0x02), clear CTRL0 and CTRL1 of the stub behind the driver's back to emulate the power loss, and run a suspend/resume cycle with "devices" in /sys/power/pm_test. Without this change CTRL1 is still 0x00 after resume and the warning is printed. With it, and also with the regcache commit reverted, CTRL1 is 0x02 again and there is no warning. Not tested on real hardware. Fixes: 6e5f6bf2e3f0 ("iio: magnetometer: Add mmc5633 sensor") Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: magnetometer: mmc35240: leave cache-only mode before the cache syncShashank Mohan Jain
mmc35240_resume() marks the register cache dirty and calls regcache_sync_region() while the regmap is still in cache-only mode. It calls regcache_cache_only(false) only after the sync. This ordering has been wrong since the resume support was added; it happened to work until regmap started rejecting a sync in cache-only mode. Since commit afc8e3ee8307 ("regcache: Validate cache_only state in regcache_sync_region()") a sync in cache-only mode is refused with a WARN and -EINVAL. Every resume now gives WARNING: drivers/base/regmap/regcache.c:536 at regcache_sync_region+0x1a4/0x1c0 ... mmc35240_resume+0x30/0x70 dpm_run_callback+0x7d/0x1c0 device_resume+0x175/0x270 ... mmc35240 1-0030: Failed to restore control registers and the control registers are not written. If the chip lost its state during suspend, it runs with the reset value of CTRL1 while the cache, and with it the sampling frequency attribute, still has the configured value. Writing the same frequency again does not repair this, because regmap_update_bits() finds no difference to the cache. Leave cache-only mode first, then mark the cache dirty and sync it. Reproduced in qemu with the driver bound to an i2c-stub device: set in_magn_sampling_frequency to 25 (CTRL1 = 0x02), clear CTRL0 and CTRL1 of the stub behind the driver's back to emulate the power loss, and run a suspend/resume cycle with "devices" in /sys/power/pm_test. Without this change CTRL1 is still 0x00 after resume and the warning is printed. With it, and also with the regcache commit reverted, CTRL1 is 0x02 again and there is no warning. Not tested on real hardware. Fixes: 553a776b7908 ("iio: magnetometer: mmc35240: Add PM sleep support") Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: acpi: Accept comma separated values in ROTM stringsYu-Hsiang Tseng
The ROTM method of the MXC6655 accelerometer on the Higole F9B, an Alder Lake-N handheld (AMI BIOS F9D_16G_P800217, DMI strings are all "Default string"), separates the values with a comma and a space: Method (ROTM, 0, NotSerialized) { Name (SBUF, Package (0x03) { "-1, 0, 0", "0, 1, 0", "0, 0, 1" }) Return (SBUF) } iio_read_acpi_mount_matrix() only accepts the space separated form used in Microsoft's example ("0 1 0"). It rejects this matrix and mxc4005 falls back to the identity matrix: mxc4005 i2c-MXC6655:00: Incorrect ACPI mount matrix string format mxc4005 i2c-MXC6655:00: mounting matrix not found: using identity... With the X axis not inverted, iio-sensor-proxy reports left-up when the device is held right-up and vice versa, so the desktop turns the picture upside down whenever the handheld is held in landscape. It is not the only BIOS written this way. The BOSC0200 on the AYANEO Air Plus uses commas in its ROMS method as well, with a space before one of them, and its ROMK method has "1, 0,0": Method (ROMS, 0, NotSerialized) { Name (SBUF, Package (0x03) { "-1, 0, 0", "0, -1 , 0", "0, 0, -1" }) Return (SBUF) } The kernel's sscanf() does not support '%*[', so there is no clean way to take both separators in a single format string. That leaves either a second sscanf() call with a comma format, or normalizing the separator first. Do the latter: turn the commas into spaces before parsing, so the existing "%d %d %d" format, which already takes any amount of white space around the values, keeps working unchanged. The strings live in the buffer acpi_evaluate_object() allocated for us, so they can be modified in place. With this change in_accel_mount_matrix on the Higole F9B reads "-1, 0, 0; 0, 1, 0; 0, 0, 1" and, with no udev hwdb override, the desktop rotates correctly in all four orientations. The AYANEO Air Plus was not tested; systemd's hwdb has an entry for it, which iio-sensor-proxy prefers over the kernel's matrix. Link: https://github.com/hhd-dev/hwinfo/blob/d9508123bee46ae3a59dc24826030ef51ea95058/devices/ayaneo_airplus/acpi/decoded/dsdt.dsl Cc: stable@vger.kernel.org # 6.10.x Signed-off-by: Yu-Hsiang Tseng <asas1asas200@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: atlas-ezo: Fix humidity channel read supportNikhil Gautam
The atlas_ezo_read_raw() function rejects channels that are not of type IIO_CONCENTRATION, preventing the relative humidity channel from reading raw and scale values. Remove the early channel type check to allow both concentration and relative humidity channels to reach the mask-specific handling. Fixes: dc3ebfcaa51f ("iio: chemical: atlas-ezo-sensor: add humidity sensor support") Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Matt Ranostay <matt@ranostay.sg> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: light: vcnl4035: Fix reversed ALS mode bitAlexander Sarmanow
According to the datasheet (table 2) the ALS_SD bit behaves the opposite way the current ALS mode defines are set, writing 0 powers the sensor and writing 1 shuts it down. The current driver thinks the ALS is up while it's actually shut down and it's down when the systems powers it up. Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035") Cc: stable@vger.kernel.org Signed-off-by: Alexander Sarmanow <as@discnull.de> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: common: scmi_sensors: fix truncating 64-bit divisionsArnav Kapoor
do_div() divides a 64-bit dividend by a 32-bit divisor: the divisor is stored in a uint32_t on all architectures. The driver passes 64-bit divisors to it in several places, so they are silently truncated: - scmi_iio_set_odr_val() divides by uHz, which exceeds 32 bits for sampling frequencies above ~4294 Hz. - convert_ns_to_freq() divides by interval_ns, which exceeds 32 bits for update intervals of ~4.29 s and above. If its low 32 bits happen to be zero, this is a division by zero. - scmi_iio_get_odr_val(), scmi_iio_convert_interval_to_ns(), scmi_iio_sensor_update_cb() and scmi_iio_get_raw_available() divide by int_pow(10, n), which returns u64 and exceeds 32 bits for n >= 10. The SCMI exponent fields allow values down to -16. Truncation results in wrong sampling frequency, timestamp and raw_available values being reported to userspace. Use div64_u64() and div64_u64_rem(), which take a 64-bit divisor. Fixes: f774117c96f9 ("iio/scmi: Adding support for IIO SCMI Based Sensors") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202606040245.XfmRpBhA-lkp@intel.com/ Signed-off-by: Arnav Kapoor <kapoorarnav43@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-11-02iio: imu: inv_mpu6050: fix swapped accel and gyro startup timesArnav Kapoor
struct inv_mpu6050_hw declares startup_time as { accel, gyro }, but every entry of hw_info[] initializes it positionally as { *_GYRO_STARTUP_TIME, *_ACCEL_STARTUP_TIME }, so the two values are swapped for all chips. inv_mpu6050_switch_engine() waits for startup_time.gyro after enabling the gyroscope, so it waits for the accelerometer startup time instead, e.g. 20 ms instead of 60 ms on MPU6050 and 20 ms instead of 100 ms on ICM20602, and the first gyroscope samples can be read before the sensor has settled. Enabling only the accelerometer waits longer than needed. Use designated initializers, so each value is assigned to the member it is named after. Fixes: e46a36d92da0 ("Add startup time for each chip using inv_mpu6050 driver") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axesArnav Kapoor
inv_mpu_magn_get_scale() returns st->magn_raw_to_gauss[chan->address], where magn_raw_to_gauss[] holds one coefficient per axis, computed in inv_magn_init() from the per-axis factory sensitivity adjustment values (ASAX, ASAY, ASAZ) of the AK8975/AK8963 magnetometer. However INV_MPU9X50_MAGN_CHAN() never sets .address, so it is 0 for all three magnetometer channels. As a result the Y and Z channels report the scale computed from the X axis adjustment value, and userspace scales the Y and Z readings with the wrong per-axis calibration. Set .address to the axis index (0 for X, 1 for Y, 2 for Z) in the channel macro, matching the order used to fill magn_raw_to_gauss[]. Fixes: b1392de06184 ("iio: imu: inv_mpu6050: add MPU925x magnetometer support") Signed-off-by: Arnav Kapoor <kapoorarnav43@gmail.com> Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: proximity: hx9023s: Allocate trigger before requesting IRQMyeonghun Pak
An IRQ handler that already read trigger_enabled can poll data->trig after buffer disable. Detaching the virtual IRQ does not join this physical IRQ, and trigger deselection can drop the consumer reference. Devres may then free the trigger before joining the handler. Allocate the trigger before requesting the IRQ so devres joins the handler before dropping the allocation reference. This issue was identified as part of our ongoing research while reviewing kernel code. Fixes: 60df548277b7 ("iio: proximity: Add driver support for TYHX's HX9023S capacitive proximity sensor") Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@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-11-02iio: accel: adxl345: select IIO_BUFFER and IIO_KFIFO_BUFAlexis Bouzigues
Since the addition of FIFO watermark support, adxl345_core.c calls devm_iio_kfifo_buffer_setup() and iio_push_to_buffers(), but the ADXL345 Kconfig entry does not select IIO_BUFFER and IIO_KFIFO_BUF. Building with CONFIG_ADXL345_I2C=y and CONFIG_IIO_BUFFER=n fails to link: ld: drivers/iio/accel/adxl345_core.o: in function `adxl345_irq_handler': adxl345_core.c:(.text+0x145c): undefined reference to `iio_push_to_buffers' ld: drivers/iio/accel/adxl345_core.o: in function `adxl345_core_probe': adxl345_core.c:(.text+0x1db6): undefined reference to `devm_iio_kfifo_buffer_setup_ext' Add the missing selects on the hidden ADXL345 core symbol, as done for ADXL367, ADXL372 and ADXL380, so both the I2C and SPI front-ends are covered. Fixes: cf04212d1fe7 ("iio: accel: adxl345: add FIFO with watermark events") Signed-off-by: Alexis Bouzigues <BouziguesAlexis@JohnDeere.com> Tested-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: imu: kmx61: reject duplicate event disableJiale Yao
The IIO core does not filter duplicate writes to the event enable attribute. kmx61_write_event_config() already ignores repeated enable requests, but a repeated disable request still calls kmx61_set_power_state(data, false, KMX61_ACC), dropping a runtime PM reference that was not acquired for this request. This can underflow the runtime PM usage count and trigger a "Runtime PM usage count underflow" warning. Return early when the requested state already matches ev_enable_state. Fixes: fd3ae7a9f21c ("iio: imu: kmx61: Add support for any motion trigger") Signed-off-by: Jiale Yao <yaojiale02@163.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-11-02iio: gyro: bmg160: reject duplicate event disableJiale Yao
The IIO core does not filter duplicate writes to the event enable attribute. bmg160_write_event_config() already ignores repeated enable requests, but a repeated disable request still calls bmg160_set_power_state(data, false), dropping a runtime PM reference that was not acquired for this request. This can underflow the runtime PM usage count and trigger a "Runtime PM usage count underflow" warning. Return early when the requested state already matches ev_enable_state. Fixes: 22b46c45fb9b ("iio:gyro:bmg160 Gyro Sensor driver") Signed-off-by: Jiale Yao <yaojiale02@163.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
2026-10-26Merge tag 'mfd-next-7.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Support & Features: - Cirrus Logic CS42L43: Add support for the CS42L44 variant - Khadas MCU: Add support for the VIM4 MCU variant along with per-variant fan duty-cycle levels and optional fan supply regulator support - Maxim MAX77705: Add support for the PASS2 hardware revision - MediaTek MT6397: Add AUXADC sub-device support for MT6397 - Motorola CPCAP: Support per-board sub-device compositions and add the Tegra20 Mot composition - ROHM BD73800: Add support for the BD73800 PMIC core, regulator, RTC, clock gate, and GPIO sub-devices - TI LM3533: Add VIN regulator supply support, configure initial backlight mapping mode from Device Tree, and implement the `backlight_scale` property - X-Powers AC200: Add support for the AC200 I2C mixed-signal companion IC Improvements & Fixes: - Cirrus Logic CS42L43: Synchronize SoundWire enumeration work in `remove()` before devres cleanup begins - Dialog DA903x: Manage IRQ work cancellation and sub-device removal via devres to prevent use-after-free during teardown - Dialog DA9150: Balance `enable_irq_wake()` with `disable_irq_wake()` during probe failure and driver removal - Intel LPSS: Add DMI quirks for Dell Latitude 5285 and 7275 to ignore ACPI resource conflicts on the I2C4 controller - Intel Quark I2C/GPIO: Manage the fixed-rate clock and its clkdev lookup with devres to fix a resource leak on unbind - Maxim MAX77705: Select `REGMAP_I2C` and `REGMAP_IRQ` in Kconfig to fix build errors - Qualcomm WCD934x: Initialize the parent DMA mask to suppress "DMA mask not set" warnings on child devices - Qualcomm WCD934x: Pass the valid device pointer to `dev_err_probe()` on IRQ lookup failure to avoid a NULL pointer dereference - Rockchip RK8xx: Register the poweroff handler in the atomic `SYS_OFF_MODE_POWER_OFF` phase so polling I2C transfers complete during shutdown - ST-Ericsson AB8500: Use `devm_mfd_add_devices()` to prevent leaking child devices on probe failure - TI BQ257xx: Mark self-modifying BQ25792 configuration registers as volatile - TI LM3533: Set `coherent_dma_mask` to zero to suppress "DMA mask not set" warnings - TI TPS65217: Check for errors during IRQ initialization and masking, and manage IRQ domain and wake teardown with devres - TI TWL: Unregister the auxiliary platform device via a devres action on probe failure and driver unbind Cleanups & Refactoring - Core: Convert drivers from deprecated `SIMPLE_DEV_PM_OPS()` to `DEFINE_SIMPLE_DEV_PM_OPS()` and `pm_sleep_ptr()` - Core: Fix spelling mistakes in comments across various MFD drivers and headers - Maintainers: Add ROHM BD73800 PMIC files under the ROHM PMIC entry - Maintainers: Specify the `for-mfd-next` branch for the MFD and Syscon git trees - Dialog DA9062: Use `DEFINE_RES_IRQ_NAMED()` for IRQ resource definitions - Intel LPSS: Simplify DebugFS handling by dropping redundant error checks and intermediate dentry variables, using octal permissions, and switching to `debugfs_remove()` - Khadas MCU: Convert MFD cell arrays to `const` and use `MFD_CELL_NAME()` - ST-Ericsson AB8500: Fix a spelling typo in a comment - TI LM3533: Convert from platform data to Device Tree bindings and pass only regmap and light sensor presence to child devices - TI LM3533: Remove driver-specific regmap wrappers, redundant pdata helpers, and unnecessary `extern` qualifiers, and use `dev_groups` for sysfs attributes - Wolfson WM831x: Fix a spelling typo in a comment Device Tree Binding Updates - HiSilicon Hi6421 SPMI: Fix the compatible string to match `hisilicon,hi6421-spmi` - MediaTek MT6357: Allow an `adc` child node - MediaTek MT6360: Allow two-cell interrupt specifiers with trigger flags - MediaTek MT6397: Document the `#sound-dai-cells` property - MediaTek MT6397: Document the battery-backed NVMEM layout under the RTC child node - MediaTek MT6397: Document the MT6323 PMIC EFUSE child node - Motorola CPCAP: Convert MFD and power button bindings to DT schema and document the Mapphone and Mot compositions - Qualcomm SPMI PMIC: Document the PM4125 audio codec compatible - Qualcomm SPMI PMIC: Document the PMAU0102 PMIC compatible - Qualcomm TCSR: Document the MSM8952 TCSR compatible - Rockchip RK805: Fold the pin controller binding into the RK805 PMIC DT schema - ROHM BD73800: Document the BD73800 PMIC and its regulators - ROHM PMIC: Factor out common pin properties into `rohm,pmic-pins.yaml` and reference them across BD71815, BD71828, and BD72720 bindings - ST-Ericsson AB8500: Document AB8500 and AB8505 buck converter regulators - ST-Ericsson AB8500: Document codec audio graph ports, sound DAI cells, and analog microphone wiring properties - ST-Ericsson DB8500 PRCMU: Deprecate the `db8500-prcmu-regulators` child node and make it optional - Syscon: Document the Ambarella CV75 secure scratchpad compatible - TI BQ25703A: Add the BQ25798 compatible with fallback to BQ25792 - TI Keystone: Convert Device State Control bindings to DT schema - TI LM3533: Document the LM3533 LED controller, backlight, and indicator LED bindings - TI LP3943: Convert MFD and PWM bindings to DT schema - TI TPS61050: Convert bindings to DT schema - TI TPS65086: Make the `regulators` child node optional - TI TPS65910: Document `wakeup-source` and GPIO hog child nodes - TI TWL6040: Convert bindings to DT schema and align property names with the driver - X-Powers AC200: Document the AC200 mixed-signal companion IC" * tag 'mfd-next-7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (74 commits) dt-bindings: mfd: db8500-prcmu: Deprecate EPOD regulators dt-bindings: mfd: syscon: Add Ambarella CV75 secure scratchpad dt-bindings: mfd: rockchip,rk805: Convert pinctrl to DT schema mfd: intel-lpss: Add Dell Latitude 7275 to the resource conflict quirk mfd: intel-lpss: Add resource conflict quirk for Dell Latitude 5285 mfd: tps65217: Use devres for IRQ domain and wake teardown mfd: tps65217: Check return value when masking interrupt sources mfd: tps65217: Fix NULL pointer dereference on IRQ init failure dt-bindings: mfd: qcom,spmi-pmic: Add compatibles for pm4125-codec mfd: bq257xx: Mark self-modifying BQ25792 registers volatile dt-bindings: mfd: mediatek: mt6397: describe the RTC's nvmem layout mfd: mt6397-core: Add mt6397 AUXADC support mfd: max77705: Mark PASS2 revision as supported mfd: ab8500: Fix child device leaks on probe failure dt-bindings: mfd: Add MT6397 sound DAI cells dt-bindings: mfd: mediatek: mt6397: Add mt6323 PMIC EFUSE dt-bindings: mfd: hisilicon: Fix Hi6421 SPMI compatible dt-bindings: mfd: ti,bq25703a: Expand to include BQ25798 dt-bindings: mfd: Allow MT6360 interrupt flags dt-bindings: mfd: mediatek: Allow MT6357 ADC ...
2026-10-18Merge tag 'spmi-for-next' of ↵Greg Kroah-Hartman
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi into char-misc-next Stephen writes: More than a handful of changes for SPMI. I'm bringing on Abel Vesa to help maintain SPMI so the tree may change in the future but we'll probably continue to send patches when the pile is small. The big change here is that we gained a new function spmi_subdevice_alloc_and_add() to support complex PMICs that have different devices spread throughout the SPMI address. We've grown subdevice drivers that use OF APIs directly to figure out some base address to add to all their register read/write operations which is tightly coupling our parent/child drivers. This change allows us to clean all those drivers up to use standard device APIs and their own regmap instead of relying on a parent SPMI driver to do all the heavy lifting. The series also updated drivers that could use the new API and I picked those all up because they were acked by maintainers. Beyond that we have some minor fixes to the Qualcomm and Mediatek SPMI drivers for bugs in software and hardware and a couple maintainer updates as stated earlier. * tag 'spmi-for-next' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi: MAINTAINERS: Add Abel as SPMI co-maintainer spmi: mtk-pmif: Fix clock reference leak in mtk_spmi_bus_probe() iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions iio: adc: qcom-spmi-iadc: Migrate to devm_spmi_subdevice_alloc_and_add() misc: qcom-coincell: Migrate to devm_spmi_subdevice_alloc_and_add() phy: qualcomm: eusb2-repeater: Migrate to devm_spmi_subdevice_alloc_and_add() power: reset: qcom-pon: Migrate to devm_spmi_subdevice_alloc_and_add() nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() spmi: Add helper to get a parent SPMI device spmi: Implement spmi_subdevice_alloc_and_add() and devm variant spmi: Remove unneeded goto in spmi_device_add() error path spmi: Print error status with %pe format spmi: Remove redundant dev_name() print in spmi_device_add() spmi: Fix potential use-after-free by grabbing of_node reference spmi: mtk-pmif: Add workaround for FSM lockup/error in read operation MAINTAINERS: Add Qualcomm SPMI controller entry spmi: pmic-arb: return 0 in spmi_pmic_arb_register_buses() on success
2026-10-14iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functionsAngeloGioacchino Del Regno
This driver doesn't need to add any register base address to any regmap call anymore since it was migrated to register as a SPMI subdevice with its own regmap reg_base, which makes the regmap API to automatically add such base address internally. Since the iadc_{read,write,read_result}() functions now only do call regmap_{read,write,bulk_read}() and nothing else, simplify the driver by removing them and by calling regmap APIs directly. Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>