From 221b565a3316b1ba3a9bcd1f61238440207b3e00 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Thu, 5 Nov 2026 10:17:02 -0800 Subject: [PATCH 01/11] hwmon: (gpio-fan) Fix runtime PM imbalance in probe and teardown In gpio_fan_probe(), gpio_fan_stop() is registered conditionally as a devres action before runtime PM is initialized, while gpio_fan_stop() unconditionally calls pm_runtime_disable(). This breaks runtime PM disable_depth and usage_count invariants across several paths: - On alarm-only devices without control GPIOs, gpio_fan_stop() is never registered, leaving pm_runtime_enable() unbalanced on unbind and triggering "Unbalanced pm_runtime_enable!" on subsequent binds. - When control GPIOs are present and devm_add_action_or_reset(), hwmon registration, or fan_alarm_init() fails, gpio_fan_stop() runs before pm_runtime_enable(), incrementing disable_depth to 2 (leaving runtime PM permanently disabled on re-probe) and, if speed_index > 0, underflowing usage_count via pm_runtime_put_sync(). - If pm_runtime_resume_and_get() fails when speed_index > 0, it drops its reference while speed_index remains non-zero, causing gpio_fan_stop() to call pm_runtime_put_sync() and underflow usage_count. - Registering the hwmon device before enabling runtime PM exposes sysfs attributes that can invoke set_fan_speed() before runtime PM state is initialized. Initialize runtime PM upfront with pm_runtime_set_suspended() and devm_pm_runtime_enable(), remove pm_runtime_disable() from gpio_fan_stop(), and acquire the initial active runtime PM reference before registering gpio_fan_stop() and the hwmon device. Fixes: 0d01110e6356 ("hwmon: (gpio-fan) Add regulator support") Reported-by: Sashiko Link: https://sashiko.dev/#/bug/linux-349aa3ba-30c3-4c3c-b47e-f52839af2b8d Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck --- drivers/hwmon/gpio-fan.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index d95a00f1c863..55c812442b4f 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c @@ -528,8 +528,6 @@ static void gpio_fan_stop(void *data) mutex_lock(&fan_data->lock); set_fan_speed(data, 0); mutex_unlock(&fan_data->lock); - - pm_runtime_disable(fan_data->dev); } static int gpio_fan_probe(struct platform_device *pdev) @@ -556,6 +554,11 @@ static int gpio_fan_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(fan_data->supply), "Failed to get fan-supply"); + pm_runtime_set_suspended(dev); + err = devm_pm_runtime_enable(dev); + if (err) + return err; + /* Configure control GPIOs if available. */ if (fan_data->gpios && fan_data->num_gpios > 0) { if (!fan_data->speed || fan_data->num_speed <= 1) @@ -563,6 +566,12 @@ static int gpio_fan_probe(struct platform_device *pdev) err = fan_ctrl_init(fan_data); if (err) return err; + /* If current GPIO state is active, mark RPM as active as well */ + if (fan_data->speed_index > 0) { + err = pm_runtime_resume_and_get(dev); + if (err) + return err; + } err = devm_add_action_or_reset(dev, gpio_fan_stop, fan_data); if (err) return err; @@ -583,17 +592,6 @@ static int gpio_fan_probe(struct platform_device *pdev) return err; } - pm_runtime_set_suspended(&pdev->dev); - pm_runtime_enable(&pdev->dev); - /* If current GPIO state is active, mark RPM as active as well */ - if (fan_data->speed_index > 0) { - int ret; - - ret = pm_runtime_resume_and_get(&pdev->dev); - if (ret) - return ret; - } - /* Optional cooling device register for Device tree platforms */ fan_data->cdev = devm_thermal_of_child_cooling_device_register(dev, np, "gpio-fan", From 028ed93145d9be88eee670088ef13482b5d36c1a Mon Sep 17 00:00:00 2001 From: Stanislav Aleksandrov Date: Sun, 8 Nov 2026 03:59:53 +0000 Subject: [PATCH 02/11] hwmon: (max31760) Fix the local temperature limit registers temp2_max and temp2_crit use each other's registers, so reading them shows the local limits swapped and writing temp2_max changes the overtemperature (SHDN) threshold. Use the high limit (0x0C) for temp2_max and the overtemperature limit (0x08) for temp2_crit. Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver") Cc: stable@vger.kernel.org Signed-off-by: Stanislav Aleksandrov Link: https://patch.msgid.link/20261108-max31760-fixes-v1-1-a61450463059@gmail.com Signed-off-by: Guenter Roeck --- drivers/hwmon/max31760.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c index d88c1eff9146..c16066f72c86 100644 --- a/drivers/hwmon/max31760.c +++ b/drivers/hwmon/max31760.c @@ -27,8 +27,8 @@ #define REG_TACH(ch) (0x52 + (ch) * 2) #define REG_TEMP_INPUT(ch) (0x56 + (ch) * 2) -#define REG_TEMP_MAX(ch) (0x06 + (ch) * 2) -#define REG_TEMP_CRIT(ch) (0x0A + (ch) * 2) +#define REG_TEMP_MAX(ch) ((ch) ? 0x0C : 0x06) +#define REG_TEMP_CRIT(ch) ((ch) ? 0x08 : 0x0A) #define TEMP11_FROM_REG(reg) ((reg) / 32 * 125) #define TEMP11_TO_REG(val) (DIV_ROUND_CLOSEST(clamp_val((val), -128000, \ From 95bddc5252a4c0a2ed9d62e7e53a3461265d9603 Mon Sep 17 00:00:00 2001 From: Stanislav Aleksandrov Date: Sun, 8 Nov 2026 03:59:54 +0000 Subject: [PATCH 03/11] hwmon: (max31760) Leave standby mode at probe The driver never clears the standby bit (CR2_STBY) during probe. While max31760_resume() clears this bit on resume, probe only configured CR2_ALERTS. If the chip was left in standby (for example, by boot firmware or a previously running OS before a warm reboot), it remains in standby: temperature sensing, fan speed counting, and PWM output are halted. This occurs on the Samsung Galaxy XR, where the bootloader places the chip in standby during boot. Clear CR2_STBY alongside setting CR2_ALERTS in probe. Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver") Cc: stable@vger.kernel.org Signed-off-by: Stanislav Aleksandrov Link: https://patch.msgid.link/20261108-max31760-fixes-v1-2-a61450463059@gmail.com Signed-off-by: Guenter Roeck --- drivers/hwmon/max31760.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c index c16066f72c86..ff55f7fc0f1b 100644 --- a/drivers/hwmon/max31760.c +++ b/drivers/hwmon/max31760.c @@ -533,8 +533,9 @@ static int max31760_probe(struct i2c_client *client) dev_set_drvdata(dev, state); - /* Set alert output to comparator mode */ - ret = regmap_set_bits(state->regmap, REG_CR2, CR2_ALERTS); + /* Leave standby mode, set alert output to comparator mode */ + ret = regmap_update_bits(state->regmap, REG_CR2, CR2_STBY | CR2_ALERTS, + CR2_ALERTS); if (ret) return dev_err_probe(dev, ret, "cannot write register\n"); From 33d58cbf2ab26bda81bc3052158d8b9867d5b9a6 Mon Sep 17 00:00:00 2001 From: Stanislav Aleksandrov Date: Sun, 8 Nov 2026 03:59:55 +0000 Subject: [PATCH 04/11] hwmon: (max31760) Report 0 RPM before the first fan speed measurement The tachometer count registers initialize to 0 until the first measurement cycle completes after power-on. To prevent division by zero, tach_to_rpm() clamped tach == 0 to 1, causing it to compute and report 3,000,000 RPM (60 * 100000 / 1 / 2). Return 0 RPM when tach == 0 instead. Fixes: 38b04ad02d0d ("drivers: hwmon: Add max31760 fan speed controller driver") Cc: stable@vger.kernel.org Signed-off-by: Stanislav Aleksandrov Link: https://patch.msgid.link/20261108-max31760-fixes-v1-3-a61450463059@gmail.com Signed-off-by: Guenter Roeck --- drivers/hwmon/max31760.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/max31760.c b/drivers/hwmon/max31760.c index ff55f7fc0f1b..cf9ee0ed1389 100644 --- a/drivers/hwmon/max31760.c +++ b/drivers/hwmon/max31760.c @@ -68,8 +68,9 @@ static const int max31760_pwm_freq[] = {33, 150, 1500, 25000}; static int tach_to_rpm(u16 tach) { + /* The count is 0 until the first measurement */ if (tach == 0) - tach = 1; + return 0; return 60 * 100000 / tach / 2; } From fc8519fab34e162b0c29dacccf73031820878917 Mon Sep 17 00:00:00 2001 From: Pablo Mazzini Date: Sun, 8 Nov 2026 09:35:59 +0000 Subject: [PATCH 05/11] hwmon: (sy7636a) fix negative temperatures The thermistor readout is a signed 8-bit value in degrees Celsius. Fixes: de34a4053250 ("hwmon: sy7636a: Add temperature driver for sy7636a") Cc: stable@vger.kernel.org Signed-off-by: Pablo Mazzini Link: https://patch.msgid.link/20261108093602.329554-3-pmazzini@gmail.com Signed-off-by: Guenter Roeck --- drivers/hwmon/sy7636a-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c index d51daaf63d63..f01f368d68e5 100644 --- a/drivers/hwmon/sy7636a-hwmon.c +++ b/drivers/hwmon/sy7636a-hwmon.c @@ -29,7 +29,7 @@ static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type, if (ret) return ret; - *temp = reg_val * 1000; + *temp = (s8)reg_val * 1000; return 0; } From 00944852275efd39706fe7b9ce75c28edde983eb Mon Sep 17 00:00:00 2001 From: Felix Radensky Date: Thu, 5 Nov 2026 21:32:00 +0200 Subject: [PATCH 06/11] hwmon: (pmbus/mp2975) Get vout fault limits dynamically The over- and under-voltage fault limits of the tracking mode are relative to the voltage reference, which follows the VID/AVS requests issued to the device and therefore changes at runtime. The driver reads the voltage reference once during probe and derives the limits from that snapshot, which the PMBus core caches in addition. As a result in2_crit and in2_lcrit reflect the operating point at probe, rather than the thresholds the device enforces. On systems where the device supplies the CPU core voltage, in2_crit was reported anywhere between 1.15V and 1.70V across identical systems, causing false over-voltage reports once the CPU voltage exceeded the value latched at probe. Read the voltage reference and the over-voltage offset selector whenever a limit is requested, and mark both limits with pmbus_set_update(), so that the core does not cache them. The voltage reference is available on page 3 only. Let the core change the page, so that the page it caches matches the device, except for a single rail configuration, for which the core does not issue PAGE commands, and the page is changed directly. With the selector read at runtime, a device configured with an unsupported selector no longer fails to probe. The OVP1 threshold, which does not depend on the selector, is reported for it instead, with a warning. Clamp the under-voltage limit to zero, since the offset can exceed a low voltage reference, while a negative value would be reported as a read error. Fixes: 2c6fcbb21149 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2975 controller") Cc: stable@vger.kernel.org Signed-off-by: Felix Radensky Reviewed-by: Vadim Pasternak Link: https://patch.msgid.link/20261105193200.1570996-1-fradensky@nvidia.com Signed-off-by: Guenter Roeck --- drivers/hwmon/pmbus/mp2975.c | 207 +++++++++++++++++++---------------- 1 file changed, 115 insertions(+), 92 deletions(-) diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c index a11ec6756990..2ad6b7d831c8 100644 --- a/drivers/hwmon/pmbus/mp2975.c +++ b/drivers/hwmon/pmbus/mp2975.c @@ -109,10 +109,7 @@ struct mp2975_data { int vout_scale; int max_phases[MP2975_PAGE_NUM]; int vid_step[MP2975_PAGE_NUM]; - int vref[MP2975_PAGE_NUM]; - int vref_off[MP2975_PAGE_NUM]; int vout_max[MP2975_PAGE_NUM]; - int vout_ov_fixed[MP2975_PAGE_NUM]; int curr_sense_gain[MP2975_PAGE_NUM]; }; @@ -460,12 +457,77 @@ static int mp2973_write_word_data(struct i2c_client *client, int page, return pmbus_write_word_data(client, 0, PMBUS_SMBALERT_MASK, ret); } +/* + * Let the PMBus core change the page, so that the page it caches matches the + * device. The core does not issue PAGE commands for a single rail + * configuration, thus change the page directly then. + */ +static int +mp2975_page_set(struct i2c_client *client, struct mp2975_data *data, int page) +{ + if (data->info.pages > 1) + return pmbus_set_page(client, page, 0xff); + + return i2c_smbus_write_byte_data(client, PMBUS_PAGE, page); +} + +/* + * Voltage reference is available on page 3 only. The callers read a register + * of the rail through the core first, thus the core caches the rail page. + */ +static int +mp2975_vref_get(struct i2c_client *client, struct mp2975_data *data, int page) +{ + int ret, vref; + + ret = mp2975_page_set(client, data, 3); + if (ret < 0) + return ret; + + vref = i2c_smbus_read_word_data(client, page ? MP2975_MFR_READ_VREF_R2 : + MP2975_MFR_READ_VREF_R1); + + ret = mp2975_page_set(client, data, page); + if (ret < 0) + return ret; + + return (vref < 0) ? vref : vref * data->vid_step[page]; +} + +static int +mp2975_ovp2_offset_get(int ovp_th_set) +{ + switch ((ovp_th_set & GENMASK(5, 3)) >> 3) { + case 1: + return 140; + case 2: + return 220; + case 4: + return 400; + default: + return -EINVAL; + } +} + +static int +mp2975_vout_ovp2_get(struct i2c_client *client, struct mp2975_data *data, + int page, int vref_off) +{ + int vref; + + vref = mp2975_vref_get(client, data, page); + if (vref < 0) + return vref; + + return vref + DIV_ROUND_CLOSEST(vref_off * data->vout_scale, 10); +} + static int mp2975_read_word_data(struct i2c_client *client, int page, int phase, int reg) { const struct pmbus_driver_info *info = pmbus_get_driver_info(client); struct mp2975_data *data = to_mp2975_data(info); - int ret; + int ret, ovp1, vref_off, uv_off; switch (reg) { case PMBUS_OT_FAULT_LIMIT: @@ -482,19 +544,35 @@ static int mp2975_read_word_data(struct i2c_client *client, int page, break; case PMBUS_VOUT_OV_FAULT_LIMIT: /* - * Register provides two values for over-voltage protection - * threshold for fixed (ovp2) and tracking (ovp1) modes. The - * minimum of these two values is provided as over-voltage - * fault alarm. + * Device provides dual over-voltage protection. OVP1 is + * referred to the maximum reference voltage, while OVP2 is + * referred to the current voltage reference, which is changed + * at runtime. Protection is tripped by any of them, thus the + * minimum of the two is exposed as over-voltage fault alarm, + * and OVP2 is obtained on each read. */ ret = mp2975_read_word_helper(client, page, phase, MP2975_MFR_OVP_TH_SET, - GENMASK(2, 0)); + GENMASK(5, 0)); if (ret < 0) return ret; - ret = min_t(int, data->vout_max[page] + 50 * (ret + 1), - data->vout_ov_fixed[page]); + ovp1 = data->vout_max[page] + 50 * ((ret & GENMASK(2, 0)) + 1); + + /* OVP1 still applies if the OVP2 threshold is unknown. */ + vref_off = mp2975_ovp2_offset_get(ret); + if (vref_off < 0) { + dev_warn_once(&client->dev, + "unsupported OVP2 selector, reporting OVP1 threshold\n"); + ret = ovp1; + break; + } + + ret = mp2975_vout_ovp2_get(client, data, page, vref_off); + if (ret < 0) + return ret; + + ret = min_t(int, ovp1, ret); break; case PMBUS_VOUT_UV_FAULT_LIMIT: ret = mp2975_read_word_helper(client, page, phase, @@ -503,8 +581,17 @@ static int mp2975_read_word_data(struct i2c_client *client, int page, if (ret < 0) return ret; - ret = DIV_ROUND_CLOSEST(data->vref[page] * 10 - 50 * - (ret + 1) * data->vout_scale, 10); + uv_off = 50 * (ret + 1) * data->vout_scale; + + ret = mp2975_vref_get(client, data, page); + if (ret < 0) + return ret; + + /* + * Offset can exceed the voltage reference, while a negative + * value would be reported as a read error. + */ + ret = max_t(int, DIV_ROUND_CLOSEST(ret * 10 - uv_off, 10), 0); break; case PMBUS_VIRT_READ_POUT_MAX: ret = mp2975_read_word_helper(client, page, phase, @@ -753,60 +840,6 @@ mp2975_current_sense_gain_get(struct i2c_client *client, return 0; } -static int -mp2975_vref_get(struct i2c_client *client, struct mp2975_data *data, - struct pmbus_driver_info *info) -{ - int ret; - - ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 3); - if (ret < 0) - return ret; - - /* Get voltage reference value for rail 1. */ - ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R1); - if (ret < 0) - return ret; - - data->vref[0] = ret * data->vid_step[0]; - - /* Get voltage reference value for rail 2, if connected. */ - if (data->info.pages == MP2975_PAGE_NUM) { - ret = i2c_smbus_read_word_data(client, MP2975_MFR_READ_VREF_R2); - if (ret < 0) - return ret; - - data->vref[1] = ret * data->vid_step[1]; - } - return 0; -} - -static int -mp2975_vref_offset_get(struct i2c_client *client, struct mp2975_data *data, - int page) -{ - int ret; - - ret = i2c_smbus_read_word_data(client, MP2975_MFR_OVP_TH_SET); - if (ret < 0) - return ret; - - switch ((ret & GENMASK(5, 3)) >> 3) { - case 1: - data->vref_off[page] = 140; - break; - case 2: - data->vref_off[page] = 220; - break; - case 4: - data->vref_off[page] = 400; - break; - default: - return -EINVAL; - } - return 0; -} - static int mp2975_vout_max_get(struct i2c_client *client, struct mp2975_data *data, struct pmbus_driver_info *info, int page) @@ -911,25 +944,6 @@ mp2975_vout_per_rail_config_get(struct i2c_client *client, ret = mp2975_vout_max_get(client, data, info, i); if (ret < 0) return ret; - - /* Skip if reading Vref is unsupported */ - if (data->chip_id != mp2975) - continue; - - /* Obtain voltage reference offsets. */ - ret = mp2975_vref_offset_get(client, data, i); - if (ret < 0) - return ret; - - /* - * Set over-voltage fixed value. Thresholds are provided as - * fixed value, and tracking value. The minimum of them are - * exposed as over-voltage critical threshold. - */ - data->vout_ov_fixed[i] = data->vref[i] + - DIV_ROUND_CLOSEST(data->vref_off[i] * - data->vout_scale, - 10); } return 0; @@ -1042,11 +1056,6 @@ static int mp2975_probe(struct i2c_client *client) if (ret) return ret; - /* Obtain voltage reference values. */ - ret = mp2975_vref_get(client, data, info); - if (ret) - return ret; - /* Obtain vout over-voltage scales. */ ret = mp2975_vout_ov_scale_get(client, data, info); if (ret < 0) @@ -1063,7 +1072,21 @@ static int mp2975_probe(struct i2c_client *client) if (ret) return ret; - return pmbus_do_probe(client, info); + ret = pmbus_do_probe(client, info); + if (ret) + return ret; + + /* + * Vout over- and under-voltage fault limits are relative to the + * voltage reference, which is changed at runtime. Do not allow the + * PMBus core to cache them. + */ + if (data->chip_id == mp2975) { + pmbus_set_update(client, PMBUS_VOUT_OV_FAULT_LIMIT, true); + pmbus_set_update(client, PMBUS_VOUT_UV_FAULT_LIMIT, true); + } + + return 0; } static const struct of_device_id mp2975_of_match[] = { From 3ae1af2faad93276645d7620261643457daec73b Mon Sep 17 00:00:00 2001 From: Xu Rao Date: Mon, 9 Nov 2026 16:28:54 +0800 Subject: [PATCH 07/11] hwmon: (scmi) Enable temperature sensors using their sensor IDs scmi_hwmon_probe() groups sensors by hwmon type, so the index in scmi_sensors->info[hwmon_temp] is not necessarily the SCMI sensor ID. Passing that index to config_set() targets a different sensor if the platform exposes non-temperature sensors ahead of temperature sensors. The intended temperature sensor can remain disabled, causing subsequent readings to fail. If configuring the wrong sensor fails, thermal registration of the intended sensor is also skipped. Use the firmware sensor ID, as the read and thermal registration paths already do, so temperature sensors are enabled correctly. The patch was reviewed and the commit message expanded with OpenCode AI assistance. Fixes: 72804d1631b3 ("hwmon: (scmi) Enable sensors to assure they can be read") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao Reviewed-by: Sudeep Holla Link: https://patch.msgid.link/AED18609B941BCFD+20261109082854.3739085-1-raoxu@uniontech.com Signed-off-by: Guenter Roeck --- drivers/hwmon/scmi-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index d4195d14a983..7789285b6c67 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -339,7 +339,7 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) if (!sensor) continue; - ret = sensor_ops->config_set(ph, i, sensor_config); + ret = sensor_ops->config_set(ph, sensor->id, sensor_config); if (ret) { dev_err(dev, "Error enabling sensor %s. err=%d\n", sensor->name, ret); From ca1abdd1a9b9ce51713a18c8905bf10579533c3b Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 9 Nov 2026 09:25:09 +0100 Subject: [PATCH 08/11] hwmon: (nct6775) Handle dual use registers The REG_TARGET register has different meaning, depending on if pwm is in thermal_cruise or speed_cruise. This means we can't assume it's always word sized, so we need to handle it differently depending on which mode we're in. The code already does this, but the register was configured as word sized for the speed_cruise mode, which would do the wrong thing in thermal_cruise mode. Fixes: 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D") Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116") Fixes: 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D") Cc: stable@vger.kernel.org Signed-off-by: Anton Lundin Link: https://patch.msgid.link/20261109082511.851377-2-glance@ac2.se Signed-off-by: Guenter Roeck --- drivers/hwmon/nct6775-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c index 6e97e4f08b90..3515a962adac 100644 --- a/drivers/hwmon/nct6775-core.c +++ b/drivers/hwmon/nct6775-core.c @@ -1188,15 +1188,13 @@ bool nct6775_reg_is_word_sized(struct nct6775_data *data, u16 reg) case nct6106: return reg == 0x20 || reg == 0x22 || reg == 0x24 || (reg >= 0x59 && reg < 0x69 && (reg & 1)) || - reg == 0xe0 || reg == 0xe2 || reg == 0xe4 || - reg == 0x111 || reg == 0x121 || reg == 0x131; + reg == 0xe0 || reg == 0xe2 || reg == 0xe4; case nct6116: case nct6126: return reg == 0x20 || reg == 0x22 || reg == 0x24 || reg == 0x26 || reg == 0x28 || reg == 0x59 || reg == 0x5b || reg == 0xe0 || reg == 0xe2 || reg == 0xe4 || reg == 0xe6 || - reg == 0xe8 || reg == 0x111 || reg == 0x121 || reg == 0x131 || - reg == 0x191 || reg == 0x1a1; + reg == 0xe8; case nct6775: return (((reg & 0xff00) == 0x100 || (reg & 0xff00) == 0x200) && From a2996d892d0150d059d39c683d95d6fd7a37630a Mon Sep 17 00:00:00 2001 From: Sudeep Holla Date: Mon, 9 Nov 2026 15:19:26 +0000 Subject: [PATCH 09/11] hwmon: (scmi) Check channel config allocation scmi_hwmon_add_chan_info() can fail to allocate a channel's config array. Ignoring that error leaves a channel with a NULL config pointer in the hwmon chip info, which hwmon dereferences while registering the device. Check the helper's return value and abort probe on failure. Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-d10ced6b-a6f0-403b-9619-f5a6573f9e7f Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI") Cc: stable@vger.kernel.org Signed-off-by: Sudeep Holla Link: https://patch.msgid.link/20261109151927.1672956-1-sudeep.holla@kernel.org Signed-off-by: Guenter Roeck --- drivers/hwmon/scmi-hwmon.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 7789285b6c67..0c82d8dbd626 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -228,8 +228,8 @@ static int scmi_thermal_sensor_register(struct device *dev, static int scmi_hwmon_probe(struct scmi_device *sdev) { - int i, idx; u16 nr_sensors; + int i, idx, ret; enum hwmon_sensor_types type; struct scmi_sensors *scmi_sensors; const struct scmi_sensor_info *sensor; @@ -297,8 +297,12 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) if (!nr_count[type]) continue; - scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], - type, hwmon_attributes[type]); + ret = scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, + nr_count[type], type, + hwmon_attributes[type]); + if (ret) + return ret; + *ptr_scmi_ci++ = scmi_hwmon_chan++; scmi_sensors->info[type] = @@ -333,8 +337,6 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) return PTR_ERR(hwdev); for (i = 0; i < nr_count_temp; i++) { - int ret; - sensor = *(scmi_sensors->info[hwmon_temp] + i); if (!sensor) continue; From 68af85b730f9a9e5f66c96ba861a66da08cfa5a9 Mon Sep 17 00:00:00 2001 From: Sudeep Holla Date: Mon, 9 Nov 2026 15:19:27 +0000 Subject: [PATCH 10/11] hwmon: (scmi) Configure sensors before exposing channels SCMI hwmon enables sensors with SENSOR_CONFIG_SET, but only after registering the hwmon device and only for temperature sensors. This leaves other sensor classes disabled on firmware that defaults sensors to off, and exposes temperature channels before they are ready. Configure each supported sensor while building the channel list, before registering the hwmon device. Leave failed sensors out of the list so their channels remain hidden, while continuing with other sensors. Cc: Marek Vasut Reported-by: Sashiko Closes: https://sashiko.dev/#/bug/linux-4bdf9a68-22d5-4305-b684-f11fe6d1dbcc Fixes: 72804d1631b3 ("hwmon: (scmi) Enable sensors to assure they can be read") Cc: stable@vger.kernel.org Signed-off-by: Sudeep Holla Link: https://patch.msgid.link/20261109151927.1672956-2-sudeep.holla@kernel.org Signed-off-by: Guenter Roeck --- drivers/hwmon/scmi-hwmon.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c index 0c82d8dbd626..91a63e92c3ed 100644 --- a/drivers/hwmon/scmi-hwmon.c +++ b/drivers/hwmon/scmi-hwmon.c @@ -325,6 +325,12 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) case ENERGY: type = scmi_types[sensor->type]; idx = --nr_count[type]; + ret = sensor_ops->config_set(ph, sensor->id, sensor_config); + if (ret) { + dev_err(dev, "Error enabling sensor %s. err=%d\n", + sensor->name, ret); + continue; + } *(scmi_sensors->info[type] + idx) = sensor; break; } @@ -341,13 +347,6 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) if (!sensor) continue; - ret = sensor_ops->config_set(ph, sensor->id, sensor_config); - if (ret) { - dev_err(dev, "Error enabling sensor %s. err=%d\n", - sensor->name, ret); - continue; - } - /* * Warn on any misconfiguration related to thermal zones but * bail out of probing only on memory errors. From b5c5b67e02406fb48acf57cf2c30a570230fd6aa Mon Sep 17 00:00:00 2001 From: Rupesh Majhi Date: Sun, 8 Nov 2026 19:26:51 +0200 Subject: [PATCH 11/11] hwmon: (aht10) Fix update_interval overflow on 64-bit On 64-bit, update_interval writes are clamped to LONG_MAX ms, but ms_to_ktime() overflows above 9223372036854 ms and the interval wraps. LONG_MAX becomes -1 ms, so every read starts a new measurement and update_interval reads back -1. Clamp to INT_MAX like sht4x, so the limit is the same on all platforms. Fixes: 8c78f0dee437 ("hwmon: Add AHT10 Temperature and Humidity Sensor Driver") Cc: stable@vger.kernel.org Signed-off-by: Rupesh Majhi Link: https://patch.msgid.link/20261108172651.220121-1-zoone.rupert@gmail.com Signed-off-by: Guenter Roeck --- drivers/hwmon/aht10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c index 89d18793137c..1a7580bf18b7 100644 --- a/drivers/hwmon/aht10.c +++ b/drivers/hwmon/aht10.c @@ -222,7 +222,7 @@ static int aht10_read_values(struct aht10_data *data) static ssize_t aht10_interval_write(struct aht10_data *data, long val) { - data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, LONG_MAX)); + data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, INT_MAX)); return 0; }