Skip to contentSkip to conversation

Radeonfb acpi vgapost

PATCH In review Micheal Marineau 2 participants 2 messages Aug 27, 2005 – Aug 28, 2005 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Radeonfb acpi vgapost

Here is a cleaned up version of the patch to repost radeon cards when resuming from acpi s3 suspend. I've been sitting on it for a while hoping that I might be able to gain some insight in how to use the d2 state instead of this repost as ppc does. On my x86 laptop with a radeon 9000 resuming from d2 does manage to turn on the card/display, but it becomes horridly scrambled. But right now I don't have the time or the skill to actually get any futher than that.

And btw, posting the card still causes the system to wait for a key press. I don't know if that is solvable with the current post method. Getting the existing d2 suspend/resume stuff to work might be the only way to clear that up.

Signature · 3 lines
Michael Marineau
[email protected]
Oregon State University
arch/i386/kernel/acpi/sleep.c +29 -0
Index: linux-2.6.13-rc3/arch/i386/kernel/acpi/sleep.c
===================================================================
@@ -5,6 +5,7 @@
  *  Copyright (C) 2001-2003 Pavel Machek <[email protected]>
  */
 
+#include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/dmi.h>
@@ -56,6 +57,34 @@
 	zap_low_mappings();
 }
 
+/*
+ * acpi_vgapost
+ */
+
+extern void do_vgapost_lowlevel (unsigned long);
+
+void acpi_vgapost (unsigned long slot)
+{
+	unsigned long flags, saved_video_flags = acpi_video_flags;
+	
+	acpi_video_flags = (slot & 0xffff) << 16 | 1;
+	
+	/* Map low memory and copy information */
+	init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
+	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
+	acpi_copy_wakeup_routine(acpi_wakeup_address);
+	
+	/* Tunnel thru real mode */
+	local_irq_save(flags);
+	do_vgapost_lowlevel(acpi_wakeup_address);
+	local_irq_restore(flags);
+	
+	/* Restore mapping etc */
+	zap_low_mappings();
+	acpi_video_flags = saved_video_flags;
+}
+EXPORT_SYMBOL (acpi_vgapost);
+
 /**
  * acpi_reserve_bootmem - do _very_ early ACPI initialisation
  *
arch/i386/kernel/acpi/wakeup.S +79 -0

91 lines not on this page · raw message

drivers/video/aty/radeon_pm.c +18 -0
Index: linux-2.6.13-rc3/drivers/video/aty/radeon_pm.c
===================================================================
@@ -2403,6 +2403,15 @@
 
 #endif /* CONFIG_PPC_OF */
 
+#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+extern void acpi_vgapost (unsigned long slot);
+
+static void radeon_reinitialize_vgapost(struct radeonfb_info *rinfo)
+{
+	acpi_vgapost (rinfo->pdev->devfn);
+}
+#endif
+
 static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
 {
 	u16 pwr_cmd;
@@ -2657,6 +2666,8 @@
 		 */
 		else if (rinfo->pm_mode & radeon_pm_d2)
 			radeon_set_suspend(rinfo, 0);
+		if (rinfo->pm_mode & radeon_pm_post && rinfo->reinit_func != NULL)
+			rinfo->reinit_func(rinfo);
 
 		rinfo->asleep = 0;
 	} else
@@ -2777,6 +2788,13 @@
 #endif
 	}
 #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */
+
+#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+	if (rinfo->is_mobility && rinfo->pm_reg) {
+		rinfo->reinit_func = radeon_reinitialize_vgapost;
+		rinfo->pm_mode |= radeon_pm_post;
+	}
+#endif
 }
 
 void radeonfb_pm_exit(struct radeonfb_info *rinfo)
drivers/video/aty/radeonfb.h +1 -0
Index: linux-2.6.13-rc3/drivers/video/aty/radeonfb.h
===================================================================
@@ -271,6 +271,7 @@
 	radeon_pm_none	= 0,		/* Nothing supported */
 	radeon_pm_d2	= 0x00000001,	/* Can do D2 state */
 	radeon_pm_off	= 0x00000002,	/* Can resume from D3 cold */
+	radeon_pm_post	= 0x00000004,	/* Resume with vgapost */
 };
 
 struct radeonfb_info {
#1 lore raw

Micheal Marineau napsal(a):

Quoted 29 lines

Here is a cleaned up version of the patch to repost radeon cards when resuming from acpi s3 suspend. I've been sitting on it for a while hoping that I might be able to gain some insight in how to use the d2 state instead of this repost as ppc does. On my x86 laptop with a radeon 9000 resuming from d2 does manage to turn on the card/display, but it becomes horridly scrambled. But right now I don't have the time or the skill to actually get any futher than that.

And btw, posting the card still causes the system to wait for a key press. I don't know if that is solvable with the current post method. Getting the existing d2 suspend/resume stuff to work might be the only way to clear that up.

------------------------------------------------------------------------

Index: linux-2.6.13-rc3/arch/i386/kernel/acpi/sleep.c
===================================================================

arch/i386/kernel/acpi/sleep.c +1 -0
@@ -5,6 +5,7 @@
 *  Copyright (C) 2001-2003 Pavel Machek <[email protected]>
 */
 
+#include <linux/module.h>
 #include <linux/acpi.h>
 #include <linux/bootmem.h>
 #include <linux/dmi.h>

arch/i386/kernel/acpi/sleep.c line 66

Quoted 10 lines
arch/i386/kernel/acpi/sleep.c +5 -0
@@ -56,6 +57,34 @@
 	zap_low_mappings();
 }
 
+/*
+ * acpi_vgapost
+ */
+
+extern void do_vgapost_lowlevel (unsigned long);
 
 

the comment is for acpi_vgapost, not for some extern somewhat, maybe...

arch/i386/kernel/acpi/sleep.c

Quoted 12 lines
arch/i386/kernel/acpi/sleep.c +10 -0
+
+void acpi_vgapost (unsigned long slot)
+{
+	unsigned long flags, saved_video_flags = acpi_video_flags;
+	
+	acpi_video_flags = (slot & 0xffff) << 16 | 1;
+	
+	/* Map low memory and copy information */
+	init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
+	memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
 

80 chars on line max, please.

Quoted 9 lines
arch/i386/kernel/acpi/sleep.c +7 -0
+	acpi_copy_wakeup_routine(acpi_wakeup_address);
+	
+	/* Tunnel thru real mode */
+	local_irq_save(flags);
+	do_vgapost_lowlevel(acpi_wakeup_address);
+	local_irq_restore(flags);
+	

[snip]

arch/i386/kernel/acpi/sleep.c line 2671

Quoted 11 lines

static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)

{
	u16 pwr_cmd;
arch/i386/kernel/acpi/sleep.c +1 -0
@@ -2657,6 +2666,8 @@
 		 */
 		else if (rinfo->pm_mode & radeon_pm_d2)
 			radeon_set_suspend(rinfo, 0);
+		if (rinfo->pm_mode & radeon_pm_post && rinfo->reinit_func != NULL)
 
 

80 too

arch/i386/kernel/acpi/sleep.c line 2792

Quoted 10 lines
arch/i386/kernel/acpi/sleep.c +1 -0
+			rinfo->reinit_func(rinfo);
 
		rinfo->asleep = 0;
	} else
arch/i386/kernel/acpi/sleep.c +0 -0
@@ -2777,6 +2788,13 @@
 #endif
 	}
 #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_OF) */
 
 

[snip]

It looks good, otherwise.

Signature · 3 lines
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      [email protected]      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10