aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/mmp/fb/mmpfb.c6
-rw-r--r--drivers/video/mmp/hw/mmp_ctrl.c30
-rw-r--r--include/video/mmp_disp.h5
3 files changed, 34 insertions, 7 deletions
diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c
index 19fd913f462d..7ab31eb76a8c 100644
--- a/drivers/video/mmp/fb/mmpfb.c
+++ b/drivers/video/mmp/fb/mmpfb.c
@@ -395,12 +395,18 @@ static int var_update(struct fb_info *info)
395static void mmpfb_set_win(struct fb_info *info) 395static void mmpfb_set_win(struct fb_info *info)
396{ 396{
397 struct mmpfb_info *fbi = info->par; 397 struct mmpfb_info *fbi = info->par;
398 struct fb_var_screeninfo *var = &info->var;
398 struct mmp_win win; 399 struct mmp_win win;
400 u32 stride;
399 401
400 memset(&win, 0, sizeof(win)); 402 memset(&win, 0, sizeof(win));
401 win.xsrc = win.xdst = fbi->mode.xres; 403 win.xsrc = win.xdst = fbi->mode.xres;
402 win.ysrc = win.ydst = fbi->mode.yres; 404 win.ysrc = win.ydst = fbi->mode.yres;
403 win.pix_fmt = fbi->pix_fmt; 405 win.pix_fmt = fbi->pix_fmt;
406 stride = pixfmt_to_stride(win.pix_fmt);
407 win.pitch[0] = var->xres_virtual * stride;
408 win.pitch[1] = win.pitch[2] =
409 (stride == 1) ? (var->xres_virtual >> 1) : 0;
404 mmp_overlay_set_win(fbi->overlay, &win); 410 mmp_overlay_set_win(fbi->overlay, &win);
405} 411}
406 412
diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c
index c0eb8bccfb87..ae724aaaad47 100644
--- a/drivers/video/mmp/hw/mmp_ctrl.c
+++ b/drivers/video/mmp/hw/mmp_ctrl.c
@@ -142,17 +142,27 @@ static void dmafetch_set_fmt(struct mmp_overlay *overlay)
142static void overlay_set_win(struct mmp_overlay *overlay, struct mmp_win *win) 142static void overlay_set_win(struct mmp_overlay *overlay, struct mmp_win *win)
143{ 143{
144 struct lcd_regs *regs = path_regs(overlay->path); 144 struct lcd_regs *regs = path_regs(overlay->path);
145 u32 pitch;
146 145
147 /* assert win supported */ 146 /* assert win supported */
148 memcpy(&overlay->win, win, sizeof(struct mmp_win)); 147 memcpy(&overlay->win, win, sizeof(struct mmp_win));
149 148
150 mutex_lock(&overlay->access_ok); 149 mutex_lock(&overlay->access_ok);
151 pitch = win->xsrc * pixfmt_to_stride(win->pix_fmt); 150
152 writel_relaxed(pitch, &regs->g_pitch); 151 if (overlay_is_vid(overlay)) {
153 writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->g_size); 152 writel_relaxed(win->pitch[0], &regs->v_pitch_yc);
154 writel_relaxed((win->ydst << 16) | win->xdst, &regs->g_size_z); 153 writel_relaxed(win->pitch[2] << 16 |
155 writel_relaxed(0, &regs->g_start); 154 win->pitch[1], &regs->v_pitch_uv);
155
156 writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->v_size);
157 writel_relaxed((win->ydst << 16) | win->xdst, &regs->v_size_z);
158 writel_relaxed(win->ypos << 16 | win->xpos, &regs->v_start);
159 } else {
160 writel_relaxed(win->pitch[0], &regs->g_pitch);
161
162 writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->g_size);
163 writel_relaxed((win->ydst << 16) | win->xdst, &regs->g_size_z);
164 writel_relaxed(win->ypos << 16 | win->xpos, &regs->g_start);
165 }
156 166
157 dmafetch_set_fmt(overlay); 167 dmafetch_set_fmt(overlay);
158 mutex_unlock(&overlay->access_ok); 168 mutex_unlock(&overlay->access_ok);
@@ -234,7 +244,13 @@ static int overlay_set_addr(struct mmp_overlay *overlay, struct mmp_addr *addr)
234 244
235 /* FIXME: assert addr supported */ 245 /* FIXME: assert addr supported */
236 memcpy(&overlay->addr, addr, sizeof(struct mmp_addr)); 246 memcpy(&overlay->addr, addr, sizeof(struct mmp_addr));
237 writel(addr->phys[0], &regs->g_0); 247
248 if (overlay_is_vid(overlay)) {
249 writel_relaxed(addr->phys[0], &regs->v_y0);
250 writel_relaxed(addr->phys[1], &regs->v_u0);
251 writel_relaxed(addr->phys[2], &regs->v_v0);
252 } else
253 writel_relaxed(addr->phys[0], &regs->g_0);
238 254
239 return overlay->addr.phys[0]; 255 return overlay->addr.phys[0];
240} 256}
diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h
index 32094c052deb..9fd9398368d5 100644
--- a/include/video/mmp_disp.h
+++ b/include/video/mmp_disp.h
@@ -91,6 +91,11 @@ struct mmp_win {
91 u16 up_crop; 91 u16 up_crop;
92 u16 bottom_crop; 92 u16 bottom_crop;
93 int pix_fmt; 93 int pix_fmt;
94 /*
95 * pitch[0]: graphics/video layer line length or y pitch
96 * pitch[1]/pitch[2]: video u/v pitch if non-zero
97 */
98 u32 pitch[3];
94}; 99};
95 100
96struct mmp_addr { 101struct mmp_addr {