mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Changhuang Liang <changhuang.liang@starfivetech.com>
Cc: Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach
Date: Tue, 22 Sep 2026 18:54:09 +0100	[thread overview]
Message-ID: <20260922-buffalo-urology-0395e437ae61@spud> (raw)
In-Reply-To: <ZQ4PR01MB1202328B1B28955A0C6DF44DF2B22@ZQ4PR01MB1202.CHNPR01.prod.partner.outlook.cn>

[-- Attachment #1: Type: text/plain, Size: 4550 bytes --]

On Mon, Sep 07, 2026 at 02:51:44AM +0000, Changhuang Liang wrote:
> Hi, Guenter, Conor
> 
> Thanks for the review.
> 
> > On 9/1/26 03:14, Conor Dooley wrote:
> > > On Tue, Sep 01, 2026 at 01:24:39AM +0000, Changhuang Liang wrote:
> > >>> On Sat, Aug 29, 2026 at 06:19:40PM -0700, Changhuang Liang wrote:
> > >>>> +patternProperties:
> > >>>> +  "^fan@[0-9a-f]+$":
> > >>>> +    $ref: fan-common.yaml#
> > >>>> +    unevaluatedProperties: false
> > >>>> +
> > >>>> +    properties:
> > >>>> +      reg:
> > >>>> +        description:
> > >>>> +          PWM channel index. The driver allows two fans to share
> > >>>> + the
> > >>> same
> > >>>> +          PWM channel, or each fan to use a dedicated channel.
> > >>>
> > >>> Doesn't matter what the driver can do, the description should
> > >>> describe what the hardware supports.
> > >>> pw-bot: changes-requested
> > >>> Does this fan-tach controller provide the PWMs?
> > >>> If so (although Guenter may correct me), I think the fan-tach
> > >>> controller needs to be.
> > >>>
> > >>> If you don't do that, I think you're going to run into problems with
> > >>> having multiple nodes with the same unit address when two fans share a
> > pwm?
> > >>>
> > >>> I think what you're supposed to do is drop "reg" and replace it with
> > >>> "pwms", but once again Guenter may correct me there.
> > >>> e.g. aspeed,g6-pwm-tach.yaml
> > >>>
> > >>
> > >> Perhaps I can refer to aspeed,g6-pwm-tach.yaml and change
> > >> "^fan@[0-9a-f]+$" to "^fan-[0-9]+$", which would remove the reg
> > >> property. In fact, the driver does not use reg either.
> > >>
> > >> Our fan-tach controller does not include PWM. The JHB100 SoC will
> > >> have a separate PWM controller. (This controller uses the same IP as
> > >> the JH7110 SoC, but there are some differences in driver
> > >> implementation.)
> > >>
> > >> The JHB100 has 8 PWM channels and 16 fan tach channels.
> > >>
> > >> So currently we expect the Device Tree to be configured like this:
> > >>
> > >> 	pwm0: pwm {
> > >> 		compatible = "starfive,jhb100-pwm";
> > >> 	};
> > >>
> > >
> > >>
> > >> 	fan0: pwm-fan0 {
> > >> 		compatible = "pwm-fan";
> > >> 		pwms = <&pwm0 0 40000 0>;
> > >> 	};
> > >
> > >>
> > >> fan-controller {
> > >> 	compatible = "starfive,jhb100-fan-tach";
> > >>
> > >> 	fan@0 {
> > >> 		tach-ch = <0x0>, <0x8>;
> > >> 	};
> > >
> > > Truncating this for readability, but it looks wrong to me. How does
> > > the feedback loop work here when there's no way to determine which fan
> > > is connected to a tach channel? The unit address of the child nodes
> > > has no dt enforced guarantee to line up with node names of the fans or
> > > pwm indices.
> > 
> > Normally (for other fan controllers) the fan would have a target speed.
> > The controller measures the speed and adjusts pwm output values until the
> > fan speed matches the expected value. The controller needs to know the
> > association between tachometer input and pwm output for this to work.
> > Typically (for classic fan controllers) that association is static.
> > In the Aspeed G6 fan controller it is dynamic/configurable.
> > 
> > I thought this is the case here as well, but I have no idea if that is correct (or if
> > there is a chip-internal feedback loop to start with).
> 
> Here is some information I found about fan tach and PWM control. It looks like these 
> two devices are managed through an application.
> 
> Do you have any new suggestions for modifications?

I, at least, have no new suggestions. I thought the most recent reply
from Guenter was pretty clear? If you've got a dedicated fan controller
with static association then you don't need to provide the association,
but if there's dynamic/configurable pwm-tach then you need to provide
the association so that the fan controller can work correctly?
To me, that read as if the pwms property would be required here, because
what's proposed above represents the same fan twice, as pwm-fan0 and
fan0 without an association between the two because you have an
different IP entirely providing the pwm.

For this to work, don't you actually need to do:
pwm0: pwm {
	compatible = "starfive,jhb100-pwm";
};

fan-controller {
	compatible = "starfive,jhb100-fan-tach";
	
	fan@0 {
		pwms = <&pwm0 0 40000 0>;
		tach-ch = <0x0>, <0x8>;
	};
};

Cheers,
Conor.

> 
> https://github.com/openbmc/phosphor-pid-control/blob/master/README.md
> 
> Best Regards,
> Changhuang
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-09-22 17:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30  1:19 [PATCH v4 0/2] Add JHB100 Fan-Tach support Changhuang Liang
2026-08-30  1:19 ` [PATCH v4 1/2] dt-bindings: hwmon: Add starfive,jhb100-fan-tach Changhuang Liang
2026-08-31 16:32   ` Conor Dooley
2026-08-31 17:54     ` Guenter Roeck
2026-09-01 10:17       ` Conor Dooley
2026-09-01  1:24     ` Changhuang Liang
2026-09-01 10:14       ` Conor Dooley
2026-09-01 15:52         ` Guenter Roeck
2026-09-07  2:51           ` Changhuang Liang
2026-09-22 17:54             ` Conor Dooley [this message]
2026-09-23  0:27               ` Changhuang Liang
2026-08-30  1:19 ` [PATCH v4 2/2] hwmon: (starfive-fan-tach) Add fan tach driver for StarFive JHB100 Changhuang Liang

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=20260922-buffalo-urology-0395e437ae61@spud \
    --to=conor@kernel.org \
    --cc=changhuang.liang@starfivetech.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh@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®