Commit bae1577e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal management fixes from Zhang Rui:
 "Specifics:

   - fix an error that "weight_attr" sysfs attribute is not removed
     while unbinding.  From: Viresh Kumar.

   - fix power allocator governor tracing to return the real request.
     From Javi Merino.

   - remove redundant owner assignment of hisi platform thermal driver.
     From Krzysztof Kozlowski.

   - a couple of small fixes of Exynos thermal driver.  From Krzysztof
     Kozlowski and Chanwoo Choi"

* 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  thermal: Drop owner assignment from platform_driver
  thermal: exynos: Remove unused code related to platform_data on probe()
  thermal: exynos: Add the dependency of CONFIG_THERMAL_OF instead of CONFIG_OF
  thermal: exynos: Disable the regulator on probe failure
  thermal: power_allocator: trace the real requested power
  thermal: remove dangling 'weight_attr' device file
parents dd2384a7 8bf93f24
...@@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, ...@@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
static struct platform_driver hisi_thermal_driver = { static struct platform_driver hisi_thermal_driver = {
.driver = { .driver = {
.name = "hisi_thermal", .name = "hisi_thermal",
.owner = THIS_MODULE,
.pm = &hisi_thermal_pm_ops, .pm = &hisi_thermal_pm_ops,
.of_match_table = of_hisi_thermal_match, .of_match_table = of_hisi_thermal_match,
}, },
......
...@@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz, ...@@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz,
struct thermal_instance *instance; struct thermal_instance *instance;
struct power_allocator_params *params = tz->governor_data; struct power_allocator_params *params = tz->governor_data;
u32 *req_power, *max_power, *granted_power, *extra_actor_power; u32 *req_power, *max_power, *granted_power, *extra_actor_power;
u32 total_req_power, max_allocatable_power; u32 *weighted_req_power;
u32 total_req_power, max_allocatable_power, total_weighted_req_power;
u32 total_granted_power, power_range; u32 total_granted_power, power_range;
int i, num_actors, total_weight, ret = 0; int i, num_actors, total_weight, ret = 0;
int trip_max_desired_temperature = params->trip_max_desired_temperature; int trip_max_desired_temperature = params->trip_max_desired_temperature;
...@@ -247,16 +248,17 @@ static int allocate_power(struct thermal_zone_device *tz, ...@@ -247,16 +248,17 @@ static int allocate_power(struct thermal_zone_device *tz,
} }
/* /*
* We need to allocate three arrays of the same size: * We need to allocate five arrays of the same size:
* req_power, max_power and granted_power. They are going to * req_power, max_power, granted_power, extra_actor_power and
* be needed until this function returns. Allocate them all * weighted_req_power. They are going to be needed until this
* in one go to simplify the allocation and deallocation * function returns. Allocate them all in one go to simplify
* logic. * the allocation and deallocation logic.
*/ */
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power)); BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power));
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power)); BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power));
BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power)); BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power));
req_power = devm_kcalloc(&tz->device, num_actors * 4, BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power));
req_power = devm_kcalloc(&tz->device, num_actors * 5,
sizeof(*req_power), GFP_KERNEL); sizeof(*req_power), GFP_KERNEL);
if (!req_power) { if (!req_power) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz, ...@@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz,
max_power = &req_power[num_actors]; max_power = &req_power[num_actors];
granted_power = &req_power[2 * num_actors]; granted_power = &req_power[2 * num_actors];
extra_actor_power = &req_power[3 * num_actors]; extra_actor_power = &req_power[3 * num_actors];
weighted_req_power = &req_power[4 * num_actors];
i = 0; i = 0;
total_weighted_req_power = 0;
total_req_power = 0; total_req_power = 0;
max_allocatable_power = 0; max_allocatable_power = 0;
...@@ -289,13 +293,14 @@ static int allocate_power(struct thermal_zone_device *tz, ...@@ -289,13 +293,14 @@ static int allocate_power(struct thermal_zone_device *tz,
else else
weight = instance->weight; weight = instance->weight;
req_power[i] = frac_to_int(weight * req_power[i]); weighted_req_power[i] = frac_to_int(weight * req_power[i]);
if (power_actor_get_max_power(cdev, tz, &max_power[i])) if (power_actor_get_max_power(cdev, tz, &max_power[i]))
continue; continue;
total_req_power += req_power[i]; total_req_power += req_power[i];
max_allocatable_power += max_power[i]; max_allocatable_power += max_power[i];
total_weighted_req_power += weighted_req_power[i];
i++; i++;
} }
...@@ -303,8 +308,9 @@ static int allocate_power(struct thermal_zone_device *tz, ...@@ -303,8 +308,9 @@ static int allocate_power(struct thermal_zone_device *tz,
power_range = pid_controller(tz, current_temp, control_temp, power_range = pid_controller(tz, current_temp, control_temp,
max_allocatable_power); max_allocatable_power);
divvy_up_power(req_power, max_power, num_actors, total_req_power, divvy_up_power(weighted_req_power, max_power, num_actors,
power_range, granted_power, extra_actor_power); total_weighted_req_power, power_range, granted_power,
extra_actor_power);
total_granted_power = 0; total_granted_power = 0;
i = 0; i = 0;
......
config EXYNOS_THERMAL config EXYNOS_THERMAL
tristate "Exynos thermal management unit driver" tristate "Exynos thermal management unit driver"
depends on OF depends on THERMAL_OF
help help
If you say yes here you get support for the TMU (Thermal Management If you say yes here you get support for the TMU (Thermal Management
Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises
......
...@@ -1296,7 +1296,6 @@ static struct thermal_zone_of_device_ops exynos_sensor_ops = { ...@@ -1296,7 +1296,6 @@ static struct thermal_zone_of_device_ops exynos_sensor_ops = {
static int exynos_tmu_probe(struct platform_device *pdev) static int exynos_tmu_probe(struct platform_device *pdev)
{ {
struct exynos_tmu_platform_data *pdata;
struct exynos_tmu_data *data; struct exynos_tmu_data *data;
int ret; int ret;
...@@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_sensor; goto err_sensor;
pdata = data->pdata;
INIT_WORK(&data->irq_work, exynos_tmu_work); INIT_WORK(&data->irq_work, exynos_tmu_work);
data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); data->clk = devm_clk_get(&pdev->dev, "tmu_apbif");
...@@ -1392,6 +1389,8 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -1392,6 +1389,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
if (!IS_ERR(data->clk_sec)) if (!IS_ERR(data->clk_sec))
clk_unprepare(data->clk_sec); clk_unprepare(data->clk_sec);
err_sensor: err_sensor:
if (!IS_ERR_OR_NULL(data->regulator))
regulator_disable(data->regulator);
thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd);
return ret; return ret;
......
...@@ -1333,6 +1333,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, ...@@ -1333,6 +1333,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
return -ENODEV; return -ENODEV;
unbind: unbind:
device_remove_file(&tz->device, &pos->weight_attr);
device_remove_file(&tz->device, &pos->attr); device_remove_file(&tz->device, &pos->attr);
sysfs_remove_link(&tz->device.kobj, pos->name); sysfs_remove_link(&tz->device.kobj, pos->name);
release_idr(&tz->idr, &tz->lock, pos->id); release_idr(&tz->idr, &tz->lock, pos->id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment