From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
akinobu.mita@gmail.com, Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Billy Tsai <billy_tsai@aspeedtech.com>
Subject: [PATCH v2 1/2] hwmon: (pwm-fan) add option to leave fan on shutdown
Date: Sat, 26 Oct 2024 17:05:34 +0900 [thread overview]
Message-ID: <20241026080535.444903-2-akinobu.mita@gmail.com> (raw)
In-Reply-To: <20241026080535.444903-1-akinobu.mita@gmail.com>
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@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rob Herring <robh@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.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
next prev parent reply other threads:[~2024-10-26 8:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 8:05 [PATCH v2 0/2] hwmon: (pwm-fan) add option to leave fan on shutdown Akinobu Mita
2024-10-26 8:05 ` Akinobu Mita [this message]
2024-10-29 2:34 ` [PATCH v2 1/2] " Billy Tsai
2024-10-30 14:55 ` Akinobu Mita
2024-10-30 15:02 ` Guenter Roeck
2024-10-30 15:18 ` Akinobu Mita
2024-10-30 15:30 ` Guenter Roeck
2024-10-26 8:05 ` [PATCH v2 2/2] dt-bindings: hwmon: pwm-fan: add retain-state-shutdown property Akinobu Mita
2024-10-27 20:38 ` Krzysztof Kozlowski
2024-10-28 12:42 ` Akinobu Mita
2024-10-28 14:22 ` Krzysztof Kozlowski
2024-10-28 14:57 ` Akinobu Mita
2024-10-30 15:18 ` Krzysztof Kozlowski
2024-10-30 15:34 ` Akinobu Mita
2024-11-04 7:45 ` Billy Tsai
2024-11-04 11:47 ` Krzysztof Kozlowski
2024-11-05 8:16 ` Billy Tsai
2024-10-26 16:19 ` [PATCH v2 0/2] hwmon: (pwm-fan) add option to leave fan on shutdown Guenter Roeck
2024-10-27 5:31 ` Akinobu Mita
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241026080535.444903-2-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=billy_tsai@aspeedtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox