Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
David Collins | c4eb8e5 | 2012-09-10 14:43:14 -0700 | [diff] [blame] | 2 | * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | /* |
| 15 | * Qualcomm PMIC PM8xxx Thermal Manager driver |
| 16 | */ |
| 17 | |
| 18 | #ifndef __PM8XXX_TM_H |
| 19 | #define __PM8XXX_TM_H |
| 20 | |
| 21 | #include <linux/errno.h> |
| 22 | |
| 23 | #define PM8XXX_TM_DEV_NAME "pm8xxx-tm" |
| 24 | |
David Collins | c4eb8e5 | 2012-09-10 14:43:14 -0700 | [diff] [blame] | 25 | /** |
| 26 | * enum pm8xxx_tm_adc_type - support ADC API types for PMIC thermal manager |
| 27 | * %PM8XXX_TM_ADC_NONE: Do not call any ADC API and instead estimate |
| 28 | * PMIC temerature based on over temperature stage. |
| 29 | * %PM8XXX_TM_ADC_PM8058_ADC: Use the pmic8058-xoadc ADC API |
| 30 | * %PM8XXX_TM_ADC_PM8XXX_ADC: Use the pm8xxx-adc ADC API |
| 31 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | enum pm8xxx_tm_adc_type { |
David Collins | c4eb8e5 | 2012-09-10 14:43:14 -0700 | [diff] [blame] | 33 | PM8XXX_TM_ADC_NONE, |
Anirudh Ghayal | c201933 | 2011-11-12 06:29:10 +0530 | [diff] [blame] | 34 | PM8XXX_TM_ADC_PM8058_ADC, |
Siddartha Mohanadoss | af91d90 | 2011-10-20 10:23:34 -0700 | [diff] [blame] | 35 | PM8XXX_TM_ADC_PM8XXX_ADC, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
David Collins | c4eb8e5 | 2012-09-10 14:43:14 -0700 | [diff] [blame] | 38 | /** |
| 39 | * struct pm8xxx_tm_core_data - PM8XXX thermal manager core data |
| 40 | * @tm_name: Thermal zone name for the device |
| 41 | * @irq_name_temp_stat: String name used to identify TEMP_STAT IRQ |
| 42 | * @irq_name_over_temp: String name used to identify OVER_TEMP IRQ |
| 43 | * @reg_addr_temp_alarm_ctrl: PMIC SSBI address for temp alarm control |
| 44 | * register |
| 45 | * @reg_addr_temp_alarm_pwm: PMIC SSBI address for temp alarm pwm register |
| 46 | * @adc_type: Determines which ADC API to use in order to read |
| 47 | * the PMIC die temperature. |
| 48 | * @adc_channel: ADC channel identifier |
| 49 | * If adc_type == PM8XXX_TM_ADC_PM8XXX_ADC, then |
| 50 | * use a value from enum pm8xxx_adc_channels. |
| 51 | * If adc_type == PM8XXX_TM_ADC_PM8058_ADC, then |
| 52 | * use a channel value specified in |
| 53 | * <linux/pmic8058-xoadc.h> |
| 54 | * @default_no_adc_temp: Default temperature in millicelcius to report |
| 55 | * while stage == 0 and stage has never been |
| 56 | * greater than 0 if adc_type == PM8XXX_TM_ADC_NONE |
| 57 | * @allow_software_override: true --> writing "enabled" to thermalfs mode |
| 58 | * file results in software override of PMIC |
| 59 | * automatic over temperature shutdown |
| 60 | * false --> PMIC automatic over temperature |
| 61 | * shutdown always enabled. mode file cannot be |
| 62 | * set to "enabled". |
| 63 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 64 | struct pm8xxx_tm_core_data { |
David Collins | c4eb8e5 | 2012-09-10 14:43:14 -0700 | [diff] [blame] | 65 | char *tm_name; |
| 66 | char *irq_name_temp_stat; |
| 67 | char *irq_name_over_temp; |
| 68 | u16 reg_addr_temp_alarm_ctrl; |
| 69 | u16 reg_addr_temp_alarm_pwm; |
| 70 | enum pm8xxx_tm_adc_type adc_type; |
| 71 | int adc_channel; |
| 72 | unsigned long default_no_adc_temp; |
| 73 | bool allow_software_override; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | #endif |