Hello Guenter,

On Wed, Feb 11, 2026 at 10:28:55AM +0100, Richard Weinberger wrote:
> The backlight of a board I am working with is controlled via PWM.
> Naturally, I thought this would be a straightforward task using the
> pwm-backlight driver.
> 
> However, the PWM in question is implemented using an NCT6106D chip.
> The associated HWMON driver, nct6775-core.c, does not implement a
> standard PWM device interface but rather its own custom one.

Looking around in drivers/hwmon made me a sad. There are four drivers
that handle parsing #pwm-cells:

        $ git grep pwm-cell drivers/hwmon/
        drivers/hwmon/adt7475.c:        ret = 
fwnode_property_get_reference_args(fwnode, "pwms", "#pwm-cells", 0, 0, &rargs);
        drivers/hwmon/amc6821.c:        if (of_parse_phandle_with_args(fan_np, 
"pwms", "#pwm-cells", 0, &args))
        drivers/hwmon/emc2305.c:        ret = of_parse_phandle_with_args(child, 
"pwms", "#pwm-cells", 0, &args);
        drivers/hwmon/nct7363.c:        ret = of_parse_phandle_with_args(child, 
"pwms", "#pwm-cells",

instead of using the pwm subsystem. Also the driver mentioned by Richard
above has some self-made PWM handling including a set of driver specific
sysfs files to control the PWMs. I stopped looking at the output of

        git grep pwm drivers/hwmon/

after finding some more sad things. (My "favourite" so far was:

        dev_dbg(dev, "chmod -w pwm%d failed\n", nr + 1);
 
.)

> I am a bit puzzled, is there a specific reason why HWMON does not
> utilize the standard PWM framework in this case?

Yes please!

I think that the PWM waveform API that exists since v6.13-rc1 is
flexible enough that hwmon chips should be able to both implement and
use it properly.

Can you please make sure that the next hardware driver for a pwm capable
chip uses a proper PWM chip? Feel free to send patch authors in my
direction for that.

And if I'm wrong and using the pwm subsystem in these cases is a burden,
I want to hear about that and discuss how this can be made better.

Thanks
Uwe

Attachment: signature.asc
Description: PGP signature

Reply via email to