public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] clk: Add clock consumer and connection id to clk summary
@ 2023-09-09 21:47 Maksim Kiselev
  0 siblings, 0 replies; only message in thread
From: Maksim Kiselev @ 2023-09-09 21:47 UTC (permalink / raw)
  To: linux-clk
  Cc: Maksim Kiselev, Chinmoy Ghosh, Mintu Patel, Vimal Kumar,
	Vishal Badole, Michael Turquette, Stephen Boyd, linux-kernel

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-09 21:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-09 21:47 [PATCH v1] clk: Add clock consumer and connection id to clk summary Maksim Kiselev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox