diff options
author | Anson Huang <b20788@freescale.com> | 2011-09-01 09:57:55 +0800 |
---|---|---|
committer | Anson Huang <b20788@freescale.com> | 2011-09-01 11:05:56 +0800 |
commit | bd0e3c609c0c4d23913331c3691d1bd4f44acfb1 (patch) | |
tree | 5cac3fee00098179899c067f7c5f1d583eb0d010 /drivers | |
parent | 3ada171614a098145dd755a71a9c9c66e15a219b (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')
-rw-r--r-- | drivers/thermal/thermal_sys.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 713b7ea4a60..42e123b5a1b 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), |