Re: [PATCH v2] hwmon: add a driver for the temp/voltage sensor on PolarFire SoC

From: Guenter Roeck

Date: Tue Jun 09 2026 - 09:01:59 EST


On 6/9/26 02:43, Conor Dooley wrote:
On Mon, Jun 08, 2026 at 10:03:48AM -0700, Guenter Roeck wrote:
On 6/3/26 06:19, Conor Dooley wrote:
From: Lars Randers <lranders@xxxxxxx>

Add a driver for the temperature and voltage sensors on PolarFire SoC.
The temperature reports how hot the die is, and the voltages are the
SoC's 1.05, 1.8 and 2.5 volt rails respectively.

The hardware supports alarms in theory, but there is an erratum that
prevents clearing them once triggered, so no support is added for them.

The hardware measures voltage with 16 bits, of which 1 is a sign bit and
the remainder holds the voltage as a fixed point integer value. It's
improbable that the hardware will work if the voltages are negative, so
the driver ignores the sign bits.

There's no dt support etc here because this is the child of a simple-mfd
syscon.

Signed-off-by: Lars Randers <lranders@xxxxxxx>
Co-developed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
Signed-off-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>

Comments inline.

Cheers.

...

If regmap never returns errors this needs to be documented in the driver.

It's an mmio regmap via a syscon, it evaluates to readl()/writel() so
there's nothing that can fail /and/ return an error.
I mean, I can add if (ret) return ret, there's not a clean place to put
a comment about it I don't think.


No, there is no need to add dummy error checks. Just add a comment
either at the top of the driver or maybe even better where the regmap
is initialized and explain the above.

Guenter