shithub: riscv

Download patch

ref: 4e938841f02de646d4e2e428453cbeede4051a57
parent: 0c7fe8ae0679c3216cb145ee6ceb5f075af1bddd
author: mischief <mischief@offblast.org>
date: Tue Aug 21 07:31:45 EDT 2018

igfx: support blanking by turning off panel power and backlight

tested on t61, x200, x230, x301, t420, w520

--- a/sys/src/9/pc/vgaigfx.c
+++ b/sys/src/9/pc/vgaigfx.c
@@ -55,9 +55,46 @@
 	scr->softscreen = 1;
 }
 
+static void
+igfxblank(VGAscr *scr, int blank)
+{
+	u32int off;
+
+	switch(scr->pci->did){
+	default:
+		return;
+
+	case 0x2a02:	/* GM965 */
+	case 0x2a42:	/* GM45 */
+		off = 0x61204;
+		break;
+
+	case 0x0126:	/* SNB */
+	case 0x0166:	/* IVB */
+		off = 0xC7204;
+		break;
+	}
+
+	/* toggle PP_CONTROL backlight & power state */
+	if(blank)
+		scr->mmio[off/4] &= ~0x5;
+	else
+		scr->mmio[off/4] |= 0x5;
+}
+
+static void
+igfxdrawinit(VGAscr *scr)
+{
+	scr->blank = igfxblank;
+}
+
 VGAdev vgaigfxdev = {
 	"igfx",
 	igfxenable,
+	nil,
+	nil,
+	nil,
+	igfxdrawinit,
 };
 
 static void