summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/tegra_bbc_proxy.c
diff options
context:
space:
mode:
authorNeil Patel <neilp@nvidia.com>2013-02-21 14:16:07 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 13:00:24 -0700
commit9855fe73fdc3daa38262d5f846b06e7e9248a2c5 (patch)
treef2a5c37f7ecda72b45599daff08214baa095cf2e /arch/arm/mach-tegra/tegra_bbc_proxy.c
parent734193988a64ddc3bc233519bc908973866255b8 (diff)
ARM: tegra: support modem EDP request/threshold updates
The modem client unregisters and re-registers during crash recovery. Since permissions are set at init we need use sysfs files for request and threshold updates that are present at boot. Bug 1242282 Change-Id: I5023eb39f78224a7022dafd9af2ab753b1449952 Signed-off-by: Neil Patel <neilp@nvidia.com> Reviewed-on: http://git-master/r/203017 Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com> Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/tegra_bbc_proxy.c')
-rw-r--r--arch/arm/mach-tegra/tegra_bbc_proxy.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/tegra_bbc_proxy.c b/arch/arm/mach-tegra/tegra_bbc_proxy.c
index 98533aa2e2f6..a05fa1d6274a 100644
--- a/arch/arm/mach-tegra/tegra_bbc_proxy.c
+++ b/arch/arm/mach-tegra/tegra_bbc_proxy.c
@@ -173,11 +173,65 @@ done:
}
static DEVICE_ATTR(i_max, S_IRUSR | S_IWUSR, i_max_show, i_max_store);
+static ssize_t request_store(struct device *pdev, struct device_attribute *attr,
+ const char *buff, size_t size)
+{
+ struct tegra_bbc_proxy *bbc = dev_get_drvdata(pdev);
+ struct edp_client *c;
+ unsigned int id;
+ int ret;
+
+ if (sscanf(buff, "%u", &id) != 1)
+ return -EINVAL;
+
+ if (!bbc->edp_client_registered)
+ return -EINVAL;
+
+ c = &bbc->modem_edp_client;
+ if (id >= c->num_states)
+ return -EINVAL;
+
+ ret = edp_update_client_request(c, id, NULL);
+ if (ret)
+ dev_err(pdev, "state update to %u failed\n", id);
+ else
+ ret = size;
+
+ return ret;
+}
+static DEVICE_ATTR(request, S_IWUSR, NULL, request_store);
+
+static ssize_t threshold_store(struct device *pdev,
+ struct device_attribute *attr,
+ const char *buff, size_t size)
+{
+ struct tegra_bbc_proxy *bbc = dev_get_drvdata(pdev);
+ unsigned int tv;
+ int ret;
+
+ if (sscanf(buff, "%u", &tv) != 1)
+ return -EINVAL;
+
+ if (!bbc->edp_client_registered)
+ return -EINVAL;
+
+ ret = edp_update_loan_threshold(&bbc->modem_edp_client, tv);
+ if (ret)
+ dev_err(pdev, "threshold update to %u failed\n", tv);
+ else
+ ret = size;
+
+ return ret;
+}
+DEVICE_ATTR(threshold, S_IWUSR, NULL, threshold_store);
+
static struct device_attribute *edp_attributes[] = {
&dev_attr_i_breach_ppm,
&dev_attr_i_thresh_3g_adjperiod,
&dev_attr_i_thresh_lte_adjperiod,
&dev_attr_i_max,
+ &dev_attr_request,
+ &dev_attr_threshold,
NULL
};