From 0f220f828b8c1b3db48028182fdf8d37bd05d480 Mon Sep 17 00:00:00 2001 From: Ashok Vuyyuru Date: Tue, 17 Nov 2020 00:43:34 +0530 Subject: [PATCH] msm: ipa3: Changes to control the IPA BW vote using debugfs Changes to control the IPA BW vote persistent using debugfs. Change-Id: Ie1edf294558a61af065f3fddec410808dc1abdd5 Signed-off-by: Ashok Vuyyuru --- drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c index 2380552b38..871c5a2566 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c @@ -441,6 +441,49 @@ static ssize_t ipa3_read_ep_reg(struct file *file, char __user *ubuf, return size; } +static ssize_t ipa3_set_clk_index(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +{ + s8 option = 0; + int ret; + uint32_t bw_idx = 0; + + ret = kstrtos8_from_user(buf, count, 0, &option); + if (ret) + return ret; + + switch (option) { + case 0: + bw_idx = 0; + break; + case 1: + bw_idx = 1; + break; + case 2: + bw_idx = 2; + break; + case 3: + bw_idx = 3; + break; + case 4: + bw_idx = 4; + break; + default: + pr_err("Not support this vote (%d)\n", option); + return -EFAULT; + } + pr_info("Make sure some client connected before scaling the BW\n"); + ipa3_ctx->enable_clock_scaling = 1; + if (ipa3_set_clock_plan_from_pm(bw_idx)) { + IPAERR("Failed to vote for bus BW (%u)\n", bw_idx); + return -EFAULT; + } + ipa3_ctx->enable_clock_scaling = 0; + IPAERR("Clock scaling is done sucessful\n"); + + return count; +} + static ssize_t ipa3_write_keep_awake(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { @@ -2751,6 +2794,10 @@ static const struct ipa3_debugfs_file debugfs_files[] = { .read = ipa3_read_keep_awake, .write = ipa3_write_keep_awake, } + }, { + "set_clk_idx", IPA_READ_WRITE_MODE, NULL, { + .write = ipa3_set_clk_index, + } }, { "holb", IPA_WRITE_ONLY_MODE, NULL, { .write = ipa3_write_ep_holb,