diff options
author | Antonino A. Daplas <adaplas@gmail.com> | 2005-09-09 16:04:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 16:57:58 -0400 |
commit | d2d58384fc5d4c0fe2d8e34bc2d15a90a9bb372a (patch) | |
tree | 6b28b34161e7ca2db38014b473690e9c9954779a /drivers/video/vesafb.c | |
parent | 7726e9e10fc6e026ed2dc00e48f4a3ffc1254ad2 (diff) |
[PATCH] vesafb: Add blanking support
Add rudimentary support by manipulating the VGA registers. However, not
all vesa modes are VGA compatible, so VGA compatiblity is checked first.
Only 2 levels are supported, powerup and powerdown.
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/vesafb.c')
-rw-r--r-- | drivers/video/vesafb.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index a272592b0373..1ca80264c7b0 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
20 | #include <linux/ioport.h> | 20 | #include <linux/ioport.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <video/vga.h> | ||
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include <asm/mtrr.h> | 24 | #include <asm/mtrr.h> |
24 | 25 | ||
@@ -54,6 +55,7 @@ static unsigned short *pmi_base = NULL; | |||
54 | static void (*pmi_start)(void); | 55 | static void (*pmi_start)(void); |
55 | static void (*pmi_pal)(void); | 56 | static void (*pmi_pal)(void); |
56 | static int depth; | 57 | static int depth; |
58 | static int vga_compat; | ||
57 | 59 | ||
58 | /* --------------------------------------------------------------------- */ | 60 | /* --------------------------------------------------------------------- */ |
59 | 61 | ||
@@ -86,6 +88,37 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, | |||
86 | return 0; | 88 | return 0; |
87 | } | 89 | } |
88 | 90 | ||
91 | static int vesafb_blank(int blank, struct fb_info *info) | ||
92 | { | ||
93 | int err = 1; | ||
94 | |||
95 | if (vga_compat) { | ||
96 | int loop = 10000; | ||
97 | u8 seq = 0, crtc17 = 0; | ||
98 | |||
99 | err = 0; | ||
100 | |||
101 | if (blank) { | ||
102 | seq = 0x20; | ||
103 | crtc17 = 0x00; | ||
104 | } else { | ||
105 | seq = 0x00; | ||
106 | crtc17 = 0x80; | ||
107 | } | ||
108 | |||
109 | vga_wseq(NULL, 0x00, 0x01); | ||
110 | seq |= vga_rseq(NULL, 0x01) & ~0x20; | ||
111 | vga_wseq(NULL, 0x00, seq); | ||
112 | |||
113 | crtc17 |= vga_rcrt(NULL, 0x17) & ~0x80; | ||
114 | while (loop--); | ||
115 | vga_wcrt(NULL, 0x17, crtc17); | ||
116 | vga_wseq(NULL, 0x00, 0x03); | ||
117 | } | ||
118 | |||
119 | return err; | ||
120 | } | ||
121 | |||
89 | static void vesa_setpalette(int regno, unsigned red, unsigned green, | 122 | static void vesa_setpalette(int regno, unsigned red, unsigned green, |
90 | unsigned blue) | 123 | unsigned blue) |
91 | { | 124 | { |
@@ -176,6 +209,7 @@ static struct fb_ops vesafb_ops = { | |||
176 | .owner = THIS_MODULE, | 209 | .owner = THIS_MODULE, |
177 | .fb_setcolreg = vesafb_setcolreg, | 210 | .fb_setcolreg = vesafb_setcolreg, |
178 | .fb_pan_display = vesafb_pan_display, | 211 | .fb_pan_display = vesafb_pan_display, |
212 | .fb_blank = vesafb_blank, | ||
179 | .fb_fillrect = cfb_fillrect, | 213 | .fb_fillrect = cfb_fillrect, |
180 | .fb_copyarea = cfb_copyarea, | 214 | .fb_copyarea = cfb_copyarea, |
181 | .fb_imageblit = cfb_imageblit, | 215 | .fb_imageblit = cfb_imageblit, |
@@ -429,6 +463,10 @@ static int __init vesafb_probe(struct device *device) | |||
429 | info->flags = FBINFO_FLAG_DEFAULT | | 463 | info->flags = FBINFO_FLAG_DEFAULT | |
430 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; | 464 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; |
431 | 465 | ||
466 | vga_compat = (screen_info.capabilities & 2) ? 0 : 1; | ||
467 | printk("vesafb: Mode is %sVGA compatible\n", | ||
468 | (vga_compat) ? "" : "not "); | ||
469 | |||
432 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 470 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
433 | err = -ENOMEM; | 471 | err = -ENOMEM; |
434 | goto err; | 472 | goto err; |