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 | |
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>
-rw-r--r-- | arch/i386/boot/video.S | 5 | ||||
-rw-r--r-- | drivers/video/vesafb.c | 38 | ||||
-rw-r--r-- | include/linux/tty.h | 3 |
3 files changed, 45 insertions, 1 deletions
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S index 0587477c99f2..02bf625a681b 100644 --- a/arch/i386/boot/video.S +++ b/arch/i386/boot/video.S | |||
@@ -97,6 +97,7 @@ | |||
97 | #define PARAM_VESAPM_OFF 0x30 | 97 | #define PARAM_VESAPM_OFF 0x30 |
98 | #define PARAM_LFB_PAGES 0x32 | 98 | #define PARAM_LFB_PAGES 0x32 |
99 | #define PARAM_VESA_ATTRIB 0x34 | 99 | #define PARAM_VESA_ATTRIB 0x34 |
100 | #define PARAM_CAPABILITIES 0x36 | ||
100 | 101 | ||
101 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ | 102 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ |
102 | #ifdef CONFIG_VIDEO_RETAIN | 103 | #ifdef CONFIG_VIDEO_RETAIN |
@@ -233,6 +234,10 @@ mopar_gr: | |||
233 | movw 18(%di), %ax | 234 | movw 18(%di), %ax |
234 | movl %eax, %fs:(PARAM_LFB_SIZE) | 235 | movl %eax, %fs:(PARAM_LFB_SIZE) |
235 | 236 | ||
237 | # store mode capabilities | ||
238 | movl 10(%di), %eax | ||
239 | movl %eax, %fs:(PARAM_CAPABILITIES) | ||
240 | |||
236 | # switching the DAC to 8-bit is for <= 8 bpp only | 241 | # switching the DAC to 8-bit is for <= 8 bpp only |
237 | movw %fs:(PARAM_LFB_DEPTH), %ax | 242 | movw %fs:(PARAM_LFB_DEPTH), %ax |
238 | cmpw $8, %ax | 243 | cmpw $8, %ax |
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; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 59ff42c629ec..1267f88ece6e 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -74,7 +74,8 @@ struct screen_info { | |||
74 | u16 vesapm_off; /* 0x30 */ | 74 | u16 vesapm_off; /* 0x30 */ |
75 | u16 pages; /* 0x32 */ | 75 | u16 pages; /* 0x32 */ |
76 | u16 vesa_attributes; /* 0x34 */ | 76 | u16 vesa_attributes; /* 0x34 */ |
77 | /* 0x36 -- 0x3f reserved for future expansion */ | 77 | u32 capabilities; /* 0x36 */ |
78 | /* 0x3a -- 0x3f reserved for future expansion */ | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | extern struct screen_info screen_info; | 81 | extern struct screen_info screen_info; |