thermal: Add support for hardware-tracked trip points
authorSascha Hauer <s.hauer@pengutronix.de>
Wed, 20 May 2015 13:20:42 +0000 (15:20 +0200)
committerCaesar Wang <wxt@rock-chips.com>
Tue, 26 Apr 2016 02:35:41 +0000 (10:35 +0800)
commit606113604b3b1b926fe21cc37e9ee5d01efc7cdc
tree8f097e30651b7935d4cad8de86ad1c3ef16aab9f
parentdb6c7c9251f337bef4663437004121b2f6df6e52
thermal: Add support for hardware-tracked trip points

This adds support for hardware-tracked trip points to the device tree
thermal sensor framework.

The framework supports an arbitrary number of trip points. Whenever
the current temperature is updated, the trip points immediately
below and above the current temperature are found. A .set_trips
callback is then called with the temperatures. If there is no trip
point above or below the current temperature, the passed trip
temperature will be -INT_MAX or INT_MAX respectively. In this callback,
the driver should program the hardware such that it is notified
when either of these trip points are triggered. When a trip point
is triggered, the driver should call `thermal_zone_device_update'
for the respective thermal zone. This will cause the trip points
to be updated again.

If .set_trips is not implemented, the framework behaves as before.

This patch is based on an earlier version from Mikko Perttunen
<mikko.perttunen@kapsi.fi>

Change-Id: I8c33f9859909704583ba8b6632b91ffd58a9628e
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
drivers/thermal/thermal_core.c
include/linux/thermal.h