Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 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 | */ |
Eduardo Valentin | 097ca6a | 2013-03-19 10:54:20 -0400 | [diff] [blame] | 23 | #ifndef __TI_THERMAL_H |
| 24 | #define __TI_THERMAL_H |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 25 | |
Eduardo Valentin | 7372add | 2013-03-19 10:54:19 -0400 | [diff] [blame] | 26 | #include "ti-bandgap.h" |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 27 | |
| 28 | /* sensors gradient and offsets */ |
Eduardo Valentin | b763fda | 2013-04-08 08:19:10 -0400 | [diff] [blame] | 29 | #define OMAP_GRADIENT_SLOPE_4430 0 |
| 30 | #define OMAP_GRADIENT_CONST_4430 20000 |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 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 | |
Eduardo Valentin | 21bf220 | 2013-04-08 08:19:11 -0400 | [diff] [blame] | 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 |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 40 | |
Eduardo Valentin | 8926fa4 | 2013-06-03 20:31:55 +0000 | [diff] [blame] | 41 | #define DRA752_GRADIENT_SLOPE 0 |
| 42 | #define DRA752_GRADIENT_CONST 2000 |
| 43 | |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 44 | /* PCB sensor calculation constants */ |
Eduardo Valentin | b763fda | 2013-04-08 08:19:10 -0400 | [diff] [blame] | 45 | #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0 |
| 46 | #define OMAP_GRADIENT_CONST_W_PCB_4430 20000 |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 47 | #define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142 |
| 48 | #define OMAP_GRADIENT_CONST_W_PCB_4460 -393 |
| 49 | #define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063 |
| 50 | #define OMAP_GRADIENT_CONST_W_PCB_4470 -477 |
| 51 | |
Eduardo Valentin | 21bf220 | 2013-04-08 08:19:11 -0400 | [diff] [blame] | 52 | #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100 |
| 53 | #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484 |
| 54 | #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464 |
| 55 | #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102 |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 56 | |
Eduardo Valentin | 8926fa4 | 2013-06-03 20:31:55 +0000 | [diff] [blame] | 57 | #define DRA752_GRADIENT_SLOPE_W_PCB 0 |
| 58 | #define DRA752_GRADIENT_CONST_W_PCB 2000 |
| 59 | |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 60 | /* trip points of interest in milicelsius (at hotspot level) */ |
| 61 | #define OMAP_TRIP_COLD 100000 |
| 62 | #define OMAP_TRIP_HOT 110000 |
| 63 | #define OMAP_TRIP_SHUTDOWN 125000 |
| 64 | #define OMAP_TRIP_NUMBER 2 |
| 65 | #define OMAP_TRIP_STEP \ |
| 66 | ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1)) |
| 67 | |
| 68 | /* Update rates */ |
| 69 | #define FAST_TEMP_MONITORING_RATE 250 |
| 70 | |
| 71 | /* helper macros */ |
| 72 | /** |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 73 | * ti_thermal_get_trip_value - returns trip temperature based on index |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 74 | * @i: trip index |
| 75 | */ |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 76 | #define ti_thermal_get_trip_value(i) \ |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 77 | (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP)) |
| 78 | |
| 79 | /** |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 80 | * ti_thermal_is_valid_trip - check for trip index |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 81 | * @i: trip index |
| 82 | */ |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 83 | #define ti_thermal_is_valid_trip(trip) \ |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 84 | ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER) |
| 85 | |
Eduardo Valentin | 097ca6a | 2013-03-19 10:54:20 -0400 | [diff] [blame] | 86 | #ifdef CONFIG_TI_THERMAL |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 87 | int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain); |
| 88 | int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id); |
Eduardo Valentin | 8c99c16 | 2013-04-01 12:04:35 -0400 | [diff] [blame] | 89 | int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id); |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 90 | int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id); |
| 91 | int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id); |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 92 | #else |
| 93 | static inline |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 94 | int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain) |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 95 | { |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | static inline |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 100 | int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 101 | { |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static inline |
Eduardo Valentin | 8c99c16 | 2013-04-01 12:04:35 -0400 | [diff] [blame] | 106 | int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id) |
| 107 | { |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | static inline |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 112 | int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id) |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 113 | { |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | static inline |
Eduardo Valentin | 03e859d | 2013-03-19 10:54:21 -0400 | [diff] [blame] | 118 | int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) |
Eduardo Valentin | 445eaf8 | 2012-07-12 19:02:30 +0300 | [diff] [blame] | 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | #endif |
| 123 | #endif |