hwmon: (amc6821) Add cooling device support
authorJoão Paulo Gonçalves <joao.goncalves@toradex.com>
Fri, 13 Jun 2025 13:42:40 +0000 (10:42 -0300)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 20 Jul 2025 23:38:34 +0000 (16:38 -0700)
commit90cf254f88d1d5a5219c8ee122ce677a3dc2f734
tree5563090884d2a1ec9b24961ca07bbab62575fd05
parentb0078b2c9f54eac77e2562d83e70ace41f8397cc
hwmon: (amc6821) Add cooling device support

Add support for using the AMC6821 as a cooling device. The AMC6821
registers with the thermal framework only if the `cooling-levels`
property is present in the fan device tree child node. If this property
is present, the driver assumes the fan will operate in open-loop, and
the kernel will control it directly. In this case, the driver will
change the AMC6821 mode to manual (software DCY) and set the initial PWM
duty cycle to the maximum fan cooling state level as defined in the DT.
It is worth mentioning that the cooling device is registered on the
child fan node, not on the fan controller node. Existing behavior is
unchanged, so the AMC6821 can still be used without the thermal
framework (hwmon only).

Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
Link: https://lore.kernel.org/r/20250613-b4-amc6821-cooling-device-support-v4-3-a8fc063c55de@toradex.com
[groeck: Reduced line length when registering thermal device]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/amc6821.c