@@ -694,6 +694,14 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
mutex_unlock(&cdev->lock);
mutex_unlock(&tz->lock);
+ if (cdev->ops->bind) {
+ result = cdev->ops->bind(cdev, tz, trip, upper, lower, weight);
+ if (result < 0) {
+ pr_err("failed to bind %s to %s: %d\n", cdev->type,
+ tz->type, result);
+ }
+ }
+
if (!result)
return 0;
@@ -730,6 +738,9 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
{
struct thermal_instance *pos, *next;
+ if (cdev->ops->unbind)
+ cdev->ops->unbind(cdev, tz, trip);
+
mutex_lock(&tz->lock);
mutex_lock(&cdev->lock);
list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) {
@@ -89,6 +89,12 @@ struct thermal_trip {
};
struct thermal_cooling_device_ops {
+ int (*bind)(struct thermal_cooling_device *cdev,
+ struct thermal_zone_device *tz, int trip_id,
+ unsigned long upper, unsigned long lower,
+ unsigned int weight);
+ void (*unbind)(struct thermal_cooling_device *cdev,
+ struct thermal_zone_device *tz, int trip_id);
int (*get_max_state) (struct thermal_cooling_device *, unsigned long *);
int (*get_cur_state) (struct thermal_cooling_device *, unsigned long *);
int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);