diff mbox series

[v5] Common clock: To list active consumers of clocks

Message ID 1669569799-8526-1-git-send-email-badolevishal1116@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v5] Common clock: To list active consumers of clocks | expand

Commit Message

Vishal Badole Nov. 27, 2022, 5:23 p.m. UTC
This feature lists the clock consumer's name and respective connection
id. Using this feature user can easily check that which user has
acquired and enabled a particular clock.

Usage:
>> cat /sys/kernel/debug/clk/clk_summary
                      enable  prepare  protect
                                                                          duty  hardware                            Connection
   clock               count    count    count    rate   accuracy phase  cycle    enable   consumer                         Id
------------------------------------------------------------------------------------------------------------------------------
 clk_mcasp0_fixed         0        0        0    24576000          0      0  50000     Y   deviceless                     of_clk_get_from_provider
                                                                                           deviceless                     no_connection_id
    clk_mcasp0            0        0        0    24576000          0      0  50000     N      simple-audio-card,cpu           no_connection_id
                                                                                              deviceless                      no_connection_id

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>
Signed-off-by: Vishal Badole <badolevishal1116@gmail.com>
---
 drivers/clk/clk.c | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

Comments

Vishal Badole Dec. 10, 2022, 7:03 a.m. UTC | #1
Hi Stephen,
We are eagerly waiting for ypur response. As per your suggestions, we have updated and sent another gerrit with message Id
<1669569799-8526-1-git-send-email-badolevishal1116@gmail.com>. In this new patch we are listing the clock consumers name along 
with consumer id in clk_summary.

Please review the latest patch.

New patch details:

Message ID:
<1669569799-8526-1-git-send-email-badolevishal1116@gmail.com>
Subject:        [PATCH v5] Common clock: To list active consumers of
clocks

Regards,
Vishal
Maksim Kiselev Aug. 26, 2023, 11:25 a.m. UTC | #2
Sorry for disturbing. Just a gentle ping :) 
This patch looks abandoned.
Is there any chance that it will be reviewed?

Cheers,
Maksim
Stephen Boyd Sept. 6, 2023, 9:37 p.m. UTC | #3
Quoting Maksim Kiselev (2023-08-26 04:25:24)
> Sorry for disturbing. Just a gentle ping :) 
> This patch looks abandoned.
> Is there any chance that it will be reviewed?
> 

You could review it. Or resend it.
Stephen Boyd Oct. 24, 2023, 2:20 a.m. UTC | #4
Quoting Vishal Badole (2022-11-27 09:23:19)
> This feature lists the clock consumer's name and respective connection
> id. Using this feature user can easily check that which user has
> acquired and enabled a particular clock.
> 
> Usage:
> >> cat /sys/kernel/debug/clk/clk_summary
>                       enable  prepare  protect
>                                                                           duty  hardware                            Connection
>    clock               count    count    count    rate   accuracy phase  cycle    enable   consumer                         Id
> ------------------------------------------------------------------------------------------------------------------------------
>  clk_mcasp0_fixed         0        0        0    24576000          0      0  50000     Y   deviceless                     of_clk_get_from_provider
>                                                                                            deviceless                     no_connection_id
>     clk_mcasp0            0        0        0    24576000          0      0  50000     N      simple-audio-card,cpu           no_connection_id
>                                                                                               deviceless                      no_connection_id
> 
> 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>
> Signed-off-by: Vishal Badole <badolevishal1116@gmail.com>
> ---

Applied to clk-next
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index bd0b35c..c4aa3b4 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2952,28 +2952,41 @@  static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
 				 int level)
 {
 	int phase;
+	struct clk *clk_user;
+	int multi_node = 0;
 
-	seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ",
+	seq_printf(s, "%*s%-*s %-7d %-8d %-8d %-11lu %-10lu ",
 		   level * 3 + 1, "",
-		   30 - level * 3, c->name,
+		   35 - level * 3, c->name,
 		   c->enable_count, c->prepare_count, c->protect_count,
 		   clk_core_get_rate_recalc(c),
 		   clk_core_get_accuracy_recalc(c));
 
 	phase = clk_core_get_phase(c);
 	if (phase >= 0)
-		seq_printf(s, "%5d", phase);
+		seq_printf(s, "%-5d", phase);
 	else
 		seq_puts(s, "-----");
 
-	seq_printf(s, " %6d", clk_core_get_scaled_duty_cycle(c, 100000));
+	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, " %5c ", clk_core_is_enabled(c) ? 'Y' : 'N');
 	else if (!c->ops->enable)
-		seq_printf(s, " %9c\n", 'Y');
+		seq_printf(s, " %5c ", 'Y');
 	else
-		seq_printf(s, " %9c\n", '?');
+		seq_printf(s, " %5c ", '?');
+
+	hlist_for_each_entry(clk_user, &c->clks, clks_node) {
+		seq_printf(s, "%*s%-*s  %-25s\n",
+			   level * 3 + 2 + 105 * multi_node, "",
+			   30,
+			   clk_user->dev_id ? clk_user->dev_id : "deviceless",
+			   clk_user->con_id ? clk_user->con_id : "no_connection_id");
+
+		multi_node = 1;
+	}
+
 }
 
 static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
@@ -2994,9 +3007,10 @@  static int clk_summary_show(struct seq_file *s, void *data)
 	struct clk_core *c;
 	struct hlist_head **lists = (struct hlist_head **)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                            connection\n");
+	seq_puts(s, "   clock                          count    count    count        rate   accuracy phase  cycle    enable   consumer                         id\n");
+	seq_puts(s, "---------------------------------------------------------------------------------------------------------------------------------------------\n");
+
 
 	clk_prepare_lock();