aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRobert Reif <reif@earthlink.net>2008-10-10 15:13:22 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-10 15:13:22 -0400
commit4dd95b63ae25c5cad6986829b5e8788e9faa0330 (patch)
tree3a61b1f9a557e0940eb8a3e395e7ee073bd12b72 /drivers
parent291d5f30399c258344c71069552b82b694bb2b34 (diff)
leo: disable cursor when leaving graphics mode
On sparc32 debian etch, the cursor is not disabled when leaving X windows. This patch disables the cursor when leaving graphics mode just like the ffb driver. Signed-off-by: Robert Reif <reif@earthlink.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/leo.c94
1 files changed, 56 insertions, 38 deletions
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 465459e5eae6..7c7e8c2da9d9 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -33,6 +33,7 @@ static int leo_blank(int, struct fb_info *);
33 33
34static int leo_mmap(struct fb_info *, struct vm_area_struct *); 34static int leo_mmap(struct fb_info *, struct vm_area_struct *);
35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long); 35static int leo_ioctl(struct fb_info *, unsigned int, unsigned long);
36static int leo_pan_display(struct fb_var_screeninfo *, struct fb_info *);
36 37
37/* 38/*
38 * Frame buffer operations 39 * Frame buffer operations
@@ -42,6 +43,7 @@ static struct fb_ops leo_ops = {
42 .owner = THIS_MODULE, 43 .owner = THIS_MODULE,
43 .fb_setcolreg = leo_setcolreg, 44 .fb_setcolreg = leo_setcolreg,
44 .fb_blank = leo_blank, 45 .fb_blank = leo_blank,
46 .fb_pan_display = leo_pan_display,
45 .fb_fillrect = cfb_fillrect, 47 .fb_fillrect = cfb_fillrect,
46 .fb_copyarea = cfb_copyarea, 48 .fb_copyarea = cfb_copyarea,
47 .fb_imageblit = cfb_imageblit, 49 .fb_imageblit = cfb_imageblit,
@@ -206,6 +208,60 @@ static void leo_wait(struct leo_lx_krn __iomem *lx_krn)
206 return; 208 return;
207} 209}
208 210
211static void leo_switch_from_graph(struct fb_info *info)
212{
213 struct leo_par *par = (struct leo_par *) info->par;
214 struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
215 struct leo_cursor __iomem *cursor = par->cursor;
216 unsigned long flags;
217 u32 val;
218
219 spin_lock_irqsave(&par->lock, flags);
220
221 par->extent = ((info->var.xres - 1) |
222 ((info->var.yres - 1) << 16));
223
224 sbus_writel(0xffffffff, &ss->wid);
225 sbus_writel(0xffff, &ss->wmask);
226 sbus_writel(0, &ss->vclipmin);
227 sbus_writel(par->extent, &ss->vclipmax);
228 sbus_writel(0, &ss->fg);
229 sbus_writel(0xff000000, &ss->planemask);
230 sbus_writel(0x310850, &ss->rop);
231 sbus_writel(0, &ss->widclip);
232 sbus_writel((info->var.xres-1) | ((info->var.yres-1) << 11),
233 &par->lc_ss0_usr->extent);
234 sbus_writel(4, &par->lc_ss0_usr->addrspace);
235 sbus_writel(0x80000000, &par->lc_ss0_usr->fill);
236 sbus_writel(0, &par->lc_ss0_usr->fontt);
237 do {
238 val = sbus_readl(&par->lc_ss0_usr->csr);
239 } while (val & 0x20000000);
240
241 /* setup screen buffer for cfb_* functions */
242 sbus_writel(1, &ss->wid);
243 sbus_writel(0x00ffffff, &ss->planemask);
244 sbus_writel(0x310b90, &ss->rop);
245 sbus_writel(0, &par->lc_ss0_usr->addrspace);
246
247 /* hide cursor */
248 sbus_writel(sbus_readl(&cursor->cur_misc) & ~LEO_CUR_ENABLE, &cursor->cur_misc);
249
250 spin_unlock_irqrestore(&par->lock, flags);
251}
252
253static int leo_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
254{
255 /* We just use this to catch switches out of
256 * graphics mode.
257 */
258 leo_switch_from_graph(info);
259
260 if (var->xoffset || var->yoffset || var->vmode)
261 return -EINVAL;
262 return 0;
263}
264
209/** 265/**
210 * leo_setcolreg - Optional function. Sets a color register. 266 * leo_setcolreg - Optional function. Sets a color register.
211 * @regno: boolean, 0 copy local, 1 get_user() function 267 * @regno: boolean, 0 copy local, 1 get_user() function
@@ -454,44 +510,6 @@ static void leo_init_wids(struct fb_info *info)
454 leo_wid_put(info, &wl); 510 leo_wid_put(info, &wl);
455} 511}
456 512
457static void leo_switch_from_graph(struct fb_info *info)
458{
459 struct leo_par *par = (struct leo_par *) info->par;
460 struct leo_ld_ss0 __iomem *ss = par->ld_ss0;
461 unsigned long flags;
462 u32 val;
463
464 spin_lock_irqsave(&par->lock, flags);
465
466 par->extent = ((info->var.xres - 1) |
467 ((info->var.yres - 1) << 16));
468
469 sbus_writel(0xffffffff, &ss->wid);
470 sbus_writel(0xffff, &ss->wmask);
471 sbus_writel(0, &ss->vclipmin);
472 sbus_writel(par->extent, &ss->vclipmax);
473 sbus_writel(0, &ss->fg);
474 sbus_writel(0xff000000, &ss->planemask);
475 sbus_writel(0x310850, &ss->rop);
476 sbus_writel(0, &ss->widclip);
477 sbus_writel((info->var.xres-1) | ((info->var.yres-1) << 11),
478 &par->lc_ss0_usr->extent);
479 sbus_writel(4, &par->lc_ss0_usr->addrspace);
480 sbus_writel(0x80000000, &par->lc_ss0_usr->fill);
481 sbus_writel(0, &par->lc_ss0_usr->fontt);
482 do {
483 val = sbus_readl(&par->lc_ss0_usr->csr);
484 } while (val & 0x20000000);
485
486 /* setup screen buffer for cfb_* functions */
487 sbus_writel(1, &ss->wid);
488 sbus_writel(0x00ffffff, &ss->planemask);
489 sbus_writel(0x310b90, &ss->rop);
490 sbus_writel(0, &par->lc_ss0_usr->addrspace);
491
492 spin_unlock_irqrestore(&par->lock, flags);
493}
494
495static void leo_init_hw(struct fb_info *info) 513static void leo_init_hw(struct fb_info *info)
496{ 514{
497 struct leo_par *par = (struct leo_par *) info->par; 515 struct leo_par *par = (struct leo_par *) info->par;