* [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings
@ 2025-06-29 22:02 Marek Vasut
2025-06-29 22:02 ` [PATCH 2/2] hwmon: (pwm-fan) Implement " Marek Vasut
2025-07-08 15:50 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document " Rob Herring
0 siblings, 2 replies; 5+ messages in thread
From: Marek Vasut @ 2025-06-29 22:02 UTC (permalink / raw)
To: linux-hwmon
Cc: Marek Vasut, Conor Dooley, Guenter Roeck, Jean Delvare,
Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc
Document fan-shutdown-percent property, used to describe fan RPM in percent
set during shutdown. This is used to keep the fan running at fixed RPM after
the kernel shut down, which is useful on hardware that does keep heating
itself even after the kernel did shut down, for example from some sort of
management core.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
index 8b4ed5ee962f..a84cc3a4cfdc 100644
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
+++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
@@ -31,6 +31,15 @@ properties:
it must be self resetting edge interrupts.
maxItems: 1
+ fan-shutdown-percent:
+ description:
+ Fan RPM in percent set during shutdown. This is used to keep the fan
+ running at fixed RPM after the kernel shut down, which is useful on
+ hardware that does keep heating itself even after the kernel did shut
+ down, for example from some sort of management core.
+ minimum: 0
+ maximum: 100
+
fan-stop-to-start-percent:
description:
Minimum fan RPM in percent to start when stopped.
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] hwmon: (pwm-fan) Implement after shutdown fan settings
2025-06-29 22:02 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings Marek Vasut
@ 2025-06-29 22:02 ` Marek Vasut
2025-07-08 15:50 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document " Rob Herring
1 sibling, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2025-06-29 22:02 UTC (permalink / raw)
To: linux-hwmon
Cc: Marek Vasut, Conor Dooley, Guenter Roeck, Jean Delvare,
Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc
Add fan-shutdown-percent property, used to describe fan RPM in percent set
during shutdown. This is used to keep the fan running at fixed RPM after
the kernel shut down, which is useful on hardware that does keep heating
itself even after the kernel did shut down, for example from some sort of
management core. The current behavior of pwm-fan is to unconditionally
stop the fan on shutdown, which is not always the safe and correct thing
to do, so let the hardware description include the expected behavior.
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-hwmon@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
---
drivers/hwmon/pwm-fan.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index d0fe53451bdf..37269db2de84 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -64,6 +64,7 @@ struct pwm_fan_ctx {
u64 pwm_duty_cycle_from_stopped;
u32 pwm_usec_from_stopped;
+ u8 pwm_shutdown;
};
/* This handler assumes self resetting edge triggered interrupt. */
@@ -484,9 +485,14 @@ static void pwm_fan_cleanup(void *__ctx)
struct pwm_fan_ctx *ctx = __ctx;
timer_delete_sync(&ctx->rpm_timer);
- /* Switch off everything */
- ctx->enable_mode = pwm_disable_reg_disable;
- pwm_fan_power_off(ctx, true);
+ if (ctx->pwm_shutdown) {
+ ctx->enable_mode = pwm_enable_reg_enable;
+ __set_pwm(ctx, ctx->pwm_shutdown);
+ } else {
+ /* Switch off everything */
+ ctx->enable_mode = pwm_disable_reg_disable;
+ pwm_fan_power_off(ctx, true);
+ }
}
static int pwm_fan_probe(struct platform_device *pdev)
@@ -498,6 +504,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
int ret;
const struct hwmon_channel_info **channels;
u32 initial_pwm, pwm_min_from_stopped = 0;
+ u32 pwm_shutdown_percent = 0;
u32 *fan_channel_config;
int channel_count = 1; /* We always have a PWM channel. */
int i;
@@ -648,6 +655,11 @@ static int pwm_fan_probe(struct platform_device *pdev)
channels[1] = &ctx->fan_channel;
}
+ ret = device_property_read_u32(dev, "fan-shutdown-percent",
+ &pwm_shutdown_percent);
+ if (!ret && pwm_shutdown_percent)
+ ctx->pwm_shutdown = (clamp(pwm_shutdown_percent, 0, 100) * 255) / 100;
+
ret = device_property_read_u32(dev, "fan-stop-to-start-percent",
&pwm_min_from_stopped);
if (!ret && pwm_min_from_stopped) {
--
2.47.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings
2025-06-29 22:02 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings Marek Vasut
2025-06-29 22:02 ` [PATCH 2/2] hwmon: (pwm-fan) Implement " Marek Vasut
@ 2025-07-08 15:50 ` Rob Herring
2025-07-20 20:07 ` Marek Vasut
1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2025-07-08 15:50 UTC (permalink / raw)
To: Marek Vasut
Cc: linux-hwmon, Conor Dooley, Guenter Roeck, Jean Delvare,
Krzysztof Kozlowski, devicetree, linux-renesas-soc
On Mon, Jun 30, 2025 at 12:02:08AM +0200, Marek Vasut wrote:
> Document fan-shutdown-percent property, used to describe fan RPM in percent
> set during shutdown. This is used to keep the fan running at fixed RPM after
> the kernel shut down, which is useful on hardware that does keep heating
> itself even after the kernel did shut down, for example from some sort of
> management core.
This sounds more like "don't ever let the fan go below this RPM" or
"don't ever turn off the fan". IOW, it is more than just shutdown.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
> Cc: Rob Herring <robh@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-hwmon@vger.kernel.org
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> index 8b4ed5ee962f..a84cc3a4cfdc 100644
> --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
> @@ -31,6 +31,15 @@ properties:
> it must be self resetting edge interrupts.
> maxItems: 1
>
> + fan-shutdown-percent:
> + description:
> + Fan RPM in percent set during shutdown. This is used to keep the fan
> + running at fixed RPM after the kernel shut down, which is useful on
> + hardware that does keep heating itself even after the kernel did shut
> + down, for example from some sort of management core.
> + minimum: 0
> + maximum: 100
> +
> fan-stop-to-start-percent:
> description:
> Minimum fan RPM in percent to start when stopped.
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings
2025-07-08 15:50 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document " Rob Herring
@ 2025-07-20 20:07 ` Marek Vasut
2025-08-31 19:13 ` Marek Vasut
0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2025-07-20 20:07 UTC (permalink / raw)
To: Rob Herring
Cc: linux-hwmon, Conor Dooley, Guenter Roeck, Jean Delvare,
Krzysztof Kozlowski, devicetree, linux-renesas-soc
On 7/8/25 5:50 PM, Rob Herring wrote:
> On Mon, Jun 30, 2025 at 12:02:08AM +0200, Marek Vasut wrote:
>> Document fan-shutdown-percent property, used to describe fan RPM in percent
>> set during shutdown. This is used to keep the fan running at fixed RPM after
>> the kernel shut down, which is useful on hardware that does keep heating
>> itself even after the kernel did shut down, for example from some sort of
>> management core.
>
> This sounds more like "don't ever let the fan go below this RPM" or
> "don't ever turn off the fan". IOW, it is more than just shutdown.
This property is literally only used during/after shutdown , this does
not limit or affect fan RPM during runtime in any way.
Also, sorry for the late reply.
>> diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>> index 8b4ed5ee962f..a84cc3a4cfdc 100644
>> --- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>> +++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
>> @@ -31,6 +31,15 @@ properties:
>> it must be self resetting edge interrupts.
>> maxItems: 1
>>
>> + fan-shutdown-percent:
>> + description:
>> + Fan RPM in percent set during shutdown. This is used to keep the fan
>> + running at fixed RPM after the kernel shut down, which is useful on
>> + hardware that does keep heating itself even after the kernel did shut
>> + down, for example from some sort of management core.
>> + minimum: 0
>> + maximum: 100
>> +
>> fan-stop-to-start-percent:
>> description:
>> Minimum fan RPM in percent to start when stopped.
>> --
>> 2.47.2
>>
--
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings
2025-07-20 20:07 ` Marek Vasut
@ 2025-08-31 19:13 ` Marek Vasut
0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2025-08-31 19:13 UTC (permalink / raw)
To: Rob Herring
Cc: linux-hwmon, Conor Dooley, Guenter Roeck, Jean Delvare,
Krzysztof Kozlowski, devicetree, linux-renesas-soc
On 7/20/25 10:07 PM, Marek Vasut wrote:
> On 7/8/25 5:50 PM, Rob Herring wrote:
>> On Mon, Jun 30, 2025 at 12:02:08AM +0200, Marek Vasut wrote:
>>> Document fan-shutdown-percent property, used to describe fan RPM in
>>> percent
>>> set during shutdown. This is used to keep the fan running at fixed
>>> RPM after
>>> the kernel shut down, which is useful on hardware that does keep heating
>>> itself even after the kernel did shut down, for example from some
>>> sort of
>>> management core.
>>
>> This sounds more like "don't ever let the fan go below this RPM" or
>> "don't ever turn off the fan". IOW, it is more than just shutdown.
>
> This property is literally only used during/after shutdown , this does
> not limit or affect fan RPM during runtime in any way.
How can we proceed here ?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-31 19:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-29 22:02 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document after shutdown fan settings Marek Vasut
2025-06-29 22:02 ` [PATCH 2/2] hwmon: (pwm-fan) Implement " Marek Vasut
2025-07-08 15:50 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document " Rob Herring
2025-07-20 20:07 ` Marek Vasut
2025-08-31 19:13 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).