ti-thermal.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. /* PCB sensor calculation constants */
  38. #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
  39. #define OMAP_GRADIENT_CONST_W_PCB_4430 20000
  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. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
  45. #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
  46. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
  47. #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
  48. /* trip points of interest in milicelsius (at hotspot level) */
  49. #define OMAP_TRIP_COLD 100000
  50. #define OMAP_TRIP_HOT 110000
  51. #define OMAP_TRIP_SHUTDOWN 125000
  52. #define OMAP_TRIP_NUMBER 2
  53. #define OMAP_TRIP_STEP \
  54. ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
  55. /* Update rates */
  56. #define FAST_TEMP_MONITORING_RATE 250
  57. /* helper macros */
  58. /**
  59. * ti_thermal_get_trip_value - returns trip temperature based on index
  60. * @i: trip index
  61. */
  62. #define ti_thermal_get_trip_value(i) \
  63. (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
  64. /**
  65. * ti_thermal_is_valid_trip - check for trip index
  66. * @i: trip index
  67. */
  68. #define ti_thermal_is_valid_trip(trip) \
  69. ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
  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. static inline
  83. int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
  84. {
  85. return 0;
  86. }
  87. static inline
  88. int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
  89. {
  90. return 0;
  91. }
  92. static inline
  93. int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
  94. {
  95. return 0;
  96. }
  97. static inline
  98. int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
  99. {
  100. return 0;
  101. }
  102. #endif
  103. #endif