Re: [PATCH] [RFC] hwmon: nct6775: Register fan PWMs as PWM chip
From: Uwe Kleine-König
Date: Tue Apr 14 2026 - 05:53:43 EST
Hello Richard,
On Thu, Feb 26, 2026 at 02:38:27PM -0800, Guenter Roeck wrote:
> On 2/25/26 04:51, Richard Weinberger wrote:
> > The Nuvoton 6775 chip family also offers PWM functionality to control
> > various fans. Depending on the hardware design, the PWM can also be
> > used for other purposes, such as controlling a display backlight.
> >
> > Historically, the driver implemented its own sysfs-based interface to
> > control the PWMs. This made it impossible to use the PWM as a backend
> > for other drivers, such as pwm-backlight.
> >
> > This patch registers the PWM functionality as a PWM chip within the
> > PWM subsystem. Since the Nuvoton chip has non-trivial control logic,
> > the following constraints exist:
> >
> > - Exporting a PWM for external use is only allowed when the fan mode
> > is set to manual or off.
> > - As soon as a PWM is exported, changing its configuration is no
> > longer possible through the hwmon sysfs interface, reading is
> > still allowed.
> > - Changing the PWM period is not supported. IMHO, it is too risky
> > since the PWMs usually control system fans and similar components.
> > - Reading and decoding the current PWM period is only supported for
> > one chip variant so far, for all other chips, a fixed period of
> > 100ms is assumed.
> >
>
> This is a good start, but I'll want to see stronger safeguards.
> - Creating a pwmchip entry for a pwm channel must be triggered by
> device property data, obtained either from devicetree or through
> DMI or through device properties embedded in ACPI data. For each
> channel, this must be confirmed by checking that the channel is
> not associated with a fan control channel.
I personally would be more lax here. root being able to change the
configuration at runtime is fine for me. IMHO this is in line with being
able to unload a driver or manually bind and unbind a driver or
dynamically creating an i2c device via sysfs.
> - If a pwm channel is configured as pwmchip, it must not be used for fan
> control, meaning the hwmon properties associated with that channel
> must not be created.
I fully agree here. At each point in time the hardware should either be
exposed as hwmon or as PWM channel. And if changing that during runtime
is possible, the old configuration must be completely gone before the
new one gets active.
This patch still was in the pwm patchwork as "action required". As is
both Guenter and me agree the patch isn't ready to be merged (though for
different reasons). I discarded the patch from my todo list and updated
the state to "changes requested" now.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature