tm.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. /*
  14. * Qualcomm PMIC PM8xxx Thermal Manager driver
  15. */
  16. #ifndef __PM8XXX_TM_H
  17. #define __PM8XXX_TM_H
  18. #include <linux/errno.h>
  19. #define PM8XXX_TM_DEV_NAME "pm8xxx-tm"
  20. /**
  21. * enum pm8xxx_tm_adc_type - support ADC API types for PMIC thermal manager
  22. * %PM8XXX_TM_ADC_NONE: Do not call any ADC API and instead estimate
  23. * PMIC temerature based on over temperature stage.
  24. * %PM8XXX_TM_ADC_PM8058_ADC: Use the pmic8058-xoadc ADC API
  25. * %PM8XXX_TM_ADC_PM8XXX_ADC: Use the pm8xxx-adc ADC API
  26. */
  27. enum pm8xxx_tm_adc_type {
  28. PM8XXX_TM_ADC_NONE,
  29. PM8XXX_TM_ADC_PM8058_ADC,
  30. PM8XXX_TM_ADC_PM8XXX_ADC,
  31. };
  32. /**
  33. * struct pm8xxx_tm_core_data - PM8XXX thermal manager core data
  34. * @tm_name: Thermal zone name for the device
  35. * @irq_name_temp_stat: String name used to identify TEMP_STAT IRQ
  36. * @irq_name_over_temp: String name used to identify OVER_TEMP IRQ
  37. * @reg_addr_temp_alarm_ctrl: PMIC SSBI address for temp alarm control
  38. * register
  39. * @reg_addr_temp_alarm_pwm: PMIC SSBI address for temp alarm pwm register
  40. * @adc_type: Determines which ADC API to use in order to read
  41. * the PMIC die temperature.
  42. * @adc_channel: ADC channel identifier
  43. * If adc_type == PM8XXX_TM_ADC_PM8XXX_ADC, then
  44. * use a value from enum pm8xxx_adc_channels.
  45. * If adc_type == PM8XXX_TM_ADC_PM8058_ADC, then
  46. * use a channel value specified in
  47. * <linux/pmic8058-xoadc.h>
  48. * @default_no_adc_temp: Default temperature in millicelcius to report
  49. * while stage == 0 and stage has never been
  50. * greater than 0 if adc_type == PM8XXX_TM_ADC_NONE
  51. * @allow_software_override: true --> writing "enabled" to thermalfs mode
  52. * file results in software override of PMIC
  53. * automatic over temperature shutdown
  54. * false --> PMIC automatic over temperature
  55. * shutdown always enabled. mode file cannot be
  56. * set to "enabled".
  57. */
  58. struct pm8xxx_tm_core_data {
  59. char *tm_name;
  60. char *irq_name_temp_stat;
  61. char *irq_name_over_temp;
  62. u16 reg_addr_temp_alarm_ctrl;
  63. u16 reg_addr_temp_alarm_pwm;
  64. enum pm8xxx_tm_adc_type adc_type;
  65. int adc_channel;
  66. unsigned long default_no_adc_temp;
  67. bool allow_software_override;
  68. };
  69. #endif