diff options
author | Diwakar Tundlam <dtundlam@nvidia.com> | 2013-07-15 16:26:05 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:37:45 -0700 |
commit | 4bcf96c87f25097e53f5c97c3ab07eb51a6b4eb7 (patch) | |
tree | f4bcc7f281fd31451d41ffe8942e8b2709478f82 /drivers/thermal | |
parent | 3e7750817f671aa9f6bc85ed1d9fad3c3f8642a9 (diff) |
Thermal: sys node to read and write polling_delay
Bug 1315460
Change-Id: I7dca29c63d5238522b1cd9df680dc7c019674066
Signed-off-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-on: http://git-master/r/250905
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jinyoung Park <jinyoungp@nvidia.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/thermal_core.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index e2b5e2d522b8..4439083a0a8e 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -745,6 +745,30 @@ passive_delay_show(struct device *dev, struct device_attribute *attr, } static ssize_t +polling_delay_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct thermal_zone_device *tz = to_thermal_zone(dev); + int polling_delay; + + if (!sscanf(buf, "%d\n", &polling_delay)) + return -EINVAL; + + tz->polling_delay = polling_delay; + thermal_zone_device_update(tz); + return count; +} + +static ssize_t +polling_delay_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct thermal_zone_device *tz = to_thermal_zone(dev); + + return sprintf(buf, "%d\n", tz->polling_delay); +} + +static ssize_t policy_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -843,6 +867,8 @@ static DEVICE_ATTR(mode, 0644, mode_show, mode_store); static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store); static DEVICE_ATTR(passive_delay, S_IRUGO | S_IWUSR, passive_delay_show, passive_delay_store); +static DEVICE_ATTR(polling_delay, S_IRUGO | S_IWUSR, + polling_delay_show, polling_delay_store); static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store); static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL); @@ -1821,6 +1847,11 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, if (result) goto unregister; + /* Create polling_delay attribute */ + result = device_create_file(&tz->device, &dev_attr_polling_delay); + if (result) + goto unregister; + /* Create available_policies attribute */ result = device_create_file(&tz->device, &dev_attr_available_policies); if (result) @@ -1935,6 +1966,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) if (tz->ops->get_mode) device_remove_file(&tz->device, &dev_attr_mode); device_remove_file(&tz->device, &dev_attr_passive_delay); + device_remove_file(&tz->device, &dev_attr_polling_delay); device_remove_file(&tz->device, &dev_attr_policy); device_remove_file(&tz->device, &dev_attr_available_policies); remove_trip_attrs(tz); |