[PATCH] added three more trip points to acerhdf, this allows thermallayer to correctly handle the two point regulation of acerhdf. Trip point 0will be active from 0 degree to "fanoff" and is marked as passive, then trippoint 1 is valid from "fanoff" to "fanon" value and is marked as active, evenif it's only really active in case temperature is going down from trip point2. Trip point 2 will be valid above "fanon" value and is also marked asactive. Trip point 3 is when hitting the critical temperature.
From: Peter Feuerer
Date: Mon Feb 18 2013 - 11:23:34 EST
---
drivers/platform/x86/acerhdf.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..b121449 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -400,7 +400,13 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
enum thermal_trip_type *type)
{
if (trip == 0)
+ *type = THERMAL_TRIP_PASSIVE;
+ if (trip == 1)
*type = THERMAL_TRIP_ACTIVE;
+ if (trip == 2)
+ *type = THERMAL_TRIP_ACTIVE;
+ if (trip == 3)
+ *type = THERMAL_TRIP_CRITICAL;
return 0;
}
@@ -409,7 +415,13 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
unsigned long *temp)
{
if (trip == 0)
+ *temp = 0;
+ if (trip == 1)
+ *temp = fanoff;
+ if (trip == 2)
*temp = fanon;
+ if (trip == 3)
+ *temp = ACERHDF_TEMP_CRIT;
return 0;
}
@@ -431,6 +443,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
.get_trip_type = acerhdf_get_trip_type,
.get_trip_temp = acerhdf_get_trip_temp,
.get_crit_temp = acerhdf_get_crit_temp,
+ .notify = NULL,
};
@@ -486,7 +499,8 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
(cur_temp < fanoff))
acerhdf_change_fanstate(ACERHDF_FAN_OFF);
} else {
- if (cur_state == ACERHDF_FAN_OFF)
+ if ((cur_state == ACERHDF_FAN_OFF) &&
+ (cur_temp > fanon))
acerhdf_change_fanstate(ACERHDF_FAN_AUTO);
}
return 0;
@@ -661,8 +675,9 @@ static int acerhdf_register_thermal(void)
if (IS_ERR(cl_dev))
return -EINVAL;
- thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
- &acerhdf_dev_ops, NULL, 0,
+ thz_dev = thermal_zone_device_register("acerhdf", 4, 0, NULL,
+ &acerhdf_dev_ops,
+ (kernelmode) ? interval*1000 : 0,
(kernelmode) ? interval*1000 : 0);
if (IS_ERR(thz_dev))
return -EINVAL;
--
1.8.1.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/