From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Guenter Roeck <linux@roeck-us.net>,
Billy Tsai <billy_tsai@aspeedtech.com>
Subject: [PATCH 1/2] hwmon: (pwm-fan) add option to leave fan on shutdown
Date: Thu, 23 Sep 2021 11:34:47 +0900 [thread overview]
Message-ID: <20210923023448.4190-1-akinobu.mita@gmail.com> (raw)
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: Rob Herring <robh+dt@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Billy Tsai <billy_tsai@aspeedtech.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/hwmon/pwm-fan.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 17518b4cab1b..1ea0d0562c28 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -38,6 +38,7 @@ struct pwm_fan_ctx {
struct pwm_fan_tach *tachs;
ktime_t sample_start;
struct timer_list rpm_timer;
+ bool retain_state_shutdown;
unsigned int pwm_value;
unsigned int pwm_fan_state;
@@ -312,6 +313,9 @@ static int pwm_fan_probe(struct platform_device *pdev)
mutex_init(&ctx->lock);
+ ctx->retain_state_shutdown =
+ of_property_read_bool(dev->of_node, "retain-state-shutdown");
+
ctx->pwm = devm_of_pwm_get(dev, dev->of_node, NULL);
if (IS_ERR(ctx->pwm))
return dev_err_probe(dev, PTR_ERR(ctx->pwm), "Could not get PWM\n");
@@ -492,7 +496,10 @@ static int pwm_fan_disable(struct device *dev)
static void pwm_fan_shutdown(struct platform_device *pdev)
{
- pwm_fan_disable(&pdev->dev);
+ struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev);
+
+ if (!ctx->retain_state_shutdown)
+ pwm_fan_disable(&pdev->dev);
}
#ifdef CONFIG_PM_SLEEP
--
2.25.1
next reply other threads:[~2021-09-23 2:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-23 2:34 Akinobu Mita [this message]
2021-09-23 2:34 ` [PATCH 2/2] dt-bindings: hwmon: (pwm-fan) add retain-state-shutdown property Akinobu Mita
2024-10-25 8:28 ` Krzysztof Kozlowski
2024-10-25 8:31 ` Krzysztof Kozlowski
2021-10-11 14:34 ` [PATCH 1/2] hwmon: (pwm-fan) add option to leave fan on shutdown Guenter Roeck
2022-08-15 6:50 ` Billy Tsai
2024-10-23 6:08 ` Billy Tsai
2024-10-23 15:24 ` Rob Herring
2024-10-23 15:50 ` Guenter Roeck
2024-10-26 8:08 ` Akinobu Mita
2024-10-26 16:20 ` Guenter Roeck
2024-10-29 2:22 ` Billy Tsai
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=20210923023448.4190-1-akinobu.mita@gmail.com \
--to=akinobu.mita@gmail.com \
--cc=b.zolnierkie@samsung.com \
--cc=billy_tsai@aspeedtech.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=robh+dt@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