Messages in this thread Patch in this message | | | From | Maksim Kiselev <> | Subject | [PATCH v1] clk: Add clock consumer and connection id to clk summary | Date | Sun, 10 Sep 2023 00:47:32 +0300 |
| |
Add "consumer device" and "connection id" columns to the clk summary in order to show which user acquired and enabled a particular clock.
Co-developed-by: Chinmoy Ghosh <chinmoyghosh2001@gmail.com> Signed-off-by: Chinmoy Ghosh <chinmoyghosh2001@gmail.com> Co-developed-by: Mintu Patel <mintupatel89@gmail.com> Signed-off-by: Mintu Patel <mintupatel89@gmail.com> Co-developed-by: Vimal Kumar <vimal.kumar32@gmail.com> Signed-off-by: Vimal Kumar <vimal.kumar32@gmail.com> Co-developed-by: Vishal Badole <badolevishal1116@gmail.com> Signed-off-by: Vishal Badole <badolevishal1116@gmail.com> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com> --- drivers/clk/clk.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index c249f9791ae8..64ee44f55a6f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -3187,7 +3187,8 @@ static struct hlist_head *orphan_list[] = { static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, int level) { - int phase; + int phase, next_line = 0; + struct clk *clk_user; seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ", level * 3 + 1, "", @@ -3205,11 +3206,25 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c, seq_printf(s, " %6d", clk_core_get_scaled_duty_cycle(c, 100000)); if (c->ops->is_enabled) - seq_printf(s, " %9c\n", clk_core_is_enabled(c) ? 'Y' : 'N'); + seq_printf(s, " %9c", clk_core_is_enabled(c) ? 'Y' : 'N'); else if (!c->ops->enable) - seq_printf(s, " %9c\n", 'Y'); + seq_printf(s, " %9c", 'Y'); else - seq_printf(s, " %9c\n", '?'); + seq_printf(s, " %9c", '?'); + + hlist_for_each_entry(clk_user, &c->clks, clks_node) { + if (!clk_user->dev_id && !clk_user->con_id) + continue; + + seq_printf(s, "%*s%-25s %10s\n", + 2 + 103 * next_line, "", + clk_user->dev_id, clk_user->con_id); + + next_line = 1; + } + + if (!next_line) + seq_puts(s, "\n"); } static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c, @@ -3230,9 +3245,9 @@ static int clk_summary_show(struct seq_file *s, void *data) struct clk_core *c; struct hlist_head **lists = s->private; - seq_puts(s, " enable prepare protect duty hardware\n"); - seq_puts(s, " clock count count count rate accuracy phase cycle enable\n"); - seq_puts(s, "-------------------------------------------------------------------------------------------------------\n"); + seq_puts(s, " enable prepare protect duty hardware consumer connection\n"); + seq_puts(s, " clock count count count rate accuracy phase cycle enable device id\n"); + seq_puts(s, "----------------------------------------------------------------------------------------------------------------------------------------------\n"); clk_prepare_lock(); -- 2.39.2
| |