2024-05-08 17:17:05

by Chris Packham

[permalink] [raw]
Subject: [PATCH 0/2] hwmon: (adt7475) duty cycle configuration

I have a system that has very over spec'd fans so the amount of noise when they
run at 100% duty cycle is considerable. We have userspace monitoring tools that
will configure appropriate fan control parameters but there is a bit of a delay
between the kernel loading the driver and the userland tools catching up to
configure the fan control. This series adds device properties that allow the
PWM duty cycle to be specified via device properties so the PWM duty cycle can
be reduced as soon as possible.

Chris Packham (2):
dt-bindings: hwmon: Document adt7475 PWM initial duty cycle
hwmon: (adt7475) Add support for configuring initial PWM duty cycle

.../devicetree/bindings/hwmon/adt7475.yaml | 26 ++++++++-
drivers/hwmon/adt7475.c | 56 +++++++++++++++++++
2 files changed, 81 insertions(+), 1 deletion(-)

--
2.43.2



2024-05-08 17:17:05

by Chris Packham

[permalink] [raw]
Subject: [PATCH 1/2] dt-bindings: hwmon: Document adt7475 PWM initial duty cycle

Add documentation for the pwm-initial-duty-cycle and
pwm-initial-frequency properties. These allow the starting state of the
PWM outputs to be set to cater for hardware designs where undesirable
amounts of noise is created by the default hardware state.

Signed-off-by: Chris Packham <[email protected]>
---
.../devicetree/bindings/hwmon/adt7475.yaml | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
index 051c976ab711..3de300c9da2a 100644
--- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml
+++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml
@@ -51,6 +51,29 @@ properties:
enum: [0, 1]
default: 1

+ adi,pwm-initial-duty-cycle:
+ description: |
+ Configures the initial duty cycle for the PWM outputs. The hardware
+ default is 100% but this may cause unwanted fan noise at startup. Set
+ this to a value from 0 (0% duty cycle) to 255 (100% duty cycle).
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 3
+ maxItems: 3
+ items:
+ minimum: 0
+ maximum: 255
+ default: 255
+
+ adi,pwm-initial-frequency:
+ description: |
+ Configures the initial frequency for the PWM outputs.
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 3
+ maxItems: 3
+ items:
+ enum: [11, 14, 22, 29, 35, 44, 58, 88, 22500]
+ default: 35
+
patternProperties:
"^adi,bypass-attenuator-in[0-4]$":
description: |
@@ -80,7 +103,6 @@ patternProperties:
- therm#
- smbalert#
- gpio
-
required:
- compatible
- reg
@@ -99,6 +121,8 @@ examples:
adi,bypass-attenuator-in0 = <1>;
adi,bypass-attenuator-in1 = <0>;
adi,pwm-active-state = <1 0 1>;
+ adi,pwm-initial-duty-cycle = <128 0 128>;
+ adi,pwm-initial-frequency = <22500 0 22500>;
adi,pin10-function = "smbalert#";
adi,pin14-function = "tach4";
};
--
2.43.2


2024-05-08 19:00:56

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/2] dt-bindings: hwmon: Document adt7475 PWM initial duty cycle


On Thu, 09 May 2024 05:05:42 +1200, Chris Packham wrote:
> Add documentation for the pwm-initial-duty-cycle and
> pwm-initial-frequency properties. These allow the starting state of the
> PWM outputs to be set to cater for hardware designs where undesirable
> amounts of noise is created by the default hardware state.
>
> Signed-off-by: Chris Packham <[email protected]>
> ---
> .../devicetree/bindings/hwmon/adt7475.yaml | 26 ++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>

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/adt7475.example.dtb: hwmon@2e: adi,pwm-initial-frequency:0:1: 0 is not one of [11, 14, 22, 29, 35, 44, 58, 88, 22500]
from schema $id: http://devicetree.org/schemas/hwmon/adt7475.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

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.