[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250512-cros_ec_fan-v3-0-a9f2b255f0cd@chromium.org>
Date: Mon, 12 May 2025 15:11:54 +0800
From: Sung-Chi Li via B4 Relay <devnull+lschyi.chromium.org@...nel.org>
To: Benson Leung <bleung@...omium.org>, Guenter Roeck <groeck@...omium.org>,
Thomas Weißschuh <linux@...ssschuh.net>,
Jean Delvare <jdelvare@...e.com>, Guenter Roeck <linux@...ck-us.net>,
Jonathan Corbet <corbet@....net>
Cc: chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-hwmon@...r.kernel.org, linux-doc@...r.kernel.org,
Sung-Chi Li <lschyi@...gle.com>, Sung-Chi Li <lschyi@...omium.org>
Subject: [PATCH v3 0/3] Export fan control and register fans as cooling
devices
This is a continuation of the previous series "Export the target RPM fan
control by ChromeOS EC under hwmon"
(https://lore.kernel.org/lkml/20250313-extend_ec_hwmon_fan-v1-0-5c566776f2c4@chromium.org/T/#t).
There is a change from controlling the target fan RPM value to control
the PWM value.
We anticipate to involve fans connected to EC as thermal cooling
devices, so we can utilize the thermal framework to have further thermal
control strategies.
This series updates the required EC controls definitions, implements the
mechanism for controlling fan PWM values, and registers these fans under
thermal framework as cooling devices.
Adapting comments from the previous series, the driver probes the host
command capability at beginning to see whether a fan is controllable:
- if command `EC_CMD_PWM_GET_FAN_DUTY` is supported (v0, this is a
new command).
- if command `EC_CMD_THERMAL_AUTO_FAN_CTRL` v2 is supported.
- if command `EC_CMD_PWM_SET_FAN_DUTY` v1 is supported.
This combination is selected as this is the minimum requirement for a
fan to be fully controllable under hwmon framework.
The driver supports changing the fan control mode, and allows to change
the fan PWM value only if the fan is in manual control mode. The power
management hook is implemented as well for keeping the fan control
settings, as EC will automatically restore the control method to auto
when device is suspended.
Change-Id: I4e2fdc8c4bc50778c0d04cfbefeaab7088d3181e
Signed-off-by: Sung-Chi Li <lschyi@...gle.com>
---
Changes in v3:
- Make required EC command versions macros.
- Add `CONFIG_THERMAL` guarding for registering as thermal fan cooling
devices.
- Add error handling during registering thermal cooling devices, and
immediately abort the registration if any error occurred to align with
the thermal sensor registration in hwmon core.
- Add error handling for EC fan communication during suspend and resume.
- Add `CONFIG_PM` guarding for checking whether the EC supports a
complete fan control in hwmon driver.
- Sort variables order in declaration.
- Separate declaration and logic to different sections.
- Move `cros_ec_thermal_cooling_ops` next right after the operation
functions declaration.
- Improve describing the resume behavior in documentation.
Changes in v2:
- Change column from 80 to 100 and fix styles.
- Directly store driver data into platform dev with
platform_set_drvdata.
- Unify the PWM unit (from 0 ~ 255) between hwmon and thermal cooling
devices.
- Only fetch the fan control mode and PWM value when suspending rather
than caching values when writing. The suspend hook is thus added.
- Link to v1: https://lore.kernel.org/r/20250429-cros_ec_fan-v1-0-a8d9e3efbb1a@chromium.org
---
Sung-Chi Li (3):
platform/chrome: update pwm fan control host commands
hwmon: (cros_ec) add PWM control over fans
hwmon: (cros_ec) register fans into thermal framework cooling devices
Documentation/hwmon/cros_ec_hwmon.rst | 7 +-
drivers/hwmon/cros_ec_hwmon.c | 306 +++++++++++++++++++++++++
include/linux/platform_data/cros_ec_commands.h | 29 ++-
3 files changed, 340 insertions(+), 2 deletions(-)
---
base-commit: 33035b665157558254b3c21c3f049fd728e72368
change-id: 20250429-cros_ec_fan-da3b64ac9c10
Best regards,
--
Sung-Chi Li <lschyi@...omium.org>
Powered by blists - more mailing lists