Add a new driver for the MPS MPQ8646 that is a PMBus device.
Beyond basic PMBus telemetry, the driver adds:
- alarm acknowledge via inX_reset_history.
- STATUS_WORD MPS-extended bit decode and the NVM-backed
PROTECTION_LAST post-mortem, exposed as a read-only debugfs
decoder.
- In-driver alarm-poll fallback work item (thanks lm90) for
boards without SMBALERT
Signed-off-by: Vincent Jardin <vjardin@free.fr>
Link: https://lore.kernel.org/r/20260730-mpq8646_v0-v7-3-e7c7ad768d5d@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Factor of pmbus_fault_handler() into an exported helper so
drivers can notify sequence from a polling work item on boards
for which the chip's SMBALERT# pin is not wired to the
CPU. The interrupt handler becomes a thin wrapper.
Like the SMBALERT# path, the helper notifies and then clears the
latched faults unconditionally, so a polling caller inherits exactly
the interrupt semantics.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
Link: https://lore.kernel.org/r/20260730-mpq8646_v0-v7-1-e7c7ad768d5d@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Replace OF property handling with fwnode in the probe function to read
the channels properties, improving the driver compatibility since this
method is not limited to Device Tree only.
Add also the needed headers for explicit include and clean up related
function naming.
Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
Link: https://lore.kernel.org/r/20260730091409.10544-1-flaviu.nistor@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Commit 554b3529fe ("thermal/drivers/core: Remove the module Kconfig's
option") [1] obviated some of the "Optional dependencies" (as described in
"Documentation/kbuild/kconfig-language.rst") in "drivers/hwmon/Kconfig".
Namely, said commit restricted the valid/possible subset of the full
Cartesian product "CONFIG_THERMAL x CONFIG_THERMAL_OF" to
{ (n, n), (y, n), (y, y) }
through "drivers/thermal/Kconfig". Numerically (using tristate values),
this set can be expressed as:
{ (0, 0), (2, 0), (2, 2) }
Over this set, the "drivers/hwmon/Kconfig" tristate expression
THERMAL || !THERMAL_OF
or equivalently,
max(THERMAL, 2-THERMAL_OF)
invariably evaluates to "y" (2).
Similarly, with THERMAL having been restricted to
{ n, y }
or numerically,
{ 0, 2 }
the "drivers/hwmon/Kconfig" tristate expression
THERMAL || THERMAL=n
or equivalently,
max(THERMAL, THERMAL=0)
invariably evaluates to "y" (2). (Note that "THERMAL=0" returns either "y"
(2) or "n" (0).)
Commit f37353320e ("hwmon/drivers/core: Simplify complex dependency")
[2], which is the final commit of the series that [1] is the beginning of,
cleaned up the hwmon C source code in fact; however, it missed the
now-collapsed dependencies in Kconfig. At the time of [2], six of today's
such dependencies were present in Kconfig. Since then, two more have been
added (such that they persist, anyway): one by commit 4f8d374b77
("hwmon: (max6650) add thermal cooling device capability"), which was
independent of the above-noted series, and another by commit 9855caf5d4
("hwmon: add driver for the hwmon parts of qnap-mcu devices"), which was a
descendant of the series.
Remove these always-"y" dependencies.
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Cristian Marussi <cristian.marussi@arm.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Sudeep Holla <sudeep.holla@kernel.org>
Cc: arm-scmi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-aspeed@lists.ozlabs.org
Cc: linux-hwmon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Laszlo Ersek <laszlo.ersek@arm.com>
Link: https://lore.kernel.org/r/20260729215436.2103380-1-laszlo.ersek@arm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Implement support for external voltage divider scaling using the
adi,vout-rfb1-ohms and adi,vout-rfb2-ohms device tree properties.
When the desired output voltage exceeds VREF, a resistor divider
(RFB1 and RFB2) is used to scale down the feedback voltage. The
driver reads these resistor values from device tree and applies
the scaling formula: VOUT_actual = VOUT_measured × (1 + RFB1/RFB2)
The properties are optional. If not specified, the driver assumes
no voltage divider is present and reports the raw VOUT reading.
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Link: https://lore.kernel.org/r/20260730-dev-max20830c-v5-2-a7553f84ee74@analog.com
[groeck: Fixed minor conflicts]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add adi,vout-rfb1-ohms and adi,vout-rfb2-ohms properties to support
external voltage divider configuration for VOUT sensing. When the
desired output voltage is higher than VREF, a resistor divider (RFB1
and RFB2) is required to reach the intended value.
The properties use a dependency constraint to ensure both resistors
are specified together, or neither. This prevents misconfiguration
where only one resistor value is provided.
This patch also adds missing entries in the examples.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Link: https://lore.kernel.org/r/20260730-dev-max20830c-v5-1-a7553f84ee74@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Some PMBus chips do not support the PMBUS_REVISION command. Knowing
the PMBUs revision supported by a chip is relevant for PMBUs core
functionality, so add support for letting chip drivers report the PMBUs
revision.
Use the new capability to report the PMBus revision supported by MAX20830.
While at it, add definitions for PMBUs revisons 1.3.1 and 1.4.
Cc: Nuno Sá <nuno.sa@analog.com>
Cc: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The Kraken 2024 Elite (USB ID 1e71:3012) is protocol-compatible with the
existing Kraken 2023 devices and works with the current Z53 code paths.
Add its USB product ID and map it to the KRAKEN2023 kind.
Tested on hardware: liquid temperature and pump/fan speeds read
correctly (cross-checked against liquidctl), and PWM control of both the
pump and fan channels works as expected.
Signed-off-by: Sean Lyon <sean@seanlyon.dev>
Link: https://lore.kernel.org/r/20260728031127.26553-1-sean@seanlyon.dev
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add a PMBus driver for the Analog Devices MAX16545 and MAX16550, and the
Volterra VT7505 controllers. The driver reports input/output voltage,
input/output current, input power and temperature over PMBus. All values
use the direct data format. Peak input voltage, output voltage, output
current, input power and temperature readings are exposed and can be
reset.
The reported current and power depend on the external current-report
resistor connected to the ILOAD pin, which can be provided through the
"adi,rload-ohms" device tree property.
On the MAX16550 and VT7505, the severe-OCP deglitch time can optionally
be configured with the "adi,ocp-severe-filter-us" device tree property.
When omitted, the existing hardware setting is left unchanged.
Co-developed-by: Dhruva Devineni <ddevineni@juniper.net>
Co-developed-by: Debjit Ghosh <dghosh@juniper.net>
Co-developed-by: JawaharBalaji Thirumalaisamy <jawaharb@juniper.net>
Co-developed-by: Avadhut Naik <avadhutn@juniper.net>
Co-developed-by: Santhanakrishnan Balraj <sbalraj@juniper.net>
Co-developed-by: Brian Mak <makb@juniper.net>
Signed-off-by: Georgi Vlaev <gvlaev@juniper.net>
Signed-off-by: Sanman Pradhan <psanman@juniper.net>
Link: https://lore.kernel.org/r/20260725211945.288415-3-sanman.pradhan@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Coverity reports dead code in mp2975_data2reg_linear11(). Code analysis
shows that the parameter passed to the function is always non-negative.
This means that negative values do not need to be handled, and the
associated variable and conditional code can be removed.
No functional impact or change.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The driver registers ltc4283_of_match as the platform driver's
.of_match_table so the kernel probes the device when a DT node with
compatible "adi,ltc4283" is present, but the corresponding
MODULE_DEVICE_TABLE(of, ...) call is absent.
Without it the module alias table (modules.alias) does not contain an
"of:N*T*Cadi,ltc4283" entry, so udev / kmod cannot auto-load the
module when the DT node appears, breaking modules-based deployments
while built-in configurations happen to work by accident.
Add the missing MODULE_DEVICE_TABLE() to fix module auto-loading.
Fixes: dd63353a0b ("hwmon: ltc4283: Add support for the LTC4283 Swap Controller")
Signed-off-by: surendra <kr494167@gmail.com>
Link: https://lore.kernel.org/r/20260721055022.34629-1-kr494167@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The legacy hwmon_device_register() function is deprecated and triggers
warnings in dmesg. Convert the driver to the modern
hwmon_device_register_with_info() API.
This conversion does the following:
- Dynamically allocates standard HWMON temp, fan, and pwm channels.
- Configures HWMON ops callbacks (.is_visible, .read, .read_string, .write).
- Standardizes attribute naming to match the HWMON ABI:
- fanX_output -> fanX_target (HWMON_F_TARGET)
- fanX_manual -> pwmX_enable (HWMON_PWM_ENABLE)
- Dynamically registers non-standard fanX_safe attributes under the HWMON
class directory via extra_groups.
- Cleans up legacy sysfs nodes, groups, and unused show/store static functions
to avoid unused symbol compiler warnings.
- Avoids recursive mutex deadlocks when writing to pwmX_enable by locklessly
resolving the entry and invoking the underlying raw SMC read/write calls.
- Avoids UAF race condition on module exit by using unmanaged registration and
explicitly calling hwmon_device_unregister() as the first step of applesmc_exit(),
guaranteeing that HWMON nodes are destroyed before static structures are freed.
Signed-off-by: Shih-Yuan Lee <fourdollars@debian.org>
Link: https://lore.kernel.org/r/20260711093323.14529-4-fourdollars@debian.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
In applesmc_get_entry_by_index(), the cache->valid flag is checked
locklessly, but setting it to true lacks memory barriers. This can lead to
a data race (TOCTOU) where another thread sees cache->valid as true
before the actual cache contents (cache->key, cache->len, cache->type, etc.)
are fully committed and visible to that CPU, potentially causing it to read
uninitialized data and send incorrect keys to the Apple SMC hardware.
Introduce memory barriers (smp_load_acquire and smp_store_release) with
explanatory comments to ensure cache synchronization is thread-safe and
fully visible across all CPUs.
Signed-off-by: Shih-Yuan Lee <fourdollars@debian.org>
Link: https://lore.kernel.org/r/20260711093323.14529-3-fourdollars@debian.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
To support the read_string callback for fan labels in the modern HWMON
API, load and cache the fan position names in smcreg.fan_positions
during register initialization.
Pre-pad fallback labels with four spaces to match the "+ 4" pointer
arithmetic offset used by all fan labels in the read_string callback.
Signed-off-by: Shih-Yuan Lee <fourdollars@debian.org>
Link: https://lore.kernel.org/r/20260711093323.14529-2-fourdollars@debian.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The driver has a match table for the i2c bus wired into its driver
structure, but the table is not exported with MODULE_DEVICE_TABLE().
Add the missing MODULE_DEVICE_TABLE() entry so module alias information
is generated for automatic module loading.
This is a source-level fix. It does not claim dynamic hardware
reproduction; the evidence is the driver-owned match table, its use by
the driver registration structure, and the missing module alias
publication.
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20260704151543.35069-1-pengpeng@iscas.ac.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
scripts/kernel-doc -Wall -none reports:
Warning: drivers/hwmon/peci/common.h:39 function parameter 'state' not
described in 'peci_sensor_need_update'
Warning: drivers/hwmon/peci/common.h:39 Excess function parameter
'sensor' description in 'peci_sensor_need_update'
Warning: drivers/hwmon/peci/common.h:49 function parameter 'state' not
described in 'peci_sensor_mark_updated'
Warning: drivers/hwmon/peci/common.h:49 Excess function parameter
'sensor' description in 'peci_sensor_mark_updated'
Both peci_sensor_need_update() and peci_sensor_mark_updated() take a
pointer to struct peci_sensor_state named 'state', but their kernel-doc
comments document a parameter named 'sensor' and describe it as a
pointer to the sensor data struct. The comments have been out of sync
with the code since the file was added by commit bf3608f338 ("hwmon:
peci: Add cputemp driver").
Update the kernel-doc comments to document the 'state' parameter.
No functional change.
Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
Link: https://lore.kernel.org/r/20260712081258.7-1-bbnpreetsingh@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
The GXCAS GXHT30 is a humidity and temperature sensor that is a
drop-in replacement for and fully software compatible with the
Sensirion SHT30.
It is handled by the "sensirion,sht30" fallback compatible without
any driver changes; manual instantiation works with the existing
sht3x device name. Document the chip as supported.
Signed-off-by: Zaixiang Xu <zaixiang.xu.dev@gmail.com>
Link: https://lore.kernel.org/r/20260713074559.12196-5-zaixiang.xu.dev@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add an of_device_id table to support devicetree based instantiation
of the supported sensors.
The devicetree binding models all higher accuracy parts with a
fallback to the base part of their group, so only the two base
compatibles need to be listed. The match data distinguishes the
humidity and temperature parts (SHT3x) from the temperature-only
parts (STS3x), which require different configuration.
Start enum sht3x_chips at 1: with sht3x equal to 0, the OF match
data for the SHT devices would be NULL, causing i2c_get_match_data()
to fall back to i2c_device_id name matching, which fails for
devicetree names. The devices would then only work because the
resulting chip id 0 happens to equal sht3x. Non-zero match data
avoids relying on that coincidence.
Signed-off-by: Zaixiang Xu <zaixiang.xu.dev@gmail.com>
Link: https://lore.kernel.org/r/20260713074559.12196-4-zaixiang.xu.dev@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Add a YAML devicetree binding for the Sensirion SHT3x/STS3x sensor
family and the compatible GXCAS GXHT30, with the ALERT interrupt,
nRESET GPIO and VDD supply as optional properties.
The SHT30, SHT31, SHT35 and SHT85 measure humidity and temperature
and differ only in accuracy and packaging, while the STS30, STS31,
STS32 and STS35 are temperature-only parts. Within each group the
parts share the same software interface, so model them with a
fallback to the base part of their group: "sensirion,sht30" for the
SHT parts and "sensirion,sts30" for the STS parts.
The GXCAS GXHT30 is a drop-in replacement for the SHT30 and uses it
as fallback as well.
Signed-off-by: Zaixiang Xu <zaixiang.xu.dev@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260713074559.12196-3-zaixiang.xu.dev@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Enable T_Sensor for ROG STRIX X870E-E GAMING WIFI.
Board specs list the sensor, reading at the standard for this family
address without the thermistor connected to the motherboard, returns
-62, which is one of the known blank values (the other one in -40)
readings for temperature sensors in the ASUS EC when there is no
thermistor connected to the motherboard socket. With that evidence we
conclude that the T_Sensor can be enabled in the driver for this board.
Signed-off-by: Vishaal Saraiya <vishaal.saraiya@gmail.com>
Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
Link: https://lore.kernel.org/r/20260711073319.553163-2-eugene.shalygin@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
tmp401 is missing HWMON_C_REGISTER_TZ. So a devicetree thermal
zone referencing a such sensor ('thermal-sensors = <&tmp411 N>')
fails to register it. Then its cooling-maps is not set, which means
that the fans are not managed.
Same as lm90 or jc42, set HWMON_C_REGISTER_TZ.
Boards without the property into the DT keep the same behavior.
Signed-off-by: Vincent Jardin <vjardin@free.fr>
Link: https://lore.kernel.org/r/20260713-for-upstream-hwmon-tmp401-register-tz-v1-1-47315d8617bc@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>