aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 22:27:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-12 22:27:59 -0400
commita3920a6efa158b445b8a39080b463b9b29337425 (patch)
tree1726a21d317bea8039c1f0f041b7443af76f6ca1 /include
parent18a022de47bc11ee20d7d0f4dd72d42d2cfdc51c (diff)
parentd1d4a81b842db21b144ffd2334ca5eee3eb740f3 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Pull ACPI & Thermal updates from Len Brown: "The generic Linux thermal layer is gaining some new capabilities (generic cooling via cpufreq) and some new customers (ARM). Also, an ACPI EC bug fix plus a regression fix." * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux: (30 commits) tools/power/acpi/acpidump: remove duplicated include from acpidump.c ACPI idle, CPU hotplug: Fix NULL pointer dereference during hotplug cpuidle / ACPI: fix potential NULL pointer dereference ACPI: EC: Add a quirk for CLEVO M720T/M730T laptop ACPI: EC: Make the GPE storm threshold a module parameter thermal: Exynos: Fix NULL pointer dereference in exynos_unregister_thermal() Thermal: Fix bug on cpu_cooling, cooling device's id conflict problem. thermal: exynos: Use devm_* functions ARM: exynos: add thermal sensor driver platform data support thermal: exynos: register the tmu sensor with the kernel thermal layer thermal: exynos5: add exynos5250 thermal sensor driver support hwmon: exynos4: move thermal sensor driver to driver/thermal directory thermal: add generic cpufreq cooling implementation Fix a build error. thermal: Fix potential NULL pointer accesses thermal: add Renesas R-Car thermal sensor support thermal: fix potential out-of-bounds memory access Thermal: Introduce locking for cdev.thermal_instances list. Thermal: Unify the code for both active and passive cooling Thermal: Introduce simple arbitrator for setting device cooling state ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/cpu_cooling.h58
-rw-r--r--include/linux/platform_data/exynos_thermal.h (renamed from include/linux/platform_data/exynos4_tmu.h)47
-rw-r--r--include/linux/thermal.h28
3 files changed, 118 insertions, 15 deletions
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
new file mode 100644
index 000000000000..851530128e65
--- /dev/null
+++ b/include/linux/cpu_cooling.h
@@ -0,0 +1,58 @@
1/*
2 * linux/include/linux/cpu_cooling.h
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23
24#ifndef __CPU_COOLING_H__
25#define __CPU_COOLING_H__
26
27#include <linux/thermal.h>
28
29#define CPUFREQ_COOLING_START 0
30#define CPUFREQ_COOLING_STOP 1
31
32#ifdef CONFIG_CPU_THERMAL
33/**
34 * cpufreq_cooling_register - function to create cpufreq cooling device.
35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 */
37struct thermal_cooling_device *cpufreq_cooling_register(
38 struct cpumask *clip_cpus);
39
40/**
41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
42 * @cdev: thermal cooling device pointer.
43 */
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device *cpufreq_cooling_register(
47 struct cpumask *clip_cpus)
48{
49 return NULL;
50}
51static inline void cpufreq_cooling_unregister(
52 struct thermal_cooling_device *cdev)
53{
54 return;
55}
56#endif /* CONFIG_CPU_THERMAL */
57
58#endif /* __CPU_COOLING_H__ */
diff --git a/include/linux/platform_data/exynos4_tmu.h b/include/linux/platform_data/exynos_thermal.h
index 39e038cca590..a7bdb2f63b73 100644
--- a/include/linux/platform_data/exynos4_tmu.h
+++ b/include/linux/platform_data/exynos_thermal.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * exynos4_tmu.h - Samsung EXYNOS4 TMU (Thermal Management Unit) 2 * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics 4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com> 5 * Donggeun Kim <dg77.kim@samsung.com>
@@ -19,8 +19,9 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#ifndef _LINUX_EXYNOS4_TMU_H 22#ifndef _LINUX_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS4_TMU_H 23#define _LINUX_EXYNOS_THERMAL_H
24#include <linux/cpu_cooling.h>
24 25
25enum calibration_type { 26enum calibration_type {
26 TYPE_ONE_POINT_TRIMMING, 27 TYPE_ONE_POINT_TRIMMING,
@@ -28,8 +29,28 @@ enum calibration_type {
28 TYPE_NONE, 29 TYPE_NONE,
29}; 30};
30 31
32enum soc_type {
33 SOC_ARCH_EXYNOS4210 = 1,
34 SOC_ARCH_EXYNOS,
35};
36/**
37 * struct freq_clip_table
38 * @freq_clip_max: maximum frequency allowed for this cooling state.
39 * @temp_level: Temperature level at which the temperature clipping will
40 * happen.
41 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
42 *
43 * This structure is required to be filled and passed to the
44 * cpufreq_cooling_unregister function.
45 */
46struct freq_clip_table {
47 unsigned int freq_clip_max;
48 unsigned int temp_level;
49 const struct cpumask *mask_val;
50};
51
31/** 52/**
32 * struct exynos4_tmu_platform_data 53 * struct exynos_tmu_platform_data
33 * @threshold: basic temperature for generating interrupt 54 * @threshold: basic temperature for generating interrupt
34 * 25 <= threshold <= 125 [unit: degree Celsius] 55 * 25 <= threshold <= 125 [unit: degree Celsius]
35 * @trigger_levels: array for each interrupt levels 56 * @trigger_levels: array for each interrupt levels
@@ -63,11 +84,18 @@ enum calibration_type {
63 * @reference_voltage: reference voltage of amplifier 84 * @reference_voltage: reference voltage of amplifier
64 * in the positive-TC generator block 85 * in the positive-TC generator block
65 * 0 <= reference_voltage <= 31 86 * 0 <= reference_voltage <= 31
87 * @noise_cancel_mode: noise cancellation mode
88 * 000, 100, 101, 110 and 111 can be different modes
89 * @type: determines the type of SOC
90 * @efuse_value: platform defined fuse value
66 * @cal_type: calibration type for temperature 91 * @cal_type: calibration type for temperature
92 * @freq_clip_table: Table representing frequency reduction percentage.
93 * @freq_tab_count: Count of the above table as frequency reduction may
94 * applicable to only some of the trigger levels.
67 * 95 *
68 * This structure is required for configuration of exynos4_tmu driver. 96 * This structure is required for configuration of exynos_tmu driver.
69 */ 97 */
70struct exynos4_tmu_platform_data { 98struct exynos_tmu_platform_data {
71 u8 threshold; 99 u8 threshold;
72 u8 trigger_levels[4]; 100 u8 trigger_levels[4];
73 bool trigger_level0_en; 101 bool trigger_level0_en;
@@ -77,7 +105,12 @@ struct exynos4_tmu_platform_data {
77 105
78 u8 gain; 106 u8 gain;
79 u8 reference_voltage; 107 u8 reference_voltage;
108 u8 noise_cancel_mode;
109 u32 efuse_value;
80 110
81 enum calibration_type cal_type; 111 enum calibration_type cal_type;
112 enum soc_type type;
113 struct freq_clip_table freq_tab[4];
114 unsigned int freq_tab_count;
82}; 115};
83#endif /* _LINUX_EXYNOS4_TMU_H */ 116#endif /* _LINUX_EXYNOS_THERMAL_H */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 4b94a61955df..91b34812cd84 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,6 +44,12 @@ enum thermal_trip_type {
44 THERMAL_TRIP_CRITICAL, 44 THERMAL_TRIP_CRITICAL,
45}; 45};
46 46
47enum thermal_trend {
48 THERMAL_TREND_STABLE, /* temperature is stable */
49 THERMAL_TREND_RAISING, /* temperature is raising */
50 THERMAL_TREND_DROPPING, /* temperature is dropping */
51};
52
47struct thermal_zone_device_ops { 53struct thermal_zone_device_ops {
48 int (*bind) (struct thermal_zone_device *, 54 int (*bind) (struct thermal_zone_device *,
49 struct thermal_cooling_device *); 55 struct thermal_cooling_device *);
@@ -65,6 +71,8 @@ struct thermal_zone_device_ops {
65 int (*set_trip_hyst) (struct thermal_zone_device *, int, 71 int (*set_trip_hyst) (struct thermal_zone_device *, int,
66 unsigned long); 72 unsigned long);
67 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 73 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
74 int (*get_trend) (struct thermal_zone_device *, int,
75 enum thermal_trend *);
68 int (*notify) (struct thermal_zone_device *, int, 76 int (*notify) (struct thermal_zone_device *, int,
69 enum thermal_trip_type); 77 enum thermal_trip_type);
70}; 78};
@@ -75,6 +83,8 @@ struct thermal_cooling_device_ops {
75 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); 83 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
76}; 84};
77 85
86#define THERMAL_NO_LIMIT -1UL /* no upper/lower limit requirement */
87
78#define THERMAL_TRIPS_NONE -1 88#define THERMAL_TRIPS_NONE -1
79#define THERMAL_MAX_TRIPS 12 89#define THERMAL_MAX_TRIPS 12
80#define THERMAL_NAME_LENGTH 20 90#define THERMAL_NAME_LENGTH 20
@@ -84,6 +94,9 @@ struct thermal_cooling_device {
84 struct device device; 94 struct device device;
85 void *devdata; 95 void *devdata;
86 const struct thermal_cooling_device_ops *ops; 96 const struct thermal_cooling_device_ops *ops;
97 bool updated; /* true if the cooling device does not need update */
98 struct mutex lock; /* protect thermal_instances list */
99 struct list_head thermal_instances;
87 struct list_head node; 100 struct list_head node;
88}; 101};
89 102
@@ -105,17 +118,16 @@ struct thermal_zone_device {
105 struct thermal_attr *trip_hyst_attrs; 118 struct thermal_attr *trip_hyst_attrs;
106 void *devdata; 119 void *devdata;
107 int trips; 120 int trips;
108 int tc1;
109 int tc2;
110 int passive_delay; 121 int passive_delay;
111 int polling_delay; 122 int polling_delay;
123 int temperature;
112 int last_temperature; 124 int last_temperature;
113 bool passive; 125 int passive;
114 unsigned int forced_passive; 126 unsigned int forced_passive;
115 const struct thermal_zone_device_ops *ops; 127 const struct thermal_zone_device_ops *ops;
116 struct list_head cooling_devices; 128 struct list_head thermal_instances;
117 struct idr idr; 129 struct idr idr;
118 struct mutex lock; /* protect cooling devices list */ 130 struct mutex lock; /* protect thermal_instances list */
119 struct list_head node; 131 struct list_head node;
120 struct delayed_work poll_queue; 132 struct delayed_work poll_queue;
121}; 133};
@@ -152,12 +164,12 @@ enum {
152#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) 164#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
153 165
154struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 166struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
155 void *, const struct thermal_zone_device_ops *, int tc1, 167 void *, const struct thermal_zone_device_ops *, int, int);
156 int tc2, int passive_freq, int polling_freq);
157void thermal_zone_device_unregister(struct thermal_zone_device *); 168void thermal_zone_device_unregister(struct thermal_zone_device *);
158 169
159int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 170int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
160 struct thermal_cooling_device *); 171 struct thermal_cooling_device *,
172 unsigned long, unsigned long);
161int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 173int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
162 struct thermal_cooling_device *); 174 struct thermal_cooling_device *);
163void thermal_zone_device_update(struct thermal_zone_device *); 175void thermal_zone_device_update(struct thermal_zone_device *);