mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
clk: Add clk_min/max_rate entries in debugfs
Add two files to expose min/max clk rates as determined by clk_core_get_boundaries, taking all consumer requests into account. This information does not appear to be otherwise exposed to userspace. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Link: https://lkml.kernel.org/r/68e96af2df96512300604d797ade2088d7e6e496.1562073871.git.leonard.crestez@nxp.com [sboyd@kernel.org: Drop if statements for JSON printing] Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
5f9e832c13
commit
1bd37a4677
@ -2896,15 +2896,21 @@ DEFINE_SHOW_ATTRIBUTE(clk_summary);
|
||||
|
||||
static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
|
||||
{
|
||||
unsigned long min_rate, max_rate;
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
clk_core_get_boundaries(c, &min_rate, &max_rate);
|
||||
|
||||
/* This should be JSON format, i.e. elements separated with a comma */
|
||||
seq_printf(s, "\"%s\": { ", c->name);
|
||||
seq_printf(s, "\"enable_count\": %d,", c->enable_count);
|
||||
seq_printf(s, "\"prepare_count\": %d,", c->prepare_count);
|
||||
seq_printf(s, "\"protect_count\": %d,", c->protect_count);
|
||||
seq_printf(s, "\"rate\": %lu,", clk_core_get_rate(c));
|
||||
seq_printf(s, "\"min_rate\": %lu,", min_rate);
|
||||
seq_printf(s, "\"max_rate\": %lu,", max_rate);
|
||||
seq_printf(s, "\"accuracy\": %lu,", clk_core_get_accuracy(c));
|
||||
seq_printf(s, "\"phase\": %d,", clk_core_get_phase(c));
|
||||
seq_printf(s, "\"duty_cycle\": %u",
|
||||
@ -3064,6 +3070,34 @@ static int clk_duty_cycle_show(struct seq_file *s, void *data)
|
||||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(clk_duty_cycle);
|
||||
|
||||
static int clk_min_rate_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct clk_core *core = s->private;
|
||||
unsigned long min_rate, max_rate;
|
||||
|
||||
clk_prepare_lock();
|
||||
clk_core_get_boundaries(core, &min_rate, &max_rate);
|
||||
clk_prepare_unlock();
|
||||
seq_printf(s, "%lu\n", min_rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(clk_min_rate);
|
||||
|
||||
static int clk_max_rate_show(struct seq_file *s, void *data)
|
||||
{
|
||||
struct clk_core *core = s->private;
|
||||
unsigned long min_rate, max_rate;
|
||||
|
||||
clk_prepare_lock();
|
||||
clk_core_get_boundaries(core, &min_rate, &max_rate);
|
||||
clk_prepare_unlock();
|
||||
seq_printf(s, "%lu\n", max_rate);
|
||||
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SHOW_ATTRIBUTE(clk_max_rate);
|
||||
|
||||
static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
|
||||
{
|
||||
struct dentry *root;
|
||||
@ -3075,6 +3109,8 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
|
||||
core->dentry = root;
|
||||
|
||||
debugfs_create_ulong("clk_rate", 0444, root, &core->rate);
|
||||
debugfs_create_file("clk_min_rate", 0444, root, core, &clk_min_rate_fops);
|
||||
debugfs_create_file("clk_max_rate", 0444, root, core, &clk_max_rate_fops);
|
||||
debugfs_create_ulong("clk_accuracy", 0444, root, &core->accuracy);
|
||||
debugfs_create_u32("clk_phase", 0444, root, &core->phase);
|
||||
debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops);
|
||||
|
Loading…
Reference in New Issue
Block a user