]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/thermal/ti-soc-thermal/ti-thermal.h
Merge tag 'jfs-4.13' of git://github.com/kleikamp/linux-shaggy
[mirror_ubuntu-jammy-kernel.git] / drivers / thermal / ti-soc-thermal / ti-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 __TI_THERMAL_H
24 #define __TI_THERMAL_H
25
26 #include "ti-bandgap.h"
27
28 /* PCB sensor calculation constants */
29 #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
30 #define OMAP_GRADIENT_CONST_W_PCB_4430 20000
31 #define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142
32 #define OMAP_GRADIENT_CONST_W_PCB_4460 -393
33 #define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063
34 #define OMAP_GRADIENT_CONST_W_PCB_4470 -477
35
36 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
37 #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
38 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
39 #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
40
41 #define DRA752_GRADIENT_SLOPE_W_PCB 0
42 #define DRA752_GRADIENT_CONST_W_PCB 2000
43
44 /* trip points of interest in milicelsius (at hotspot level) */
45 #define OMAP_TRIP_COLD 100000
46 #define OMAP_TRIP_HOT 110000
47 #define OMAP_TRIP_SHUTDOWN 125000
48 #define OMAP_TRIP_NUMBER 2
49 #define OMAP_TRIP_STEP \
50 ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
51
52 /* Update rates */
53 #define FAST_TEMP_MONITORING_RATE 250
54
55 /* helper macros */
56 /**
57 * ti_thermal_get_trip_value - returns trip temperature based on index
58 * @i: trip index
59 */
60 #define ti_thermal_get_trip_value(i) \
61 (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
62
63 /**
64 * ti_thermal_is_valid_trip - check for trip index
65 * @i: trip index
66 */
67 #define ti_thermal_is_valid_trip(trip) \
68 ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
69
70 #ifdef CONFIG_TI_THERMAL
71 int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
72 int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
73 int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
74 int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
75 int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
76 #else
77 static inline
78 int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
79 {
80 return 0;
81 }
82
83 static inline
84 int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
85 {
86 return 0;
87 }
88
89 static inline
90 int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
91 {
92 return 0;
93 }
94
95 static inline
96 int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
97 {
98 return 0;
99 }
100
101 static inline
102 int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
103 {
104 return 0;
105 }
106 #endif
107 #endif