* [PATCH 0/2] hwmon: adt7475: Implement support for #pwm-cells = <3> @ 2025-06-19 19:37 Uwe Kleine-König 2025-06-19 19:37 ` [PATCH 1/2] " Uwe Kleine-König 2025-06-19 19:37 ` [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend " Uwe Kleine-König 0 siblings, 2 replies; 6+ messages in thread From: Uwe Kleine-König @ 2025-06-19 19:37 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck Cc: Chris Packham, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree Hello, this patch series implements support for #pwm-cells = <3> and updates the binding accordingly. 3 cells is the usual PWM binding as was discussed in https://lore.kernel.org/linux-hwmon/jmxmxzzfyobuheqe75lj7qcq5rlt625wddb3rlhiernunjdodu@tgxghvfef4tl . Best regards Uwe Uwe Kleine-König (2): hwmon: adt7475: Implement support for #pwm-cells = <3> dt-bindings: hwmon: adt7475: Allow and recommend #pwm-cells = <3> .../devicetree/bindings/hwmon/adt7475.yaml | 15 ++++++++------ drivers/hwmon/adt7475.c | 20 ++++++++++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) base-commit: 4325743c7e209ae7845293679a4de94b969f2bef -- 2.49.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] hwmon: adt7475: Implement support for #pwm-cells = <3> 2025-06-19 19:37 [PATCH 0/2] hwmon: adt7475: Implement support for #pwm-cells = <3> Uwe Kleine-König @ 2025-06-19 19:37 ` Uwe Kleine-König 2025-07-16 20:11 ` Guenter Roeck 2025-06-19 19:37 ` [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend " Uwe Kleine-König 1 sibling, 1 reply; 6+ messages in thread From: Uwe Kleine-König @ 2025-06-19 19:37 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck Cc: Chris Packham, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree The adt7475 driver and binding are outliers requiring 4 pwm-cells. The typical value is 3, there are a few devices that use a lesser value for historical reasons, no other uses a value bigger than 3. Implement support for 3 cells to make the adt7475 binding match the usual PWM binding. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> --- drivers/hwmon/adt7475.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c index 5f2541c11fe9..8cefa14e1633 100644 --- a/drivers/hwmon/adt7475.c +++ b/drivers/hwmon/adt7475.c @@ -1704,12 +1704,15 @@ static int adt7475_pwm_properties_parse_reference_args(struct fwnode_handle *fwn if (ret) return ret; - if (rargs.nargs != 4) { + if (rargs.nargs != 3 && rargs.nargs != 4) { fwnode_handle_put(rargs.fwnode); return -EINVAL; } - for (i = 0; i < 4; i++) + /* Let duty_cycle default to period */ + args[3] = rargs.args[1]; + + for (i = 0; i < rargs.nargs; i++) args[i] = rargs.args[i]; ret = _adt7475_pwm_properties_parse_args(args, cfg); @@ -1724,11 +1727,22 @@ static int adt7475_pwm_properties_parse_args(struct fwnode_handle *fwnode, { int ret; u32 args[4] = {}; + size_t n_vals = fwnode_property_count_u32(fwnode, "pwms"); - ret = fwnode_property_read_u32_array(fwnode, "pwms", args, ARRAY_SIZE(args)); + if (n_vals != 3 && n_vals != 4) + return -EOVERFLOW; + + ret = fwnode_property_read_u32_array(fwnode, "pwms", args, n_vals); if (ret) return ret; + /* + * If there are no item to define the duty_cycle, default it to the + * period. + */ + if (n_vals == 3) + args[3] = args[1]; + return _adt7475_pwm_properties_parse_args(args, cfg); } -- 2.49.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] hwmon: adt7475: Implement support for #pwm-cells = <3> 2025-06-19 19:37 ` [PATCH 1/2] " Uwe Kleine-König @ 2025-07-16 20:11 ` Guenter Roeck 0 siblings, 0 replies; 6+ messages in thread From: Guenter Roeck @ 2025-07-16 20:11 UTC (permalink / raw) To: Uwe Kleine-König Cc: Jean Delvare, Chris Packham, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree On Thu, Jun 19, 2025 at 09:37:45PM +0200, Uwe Kleine-König wrote: > The adt7475 driver and binding are outliers requiring 4 pwm-cells. The > typical value is 3, there are a few devices that use a lesser value for > historical reasons, no other uses a value bigger than 3. > > Implement support for 3 cells to make the adt7475 binding match the > usual PWM binding. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Applied. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend #pwm-cells = <3> 2025-06-19 19:37 [PATCH 0/2] hwmon: adt7475: Implement support for #pwm-cells = <3> Uwe Kleine-König 2025-06-19 19:37 ` [PATCH 1/2] " Uwe Kleine-König @ 2025-06-19 19:37 ` Uwe Kleine-König 2025-06-27 19:42 ` Rob Herring (Arm) 2025-07-16 20:12 ` Guenter Roeck 1 sibling, 2 replies; 6+ messages in thread From: Uwe Kleine-König @ 2025-06-19 19:37 UTC (permalink / raw) To: Jean Delvare, Guenter Roeck Cc: Chris Packham, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree To make this binding match what is usally used for PWMs, deprecate 4 cells and allow 3 instead. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> --- .../devicetree/bindings/hwmon/adt7475.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/hwmon/adt7475.yaml b/Documentation/devicetree/bindings/hwmon/adt7475.yaml index 79e8d62fa3b3..43e9fe225870 100644 --- a/Documentation/devicetree/bindings/hwmon/adt7475.yaml +++ b/Documentation/devicetree/bindings/hwmon/adt7475.yaml @@ -53,7 +53,10 @@ properties: default: 1 "#pwm-cells": - const: 4 + oneOf: + - const: 3 + - const: 4 + deprecated: true description: | Number of cells in a PWM specifier. - 0: The PWM channel @@ -68,7 +71,7 @@ properties: - 11363636 (88 Hz) - 44444 (22 kHz) - 2: PWM flags 0 or PWM_POLARITY_INVERTED - - 3: The default PWM duty cycle in nanoseconds + - 3: The default PWM duty cycle in nanoseconds, defaults to period. patternProperties: "^adi,bypass-attenuator-in[0-4]$": @@ -124,15 +127,15 @@ examples: adi,bypass-attenuator-in1 = <0>; adi,pin10-function = "smbalert#"; adi,pin14-function = "tach4"; - #pwm-cells = <4>; + #pwm-cells = <3>; - /* PWMs at 22.5 kHz frequency, 50% duty*/ + /* PWMs at 22.5 kHz frequency */ fan-0 { - pwms = <&pwm 0 44444 0 22222>; + pwms = <&pwm 0 44444 0>; }; fan-1 { - pwms = <&pwm 2 44444 0 22222>; + pwms = <&pwm 2 44444 0>; }; }; }; -- 2.49.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend #pwm-cells = <3> 2025-06-19 19:37 ` [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend " Uwe Kleine-König @ 2025-06-27 19:42 ` Rob Herring (Arm) 2025-07-16 20:12 ` Guenter Roeck 1 sibling, 0 replies; 6+ messages in thread From: Rob Herring (Arm) @ 2025-06-27 19:42 UTC (permalink / raw) To: Uwe Kleine-König Cc: Jean Delvare, Conor Dooley, Guenter Roeck, devicetree, Chris Packham, Krzysztof Kozlowski, linux-hwmon On Thu, 19 Jun 2025 21:37:46 +0200, Uwe Kleine-König wrote: > To make this binding match what is usally used for PWMs, deprecate 4 > cells and allow 3 instead. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> > --- > .../devicetree/bindings/hwmon/adt7475.yaml | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > Reviewed-by: Rob Herring (Arm) <robh@kernel.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend #pwm-cells = <3> 2025-06-19 19:37 ` [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend " Uwe Kleine-König 2025-06-27 19:42 ` Rob Herring (Arm) @ 2025-07-16 20:12 ` Guenter Roeck 1 sibling, 0 replies; 6+ messages in thread From: Guenter Roeck @ 2025-07-16 20:12 UTC (permalink / raw) To: Uwe Kleine-König Cc: Jean Delvare, Chris Packham, Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon, devicetree On Thu, Jun 19, 2025 at 09:37:46PM +0200, Uwe Kleine-König wrote: > To make this binding match what is usally used for PWMs, deprecate 4 > cells and allow 3 instead. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> > Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Applied. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-07-16 20:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-19 19:37 [PATCH 0/2] hwmon: adt7475: Implement support for #pwm-cells = <3> Uwe Kleine-König 2025-06-19 19:37 ` [PATCH 1/2] " Uwe Kleine-König 2025-07-16 20:11 ` Guenter Roeck 2025-06-19 19:37 ` [PATCH 2/2] dt-bindings: hwmon: adt7475: Allow and recommend " Uwe Kleine-König 2025-06-27 19:42 ` Rob Herring (Arm) 2025-07-16 20:12 ` Guenter Roeck
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).