CHROMIUM: thermal: of: Add support for hardware-tracked trip points
authorMikko Perttunen <mperttunen@nvidia.com>
Tue, 29 Jul 2014 00:33:55 +0000 (17:33 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 15 Apr 2016 11:55:16 +0000 (19:55 +0800)
commit2f8e5324ef44d0842f3db3af5fc4da761440abfb
tree9473c9913f6045cff38ec22299d308c1f6a7cf7a
parentae9810ed8e33a5de5c6183d8a874f8961755b536
CHROMIUM: thermal: of: 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 sensor driver
callback `set_trips' is then called with the temperatures.
If there is no trip point above or below the current temperature,
the passed trip temperature will be LONG_MAX or LONG_MIN 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 the `set_trips' callback is not implemented (is NULL), the framework
behaves as before.

CQ-DEPEND=CL:*210768
BUG=chrome-os-partner:30834
TEST=None

Change-Id: I33226d2b80f3e71a0c3ca3fbc5718db4e461268f
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Paul Walmsley <pwalmsley@nvidia.com>
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/212425
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Queue: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
Reviewed-on: https://chrome-internal-review.googlesource.com/210454
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/267514
Tested-by: David Riley <davidriley@chromium.org>
Reviewed-by: David Riley <davidriley@chromium.org>
Commit-Queue: David Riley <davidriley@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
(cherry-picked from https://chromium.googlesource.com/chromiumos/
 third_party/kernel/+/v3.18 commit 397befabb2a52fc16586509a970f8c98268b8040)
drivers/thermal/of-thermal.c
include/linux/thermal.h