public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Dösinger" <stefandoesinger-RbZlAiThDcE@public.gmane.org>
To: kronos-0Y2hHv2PMqFeoWH0uzbU5w@public.gmane.org
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
Subject: Re: pci device resume too early?
Date: Wed, 4 Aug 2004 20:47:00 +0200	[thread overview]
Message-ID: <200408042047.01268.stefandoesinger@gmx.at> (raw)
In-Reply-To: <20040728210602.GA26087-sTXFmx6KbOnUXq0IF5SVAZ4oGUkBHcCu@public.gmane.org>

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

Hi,

> ACPI finish calls acpi_leave_sleep_state() and restore the waking
> vectore. I'm not an ACPI guru but my guess is that what you need is
> in acpi_leave_sleep_state().
>
> If that's the case we may want to split the finish callback (say
> prepare_wake and finish_wake).
I've got a small patch which introduces ->leave function which calls(if acpi 
is used) acpi_leave_sleep_state and acpi_disable_wakeup_device which are 
needed for me to make device resume work properly.

Hope it's correct and you like it,
Stefan Dösinger

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

--- linux-2.6.8-rc2/include/linux/pm.h	2004-08-04 20:36:48.044455680 +0200
+++ include/linux/pm.h	2004-08-04 19:50:07.000000000 +0200
@@ -214,6 +214,7 @@
 	u32	pm_disk_mode;
 	int (*prepare)(u32 state);
 	int (*enter)(u32 state);
+	int (*leave)(u32 state);
 	int (*finish)(u32 state);
 };
 
--- linux-2.6.8-rc2/kernel/power/main.c	2004-08-04 20:36:17.755060368 +0200
+++ kernel/power/main.c	2004-08-04 19:52:26.000000000 +0200
@@ -108,6 +108,8 @@
 
 static void suspend_finish(u32 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.8-rc2/drivers/acpi/sleep/main.c	2004-08-04 20:29:23.863981376 +0200
+++ drivers/acpi/sleep/main.c	2004-08-04 20:33:41.348837728 +0200
@@ -127,7 +127,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(u32 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.
@@ -140,9 +156,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);
 
@@ -170,6 +183,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-08-04 18:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-28 17:53 pci device resume too early? Stefan Dösinger
     [not found] ` <200407281953.39159.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-07-28 18:14   ` Matthew Garrett
     [not found]     ` <1091038485.15464.9.camel-myFlNLNQP+Q@public.gmane.org>
2004-07-28 19:18       ` Stefan Dösinger
     [not found]         ` <200407282118.52624.stefandoesinger-RbZlAiThDcE@public.gmane.org>
2004-07-28 21:06           ` Luca
     [not found]             ` <20040728210602.GA26087-sTXFmx6KbOnUXq0IF5SVAZ4oGUkBHcCu@public.gmane.org>
2004-07-29 15:04               ` Stefan Dösinger
2004-08-04 18:47               ` Stefan Dösinger [this message]
2004-07-28 21:59           ` Matthew Garrett
  -- strict thread matches above, loose matches on Subject: below --
2004-07-29  0:48 Li, Shaohua

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=200408042047.01268.stefandoesinger@gmx.at \
    --to=stefandoesinger-rbzlaithdce@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=kronos-0Y2hHv2PMqFeoWH0uzbU5w@public.gmane.org \
    --cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@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