* [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
@ 2025-01-02 17:50 Peter Korsgaard
2025-01-02 17:50 ` [PATCH 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable Peter Korsgaard
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-02 17:50 UTC (permalink / raw)
To: Guenter Roeck, devicetree, linux-hwmon
Cc: Peter Korsgaard, Jean Delvare, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, open list
The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
always be desirable because of noise or power consumption peaks, so add an
optional "default-pwm" property that can be used to specify a custom default
PWM duty cycle.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
index 8b4ed5ee962f..83b8b0b964ee 100644
--- a/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
+++ b/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml
@@ -20,6 +20,12 @@ properties:
items:
maximum: 255
+ default-pwm:
+ description: Default PWM duty cycle value to use at startup
+ minimum: 0
+ maximum: 255
+ default: 255
+
fan-supply:
description: Phandle to the regulator that provides power to the fan.
@@ -100,6 +106,7 @@ examples:
pwm-fan {
compatible = "pwm-fan";
pwms = <&pwm 0 40000 0>;
+ default-pwm = 75;
fan-supply = <®_fan>;
interrupt-parent = <&gpio5>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable
2025-01-02 17:50 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Peter Korsgaard
@ 2025-01-02 17:50 ` Peter Korsgaard
2025-01-02 18:22 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Krzysztof Kozlowski
2025-01-02 19:24 ` Rob Herring (Arm)
2 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-02 17:50 UTC (permalink / raw)
To: Guenter Roeck, devicetree, linux-hwmon
Cc: Peter Korsgaard, Jean Delvare, open list
The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
always be desirable because of noise or power consumption peaks, so support
an optional "default-pwm" property that can be used to specify the default
PWM duty cycle.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
drivers/hwmon/pwm-fan.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 53a1a968d00d..09e9047635f7 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -499,6 +499,7 @@ static int pwm_fan_probe(struct platform_device *pdev)
const struct hwmon_channel_info **channels;
u32 pwm_min_from_stopped = 0;
u32 *fan_channel_config;
+ u32 default_pwm;
int channel_count = 1; /* We always have a PWM channel. */
int i;
@@ -545,11 +546,15 @@ static int pwm_fan_probe(struct platform_device *pdev)
ctx->enable_mode = pwm_disable_reg_enable;
+ ret = device_property_read_u32(dev, "default-pwm", &default_pwm);
+ if (ret)
+ default_pwm = MAX_PWM;
+
/*
- * Set duty cycle to maximum allowed and enable PWM output as well as
+ * Set duty cycle to default and enable PWM output as well as
* the regulator. In case of error nothing is changed
*/
- ret = set_pwm(ctx, MAX_PWM);
+ ret = set_pwm(ctx, default_pwm);
if (ret) {
dev_err(dev, "Failed to configure PWM: %d\n", ret);
return ret;
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-02 17:50 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Peter Korsgaard
2025-01-02 17:50 ` [PATCH 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable Peter Korsgaard
@ 2025-01-02 18:22 ` Krzysztof Kozlowski
2025-01-03 7:59 ` Peter Korsgaard
2025-01-02 19:24 ` Rob Herring (Arm)
2 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-02 18:22 UTC (permalink / raw)
To: Peter Korsgaard, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 02/01/2025 18:50, Peter Korsgaard wrote:
> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
> always be desirable because of noise or power consumption peaks, so add an
> optional "default-pwm" property that can be used to specify a custom default
> PWM duty cycle.
>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
That's v3, not v1. Also mention here shortly how Rob's comment is addressed.
Please always handle reviewers' feedback, either by implementing it or
by responding or by extending commit msg. All this is missing in all
your versions you sent.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-02 18:22 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Krzysztof Kozlowski
@ 2025-01-03 7:59 ` Peter Korsgaard
2025-01-03 8:10 ` Krzysztof Kozlowski
0 siblings, 1 reply; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-03 7:59 UTC (permalink / raw)
To: Krzysztof Kozlowski, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 1/2/25 19:22, Krzysztof Kozlowski wrote:
> On 02/01/2025 18:50, Peter Korsgaard wrote:
>> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
>> always be desirable because of noise or power consumption peaks, so add an
>> optional "default-pwm" property that can be used to specify a custom default
>> PWM duty cycle.
>>
>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>
> That's v3, not v1. Also mention here shortly how Rob's comment is addressed.
It is? Then that wasn't from me, and I don't right away see anything
related on lore. Can you give me a pointer?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-03 7:59 ` Peter Korsgaard
@ 2025-01-03 8:10 ` Krzysztof Kozlowski
2025-01-03 9:01 ` Peter Korsgaard
0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-03 8:10 UTC (permalink / raw)
To: Peter Korsgaard, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 03/01/2025 08:59, Peter Korsgaard wrote:
> On 1/2/25 19:22, Krzysztof Kozlowski wrote:
>> On 02/01/2025 18:50, Peter Korsgaard wrote:
>>> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
>>> always be desirable because of noise or power consumption peaks, so add an
>>> optional "default-pwm" property that can be used to specify a custom default
>>> PWM duty cycle.
>>>
>>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>>
>> That's v3, not v1. Also mention here shortly how Rob's comment is addressed.
>
> It is? Then that wasn't from me, and I don't right away see anything
> related on lore. Can you give me a pointer?
It is trivial to find your v1 and v2 in lore, so I assume you just reply
here to waste my time.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-03 8:10 ` Krzysztof Kozlowski
@ 2025-01-03 9:01 ` Peter Korsgaard
2025-01-03 9:35 ` Krzysztof Kozlowski
0 siblings, 1 reply; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-03 9:01 UTC (permalink / raw)
To: Krzysztof Kozlowski, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 1/3/25 09:10, Krzysztof Kozlowski wrote:
> On 03/01/2025 08:59, Peter Korsgaard wrote:
>> On 1/2/25 19:22, Krzysztof Kozlowski wrote:
>>> On 02/01/2025 18:50, Peter Korsgaard wrote:
>>>> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
>>>> always be desirable because of noise or power consumption peaks, so add an
>>>> optional "default-pwm" property that can be used to specify a custom default
>>>> PWM duty cycle.
>>>>
>>>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>>>
>>> That's v3, not v1. Also mention here shortly how Rob's comment is addressed.
>>
>> It is? Then that wasn't from me, and I don't right away see anything
>> related on lore. Can you give me a pointer?
>
> It is trivial to find your v1 and v2 in lore, so I assume you just reply
> here to waste my time.
Sorry, I indeed apparently did send a v1/v2 ~1 year ago, I must be
getting old. I didn't look that far back in lore and for some reason I
don't have the changes in my local tree anymore, hence the reason for
recreating the commits yesterday and sending a new v1.
Looking at lore, v1 used target-pwm which Gunter suggested I changed to
default-rpm while explaining that it cannot be a generic property:
https://lore.kernel.org/linux-devicetree/b717da30-1d4c-4e09-b98c-4aa41a235234@roeck-us.net/
Which I then did as a v2, that then didn't get any additional feedback:
https://lore.kernel.org/linux-devicetree/3aa21a01-c994-4b36-8893-181e55a60c5e@korsgaard.com/
So if we agree on default-pwm, then I can send an update (a v4!) with
the typo in the example fixed, OK?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-03 9:01 ` Peter Korsgaard
@ 2025-01-03 9:35 ` Krzysztof Kozlowski
2025-01-03 9:42 ` Peter Korsgaard
0 siblings, 1 reply; 10+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-03 9:35 UTC (permalink / raw)
To: Peter Korsgaard, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 03/01/2025 10:01, Peter Korsgaard wrote:
>
> Looking at lore, v1 used target-pwm which Gunter suggested I changed to
> default-rpm while explaining that it cannot be a generic property:
>
> https://lore.kernel.org/linux-devicetree/b717da30-1d4c-4e09-b98c-4aa41a235234@roeck-us.net/
>
> Which I then did as a v2, that then didn't get any additional feedback:
>
> https://lore.kernel.org/linux-devicetree/3aa21a01-c994-4b36-8893-181e55a60c5e@korsgaard.com/
>
> So if we agree on default-pwm, then I can send an update (a v4!) with
> the typo in the example fixed, OK?
Yes and we go back to my first comment about commit msg:
"Also mention here shortly how Rob's comment is addressed."
e.g. we cannot use default/target-rpm because of foo bar.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-03 9:35 ` Krzysztof Kozlowski
@ 2025-01-03 9:42 ` Peter Korsgaard
0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-03 9:42 UTC (permalink / raw)
To: Krzysztof Kozlowski, Guenter Roeck, devicetree, linux-hwmon
Cc: Jean Delvare, Rob Herring, Krzysztof Kozlowski, Conor Dooley, open list
On 1/3/25 10:35, Krzysztof Kozlowski wrote:
>> So if we agree on default-pwm, then I can send an update (a v4!) with
>> the typo in the example fixed, OK?
>
> Yes and we go back to my first comment about commit msg:
>
> "Also mention here shortly how Rob's comment is addressed."
>
> e.g. we cannot use default/target-rpm because of foo bar.
OK, I'll extend the commit message and send a v4.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-02 17:50 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Peter Korsgaard
2025-01-02 17:50 ` [PATCH 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable Peter Korsgaard
2025-01-02 18:22 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Krzysztof Kozlowski
@ 2025-01-02 19:24 ` Rob Herring (Arm)
2025-01-03 9:16 ` Peter Korsgaard
2 siblings, 1 reply; 10+ messages in thread
From: Rob Herring (Arm) @ 2025-01-02 19:24 UTC (permalink / raw)
To: Peter Korsgaard
Cc: Guenter Roeck, Krzysztof Kozlowski, Conor Dooley, devicetree,
linux-hwmon, Jean Delvare, linux-kernel
On Thu, 02 Jan 2025 18:50:40 +0100, Peter Korsgaard wrote:
> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
> always be desirable because of noise or power consumption peaks, so add an
> optional "default-pwm" property that can be used to specify a custom default
> PWM duty cycle.
>
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
> Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml: default-pwm: missing type definition
Error: Documentation/devicetree/bindings/hwmon/pwm-fan.example.dts:75.25-27 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.dtbs:131: Documentation/devicetree/bindings/hwmon/pwm-fan.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1506: dt_binding_check] Error 2
make: *** [Makefile:251: __sub-make] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250102175041.822977-1-peter@korsgaard.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property
2025-01-02 19:24 ` Rob Herring (Arm)
@ 2025-01-03 9:16 ` Peter Korsgaard
0 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2025-01-03 9:16 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Guenter Roeck, Krzysztof Kozlowski, Conor Dooley, devicetree,
linux-hwmon, Jean Delvare, linux-kernel
On 1/2/25 20:24, Rob Herring (Arm) wrote:
>
> On Thu, 02 Jan 2025 18:50:40 +0100, Peter Korsgaard wrote:
>> The pwm-fan driver uses full PWM (255) duty cycle at startup, which may not
>> always be desirable because of noise or power consumption peaks, so add an
>> optional "default-pwm" property that can be used to specify a custom default
>> PWM duty cycle.
>>
>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>> ---
>> Documentation/devicetree/bindings/hwmon/pwm-fan.yaml | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/pwm-fan.yaml: default-pwm: missing type definition
> Error: Documentation/devicetree/bindings/hwmon/pwm-fan.example.dts:75.25-27 syntax error
> FATAL ERROR: Unable to parse input tree
> make[2]: *** [scripts/Makefile.dtbs:131: Documentation/devicetree/bindings/hwmon/pwm-fan.example.dtb] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1506: dt_binding_check] Error 2
> make: *** [Makefile:251: __sub-make] Error 2
Ups, I added the entry to the example AFTER running make
dt_binding_check and missed the <>, will fix.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-01-03 9:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-02 17:50 [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Peter Korsgaard
2025-01-02 17:50 ` [PATCH 2/2] hwmon: (pwm-fan): Make default PWM duty cycle configurable Peter Korsgaard
2025-01-02 18:22 ` [PATCH 1/2] dt-bindings: hwmon: pwm-fan: Document default-pwm property Krzysztof Kozlowski
2025-01-03 7:59 ` Peter Korsgaard
2025-01-03 8:10 ` Krzysztof Kozlowski
2025-01-03 9:01 ` Peter Korsgaard
2025-01-03 9:35 ` Krzysztof Kozlowski
2025-01-03 9:42 ` Peter Korsgaard
2025-01-02 19:24 ` Rob Herring (Arm)
2025-01-03 9:16 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®