mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
thermal: pm8xxx-tm: Add configuration option for allowing shutdown override
Add a field to the PMIC thermal alarm core data named allow_software_override which is used to control whether or not userspace may switch the mode of a PMIC thermal device to "enabled" in order to enable software override of PMIC automatic over temperature shutdown. allow_software_override - true: writing "enabled" to thermalfs mode file results in software override of PMIC automatic over temperature shutdown. false: PMIC automatic over temperature shutdown is always enabled. mode file cannot be set to "enabled". Change-Id: I4c47fdf0c0c4704008591755296118ad7fac95ae Signed-off-by: David Collins <collinsd@codeaurora.org> (cherry picked from commit 8f6d8a8e7e1d149687819af7f9abbb24a8459cc0)
This commit is contained in:
parent
bdda1c7404
commit
b536bcacc5
2 changed files with 48 additions and 10 deletions
|
@ -316,6 +316,10 @@ static int pm8xxx_tz_set_mode(struct thermal_zone_device *thermal,
|
|||
if (!chip)
|
||||
return -EINVAL;
|
||||
|
||||
/* Mask software override requests if they are not allowed. */
|
||||
if (!chip->cdata.allow_software_override)
|
||||
mode = THERMAL_DEVICE_DISABLED;
|
||||
|
||||
if (mode != chip->mode) {
|
||||
if (mode == THERMAL_DEVICE_ENABLED)
|
||||
pm8xxx_tm_shutdown_override(chip,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -22,21 +22,55 @@
|
|||
|
||||
#define PM8XXX_TM_DEV_NAME "pm8xxx-tm"
|
||||
|
||||
/**
|
||||
* enum pm8xxx_tm_adc_type - support ADC API types for PMIC thermal manager
|
||||
* %PM8XXX_TM_ADC_NONE: Do not call any ADC API and instead estimate
|
||||
* PMIC temerature based on over temperature stage.
|
||||
* %PM8XXX_TM_ADC_PM8058_ADC: Use the pmic8058-xoadc ADC API
|
||||
* %PM8XXX_TM_ADC_PM8XXX_ADC: Use the pm8xxx-adc ADC API
|
||||
*/
|
||||
enum pm8xxx_tm_adc_type {
|
||||
PM8XXX_TM_ADC_NONE, /* Estimates temp based on overload level. */
|
||||
PM8XXX_TM_ADC_NONE,
|
||||
PM8XXX_TM_ADC_PM8058_ADC,
|
||||
PM8XXX_TM_ADC_PM8XXX_ADC,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pm8xxx_tm_core_data - PM8XXX thermal manager core data
|
||||
* @tm_name: Thermal zone name for the device
|
||||
* @irq_name_temp_stat: String name used to identify TEMP_STAT IRQ
|
||||
* @irq_name_over_temp: String name used to identify OVER_TEMP IRQ
|
||||
* @reg_addr_temp_alarm_ctrl: PMIC SSBI address for temp alarm control
|
||||
* register
|
||||
* @reg_addr_temp_alarm_pwm: PMIC SSBI address for temp alarm pwm register
|
||||
* @adc_type: Determines which ADC API to use in order to read
|
||||
* the PMIC die temperature.
|
||||
* @adc_channel: ADC channel identifier
|
||||
* If adc_type == PM8XXX_TM_ADC_PM8XXX_ADC, then
|
||||
* use a value from enum pm8xxx_adc_channels.
|
||||
* If adc_type == PM8XXX_TM_ADC_PM8058_ADC, then
|
||||
* use a channel value specified in
|
||||
* <linux/pmic8058-xoadc.h>
|
||||
* @default_no_adc_temp: Default temperature in millicelcius to report
|
||||
* while stage == 0 and stage has never been
|
||||
* greater than 0 if adc_type == PM8XXX_TM_ADC_NONE
|
||||
* @allow_software_override: true --> writing "enabled" to thermalfs mode
|
||||
* file results in software override of PMIC
|
||||
* automatic over temperature shutdown
|
||||
* false --> PMIC automatic over temperature
|
||||
* shutdown always enabled. mode file cannot be
|
||||
* set to "enabled".
|
||||
*/
|
||||
struct pm8xxx_tm_core_data {
|
||||
int adc_channel;
|
||||
unsigned long default_no_adc_temp;
|
||||
enum pm8xxx_tm_adc_type adc_type;
|
||||
u16 reg_addr_temp_alarm_ctrl;
|
||||
u16 reg_addr_temp_alarm_pwm;
|
||||
char *tm_name;
|
||||
char *irq_name_temp_stat;
|
||||
char *irq_name_over_temp;
|
||||
char *tm_name;
|
||||
char *irq_name_temp_stat;
|
||||
char *irq_name_over_temp;
|
||||
u16 reg_addr_temp_alarm_ctrl;
|
||||
u16 reg_addr_temp_alarm_pwm;
|
||||
enum pm8xxx_tm_adc_type adc_type;
|
||||
int adc_channel;
|
||||
unsigned long default_no_adc_temp;
|
||||
bool allow_software_override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue