ti-thermal.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #include "ti-bandgap.h"
  26. /* sensors gradient and offsets */
  27. #define OMAP_GRADIENT_SLOPE_4430 0
  28. #define OMAP_GRADIENT_CONST_4430 20000
  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. #define OMAP_GRADIENT_SLOPE_5430_CPU 65
  34. #define OMAP_GRADIENT_CONST_5430_CPU -1791
  35. #define OMAP_GRADIENT_SLOPE_5430_GPU 117
  36. #define OMAP_GRADIENT_CONST_5430_GPU -2992
  37. #define DRA752_GRADIENT_SLOPE 0
  38. #define DRA752_GRADIENT_CONST 2000
  39. /* PCB sensor calculation constants */
  40. #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
  41. #define OMAP_GRADIENT_CONST_W_PCB_4430 20000
  42. #define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142
  43. #define OMAP_GRADIENT_CONST_W_PCB_4460 -393
  44. #define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063
  45. #define OMAP_GRADIENT_CONST_W_PCB_4470 -477
  46. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
  47. #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
  48. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
  49. #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
  50. #define DRA752_GRADIENT_SLOPE_W_PCB 0
  51. #define DRA752_GRADIENT_CONST_W_PCB 2000
  52. /* trip points of interest in milicelsius (at hotspot level) */
  53. #define OMAP_TRIP_COLD 100000
  54. #define OMAP_TRIP_HOT 110000
  55. #define OMAP_TRIP_SHUTDOWN 125000
  56. #define OMAP_TRIP_NUMBER 2
  57. #define OMAP_TRIP_STEP \
  58. ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
  59. /* Update rates */
  60. #define FAST_TEMP_MONITORING_RATE 250
  61. /* helper macros */
  62. /**
  63. * ti_thermal_get_trip_value - returns trip temperature based on index
  64. * @i: trip index
  65. */
  66. #define ti_thermal_get_trip_value(i) \
  67. (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
  68. /**
  69. * ti_thermal_is_valid_trip - check for trip index
  70. * @i: trip index
  71. */
  72. #define ti_thermal_is_valid_trip(trip) \
  73. ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
  74. #ifdef CONFIG_TI_THERMAL
  75. int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
  76. int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
  77. int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
  78. int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
  79. int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
  80. #else
  81. static inline
  82. int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
  83. {
  84. return 0;
  85. }
  86. static inline
  87. int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
  88. {
  89. return 0;
  90. }
  91. static inline
  92. int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
  93. {
  94. return 0;
  95. }
  96. static inline
  97. int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
  98. {
  99. return 0;
  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