Merge branches 'thermal-intel' and 'thermal-core' into next
This commit is contained in:
commit
1577ddfac7
|
@ -426,6 +426,7 @@ clock_cooling_register(struct device *dev, const char *clock_name)
|
||||||
if (!ccdev)
|
if (!ccdev)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
mutex_init(&ccdev->lock);
|
||||||
ccdev->dev = dev;
|
ccdev->dev = dev;
|
||||||
ccdev->clk = devm_clk_get(dev, clock_name);
|
ccdev->clk = devm_clk_get(dev, clock_name);
|
||||||
if (IS_ERR(ccdev->clk))
|
if (IS_ERR(ccdev->clk))
|
||||||
|
|
|
@ -116,7 +116,9 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
|
||||||
instance->target = get_target_state(tz, cdev, percentage,
|
instance->target = get_target_state(tz, cdev, percentage,
|
||||||
cur_trip_level);
|
cur_trip_level);
|
||||||
|
|
||||||
|
mutex_lock(&instance->cdev->lock);
|
||||||
instance->cdev->updated = false;
|
instance->cdev->updated = false;
|
||||||
|
mutex_unlock(&instance->cdev->lock);
|
||||||
thermal_cdev_update(cdev);
|
thermal_cdev_update(cdev);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -71,7 +71,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
dev_dbg(&instance->cdev->device, "target=%d\n",
|
dev_dbg(&instance->cdev->device, "target=%d\n",
|
||||||
(int)instance->target);
|
(int)instance->target);
|
||||||
|
|
||||||
|
mutex_lock(&instance->cdev->lock);
|
||||||
instance->cdev->updated = false; /* cdev needs update */
|
instance->cdev->updated = false; /* cdev needs update */
|
||||||
|
mutex_unlock(&instance->cdev->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&tz->lock);
|
mutex_unlock(&tz->lock);
|
||||||
|
|
|
@ -529,7 +529,9 @@ static void allow_maximum_power(struct thermal_zone_device *tz)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
instance->target = 0;
|
instance->target = 0;
|
||||||
|
mutex_lock(&instance->cdev->lock);
|
||||||
instance->cdev->updated = false;
|
instance->cdev->updated = false;
|
||||||
|
mutex_unlock(&instance->cdev->lock);
|
||||||
thermal_cdev_update(instance->cdev);
|
thermal_cdev_update(instance->cdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
|
||||||
update_passive_instance(tz, trip_type, -1);
|
update_passive_instance(tz, trip_type, -1);
|
||||||
|
|
||||||
instance->initialized = true;
|
instance->initialized = true;
|
||||||
|
mutex_lock(&instance->cdev->lock);
|
||||||
instance->cdev->updated = false; /* cdev needs update */
|
instance->cdev->updated = false; /* cdev needs update */
|
||||||
|
mutex_unlock(&instance->cdev->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&tz->lock);
|
mutex_unlock(&tz->lock);
|
||||||
|
|
|
@ -1093,7 +1093,9 @@ int power_actor_set_power(struct thermal_cooling_device *cdev,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
instance->target = state;
|
instance->target = state;
|
||||||
|
mutex_lock(&cdev->lock);
|
||||||
cdev->updated = false;
|
cdev->updated = false;
|
||||||
|
mutex_unlock(&cdev->lock);
|
||||||
thermal_cdev_update(cdev);
|
thermal_cdev_update(cdev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1623,11 +1625,13 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
|
||||||
struct thermal_instance *instance;
|
struct thermal_instance *instance;
|
||||||
unsigned long target = 0;
|
unsigned long target = 0;
|
||||||
|
|
||||||
/* cooling device is updated*/
|
|
||||||
if (cdev->updated)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mutex_lock(&cdev->lock);
|
mutex_lock(&cdev->lock);
|
||||||
|
/* cooling device is updated*/
|
||||||
|
if (cdev->updated) {
|
||||||
|
mutex_unlock(&cdev->lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make sure cdev enters the deepest cooling state */
|
/* Make sure cdev enters the deepest cooling state */
|
||||||
list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) {
|
list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) {
|
||||||
dev_dbg(&cdev->device, "zone%d->target=%lu\n",
|
dev_dbg(&cdev->device, "zone%d->target=%lu\n",
|
||||||
|
@ -1637,9 +1641,9 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
|
||||||
if (instance->target > target)
|
if (instance->target > target)
|
||||||
target = instance->target;
|
target = instance->target;
|
||||||
}
|
}
|
||||||
mutex_unlock(&cdev->lock);
|
|
||||||
cdev->ops->set_cur_state(cdev, target);
|
cdev->ops->set_cur_state(cdev, target);
|
||||||
cdev->updated = true;
|
cdev->updated = true;
|
||||||
|
mutex_unlock(&cdev->lock);
|
||||||
trace_cdev_update(cdev, target);
|
trace_cdev_update(cdev, target);
|
||||||
dev_dbg(&cdev->device, "set to state %lu\n", target);
|
dev_dbg(&cdev->device, "set to state %lu\n", target);
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,6 +232,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(thermal_add_hwmon_sysfs);
|
||||||
|
|
||||||
void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
|
void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
|
||||||
{
|
{
|
||||||
|
@ -270,3 +271,4 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
|
||||||
hwmon_device_unregister(hwmon->device);
|
hwmon_device_unregister(hwmon->device);
|
||||||
kfree(hwmon);
|
kfree(hwmon);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(thermal_remove_hwmon_sysfs);
|
||||||
|
|
Loading…
Reference in New Issue