blob: 74b77ec76cabe0762411219ca3a803242a06ba63 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
David Collinsc4eb8e52012-09-10 14:43:14 -07002 * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003 *
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 Collinsc4eb8e52012-09-10 14:43:14 -070025/**
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 Huntsman3f2bc4d2011-08-16 17:27:22 -070032enum pm8xxx_tm_adc_type {
David Collinsc4eb8e52012-09-10 14:43:14 -070033 PM8XXX_TM_ADC_NONE,
Anirudh Ghayalc2019332011-11-12 06:29:10 +053034 PM8XXX_TM_ADC_PM8058_ADC,
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070035 PM8XXX_TM_ADC_PM8XXX_ADC,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070036};
37
David Collinsc4eb8e52012-09-10 14:43:14 -070038/**
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 Huntsman3f2bc4d2011-08-16 17:27:22 -070064struct pm8xxx_tm_core_data {
David Collinsc4eb8e52012-09-10 14:43:14 -070065 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 Huntsman3f2bc4d2011-08-16 17:27:22 -070074};
75
76#endif