Linux-libre 3.6.3-gnu1
[librecmc/linux-libre.git] / drivers / staging / omap-thermal / omap-thermal.h
1 /*
2  * OMAP thermal definitions
3  *
4  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5  * Contact:
6  *   Eduardo Valentin <eduardo.valentin@ti.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
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
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 #ifndef __OMAP_THERMAL_H
24 #define __OMAP_THERMAL_H
25
26 #include "omap-bandgap.h"
27
28 /* sensors gradient and offsets */
29 #define OMAP_GRADIENT_SLOPE_4460                                348
30 #define OMAP_GRADIENT_CONST_4460                                -9301
31 #define OMAP_GRADIENT_SLOPE_4470                                308
32 #define OMAP_GRADIENT_CONST_4470                                -7896
33
34 #define OMAP_GRADIENT_SLOPE_5430_CPU                            196
35 #define OMAP_GRADIENT_CONST_5430_CPU                            -6822
36 #define OMAP_GRADIENT_SLOPE_5430_GPU                            64
37 #define OMAP_GRADIENT_CONST_5430_GPU                            978
38
39 /* PCB sensor calculation constants */
40 #define OMAP_GRADIENT_SLOPE_W_PCB_4460                          1142
41 #define OMAP_GRADIENT_CONST_W_PCB_4460                          -393
42 #define OMAP_GRADIENT_SLOPE_W_PCB_4470                          1063
43 #define OMAP_GRADIENT_CONST_W_PCB_4470                          -477
44
45 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU                      469
46 #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU                      -1272
47 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU                      378
48 #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU                      154
49
50 /* trip points of interest in milicelsius (at hotspot level) */
51 #define OMAP_TRIP_COLD                                          100000
52 #define OMAP_TRIP_HOT                                           110000
53 #define OMAP_TRIP_SHUTDOWN                                      125000
54 #define OMAP_TRIP_NUMBER                                        2
55 #define OMAP_TRIP_STEP                                                  \
56         ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
57
58 /* Update rates */
59 #define FAST_TEMP_MONITORING_RATE                               250
60
61 /* helper macros */
62 /**
63  * omap_thermal_get_trip_value - returns trip temperature based on index
64  * @i:  trip index
65  */
66 #define omap_thermal_get_trip_value(i)                                  \
67         (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
68
69 /**
70  * omap_thermal_is_valid_trip - check for trip index
71  * @i:  trip index
72  */
73 #define omap_thermal_is_valid_trip(trip)                                \
74         ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
75
76 #ifdef CONFIG_OMAP_THERMAL
77 int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id,
78                                char *domain);
79 int omap_thermal_remove_sensor(struct omap_bandgap *bg_ptr, int id);
80 int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id);
81 int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bg_ptr, int id);
82 #else
83 static inline
84 int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id,
85                                char *domain)
86 {
87         return 0;
88 }
89
90 static inline
91 int omap_thermal_remove_sensor(struct omap_bandgap *bg_ptr, int id)
92 {
93         return 0;
94 }
95
96 static inline
97 int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id)
98 {
99         return 0;
100 }
101
102 static inline
103 int omap_thermal_unregister_cpu_cooling(struct omap_bandgap *bg_ptr, int id)
104 {
105         return 0;
106 }
107 #endif
108 #endif