suspend to RAM on lifebook 7110
Hi,
Quoted 3 lines
ram - suspend/resume using s2ram works fine, but display remains nearly black. I can see very hardly what's on display, but machine including network works fine.
After resume the backlight remains off. All other stuff is working, but whitout backlight its a bit hard to work :-) I have the same Lifebook and for me the following is working very well:
Before i actually suspend the notebook, i write some data about the graphic card on disk and on resume the data is written back to the graphic card and everything works fine (I'm writing only the relevant parts in here):
# discover video card's ID
ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`# dump current data from the video card to the temporary file cat /proc/bus/pci/$ID > $TMP_FILE
# suspend echo -n mem > /sys/power/state
# restore video card data from the temporary file # on resume cat $TMP_FILE > /proc/bus/pci/$ID
Note: This works fine for me in a script, which is invoked by acpi on
button-press. I'm using Debian/SID and i don't know where the right place for manipulation on Suse is. Maybe you need to tweek a bit ;-)
HTH,
Frank
Quoted 11 lines · Frank Ursel
Before i actually suspend the notebook, i write some data about the graphic card on disk and on resume the data is written back to the graphic card and everything works fine (I'm writing only the relevant parts in here):
# discover video card's ID ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`# dump current data from the video card to the temporary file cat /proc/bus/pci/$ID > $TMP_FILE
Quoted 6 lines
# suspend echo -n mem > /sys/power/state# restore video card data from the temporary file # on resume cat $TMP_FILE > /proc/bus/pci/$ID
Great, it works for me too.
Quoted 3 lines
Note: This works fine for me in a script, which is invoked by acpi on
button-press. I'm using Debian/SID and i don't know where the right place for manipulation on Suse is. Maybe you need to tweek a bit
Just for record (or others with the same problem :-), I'm using hibernate script from swsusp2 and there I was able to use
OnSuspend 80 /etc/hibernate/video.sh store
OnResume 80 /etc/hibernate/video.sh restore
into /etc/hibernate/ususpend-ram.conf script.
Or on Suse 10.2, pm-utils are used by default and it's easy to add call to this script to /etc/pm/hooks/ directory.
Thanks for your help.
Signature · 1 line
Mirek Ruda
Quoted 12 lines · Miroslav Ruda
Quoted 11 lines · Frank Ursel
Before i actually suspend the notebook, i write some data about the graphic card on disk and on resume the data is written back to the graphic card and everything works fine (I'm writing only the relevant parts in here):
# discover video card's ID ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`# dump current data from the video card to the temporary file cat /proc/bus/pci/$ID > $TMP_FILE
Quoted 8 lines
Quoted 6 lines
# suspend echo -n mem > /sys/power/state# restore video card data from the temporary file # on resume cat $TMP_FILE > /proc/bus/pci/$IDGreat, it works for me too.
OK. This is probably the same as the R50e entry in the whitelist:
/* R50e needs not yet implemented save_video_pci_state :-(
I thought that this should somehow go away by the PCI bus suspend/resume methods that somewhen back got merged by Greg K-H.
I still think that this belongs in the kernel and that we should not work around this issue in s2ram. But maybe somebody who knows more about this stuff can convince me otherwise. It should not be too hard :-)
Quoted 4 lines
Quoted 3 lines
Note: This works fine for me in a script, which is invoked by acpi on
button-press. I'm using Debian/SID and i don't know where the right place for manipulation on Suse is. Maybe you need to tweek a bit
Quoted 8 lines
Just for record (or others with the same problem :-), I'm using hibernate script from swsusp2 and there I was able to use
OnSuspend 80/etc/hibernate/video.shstore
OnResume 80/etc/hibernate/video.shrestore
into/etc/hibernate/ususpend-ram.confscript.Or on Suse 10.2, pm-utils are used by default and it's easy to add call to this script to
/etc/pm/hooks/directory.
Yes, that's how it was intended to be. Easy and straightforward :-)
Best regards,
Stefan
Signature · 9 lines
Stefan Seyfried QA / R&D Team Mobile Devices | "Any ideas, John?" SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out." ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 2 lines · Stefan Seyfried
I thought that this should somehow go away by the PCI bus suspend/resume methods that somewhen back got merged by Greg K-H.
The kernel will only save and restore the standardised PCI configuration registers - anything else needs to be handled by the specific device driver. Unfortunately, in the graphics hardware case, the closest thing to that is the framebuffer driver. Which we don't tend to use.
Signature · 7 lines
Matthew Garrett | [email protected] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Hi Matthew,
thanks for explaining this, i am obviously not too deep into that PCI bus stuff :-)
Quoted 9 lines · Matthew Garrett
Quoted 2 lines · Stefan Seyfried
I thought that this should somehow go away by the PCI bus suspend/resume methods that somewhen back got merged by Greg K-H.
The kernel will only save and restore the standardised PCI configuration registers - anything else needs to be handled by the specific device driver. Unfortunately, in the graphics hardware case, the closest thing to that is the framebuffer driver. Which we don't tend to use.
So the question is: should we either
- implement a minimal "graphics card PCI suspend resume" "driver" in the kernel that will do this even if no framebuffer is used, or
- implement this as a workaround in userspace?
I mean - it is not rocket science to do it in s2ram, but it just seems more correct (to me) to do it in the kernel, where the correct locking and ordering is more or less guaranteed.
Signature · 7 lines
Stefan Seyfried QA / R&D Team Mobile Devices | "Any ideas, John?" SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out." - To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Stefan Seyfried
So the question is: should we either
- implement a minimal "graphics card PCI suspend resume" "driver" in the kernel that will do this even if no framebuffer is used, or
The long term aim is to implement a thin graphics card driver in the kernel, and then port framebuffer and DRM code to that. Doing it effectively requires knowing which PCI configuration registers are relevant for the hardware, which is possibly easier said than done.
Quoted 1 line
- implement this as a workaround in userspace?
Might be easier for the moment, though I agree that it's less than ideal.
Signature · 7 lines
Matthew Garrett | [email protected] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 6 lines · Matthew Garrett
Quoted 1 line · Stefan Seyfried
- implement this as a workaround in userspace?
Might be easier for the moment, though I agree that it's less than ideal.
Ok, so how about that (compiled, not really tested. I tested the "save_vga_pci" by outputting to a file and comparing to /proc and sysfs), but i have no hardware here that needs this:
Warning: watch out for my maybe creative usage of "*" and "&" and complain if you find obvious errors ;-)
Index: s2ram.c
===================================================================
RCS file: /cvsroot/suspend/suspend/s2ram.c,v
retrieving revision 1.45
s2ram.c +54 -3
@@ -11,12 +11,16 @@#include <errno.h> #include <string.h> +#include <pci/pci.h> +#define S2RAM #include "vbetool/vbetool.h" #include "vt.h" #include "s2ram.h" static void *vbe_buffer; +unsigned char vga_pci_state[256 ]; +struct pci_dev vga_dev;/* Flags set from whitelist */ static int flags, vbe_mode =-1 ;char bios_version[1024 ], sys_vendor[1024 ], sys_product[1024 ], sys_version[1024 ];
@@ -36,6 +40,7 @@ char bios_version[1024], sys_vendor[1024#define UNSURE 0x20/* unverified entries from acpi-support 0.59 */ #define NOFB 0x40/* must not use a frame buffer */ #define VBE_MODE 0x80/* machine needs "vbetool vbemode get / set" */ +#define PCI_SAVE 0x100/* we need to save the VGA PCI registers */ #include "whitelist.c"
@@ -67,14 +72,15 @@ void machine_known(int i)" bios_version = '%s'\n" , i, whitelist[i].sys_vendor, whitelist[i].sys_product, whitelist[i].sys_version, whitelist[i].bios_version); -printf ("Fixes: 0x%x %s%s%s%s%s%s%s\n" , flags, +printf ("Fixes: 0x%x %s%s%s%s%s%s%s%s\n" , flags, (flags &VBE_SAVE ) ?"VBE_SAVE " :"" , (flags &VBE_POST ) ?"VBE_POST " :"" , (flags &VBE_MODE ) ?"VBE_MODE " :"" , (flags &RADEON_OFF ) ?"RADEON_OFF " :"" , (flags &S3_BIOS ) ?"S3_BIOS " :"" , (flags &S3_MODE ) ?"S3_MODE " :"" , - (flags &NOFB ) ?"NOFB " :"" ); + (flags &NOFB ) ?"NOFB " :"" , + (flags &PCI_SAVE ) ?"PCI_SAVE " :"" );if (flags &UNSURE )printf ("Machine is in the whitelist but perhaps using " "vbetool unnecessarily.\n"
@@ -143,6 +149,35 @@ int s2ram_check(int id)return ret; } +struct pci_dev find_vga (void ) +{ +struct pci_access *pacc; +struct pci_dev *dev; + + pacc =pci_alloc ();/* Get the pci_access structure */ +pci_init (pacc);/* Initialize the PCI library */ +pci_scan_bus (pacc);/* We want to get the list of devices */ + +for (dev=pacc->devices; dev; dev=dev->next) { +pci_fill_info (dev,PCI_FILL_IDENT |PCI_FILL_CLASS ); +if (dev->device_class ==0x300 ) +break ; + } +pci_cleanup (pacc); + +return *dev; +} + +void save_vga_pci (struct pci_dev dev) +{ +pci_read_block (&dev,0 , vga_pci_state,256 ); +} + +void restore_vga_pci (struct pci_dev dev) +{ +pci_write_block (&dev,0 , vga_pci_state,256 ); +} +/* warning: we have to be on a text console when calling this */ int s2ram_hacks (void ) {
@@ -171,6 +206,12 @@ int s2ram_hacks(void)printf ("Calling radeon_cmd_light(0)\n" );radeon_cmd_light (0 ); } +if (flags &PCI_SAVE ) { + vga_dev =find_vga (); +printf ("saving PCI config of device %02x:%02x.%d\n" , + vga_dev.bus, vga_dev.dev, vga_dev.func); +save_vga_pci (vga_dev); + }return 0 ; }
@@ -216,6 +257,11 @@ int s2ram_do(void)void s2ram_resume (void ) { +if (flags &PCI_SAVE ) { +printf ("saving PCI config of device %02x:%02x.%d\n" , + vga_dev.bus, vga_dev.dev, vga_dev.func); +restore_vga_pci (vga_dev); + }// FIXME: can we call vbetool_init() multiple times without cleaning up? if (flags &VBE_POST ) {vbetool_init ();
@@ -260,6 +306,7 @@ static void usage(void)" -a, --acpi_sleep: set the acpi_sleep parameter before " "suspend\n" " 1=s3_bios, 2=s3_mode, 3=both\n" +" -v, --pci_save: save the PCI config space for the VGA card.\n" "\n");exit (1 ); }
@@ -278,10 +325,11 @@ int main(int argc, char *argv[]) { "radeontool", no_argument, NULL, 'r'}, { "identify", no_argument, NULL, 'i'}, { "acpi_sleep", required_argument, NULL, 'a'}, + { "pci_save", no_argument, NULL, 'v'}, { NULL, 0, NULL, 0 } }; -while ((i =getopt_long (argc, argv,"nhfspmria:" , options,NULL )) !=-1 ) { +while ((i =getopt_long (argc, argv,"nhfspmriva:" , options,NULL )) !=-1 ) {switch (i) {case 'h' :usage ();
@@ -311,6 +359,9 @@ int main(int argc, char *argv[])case 'a' : flags |= (atoi (optarg) & (S3_BIOS |S3_MODE ));break ; +case 'v' : + flags |=PCI_SAVE ; +break ;default :usage ();break ;
Signature · 9 lines
Stefan Seyfried \ "I didn't want to write for pay. I QA / R&D Team Mobile Devices \ wanted to be paid for what I write." SUSE LINUX Products GmbH, Nürnberg \ -- Leonard Cohen ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Quoted 77 lines · Stefan Seyfried
Quoted 6 lines · Matthew Garrett
Quoted 1 line · Stefan Seyfried
- implement this as a workaround in userspace?
Might be easier for the moment, though I agree that it's less than ideal.
Ok, so how about that (compiled, not really tested. I tested the "
save_vga_pci" by outputting to a file and comparing to /proc and sysfs), but i have no hardware here that needs this:Warning: watch out for my maybe creative usage of "*" and "&" and complain if you find obvious errors ;-)
Index:
s2ram.c
===================================================================
RCS file: /cvsroot/suspend/suspend/s2ram.c,v
retrieving revision 1.45
diff -u -p -r1.45s2ram.cs2ram.c +16
-2@@ -11,12 +11,16 @@#include <errno.h> #include <string.h> +#include <pci/pci.h> +#define S2RAM #include "vbetool/vbetool.h" #include "vt.h" #include "s2ram.h" static void *vbe_buffer; +unsigned char vga_pci_state[256 ]; +struct pci_dev vga_dev;/* Flags set from whitelist */ static int flags, vbe_mode =-1 ;char bios_version[1024 ], sys_vendor[1024 ], sys_product[1024 ], sys_version[1024 ];@@ -36,6 +40,7 @@ char bios_version[1024], sys_vendor[1024#define UNSURE 0x20/* unverified entries from acpi-support 0.59 */ #define NOFB 0x40/* must not use a frame buffer */ #define VBE_MODE 0x80/* machine needs "vbetool vbemode get / set" */ +#define PCI_SAVE 0x100/* we need to save the VGA PCI registers */ #include "whitelist.c" @@ -67,14 +72,15 @@ void machine_known(int i)" bios_version = '%s'\n" , i, whitelist[i].sys_vendor, whitelist[i].sys_product, whitelist[i].sys_version, whitelist[i].bios_version); -printf ("Fixes: 0x%x %s%s%s%s%s%s%s\n" , flags, +printf ("Fixes: 0x%x %s%s%s%s%s%s%s%s\n" , flags, (flags &VBE_SAVE ) ?"VBE_SAVE " :"" , (flags &VBE_POST ) ?"VBE_POST " :"" , (flags &VBE_MODE ) ?"VBE_MODE " :"" , (flags &RADEON_OFF ) ?"RADEON_OFF " :"" , (flags &S3_BIOS ) ?"S3_BIOS " :"" , (flags &S3_MODE ) ?"S3_MODE " :"" , - (flags &NOFB ) ?"NOFB " :"" ); + (flags &NOFB ) ?"NOFB " :"" , + (flags &PCI_SAVE ) ?"PCI_SAVE " :"" );if (flags &UNSURE )printf ("Machine is in the whitelist but perhaps using " "vbetool unnecessarily.\n"@@ -143,6 +149,35 @@ int s2ram_check(int id)return ret; } +struct pci_dev find_vga (void ) +{ +struct pci_access *pacc; +struct pci_dev *dev; + + pacc =pci_alloc ();/* Get the pci_access structure */ +pci_init (pacc);/* Initialize the PCI library */ +pci_scan_bus (pacc);/* We want to get the list of devices */
s2ram.c int s2ram_check(int id) · line 169
Quoted 10 lines
s2ram.c +10
-0+ +for (dev=pacc->devices; dev; dev=dev->next) { +pci_fill_info (dev,PCI_FILL_IDENT |PCI_FILL_CLASS ); +if (dev->device_class ==0x300 ) +break ; + } +pci_cleanup (pacc); + +return *dev; +}
Hm, I'd rather return the pointer (eg. so that the structure can be freed).
s2ram.c int s2ram_check(int id) · line 171
Quoted 2 lines
s2ram.c +2
-0+ +void save_vga_pci (struct pci_dev dev)
A pointer here?
s2ram.c int s2ram_check(int id) · line 176
Quoted 5 lines
s2ram.c +5
-0+{ +pci_read_block (&dev,0 , vga_pci_state,256 ); +} + +void restore_vga_pci (struct pci_dev dev)
And here?
s2ram.c int s2ram_hacks(void) · line 210
Quoted 13 lines
s2ram.c +6
-0+{ +pci_write_block (&dev,0 , vga_pci_state,256 ); +} +/* warning: we have to be on a text console when calling this */ int s2ram_hacks (void ) {@@ -171,6 +206,12 @@ int s2ram_hacks(void)printf ("Calling radeon_cmd_light(0)\n" );radeon_cmd_light (0 ); } +if (flags &PCI_SAVE ) { + vga_dev =find_vga ();
Could vga_dev be a pointer?
Quoted 42 lines
s2ram.c +12
-1+printf ("saving PCI config of device %02x:%02x.%d\n" , + vga_dev.bus, vga_dev.dev, vga_dev.func); +save_vga_pci (vga_dev); + }return 0 ; }@@ -216,6 +257,11 @@ int s2ram_do(void)void s2ram_resume (void ) { +if (flags &PCI_SAVE ) { +printf ("saving PCI config of device %02x:%02x.%d\n" , + vga_dev.bus, vga_dev.dev, vga_dev.func); +restore_vga_pci (vga_dev); + }// FIXME: can we call vbetool_init() multiple times without cleaning up? if (flags &VBE_POST ) {vbetool_init ();@@ -260,6 +306,7 @@ static void usage(void)" -a, --acpi_sleep: set the acpi_sleep parameter before " "suspend\n" " 1=s3_bios, 2=s3_mode, 3=both\n" +" -v, --pci_save: save the PCI config space for the VGA card.\n" "\n");exit (1 ); }@@ -278,10 +325,11 @@ int main(int argc, char *argv[]) { "radeontool", no_argument, NULL, 'r'}, { "identify", no_argument, NULL, 'i'}, { "acpi_sleep", required_argument, NULL, 'a'}, + { "pci_save", no_argument, NULL, 'v'}, { NULL, 0, NULL, 0 } }; -while ((i =getopt_long (argc, argv,"nhfspmria:" , options,NULL )) !=-1 ) { +while ((i =getopt_long (argc, argv,"nhfspmriva:" , options,NULL )) !=-1 ) {switch (i) {case 'h' :usage ();
s2ram.c int main(int argc, char *argv[]) · line 367
Quoted 9 lines
s2ram.c +3
-0@@ -311,6 +359,9 @@ int main(int argc, char *argv[])case 'a' : flags |= (atoi (optarg) & (S3_BIOS |S3_MODE ));break ; +case 'v' : + flags |=PCI_SAVE ; +break ;default :usage ();break ;
Greetings,
Rafael
Signature · 9 lines
If you don't have the time to read, you don't have the time or the tools to write. - Stephen King ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Hi!
Quoted 3 lines
thanks for explaining this, i am obviously not too deep into that PCI bus stuff :-)
...
Quoted 11 lines
Quoted 7 lines
Quoted 2 lines
I thought that this should somehow go away by the PCI bus suspend/resume methods that somewhen back got merged by Greg K-H.
The kernel will only save and restore the standardised PCI configuration registers - anything else needs to be handled by the specific device driver. Unfortunately, in the graphics hardware case, the closest thing to that is the framebuffer driver. Which we don't tend to use.
So the question is: should we either
- implement a minimal "graphics card PCI suspend resume" "driver" in the kernel that will do this even if no framebuffer is used, or
We are going there, but it is *hard* to do, due to kernel graphics missdesign. Could take years.
Quoted 5 lines
- implement this as a workaround in userspace?
I mean - it is not rocket science to do it in s2ram, but it just seems more correct (to me) to do it in the kernel, where the correct locking and ordering is more or less guaranteed.
Lets do it in userspace. Doing in kernel is right, but it will be hard.
Pavel
Signature · 8 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Hi,
Quoted 21 lines · Pavel Machek
Hi!
Quoted 3 lines
thanks for explaining this, i am obviously not too deep into that PCI bus stuff :-)
...
Quoted 11 lines
Quoted 7 lines
Quoted 2 lines
I thought that this should somehow go away by the PCI bus suspend/resume methods that somewhen back got merged by Greg K-H.
The kernel will only save and restore the standardised PCI configuration registers - anything else needs to be handled by the specific device driver. Unfortunately, in the graphics hardware case, the closest thing to that is the framebuffer driver. Which we don't tend to use.
So the question is: should we either
- implement a minimal "graphics card PCI suspend resume" "driver" in the kernel that will do this even if no framebuffer is used, orWe are going there, but it is *hard* to do, due to kernel graphics missdesign. Could take years.
Quoted 8 lines
Quoted 5 lines
- implement this as a workaround in userspace?
I mean - it is not rocket science to do it in s2ram, but it just seems more correct (to me) to do it in the kernel, where the correct locking and ordering is more or less guaranteed.
Lets do it in userspace. Doing in kernel is right, but it will be hard.
Agreed.
Plus if we do it in the user space, we'll be able to drop it as soon as it's no longer needed. ;-)
Greetings,
Rafael
Signature · 9 lines
If you don't have the time to read, you don't have the time or the tools to write. - Stephen King ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV