Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Antonino A. Daplas and committed by
Linus Torvalds
d2d58384 7726e9e1

+45 -1
+5
arch/i386/boot/video.S
··· 97 97 #define PARAM_VESAPM_OFF 0x30 98 98 #define PARAM_LFB_PAGES 0x32 99 99 #define PARAM_VESA_ATTRIB 0x34 100 + #define PARAM_CAPABILITIES 0x36 100 101 101 102 /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ 102 103 #ifdef CONFIG_VIDEO_RETAIN ··· 233 232 xorl %eax, %eax 234 233 movw 18(%di), %ax 235 234 movl %eax, %fs:(PARAM_LFB_SIZE) 235 + 236 + # store mode capabilities 237 + movl 10(%di), %eax 238 + movl %eax, %fs:(PARAM_CAPABILITIES) 236 239 237 240 # switching the DAC to 8-bit is for <= 8 bpp only 238 241 movw %fs:(PARAM_LFB_DEPTH), %ax
+38
drivers/video/vesafb.c
··· 19 19 #include <linux/fb.h> 20 20 #include <linux/ioport.h> 21 21 #include <linux/init.h> 22 + #include <video/vga.h> 22 23 #include <asm/io.h> 23 24 #include <asm/mtrr.h> 24 25 ··· 55 54 static void (*pmi_start)(void); 56 55 static void (*pmi_pal)(void); 57 56 static int depth; 57 + static int vga_compat; 58 58 59 59 /* --------------------------------------------------------------------- */ 60 60 ··· 86 84 "D" (&pmi_start)); /* EDI */ 87 85 #endif 88 86 return 0; 87 + } 88 + 89 + static int vesafb_blank(int blank, struct fb_info *info) 90 + { 91 + int err = 1; 92 + 93 + if (vga_compat) { 94 + int loop = 10000; 95 + u8 seq = 0, crtc17 = 0; 96 + 97 + err = 0; 98 + 99 + if (blank) { 100 + seq = 0x20; 101 + crtc17 = 0x00; 102 + } else { 103 + seq = 0x00; 104 + crtc17 = 0x80; 105 + } 106 + 107 + vga_wseq(NULL, 0x00, 0x01); 108 + seq |= vga_rseq(NULL, 0x01) & ~0x20; 109 + vga_wseq(NULL, 0x00, seq); 110 + 111 + crtc17 |= vga_rcrt(NULL, 0x17) & ~0x80; 112 + while (loop--); 113 + vga_wcrt(NULL, 0x17, crtc17); 114 + vga_wseq(NULL, 0x00, 0x03); 115 + } 116 + 117 + return err; 89 118 } 90 119 91 120 static void vesa_setpalette(int regno, unsigned red, unsigned green, ··· 209 176 .owner = THIS_MODULE, 210 177 .fb_setcolreg = vesafb_setcolreg, 211 178 .fb_pan_display = vesafb_pan_display, 179 + .fb_blank = vesafb_blank, 212 180 .fb_fillrect = cfb_fillrect, 213 181 .fb_copyarea = cfb_copyarea, 214 182 .fb_imageblit = cfb_imageblit, ··· 462 428 info->fix = vesafb_fix; 463 429 info->flags = FBINFO_FLAG_DEFAULT | 464 430 (ypan) ? FBINFO_HWACCEL_YPAN : 0; 431 + 432 + vga_compat = (screen_info.capabilities & 2) ? 0 : 1; 433 + printk("vesafb: Mode is %sVGA compatible\n", 434 + (vga_compat) ? "" : "not "); 465 435 466 436 if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { 467 437 err = -ENOMEM;
+2 -1
include/linux/tty.h
··· 74 74 u16 vesapm_off; /* 0x30 */ 75 75 u16 pages; /* 0x32 */ 76 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 81 extern struct screen_info screen_info;