mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: Richard Weinberger <richard@nod.at>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-pwm <linux-pwm@vger.kernel.org>,
	linux-hwmon <linux-hwmon@vger.kernel.org>,
	julian friedrich <julian.friedrich@frequentis.com>
Subject: Re: [PATCH] [RFC] hwmon: nct6775: Register fan PWMs as PWM chip
Date: Fri, 27 Feb 2026 12:59:43 -0800	[thread overview]
Message-ID: <749fa661-efc3-4096-8f46-94558dfd80bf@roeck-us.net> (raw)
In-Reply-To: <aaH3ZgfMiYuRhvp4@monoceros>

On 2/27/26 12:02, Uwe Kleine-König wrote:
> Hello,
> 
> On Fri, Feb 27, 2026 at 12:17:00AM -0800, Guenter Roeck wrote:
>> Hi Richard,
>>
>> On 2/26/26 23:46, Richard Weinberger wrote:
>>> Hello Guenter,
>>>
>>> ----- Ursprüngliche Mail -----
>>>> Von: "Guenter Roeck" <linux@roeck-us.net>
>>>>>     - 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.
>>>
>>> In my case it's a x86 based industrial PC with direct access.
>>> What safeguard do you suggest in this case? A module parameter?
>>>
>>
>> Presumably it has DMI information or some other means to identify the system.
>> That information can be used to set device properties, which would then be used
>> in the probe function to determine if a channel is modeled as pwm channel.
>> See device_add_software_node() and friends to get an idea how that works.
>>
>> How exactly those properties would look like needs to be documented in
>> nuvoton,nct6775.yaml. I'd assume that the pwm channels would be described
>> in there just like for any other pwm chips.
>>
>>> Also for ACPI data, what exactly do you have in mind?
>>>
>> ACPI can be used to provide devicetree properties. The information is embedded
>> in the DSDT table. Conceptually that is identical to devicetree data. That is
>> not something you need to be concerned about unless you are responsible for that
>> system and in control of the firmware. Technically the company selling that
>> industrial PC should provide the information in the DSDT table, but of course
>> that needs to be standardized first (and then they would have to actually use it).
> 
> That would imply that derRichard has to update the BIOS, or at least
> fake some ACPI tables, right?
> 
No, I didn't say that. The board manufacturer could do that, but checking
the DMI data in the init function and using software nodes to pass properties
to the driver would do the trick.

> For me it would be good enough if the first consumer of a channel "wins"
> and others get a -EBUSY. Compared to describing that in dt or acpi this
> has the advantage that the use can be changed without a reboot.
> 

No, this is not acceptable. In almost all cases the pwm output will be
connected to a fan, it will be configured by the BIOS, and it may (and
likely will) be configured for DC output instead of pwm output. Changing
that randomly with "first consumer wins" is simply not acceptable.
This will have to be static and well defined.

Guenter


  reply	other threads:[~2026-02-27 20:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 12:51 Richard Weinberger
2026-02-26 17:54 ` Uwe Kleine-König
2026-02-26 18:36   ` Richard Weinberger
2026-02-27 19:57     ` Uwe Kleine-König
2026-02-26 22:38 ` Guenter Roeck
2026-02-27  7:46   ` Richard Weinberger
2026-02-27  8:17     ` Guenter Roeck
2026-02-27 20:02       ` Uwe Kleine-König
2026-02-27 20:59         ` Guenter Roeck [this message]
2026-04-14  9:48   ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=749fa661-efc3-4096-8f46-94558dfd80bf@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=julian.friedrich@frequentis.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=richard@nod.at \
    --cc=ukleinek@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®