Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1302485
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 3/4] thermal: add sys node for k_pu_ratio/k_po_ratio |
| Date | 2016-01-06 10:00 +0100 |
| Message-ID | <qNS6L-7dw-23@gated-at.bofh.it> (permalink) |
| References | <qNS6J-7dw-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add two sys nodes for k_pu_ratio and k_po_ratio, so user can set ratio
value from them. Also change k_pu/k_po as read only nodes, it will only
be used to show proportional term constants which are calculated by
ratio.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
drivers/thermal/thermal_core.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9e525c..bc149a67 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -955,8 +955,25 @@ static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
} \
static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, name##_show, name##_store)
-create_s32_tzp_attr(k_po);
-create_s32_tzp_attr(k_pu);
+
+#define create_s32_tzp_attr_ro(name) \
+ static ssize_t \
+ name##_show(struct device *dev, struct device_attribute *devattr, \
+ char *buf) \
+ { \
+ struct thermal_zone_device *tz = to_thermal_zone(dev); \
+ \
+ if (tz->tzp) \
+ return sprintf(buf, "%u\n", tz->tzp->name); \
+ else \
+ return -EIO; \
+ } \
+ static DEVICE_ATTR(name, S_IRUGO, name##_show, NULL)
+
+create_s32_tzp_attr_ro(k_po);
+create_s32_tzp_attr_ro(k_pu);
+create_s32_tzp_attr(k_po_ratio);
+create_s32_tzp_attr(k_pu_ratio);
create_s32_tzp_attr(k_i);
create_s32_tzp_attr(k_d);
create_s32_tzp_attr(integral_cutoff);
@@ -968,6 +985,8 @@ static struct device_attribute *dev_tzp_attrs[] = {
&dev_attr_sustainable_power,
&dev_attr_k_po,
&dev_attr_k_pu,
+ &dev_attr_k_po_ratio,
+ &dev_attr_k_pu_ratio,
&dev_attr_k_i,
&dev_attr_k_d,
&dev_attr_integral_cutoff,
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Leo Yan <leo.yan@linaro.org> - 2016-01-06 10:00 +0100
[PATCH v3 2/4] thermal: power_allocator: change k_pu_ratio/k_po_ratio as percentage Leo Yan <leo.yan@linaro.org> - 2016-01-06 10:00 +0100
[PATCH v3 4/4] thermal: power_allocator: document k_pu_ratio/k_po_ratio Leo Yan <leo.yan@linaro.org> - 2016-01-06 10:00 +0100
[PATCH v3 1/4] thermal: power_allocator: rework proportional parameter Leo Yan <leo.yan@linaro.org> - 2016-01-06 10:00 +0100
[PATCH v3 3/4] thermal: add sys node for k_pu_ratio/k_po_ratio Leo Yan <leo.yan@linaro.org> - 2016-01-06 10:00 +0100
Re: [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Javi Merino <javi.merino@arm.com> - 2016-01-06 11:10 +0100
Re: [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Leo Yan <leo.yan@linaro.org> - 2016-01-06 12:20 +0100
Re: [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Daniel Thompson <daniel.thompson@linaro.org> - 2016-01-06 12:30 +0100
Re: [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Javi Merino <javi.merino@arm.com> - 2016-01-06 16:10 +0100
csiph-web