summaryrefslogtreecommitdiff
path: root/drivers/hwmon
AgeCommit message (Collapse)Author
5 dayshwmon: (lm90) Add lock protection to lm90_alertGuenter Roeck
Sashiko reports: lm90_alert() executes in the smbus alert context and calls lm90_update_confreg() to disable the hardware alert line, without acquiring hwmon_lock. Concurrently, sysfs write operations (such as lm90_write_convrate) hold the hwmon_lock, temporarily modify data->config, and then restore it. If an alert interrupt occurs concurrently with a sysfs write, the sysfs path will overwrite the alert handler's modifications to data->config and the hardware register. This unintentionally re-enables the hardware alert line while the alarm is still active, causing an interrupt storm. Add the missing lock to lm90_alert() to solve the problem. Fixes: 7a1d220ccb0cc ("hwmon: (lm90) Introduce function to update configuration register") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 dayshwmon: (lm90) Stop work before releasing hwmon deviceGuenter Roeck
Sashiko reports: In lm90_probe(), the devm action to cancel the alert_work and report_work (lm90_restore_conf) is registered in lm90_init_client() before devm_hwmon_device_register_with_info() is called. Because devm executes cleanup actions in reverse order during module unbind or probe failure, the hwmon device is unregistered and freed first. If lm90_alert_work() or lm90_report_alarms() runs in the window between the hwmon device being freed and the delayed works being cancelled, lm90_update_alarms() will dereference the freed data->hwmon_dev here. Fix the problem by canceling the workers separately after registering the hwmon device and before registering the interrupt handler. This ensures that the workers are canceled after interrupts are disabled and before the hwmon device is released. Add "shutdown" flag to indicate that device shutdown is in progress to prevent workers from being re-armed. Fixes: f6d0775119fb9 ("hwmon: (lm90) Rework alarm/status handling") Reported-by: Sashiko <sashiko-bot@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8 dayshwmon: (asus_atk0110) Check ACPI_COMPANION() against NULLRafael J. Wysocki
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence. Accordingly, add a requisite ACPI_HANDLE() check against NULL to the asus_atk0110 hwmon driver. Fixes: ee1752590733 ("hwmon: (asus_atk0110) Convert ACPI driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/2261594.irdbgypaU6@rafael.j.wysocki Signed-off-by: Guenter Roeck <linux@roeck-us.net>
8 dayshwmon: (acpi_power_meter) Check ACPI_COMPANION() against NULLRafael J. Wysocki
Every platform driver can be forced to match a device that doesn't match its list of device IDs because of device_match_driver_override(), so platform drivers that rely on the existence of a device's ACPI companion object need to verify its presence. Accordingly, add a requisite ACPI_COMPANION() check against NULL to the acpi_power_meter hwmon driver. Fixes: afc6c4aedea5 ("hwmon: (acpi_power_meter) Convert ACPI driver to a platform one") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/5068745.GXAFRqVoOG@rafael.j.wysocki Signed-off-by: Guenter Roeck <linux@roeck-us.net>
13 dayshwmon: (ads7871) Fix endianness bug in 16-bit register readsTabrez Ahmed
The ads7871_read_reg16() function relies on spi_w8r16() to read the 16-bit sensor output. The ADS7871 device transmits the Least Significant Byte (LSB) first. On Little-Endian architectures, spi_w8r16() correctly reconstructs the 16-bit value. However, on Big-Endian architectures, the byte swapping causes the first received byte (LSB) to be placed in the most significant byte of the u16, resulting in corrupted voltage readings. To fix this, cast the integer result of spi_w8r16() to a restricted __le16 type and convert it to the host CPU's native byte order using le16_to_cpu(). Negative error codes returned by the SPI core are caught and returned prior to the conversion to avoid mangling the error status. Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20260418034601.90226-1-tabreztalks@gmail.com Fixes: e0c70b8078629 ("hwmon: add TI ads7871 a/d converter driver") Suggested-by: David Laight <david.laight.linux@gmail.com> Signed-off-by: Tabrez Ahmed <tabreztalks@gmail.com> Link: https://lore.kernel.org/r/20260502020844.110038-2-tabreztalks@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
13 dayshwmon: (lm75) Fix configuration register writes.Markus Stockhausen
Sensors configurations are defined by set and clear masks. These do not follow a consistent "clear mask is a superset of set mask" rule. This relaxed definition breaks lm75_write_config() static inline int lm75_write_config(struct lm75_data *data, u16 set_mask, u16 clr_mask) { return regmap_update_bits(data->regmap, LM75_REG_CONF, clr_mask | LM75_SHUTDOWN, set_mask); } Basically all bits from set_mask that are not defined in clr_mask are dropped. Fix that by enhancing the helper to always combine clr_mask and set_mask into the mask bits of regmap_update_bits(). Fixes: 6da24a25f766 ("hwmon: (lm75) Hide register size differences in regmap access functions") Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://lore.kernel.org/r/20260502173207.3567876-3-markus.stockhausen@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
13 dayshwmon: (lm75) Fix AS6200 and TMP112 setup and alarm handlingMarkus Stockhausen
The initialization of the AS6200 has two shortcomings - The device-add-commit states "Conversion mode: continuous" but the the lm75_params structure uses set_mask = 0x94c0. This activates single shot mode (bit 15). According to the datasheet "The device features a single shot measurement mode if the device is in sleep mode (SM=1)". This is quite contradictionary. - It is the only device that activates polarity active-high (bit 10) All this is paired with a undefined clear mask bug in function lm75_write_config() that was introduced with a later refactoring commit. [as6200] = { .config_reg_16bits = true, .set_mask = 0x94C0, -> .clr_mask not defined here .default_resolution = 12, ... static inline int lm75_write_config(struct lm75_data *data, u16 set_mask, u16 clr_mask) { return regmap_update_bits(data->regmap, LM75_REG_CONF, clr_mask | LM75_SHUTDOWN, set_mask); } regmap_update_bits() requires clr_mask to be a superset of set_mask. So basically all sensors with "wrong" masks like the AS6200 are not initialized as intended. Fix that by - Change the set_mask to 0xc010 to reflect the current active-low setup properly and to drive the sensor in continous mode. This takes into account that the config register is little endian and the first byte sent to the chip is the LSB. - Adapt the alarm handling so it can report the alarm correctly even if it is high active. This is done by comparing config register bit 5 and 10 (translated to 2 and 13). This commit does not introduce any ABI breakage as the mutliple bugs effectly drive the AS6200 in standard active-low mode. Fixes: 4b6358e1fe46 ("hwmon: (lm75) Add AMS AS6200 temperature sensor") Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://lore.kernel.org/r/20260502173207.3567876-2-markus.stockhausen@gmx.de [groeck: Update set_mask for as6200 further: As modeled, the upper bits contain the conversion rate, so the config register needs to be set to 0xc010 instead of 0x10c0 to reflect 8 samples/s and 4 consecutive faults. Fix the same problem for TMP112.] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-30hwmon: (lm63) Add locking to avoid TOCTOUGui-Dong Han
The functions show_fan(), show_pwm1(), show_temp11(), temp2_crit_hyst_show(), and show_lut_temp_hyst() access shared cached data without holding the update lock. This can cause TOCTOU races if the cached values change between the checks and the later calculations. Those cached values are updated in lm63_update_device(). In the general case, the affected functions combine multiple cached values without locking and can therefore observe a mixed old/new snapshot. In addition, show_fan() reads data->fan[nr] locklessly while lm63_update_device() updates data->fan[0] in two steps, which can expose an intermediate torn value and potentially trigger a divide-by-zero error. This means that converting the macro to a function is not sufficient to fix show_fan(). Hold the update lock across the whole read and calculation sequence so that the values remain stable. Check the other functions in the driver as well. Keep them unchanged because they either do not access shared cached values multiple times or already do so under lock. Link: https://lore.kernel.org/linux-hwmon/CALbr=LYJ_ehtp53HXEVkSpYoub+XYSTU8Rg=o1xxMJ8=5z8B-g@mail.gmail.com/ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Fixes: e872c91e726e ("hwmon: (lm63) Add support for unsigned upper temperature limits") Fixes: d216f6809eb6 ("hwmon: (lm63) Expose automatic fan speed control lookup table") Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com> Link: https://lore.kernel.org/r/20260416135703.53262-1-hanguidong02@gmail.com [groeck: Use lm63_update_device() to get driver data in temp2_crit_hyst_store] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-30hwmon: (corsair-psu) Close HID device on probe errorsMyeonghun Pak
corsairpsu_probe() opens the HID device before sending the device init and firmware-info commands. If either command fails, the error path jumps directly to fail_and_stop and skips hid_hw_close(). Use the existing fail_and_close label for those post-open failures so the open count and low-level close callback are balanced before hid_hw_stop(). Fixes: d115b51e0e56 ("hwmon: add Corsair PSU HID controller driver") Cc: stable@vger.kernel.org Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Reviewed-by: Wilken Gottwalt <wilken.gottwalt@posteo.net> Link: https://lore.kernel.org/r/20260424135107.13720-1-mhun512@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-30hwmon: Remove stale CONFIG_SENSORS_SBRMI Makefile referenceSasha Levin
kconfiglint reports: X001: CONFIG_SENSORS_SBRMI referenced in Makefile but not defined in any Kconfig The SB-RMI hardware monitoring driver was originally introduced in commit 5a0f50d110b3 ("hwmon: Add support for SB-RMI power module") with both a Kconfig entry (CONFIG_SENSORS_SBRMI) and a Makefile line (obj-$(CONFIG_SENSORS_SBRMI) += sbrmi.o) in drivers/hwmon/. Commit e156586764050 ("hwmon/misc: amd-sbi: Move core sbrmi from hwmon to misc") moved the driver to drivers/misc/amd-sbi/ to support additional functionality beyond hardware monitoring. That commit correctly removed the Kconfig entry from drivers/hwmon/Kconfig, moved the source file drivers/hwmon/sbrmi.c to drivers/misc/amd-sbi/sbrmi.c, and created new Kconfig/Makefile entries in drivers/misc/amd-sbi/ with a renamed symbol (CONFIG_AMD_SBRMI_I2C). However, the Makefile line in drivers/hwmon/Makefile was not removed in that commit. The orphaned line references a CONFIG symbol that no longer exists and a source file that is no longer present, so it has no effect on the build — but it is dead code that should be cleaned up. Remove the stale Makefile reference. Assisted-by: Claude:claude-opus-4-6 kconfiglint Signed-off-by: Sasha Levin <sashal@kernel.org> Link: https://lore.kernel.org/r/20260426000319.55908-1-sashal@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-30hwmon: (ltc2992) Fix u32 overflow in power read pathSanman Pradhan
ltc2992_get_power() computes the divisor for mul_u64_u32_div() as r_sense_uohm * 1000. This multiplication overflows u32 when r_sense_uohm exceeds about 4.29 ohms (4294967 micro-ohms), producing a truncated divisor and an incorrect power reading. Cancel the factor of 1000 from both the numerator (VADC_UV_LSB * IADC_NANOV_LSB = 312500000) and the divisor (r_sense_uohm * 1000), giving (VADC_UV_LSB / 1000) * IADC_NANOV_LSB = 312500 as the numerator and plain r_sense_uohm as the divisor. The cancellation is exact because LTC2992_VADC_UV_LSB (25000) is divisible by 1000. This is the read-path counterpart of the write-path fix applied in the preceding patch. Fixes: b0bd407e94b03 ("hwmon: (ltc2992) Add support") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260416215904.101969-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-30hwmon: (ltc2992) Clamp threshold writes to hardware rangeSanman Pradhan
ltc2992_set_voltage(), ltc2992_set_current(), and ltc2992_set_power() do not validate the user-supplied value before converting it to a register value. This can result in: 1. Negative input values wrapping to large positive register values. For power, the negative long is implicitly cast to u64 in mul_u64_u32_div(), producing an incorrect value. For voltage and current, the negative converted value wraps when passed to ltc2992_write_reg() as a u32. 2. Intermediate arithmetic exceeding the range representable in u64 on 64-bit platforms. In ltc2992_set_voltage(), (u64)val * 1000 can exceed U64_MAX when val is a large positive long. In ltc2992_set_current(), (u64)val * r_sense_uohm can overflow similarly. In ltc2992_set_power(), the computed value may not fit in u64. 3. Register values exceeding the hardware field width. Voltage and current threshold registers are 12-bit (stored left-justified in 16 bits), and power threshold registers are 24-bit. Without clamping, bits above the field width are truncated in ltc2992_write_reg(). Fix by clamping negative values to zero, clamping positive values to the rounded hardware-representable maximum (the value returned by the read path for a full-scale register) to prevent intermediate overflow, and clamping the converted register value to the hardware field width before writing. The existing conversion formula and rounding behavior are preserved. In the power write path, cancel the factor of 1000 from both the numerator (r_sense_uohm * 1000) and the denominator (VADC_UV_LSB * IADC_NANOV_LSB) to also eliminate a u32 overflow of r_sense_uohm * 1000 when r_sense_uohm exceeds about 4.29 ohms. Fixes: b0bd407e94b03 ("hwmon: (ltc2992) Add support") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260416215904.101969-2-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-15Merge tag 'hwmon-for-v7.1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: "New drivers: - Lenovo Yoga/Legion fan monitoring (yogafan) - LattePanda Sigma EC - Infineon XDP720 eFuse - Microchip MCP998X New device support: - TI INA234 - Infineon XDPE1A2G5B/7B - Renesas RAA228942 and RAA228943 (isl68137) - Delta Q54SN120A1 and Q54SW120A7 (pmbus) - TI TMP110 and TMP113 (tmp102) - Sony APS-379 (pmbus) - ITE IT8689E (it87) - ASUS ROG STRIX Z790-H, X470-F, and CROSSHAIR X670E (asus-ec-sensors) - GPD Win 5 (gpd-fan) Modernization and Cleanups: - Convert asus_atk0110 and acpi_power_meter ACPI drivers to platform drivers - Remove i2c_match_id() usage in many PMBus drivers - Use guard() for mutex protection in pmbus_core - Replace sprintf() with sysfs_emit() in ads7871, emc1403, max6650, ads7828, max31722, and tc74 - Various markup and documentation improvements for yogafan and ltc4282 Bug fixes: - Fix use-after-free and missing usb_kill_urb on disconnect in powerz driver - Avoid cacheline sharing for DMA buffer in powerz driver - Fix integer overflow in power calculation on 32-bit in isl28022 driver - Fix bugs in pt5161l_read_block_data() - Propagate SPI errors and fix incorrect error codes in ads7871 driver - Fix i2c_smbus_write_byte_data wrapper argument type in max31785 driver Device tree bindings: - Convert npcm750-pwm-fan to DT schema - Add bindings for Infineon XDP720, Microchip MCP998X, Sony APS-379, Renesas RAA228942/3, Delta Q54SN120A1/7, XDPE1A2G5B/7B, Aosong AHT10/20, DHT20, and TI INA234 - Adapt moortec,mr75203 bindings for T-Head TH1520" * tag 'hwmon-for-v7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (82 commits) hwmon: (ina233) Don't check for specific errors when parsing properties hwmon: (isl28022) Don't check for specific errors when parsing properties hwmon: (pmbus/tps25990) Don't check for specific errors when parsing properties hwmon: (nct6683) Add customer ID for ASRock B650I Lightning WiFi hwmon:(pmbus/xdp720) Add support for efuse xdp720 dt-bindings: hwmon/pmbus: Add Infineon XDP720 hwmon: add support for MCP998X dt-bindings: hwmon: add support for MCP998X hwmon: (powerz) Avoid cacheline sharing for DMA buffer hwmon: (isl28022) Fix integer overflow in power calculation on 32-bit hwmon: (pt5161l) Fix bugs in pt5161l_read_block_data() hwmon: (powerz) Fix missing usb_kill_urb() on signal interrupt hwmon: (powerz) Fix use-after-free on USB disconnect hwmon: pmbus: Add support for Sony APS-379 dt-bindings: trivial-devices: Add sony,aps-379 hwmon: (yogafan) various markup improvements hwmon: (sparx5) Make it selectable for ARCH_LAN969X hwmon: (tmp102) add support for update interval hwmon: (yogafan) fix markup warning hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoring ...
2026-04-12hwmon: (ina233) Don't check for specific errors when parsing propertiesAndy Shevchenko
Instead of checking for the specific error codes (that can be considered a layering violation to some extent) check for the property existence first and then either parse it, or apply a default value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20260219141532.2259642-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-12hwmon: (isl28022) Don't check for specific errors when parsing propertiesAndy Shevchenko
Instead of checking for the specific error codes (that can be considered a layering violation to some extent) check for the property existence first and then either parse it, or apply a default value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20260219140532.2259235-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-12hwmon: (pmbus/tps25990) Don't check for specific errors when parsing propertiesAndy Shevchenko
Instead of checking for the specific error codes (that can be considered a layering violation to some extent) check for the property existence first and then either parse it, or apply a default value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20260219141936.2259945-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-12hwmon: (nct6683) Add customer ID for ASRock B650I Lightning WiFiPetr Klotz
The ASRock B650I Lightning WiFi motherboard uses an NCT6686D chip with a customer ID of 0x1633. Without this ID, the nct6683 driver fails to recognize the hardware on this board, preventing hardware monitoring from working. Add NCT6683_CUSTOMER_ID_ASROCK6 (0x1633) to the list of supported customer IDs and update the probe function to handle it Signed-off-by: Petr Klotz <pklotz0@protonmail.com> Link: https://lore.kernel.org/r/20260412000911.9063-2-pklotz0@protonmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-11hwmon:(pmbus/xdp720) Add support for efuse xdp720Ashish Yadav
Add the pmbus driver for Infineon XDP720 Digital eFuse Controller. Signed-off-by: Ashish Yadav <ashish.yadav@infineon.com> Link: https://lore.kernel.org/r/20260410070154.3313-3-Ashish.Yadav@infineon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-11hwmon: add support for MCP998XVictor Duicu
Add driver for Microchip MCP998X/33 and MCP998XD/33D Multichannel Automotive Temperature Monitor Family. Signed-off-by: Victor Duicu <victor.duicu@microchip.com> Link: https://lore.kernel.org/r/20260403-add-mcp9982-hwmon-v12-2-b3bfb26ff136@microchip.com [groeck: Add missing break; to avoid build warning] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: (powerz) Avoid cacheline sharing for DMA bufferThomas Weißschuh
Depending on the architecture the transfer buffer may share a cacheline with the following mutex. As the buffer may be used for DMA, that is problematic. Use the high-level DMA helpers to make sure that cacheline sharing can not happen. Also drop the comment, as the helpers are documentation enough. https://sashiko.dev/#/message/20260408175814.934BFC19421%40smtp.kernel.org Fixes: 4381a36abdf1c ("hwmon: add POWER-Z driver") Cc: stable@vger.kernel.org # ca085faabb42: dma-mapping: add __dma_from_device_group_begin()/end() Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20260408-powerz-cacheline-alias-v1-1-1254891be0dd@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: (isl28022) Fix integer overflow in power calculation on 32-bitSanman Pradhan
isl28022_read_power() computes: *val = ((51200000L * ((long)data->gain)) / (long)data->shunt) * (long)regval; On 32-bit platforms, 'long' is 32 bits. With gain=8 and shunt=10000 (the default configuration): (51200000 * 8) / 10000 = 40960 40960 * 65535 = 2,684,313,600 This exceeds LONG_MAX (2,147,483,647), resulting in signed integer overflow. Additionally, dividing before multiplying by regval loses precision unnecessarily. Use u64 arithmetic with div_u64() and multiply before dividing to retain precision. The intermediate product cannot overflow u64 (worst case: 51200000 * 8 * 65535 = 26843136000000). Power is inherently non-negative, so unsigned types are the natural fit. Cap the result to LONG_MAX before returning it through the hwmon callback. Fixes: 39671a14df4f2 ("hwmon: (isl28022) new driver for ISL28022 power monitor") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260410002613.424557-1-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: (pt5161l) Fix bugs in pt5161l_read_block_data()Sanman Pradhan
Fix two bugs in pt5161l_read_block_data(): 1. Buffer overrun: The local buffer rbuf is declared as u8 rbuf[24], but i2c_smbus_read_block_data() can return up to I2C_SMBUS_BLOCK_MAX (32) bytes. The i2c-core copies the data into the caller's buffer before the return value can be checked, so the post-read length validation does not prevent a stack overrun if a device returns more than 24 bytes. Resize the buffer to I2C_SMBUS_BLOCK_MAX. 2. Unexpected positive return on length mismatch: When all three retries are exhausted because the device returns data with an unexpected length, i2c_smbus_read_block_data() returns a positive byte count. The function returns this directly, and callers treat any non-negative return as success, processing stale or incomplete buffer contents. Return -EIO when retries are exhausted with a positive return value, preserving the negative error code on I2C failure. Fixes: 1b2ca93cd0592 ("hwmon: Add driver for Astera Labs PT5161L retimer") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260410002549.424162-1-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: (powerz) Fix missing usb_kill_urb() on signal interruptSanman Pradhan
wait_for_completion_interruptible_timeout() returns -ERESTARTSYS when interrupted. This needs to abort the URB and return an error. No data has been received from the device so any reads from the transfer buffer are invalid. The original code tests !ret, which only catches the timeout case (0). On signal delivery (-ERESTARTSYS), !ret is false so the function skips usb_kill_urb() and falls through to read from the unfilled transfer buffer. Fix by capturing the return value into a long (matching the function return type) and handling signal (negative) and timeout (zero) cases with separate checks that both call usb_kill_urb() before returning. Fixes: 4381a36abdf1c ("hwmon: add POWER-Z driver") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260410002521.422645-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: (powerz) Fix use-after-free on USB disconnectSanman Pradhan
After powerz_disconnect() frees the URB and releases the mutex, a subsequent powerz_read() call can acquire the mutex and call powerz_read_data(), which dereferences the freed URB pointer. Fix by: - Setting priv->urb to NULL in powerz_disconnect() so that powerz_read_data() can detect the disconnected state. - Adding a !priv->urb check at the start of powerz_read_data() to return -ENODEV on a disconnected device. - Moving usb_set_intfdata() before hwmon registration so the disconnect handler can always find the priv pointer. Fixes: 4381a36abdf1c ("hwmon: add POWER-Z driver") Cc: stable@vger.kernel.org Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260410002521.422645-2-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-10hwmon: pmbus: Add support for Sony APS-379Chris Packham
Add pmbus support for Sony APS-379 power supplies. There are a few PMBUS commands that return data that is undocumented/invalid so these need to be rejected with -ENXIO. The READ_VOUT command returns data in linear11 format instead of linear16 so we need to workaround this. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20260410012414.2818829-3-chris.packham@alliedtelesis.co.nz [groeck: Dropped empty line from documentation; added module name to Kconfig] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-03hwmon: (sparx5) Make it selectable for ARCH_LAN969XRobert Marko
LAN969x uses the same sensor and driver, so make it selectable for ARCH_LAN969X. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Link: https://lore.kernel.org/r/20260402123436.47856-1-robert.marko@sartura.hr Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-03hwmon: (tmp102) add support for update intervalFlaviu Nistor
Since the sensor supports different sampling intervals via bits CR0 and CR1 from the CONFIG register, add support in order for the conversion rate to be changed from user space. Default is 4 conv/sec. Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> Link: https://lore.kernel.org/r/20260403140654.10368-1-flaviu.nistor@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-03hwmon: (yogafan) Add support for Lenovo Yoga/Legion fan monitoringSergio Melas
This driver provides fan speed monitoring for Lenovo Yoga, Legion, and IdeaPad laptops by interfacing with the Embedded Controller (EC) via ACPI. To address low-resolution sampling in Lenovo EC firmware, a Rate-Limited Lag (RLLag) filter is implemented. The filter ensures a consistent physical curve regardless of userspace polling frequency. Hardware identification is performed via DMI-based quirk tables, which map specific ACPI object paths and register widths (8-bit vs 16-bit) deterministically. Signed-off-by: Sergio Melas <sergiomelas@gmail.com> Link: https://lore.kernel.org/r/20260327221602.18832-1-sergiomelas@gmail.com [groeck: Dropped double empty line in Kconfig] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-04-01hwmon: (asus-ec-sensors) Fix T_Sensor for PRIME X670E-PRO WIFICorey Hickey
On the Asus PRIME X670E-PRO WIFI, the driver reports a constant value of zero for T_Sensor. On this board, the register for T_Sensor is at a different address, as found by experimentation and confirmed by comparison to an independent temperature reading. * sensor disconnected: -62.0°C * ambient temperature: +22.0°C * held between fingers: +30.0°C Introduce SENSOR_TEMP_T_SENSOR_ALT1 to support the PRIME X670E-PRO WIFI without causing a regression for other 600-series boards Fixes: e0444758dd1b ("hwmon: (asus-ec-sensors) add PRIME X670E-PRO WIFI") Signed-off-by: Corey Hickey <bugfood-c@fatooh.org> Link: https://lore.kernel.org/r/20260331215414.368785-1-bugfood-ml@fatooh.org [groeck: Fixed typo, updated Fixes: reference] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (ina2xx) drop unused platform dataBartosz Golaszewski
Nobody defines struct ina2xx_platform_data. Remove platform data support from the drivers which still have it (it's effectively dead code) and remove the header. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://lore.kernel.org/r/20260326-drop-ina2xx-pdata-v1-1-c159437bb2df@oss.qualcomm.com [groeck: Fixed continuation line alignment] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: Add label support for 64-bit energy attributesRong Zhang
Since commit 0bcd01f757bc ("hwmon: Introduce 64-bit energy attribute support"), devices can report 64-bit energy values by selecting the sensor type "energy64". However, such sensors can't report their labels since is_string_attr() was not updated to match it. Add label support for 64-bit energy attributes by updating is_string_attr() to match hwmon_energy64 in addition to hwmon_energy. Signed-off-by: Rong Zhang <i@rong.moe> Link: https://lore.kernel.org/r/20260327-b4-hwmon-witrn-v1-1-8d2f1896c045@rong.moe Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus_core) Use guard() for mutex protectionGuenter Roeck
Simplify the code by using guard() and scoped_guard() instead of mutex_lock()/mutex_unlock() sequences. This patch changes semantics for debugfs accesses. Previously, those used mutex_lock_interruptible() and not mutex_lock(). This change is intentional and should have little if any impact since locks should not be held for a significant amount of time and debugfs accesses are less critical than sysfs accesses (which never used interruptable locks). Reviewed-by: Sanman Pradhan <psanman@juniper.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus) Add support for guarded PMBus lockGuenter Roeck
Add support for guard(pmbus_lock)() and scoped_guard(pmbus_lock)() to be able to simplify the PMBus code. Also introduce pmbus_lock() as pre-requisite for supporting guard(). Reviewed-by: Sanman Pradhan <psanman@juniper.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/isl68137) Add support for Renesas RAA228942 and RAA228943Dawei Liu
Add I2C device IDs for Renesas RAA228942 and RAA228943. At the Linux PMBus hwmon interface level currently supported by this driver, these devices are compatible with the existing 2-rail non-TC controllers, so devicetree will use fallback compatibles and no dedicated OF match entries are needed. Signed-off-by: Dawei Liu <dawei.liu.jy@renesas.com> Link: https://lore.kernel.org/r/20260325090208.857-3-dawei.liu.jy@renesas.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: lm75: Add support for labelFlaviu Nistor
Add support for label sysfs attribute similar to other hwmon devices. This is particularly useful for systems with multiple sensors on the same board, where identifying individual sensors is much easier since labels can be defined via device tree. Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com> Link: https://lore.kernel.org/r/20260322162616.102229-1-flaviu.nistor@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (it87) Add support for IT8689EMarkus Hoffmann
Add support for the ITE IT8689E Super I/O chip. The IT8689E supports newer autopwm, 12mV ADC, 16-bit fans, six fans, six PWM channels, PWM frequency 2, six temperature inputs, AVCC3, temperature offset, and fan on/off control. Give it8689 its own GPIO configuration block in it87_find() rather than sharing the it8620/it8628 block. The shared block reads IT87_SIO_PINX2_REG and either marks IN3 as internal AVCC or skips IN9. Because it8689 declares FEAT_AVCC3, IN9 is already marked as always-internal before the GPIO block is reached; applying the PINX2 check would either create duplicate AVCC labels on IN3 and IN9 or incorrectly skip IN9. Also update Documentation/hwmon/it87.rst and drivers/hwmon/Kconfig to document the newly supported chip. Signed-off-by: Markus Hoffmann <markus@thehoffs.at> Link: https://lore.kernel.org/r/20260322103301.18112-1-markus@thehoffs.at Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (nct6775) Add ASUS X870/W480 to WMI monitoring listDenis Pauk
Boards such as * G15CE, * PRIME X870-P WIFI, * PRIME X870-P, * Pro WS W480-ACE, * ProArt X870E-CREATOR WIFI, * ROG CROSSHAIR X870E APEX, * ROG CROSSHAIR X870E DARK HERO, * ROG CROSSHAIR X870E EXTREME, * ROG CROSSHAIR X870E GLACIAL, * ROG CROSSHAIR X870E HERO BTF, * ROG CROSSHAIR X870E HERO, * ROG STRIX X870-A GAMING WIFI, * ROG STRIX X870-F GAMING WIFI, * ROG STRIX X870-I GAMING WIFI, * ROG STRIX X870E-E GAMING WIFI, * ROG STRIX X870E-E GAMING WIFI7 R2, * TUF GAMING X870-PLUS WIFI, * TUF GAMING X870-PRO WIFI7 W NEO, * TUF GAMING X870E-PLUS WIFI7, * W480/SYS, * X870 AYW GAMING WIFI W, * X870 MAX GAMING WIFI7 W, * X870 MAX GAMING WIFI7 have got a nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. Add the boards to the WMI monitoring list. Link: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Tomáš Bžatek <bugs@bzatek.net> Tested-by: Theunis Scheepers <ptscheepers@gmail.com> Link: https://lore.kernel.org/r/20260322131848.6261-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/max31785) check for partial i2c_transfer in read_long_dataSanman Pradhan
i2c_transfer() returns the number of messages successfully transferred, not only a negative errno on failure. When called with two messages (write command byte followed by a read of the 4-byte response), a return value of 1 means the command write succeeded but the read did not complete. In that case, rspbuf remains uninitialized and must not be interpreted as valid data. Treat any return value other than ARRAY_SIZE(msg) as an error, and return -EIO for partial completion. Also return 0 on success instead of the message count, since the caller only needs to distinguish success from failure. Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260321181052.27129-4-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/max31785) use access_delay for PMBus-mediated accessesSanman Pradhan
The MAX31785 driver currently uses driver-local wrappers around PMBus core accesses to enforce a 250us inter-access delay needed to work around occasional NACKs from the device. This duplicates the PMBus core delay mechanism already provided by pmbus_driver_info.access_delay and adds unnecessary complexity. Replace the PMBus wrapper approach with access_delay for normal PMBus-mediated accesses, while keeping the minimal local delay handling needed for raw pre-probe SMBus operations. For the raw i2c_transfer() long-read path, use pmbus_wait() and pmbus_update_ts() to keep the PMBus core timing state consistent with the raw transfer. Also: - allow PMBUS_FAN_CONFIG_12 physical-page accesses to fall back to the PMBus core, while remapping only virtual pages - use pmbus_update_fan() directly for fan configuration updates - use the delayed raw read helper for MFR_REVISION during probe - add a final max31785_wait() before pmbus_do_probe() to bridge the timing gap between pre-probe accesses and PMBus core registration - rename 'virtual' to 'vpage', 'driver_data' to 'data', and drop the unused to_max31785_data() macro Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260321181052.27129-3-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus) export pmbus_wait and pmbus_update_tsSanman Pradhan
Export pmbus_wait() and pmbus_update_ts() so that PMBus device drivers which perform raw I2C transfers outside the core helpers can keep the PMBus core delay bookkeeping in sync. Move PMBUS_OP_WRITE and PMBUS_OP_PAGE_CHANGE from pmbus_core.c to pmbus.h so device drivers can pass the correct operation type flags to pmbus_update_ts(). This is needed by the max31785 driver, which performs raw i2c_transfer() calls for its 4-byte extended fan speed reads that cannot use the standard PMBus word read path. Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260321181052.27129-2-sanman.pradhan@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/isl68137) Remove unused enum chipsDawei Liu
The enum chips is not used anywhere in the driver. Device matching relies on the variants enum instead. Remove it to clean up the code. Signed-off-by: Dawei Liu <dawei.liu.jy@renesas.com> Link: https://lore.kernel.org/r/20260318021921.75-2-dawei.liu.jy@renesas.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (aspeed-g6-pwm-tach): remove redundant driver remove callbackBilly Tsai
Drops the remove callback as it only asserts reset and the probe already registers a devres action (devm_add_action_or_reset()) to call aspeed_pwm_tach_reset_assert(). Fixes: 7e1449cd15d1 ("hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach") Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com> Link: https://lore.kernel.org/r/20260309-pwm_fixes-v2-1-ca9768e70470@aspeedtech.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus) Add Delta Q54SN120A1 Q54SW120A7 chipColin Huang
Add the DELTA chips Q54SN120A1, Q54SW120A7 in q54sj108a2, 1/4 Brick DC/DC Regulated Power Module with PMBus support Signed-off-by: Colin Huang <u8813345@gmail.com> Link: https://lore.kernel.org/r/20260316-add-q54sn120a1-q54q54sw120a7-v2-2-60e6182cc4a7@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (ads7871) Propagate SPI errors in voltage_showTabrez Ahmed
The voltage_show() function previously ignored negative error codes returned by the underlying SPI read/write functions. Because negative numbers have their most significant bits set in two's complement, a failed SPI read returning -EIO (-5) would incorrectly evaluate to true when masked with MUX_CNV_BM (0x80). This would cause the driver to enter the polling loop even when the SPI bus failed, eventually returning a misleading -ETIMEDOUT error to userspace instead of the actual hardware error. Furthermore, the return values of the initial SPI write and the final 16-bit SPI read were completely ignored. Add proper error checking after every SPI operation to ensure hardware failures are immediately propagated back to userspace. Suggested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Tabrez Ahmed <tabreztalks@gmail.com> Link: https://lore.kernel.org/r/20260308124714.84715-1-tabreztalks@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/max31785) fix argument type for i2c_smbus_write_byte_data wrapperSanman Pradhan
The local wrapper max31785_i2c_write_byte_data() declares its data parameter as u16 but passes it directly to i2c_smbus_write_byte_data() which takes u8. Fix the type to match the underlying API. No functional change; all current callers pass values that fit in u8. Signed-off-by: Sanman Pradhan <psanman@juniper.net> Link: https://lore.kernel.org/r/20260307224517.38316-2-sanman.p211993@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (ads7871) Fix incorrect error code in voltage_showTabrez Ahmed
The voltage_show() function returns -1 when the A/D conversion fails to complete within the polling loop. -1 maps to -EPERM (operation not permitted), which does not describe the actual failure. Replace this -1 error code with -ETIMEDOUT to better indicate the timeout condition to userspace. Drop the else block after return. Note: not runtime tested due to lack of hardware. Signed-off-by: Tabrez Ahmed <tabreztalks@gmail.com> Link: https://lore.kernel.org/r/20260307115226.25757-1-tabreztalks@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (ads7871) Replace sprintf() with sysfs_emit()Tabrez Ahmed
Use sysfs_emit() instead of sprintf() in the sysfs show function voltage_show() to comply with the preferred kernel interface for writing to sysfs buffers, which ensures PAGE_SIZE buffer limits are respected. No functional change intended. Note: Not runtime tested due to lack of hardware. Signed-off-by: Tabrez Ahmed <tabreztalks@gmail.com> Link: https://lore.kernel.org/r/20260307083815.12095-1-tabreztalks@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/max16601) Remove use of i2c_match_id()Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from the i2c_device_id table. This can instead be done with i2c_client_get_device_id(). For this driver functionality should not change. Switch over to remove the last couple users of the i2c_match_id() function from kernel. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20260306171652.951274-12-afd@ti.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/ltc2978) Remove use of i2c_match_id()Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from the i2c_device_id table. This can instead be done with i2c_client_get_device_id(). For this driver functionality should not change. Switch over to remove the last couple users of the i2c_match_id() function from kernel. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20260306171652.951274-11-afd@ti.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-03-30hwmon: (pmbus/fsp-3y) Remove use of i2c_match_id()Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from the i2c_device_id table. This can be done instead with i2c_client_get_device_id() which doesn't need the i2c_device_id passed in so we do not need to have that forward declared, allowing us to move the i2c_device_id table down to its more natural spot with the other module info. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20260306171652.951274-10-afd@ti.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>