Commit Graph

1465007 Commits

Author SHA1 Message Date
Thomas Weißschuh
87fdc8d7bb hwmon: (sysfs) Allow drivers to register const attributes
Switch to the __DEVICE_ATTR() macro which can handle callbacks taking
both const and non-const attribute structure arguments.
Allow the step-wise migration of the drivers.

Also use container_of_const() over container_of() to avoid casting away
the constness accidentally.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20260806-sysfs-const-attr-hwmon-v2-3-22fee8b85509@weissschuh.net
[groeck: Squashed 'hwmon: (core) Constify PEC device attribute']
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Wilken Gottwalt
52fcdd5639 hwmon: (corsair-psu) Update documentation
Add information about the HX1500i 2025 series and fix the missing
HX1500i in Kbuild.

Signed-off-by: Wilken Gottwalt <wilken.gottwalt@posteo.net>
Link: https://lore.kernel.org/r/anVuBd8Bb7T66OUO@monster.localdomain
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Thomas Weißschuh
7df38f8d4c hwmon: (core) Use const APIs for the dynamically allocated sysfs attributes
The non-const sysfs attribute APIs are going to go away at some point.

Switch to the const variants to prepare for that.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20260806-sysfs-const-attr-hwmon-v2-2-22fee8b85509@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Thomas Weißschuh
dafe7f1ec9 hwmon: (core) Constify device attributes
Mark the attribute structures as const, as they are never modified.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20260806-sysfs-const-attr-hwmon-v2-1-22fee8b85509@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Sergio Melas
9c110a4676 hwmon: (yogafan) Add support for new Lenovo models
Add DMI quirk entries and map correct ACPI paths and configurations for
additional Lenovo laptop models including the LOQ 15IAX9,
XiaoXin Pro 13ARE 2020, IdeaPad 3 15ALC6, Legion Pro 7 16AFR10H,
Yoga Pro 7 14IAH10, and Yoga 7 16ARP8.

Reorder the DMI quirk table to evaluate specific model matches before
generic family fallbacks, preventing DMI shadowing.

Signed-off-by: Sergio Melas <sergiomelas@gmail.com>
Link: https://lore.kernel.org/r/20260806131103.19104-1-sergiomelas@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Luiz Angelo Daros de Luca
62f8ed1d03 hwmon: (adt7470) Add thermal zone sensor support
Register the ADT7470 temperature channels as thermal zone sensors.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260805-adt7470_thermalzone-v6-4-5605a5f95467@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Luiz Angelo Daros de Luca
48e2047694 hwmon: (adt7470) Expose fan control via PWM framework
The ADT7470 features four PWM outputs designed to control fans.
Previously, these were only accessible through the legacy hwmon
sysfs interface.

Expose the ADT7470 fan control lines through the generic PWM framework.
This allows generic PWM consumers described in Device Tree, such as
"pwm-fan", to use the device through the "#pwm-cells" property.  This is
particularly necessary for boards where the ADT7470 external temperature
sensors are not populated and the chip is used strictly as a fan
controller (e.g., Edgecore ECS-2100-52T switches). In such setups,
delegating control to the generic PWM subsystem allows the kernel's
thermal framework to manage the fans based on unrelated temperature
zones, such as internal SoC sensors.

When a PWM consumer applies a new PWM state, the driver automatically
switches the corresponding PWM channel to manual mode so that the
requested duty cycle takes effect. The duty cycle specified by the PWM
framework is internally converted to the 0-255 scale expected by the
hardware registers.

To prevent conflicting access, the hwmon PWM sysfs attributes are hidden
when the device is registered with PWM framework support (i.e. when
"#pwm-cells" is present in DT and CONFIG_PWM is reachable).

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260805-adt7470_thermalzone-v6-3-5605a5f95467@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Luiz Angelo Daros de Luca
75eae6e1fa hwmon: (adt7470) Add ADT7470_PWM_MAX macro
Instead of a magic 255, use a macro to refer to it.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260805-adt7470_thermalzone-v6-2-5605a5f95467@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Luiz Angelo Daros de Luca
7d9d401d98 dt-bindings: hwmon: add adi,adt7470
The Analog Devices ADT7470 is a multichannel temperature sensor and
PWM fan controller. It supports monitoring up to 10 external
temperature sensors and controlling up to 4 fans.

Add the device tree binding documentation for it. This includes
support for the thermal framework by defining the "#thermal-sensor-cells"
property, and models the fan control lines as PWM channels by
defining the "#pwm-cells" property.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Link: https://lore.kernel.org/r/20260805-adt7470_thermalzone-v6-1-5605a5f95467@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Guenter Roeck
84f3d13ca4 hwmon: (pmbus/ir36021) Use pmbus_read_smbus_i2c_block_data for block commands
The driver uses i2c_smbus_read_i2c_block_data() for PMBus block commands.
Use pmbus_read_smbus_i2c_block_data() instead to enable the driver to work
with I2C controllers which do not support i2c_smbus_read_i2c_block_data().

Drop the functionality check to get an explicit error message if the
required SMBus commands are not supported.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Guenter Roeck
9d91132f4c hwmon: (pmbus/max20830) Use pmbus_read_smbus_i2c_block_data for block commands
The driver tries to use both pmbus_read_smbus_i2c_block_data() and
i2c_smbus_read_i2c_block_data() for PMBus block commands.

Use pmbus_read_smbus_i2c_block_data() instead to simplify the code.

Drop the functionality check to simplify the code and to trigger a return
with -EOPNOTSUPP if SMBus block commands are not supported.

Cc: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Cc: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Guenter Roeck
08007275d5 hwmon: (pmbus/ltc2978) Use pmbus_read_smbus_i2c_block_data for block commands
The driver uses a mix of pmbus_read_smbus_i2c_block_data() and
i2c_smbus_read_i2c_block_data() for PMBus block commands.

Use pmbus_read_smbus_i2c_block_data() instead to enable the driver to work
I2C controllers which do not support both block commands.

Drop the functionality check to simplify the code and to trigger a return
with -EOPNOTSUPP if SMBus block commands are not supported.

As part of this patch, rework detection of LT7170 and LT7171. The return
length of pmbus_read_smbus_i2c_block_data() may be less than the requested
number of bytes, meaning the return length needs to be checked. Also,
checking for "LT7170-1" after checking for "LT7170" and checking for
"LT7171-1" after checking for "LT7171" is pointless since the first check
will already produce a match, so drop the second part of the check.

Cc: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Cc: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Guenter Roeck
5b3dfe24a1 hwmon: (pmbus/adm1275) Use pmbus_read_smbus_i2c_block_data for block commands
The driver uses i2c_smbus_read_block_data() for PMBus block commands.
Use pmbus_read_smbus_i2c_block_data() instead to enable the driver to work
with I2C controllers which do not support i2c_smbus_read_block_data().

Drop the functionality check to get an explicit error message if the
required SMBus commands are not supported.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Guenter Roeck
1c5b549f80 hwmon: (pmbus/core) Introduce pmbus_read_smbus_i2c_block_data()
PMBus drivers need support for reading SMBus block data. Unfortunately,
not all i2C controllers support this command.

Implement pmbus_read_smbus_i2c_block_data() which first tries to use
i2c_smbus_read_block_data(). If not supported, try to emulate it by calling
i2c_smbus_read_i2c_block_data(). Export the new function for use in PMBus
drivers.

Cc: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Cc: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Vincent Jardin
25ad621391 hwmon: (pmbus/mpq8646) Gate the writes
The write cases of debugfs entries are provisioning and bench
helpers. By designs the MPQ8646 powers the CPU core rail,
so a wrong write can brown out the board or persist a bad
setpoint into finite-cycle NVM.
Said differently: some wrong register writes can and likely
will physically damage or destroy the chip and/or the board.

To be safe, it is disabled by default behind a
CONFIG_SENSORS_MPQ8646_DEBUG_UNSAFE and we print an explicit warning
banner at probe time when they are built in.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Link: https://lore.kernel.org/r/20260730-mpq8646_v0-v7-4-e7c7ad768d5d@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Vincent Jardin
24be24bebc hwmon: (pmbus) Add MPQ8646 driver
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>
2026-08-10 08:59:43 -07:00
Vincent Jardin
e7ba311513 dt-bindings: hwmon: pmbus: add MPS MPQ8646
The MPS MPQ8646 PMBus step-down converter uses the same
mps,vout-fb-divider-ratio-permille property with the same constraints
(maximum 2047, default 706) as the mps,mpq8785, so add its compatible
to the existing schema.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260730-mpq8646_v0-v7-2-e7c7ad768d5d@free.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Vincent Jardin
bf69cb4197 hwmon: (pmbus/core) export pmbus_check_and_notify_faults()
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>
2026-08-10 08:59:43 -07:00
Thomas Weißschuh
53a945a89d hwmon: (cros_ec) Avoid threshold temperature conversion overflows
If the EC returns non-sensical values the temperature conversions might
overflow on 32-bit systems.

As these values wouldn't make sense, clamp them to 255 degrees celsius.
The machine would die before reaching that limit anyways.

Suggested-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/lkml/0fbf7f69-bb90-4209-b9d5-258759711496@roeck-us.net/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20260730-cros_ec-hwmon-overflow-v3-1-c7198ba034ad@weissschuh.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:43 -07:00
Flaviu Nistor
fb564622ec hwmon: (lm90) Switch channel parsing to fwnode APIs
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>
2026-08-10 08:59:43 -07:00
Laszlo Ersek
a39b333694 hwmon: remove tautological dependency expressions from Kconfig
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>
2026-08-10 08:59:42 -07:00
Alexis Czezar Torreno
4cdcd4789f hwmon: (pmbus/max20830): add support for max20830c and max20840c
Add support for MAX20830C and MAX20840 step-down DC-DC switching
regulator with PMBus interface. MAX20830C is a different packaging
for MAX20830, and MAX20840C supports 40A regulation compared to
MAX20830 that is only 30A.

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Link: https://lore.kernel.org/r/20260730-dev-max20830c-v5-4-a7553f84ee74@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Alexis Czezar Torreno
b60e4b3ae1 dt-bindings: hwmon: (pmbus/max20830): add max20830c and max20840c support
Add compatible strings for variants of MAX20830 which are MAX20830C
and MAX20840C. These devices have the same register functionality with
MAX20830 but with a longer IC_DEVICE_ID.

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-3-a7553f84ee74@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Alexis Czezar Torreno
fdd78852b0 hwmon: (pmbus/max20830): add VOUT feedback resistor scaling support
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>
2026-08-10 08:59:42 -07:00
Alexis Czezar Torreno
b8efcfca43 dt-bindings: hwmon: (pmbus/max20830): add VOUT feedback resistor properties and complete examples
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>
2026-08-10 08:59:42 -07:00
Guenter Roeck
6d479f0f1b hwmon: (pmbus) Let PMBus drivers report the supported PMBus revision
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>
2026-08-10 08:59:42 -07:00
Sean Lyon
1dcda28817 hwmon: (nzxt-kraken3) Add support for NZXT Kraken 2024 Elite
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>
2026-08-10 08:59:42 -07:00
Georgi Vlaev
97c1723a1d hwmon: (pmbus/vt7505) Add driver for Analog Devices MAX16545/MAX16550 and Volterra VT7505
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>
2026-08-10 08:59:42 -07:00
Sanman Pradhan
047e3f8667 dt-bindings: hwmon: pmbus: Add Analog Devices MAX16545/MAX16550 and Volterra VT7505
Add device tree binding documentation for the Analog Devices MAX16545 and
MAX16550, and the Volterra VT7505 PMBus controllers.

Signed-off-by: Sanman Pradhan <psanman@juniper.net>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260725211945.288415-2-sanman.pradhan@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Andy Chung
20e95671a6 hwmon: (kb9002) Add documentation
Document the sysfs and debugfs interfaces of the Kandou KB9002 hwmon
driver.

Signed-off-by: Andy Chung <Andy.Chung@amd.com>
Link: https://lore.kernel.org/r/20260724-kb9002-upstream-v5-4-9523c3ffe83a@amd.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Andy Chung
694329073a hwmon: (kb9002) Add driver for Kandou KB9002 retimer
The Kandou KB9002 is an 8-lane PCIe 5.0 retimer that exposes an SMBus
target with mandatory PEC. Add a hwmon driver reporting the firmware
aggregated maximum die temperature as temp1_input, with the firmware
version and boot status under debugfs.

Signed-off-by: Andy Chung <Andy.Chung@amd.com>
Link: https://lore.kernel.org/r/20260724-kb9002-upstream-v5-3-9523c3ffe83a@amd.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Andy Chung
495e5dead2 dt-bindings: trivial-devices: Add Kandou KB9002
The Kandou KB9002 is an 8-lane PCIe 5.0 retimer exposing an SMBus target
that reports an aggregated die temperature. It needs no device-specific
device tree properties beyond its address, so add it to trivial-devices.

Signed-off-by: Andy Chung <Andy.Chung@amd.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260724-kb9002-upstream-v5-2-9523c3ffe83a@amd.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Andy Chung
1d687d863c dt-bindings: Add vendor prefix for Kandou
Kandou AI is the vendor of the KB9002 PCIe retimer.

Signed-off-by: Andy Chung <Andy.Chung@amd.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260724-kb9002-upstream-v5-1-9523c3ffe83a@amd.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
shaikh.kamal
828ac5f5a3 docs: hwmon: sg2042-mcu: fix spelling error
Fix spelling error reported by codespell:

  supprts -> supports

No functional change.

Signed-off-by: shaikh.kamal <shaikhkamal2012@gmail.com>
Link: https://lore.kernel.org/r/20260726065835.21012-1-shaikhkamal2012@gmail.com
[groeck: Move driver name to subject line]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Guenter Roeck
9fcd738d13 hwmon: (pmbus/mp2975) Eliminate dead code
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>
2026-08-10 08:59:42 -07:00
surendra
bd300460ce hwmon: (pmbus/ltc4283) Add missing MODULE_DEVICE_TABLE for OF match table
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>
2026-08-10 08:59:42 -07:00
Carlos Jones Jr
3d078657cf hwmon: (pmbus/max34440): Add support for MAX34452
Add support for Maxim MAX34452 PMBus 16-Channel V/I Monitor and
12-Channel Sequencer/Marginer. The device is similar to MAX34451
and shares the same configuration function.

The MAX34452 supports:
- 16 configurable voltage/current monitoring channels
- 5 temperature sensors (pages 16-20)
- Dynamic channel configuration via MFR_CHANNEL_CONFIG
- IOUT average monitoring

Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com>
Co-Developed by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Link: https://lore.kernel.org/r/20260722-max34451_fixes-v2-3-bbddb18ec1d6@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Alexis Czezar Torreno
596f410c05 hwmon: (pmbus/max34440): add support for newer version of max34451
The MAX34451 released a newer version called max34451etna8+.
This simply changes the direct format coefficients

Signed-off-by: Alexis Czezar Torreno <alexisczezar.torreno@analog.com>
Link: https://lore.kernel.org/r/20260722-max34451_fixes-v2-2-bbddb18ec1d6@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Nick Hawkins
6db3ba30de hwmon: (gxp_fan_ctrl) Provide fan info via gpio
The fan driver now is independent of the fan plreg GPIO information.
Therefore there will no longer be presence or fail information available
from the driver. Part of the changes includes removing a system power check
as the GPIO driver needs it to report power state to host.

Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230705194544.100370-5-nick.hawkins@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Nick Hawkins
152de279c1 dt-bindings: hwmon: hpe,gxp-fan-ctrl: remove fn2 and pl registers
Reduce the hpe,gxp-fan-ctrl register references from 3 to 1. The
function2 (fn2) and programmable logic (pl) references are removed.
The purpose of removal being their functionality will be consumed by a
new GPIO driver.

Signed-off-by: Nick Hawkins <nick.hawkins@hpe.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230705194544.100370-4-nick.hawkins@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Pan Chuang
ff496cdace hwmon: (pmbus) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-8-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Pan Chuang
b8ffbb950d hwmon: (sht15) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs detailed
error messages on failure. Remove the now-redundant driver-specific
dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-7-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Pan Chuang
45c6696215 hwmon: (pwm-fan) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs detailed
error messages on failure. Remove the now-redundant driver-specific
dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-6-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Pan Chuang
87dc289532 hwmon: (npcm750-pwm-fan) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_irq() automatically logs detailed
error messages on failure. Remove the now-redundant driver-specific
dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-5-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:42 -07:00
Pan Chuang
6dda9ad314 hwmon: (lm90) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-4-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:41 -07:00
Pan Chuang
ff72fc130f hwmon: (da9055) Remove redundant dev_err()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() call.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-3-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:41 -07:00
Pan Chuang
93238564c0 hwmon: (axi-fan-control) Remove redundant dev_err_probe()
Since commit 55b48e23f5 ("genirq/devres: Add error handling in
devm_request_*_irq()"), devm_request_threaded_irq() automatically logs
detailed error messages on failure. Remove the now-redundant
driver-specific dev_err() calls.

Signed-off-by: Pan Chuang <panchuang@vivo.com>
Link: https://lore.kernel.org/r/20260720063745.309331-2-panchuang@vivo.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2026-08-10 08:59:41 -07:00
Shih-Yuan Lee
94f5081d35 hwmon: (applesmc) Convert to hwmon_device_register_with_info
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>
2026-08-10 08:59:41 -07:00
Shih-Yuan Lee
5a151274c1 hwmon: (applesmc) Fix lockless cache validation data race
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>
2026-08-10 08:59:41 -07:00
Shih-Yuan Lee
d33baed3fe hwmon: (applesmc) Cache fan positions during register initialization
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>
2026-08-10 08:59:41 -07:00