aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 13:01:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-03-24 13:01:53 -0400
commit9fc13bbdf1d6b518c8377633c5fb198fbc9dcc03 (patch)
tree5134d446845452a89bb142480223fc36b2901e5e
parent38104c00200898120e12a73db27cea2b7055ea3c (diff)
parent2d7c4e17811f766321b9c054609551fa40f0b445 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management fixes from Zhang Rui: - Fix a wrong __percpu structure declaration in intel_powerclamp driver (Luc Van Oostenryck) - Fix truncated name of the idle injection kthreads created by intel_powerclamp driver (Zhang Rui) - Fix the missing UUID supports in int3400 thermal driver (Matthew Garrett) - Fix a crash when accessing the debugfs of bcm2835 SoC thermal driver (Phil Elwell) - A couple of trivial fixes/cleanups in some SoC thermal drivers * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal/intel_powerclamp: fix truncated kthread name thermal: mtk: Allocate enough space for mtk_thermal. thermal/int340x_thermal: fix mode setting thermal/int340x_thermal: Add additional UUIDs thermal: cpu_cooling: Remove unused cur_freq variable thermal: bcm2835: Fix crash in bcm2835_thermal_debugfs thermal: samsung: Fix incorrect check after code merge thermal/intel_powerclamp: fix __percpu declaration of worker_data
-rw-r--r--drivers/thermal/broadcom/bcm2835_thermal.c9
-rw-r--r--drivers/thermal/cpu_cooling.c3
-rw-r--r--drivers/thermal/intel/int340x_thermal/int3400_thermal.c21
-rw-r--r--drivers/thermal/intel/intel_powerclamp.c4
-rw-r--r--drivers/thermal/mtk_thermal.c7
-rw-r--r--drivers/thermal/samsung/exynos_tmu.c2
6 files changed, 30 insertions, 16 deletions
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
index 720760cd493f..ba39647a690c 100644
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
@@ -119,8 +119,7 @@ static const struct debugfs_reg32 bcm2835_thermal_regs[] = {
119 119
120static void bcm2835_thermal_debugfs(struct platform_device *pdev) 120static void bcm2835_thermal_debugfs(struct platform_device *pdev)
121{ 121{
122 struct thermal_zone_device *tz = platform_get_drvdata(pdev); 122 struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
123 struct bcm2835_thermal_data *data = tz->devdata;
124 struct debugfs_regset32 *regset; 123 struct debugfs_regset32 *regset;
125 124
126 data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL); 125 data->debugfsdir = debugfs_create_dir("bcm2835_thermal", NULL);
@@ -266,7 +265,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
266 265
267 data->tz = tz; 266 data->tz = tz;
268 267
269 platform_set_drvdata(pdev, tz); 268 platform_set_drvdata(pdev, data);
270 269
271 /* 270 /*
272 * Thermal_zone doesn't enable hwmon as default, 271 * Thermal_zone doesn't enable hwmon as default,
@@ -290,8 +289,8 @@ err_clk:
290 289
291static int bcm2835_thermal_remove(struct platform_device *pdev) 290static int bcm2835_thermal_remove(struct platform_device *pdev)
292{ 291{
293 struct thermal_zone_device *tz = platform_get_drvdata(pdev); 292 struct bcm2835_thermal_data *data = platform_get_drvdata(pdev);
294 struct bcm2835_thermal_data *data = tz->devdata; 293 struct thermal_zone_device *tz = data->tz;
295 294
296 debugfs_remove_recursive(data->debugfsdir); 295 debugfs_remove_recursive(data->debugfsdir);
297 thermal_zone_of_sensor_unregister(&pdev->dev, tz); 296 thermal_zone_of_sensor_unregister(&pdev->dev, tz);
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 6fff16113628..f7c1f49ec87f 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -536,12 +536,11 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev,
536 struct thermal_zone_device *tz, u32 power, 536 struct thermal_zone_device *tz, u32 power,
537 unsigned long *state) 537 unsigned long *state)
538{ 538{
539 unsigned int cur_freq, target_freq; 539 unsigned int target_freq;
540 u32 last_load, normalised_power; 540 u32 last_load, normalised_power;
541 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata; 541 struct cpufreq_cooling_device *cpufreq_cdev = cdev->devdata;
542 struct cpufreq_policy *policy = cpufreq_cdev->policy; 542 struct cpufreq_policy *policy = cpufreq_cdev->policy;
543 543
544 cur_freq = cpufreq_quick_get(policy->cpu);
545 power = power > 0 ? power : 0; 544 power = power > 0 ? power : 0;
546 last_load = cpufreq_cdev->last_load ?: 1; 545 last_load = cpufreq_cdev->last_load ?: 1;
547 normalised_power = (power * 100) / last_load; 546 normalised_power = (power * 100) / last_load;
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 61ca7ce3624e..5f3ed24e26ec 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -22,6 +22,13 @@ enum int3400_thermal_uuid {
22 INT3400_THERMAL_PASSIVE_1, 22 INT3400_THERMAL_PASSIVE_1,
23 INT3400_THERMAL_ACTIVE, 23 INT3400_THERMAL_ACTIVE,
24 INT3400_THERMAL_CRITICAL, 24 INT3400_THERMAL_CRITICAL,
25 INT3400_THERMAL_ADAPTIVE_PERFORMANCE,
26 INT3400_THERMAL_EMERGENCY_CALL_MODE,
27 INT3400_THERMAL_PASSIVE_2,
28 INT3400_THERMAL_POWER_BOSS,
29 INT3400_THERMAL_VIRTUAL_SENSOR,
30 INT3400_THERMAL_COOLING_MODE,
31 INT3400_THERMAL_HARDWARE_DUTY_CYCLING,
25 INT3400_THERMAL_MAXIMUM_UUID, 32 INT3400_THERMAL_MAXIMUM_UUID,
26}; 33};
27 34
@@ -29,6 +36,13 @@ static char *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = {
29 "42A441D6-AE6A-462b-A84B-4A8CE79027D3", 36 "42A441D6-AE6A-462b-A84B-4A8CE79027D3",
30 "3A95C389-E4B8-4629-A526-C52C88626BAE", 37 "3A95C389-E4B8-4629-A526-C52C88626BAE",
31 "97C68AE7-15FA-499c-B8C9-5DA81D606E0A", 38 "97C68AE7-15FA-499c-B8C9-5DA81D606E0A",
39 "63BE270F-1C11-48FD-A6F7-3AF253FF3E2D",
40 "5349962F-71E6-431D-9AE8-0A635B710AEE",
41 "9E04115A-AE87-4D1C-9500-0F3E340BFE75",
42 "F5A35014-C209-46A4-993A-EB56DE7530A1",
43 "6ED722A7-9240-48A5-B479-31EEF723D7CF",
44 "16CAF1B7-DD38-40ED-B1C1-1B8A1913D531",
45 "BE84BABF-C4D4-403D-B495-3128FD44dAC1",
32}; 46};
33 47
34struct int3400_thermal_priv { 48struct int3400_thermal_priv {
@@ -299,10 +313,9 @@ static int int3400_thermal_probe(struct platform_device *pdev)
299 313
300 platform_set_drvdata(pdev, priv); 314 platform_set_drvdata(pdev, priv);
301 315
302 if (priv->uuid_bitmap & 1 << INT3400_THERMAL_PASSIVE_1) { 316 int3400_thermal_ops.get_mode = int3400_thermal_get_mode;
303 int3400_thermal_ops.get_mode = int3400_thermal_get_mode; 317 int3400_thermal_ops.set_mode = int3400_thermal_set_mode;
304 int3400_thermal_ops.set_mode = int3400_thermal_set_mode; 318
305 }
306 priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0, 319 priv->thermal = thermal_zone_device_register("INT3400 Thermal", 0, 0,
307 priv, &int3400_thermal_ops, 320 priv, &int3400_thermal_ops,
308 &int3400_thermal_params, 0, 0); 321 &int3400_thermal_params, 0, 0);
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 7571f7c2e7c9..ac7256b5f020 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -101,7 +101,7 @@ struct powerclamp_worker_data {
101 bool clamping; 101 bool clamping;
102}; 102};
103 103
104static struct powerclamp_worker_data * __percpu worker_data; 104static struct powerclamp_worker_data __percpu *worker_data;
105static struct thermal_cooling_device *cooling_dev; 105static struct thermal_cooling_device *cooling_dev;
106static unsigned long *cpu_clamping_mask; /* bit map for tracking per cpu 106static unsigned long *cpu_clamping_mask; /* bit map for tracking per cpu
107 * clamping kthread worker 107 * clamping kthread worker
@@ -494,7 +494,7 @@ static void start_power_clamp_worker(unsigned long cpu)
494 struct powerclamp_worker_data *w_data = per_cpu_ptr(worker_data, cpu); 494 struct powerclamp_worker_data *w_data = per_cpu_ptr(worker_data, cpu);
495 struct kthread_worker *worker; 495 struct kthread_worker *worker;
496 496
497 worker = kthread_create_worker_on_cpu(cpu, 0, "kidle_inject/%ld", cpu); 497 worker = kthread_create_worker_on_cpu(cpu, 0, "kidle_inj/%ld", cpu);
498 if (IS_ERR(worker)) 498 if (IS_ERR(worker))
499 return; 499 return;
500 500
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index 5c07a61447d3..e4ea7f6aef20 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -199,6 +199,9 @@ enum {
199#define MT7622_TS1 0 199#define MT7622_TS1 0
200#define MT7622_NUM_CONTROLLER 1 200#define MT7622_NUM_CONTROLLER 1
201 201
202/* The maximum number of banks */
203#define MAX_NUM_ZONES 8
204
202/* The calibration coefficient of sensor */ 205/* The calibration coefficient of sensor */
203#define MT7622_CALIBRATION 165 206#define MT7622_CALIBRATION 165
204 207
@@ -249,7 +252,7 @@ struct mtk_thermal_data {
249 const int num_controller; 252 const int num_controller;
250 const int *controller_offset; 253 const int *controller_offset;
251 bool need_switch_bank; 254 bool need_switch_bank;
252 struct thermal_bank_cfg bank_data[]; 255 struct thermal_bank_cfg bank_data[MAX_NUM_ZONES];
253}; 256};
254 257
255struct mtk_thermal { 258struct mtk_thermal {
@@ -268,7 +271,7 @@ struct mtk_thermal {
268 s32 vts[MAX_NUM_VTS]; 271 s32 vts[MAX_NUM_VTS];
269 272
270 const struct mtk_thermal_data *conf; 273 const struct mtk_thermal_data *conf;
271 struct mtk_thermal_bank banks[]; 274 struct mtk_thermal_bank banks[MAX_NUM_ZONES];
272}; 275};
273 276
274/* MT8183 thermal sensor data */ 277/* MT8183 thermal sensor data */
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 48eef552cba4..fc9399d9c082 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -666,7 +666,7 @@ static int exynos_get_temp(void *p, int *temp)
666 struct exynos_tmu_data *data = p; 666 struct exynos_tmu_data *data = p;
667 int value, ret = 0; 667 int value, ret = 0;
668 668
669 if (!data || !data->tmu_read || !data->enabled) 669 if (!data || !data->tmu_read)
670 return -EINVAL; 670 return -EINVAL;
671 else if (!data->enabled) 671 else if (!data->enabled)
672 /* 672 /*