Skip to contentSkip to conversation

clk: Add enable-state column to clk summary

PATCH Superseded Dmitry Osipenko 2 participants 3 messages Nov 4, 2020 – Nov 13, 2020 Common clk

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: Add enable-state column to clk summary

Add "enable state" column to the clk summary. It's handy to know actual hardware state of all clocks for debugging purposes. In conjunction with clk_ignore_unused, this tells us what unused clocks are left on after bootloader without disabling the clocks. It's also s useful debugging information for cases where firmware touches clocks.

---
 drivers/clk/clk.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/clk/clk.c +5 -4
index f83dac54ed85..07fbdea488bc 100644
@@ -2931,7 +2931,8 @@ 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));
+	seq_printf(s, " %7d\n", clk_core_is_enabled(c));
 }
 
 static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
@@ -2950,9 +2951,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  enable\n");
+	seq_puts(s, "   clock                          count    count    count        rate   accuracy phase  cycle   state\n");
+	seq_puts(s, "-----------------------------------------------------------------------------------------------------\n");
 
 	clk_prepare_lock();
 
Signature · 1 line
2.27.0
maintainer
#1 lore raw

Quoting Dmitry Osipenko (2020-11-04 08:56:31)

Quoted 4 lines

Add "enable state" column to the clk summary. It's handy to know actual hardware state of all clocks for debugging purposes. In conjunction with clk_ignore_unused, this tells us what unused clocks are left on after bootloader without disabling the clocks.

Should it be called "boot state" then? That idea sounds OK to me.

Quoted 1 line

It's also s useful debugging

Stray 's' here.

Quoted 1 line

information for cases where firmware touches clocks.

Care to explain more? Presumably you mean when firmware is modifying clk state without notifying the kernel? In which case it should be called "hardware enable" or something like that and be a "Y/N/?" value depending on if the value can be read or not and if it is enabled or not?

Quoted 2 lines
#2 lore raw

13.11.2020 11:18, Stephen Boyd пишет:

Quoted 8 lines

Quoting Dmitry Osipenko (2020-11-04 08:56:31)

Quoted 4 lines

Add "enable state" column to the clk summary. It's handy to know actual hardware state of all clocks for debugging purposes. In conjunction with clk_ignore_unused, this tells us what unused clocks are left on after bootloader without disabling the clocks.

Should it be called "boot state" then? That idea sounds OK to me.

Quoted 8 lines
Quoted 1 line

It's also s useful debugging

Stray 's' here.

Quoted 1 line

information for cases where firmware touches clocks.

Care to explain more? Presumably you mean when firmware is modifying clk state without notifying the kernel?

This is exactly what I meant.

Quoted 3 lines

In which case it should be called
"hardware enable" or something like that and be a "Y/N/?" value depending on if the value can be read or not and if it is enabled or not?

Indeed, I like the "hardware enable", thank you for the suggestion. The "Y/N/?" suggestion is also good.

I'll prepare v2, thank you for the review!