summaryrefslogtreecommitdiff
path: root/drivers/edp
diff options
context:
space:
mode:
authorSivaram Nair <sivaramn@nvidia.com>2013-03-14 17:01:50 -0700
committerMrutyunjay Sawant <msawant@nvidia.com>2013-03-19 00:57:43 -0700
commit0251963906b6b2189868636b877b0f32920c3b2b (patch)
treec69e3832dcd71e5ccc765fc7deda1762f6ab26e5 /drivers/edp
parent8f5c3742921dc1f17d5235dca08d45ff66610d64 (diff)
EDP: tegra: core E-state request via sysfs
A new sysfs entry is added to core EDP client for changing its E-state request. This is required to limit the maximum power the core (AP+DRAM) can be allocated. Bug 1252183 Change-Id: I2f30284df3994e714f828480ac89390a21a121ee Signed-off-by: Sivaram Nair <sivaramn@nvidia.com> Reviewed-on: http://git-master/r/209803 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Diffstat (limited to 'drivers/edp')
-rw-r--r--drivers/edp/tegra_edp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/edp/tegra_edp.c b/drivers/edp/tegra_edp.c
index 332eb74155d1..5f90fde91ef6 100644
--- a/drivers/edp/tegra_edp.c
+++ b/drivers/edp/tegra_edp.c
@@ -263,10 +263,41 @@ static struct notifier_block tegra_edp_cpu_nb = {
.notifier_call = tegra_edp_cpu_notify
};
+static ssize_t core_request_store(struct edp_client *c,
+ struct edp_client_attribute *attr, const char *s, size_t count)
+{
+ unsigned int id;
+ unsigned int approved;
+ int r;
+
+ if (sscanf(s, "%u", &id) != 1)
+ return -EINVAL;
+
+ mutex_lock(&core_lock);
+
+ r = edp_update_client_request(c, id, &approved);
+ if (r)
+ goto out;
+
+ core_state = approved;
+ update_cur_corecap();
+ __do_cap_control();
+
+out:
+ mutex_unlock(&core_lock);
+ return r ?: count;
+}
+
+struct edp_client_attribute core_attrs[] = {
+ __ATTR(set_request, 0200, NULL, core_request_store),
+ __ATTR_NULL
+};
+
static struct edp_client core_client = {
.name = "core",
.priority = EDP_MIN_PRIO,
.throttle = state_change_cb,
+ .attrs = core_attrs,
.notify_promotion = state_change_cb,
.notify_loan_update = loan_update_cb,
.notify_loan_close = loan_close_cb