diff options
author | Leonard Crestez <leonard.crestez@nxp.com> | 2019-06-10 14:06:38 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2019-06-26 00:53:10 +0300 |
commit | e5e89247a74bf35f0bbfd180a46f5bf75c086885 (patch) | |
tree | 88f2c28a148ad995a84870baf6b34556502e8e0d /drivers/clk/clk.c | |
parent | a188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff) | |
download | linux-e5e89247a74bf35f0bbfd180a46f5bf75c086885.tar.xz |
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>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index aa51756fd4d6..d21a219deef8 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -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, + ¤t_parent_fops); + if (core->num_parents > 1) debugfs_create_file("clk_possible_parents", 0444, root, core, &possible_parents_fops); |