exynos_thermal_common.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * exynos_thermal_common.h - Samsung EXYNOS common header file
  3. *
  4. * Copyright (C) 2013 Samsung Electronics
  5. * Amit Daniel Kachhap <amit.daniel@samsung.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. #ifndef _EXYNOS_THERMAL_COMMON_H
  23. #define _EXYNOS_THERMAL_COMMON_H
  24. /* In-kernel thermal framework related macros & definations */
  25. #define SENSOR_NAME_LEN 16
  26. #define MAX_TRIP_COUNT 8
  27. #define MAX_COOLING_DEVICE 4
  28. #define MAX_THRESHOLD_LEVS 5
  29. #define ACTIVE_INTERVAL 500
  30. #define IDLE_INTERVAL 10000
  31. #define MCELSIUS 1000
  32. /* CPU Zone information */
  33. #define PANIC_ZONE 4
  34. #define WARN_ZONE 3
  35. #define MONITOR_ZONE 2
  36. #define SAFE_ZONE 1
  37. #define GET_ZONE(trip) (trip + 2)
  38. #define GET_TRIP(zone) (zone - 2)
  39. enum trigger_type {
  40. THROTTLE_ACTIVE = 1,
  41. THROTTLE_PASSIVE,
  42. SW_TRIP,
  43. HW_TRIP,
  44. };
  45. /**
  46. * struct freq_clip_table
  47. * @freq_clip_max: maximum frequency allowed for this cooling state.
  48. * @temp_level: Temperature level at which the temperature clipping will
  49. * happen.
  50. * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
  51. *
  52. * This structure is required to be filled and passed to the
  53. * cpufreq_cooling_unregister function.
  54. */
  55. struct freq_clip_table {
  56. unsigned int freq_clip_max;
  57. unsigned int temp_level;
  58. const struct cpumask *mask_val;
  59. };
  60. struct thermal_trip_point_conf {
  61. int trip_val[MAX_TRIP_COUNT];
  62. int trip_type[MAX_TRIP_COUNT];
  63. int trip_count;
  64. unsigned char trigger_falling;
  65. };
  66. struct thermal_cooling_conf {
  67. struct freq_clip_table freq_data[MAX_TRIP_COUNT];
  68. int freq_clip_count;
  69. };
  70. struct thermal_sensor_conf {
  71. char name[SENSOR_NAME_LEN];
  72. int (*read_temperature)(void *data);
  73. int (*write_emul_temp)(void *drv_data, unsigned long temp);
  74. struct thermal_trip_point_conf trip_data;
  75. struct thermal_cooling_conf cooling_data;
  76. void *driver_data;
  77. void *pzone_data;
  78. struct device *dev;
  79. };
  80. /*Functions used exynos based thermal sensor driver*/
  81. #ifdef CONFIG_EXYNOS_THERMAL_CORE
  82. void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf);
  83. int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf);
  84. void exynos_report_trigger(struct thermal_sensor_conf *sensor_conf);
  85. #else
  86. static inline void
  87. exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) { return; }
  88. static inline int
  89. exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) { return 0; }
  90. static inline void
  91. exynos_report_trigger(struct thermal_sensor_conf *sensor_conf) { return; }
  92. #endif /* CONFIG_EXYNOS_THERMAL_CORE */
  93. #endif /* _EXYNOS_THERMAL_COMMON_H */