* [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file
@ 2012-09-07 7:20 최종환
2012-09-07 17:33 ` Sylwester Nawrocki
2012-10-23 11:01 ` Kukjin Kim
0 siblings, 2 replies; 3+ messages in thread
From: 최종환 @ 2012-09-07 7:20 UTC (permalink / raw)
To: inux-arm-kernel, linux-samsung-soc; +Cc: kgene.kim, ben-linux
From: Colin Cross <ccross@android.com>
Add a clock/clock_tree debugfs file that shows the entire clock
hierarchy including usage counts and rates.
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
---
arch/arm/plat-samsung/clock.c | 65
++++++++++++++++++++++++++++++++++++++++-
1 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index b7338ce..9392959 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -396,6 +396,64 @@ int __init s3c24xx_register_baseclocks(unsigned long
xtal)
static struct dentry *clk_debugfs_root;
+static void clock_tree_show_one(struct seq_file *s, struct clk *c, int
level)
+{
+ struct clk *child;
+ const char *state;
+ char buf[255] = { 0 };
+ int n = 0;
+
+ if (c->name)
+ n = snprintf(buf, sizeof(buf) - 1, "%s", c->name);
+
+ if (c->devname)
+ n += snprintf(buf + n, sizeof(buf) - 1 - n, ":%s", c-
>devname);
+
+ state = (c->usage > 0) ? "on" : "off";
+
+ seq_printf(s, "%*s%-*s %-6s %-3d %-10lu\n",
+ level * 3 + 1, "",
+ 50 - level * 3, buf,
+ state, c->usage, clk_get_rate(c));
+
+ list_for_each_entry(child, &clocks, list) {
+ if (child->parent != c)
+ continue;
+
+ clock_tree_show_one(s, child, level + 1);
+ }
+}
+
+static int clock_tree_show(struct seq_file *s, void *data)
+{
+ struct clk *c;
+ unsigned long flags;
+
+ seq_printf(s, " clock
state ref rate\n");
+ seq_printf(s, "-----------------------------------------------------
---------------\n");
+
+ spin_lock_irqsave(&clocks_lock, flags);
+
+ list_for_each_entry(c, &clocks, list)
+ if (c->parent == NULL)
+ clock_tree_show_one(s, c, 0);
+
+ spin_unlock_irqrestore(&clocks_lock, flags);
+ return 0;
+}
+
+static int clock_tree_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, clock_tree_show, inode->i_private);
+}
+
+static const struct file_operations clock_tree_fops = {
+ .open = clock_tree_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
"0001-ARM-samsung-clock-add-clock_tree-debugfs-file.patch" 106L, 2832C
1,1 Top
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
static int clk_debugfs_register_one(struct clk *c)
{
int err;
@@ -457,13 +515,18 @@ static int __init clk_debugfs_init(void)
{
struct clk *c;
struct dentry *d;
- int err;
+ int err = -ENOMEM;
d = debugfs_create_dir("clock", NULL);
if (!d)
return -ENOMEM;
clk_debugfs_root = d;
+ d = debugfs_create_file("clock_tree", S_IRUGO, clk_debugfs_root,
NULL,
+ &clock_tree_fops);
+ if (!d)
+ goto err_out;
+
list_for_each_entry(c, &clocks, list) {
err = clk_debugfs_register(c);
if (err)
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file
2012-09-07 7:20 [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file 최종환
@ 2012-09-07 17:33 ` Sylwester Nawrocki
2012-10-23 11:01 ` Kukjin Kim
1 sibling, 0 replies; 3+ messages in thread
From: Sylwester Nawrocki @ 2012-09-07 17:33 UTC (permalink / raw)
To: 최종환
Cc: inux-arm-kernel, linux-samsung-soc, kgene.kim, ben-linux
Hi,
On 09/07/2012 09:20 AM, 최종환 wrote:
> From: Colin Cross<ccross@android.com>
>
> Add a clock/clock_tree debugfs file that shows the entire clock
> hierarchy including usage counts and rates.
>
> Signed-off-by: Colin Cross<ccross@android.com>
> Signed-off-by: Jonghwan Choi<jhbird.choi@samsung.com>
Due to Korean characters this patch series has improper encoding:
$ git am -3 \[PATCH\ 1_2\]\ ARM\:\ samsung\:\ clock\:\ add\ clock_tree\ debugfs\ file.eml
fatal: cannot convert from ks_c_5601-1987 to UTF-8
Could you please fix this end resend ?
--
Thanks,
Sylwester
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file
2012-09-07 7:20 [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file 최종환
2012-09-07 17:33 ` Sylwester Nawrocki
@ 2012-10-23 11:01 ` Kukjin Kim
1 sibling, 0 replies; 3+ messages in thread
From: Kukjin Kim @ 2012-10-23 11:01 UTC (permalink / raw)
To: '최종환', inux-arm-kernel,
linux-samsung-soc
Cc: ben-linux, 'Colin Cross'
최종환 wrote:
>
> From: Colin Cross <ccross@android.com>
>
> Add a clock/clock_tree debugfs file that shows the entire clock
> hierarchy including usage counts and rates.
>
> Signed-off-by: Colin Cross <ccross@android.com>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
> arch/arm/plat-samsung/clock.c | 65
> ++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 64 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
> index b7338ce..9392959 100644
> --- a/arch/arm/plat-samsung/clock.c
> +++ b/arch/arm/plat-samsung/clock.c
> @@ -396,6 +396,64 @@ int __init s3c24xx_register_baseclocks(unsigned long
> xtal)
>
> static struct dentry *clk_debugfs_root;
>
> +static void clock_tree_show_one(struct seq_file *s, struct clk *c, int
> level)
> +{
> + struct clk *child;
> + const char *state;
> + char buf[255] = { 0 };
> + int n = 0;
> +
> + if (c->name)
> + n = snprintf(buf, sizeof(buf) - 1, "%s", c->name);
> +
> + if (c->devname)
> + n += snprintf(buf + n, sizeof(buf) - 1 - n, ":%s", c-
> >devname);
> +
> + state = (c->usage > 0) ? "on" : "off";
> +
> + seq_printf(s, "%*s%-*s %-6s %-3d %-10lu\n",
> + level * 3 + 1, "",
> + 50 - level * 3, buf,
> + state, c->usage, clk_get_rate(c));
> +
> + list_for_each_entry(child, &clocks, list) {
> + if (child->parent != c)
> + continue;
> +
> + clock_tree_show_one(s, child, level + 1);
> + }
> +}
> +
> +static int clock_tree_show(struct seq_file *s, void *data)
> +{
> + struct clk *c;
> + unsigned long flags;
> +
> + seq_printf(s, " clock
> state ref rate\n");
> + seq_printf(s, "---------------------------------------------------
-
> -
> ---------------\n");
> +
> + spin_lock_irqsave(&clocks_lock, flags);
> +
> + list_for_each_entry(c, &clocks, list)
> + if (c->parent == NULL)
> + clock_tree_show_one(s, c, 0);
> +
> + spin_unlock_irqrestore(&clocks_lock, flags);
> + return 0;
> +}
> +
> +static int clock_tree_open(struct inode *inode, struct file *file)
> +{
> + return single_open(file, clock_tree_show, inode->i_private);
> +}
> +
> +static const struct file_operations clock_tree_fops = {
> + .open = clock_tree_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> "0001-ARM-samsung-clock-add-clock_tree-debugfs-file.patch" 106L, 2832C
> 1,1 Top
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = single_release,
> +};
> +
> static int clk_debugfs_register_one(struct clk *c)
> {
> int err;
> @@ -457,13 +515,18 @@ static int __init clk_debugfs_init(void)
> {
> struct clk *c;
> struct dentry *d;
> - int err;
> + int err = -ENOMEM;
>
> d = debugfs_create_dir("clock", NULL);
> if (!d)
> return -ENOMEM;
> clk_debugfs_root = d;
>
> + d = debugfs_create_file("clock_tree", S_IRUGO, clk_debugfs_root,
> NULL,
> + &clock_tree_fops);
> + if (!d)
> + goto err_out;
> +
> list_for_each_entry(c, &clocks, list) {
> err = clk_debugfs_register(c);
> if (err)
> --
> 1.7.1
Applied with fixing patch format :(
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-23 11:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 7:20 [PATCH 1/2] ARM: samsung: clock: add clock_tree debugfs file 최종환
2012-09-07 17:33 ` Sylwester Nawrocki
2012-10-23 11:01 ` Kukjin Kim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.