mbox series

[v1,0/2] Support temperature trips by HWMON core and LM90 driver

Message ID 20210620161223.16844-1-digetx@gmail.com
Headers show
Series Support temperature trips by HWMON core and LM90 driver | expand

Message

Dmitry Osipenko June 20, 2021, 4:12 p.m. UTC
Hi,

It's typical for embedded devices to use LM90-compatible sensor for
monitoring of CPU core and skin temperatures. The sensor is often
used by thermal zone that performs passive cooling and emergency
shutdown on overheat, hence it's more optimal to use interrupt for
a faster notification about temperature changes. Thermal framework
provides set_trips() callback for programming of temperature trips,
let's support it by HWMON.

Dmitry Osipenko (2):
  hwmon: Support set_trips() of thermal device ops
  hwmon: (lm90) Implement set_trips() callback

 drivers/hwmon/hwmon.c | 12 ++++++++++++
 drivers/hwmon/lm90.c  | 30 ++++++++++++++++++++++++++++++
 include/linux/hwmon.h |  9 +++++++++
 3 files changed, 51 insertions(+)

Comments

Dmitry Osipenko June 20, 2021, 5:38 p.m. UTC | #1
20.06.2021 20:23, Guenter Roeck пишет:
> On Sun, Jun 20, 2021 at 07:12:22PM +0300, Dmitry Osipenko wrote:
>> Support set_trips() callback of thermal device ops. This allows HWMON
>> device to operatively notify thermal core about temperature changes, which
>> is very handy to have in a case where HWMON sensor is used by CPU thermal
>> zone that performs passive cooling and emergency shutdown on overheat.
>> Thermal core will be able to react faster to temperature changes.
>>
> 
> Why would this require a driver callback, and why can it not be handled
> in the hwmon core alone ? The hwmon core could register a set_trip function
> if the chip (driver) supports setting low and high limits, and it could
> call the appropriate driver functions when hwmon_thermal_set_trips()
> is called.

I wasn't sure about what other hwmon drivers may need and want to do for
programming of the trips, so decided to start with this variant. I'll
prepare v2 since you're suggesting that the universal callback should
work okay for all drivers, thanks.