From: Richard Weinberger <richard@nod.at>
To: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
linux-pwm@vger.kernel.org,
linux-hwmon <linux-hwmon@vger.kernel.org>,
Guenter Roeck <linux@roeck-us.net>,
julian friedrich <julian.friedrich@frequentis.com>
Subject: Re: [PATCH] [RFC] hwmon: nct6775: Register fan PWMs as PWM chip
Date: Thu, 26 Feb 2026 19:36:44 +0100 (CET) [thread overview]
Message-ID: <1212284023.1388.1772131004601.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <aaCHc4q0I8Az7hpx@monoceros>
Hello Uwe,
----- Ursprüngliche Mail -----
> Von: "Uwe Kleine-König" <ukleinek@kernel.org>
>> + struct nct6775_data *data = pwmchip_get_drvdata(chip);
>> + const u8 *wfhw = _wfhw;
>> +
>> + if (get_pwm_period(data, pwm->hwpwm, &wf->period_length_ns))
>> + return 1;
>
> That looks wrong. In principle nct6775_pwm_round_waveform_fromhw()
> doesn't depend on hardware state. It's supposed to just convert the
> settings stored in _wfhw to wf. If you know that some things are
> constant during the lifetime of the PWM and you read those from
> hardware, return a proper error code, not 1.
I see. Since the frequency is never changed by the driver we could
read it while probing and use here the cached value.
> Rounding down wf->period_length_ns is fine, so this must be:
>
> if (wf->period_length_ns < cur_period)
> return 1;
But then the period is no longer fixed and something larger than supported
can get configured. Smaller values get caught, though.
e.g.
root@fedora:/sys/class/pwm/pwmchip0/pwm2# cat period
43243
root@fedora:/sys/class/pwm/pwmchip0/pwm2# echo 43200 > period
bash: echo: write error: Invalid argument
root@fedora:/sys/class/pwm/pwmchip0/pwm2# echo 50000 > period
root@fedora:/sys/class/pwm/pwmchip0/pwm2# echo $?
0
Thanks,
//richard
next prev parent reply other threads:[~2026-02-26 18:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 12:51 [PATCH] [RFC] hwmon: nct6775: Register fan PWMs as PWM chip Richard Weinberger
2026-02-26 17:54 ` Uwe Kleine-König
2026-02-26 18:36 ` Richard Weinberger [this message]
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
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=1212284023.1388.1772131004601.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=julian.friedrich@frequentis.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@roeck-us.net \
--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