[PATCH 1/4] clk: debug: add support for setting clk_rate from debugfs

From: Tero Kristo
Date: Wed Jun 20 2018 - 07:48:26 EST


Signed-off-by: Tero Kristo <t-kristo@xxxxxx>
---
drivers/clk/clk.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 1c46babeb093..3429680691bd 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3087,6 +3087,26 @@ static int clk_duty_cycle_show(struct seq_file *s, void *data)
}
DEFINE_SHOW_ATTRIBUTE(clk_duty_cycle);

+static int clk_dbg_rate_get(void *data, u64 *val)
+{
+ struct clk_core *core = data;
+
+ *val = core->rate;
+
+ return 0;
+}
+
+static int clk_dbg_rate_set(void *data, u64 val)
+{
+ struct clk_core *core = data;
+
+ clk_core_set_rate_nolock(core, val);
+
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(clk_dbg_option_rate, clk_dbg_rate_get, clk_dbg_rate_set, "%llu\n");
+
static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
{
struct dentry *root;
@@ -3097,7 +3117,7 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
root = debugfs_create_dir(core->name, pdentry);
core->dentry = root;

- debugfs_create_ulong("clk_rate", 0444, root, &core->rate);
+ debugfs_create_file("clk_rate", 0666, root, core, &clk_dbg_option_rate);
debugfs_create_ulong("clk_accuracy", 0444, root, &core->accuracy);
debugfs_create_u32("clk_phase", 0444, root, &core->phase);
debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops);
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


--------------E535A013B30481111D3FF646
Content-Type: text/x-patch;
name="0002-sci-clk-debug-add-reparenting-support-via-debugfs.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="0002-sci-clk-debug-add-reparenting-support-via-debugfs.patch"