Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[deliverable/linux.git] / drivers / thermal / samsung / exynos_thermal_common.h
1 /*
2 * exynos_thermal_common.h - Samsung EXYNOS common header file
3 *
4 * Copyright (C) 2013 Samsung Electronics
5 * Amit Daniel Kachhap <amit.daniel@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23 #ifndef _EXYNOS_THERMAL_COMMON_H
24 #define _EXYNOS_THERMAL_COMMON_H
25
26 /* In-kernel thermal framework related macros & definations */
27 #define SENSOR_NAME_LEN 16
28 #define MAX_TRIP_COUNT 8
29 #define MAX_COOLING_DEVICE 4
30 #define MAX_THRESHOLD_LEVS 5
31
32 #define ACTIVE_INTERVAL 500
33 #define IDLE_INTERVAL 10000
34 #define MCELSIUS 1000
35
36 /* CPU Zone information */
37 #define PANIC_ZONE 4
38 #define WARN_ZONE 3
39 #define MONITOR_ZONE 2
40 #define SAFE_ZONE 1
41
42 #define GET_ZONE(trip) (trip + 2)
43 #define GET_TRIP(zone) (zone - 2)
44
45 enum trigger_type {
46 THROTTLE_ACTIVE = 1,
47 THROTTLE_PASSIVE,
48 SW_TRIP,
49 HW_TRIP,
50 };
51
52 /**
53 * struct freq_clip_table
54 * @freq_clip_max: maximum frequency allowed for this cooling state.
55 * @temp_level: Temperature level at which the temperature clipping will
56 * happen.
57 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
58 *
59 * This structure is required to be filled and passed to the
60 * cpufreq_cooling_unregister function.
61 */
62 struct freq_clip_table {
63 unsigned int freq_clip_max;
64 unsigned int temp_level;
65 const struct cpumask *mask_val;
66 };
67
68 struct thermal_trip_point_conf {
69 int trip_val[MAX_TRIP_COUNT];
70 int trip_type[MAX_TRIP_COUNT];
71 int trip_count;
72 unsigned char trigger_falling;
73 };
74
75 struct thermal_cooling_conf {
76 struct freq_clip_table freq_data[MAX_TRIP_COUNT];
77 int freq_clip_count;
78 };
79
80 struct thermal_sensor_conf {
81 char name[SENSOR_NAME_LEN];
82 int (*read_temperature)(void *data);
83 int (*write_emul_temp)(void *drv_data, unsigned long temp);
84 struct thermal_trip_point_conf trip_data;
85 struct thermal_cooling_conf cooling_data;
86 void *driver_data;
87 void *pzone_data;
88 struct device *dev;
89 };
90
91 /*Functions used exynos based thermal sensor driver*/
92 #ifdef CONFIG_EXYNOS_THERMAL_CORE
93 void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf);
94 int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf);
95 void exynos_report_trigger(struct thermal_sensor_conf *sensor_conf);
96 #else
97 static inline void
98 exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) { return; }
99
100 static inline int
101 exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) { return 0; }
102
103 static inline void
104 exynos_report_trigger(struct thermal_sensor_conf *sensor_conf) { return; }
105
106 #endif /* CONFIG_EXYNOS_THERMAL_CORE */
107 #endif /* _EXYNOS_THERMAL_COMMON_H */
This page took 0.032561 seconds and 6 git commands to generate.