From: Jeffrey Hugo <jhugo@codeaurora.org>
To: mturquette@baylibre.com, sboyd@kernel.org, andy.gross@linaro.org,
david.brown@linaro.org
Cc: bjorn.andersson@linaro.org, linux-clk@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeffrey Hugo <jhugo@codeaurora.org>
Subject: [PATCH] clk: qcom: List rates in debugfs for rcg
Date: Tue, 18 Dec 2018 10:08:04 -0700 [thread overview]
Message-ID: <1545152884-768-1-git-send-email-jhugo@codeaurora.org> (raw)
RCGs typically have multiple frequencies they can support based on client
requests. It can be very helpful to have a list of what are the supported
frequencies when attempting to bringup or debug a new device. Add a clock
specific "list_rates" debugfs file which dumps the supported rates of a
selected rcg in a convenient format.
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
---
drivers/clk/qcom/clk-rcg2.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index 6e3bd19..e4b1d35 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -13,6 +13,8 @@
#include <linux/regmap.h>
#include <linux/math64.h>
#include <linux/slab.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
#include <asm/div64.h>
@@ -347,6 +349,36 @@ static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw,
return __clk_rcg2_set_rate(hw, rate, FLOOR);
}
+static int rcg2_list_rates_show(struct seq_file *m, void *unused)
+{
+ struct clk_rcg2 *rcg = m->private;
+ const struct freq_tbl *f;
+
+ if (rcg->freq_tbl)
+ for (f = rcg->freq_tbl; f->freq; f++)
+ seq_printf(m, "%lu\n", f->freq);
+
+ return 0;
+}
+
+static int rcg2_list_rates_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, rcg2_list_rates_show, inode->i_private);
+}
+
+static const struct file_operations rcg2_list_rates_fops = {
+ .open = rcg2_list_rates_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+static void clk_rcg2_debug_init(struct clk_hw *hw, struct dentry *dentry)
+{
+ debugfs_create_file("list_rates", 0444, dentry, to_clk_rcg2(hw),
+ &rcg2_list_rates_fops);
+}
+
const struct clk_ops clk_rcg2_ops = {
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
@@ -355,6 +387,7 @@ static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw,
.determine_rate = clk_rcg2_determine_rate,
.set_rate = clk_rcg2_set_rate,
.set_rate_and_parent = clk_rcg2_set_rate_and_parent,
+ .debug_init = clk_rcg2_debug_init,
};
EXPORT_SYMBOL_GPL(clk_rcg2_ops);
--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
reply other threads:[~2018-12-18 17:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1545152884-768-1-git-send-email-jhugo@codeaurora.org \
--to=jhugo@codeaurora.org \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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).