ti-thermal.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * OMAP thermal definitions
  4. *
  5. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  6. * Contact:
  7. * Eduardo Valentin <[email protected]>
  8. */
  9. #ifndef __TI_THERMAL_H
  10. #define __TI_THERMAL_H
  11. #include "ti-bandgap.h"
  12. /* PCB sensor calculation constants */
  13. #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
  14. #define OMAP_GRADIENT_CONST_W_PCB_4430 20000
  15. #define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142
  16. #define OMAP_GRADIENT_CONST_W_PCB_4460 -393
  17. #define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063
  18. #define OMAP_GRADIENT_CONST_W_PCB_4470 -477
  19. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
  20. #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
  21. #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
  22. #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
  23. #define DRA752_GRADIENT_SLOPE_W_PCB 0
  24. #define DRA752_GRADIENT_CONST_W_PCB 2000
  25. /* trip points of interest in milicelsius (at hotspot level) */
  26. #define OMAP_TRIP_COLD 100000
  27. #define OMAP_TRIP_HOT 110000
  28. #define OMAP_TRIP_SHUTDOWN 125000
  29. #define OMAP_TRIP_NUMBER 2
  30. #define OMAP_TRIP_STEP \
  31. ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
  32. /* Update rates */
  33. #define FAST_TEMP_MONITORING_RATE 250
  34. /* helper macros */
  35. /**
  36. * ti_thermal_get_trip_value - returns trip temperature based on index
  37. * @i: trip index
  38. */
  39. #define ti_thermal_get_trip_value(i) \
  40. (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
  41. /**
  42. * ti_thermal_is_valid_trip - check for trip index
  43. * @i: trip index
  44. */
  45. #define ti_thermal_is_valid_trip(trip) \
  46. ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
  47. #ifdef CONFIG_TI_THERMAL
  48. int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
  49. int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
  50. int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
  51. int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
  52. int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
  53. #else
  54. static inline
  55. int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
  56. {
  57. return 0;
  58. }
  59. static inline
  60. int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
  61. {
  62. return 0;
  63. }
  64. static inline
  65. int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
  66. {
  67. return 0;
  68. }
  69. static inline
  70. int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
  71. {
  72. return 0;
  73. }
  74. static inline
  75. int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
  76. {
  77. return 0;
  78. }
  79. #endif
  80. #endif