public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: Add hardware-enable column to clk summary
@ 2020-11-15 20:34 Dmitry Osipenko
  2020-12-17  9:44 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2020-11-15 20:34 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel

Add "hardware enable" column to the clk summary in order to show actual
hardware enable-state of all clocks. The possible states are "Y/N/?",
where question mark means that state is unknown, i.e. clock isn't a
mux and clk-driver doesn't support is_enabled() callback for this clock.

In conjunction with clk_ignore_unused, this tells us what unused clocks
are left enabled after bootloader. This is also useful a useful aid for
debugging interactions with firmware which changes clock states without
notifying kernel.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---

Changelog:

v2: - Renamed "enable state" column to "hardware enable" and changed
      reported values to Y/N/?

    - Improved commit message.

 drivers/clk/clk.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f83dac54ed85..c2cbf3618680 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2931,7 +2931,14 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
 	else
 		seq_puts(s, "-----");
 
-	seq_printf(s, " %6d\n", 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');
+	else if (!c->ops->enable)
+		seq_printf(s, " %9c\n", 'Y');
+	else
+		seq_printf(s, " %9c\n", '?');
 }
 
 static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
@@ -2950,9 +2957,9 @@ 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\n");
-	seq_puts(s, "   clock                          count    count    count        rate   accuracy phase  cycle\n");
-	seq_puts(s, "---------------------------------------------------------------------------------------------\n");
+	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");
 
 	clk_prepare_lock();
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] clk: Add hardware-enable column to clk summary
  2020-11-15 20:34 [PATCH v2] clk: Add hardware-enable column to clk summary Dmitry Osipenko
@ 2020-12-17  9:44 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2020-12-17  9:44 UTC (permalink / raw)
  To: Dmitry Osipenko, Michael Turquette; +Cc: linux-clk, linux-kernel

Quoting Dmitry Osipenko (2020-11-15 12:34:32)
> Add "hardware enable" column to the clk summary in order to show actual
> hardware enable-state of all clocks. The possible states are "Y/N/?",
> where question mark means that state is unknown, i.e. clock isn't a
> mux and clk-driver doesn't support is_enabled() callback for this clock.
> 
> In conjunction with clk_ignore_unused, this tells us what unused clocks
> are left enabled after bootloader. This is also useful a useful aid for
> debugging interactions with firmware which changes clock states without
> notifying kernel.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-17  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-15 20:34 [PATCH v2] clk: Add hardware-enable column to clk summary Dmitry Osipenko
2020-12-17  9:44 ` Stephen Boyd

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