From: Andrea della Porta <andrea.porta@suse.com>
To: Andrea della Porta <andrea.porta@suse.com>
Cc: "Guenter Roeck" <linux@roeck-us.net>,
"Gary Guo" <gary@garyguo.net>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Ray Jui" <rjui@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Gregor Herburger" <gregor.herburger@linutronix.de>,
"Stanimir Varbanov" <svarbanov@suse.de>,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-pwm@vger.kernel.org,
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>
Subject: Re: [PATCH RFC 0/4] hwmon: Add fan tachometer support for Raspberry Pi RP1
Date: Wed, 4 Nov 2026 14:42:29 +0100 [thread overview]
Message-ID: <aus2Ra_sLySMZU1i@apocalypse> (raw)
In-Reply-To: <auIotAwnOWKNApjp@apocalypse>
Hi,
On 17:54 Wed 28 Oct , Andrea della Porta wrote:
> On 09:13 Tue 27 Oct , Guenter Roeck wrote:
> > On Tue, Oct 27, 2026 at 10:51:15PM +0800, Gary Guo wrote:
> > > On Tue Oct 27, 2026 at 9:48 PM CST, Guenter Roeck wrote:
> > > > On Tue, Oct 27, 2026 at 10:49:48AM +0100, Andrea della Porta wrote:
> > > >> Hi Guenter,
> > > >>
> > > >> Yes, I also proposed that in the cover letter because auxbus seems also a viable
> > > >> solution.
> > > >>
> > > >> The current implementation is a consequence to the discussion about the companion
> > > >> PWM driver, from here (and the revisions that followed):
> > > >>
> > > >> https://lore.kernel.org/all/cover.1775223441.git.andrea.porta@suse.com/
> > > >>
> > > >> To give a short and hopefully coherent view of the decisions, here's a breakdown:
> > > >>
> > > >> - first proposal: PWM driver + fan hwmon (to read the RPM), all in the same driver
> > > >>
> > > >> - V2: Uwe preferred to split the PWM driver from the hwmon one, so the hwmon was
> > > >> dropped from teh PWM driver in favor of a future (fan) driver. To accomplish this,
> > > >> I moved from readl/writel to regmap + syscon.
> > > >>
> > > >> - V8: Gary proposed to export a function to read the fan RPM as a viable
> > > >> solution. As a result, the regmap/syscon was dropped as it was no longer needed
> > > >> and the function has been exported from the PWM driver
> > > >>
> > > >> - new patchset for fan driver: the now independent hwmon moodle just call the
> > > >> exported function from thw PWM driver.
> > > >>
> > > >> If the auxiliary bus is indeed the preferred approach, I'd like to ensure we are
> > > >> all aligned, as this would also require refactoring the PWM driver.
> > > >>
> > > >
> > > > Let's say it that way: If you don't want to implement the auxiliary driver,
> > > > and you insist using the exported function, I would prefer for you to go back
> > > > to the first solution. The one thing I really dislike is conceptually broken
> > > > code, and I consider the current approach broken. Your call, but the one thing
> > > > I won't accept is the code with the exported function.
> > >
> > > I agree on the auxiliary driver part. However, I don't think EXPORT_SYMBOL_NS is
> > > an issue, and regmap is not the right fit here:
> > >
> > > - Previous version of the PWM1 patch series publish regmap using
> > > of_syscon_register_regmap, but this cannot be undone -- which needs to happen
> > > on PWM device unbind (the RP1 PWM device is itself platform device, but RP1
> > > chip itself is PCIe device which must be removable).
> > >
> > > - The tachometer register is not its own separate register, but rather (re)using
> > > the phase control register. The phase control is not implemented in the RP1
> > > PWM driver on the list yet, so this is currently a simple register read -- I
> > > can see that RP1 PWM driver need to take special care to about the tachometer
> > > reading if the phase control is implemented.
> > >
> > > For the two reasons above, I think the way that tachometer is read should
> > > really be an implementation detail of the PWM driver and not for the hwmon
> > > driver to worry about, so I suggested using EXPORT_SYMBOL_NS.
> > >
> > > - EXPORT_SYMBOL_NS is the documented way for exposing functionality from parent
> > > device to auxiliary drivers: https://docs.kernel.org/driver-api/auxiliary_bus.html
> > >
> >
> > Let's agree to disagree, and keep the code in the pwm subsystem.
>
> And auxiliary bus it will be. I propose the following:
>
> - drivers/pwm/pwm-rp1.c: create an auxiliary device for the fan. The function to read
> the RPM will not be exported, but a function pointer will be passed through the
> private data to the fan driver. No need for regmap. To be taken by Uwe.
>
> - drivers/hwmon/rp1-hwmon.c: The auxiliary driver is probed against the device registered
> by the pwm driver. No imported function. To be taken by Guenter.
>
> In this way, we decouple the two drivers and we leverage the auxiliary bus paradigm.
> Also, no DT node needed for the fan.
>
> Do we all agree on this approach?
A gentle reminder about this inquiry. Before refactoring both the PWM and the fan
driver I'd like to be sure that the proposed approach is at least acceptable.
Many thanks,
Andrea
>
> Thanks,
> Andrea
>
> >
> > Thanks,
> > Guenter
next prev parent reply other threads:[~2026-11-04 13:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 10:15 [PATCH RFC 0/4] hwmon: Add fan tachometer support for Raspberry Pi RP1 Andrea della Porta
2026-10-23 10:15 ` [PATCH RFC 1/4] pwm: rp1: Export helper to read fan tachometer RPM Andrea della Porta
2026-10-23 10:15 ` [PATCH RFC 2/4] dt-bindings: hwmon: Add Raspberry Pi RP1 fan binding Andrea della Porta
2026-10-23 10:15 ` [PATCH RFC 3/4] hwmon: Add driver for Raspberry Pi RP1 fan tachometer Andrea della Porta
2026-10-27 16:32 ` Uwe Kleine-König
2026-10-27 17:36 ` Andrea della Porta
2026-10-28 7:02 ` Uwe Kleine-König
2026-10-28 16:13 ` Andrea della Porta
2026-10-23 10:15 ` [PATCH RFC 4/4] arm64: dts: broadcom: bcm2712-rpi-5-b: Add RP1 fan tachometer node Andrea della Porta
2026-10-26 16:24 ` [PATCH RFC 0/4] hwmon: Add fan tachometer support for Raspberry Pi RP1 Guenter Roeck
2026-10-27 9:49 ` Andrea della Porta
2026-10-27 13:48 ` Guenter Roeck
2026-10-27 14:51 ` Gary Guo
2026-10-27 16:13 ` Guenter Roeck
2026-10-28 16:54 ` Andrea della Porta
2026-11-04 13:42 ` Andrea della Porta [this message]
2026-11-04 22:56 ` Guenter Roeck
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=aus2Ra_sLySMZU1i@apocalypse \
--to=andrea.porta@suse.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=gary@garyguo.net \
--cc=gregor.herburger@linutronix.de \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=rdunlap@infradead.org \
--cc=rjui@broadcom.com \
--cc=robh@kernel.org \
--cc=sbranden@broadcom.com \
--cc=skhan@linuxfoundation.org \
--cc=svarbanov@suse.de \
--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