summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoshua Primero <jprimero@nvidia.com>2011-09-08 16:23:22 -0700
committerRohan Somvanshi <rsomvanshi@nvidia.com>2011-09-12 08:51:01 -0700
commit2a1664af52c45f8a9278f3454924a09a39541416 (patch)
treeea0789d8946b07a68f7cd35ca672aedeb182e584 /drivers
parentf988c97564f9ecf4b78f4e935e2cfc4ca1b6db0e (diff)
arm: tegra: power: Reduced throttling hysteresis
Set different hysteresis values for the EDP and throttling cases. bug 862301 Change-Id: Ie5a8a02a2123ce5c681e4e59cac77fcf2cbc320e Reviewed-on: http://git-master/r/51436 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/nct1008.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/misc/nct1008.c b/drivers/misc/nct1008.c
index c1875ebeae5c..f0f2fd74e4b3 100644
--- a/drivers/misc/nct1008.c
+++ b/drivers/misc/nct1008.c
@@ -434,7 +434,8 @@ static void therm_throttle(struct nct1008_data *data, bool enable)
}
}
-#define ALERT_HYSTERESIS 3
+#define ALERT_HYSTERESIS_THROTTLE 1
+#define ALERT_HYSTERESIS_EDP 3
static int edp_thermal_zone_val = -1;
static int current_hi_limit = -1;
static int current_lo_limit = -1;
@@ -446,6 +447,7 @@ static void nct1008_work_func(struct work_struct *work)
bool extended_range = data->plat_data.ext_range;
u8 temperature, value;
int err = 0, i;
+ int hysteresis;
int nentries = data->limits_sz;
int lo_limit = 0, hi_limit = 0;
int intr_status = i2c_smbus_read_byte_data(data->client, STATUS_RD);
@@ -462,32 +464,37 @@ static void nct1008_work_func(struct work_struct *work)
nct1008_disable_alert(data);
+
+ hysteresis = ALERT_HYSTERESIS_EDP;
+
+ if (temperature >= data->plat_data.throttling_ext_limit) {
+ /* start throttling */
+ therm_throttle(data, true);
+ hysteresis = ALERT_HYSTERESIS_THROTTLE;
+ } else if (temperature <=
+ (data->plat_data.throttling_ext_limit -
+ ALERT_HYSTERESIS_THROTTLE)) {
+ /* switch off throttling */
+ therm_throttle(data, false);
+ }
+
if (temperature < data->limits[0]) {
lo_limit = 0;
hi_limit = data->limits[0];
} else if (temperature >= data->limits[nentries-1]) {
- lo_limit = data->limits[nentries-1] - ALERT_HYSTERESIS;
+ lo_limit = data->limits[nentries-1] - hysteresis;
hi_limit = data->plat_data.shutdown_ext_limit;
} else {
for (i = 0; (i + 1) < nentries; i++) {
if (temperature >= data->limits[i] &&
temperature < data->limits[i + 1]) {
- lo_limit = data->limits[i] - ALERT_HYSTERESIS;
+ lo_limit = data->limits[i] - hysteresis;
hi_limit = data->limits[i + 1];
break;
}
}
}
- if (temperature >= data->plat_data.throttling_ext_limit) {
- /* start throttling */
- therm_throttle(data, true);
- } else if (temperature <=
- (data->plat_data.throttling_ext_limit - ALERT_HYSTERESIS)) {
- /* switch off throttling */
- therm_throttle(data, false);
- }
-
if (lo_limit == hi_limit) {
err = -ENODATA;
goto out;