public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Dösinger" <stefandoesinger-RbZlAiThDcE@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, "Li,
	Shaohua" <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Carl-Daniel Hailfinger
	<c-d.hailfinger.kernel.2004-hi6Y0CQ0nG0@public.gmane.org>,
	Johan Vromans <jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org>
Subject: PATCH: Call acpi_leave_sleep_state before resuming devices
Date: Thu, 30 Dec 2004 22:39:18 +0100	[thread overview]
Message-ID: <200412302239.20109.stefandoesinger@gmx.at> (raw)
In-Reply-To: <20041226194039.GC1739-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

Hello,

Here's again the resume-finish-split patch, this time CC-ed to Len.

This patch splits up acpi_pm_leave. It introduces acpi_pm_leave which calls 
acpi_leave_sleep_state and acpi_disable_wakeup_device before resuming the 
devices. This improves S3 resume on an Acer Travelmate 800 and on the Samsung 
P3 notebook.

Some archive references:
http://sourceforge.net/mailarchive/message.php?msg_id=9091506
http://sourceforge.net/mailarchive/message.php?msg_id=10315947

The background is that any write access to the pci config registers of some 
devices(sound card, usb 2.0 controler, and modem) cause a system lockup if 
they are called before acpi_leave_sleep_state and acpi_disable_wakeup_device 
were called. This is on an Acer Travelmate 803 Notebook, and it seems to be 
the same on other systems.

I sent the patch to the list, but it seems that nobody noticed it and I forgot 
to send it again. Here is an updated patch against 2.6.10. I can't promise 
that it doesn't break other systems. Someone should make sure that 
pm_ops->leave is set to NULL for apm. I haven't found this in the apm code 
yet.

Cheers,
Stefan Dösinger

[-- Attachment #2: resume-finish-split.patch --]
[-- Type: text/x-diff, Size: 1855 bytes --]

--- linux-2.6.10/include/linux/pm.h	2004-12-26 15:25:39.639998872 +0100
+++ include/linux/pm.h	2004-12-26 15:27:10.885127504 +0100
@@ -208,6 +208,7 @@
 	suspend_disk_method_t pm_disk_mode;
 	int (*prepare)(suspend_state_t state);
 	int (*enter)(suspend_state_t state);
+	int (*leave)(suspend_state_t state);
 	int (*finish)(suspend_state_t state);
 };
 
--- linux-2.6.10/kernel/power/main.c	2004-12-26 15:25:54.377758392 +0100
+++ kernel/power/main.c	2004-12-26 15:26:31.472119192 +0100
@@ -104,6 +104,8 @@
 
 static void suspend_finish(suspend_state_t state)
 {
+	if (pm_ops && pm_ops->leave)
+		pm_ops->leave(state);
 	device_resume();
 	if (pm_ops && pm_ops->finish)
 		pm_ops->finish(state);
--- linux-2.6.10/drivers/acpi/sleep/main.c	2004-12-26 15:25:20.314936728 +0100
+++ drivers/acpi/sleep/main.c	2004-12-26 15:28:49.253173288 +0100
@@ -130,7 +130,23 @@
 	return ACPI_SUCCESS(status) ? 0 : -EFAULT;
 }
 
+/**
+ *	acpi_pm_leave - Make system ready to resume devices.
+ *	@pm_state:		State we're coming out of.
+ *
+ *	This is called after we wake back up and before device
+ *	resume methods are called.
+ */
+
+static int acpi_pm_leave(suspend_state_t pm_state)
+{
+	u32 acpi_state = acpi_suspend_states[pm_state];
 
+	acpi_leave_sleep_state(acpi_state);
+	acpi_disable_wakeup_device(acpi_state);
+	
+	return 0;
+}
 /**
  *	acpi_pm_finish - Finish up suspend sequence.
  *	@pm_state:		State we're coming out of.
@@ -143,9 +159,6 @@
 {
 	u32 acpi_state = acpi_suspend_states[pm_state];
 
-	acpi_leave_sleep_state(acpi_state);
-	acpi_disable_wakeup_device(acpi_state);
-
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);
 
@@ -173,6 +186,7 @@
 static struct pm_ops acpi_pm_ops = {
 	.prepare	= acpi_pm_prepare,
 	.enter		= acpi_pm_enter,
+	.leave		= acpi_pm_leave,
 	.finish		= acpi_pm_finish,
 };
 

  parent reply	other threads:[~2004-12-30 21:39 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-15  4:55 Samsung P35 and S3 suspend Carl-Daniel Hailfinger
     [not found] ` <41BFC3AD.5030001-hi6Y0CQ0nG0@public.gmane.org>
2004-12-15 13:28   ` Matthias Hentges
2004-12-15 17:59     ` Carl-Daniel Hailfinger
     [not found]       ` <41C07B6F.70900-hi6Y0CQ0nG0@public.gmane.org>
2004-12-16  1:03         ` Matthias Hentges
2004-12-16  3:24           ` Carl-Daniel Hailfinger
     [not found]             ` <41C0FFF3.4010902-hi6Y0CQ0nG0@public.gmane.org>
2004-12-16 14:29               ` Carl-Daniel Hailfinger
     [not found]                 ` <41C19BD8.7050201-hi6Y0CQ0nG0@public.gmane.org>
2004-12-16 17:32                   ` Stefan Dösinger
     [not found]                     ` <200412161832.09711.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-12-16 18:28                       ` Carl-Daniel Hailfinger
     [not found]                         ` <41C1D3CB.5010805-hi6Y0CQ0nG0@public.gmane.org>
2004-12-16 20:57                           ` Stefan Dösinger
     [not found]                             ` <200412162157.02741.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-12-16 21:10                               ` Matthew Garrett
2004-12-16 21:26                                 ` Stefan Dösinger
     [not found]                                   ` <200412162226.43166.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-12-16 21:42                                     ` Matthew Garrett
2004-12-17  0:25                               ` Carl-Daniel Hailfinger
     [not found]                                 ` <41C22792.2000205-hi6Y0CQ0nG0@public.gmane.org>
2004-12-17 15:49                                   ` Stefan Dösinger
     [not found]                                     ` <200412171649.08125.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-12-20 18:12                                       ` Carl-Daniel Hailfinger
2004-12-16 18:10                   ` Carl-Daniel Hailfinger
     [not found]                     ` <41C1CFA2.20304-hi6Y0CQ0nG0@public.gmane.org>
2004-12-16 18:41                       ` Matthias Hentges
2004-12-16 19:09                         ` Matthew Garrett
2004-12-20 20:34                           ` Carl-Daniel Hailfinger
     [not found]                             ` <41C7374D.6090407-hi6Y0CQ0nG0@public.gmane.org>
2004-12-21  0:39                               ` Carl-Daniel Hailfinger
2004-12-22  2:06                       ` Carl-Daniel Hailfinger
     [not found]                         ` <41C8D689.3020502-hi6Y0CQ0nG0@public.gmane.org>
2004-12-22 11:37                           ` Johan Vromans
     [not found]                             ` <m2zn067edh.fsf-KjnUIgV0B0bak1Ioo/c9IoRWq/SkRNHw@public.gmane.org>
2004-12-22 15:35                               ` Carl-Daniel Hailfinger
     [not found]                                 ` <41C9945E.9080101-hi6Y0CQ0nG0@public.gmane.org>
2004-12-26 12:13                                   ` Pavel Machek
     [not found]                                     ` <20041226121316.GA1590-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-12-26 14:43                                       ` Stefan Dösinger
     [not found]                                         ` <20041226194039.GC1739@elf.ucw.cz>
     [not found]                                           ` <20041226194039.GC1739-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2004-12-30 21:39                                             ` Stefan Dösinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-01-10  2:19 PATCH: Call acpi_leave_sleep_state before resuming devices Li, Shaohua
2005-01-25 19:36 Stefan Dösinger
     [not found] ` <200501252036.32045.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2005-01-26  5:45   ` Nigel Cunningham
2005-01-26 14:11     ` Stefan Dösinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200412302239.20109.stefandoesinger@gmx.at \
    --to=stefandoesinger-rbzlaithdce@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=c-d.hailfinger.kernel.2004-hi6Y0CQ0nG0@public.gmane.org \
    --cc=jvromans-2pNSKKP3PSKEVqv0pETR8A@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox