summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Primero <jprimero@nvidia.com>2011-12-18 15:44:25 -0800
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-22 11:31:16 +0530
commit32ff2dc25622e3a0367326729c5b483c64ae2f29 (patch)
tree33418ae37cf65ee5138d2f83381ee93501bc1209
parent29a18b43d3bfeaf240094c54cb7946ba6b4975c0 (diff)
arm: tegra: thermal: Low temp to therm algorithm
Instead of using 0C as default low temp in thermal algorithm, query the thermal device driver for lowest supported temperature. Change-Id: Id1f70380ba476dec80e36ce79b42ab6f24a5d5ba Signed-off-by: Joshua Primero <jprimero@nvidia.com> Reviewed-on: http://git-master/r/70935 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board-cardhu-sensors.c8
-rw-r--r--arch/arm/mach-tegra/board-enterprise-sensors.c7
-rw-r--r--arch/arm/mach-tegra/include/mach/thermal.h1
-rw-r--r--arch/arm/mach-tegra/tegra3_thermal.c9
-rw-r--r--arch/arm/mach-tegra/tegra3_tsensor.c7
5 files changed, 29 insertions, 3 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-sensors.c b/arch/arm/mach-tegra/board-cardhu-sensors.c
index 7f3484a8f68b..e464ffe32aa1 100644
--- a/arch/arm/mach-tegra/board-cardhu-sensors.c
+++ b/arch/arm/mach-tegra/board-cardhu-sensors.c
@@ -538,6 +538,12 @@ static int nct_get_temp(void *_data, long *temp)
return nct1008_thermal_get_temp(data, temp);
}
+static int nct_get_temp_low(void *_data, long *temp)
+{
+ struct nct1008_data *data = _data;
+ return nct1008_thermal_get_temp_low(data, temp);
+}
+
static int nct_set_limits(void *_data,
long lo_limit_milli,
long hi_limit_milli)
@@ -561,6 +567,7 @@ static int nct_set_shutdown_temp(void *_data, long shutdown_temp)
struct nct1008_data *data = _data;
return nct1008_thermal_set_shutdown_temp(data, shutdown_temp);
}
+
static void nct1008_probe_callback(struct nct1008_data *data)
{
struct tegra_thermal_device *thermal_device;
@@ -576,6 +583,7 @@ static void nct1008_probe_callback(struct nct1008_data *data)
thermal_device->data = data;
thermal_device->offset = TDIODE_OFFSET;
thermal_device->get_temp = nct_get_temp;
+ thermal_device->get_temp_low = nct_get_temp_low;
thermal_device->set_limits = nct_set_limits;
thermal_device->set_alert = nct_set_alert;
thermal_device->set_shutdown_temp = nct_set_shutdown_temp;
diff --git a/arch/arm/mach-tegra/board-enterprise-sensors.c b/arch/arm/mach-tegra/board-enterprise-sensors.c
index 889348d4a1c6..68544692bcee 100644
--- a/arch/arm/mach-tegra/board-enterprise-sensors.c
+++ b/arch/arm/mach-tegra/board-enterprise-sensors.c
@@ -58,6 +58,12 @@ static int nct_get_temp(void *_data, long *temp)
return nct1008_thermal_get_temp(data, temp);
}
+static int nct_get_temp_low(void *_data, long *temp)
+{
+ struct nct1008_data *data = _data;
+ return nct1008_thermal_get_temp_low(data, temp);
+}
+
static int nct_set_limits(void *_data,
long lo_limit_milli,
long hi_limit_milli)
@@ -98,6 +104,7 @@ static void nct1008_probe_callback(struct nct1008_data *data)
thermal_device->data = data;
thermal_device->offset = TDIODE_OFFSET;
thermal_device->get_temp = nct_get_temp;
+ thermal_device->get_temp_low = nct_get_temp_low;
thermal_device->set_limits = nct_set_limits;
thermal_device->set_alert = nct_set_alert;
thermal_device->set_shutdown_temp = nct_set_shutdown_temp;
diff --git a/arch/arm/mach-tegra/include/mach/thermal.h b/arch/arm/mach-tegra/include/mach/thermal.h
index b46dcb865f77..ab7b34492d9e 100644
--- a/arch/arm/mach-tegra/include/mach/thermal.h
+++ b/arch/arm/mach-tegra/include/mach/thermal.h
@@ -40,6 +40,7 @@ struct tegra_thermal_device {
void *data;
long offset;
int (*get_temp) (void *, long *);
+ int (*get_temp_low)(void *, long *);
int (*set_limits) (void *, long, long);
int (*set_alert)(void *, void (*)(void *), void *);
int (*set_shutdown_temp)(void *, long);
diff --git a/arch/arm/mach-tegra/tegra3_thermal.c b/arch/arm/mach-tegra/tegra3_thermal.c
index be4e7c09c806..8ad7bd5b670f 100644
--- a/arch/arm/mach-tegra/tegra3_thermal.c
+++ b/arch/arm/mach-tegra/tegra3_thermal.c
@@ -174,6 +174,7 @@ void tegra_thermal_alert(void *data)
long temp_dev, temp_tj;
long lo_limit_throttle_tj, hi_limit_throttle_tj;
long lo_limit_edp_tj = 0, hi_limit_edp_tj = 0;
+ long temp_low_dev, temp_low_tj;
int lo_limit_tj = 0, hi_limit_tj = 0;
#ifdef CONFIG_TEGRA_EDP_LIMITS
const struct tegra_edp_limits *z;
@@ -202,8 +203,10 @@ void tegra_thermal_alert(void *data)
/* Convert all temps to tj and then do all work/logic in terms of
tj in order to avoid confusion */
temp_tj = dev2tj(thermal->device, temp_dev);
+ thermal->device->get_temp_low(thermal->device, &temp_low_dev);
+ temp_low_tj = dev2tj(thermal->device, temp_low_dev);
- lo_limit_throttle_tj = dev2tj(thermal->device, 0);
+ lo_limit_throttle_tj = temp_low_tj;
hi_limit_throttle_tj = thermal->temp_throttle_tj;
#ifndef CONFIG_TEGRA_THERMAL_SYSFS
@@ -228,7 +231,7 @@ void tegra_thermal_alert(void *data)
#define EDP_TEMP_TJ(_index) edp2tj(thermal, z[_index].temperature * 1000)
if (temp_tj < EDP_TEMP_TJ(0)) {
- lo_limit_edp_tj = dev2tj(thermal->device, 0);
+ lo_limit_edp_tj = temp_low_tj;
hi_limit_edp_tj = EDP_TEMP_TJ(0);
} else if (temp_tj >= EDP_TEMP_TJ(zones_sz-1)) {
lo_limit_edp_tj = EDP_TEMP_TJ(zones_sz-1) -
@@ -247,7 +250,7 @@ void tegra_thermal_alert(void *data)
}
#undef EDP_TEMP_TJ
#else
- lo_limit_edp_tj = 0;
+ lo_limit_edp_tj = temp_low_tj;
hi_limit_edp_tj = thermal->temp_shutdown_tj;
#endif
diff --git a/arch/arm/mach-tegra/tegra3_tsensor.c b/arch/arm/mach-tegra/tegra3_tsensor.c
index 9e027c8652b9..a19a99785ae7 100644
--- a/arch/arm/mach-tegra/tegra3_tsensor.c
+++ b/arch/arm/mach-tegra/tegra3_tsensor.c
@@ -62,6 +62,12 @@ static int tsensor_get_temp(void *vdata, long *milli_temp)
return tsensor_thermal_get_temp(data, milli_temp);
}
+static int tsensor_get_temp_low(void *vdata, long *milli_temp)
+{
+ struct tegra_tsensor_data *data = vdata;
+ return tsensor_thermal_get_temp_low(data, milli_temp);
+}
+
static int tsensor_set_limits(void *vdata,
long lo_limit_milli,
long hi_limit_milli)
@@ -102,6 +108,7 @@ static void tegra3_tsensor_probe_callback(struct tegra_tsensor_data *data)
thermal_device->data = data;
thermal_device->offset = TSENSOR_OFFSET;
thermal_device->get_temp = tsensor_get_temp;
+ thermal_device->get_temp_low = tsensor_get_temp_low;
thermal_device->set_limits = tsensor_set_limits;
thermal_device->set_alert = tsensor_set_alert;
thermal_device->set_shutdown_temp = tsensor_set_shutdown_temp;