]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0095-OMAP-Add-debugfs-node-to-show-the-summary-of-all-clo.patch
linux 3.0: add more sakoman patches, refresh others
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0095-OMAP-Add-debugfs-node-to-show-the-summary-of-all-clo.patch
1 From b49b248a8109e24a3a115701c3ba27d07e21dc05 Mon Sep 17 00:00:00 2001
2 From: Jon Hunter <jon-hunter@ti.com>
3 Date: Sun, 10 Jul 2011 05:57:33 -0600
4 Subject: [PATCH 095/149] OMAP: Add debugfs node to show the summary of all clocks
6 Add a debugfs node called "summary" to /sys/kernel/debug/clock/
7 that displays a quick summary of all clocks registered in the
8 "clocks" structure. The format of the output from this node is:
10 <clock-name> <parent-name> <rate> <usecount>
12 This debugfs node was very helpful for taking a quick snapshot of
13 the linux clock tree for OMAP and ensuring clock frequencies
14 calculated by the kernel were indeed correct. This patch helped
15 uncover some bugs in the linux clock tree for OMAP4.
17 Signed-off-by: Jon Hunter <jon-hunter@ti.com>
18 Signed-off-by: Paul Walmsley <paul@pwsan.com>
19 ---
20  arch/arm/plat-omap/clock.c |   39 +++++++++++++++++++++++++++++++++++++++
21  1 files changed, 39 insertions(+), 0 deletions(-)
23 diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
24 index c9122dd..156b27d 100644
25 --- a/arch/arm/plat-omap/clock.c
26 +++ b/arch/arm/plat-omap/clock.c
27 @@ -475,8 +475,41 @@ int __init clk_init(struct clk_functions * custom_clocks)
28  /*
29   *     debugfs support to trace clock tree hierarchy and attributes
30   */
31 +
32 +#include <linux/debugfs.h>
33 +#include <linux/seq_file.h>
34 +
35  static struct dentry *clk_debugfs_root;
36  
37 +static int clk_dbg_show_summary(struct seq_file *s, void *unused)
38 +{
39 +       struct clk *c;
40 +       struct clk *pa;
41 +
42 +       seq_printf(s, "%-30s %-30s %-10s %s\n",
43 +               "clock-name", "parent-name", "rate", "use-count");
44 +
45 +       list_for_each_entry(c, &clocks, node) {
46 +               pa = c->parent;
47 +               seq_printf(s, "%-30s %-30s %-10lu %d\n",
48 +                       c->name, pa ? pa->name : "none", c->rate, c->usecount);
49 +       }
50 +
51 +       return 0;
52 +}
53 +
54 +static int clk_dbg_open(struct inode *inode, struct file *file)
55 +{
56 +       return single_open(file, clk_dbg_show_summary, inode->i_private);
57 +}
58 +
59 +static const struct file_operations debug_clock_fops = {
60 +       .open           = clk_dbg_open,
61 +       .read           = seq_read,
62 +       .llseek         = seq_lseek,
63 +       .release        = single_release,
64 +};
65 +
66  static int clk_debugfs_register_one(struct clk *c)
67  {
68         int err;
69 @@ -551,6 +584,12 @@ static int __init clk_debugfs_init(void)
70                 if (err)
71                         goto err_out;
72         }
73 +
74 +       d = debugfs_create_file("summary", S_IRUGO,
75 +               d, NULL, &debug_clock_fops);
76 +       if (!d)
77 +               return -ENOMEM;
78 +
79         return 0;
80  err_out:
81         debugfs_remove_recursive(clk_debugfs_root);
82 -- 
83 1.6.6.1