[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260131184206.5859cb03@jic23-huawei>
Date: Sat, 31 Jan 2026 18:42:06 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Andreas Kemnade <andreas@...nade.info>
Cc: Guenter Roeck <linux@...ck-us.net>, Mark Brown <broonie@...nel.org>,
jdelvare@...e.com, lgirdwood@...il.com, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org, Alistair Francis <alistair@...stair23.me>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>
Subject: Re: In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon:
(sy7636a) fix races during probe of mfd subdevices)
On Thu, 22 Jan 2026 15:23:06 +0100
Andreas Kemnade <andreas@...nade.info> wrote:
> On Wed, 24 Sep 2025 12:16:14 -0700
> Guenter Roeck <linux@...ck-us.net> wrote:
>
> > > But what is the hwmon equivalent for
> > > devm_fwnode_iio_channel_get_by_name() + iio_read_channel_processed()?
> > >
> >
> > Assuming you refer to the exported functions for in-kernel use, so far no one has
> > expressed a need for it. The best solution would probably be a hwmon->iio bridge,
> > or equivalent functions could be implemented and exported.
>
> So first analyzing the need of such an interface. I think
> there is a need for such interface. The need just gets masked by some hacks
> to be able to divert to other interfaces.
>
> There is out-of-tree waiting to be upstreamed:
> - rockchip_ebc driver: Display on PineNote, uses iio_read_chanel_processed()
> in combination with an out-of-tree iio temperature
> driver
> - mxc_epdc_drm driver: Display on Kobo/Tolino ebook readers, uses
> thermal_zone_get_temp() now.
>
> In tree, there is:
> - drivers/gpu/drm/tiny/repaper.c
> in combination with
> Documentation/devicetree/bindings/display/repaper.txt
>
> Code excerpt:
> if (!device_property_read_string(dev, "pervasive,thermal-zone",
> &thermal_zone)) {
> epd->thermal = thermal_zone_get_zone_by_name(thermal_zone);
>
> and thermal_zone_get_temp() to tune refreshes according to panel temperature.
>
>
>
> The example in the binding is:
> display_temp: lm75@48 {
> compatible = "lm75b";
> reg = <0x48>;
> #thermal-sensor-cells = <0>;
> };
>
> thermal-zones {
> display {
> polling-delay-passive = <0>;
> polling-delay = <0>;
> thermal-sensors = <&display_temp>;
> };
> };
>
> [...]
> pervasive,thermal-zone = "display";
>
>
> I would prefer to be able to use e.g. pervasive,temperature-sensor = <&display_temp>;
> or maybe <&display_temp 0> if there are multiple sensors in the same chip.
> so that dtc will tell me when there is a typo and avoid the thermal
> zone layer
>
> So what are the options:
> a) provide similar logic like iio/inkern.c for hwmon usage.
> b) automatically add iio channels during hwmon registration.
>
> looking at the iio_hwmon bridge we already have, it depends on
> iio/inkern.c so for a hwmon_iio bridge we need a) or b) anyways,
> so I think a separate bridge device/driver has no advantages.
> And having a devicetree node for the bridge would be bad because
> we are then describing linux implementation details instead of
> the actual hardware in the devicetree.
That's always been a little controversial for the iio-hwmon
but I had quite a few discussions of the years of how to describe
this and no one ever came up with anything that worked other than
maybe pushing it to configfs and making it a usespace script problem.
Jonathan
>
> Regards,
> Andreas
>
Powered by blists - more mailing lists