Skip to content

Commit e5e8924

Browse files
cdleonardbebarino
authored andcommitted
clk: Add clk_parent entry in debugfs
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>
1 parent a188339 commit e5e8924

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎drivers/clk/clk.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,6 +3011,17 @@ static int possible_parents_show(struct seq_file *s, void *data)
30113011
}
30123012
DEFINE_SHOW_ATTRIBUTE(possible_parents);
30133013

3014+
static int current_parent_show(struct seq_file *s, void *data)
3015+
{
3016+
struct clk_core *core = s->private;
3017+
3018+
if (core->parent)
3019+
seq_printf(s, "%s\n", core->parent->name);
3020+
3021+
return 0;
3022+
}
3023+
DEFINE_SHOW_ATTRIBUTE(current_parent);
3024+
30143025
static int clk_duty_cycle_show(struct seq_file *s, void *data)
30153026
{
30163027
struct clk_core *core = s->private;
@@ -3043,6 +3054,10 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
30433054
debugfs_create_file("clk_duty_cycle", 0444, root, core,
30443055
&clk_duty_cycle_fops);
30453056

3057+
if (core->num_parents > 0)
3058+
debugfs_create_file("clk_parent", 0444, root, core,
3059+
&current_parent_fops);
3060+
30463061
if (core->num_parents > 1)
30473062
debugfs_create_file("clk_possible_parents", 0444, root, core,
30483063
&possible_parents_fops);

0 commit comments

Comments
 (0)