[PATCH] viafb: Restore CR00-CR06 on resume

Chris Ball cjb at laptop.org
Wed Apr 21 19:56:09 EDT 2010


Restoring this subset of the CRT registers is required for the video
overlay to work after resume on the VX855/XO1.5 -- without the patch,
the overlay remains black.  (OLPC Trac #10068.)

Signed-off-by: Chris Ball <cjb at laptop.org>
---
 drivers/video/via/viafbdev.c |   13 +++++++++++++
 drivers/video/via/viafbdev.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 767b026..0efc6e1 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -2042,12 +2042,17 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry)
 #ifdef CONFIG_PM
 static int viafb_suspend(void *unused)
 {
+	u8 i;
 	acquire_console_sem();
 
 	memcpy_fromio((void *)&viaparinfo->saved_video_regs, 
 			viaparinfo->io_virt + 0x200,
 			sizeof(video_via_regs));
 		
+	/* CR00-CR06 need to be preserved for the video overlay. */
+	for (i = 0; i <= 6; i++)
+		viaparinfo->saved_crt_regs[i] = viafb_read_reg(VIACR, i);
+
 	fb_set_suspend(viafbinfo, 1);
 	viafb_sync(viafbinfo);
 	release_console_sem();
@@ -2057,6 +2062,7 @@ static int viafb_suspend(void *unused)
 
 static int viafb_resume(void *unused)
 {
+	u8 i;
 	volatile video_via_regs  *viaVidEng = 
 		(volatile video_via_regs *)(viaparinfo->io_virt + 0x200);
 	video_via_regs  *localVidEng = &viaparinfo->saved_video_regs;
@@ -2126,6 +2132,13 @@ static int viafb_resume(void *unused)
 	fb_set_suspend(viafbinfo, 0);
 
 	release_console_sem();
+
+	/* Restore CR00-CR06 */
+	viafb_unlock_crt();
+	for (i = 0; i <= 6; i++)
+		viafb_write_reg(i, VIACR, viaparinfo->saved_crt_regs[i]);
+	viafb_lock_crt();
+
 	return 0;
 }
 
diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
index ca60452..bc72f15 100644
--- a/drivers/video/via/viafbdev.h
+++ b/drivers/video/via/viafbdev.h
@@ -151,6 +151,7 @@ struct viafb_par {
 
     	/* For suspend/resume */
 	video_via_regs saved_video_regs;
+	u8 saved_crt_regs[7];
 };
 
 struct viafb_modeinfo {
-- 
1.6.2.5






More information about the Devel mailing list