* Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices [not found] ` <20250924195358.16bbd90c@kemnade.info> @ 2025-09-24 19:16 ` Guenter Roeck 2025-09-27 18:39 ` Jonathan Cameron 2026-01-22 14:23 ` In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) Andreas Kemnade 0 siblings, 2 replies; 6+ messages in thread From: Guenter Roeck @ 2025-09-24 19:16 UTC (permalink / raw) To: Andreas Kemnade Cc: Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org, Jonathan Cameron On 9/24/25 10:53, Andreas Kemnade wrote: > On Wed, 24 Sep 2025 00:17:48 -0700 > Guenter Roeck <linux@roeck-us.net> wrote: > >> On 9/24/25 00:00, Andreas Kemnade wrote: >>> On Sat, 20 Sep 2025 23:18:59 +0100 >>> Mark Brown <broonie@kernel.org> wrote: >>> >>>> On Sat, Sep 20, 2025 at 11:33:07PM +0200, Andreas Kemnade wrote: >>>> >>>>> Just for learning, yes, it is an abuse of the _optional for non-optional >>>>> things, so a dirty hack which should not go in, therefore RFC. But what >>>>> happens more than having the hwmon device endlessly deferred at worst? >>>> >>>> There's also the fact that this API is so frequently abused for bad and >>>> broken reasons that I regularly audit users and try to fix them, I'd >>>> rather not see any new users that don't have a really strong reason to >>>> use it. >>>> >>>>> The wanted regulator is the one defined in sy7636a-regulator.c. So it >>>>> is all an issue internal to the sy7636a. >>>> >>>>> Both subdevices are instantiated via drivers/simple-mfd-i2c.c. >>>>> I see several other solutions: >>>>> a) call device_is_bound() on every other children of dev->parent, if not >>>>> bound defer. >>>>> b) do not care about the regulator api at all, just check whether >>>>> the corresponding bit is set before reading temperature, return >>>>> -ENODATA if not, some mutex is probably needed. >>>>> c) do not care about the regulator api at all, just set the >>>>> corresponding bit (together with some mutex locking and counting). >>>> >>>> I assume this is using the regulator API because someone might use an >>>> external regulator in a system design for some reason (better quality, >>>> power efficiency or a shared reference between multiple devices I >>>> guess?), or because the supply might also be used by external devices? >>>> >>>>> d) copy the of_node pointer from the parent, add a regulator phandle property >>>>> to the node pointing to the regulator in the node itself. >>>>> That sounds like your idea but is against the current dt binding for >>>>> this device and afaik it is uncommon to have mfd-internal things wired >>>>> up this way >>>>> >>>>> e) something clean, simple I miss >>>> >>>> The idea is that the relationship between the devices should be >>>> registered before the devices, that's how the regulator knows to defer. >>>> We used to have an API for doing this for board files which might fit >>>> here, but it got removed since nobody wants board files any more. If >>>> you're allocating the devices dynamically that's annoying to implement >>>> though... >>> >>> looking a bit around: >>> max5970-regulator.c has hwmon integrated and no extra device. That would >>> simplify things. Although it does not report temperature. Some >>> touchscreens have temperature via hwmon, some others have temperature >>> via iio, directly in one device without mfd. Maybe that is also >>> the better way here? >>> >> >> Touchscreens reporting temperature via iio is in general the wrong thing to do. >> Touchscreens report the temperature for monitoring reasons, after all. >> But then, sure, if you insist. I am getting tired of arguing. >> > I apparently did not make clear what my question refers to. It was more about separate > hwmon device + mfd vs. integrating everything into the regulator driver. > What I keep failing to understand is why people keep avoiding the potential of implementing auxiliary device drivers, since that would be the perfect solution and match the intended use case for auxiliary devices. > But since you brought up the topic hwmon vs. iio for temperature. I do not have > a strong opinion here as long as I can somehow live with it. Nothing I want to > fight for. One sensor I use for measuring room temperature is hwmon, another > one is iio. So it is all not that consistent. > That doesn't mean what exists is consistent or even makes sense. Some driver support for chips intended for reporting the environment or chip temperature are pushed into iio. I have no idea why that is the case. Yes, that results in odd situations like yours, but there is nothing I can do about it. I can only guess that _someone_ is pushing for submitting drivers into IIO instead of hwmon, but that is just a wild guess. You would have to ask the driver authors and/or IIO maintainers for reasons. I am copying the IIO mailing list for feedback. Also, again, I am tired of arguing, so I typically don't even comment anymore (if I even notice) unless explicitly asked. > 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. > I wonder whether I really need a thermal zone. It adds stuff not needed here, > trip points and polling. > The driver _registers_ a thermal zone, but that doesn't mean it has to be configured. If one is configured (typically via devicetree), it is obviously needed. > Documentation/hwmon/sy7636a-hwmon.rst seems to be wrong. It is not > SoC-on-die temperature, but temperature from an external NTC. And > that is typically used to tune the EPD refresh to the temperature. Please feel free to submit a patch correcting the documentation. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices 2025-09-24 19:16 ` [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices Guenter Roeck @ 2025-09-27 18:39 ` Jonathan Cameron 2025-10-27 20:12 ` Andreas Kemnade 2026-01-22 14:23 ` In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) Andreas Kemnade 1 sibling, 1 reply; 6+ messages in thread From: Jonathan Cameron @ 2025-09-27 18:39 UTC (permalink / raw) To: Guenter Roeck Cc: Andreas Kemnade, Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org On Wed, 24 Sep 2025 12:16:14 -0700 Guenter Roeck <linux@roeck-us.net> wrote: > On 9/24/25 10:53, Andreas Kemnade wrote: > > On Wed, 24 Sep 2025 00:17:48 -0700 > > Guenter Roeck <linux@roeck-us.net> wrote: > > > >> On 9/24/25 00:00, Andreas Kemnade wrote: > >>> On Sat, 20 Sep 2025 23:18:59 +0100 > >>> Mark Brown <broonie@kernel.org> wrote: > >>> > >>>> On Sat, Sep 20, 2025 at 11:33:07PM +0200, Andreas Kemnade wrote: > >>>> > >>>>> Just for learning, yes, it is an abuse of the _optional for non-optional > >>>>> things, so a dirty hack which should not go in, therefore RFC. But what > >>>>> happens more than having the hwmon device endlessly deferred at worst? > >>>> > >>>> There's also the fact that this API is so frequently abused for bad and > >>>> broken reasons that I regularly audit users and try to fix them, I'd > >>>> rather not see any new users that don't have a really strong reason to > >>>> use it. > >>>> > >>>>> The wanted regulator is the one defined in sy7636a-regulator.c. So it > >>>>> is all an issue internal to the sy7636a. > >>>> > >>>>> Both subdevices are instantiated via drivers/simple-mfd-i2c.c. > >>>>> I see several other solutions: > >>>>> a) call device_is_bound() on every other children of dev->parent, if not > >>>>> bound defer. > >>>>> b) do not care about the regulator api at all, just check whether > >>>>> the corresponding bit is set before reading temperature, return > >>>>> -ENODATA if not, some mutex is probably needed. > >>>>> c) do not care about the regulator api at all, just set the > >>>>> corresponding bit (together with some mutex locking and counting). > >>>> > >>>> I assume this is using the regulator API because someone might use an > >>>> external regulator in a system design for some reason (better quality, > >>>> power efficiency or a shared reference between multiple devices I > >>>> guess?), or because the supply might also be used by external devices? > >>>> > >>>>> d) copy the of_node pointer from the parent, add a regulator phandle property > >>>>> to the node pointing to the regulator in the node itself. > >>>>> That sounds like your idea but is against the current dt binding for > >>>>> this device and afaik it is uncommon to have mfd-internal things wired > >>>>> up this way > >>>>> > >>>>> e) something clean, simple I miss > >>>> > >>>> The idea is that the relationship between the devices should be > >>>> registered before the devices, that's how the regulator knows to defer. > >>>> We used to have an API for doing this for board files which might fit > >>>> here, but it got removed since nobody wants board files any more. If > >>>> you're allocating the devices dynamically that's annoying to implement > >>>> though... > >>> > >>> looking a bit around: > >>> max5970-regulator.c has hwmon integrated and no extra device. That would > >>> simplify things. Although it does not report temperature. Some > >>> touchscreens have temperature via hwmon, some others have temperature > >>> via iio, directly in one device without mfd. Maybe that is also > >>> the better way here? > >>> > >> > >> Touchscreens reporting temperature via iio is in general the wrong thing to do. > >> Touchscreens report the temperature for monitoring reasons, after all. > >> But then, sure, if you insist. I am getting tired of arguing. > >> > > I apparently did not make clear what my question refers to. It was more about separate > > hwmon device + mfd vs. integrating everything into the regulator driver. > > > > What I keep failing to understand is why people keep avoiding the potential of > implementing auxiliary device drivers, since that would be the perfect solution > and match the intended use case for auxiliary devices. > > > But since you brought up the topic hwmon vs. iio for temperature. I do not have > > a strong opinion here as long as I can somehow live with it. Nothing I want to > > fight for. One sensor I use for measuring room temperature is hwmon, another > > one is iio. So it is all not that consistent. > > > > That doesn't mean what exists is consistent or even makes sense. Some driver support > for chips intended for reporting the environment or chip temperature are pushed into iio. There might be some that have slipped through but when it's monitoring specific chip as opposed to part of of a SoC ADC where some channels are for monitoring and others very much not (e.g. the touchscreen ADC channels), I do direct people to provide reasons and +CC hwmon. There are a few odd corner cases where we had a driver for a mems device or similar that doesn't fit in hwmon come along and there is a variant of that silicon that only has the temp part enabled. Without specific part numbers I don't know why it happened here. We get a few drivers every year where I think it's just familiarity with IIO that drove the initial submission and for those we push them to submit a hwmon driver instead and I +CC the hwmon list on that suggestion. Guenter frequently eyeballs the driver and points that another driver can be trivially modified to support it. Mind you I may well miss some :( > I have no idea why that is the case. Yes, that results in odd situations like yours, > but there is nothing I can do about it. I can only guess that _someone_ is pushing for > submitting drivers into IIO instead of hwmon, but that is just a wild guess. You would > have to ask the driver authors and/or IIO maintainers for reasons. I am copying the IIO > mailing list for feedback. > > Also, again, I am tired of arguing, so I typically don't even comment anymore (if I even > notice) unless explicitly asked. > > > 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. > > > I wonder whether I really need a thermal zone. It adds stuff not needed here, > > trip points and polling. > > > > The driver _registers_ a thermal zone, but that doesn't mean it has to be configured. > If one is configured (typically via devicetree), it is obviously needed. > > > Documentation/hwmon/sy7636a-hwmon.rst seems to be wrong. It is not > > SoC-on-die temperature, but temperature from an external NTC. And > > that is typically used to tune the EPD refresh to the temperature. > > Please feel free to submit a patch correcting the documentation. > > Guenter > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices 2025-09-27 18:39 ` Jonathan Cameron @ 2025-10-27 20:12 ` Andreas Kemnade 0 siblings, 0 replies; 6+ messages in thread From: Andreas Kemnade @ 2025-10-27 20:12 UTC (permalink / raw) To: Jonathan Cameron Cc: Guenter Roeck, Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org On Sat, 27 Sep 2025 19:39:45 +0100 Jonathan Cameron <jic23@kernel.org> wrote: > On Wed, 24 Sep 2025 12:16:14 -0700 > Guenter Roeck <linux@roeck-us.net> wrote: > > > On 9/24/25 10:53, Andreas Kemnade wrote: > > > On Wed, 24 Sep 2025 00:17:48 -0700 > > > Guenter Roeck <linux@roeck-us.net> wrote: > > > > > >> On 9/24/25 00:00, Andreas Kemnade wrote: > > >>> On Sat, 20 Sep 2025 23:18:59 +0100 > > >>> Mark Brown <broonie@kernel.org> wrote: > > >>> > > >>>> On Sat, Sep 20, 2025 at 11:33:07PM +0200, Andreas Kemnade wrote: > > >>>> > > >>>>> Just for learning, yes, it is an abuse of the _optional for non-optional > > >>>>> things, so a dirty hack which should not go in, therefore RFC. But what > > >>>>> happens more than having the hwmon device endlessly deferred at worst? > > >>>> > > >>>> There's also the fact that this API is so frequently abused for bad and > > >>>> broken reasons that I regularly audit users and try to fix them, I'd > > >>>> rather not see any new users that don't have a really strong reason to > > >>>> use it. > > >>>> > > >>>>> The wanted regulator is the one defined in sy7636a-regulator.c. So it > > >>>>> is all an issue internal to the sy7636a. > > >>>> > > >>>>> Both subdevices are instantiated via drivers/simple-mfd-i2c.c. > > >>>>> I see several other solutions: > > >>>>> a) call device_is_bound() on every other children of dev->parent, if not > > >>>>> bound defer. > > >>>>> b) do not care about the regulator api at all, just check whether > > >>>>> the corresponding bit is set before reading temperature, return > > >>>>> -ENODATA if not, some mutex is probably needed. > > >>>>> c) do not care about the regulator api at all, just set the > > >>>>> corresponding bit (together with some mutex locking and counting). > > >>>> > > >>>> I assume this is using the regulator API because someone might use an > > >>>> external regulator in a system design for some reason (better quality, > > >>>> power efficiency or a shared reference between multiple devices I > > >>>> guess?), or because the supply might also be used by external devices? > > >>>> > > >>>>> d) copy the of_node pointer from the parent, add a regulator phandle property > > >>>>> to the node pointing to the regulator in the node itself. > > >>>>> That sounds like your idea but is against the current dt binding for > > >>>>> this device and afaik it is uncommon to have mfd-internal things wired > > >>>>> up this way > > >>>>> > > >>>>> e) something clean, simple I miss > > >>>> > > >>>> The idea is that the relationship between the devices should be > > >>>> registered before the devices, that's how the regulator knows to defer. > > >>>> We used to have an API for doing this for board files which might fit > > >>>> here, but it got removed since nobody wants board files any more. If > > >>>> you're allocating the devices dynamically that's annoying to implement > > >>>> though... > > >>> > > >>> looking a bit around: > > >>> max5970-regulator.c has hwmon integrated and no extra device. That would > > >>> simplify things. Although it does not report temperature. Some > > >>> touchscreens have temperature via hwmon, some others have temperature > > >>> via iio, directly in one device without mfd. Maybe that is also > > >>> the better way here? > > >>> > > >> > > >> Touchscreens reporting temperature via iio is in general the wrong thing to do. > > >> Touchscreens report the temperature for monitoring reasons, after all. > > >> But then, sure, if you insist. I am getting tired of arguing. > > >> > > > I apparently did not make clear what my question refers to. It was more about separate > > > hwmon device + mfd vs. integrating everything into the regulator driver. > > > > > > > What I keep failing to understand is why people keep avoiding the potential of > > implementing auxiliary device drivers, since that would be the perfect solution > > and match the intended use case for auxiliary devices. > > > > > But since you brought up the topic hwmon vs. iio for temperature. I do not have > > > a strong opinion here as long as I can somehow live with it. Nothing I want to > > > fight for. One sensor I use for measuring room temperature is hwmon, another > > > one is iio. So it is all not that consistent. > > > > > > > That doesn't mean what exists is consistent or even makes sense. Some driver support > > for chips intended for reporting the environment or chip temperature are pushed into iio. > > There might be some that have slipped through but when it's monitoring specific chip > as opposed to part of of a SoC ADC where some channels are for monitoring and others > very much not (e.g. the touchscreen ADC channels), I do direct people to provide > reasons and +CC hwmon. There are a few odd corner cases where we had a driver for > a mems device or similar that doesn't fit in hwmon come along and there is a > variant of that silicon that only has the temp part enabled. > > Without specific part numbers I don't know why it happened here. > HIH6130 (humidity + temperature via hwmon) vs bme280 (humidity + temperature + pressure via iio). So maybe the very basic thing: What does "monitor" mean in this context? Checking the state of the hardware (what temperature) to take safety/emergency measures or to tune things to work optimally at the given conditions? But when monitoring is about the health of the system... well in a drone e.g. probably everything which can be iio can be considered part of the system health and like the temperature, things can be controlled by some actors. Well as long as I do not need anything specific to one or the other api, I can live with things. I am a bit curious about the background. Regards, Andreas ^ permalink raw reply [flat|nested] 6+ messages in thread
* In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) 2025-09-24 19:16 ` [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices Guenter Roeck 2025-09-27 18:39 ` Jonathan Cameron @ 2026-01-22 14:23 ` Andreas Kemnade 2026-01-31 18:42 ` Jonathan Cameron 2026-02-01 16:29 ` In-kernel hwmon read: Guenter Roeck 1 sibling, 2 replies; 6+ messages in thread From: Andreas Kemnade @ 2026-01-22 14:23 UTC (permalink / raw) To: Guenter Roeck Cc: Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org, Jonathan Cameron On Wed, 24 Sep 2025 12:16:14 -0700 Guenter Roeck <linux@roeck-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. Regards, Andreas ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) 2026-01-22 14:23 ` In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) Andreas Kemnade @ 2026-01-31 18:42 ` Jonathan Cameron 2026-02-01 16:29 ` In-kernel hwmon read: Guenter Roeck 1 sibling, 0 replies; 6+ messages in thread From: Jonathan Cameron @ 2026-01-31 18:42 UTC (permalink / raw) To: Andreas Kemnade Cc: Guenter Roeck, Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org On Thu, 22 Jan 2026 15:23:06 +0100 Andreas Kemnade <andreas@kemnade.info> wrote: > On Wed, 24 Sep 2025 12:16:14 -0700 > Guenter Roeck <linux@roeck-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 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: In-kernel hwmon read: 2026-01-22 14:23 ` In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) Andreas Kemnade 2026-01-31 18:42 ` Jonathan Cameron @ 2026-02-01 16:29 ` Guenter Roeck 1 sibling, 0 replies; 6+ messages in thread From: Guenter Roeck @ 2026-02-01 16:29 UTC (permalink / raw) To: Andreas Kemnade Cc: Mark Brown, jdelvare, lgirdwood, linux-hwmon, linux-kernel, Alistair Francis, linux-iio@vger.kernel.org, Jonathan Cameron On 1/22/26 06:23, Andreas Kemnade wrote: > On Wed, 24 Sep 2025 12:16:14 -0700 > Guenter Roeck <linux@roeck-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. > b) _is_ the hwmon->iio bridge. Add HWMON_C_REGISTER_IIO, and register as appropriate with iio if it is set. Then add HWMON_C_REGISTER_IIO to all drivers needing it. Not sure though how that would look like in devicetree for in-kernel use. Guenter > 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. > > Regards, > Andreas > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-01 16:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20250920114311.291450-1-andreas@kemnade.info>
[not found] ` <20250920114311.291450-2-andreas@kemnade.info>
[not found] ` <79aa98fe-b9b6-4210-a556-d33863f0129a@sirena.org.uk>
[not found] ` <20250920233307.0c425863@kemnade.info>
[not found] ` <473e217a-c6b3-4ebc-895d-85beab50267c@sirena.org.uk>
[not found] ` <20250924090023.282ae450@kemnade.info>
[not found] ` <b68d40d9-6ea9-49a9-8a2e-8b899f33340d@roeck-us.net>
[not found] ` <20250924195358.16bbd90c@kemnade.info>
2025-09-24 19:16 ` [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices Guenter Roeck
2025-09-27 18:39 ` Jonathan Cameron
2025-10-27 20:12 ` Andreas Kemnade
2026-01-22 14:23 ` In-kernel hwmon read: (was: Re: [PATCH RFC 1/2] hwmon: (sy7636a) fix races during probe of mfd subdevices) Andreas Kemnade
2026-01-31 18:42 ` Jonathan Cameron
2026-02-01 16:29 ` In-kernel hwmon read: Guenter Roeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox