diff options
author | Jon Hunter <jon-hunter@ti.com> | 2011-07-10 07:57:33 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-07-10 07:57:33 -0400 |
commit | a53025724052b2b1edbc982a4a248784638f563d (patch) | |
tree | a9625e828c793d7b401db95eb0556fdd839ba46e /arch/arm | |
parent | c84584139aaeef7631df152e13cbf319d8e55950 (diff) |
OMAP: Add debugfs node to show the summary of all clocks
Add a debugfs node called "summary" to /sys/kernel/debug/clock/
that displays a quick summary of all clocks registered in the
"clocks" structure. The format of the output from this node is:
<clock-name> <parent-name> <rate> <usecount>
This debugfs node was very helpful for taking a quick snapshot of
the linux clock tree for OMAP and ensuring clock frequencies
calculated by the kernel were indeed correct. This patch helped
uncover some bugs in the linux clock tree for OMAP4.
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/plat-omap/clock.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c index c9122dd6ee8d..156b27dd5817 100644 --- a/arch/arm/plat-omap/clock.c +++ b/arch/arm/plat-omap/clock.c | |||
@@ -475,8 +475,41 @@ int __init clk_init(struct clk_functions * custom_clocks) | |||
475 | /* | 475 | /* |
476 | * debugfs support to trace clock tree hierarchy and attributes | 476 | * debugfs support to trace clock tree hierarchy and attributes |
477 | */ | 477 | */ |
478 | |||
479 | #include <linux/debugfs.h> | ||
480 | #include <linux/seq_file.h> | ||
481 | |||
478 | static struct dentry *clk_debugfs_root; | 482 | static struct dentry *clk_debugfs_root; |
479 | 483 | ||
484 | static int clk_dbg_show_summary(struct seq_file *s, void *unused) | ||
485 | { | ||
486 | struct clk *c; | ||
487 | struct clk *pa; | ||
488 | |||
489 | seq_printf(s, "%-30s %-30s %-10s %s\n", | ||
490 | "clock-name", "parent-name", "rate", "use-count"); | ||
491 | |||
492 | list_for_each_entry(c, &clocks, node) { | ||
493 | pa = c->parent; | ||
494 | seq_printf(s, "%-30s %-30s %-10lu %d\n", | ||
495 | c->name, pa ? pa->name : "none", c->rate, c->usecount); | ||
496 | } | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | static int clk_dbg_open(struct inode *inode, struct file *file) | ||
502 | { | ||
503 | return single_open(file, clk_dbg_show_summary, inode->i_private); | ||
504 | } | ||
505 | |||
506 | static const struct file_operations debug_clock_fops = { | ||
507 | .open = clk_dbg_open, | ||
508 | .read = seq_read, | ||
509 | .llseek = seq_lseek, | ||
510 | .release = single_release, | ||
511 | }; | ||
512 | |||
480 | static int clk_debugfs_register_one(struct clk *c) | 513 | static int clk_debugfs_register_one(struct clk *c) |
481 | { | 514 | { |
482 | int err; | 515 | int err; |
@@ -551,6 +584,12 @@ static int __init clk_debugfs_init(void) | |||
551 | if (err) | 584 | if (err) |
552 | goto err_out; | 585 | goto err_out; |
553 | } | 586 | } |
587 | |||
588 | d = debugfs_create_file("summary", S_IRUGO, | ||
589 | d, NULL, &debug_clock_fops); | ||
590 | if (!d) | ||
591 | return -ENOMEM; | ||
592 | |||
554 | return 0; | 593 | return 0; |
555 | err_out: | 594 | err_out: |
556 | debugfs_remove_recursive(clk_debugfs_root); | 595 | debugfs_remove_recursive(clk_debugfs_root); |