]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/thermal/samsung/exynos_tmu.h
Merge tag 'stable/for-linus-3.19-rc4-tag' of git://git.kernel.org/pub/scm/linux/kerne...
[mirror_ubuntu-zesty-kernel.git] / drivers / thermal / samsung / exynos_tmu.h
1 /*
2 * exynos_tmu.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.daniel@samsung.com>
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; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #ifndef _EXYNOS_TMU_H
24 #define _EXYNOS_TMU_H
25 #include <linux/cpu_cooling.h>
26
27 #include "exynos_thermal_common.h"
28
29 enum calibration_type {
30 TYPE_ONE_POINT_TRIMMING,
31 TYPE_ONE_POINT_TRIMMING_25,
32 TYPE_ONE_POINT_TRIMMING_85,
33 TYPE_TWO_POINT_TRIMMING,
34 TYPE_NONE,
35 };
36
37 enum soc_type {
38 SOC_ARCH_EXYNOS3250 = 1,
39 SOC_ARCH_EXYNOS4210,
40 SOC_ARCH_EXYNOS4412,
41 SOC_ARCH_EXYNOS5250,
42 SOC_ARCH_EXYNOS5260,
43 SOC_ARCH_EXYNOS5420,
44 SOC_ARCH_EXYNOS5420_TRIMINFO,
45 SOC_ARCH_EXYNOS5440,
46 };
47
48 /**
49 * struct exynos_tmu_platform_data
50 * @threshold: basic temperature for generating interrupt
51 * 25 <= threshold <= 125 [unit: degree Celsius]
52 * @threshold_falling: differntial value for setting threshold
53 * of temperature falling interrupt.
54 * @trigger_levels: array for each interrupt levels
55 * [unit: degree Celsius]
56 * 0: temperature for trigger_level0 interrupt
57 * condition for trigger_level0 interrupt:
58 * current temperature > threshold + trigger_levels[0]
59 * 1: temperature for trigger_level1 interrupt
60 * condition for trigger_level1 interrupt:
61 * current temperature > threshold + trigger_levels[1]
62 * 2: temperature for trigger_level2 interrupt
63 * condition for trigger_level2 interrupt:
64 * current temperature > threshold + trigger_levels[2]
65 * 3: temperature for trigger_level3 interrupt
66 * condition for trigger_level3 interrupt:
67 * current temperature > threshold + trigger_levels[3]
68 * @trigger_type: defines the type of trigger. Possible values are,
69 * THROTTLE_ACTIVE trigger type
70 * THROTTLE_PASSIVE trigger type
71 * SW_TRIP trigger type
72 * HW_TRIP
73 * @trigger_enable[]: array to denote which trigger levels are enabled.
74 * 1 = enable trigger_level[] interrupt,
75 * 0 = disable trigger_level[] interrupt
76 * @max_trigger_level: max trigger level supported by the TMU
77 * @non_hw_trigger_levels: number of defined non-hardware trigger levels
78 * @gain: gain of amplifier in the positive-TC generator block
79 * 0 < gain <= 15
80 * @reference_voltage: reference voltage of amplifier
81 * in the positive-TC generator block
82 * 0 < reference_voltage <= 31
83 * @noise_cancel_mode: noise cancellation mode
84 * 000, 100, 101, 110 and 111 can be different modes
85 * @type: determines the type of SOC
86 * @efuse_value: platform defined fuse value
87 * @min_efuse_value: minimum valid trimming data
88 * @max_efuse_value: maximum valid trimming data
89 * @first_point_trim: temp value of the first point trimming
90 * @second_point_trim: temp value of the second point trimming
91 * @default_temp_offset: default temperature offset in case of no trimming
92 * @cal_type: calibration type for temperature
93 * @freq_clip_table: Table representing frequency reduction percentage.
94 * @freq_tab_count: Count of the above table as frequency reduction may
95 * applicable to only some of the trigger levels.
96 *
97 * This structure is required for configuration of exynos_tmu driver.
98 */
99 struct exynos_tmu_platform_data {
100 u8 threshold;
101 u8 threshold_falling;
102 u8 trigger_levels[MAX_TRIP_COUNT];
103 enum trigger_type trigger_type[MAX_TRIP_COUNT];
104 bool trigger_enable[MAX_TRIP_COUNT];
105 u8 max_trigger_level;
106 u8 non_hw_trigger_levels;
107 u8 gain;
108 u8 reference_voltage;
109 u8 noise_cancel_mode;
110
111 u32 efuse_value;
112 u32 min_efuse_value;
113 u32 max_efuse_value;
114 u8 first_point_trim;
115 u8 second_point_trim;
116 u8 default_temp_offset;
117
118 enum calibration_type cal_type;
119 enum soc_type type;
120 struct freq_clip_table freq_tab[4];
121 unsigned int freq_tab_count;
122 };
123
124 /**
125 * struct exynos_tmu_init_data
126 * @tmu_count: number of TMU instances.
127 * @tmu_data: platform data of all TMU instances.
128 * This structure is required to store data for multi-instance exynos tmu
129 * driver.
130 */
131 struct exynos_tmu_init_data {
132 int tmu_count;
133 struct exynos_tmu_platform_data tmu_data[];
134 };
135
136 extern struct exynos_tmu_init_data const exynos3250_default_tmu_data;
137 extern struct exynos_tmu_init_data const exynos4210_default_tmu_data;
138 extern struct exynos_tmu_init_data const exynos4412_default_tmu_data;
139 extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
140 extern struct exynos_tmu_init_data const exynos5260_default_tmu_data;
141 extern struct exynos_tmu_init_data const exynos5420_default_tmu_data;
142 extern struct exynos_tmu_init_data const exynos5440_default_tmu_data;
143
144 #endif /* _EXYNOS_TMU_H */