summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2011-09-01 09:57:55 +0800
committerJason Liu <r64343@freescale.com>2012-01-09 20:23:30 +0800
commit020e0036feb1c9ce4422708034f51ecf45b1551c (patch)
treefbf0a2fc083c9c071728dc4312a6ace3349b7574 /drivers/thermal
parent187c2e1c0ba59ff4389b1ab65e5c4e03a976b3e7 (diff)
ENGR00155627-1 [MX6]Add thermal cooling devie
1.Common code of thermal_sys has some bug,could not set the mode via sysfs using echo enable/disabled command; 2.Since the anatop thermal formula still not accurate, in order to help test and adjust the trip point of anatop thermal zone, we add the set trip point temp value into the sysfs interface. Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/thermal_sys.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 0b1c82ad6805..04506f67ea45 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -152,9 +152,9 @@ mode_store(struct device *dev, struct device_attribute *attr,
if (!tz->ops->set_mode)
return -EPERM;
- if (!strncmp(buf, "enabled", sizeof("enabled")))
+ if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
- else if (!strncmp(buf, "disabled", sizeof("disabled")))
+ else if (!strncmp(buf, "disabled", sizeof("disabled") - 1))
result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
else
result = -EINVAL;
@@ -218,6 +218,29 @@ trip_point_temp_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%ld\n", temperature);
}
+static ssize_t
+trip_point_temp_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct thermal_zone_device *tz = to_thermal_zone(dev);
+ int trip, ret;
+ long temperature;
+
+ if (!tz->ops->set_trip_temp)
+ return -EPERM;
+
+ if (!sscanf(attr->attr.name, "trip_point_%d_temp", &trip))
+ return -EINVAL;
+
+ ret = sscanf(buf, "%lu", &temperature);
+
+ ret = tz->ops->set_trip_temp(tz, trip, &temperature);
+ if (ret)
+ return -EINVAL;
+
+ return count;
+
+}
static ssize_t
passive_store(struct device *dev, struct device_attribute *attr,
@@ -288,11 +311,14 @@ static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, \
static struct device_attribute trip_point_attrs[] = {
__ATTR(trip_point_0_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_0_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_0_temp, 0644, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_1_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_1_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_1_temp, 0644, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_2_type, 0444, trip_point_type_show, NULL),
- __ATTR(trip_point_2_temp, 0444, trip_point_temp_show, NULL),
+ __ATTR(trip_point_2_temp, 0644, trip_point_temp_show,
+ trip_point_temp_store),
__ATTR(trip_point_3_type, 0444, trip_point_type_show, NULL),
__ATTR(trip_point_3_temp, 0444, trip_point_temp_show, NULL),
__ATTR(trip_point_4_type, 0444, trip_point_type_show, NULL),