[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241026080535.444903-2-akinobu.mita@gmail.com>
Date: Sat, 26 Oct 2024 17:05:34 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linux-hwmon@...r.kernel.org,
devicetree@...r.kernel.org,
akinobu.mita@...il.com,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Billy Tsai <billy_tsai@...eedtech.com>
Subject: [PATCH v2 1/2] hwmon: (pwm-fan) add option to leave fan on shutdown
This adds an optional property "retain-state-shutdown" as requested by
Billy Tsai.
Billy said:
"Our platform is BMC that will use a PWM-FAN driver to control the fan
on the managed host. In our case, we do not want to stop the fan when
the BMC is reboot, which may cause the temperature of the managed host
not to be lowered."
Cc: Jean Delvare <jdelvare@...e.com>
Cc: Guenter Roeck <linux@...ck-us.net>
Cc: Rob Herring <robh@...nel.org>
Cc: Krzysztof Kozlowski <krzk+dt@...nel.org>
Cc: Conor Dooley <conor+dt@...nel.org>
Cc: Billy Tsai <billy_tsai@...eedtech.com>
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
---
drivers/hwmon/pwm-fan.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index c434db4656e7..dcb48a41f9f0 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -51,6 +51,7 @@ struct pwm_fan_ctx {
u32 *pulses_per_revolution;
ktime_t sample_start;
struct timer_list rpm_timer;
+ bool retain_state_shutdown;
unsigned int pwm_value;
unsigned int pwm_fan_state;
@@ -490,6 +491,8 @@ static int pwm_fan_probe(struct platform_device *pdev)
mutex_init(&ctx->lock);
+ ctx->retain_state_shutdown = device_property_read_bool(dev, "retain-state-shutdown");
+
ctx->dev = &pdev->dev;
ctx->pwm = devm_pwm_get(dev, NULL);
if (IS_ERR(ctx->pwm))
@@ -655,7 +658,8 @@ static void pwm_fan_shutdown(struct platform_device *pdev)
{
struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
- pwm_fan_cleanup(ctx);
+ if (!ctx->retain_state_shutdown)
+ pwm_fan_cleanup(ctx);
}
static int pwm_fan_suspend(struct device *dev)
--
2.34.1
Powered by blists - more mailing lists