diff options
| author | Praveen Chidambaram <pchidamb@codeaurora.org> | 2013-07-02 13:04:58 -0600 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:08:17 -0700 |
| commit | eb00c793d7c3a772583650dac023cf37e742f4bf (patch) | |
| tree | 8a35d9aea87ce018154b340078f9e5bc72ab8c07 /include/linux | |
| parent | 0637fa244fff60c961668a29c67c0e0310d2a95e (diff) | |
thermal: Add sensor API to allow any driver to set thresholds
Sensor API allow drivers to set min or max thresholds and get
notified when the corresponding sensor crosses these thresholds.
The sensor API, uses the THERMAL_TRIP_CONFIGURABLE_HI and
THERMAL_TRIP_CONFIGURABLE_LOW, to set the threshold. The existing
sysfs interfaces will not be affected by the newly added API.
Change-Id: I85d2ae132fc3b7b6d157faf0a7390e31fdc7e6da
Signed-off-by: Praveen Chidambaram <pchidamb@codeaurora.org>
Conflicts:
include/linux/thermal.h
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/thermal.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f11670b48878..03eec380f7f8 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -153,6 +153,27 @@ struct thermal_attr { char name[THERMAL_NAME_LENGTH]; }; +struct sensor_threshold { + int temp; + enum thermal_trip_type trip; + int (*notify)(enum thermal_trip_type type, int temp, void *data); + void *data; + struct list_head list; +}; + +struct sensor_info { + uint32_t sensor_id; + struct thermal_zone_device *tz; + int threshold_min; + int threshold_max; + int max_idx; + int min_idx; + struct list_head sensor_list; + struct list_head threshold_list; + struct mutex lock; + struct work_struct work; +}; + /** * struct thermal_zone_device - structure for a thermal zone * @id: unique id number for each thermal zone @@ -213,6 +234,8 @@ struct thermal_zone_device { struct mutex lock; struct list_head node; struct delayed_work poll_queue; + struct sensor_threshold tz_threshold[2]; + struct sensor_info sensor; }; /** @@ -423,6 +446,12 @@ struct thermal_instance *get_thermal_instance(struct thermal_zone_device *, struct thermal_cooling_device *, int); void thermal_cdev_update(struct thermal_cooling_device *); void thermal_notify_framework(struct thermal_zone_device *, int); +int sensor_get_id(char *name); +int sensor_set_trip(uint32_t sensor_id, struct sensor_threshold *threshold); +int sensor_cancel_trip(uint32_t sensor_id, struct sensor_threshold *threshold); +int thermal_sensor_trip(struct thermal_zone_device *tz, + enum thermal_trip_type trip, unsigned long temp); + #else static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev) { return false; } @@ -485,6 +514,18 @@ static inline void thermal_cdev_update(struct thermal_cooling_device *cdev) static inline void thermal_notify_framework(struct thermal_zone_device *tz, int trip) { } +static inline int sensor_get_id(char *name){ return -ENODEV;} +static inline int sensor_set_trip(uint32_t sensor_id, + struct sensor_threshold *threshold) +{ return ENODEV;} +static inline int sensor_cancel_trip(uint32_t sensor_id, + struct sensor_threshold *threshold) +{ return -ENODEV;} + +static inline int thermal_sensor_trip(struct thermal_zone_device *tz, + enum thermal_trip_type trip, unsigned long temp) +{ return -ENODEV;} + #endif /* CONFIG_THERMAL */ #if defined(CONFIG_NET) && IS_ENABLED(CONFIG_THERMAL) |
