lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1545152884-768-1-git-send-email-jhugo@codeaurora.org>
Date:   Tue, 18 Dec 2018 10:08:04 -0700
From:   Jeffrey Hugo <jhugo@...eaurora.org>
To:     mturquette@...libre.com, sboyd@...nel.org, andy.gross@...aro.org,
        david.brown@...aro.org
Cc:     bjorn.andersson@...aro.org, linux-clk@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jeffrey Hugo <jhugo@...eaurora.org>
Subject: [PATCH] clk: qcom: List rates in debugfs for rcg

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@...eaurora.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ