From: "Andrii.Tseglytskyi" <andrii.tseglytskyi@xxxxxx> Patch adds debugfs entry for each ABB: /sys/kernel/debug/<ABB device name> This entry is read-only. It prints current state of ABB. Cc: Mike Turquette <mturquette@xxxxxxxxxx> Cc: Tero Kristo <t-kristo@xxxxxx> Cc: Nishanth Menon <nm@xxxxxx> Cc: "Benoît Cousson" <b-cousson@xxxxxx> Cc: linux-omap@xxxxxxxxxxxxxxx Signed-off-by: Andrii.Tseglytskyi <andrii.tseglytskyi@xxxxxx> --- drivers/power/avs/abb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/power/avs/abb.c b/drivers/power/avs/abb.c index f5bbb8d..ac43841 100644 --- a/drivers/power/avs/abb.c +++ b/drivers/power/avs/abb.c @@ -19,6 +19,7 @@ #include <linux/clk-provider.h> #include <linux/io.h> #include <linux/opp.h> +#include <linux/debugfs.h> /* NOMINAL_OPP bypasses the ABB ldo, FAST_OPP sets it to Forward Body-Bias */ #define OMAP_ABB_NOMINAL_OPP 0 @@ -410,6 +411,66 @@ static const struct of_device_id __initdata omap_abb_of_match[] = { MODULE_DEVICE_TABLE(of, omap_abb_of_match); #endif +static int omap_abb_info_dump(struct seq_file *sf, void *unused) +{ + struct opp *opp; + struct omap_abb *abb = (struct omap_abb *)sf->private; + u32 abb_ctrl, abb_setup, rate; + unsigned long freq = 0; + + if (!abb) { + seq_printf(sf, "No ABB defined\n"); + goto out; + } + + abb_ctrl = omap_abb_readl(abb, abb->data.control_offs); + abb_setup = omap_abb_readl(abb, abb->data.setup_offs); + rate = clk_get_rate(abb->notify_clk); + seq_printf(sf, "Enabled\t->\t%d\n" + "opp_sel\t->\t%u\n" + "FBB mode\t->\t%u\n" + "RBB mode\t->\t%u\n" + "PRM_LDO_ABB_XXX_SETUP\t->\t0x%08x\n" + "PRM_LDO_ABB_XXX_CTRL\t->\t0x%08x\n" + "Notify clk\t->\t(%s) rate (%u)\n", + !!(abb_setup & abb->data.sr2en_mask), + abb->opp_sel, + !!(abb_setup & abb->data.fbb_sel_mask), + !!(abb_setup & abb->data.rbb_sel_mask), + abb_setup, + abb_ctrl, + __clk_get_name(abb->notify_clk), rate); + + seq_printf(sf, "OPP table\n"); + rcu_read_lock(); + do { + opp = opp_find_freq_ceil(abb->dev, &freq); + if (IS_ERR(opp)) + break; + + seq_printf(sf, "Freq (%lu) ABB (%lu)\n", opp_get_freq(opp), + opp_get_voltage(opp)); + + freq++; + } while (1); + rcu_read_unlock(); + +out: + return 0; +} + +static int omap_abb_fops_open(struct inode *inode, struct file *file) +{ + return single_open(file, omap_abb_info_dump, inode->i_private); +} + +static const struct file_operations omap_abb_debug_fops = { + .open = omap_abb_fops_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + /* * omap_abb_probe() - Initialize an ABB ldo instance * @pdev: ABB platform device @@ -544,6 +605,9 @@ static int __init omap_abb_probe(struct platform_device *pdev) omap_abb_rmw(abb, abb->data.sr2en_mask, abb->data.sr2en_mask, abb->data.setup_offs); + debugfs_create_file(dev_name(abb->dev), S_IRUGO, NULL, + abb, &omap_abb_debug_fops); + clk_put(sys_clk); return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html