From: Leo Yan <leo.yan@linaro.org>
To: Jonathan Corbet <corbet@lwn.net>, Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Javi Merino <javi.merino@arm.com>,
Punit Agrawal <punit.agrawal@arm.com>,
Daniel Kurtz <djkurtz@chromium.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org,
Daniel Thompson <daniel.thompson@linaro.org>
Cc: Leo Yan <leo.yan@linaro.org>
Subject: [PATCH v3 3/4] thermal: add sys node for k_pu_ratio/k_po_ratio
Date: Wed, 6 Jan 2016 16:53:47 +0800 [thread overview]
Message-ID: <1452070428-2567-4-git-send-email-leo.yan@linaro.org> (raw)
In-Reply-To: <1452070428-2567-1-git-send-email-leo.yan@linaro.org>
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
next prev parent reply other threads:[~2016-01-06 8:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 8:53 [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Leo Yan
2016-01-06 8:53 ` [PATCH v3 1/4] thermal: power_allocator: rework proportional parameter Leo Yan
2016-01-06 8:53 ` [PATCH v3 2/4] thermal: power_allocator: change k_pu_ratio/k_po_ratio as percentage Leo Yan
2016-01-06 8:53 ` Leo Yan [this message]
2016-01-06 8:53 ` [PATCH v3 4/4] thermal: power_allocator: document k_pu_ratio/k_po_ratio Leo Yan
2016-01-06 10:07 ` [PATCH v3 0/4] thermal: re-calculate k_po/k_pu when update sustainable power Javi Merino
2016-01-06 11:17 ` Leo Yan
2016-01-06 11:21 ` Daniel Thompson
2016-01-06 15:05 ` Javi Merino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452070428-2567-4-git-send-email-leo.yan@linaro.org \
--to=leo.yan@linaro.org \
--cc=corbet@lwn.net \
--cc=daniel.thompson@linaro.org \
--cc=djkurtz@chromium.org \
--cc=edubezval@gmail.com \
--cc=javi.merino@arm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=punit.agrawal@arm.com \
--cc=rui.zhang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).