From: Andrea della Porta <andrea.porta@suse.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "Andrea della Porta" <andrea.porta@suse.com>,
"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, "Gary Guo" <gary@garyguo.net>,
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>
Subject: Re: [PATCH RFC 0/4] hwmon: Add fan tachometer support for Raspberry Pi RP1
Date: Tue, 27 Oct 2026 10:49:48 +0100 [thread overview]
Message-ID: <auBzvB8TsvIK8Hik@apocalypse> (raw)
In-Reply-To: <7df58d42-517c-4936-88b0-9d044d30882c@roeck-us.net>
Hi Guenter,
On 09:24 Mon 26 Oct , Guenter Roeck wrote:
> On 10/23/26 03:15, Andrea della Porta wrote:
> > Hi,
> >
> > This patch series adds fan tachometer / RPM monitoring support for the
> > Raspberry Pi RP1 southbridge found on the Raspberry Pi 5.
> > Please note that the patchset in [1] is a prerequisite for this one.
> >
> > On the Raspberry Pi RP1, the active cooling fan speed is controlled via
> > the RP1 PWM controller. In addition to generating PWM signals, the RP1
> > monitors fan tachometer pulses. The pulse measurement and RPM calculation
> > are performed autonomously by the RP1's onboard Cortex-M microcontroller
> > core, which periodically writes the computed RPM value directly into
> > dedicated MMIO registers located within the RP1 PWM hardware block.
> >
> > During earlier discussions, Uwe Kleine-König explicitly indicated a
> > preference to keep the core PWM controller driver (drivers/pwm/pwm-rp1.c)
> > focused strictly on PWM duties, rather than bloating it by registering an
> > hwmon device directly from within the PWM driver (see [2]).
> >
> > Because the Linux PWM subsystem currently lacks a generic framework or
> > consumer API for reporting hardware-calculated tachometer readings, this
> > series implements a standalone hwmon driver (rp1-fan) using the following
> > structure:
> >
> > - The PWM driver exposes and exports rp1_pwm_read_tachometer() within a
> > dedicated symbol namespace ('RP1_PWM') to read the RPM value from
> > the MMIO block.
> > - A companion DT binding (raspberrypi,rp1-fan.yaml) introduces a vendor
> > property, 'raspberrypi,pwm-tachometer', to link the fan node to the
> > PWM controller node without overloading or abusing the standard 'pwms'
> > property.
> > - The rp1-fan hwmon driver parses this phandle, establishes a device link
> > for proper runtime and unbind dependency management, and registers the
> > standard hwmon 'fan1_input' sysfs attribute.
> >
> > An alternative architectural approach to the DT phandle + exported helper
> > method would be to model the tachometer as a child device using the
> > auxiliary bus framework (drivers/base/auxiliary.c). In that model, the RP1
> > PWM driver would instantiate an auxiliary device for the tachometer, and
> > the hwmon driver would bind to that auxiliary bus device without requiring
> > a separate DT node.
> >
> > However, adopting the auxiliary bus would require a more significant
> > rework and refactoring of the existing RP1 PWM driver.
> >
> > I'd appreciate any feedback on whether the current companion driver with
> > a dedicated DT property is acceptable, or if an auxiliary bus-based
> > refactoring of the PWM driver is the preferred upstream path.
> >
> > Patch Breakdown
> > ---------------
> > Patch 1: pwm: rp1: Export helper to read fan tachometer RPM
> > Patch 2: dt-bindings: hwmon: Add Raspberry Pi RP1 fan binding
> > Patch 3: hwmon: Add driver for Raspberry Pi RP1 fan tachometer
>
> This seems conceptually wrong.
>
> Have you considered implementing the hwmon driver as auxiliary driver
> and accessing the register in question through regmap ?
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.
>
> > Patch 4: arm64: dts: broadcom: bcm2712-rpi-5-b: Add RP1 fan tachometer node
> >
> > Thanks,
> > Andrea
> >
> >
> > LINKS:
> > [1] - https://lore.kernel.org/all/cover.1790686331.git.andrea.porta@suse.com/
> > [2] - https://lore.kernel.org/all/adLTwOTbkJ0VQXy6@monoceros/
> >
> > Andrea della Porta (4):
> > pwm: rp1: Export helper to read fan tachometer RPM
> > dt-bindings: hwmon: Add Raspberry Pi RP1 fan binding
> > hwmon: Add driver for Raspberry Pi RP1 fan tachometer
> > arm64: dts: broadcom: bcm2712-rpi-5-b: Add RP1 fan tachometer node
> >
> > .../bindings/hwmon/raspberrypi,rp1-fan.yaml | 39 +++++
> > Documentation/hwmon/index.rst | 1 +
> > Documentation/hwmon/rp1-fan.rst | 41 ++++++
> > MAINTAINERS | 1 +
> > .../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 5 +
> > drivers/hwmon/Kconfig | 11 ++
> > drivers/hwmon/Makefile | 1 +
> > drivers/hwmon/rp1-hwmon.c | 136 ++++++++++++++++++
> > drivers/pwm/pwm-rp1.c | 27 ++++
>
> Either case, there is no such driver in mainline or linux-next.
As stated in the cover letter, the pwm driver comes from the prerequisite in [1].
Many thanks,
Andrea
>
> Guenter
>
> > include/soc/bcm2835/raspberrypi-pwm-rp1.h | 10 ++
> > 10 files changed, 272 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/hwmon/raspberrypi,rp1-fan.yaml
> > create mode 100644 Documentation/hwmon/rp1-fan.rst
> > create mode 100644 drivers/hwmon/rp1-hwmon.c
> > create mode 100644 include/soc/bcm2835/raspberrypi-pwm-rp1.h
> >
>
next prev parent reply other threads:[~2026-10-27 9:45 UTC|newest]
Thread overview: 15+ 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 [this message]
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
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=auBzvB8TsvIK8Hik@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