| .. | .. |
|---|
| 12 | 12 | |
|---|
| 13 | 13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 14 | 14 | |
|---|
| 15 | | -#include <linux/sysfs.h> |
|---|
| 16 | 15 | #include <linux/device.h> |
|---|
| 17 | 16 | #include <linux/err.h> |
|---|
| 17 | +#include <linux/export.h> |
|---|
| 18 | 18 | #include <linux/slab.h> |
|---|
| 19 | 19 | #include <linux/string.h> |
|---|
| 20 | +#include <linux/sysfs.h> |
|---|
| 20 | 21 | |
|---|
| 21 | 22 | #include <trace/events/thermal.h> |
|---|
| 22 | 23 | |
|---|
| .. | .. |
|---|
| 113 | 114 | } |
|---|
| 114 | 115 | EXPORT_SYMBOL_GPL(thermal_zone_get_temp); |
|---|
| 115 | 116 | |
|---|
| 117 | +/** |
|---|
| 118 | + * thermal_zone_set_trips - Computes the next trip points for the driver |
|---|
| 119 | + * @tz: a pointer to a thermal zone device structure |
|---|
| 120 | + * |
|---|
| 121 | + * The function computes the next temperature boundaries by browsing |
|---|
| 122 | + * the trip points. The result is the closer low and high trip points |
|---|
| 123 | + * to the current temperature. These values are passed to the backend |
|---|
| 124 | + * driver to let it set its own notification mechanism (usually an |
|---|
| 125 | + * interrupt). |
|---|
| 126 | + * |
|---|
| 127 | + * It does not return a value |
|---|
| 128 | + */ |
|---|
| 116 | 129 | void thermal_zone_set_trips(struct thermal_zone_device *tz) |
|---|
| 117 | 130 | { |
|---|
| 118 | 131 | int low = -INT_MAX; |
|---|
| .. | .. |
|---|
| 161 | 174 | exit: |
|---|
| 162 | 175 | mutex_unlock(&tz->lock); |
|---|
| 163 | 176 | } |
|---|
| 164 | | -EXPORT_SYMBOL_GPL(thermal_zone_set_trips); |
|---|
| 177 | + |
|---|
| 178 | +static void thermal_cdev_set_cur_state(struct thermal_cooling_device *cdev, |
|---|
| 179 | + int target) |
|---|
| 180 | +{ |
|---|
| 181 | + if (cdev->ops->set_cur_state(cdev, target)) |
|---|
| 182 | + return; |
|---|
| 183 | + |
|---|
| 184 | + thermal_notify_cdev_state_update(cdev->id, target); |
|---|
| 185 | + thermal_cooling_device_stats_update(cdev, target); |
|---|
| 186 | +} |
|---|
| 165 | 187 | |
|---|
| 166 | 188 | void thermal_cdev_update(struct thermal_cooling_device *cdev) |
|---|
| 167 | 189 | { |
|---|
| .. | .. |
|---|
| 185 | 207 | target = instance->target; |
|---|
| 186 | 208 | } |
|---|
| 187 | 209 | |
|---|
| 188 | | - if (!cdev->ops->set_cur_state(cdev, target)) |
|---|
| 189 | | - thermal_cooling_device_stats_update(cdev, target); |
|---|
| 210 | + thermal_cdev_set_cur_state(cdev, target); |
|---|
| 190 | 211 | |
|---|
| 191 | 212 | cdev->updated = true; |
|---|
| 192 | 213 | mutex_unlock(&cdev->lock); |
|---|