summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorXiaoming Zhou <zhoux@codeaurora.org>2013-08-20 13:23:06 -0400
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:20:21 -0700
commit42300e146da1d88d747f14f1017ac10adf5d6501 (patch)
tree804e74e70fa3f97abf43a79ca3b1e70db8ca2eb3 /drivers
parentb32a8b2e782ac00cc7744fc663d5db6b7f12598c (diff)
msm: mdss: make the mdss debugfs implementation generic
Remove the core specific details in the debugfs implementation via a defined debug interface. Change-Id: I2bf9ac47e0121f1f269d8d82274143d760305526 Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fbdev/msm/mdss.h8
-rw-r--r--drivers/video/fbdev/msm/mdss_debug.c83
-rw-r--r--drivers/video/fbdev/msm/mdss_mdp.c65
3 files changed, 98 insertions, 58 deletions
diff --git a/drivers/video/fbdev/msm/mdss.h b/drivers/video/fbdev/msm/mdss.h
index ae86a5cdad02..efc06f66ebc9 100644
--- a/drivers/video/fbdev/msm/mdss.h
+++ b/drivers/video/fbdev/msm/mdss.h
@@ -58,6 +58,12 @@ struct mdss_hw_settings {
u32 val;
};
+struct mdss_debug_inf {
+ void *debug_data;
+ int (*debug_dump_stats)(void *data, char *buf, int len);
+ void (*debug_enable_clock)(int on);
+};
+
struct mdss_data_type {
u32 mdp_rev;
struct clk *mdp_clk[MDSS_MAX_CLK];
@@ -125,7 +131,7 @@ struct mdss_data_type {
int iommu_attached;
struct mdss_iommu_map_type *iommu_map;
- void *debug_data;
+ struct mdss_debug_inf debug_inf;
int current_bus_idx;
bool mixer_switched;
struct mdss_panel_cfg pan_cfg;
diff --git a/drivers/video/fbdev/msm/mdss_debug.c b/drivers/video/fbdev/msm/mdss_debug.c
index 13fba269852e..f933c8eaaf4a 100644
--- a/drivers/video/fbdev/msm/mdss_debug.c
+++ b/drivers/video/fbdev/msm/mdss_debug.c
@@ -128,11 +128,12 @@ static ssize_t mdss_debug_base_reg_write(struct file *file,
const char __user *user_buf, size_t count, loff_t *ppos)
{
struct mdss_debug_base *dbg = file->private_data;
+ struct mdss_data_type *mdata = mdss_res;
size_t off;
u32 data, cnt;
char buf[24];
- if (!dbg)
+ if (!dbg || !mdata)
return -ENODEV;
if (count >= sizeof(buf))
@@ -151,9 +152,13 @@ static ssize_t mdss_debug_base_reg_write(struct file *file,
if (off >= dbg->max_offset)
return -EFAULT;
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
+ if (mdata->debug_inf.debug_enable_clock)
+ mdata->debug_inf.debug_enable_clock(1);
+
writel_relaxed(data, dbg->base + off);
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
+
+ if (mdata->debug_inf.debug_enable_clock)
+ mdata->debug_inf.debug_enable_clock(0);
pr_debug("addr=%x data=%x\n", off, data);
@@ -164,9 +169,10 @@ static ssize_t mdss_debug_base_reg_read(struct file *file,
char __user *user_buf, size_t count, loff_t *ppos)
{
struct mdss_debug_base *dbg = file->private_data;
+ struct mdss_data_type *mdata = mdss_res;
size_t len;
- if (!dbg) {
+ if (!dbg || !mdata) {
pr_err("invalid handle\n");
return -ENODEV;
}
@@ -188,7 +194,9 @@ static ssize_t mdss_debug_base_reg_read(struct file *file,
ptr = dbg->base + dbg->off;
tot = 0;
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
+ if (mdata->debug_inf.debug_enable_clock)
+ mdata->debug_inf.debug_enable_clock(1);
+
for (cnt = dbg->cnt; cnt > 0; cnt -= ROW_BYTES) {
hex_dump_to_buffer(ptr, min(cnt, ROW_BYTES),
ROW_BYTES, GROUP_BYTES, dump_buf,
@@ -203,7 +211,8 @@ static ssize_t mdss_debug_base_reg_read(struct file *file,
if (tot >= dbg->buf_len)
break;
}
- mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
+ if (mdata->debug_inf.debug_enable_clock)
+ mdata->debug_inf.debug_enable_clock(0);
dbg->buf_len = tot;
}
@@ -246,10 +255,10 @@ int mdss_debug_register_base(const char *name, void __iomem *base,
char dn[80] = "";
int prefix_len = 0;
- if (!mdata || !mdata->debug_data)
+ if (!mdata || !mdata->debug_inf.debug_data)
return -ENODEV;
- mdd = mdata->debug_data;
+ mdd = mdata->debug_inf.debug_data;
dbg = kzalloc(sizeof(*dbg), GFP_KERNEL);
if (!dbg)
@@ -301,33 +310,11 @@ static int mdss_debug_stat_release(struct inode *inode, struct file *file)
return 0;
}
-static int mdss_debug_stat_ctl_dump(struct mdss_mdp_ctl *ctl,
- char *bp, int len)
-{
- int tot = 0;
-
- if (!ctl->ref_cnt)
- return 0;
-
- if (ctl->intf_num) {
- tot = scnprintf(bp, len,
- "intf%d: play: %08u \tvsync: %08u \tunderrun: %08u\n",
- ctl->intf_num, ctl->play_cnt,
- ctl->vsync_cnt, ctl->underrun_cnt);
- } else {
- tot = scnprintf(bp, len, "wb: \tmode=%x \tplay: %08u\n",
- ctl->opmode, ctl->play_cnt);
- }
-
- return tot;
-}
-
static ssize_t mdss_debug_stat_read(struct file *file, char __user *buff,
size_t count, loff_t *ppos)
{
struct mdss_data_type *mdata = file->private_data;
- struct mdss_mdp_pipe *pipe;
- int i, len, tot;
+ int len, tot;
char bp[512];
if (*ppos)
@@ -337,30 +324,11 @@ static ssize_t mdss_debug_stat_read(struct file *file, char __user *buff,
tot = scnprintf(bp, len, "\nmdp:\n");
- for (i = 0; i < mdata->nctl; i++)
- tot += mdss_debug_stat_ctl_dump(mdata->ctl_off + i,
- bp + tot, len - tot);
- tot += scnprintf(bp + tot, len - tot, "\n");
+ if (mdata->debug_inf.debug_dump_stats)
+ tot += mdata->debug_inf.debug_dump_stats(mdata,
+ bp + tot, len - tot);
- for (i = 0; i < mdata->nvig_pipes; i++) {
- pipe = mdata->vig_pipes + i;
- tot += scnprintf(bp + tot, len - tot,
- "VIG%d : %08u\t", i, pipe->play_cnt);
- }
- tot += scnprintf(bp + tot, len - tot, "\n");
- for (i = 0; i < mdata->nrgb_pipes; i++) {
- pipe = mdata->rgb_pipes + i;
- tot += scnprintf(bp + tot, len - tot,
- "RGB%d : %08u\t", i, pipe->play_cnt);
- }
- tot += scnprintf(bp + tot, len - tot, "\n");
-
- for (i = 0; i < mdata->ndma_pipes; i++) {
- pipe = mdata->dma_pipes + i;
- tot += scnprintf(bp + tot, len - tot,
- "DMA%d : %08u\t", i, pipe->play_cnt);
- }
tot += scnprintf(bp + tot, len - tot, "\n");
if (copy_to_user(buff, bp, tot))
@@ -401,7 +369,7 @@ int mdss_debugfs_init(struct mdss_data_type *mdata)
{
struct mdss_debug_data *mdd;
- if (mdata->debug_data) {
+ if (mdata->debug_inf.debug_data) {
pr_warn("mdss debugfs already initialized\n");
return -EBUSY;
}
@@ -424,18 +392,19 @@ int mdss_debugfs_init(struct mdss_data_type *mdata)
debugfs_create_file("stat", 0644, mdd->root, mdata, &mdss_stat_fops);
debugfs_create_u32("min_mdp_clk", 0644, mdd->root,
- (u32 *)&mdata->min_mdp_clk);
+ (u32 *)&mdata->min_mdp_clk);
- mdata->debug_data = mdd;
+ mdata->debug_inf.debug_data = mdd;
return 0;
}
int mdss_debugfs_remove(struct mdss_data_type *mdata)
{
- struct mdss_debug_data *mdd = mdata->debug_data;
+ struct mdss_debug_data *mdd = mdata->debug_inf.debug_data;
mdss_debugfs_cleanup(mdd);
+ mdata->debug_inf.debug_data = NULL;
return 0;
}
diff --git a/drivers/video/fbdev/msm/mdss_mdp.c b/drivers/video/fbdev/msm/mdss_mdp.c
index 96bfeac897ec..f02ce0dcf5c2 100644
--- a/drivers/video/fbdev/msm/mdss_mdp.c
+++ b/drivers/video/fbdev/msm/mdss_mdp.c
@@ -866,10 +866,75 @@ int mdss_iommu_init(struct mdss_data_type *mdata)
return 0;
}
+static int mdss_debug_stat_ctl_dump(struct mdss_mdp_ctl *ctl,
+ char *bp, int len)
+{
+ int total = 0;
+
+ if (!ctl->ref_cnt)
+ return 0;
+
+ if (ctl->intf_num) {
+ total = scnprintf(bp, len,
+ "intf%d: play: %08u \tvsync: %08u \tunderrun: %08u\n",
+ ctl->intf_num, ctl->play_cnt,
+ ctl->vsync_cnt, ctl->underrun_cnt);
+ } else {
+ total = scnprintf(bp, len, "wb: \tmode=%x \tplay: %08u\n",
+ ctl->opmode, ctl->play_cnt);
+ }
+
+ return total;
+}
+
+static int mdss_debug_dump_stats(void *data, char *buf, int len)
+{
+ struct mdss_data_type *mdata = data;
+ struct mdss_mdp_pipe *pipe;
+ int i, total = 0;
+
+ for (i = 0; i < mdata->nctl; i++)
+ total += mdss_debug_stat_ctl_dump(mdata->ctl_off + i, buf, len);
+
+ total += scnprintf(buf + total, len - total, "\n");
+
+ for (i = 0; i < mdata->nvig_pipes; i++) {
+ pipe = mdata->vig_pipes + i;
+ total += scnprintf(buf + total, len - total,
+ "VIG%d : %08u\t", i, pipe->play_cnt);
+ }
+ total += scnprintf(buf + total, len - total, "\n");
+
+ for (i = 0; i < mdata->nrgb_pipes; i++) {
+ pipe = mdata->rgb_pipes + i;
+ total += scnprintf(buf + total, len - total,
+ "RGB%d : %08u\t", i, pipe->play_cnt);
+ }
+ total += scnprintf(buf + total, len - total, "\n");
+
+ for (i = 0; i < mdata->ndma_pipes; i++) {
+ pipe = mdata->dma_pipes + i;
+ total += scnprintf(buf + total, len - total,
+ "DMA%d : %08u\t", i, pipe->play_cnt);
+ }
+ return total;
+}
+
+static void mdss_debug_enable_clock(int on)
+{
+ if (on)
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON, false);
+ else
+ mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF, false);
+}
+
static int mdss_mdp_debug_init(struct mdss_data_type *mdata)
{
int rc;
+ mdata->debug_inf.debug_dump_stats = mdss_debug_dump_stats;
+ mdata->debug_inf.debug_enable_clock = mdss_debug_enable_clock;
+
rc = mdss_debugfs_init(mdata);
if (rc)
return rc;