Re: [PATCH 1/1] ARM: OMAP: CLKFW: Initial sysfs support for omap clock framework

David Brownell
2008-04-16T16:58:19Z

On Wednesday 16 April 2008, Hiroshi DOYU wrote:
>         omap:~# tree -d /sys/kernel/clock/omap_32k_fck/
>         /sys/kernel/clock/omap_32k_fck/
>         |-- gpt10_fck
>         |-- gpt11_fck
>         |-- gpt1_fck
>         |-- per_32k_alwon_fck
>         |   |-- gpio3_fck
>         |   |-- gpio4_fck
>         |   |-- gpio5_fck
>         |   `-- gpio6_fck
>         |-- ts_fck
>         `-- wkup_32k_fck
>             `-- gpio1_fck
>
>         11 directories
>
>         omap:~# tree /sys/kernel/clock/omap_32k_fck/gpt10_fck
>         /sys/kernel/clock/omap_32k_fck/gpt10_fck
>         |-- flags
>         |-- rate
>         `-- usecount

Does this need to be in sysfs? I'd think debugfs would be
more appropriate ... that information isn't needed for normal
operation.

Appended is a small patch I've been carrying around. This
doesn't move the clocks info from procfs to debugfs, but
that'd be an easy patch. (Probably needs minor updates given
the recent clocktree changes, but it still applies. The
coupling to the device tree is a bit weak, and I'd think
displaying power domains would be useful too.)

- Dave

============ CUT HERE
Make /proc/omap_clocks show the clock hierarchy through indentation,
and the ids for devices (like i2c and spi; but oddly not uart, gpt,
mcbsp, or wdt) with multiple instances.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
arch/arm/plat-omap/clock.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

--- a/arch/arm/plat-omap/clock.c 2007-11-23 18:29:46.000000000 -0800
+++ b/arch/arm/plat-omap/clock.c 2007-11-23 18:45:44.000000000 -0800
@@ -465,13 +465,30 @@ static void omap_ck_stop(struct seq_file
{
}

-int omap_ck_show(struct seq_file *m, void *v)
+/* show clock hierarchy */
+static void omap_cktree_show(struct seq_file *m, unsigned n, struct clk *p)
{
struct clk *cp;

- list_for_each_entry(cp, &clocks, node)
- seq_printf(m,"%s %ld %d\n", cp->name, cp->rate, cp->usecount);
+ if (p) {
+ seq_printf(m, "%*s%-*s %9ld Hz, use %2d",
+ n, "", 30 - n, p->name,
+ p->rate, p->usecount);
+ if (p->id)
+ seq_printf(m, " (id %d)", p->id);
+ seq_printf(m, "\n");
+ n += 2;
+ }

+ list_for_each_entry(cp, &clocks, node) {
+ if (cp->parent == p)
+ omap_cktree_show(m, n, cp);
+ }
+}
+
+static int omap_ck_show(struct seq_file *m, void *v)
+{
+ omap_cktree_show(m, 0, NULL);
return 0;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html