thermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL
[linux-2.6-block.git] / drivers / thermal / ti-soc-thermal / ti-thermal.h
CommitLineData
445eaf87
EV
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 */
097ca6a3
EV
23#ifndef __TI_THERMAL_H
24#define __TI_THERMAL_H
445eaf87 25
7372add4 26#include "ti-bandgap.h"
445eaf87
EV
27
28/* sensors gradient and offsets */
b763fdae
EV
29#define OMAP_GRADIENT_SLOPE_4430 0
30#define OMAP_GRADIENT_CONST_4430 20000
445eaf87
EV
31#define OMAP_GRADIENT_SLOPE_4460 348
32#define OMAP_GRADIENT_CONST_4460 -9301
33#define OMAP_GRADIENT_SLOPE_4470 308
34#define OMAP_GRADIENT_CONST_4470 -7896
35
21bf2202
EV
36#define OMAP_GRADIENT_SLOPE_5430_CPU 65
37#define OMAP_GRADIENT_CONST_5430_CPU -1791
38#define OMAP_GRADIENT_SLOPE_5430_GPU 117
39#define OMAP_GRADIENT_CONST_5430_GPU -2992
445eaf87
EV
40
41/* PCB sensor calculation constants */
b763fdae
EV
42#define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
43#define OMAP_GRADIENT_CONST_W_PCB_4430 20000
445eaf87
EV
44#define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142
45#define OMAP_GRADIENT_CONST_W_PCB_4460 -393
46#define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063
47#define OMAP_GRADIENT_CONST_W_PCB_4470 -477
48
21bf2202
EV
49#define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
50#define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
51#define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
52#define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
445eaf87
EV
53
54/* trip points of interest in milicelsius (at hotspot level) */
55#define OMAP_TRIP_COLD 100000
56#define OMAP_TRIP_HOT 110000
57#define OMAP_TRIP_SHUTDOWN 125000
58#define OMAP_TRIP_NUMBER 2
59#define OMAP_TRIP_STEP \
60 ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
61
62/* Update rates */
63#define FAST_TEMP_MONITORING_RATE 250
64
65/* helper macros */
66/**
03e859d3 67 * ti_thermal_get_trip_value - returns trip temperature based on index
445eaf87
EV
68 * @i: trip index
69 */
03e859d3 70#define ti_thermal_get_trip_value(i) \
445eaf87
EV
71 (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
72
73/**
03e859d3 74 * ti_thermal_is_valid_trip - check for trip index
445eaf87
EV
75 * @i: trip index
76 */
03e859d3 77#define ti_thermal_is_valid_trip(trip) \
445eaf87
EV
78 ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
79
097ca6a3 80#ifdef CONFIG_TI_THERMAL
03e859d3
EV
81int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
82int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
8c99c166 83int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
03e859d3
EV
84int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
85int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
445eaf87
EV
86#else
87static inline
03e859d3 88int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
445eaf87
EV
89{
90 return 0;
91}
92
93static inline
03e859d3 94int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
445eaf87
EV
95{
96 return 0;
97}
98
8c99c166
EV
99static inline
100int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
101{
102 return 0;
103}
104
445eaf87 105static inline
03e859d3 106int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
445eaf87
EV
107{
108 return 0;
109}
110
111static inline
03e859d3 112int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
445eaf87
EV
113{
114 return 0;
115}
116#endif
117#endif