msm_fb: display: add ioctl for mixer info
Add new ioctl to allow user to query mdp mixer detail configuration.
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
diff --git a/drivers/video/msm/mdp4.h b/drivers/video/msm/mdp4.h
index 6f7d59c..6e42afc 100644
--- a/drivers/video/msm/mdp4.h
+++ b/drivers/video/msm/mdp4.h
@@ -160,11 +160,10 @@
MDP4_MIXER_STAGE_BASE,
MDP4_MIXER_STAGE0, /* zorder 0 */
MDP4_MIXER_STAGE1, /* zorder 1 */
- MDP4_MIXER_STAGE2 /* zorder 2 */
+ MDP4_MIXER_STAGE2, /* zorder 2 */
+ MDP4_MIXER_STAGE_MAX
};
-#define MDP4_MAX_STAGE 4
-
enum {
MDP4_FRAME_FORMAT_LINEAR,
MDP4_FRAME_FORMAT_ARGB_TILE,
@@ -555,6 +554,8 @@
void mdp4_dsi_video_3d_sbys(struct msm_fb_data_type *mfd,
struct msmfb_overlay_3d *r3d);
+int mdp4_mixer_info(int mixer_num, struct mdp_mixer_info *info);
+
void mdp_dmap_vsync_set(int enable);
int mdp_dmap_vsync_get(void);
void mdp_hw_cursor_done(void);
diff --git a/drivers/video/msm/mdp4_overlay.c b/drivers/video/msm/mdp4_overlay.c
index e8d6eef..c5bac33 100644
--- a/drivers/video/msm/mdp4_overlay.c
+++ b/drivers/video/msm/mdp4_overlay.c
@@ -43,7 +43,7 @@
struct mdp4_overlay_ctrl {
struct mdp4_pipe_desc ov_pipe[OVERLAY_PIPE_MAX];/* 4 */
struct mdp4_overlay_pipe plist[MDP4_MAX_PIPE]; /* 4 + 2 */
- struct mdp4_overlay_pipe *stage[MDP4_MAX_MIXER][MDP4_MAX_STAGE + 2];
+ struct mdp4_overlay_pipe *stage[MDP4_MAX_MIXER][MDP4_MIXER_STAGE_MAX];
uint32 panel_3d;
uint32 panel_mode;
uint32 mixer0_played;
@@ -1075,6 +1075,33 @@
return p1;
}
+int mdp4_mixer_info(int mixer_num, struct mdp_mixer_info *info)
+{
+
+ int ndx, cnt;
+ struct mdp4_overlay_pipe *pipe;
+
+ if (mixer_num > MDP4_MIXER_MAX)
+ return -ENODEV;
+
+ cnt = 0;
+ ndx = 1; /* ndx 0 if not used */
+
+ for ( ; ndx < MDP4_MIXER_STAGE_MAX; ndx++) {
+ pipe = ctrl->stage[mixer_num][ndx];
+ if (pipe == NULL)
+ continue;
+ info->z_order = pipe->mixer_stage - MDP4_MIXER_STAGE0;
+ info->ptype = pipe->pipe_type;
+ info->pnum = pipe->pipe_num;
+ info->pndx = pipe->pipe_ndx;
+ info->mixer_num = pipe->mixer_num;
+ info++;
+ cnt++;
+ }
+ return cnt;
+}
+
void mdp4_mixer_stage_up(struct mdp4_overlay_pipe *pipe)
{
uint32 data, mask, snum, stage, mixer, pnum;
diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
index b5cd46a3..5914068 100644
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -2542,8 +2542,7 @@
ret = copy_from_user(&req, argp, sizeof(req));
if (ret) {
- printk(KERN_ERR "%s:msmfb_overlay_blt ioctl failed\n",
- __func__);
+ pr_err("%s: failed\n", __func__);
return ret;
}
@@ -2557,6 +2556,12 @@
int ret;
struct msmfb_overlay_blt req;
+ ret = copy_from_user(&req, argp, sizeof(req));
+ if (ret) {
+ pr_err("%s: failed\n", __func__);
+ return ret;
+ }
+
ret = mdp4_overlay_blt_offset(info, &req);
ret = copy_to_user(argp, &req, sizeof(req));
@@ -2594,6 +2599,27 @@
return ret;
}
+static int msmfb_mixer_info(struct fb_info *info, unsigned long *argp)
+{
+ int ret, cnt;
+ struct msmfb_mixer_info_req req;
+
+ ret = copy_from_user(&req, argp, sizeof(req));
+ if (ret) {
+ pr_err("%s: failed\n", __func__);
+ return ret;
+ }
+
+ cnt = mdp4_mixer_info(req.mixer_num, req.info);
+ req.cnt = cnt;
+ ret = copy_to_user(argp, &req, sizeof(req));
+ if (ret)
+ pr_err("%s:msmfb_overlay_blt_off ioctl failed\n",
+ __func__);
+
+ return cnt;
+}
+
#endif
DEFINE_SEMAPHORE(msm_fb_ioctl_ppp_sem);
@@ -2718,6 +2744,11 @@
ret = msmfb_overlay_3d_sbys(info, argp);
up(&msm_fb_ioctl_ppp_sem);
break;
+ case MSMFB_MIXER_INFO:
+ down(&msm_fb_ioctl_ppp_sem);
+ ret = msmfb_mixer_info(info, argp);
+ up(&msm_fb_ioctl_ppp_sem);
+ break;
#endif
case MSMFB_BLIT:
down(&msm_fb_ioctl_ppp_sem);
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
index 9dced1a..26994fc 100644
--- a/include/linux/msm_mdp.h
+++ b/include/linux/msm_mdp.h
@@ -50,6 +50,10 @@
#define MSMFB_OVERLAY_3D _IOWR(MSMFB_IOCTL_MAGIC, 147, \
struct msmfb_overlay_3d)
+#define MSMFB_MIXER_INFO _IOWR(MSMFB_IOCTL_MAGIC, 148, \
+ struct msmfb_mixer_info_req)
+
+
#define FB_TYPE_3D_PANEL 0x10101010
#define MDP_IMGTYPE2_START 0x10000
#define MSMFB_DRIVER_VERSION 0xF9E8D701
@@ -260,6 +264,24 @@
uint32_t page_protection;
};
+
+struct mdp_mixer_info {
+ int pndx;
+ int pnum;
+ int ptype;
+ int mixer_num;
+ int z_order;
+};
+
+#define MAX_PIPE_PER_MIXER 4
+
+struct msmfb_mixer_info_req {
+ int mixer_num;
+ int cnt;
+ struct mdp_mixer_info info[MAX_PIPE_PER_MIXER];
+};
+
+
#ifdef __KERNEL__
/* get the framebuffer physical address information */