]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
clk: Add clk_parent entry in debugfs
authorLeonard Crestez <leonard.crestez@nxp.com>
Mon, 10 Jun 2019 11:06:38 +0000 (14:06 +0300)
committerStephen Boyd <sboyd@kernel.org>
Tue, 25 Jun 2019 21:53:10 +0000 (14:53 -0700)
This allows to easily determine the parent in shell scripts without
parsing more complex files.

Add the clk_parent file for all clks which can have a parent, not just
muxes. This way it can be used to determine the clk tree structure
without parsing more complex files.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk.c

index aa51756fd4d695b359ee5c6117e7c9d00fddf183..d21a219deef86358b3bf43cc81173900a6331a08 100644 (file)
@@ -3011,6 +3011,17 @@ static int possible_parents_show(struct seq_file *s, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(possible_parents);
 
+static int current_parent_show(struct seq_file *s, void *data)
+{
+       struct clk_core *core = s->private;
+
+       if (core->parent)
+               seq_printf(s, "%s\n", core->parent->name);
+
+       return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(current_parent);
+
 static int clk_duty_cycle_show(struct seq_file *s, void *data)
 {
        struct clk_core *core = s->private;
@@ -3043,6 +3054,10 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
        debugfs_create_file("clk_duty_cycle", 0444, root, core,
                            &clk_duty_cycle_fops);
 
+       if (core->num_parents > 0)
+               debugfs_create_file("clk_parent", 0444, root, core,
+                                   &current_parent_fops);
+
        if (core->num_parents > 1)
                debugfs_create_file("clk_possible_parents", 0444, root, core,
                                    &possible_parents_fops);