mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
clk: added extra features to DebugFS representation of the clock tree.
This commit is contained in:
@@ -33,6 +33,14 @@ config COMMON_CLK_DEBUG
|
||||
clk_flags, clk_prepare_count, clk_enable_count &
|
||||
clk_notifier_count.
|
||||
|
||||
config COMMON_CLK_DEBUG_EXTRA
|
||||
bool "Extra features for the clock tree DebugFS"
|
||||
depends on COMMON_CLK_DEBUG
|
||||
---help---
|
||||
Adds one write-one file named change_rate to each
|
||||
directory, allowing the function clk_set_rate to
|
||||
be called.
|
||||
|
||||
config COMMON_CLK_WM831X
|
||||
tristate "Clock driver for WM831x/2x PMICs"
|
||||
depends on MFD_WM831X
|
||||
|
||||
@@ -226,6 +226,16 @@ static const struct file_operations clk_dump_fops = {
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
#if CONFIG_COMMON_CLK_DEBUG_EXTRA
|
||||
static int debugfs_clk_set_rate(void *data, u64 val)
|
||||
{
|
||||
struct clk *clk = (struct clk *) data;
|
||||
return clk_set_rate(clk, (u32) val);
|
||||
}
|
||||
|
||||
DEFINE_SIMPLE_ATTRIBUTE(fops_clk_rate_wo, NULL, debugfs_clk_set_rate, "%llu\n");
|
||||
#endif /* CONFIG_COMMON_CLK_DEBUG_EXTRA */
|
||||
|
||||
/* caller must hold prepare_lock */
|
||||
static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
|
||||
{
|
||||
@@ -248,6 +258,12 @@ static int clk_debug_create_one(struct clk *clk, struct dentry *pdentry)
|
||||
if (!d)
|
||||
goto err_out;
|
||||
|
||||
#if CONFIG_COMMON_CLK_DEBUG_EXTRA
|
||||
d = debugfs_create_file("change_rate", S_IWUGO, clk->dentry, clk, &fops_clk_rate_wo);
|
||||
if (!d)
|
||||
goto err_out;
|
||||
#endif
|
||||
|
||||
d = debugfs_create_x32("clk_flags", S_IRUGO, clk->dentry,
|
||||
(u32 *)&clk->flags);
|
||||
if (!d)
|
||||
|
||||
Reference in New Issue
Block a user