All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jesse.barnes@intel.com>
To: Jeff Chua <jeff.chua.linux@gmail.com>
Cc: suspend-devel List <suspend-devel@lists.sourceforge.net>,
	Dave Airlie <airlied@linux.ie>, Greg KH <gregkh@suse.de>,
	lkml <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-acpi@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: 2.6.25-rc2 System no longer powers off after suspend-to-disk. Screen becomes green.
Date: Wed, 20 Feb 2008 12:09:03 -0800	[thread overview]
Message-ID: <200802201209.03807.jesse.barnes@intel.com> (raw)
In-Reply-To: <200802201118.08468.jesse.barnes@intel.com>

On Wednesday, February 20, 2008 11:18 am Jesse Barnes wrote:
> On Wednesday, February 20, 2008 11:10 am Jeff Chua wrote:
> > On Feb 21, 2008 2:53 AM, Jesse Barnes <jesse.barnes@intel.com> wrote:
> > > > So, next I'll try "shutdown" to see if it work. I was using
> > > > "platform".
> > >
> > > Ok, that would be good to try.
> >
> > "shutdown" does power down properly. But still green on resume.
>
> Ok, so Linus' theory about something later in the resume path trying to
> touch video is looking good.
>
> Rafael, is there anyway to prevent the device shutdown in the hibernate
> path?

Given the way the PM core works, do we need to set a flag like this?  I really 
hope there's a better way of doing this...

Thanks,
Jesse

diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 4048f39..a2d6242 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -238,6 +238,13 @@ static void i915_restore_vga(struct drm_device *dev)
 
 }
 
+/*
+ * If we're doing a suspend to disk, we don't want to power off the device.
+ * Unfortunately, the PM core doesn't tell us if we're headed for a regular
+ * S3 state or that it's about to shut down the machine, so we use this flag.
+ */
+static int i915_hibernate;
+
 static int i915_suspend(struct drm_device *dev, pm_message_t state)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -252,6 +259,9 @@ static int i915_suspend(struct drm_device *dev, 
pm_message_t state)
 	if (state.event == PM_EVENT_PRETHAW)
 		return 0;
 
+	if (state.event == PM_EVENT_FREEZE)
+		i915_hibernate = 1;
+
 	pci_save_state(dev->pdev);
 	pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
 
@@ -366,7 +376,7 @@ static int i915_suspend(struct drm_device *dev, 
pm_message_t state)
 
 	i915_save_vga(dev);
 
-	if (state.event == PM_EVENT_SUSPEND) {
+	if (!i915_hibernate) {
 		/* Shut down the device */
 		pci_disable_device(dev->pdev);
 		pci_set_power_state(dev->pdev, PCI_D3hot);
@@ -385,6 +395,8 @@ static int i915_resume(struct drm_device *dev)
 	if (pci_enable_device(dev->pdev))
 		return -1;
 
+	i915_hibernate = 0;
+
 	pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
 
 	/* Pipe & plane A info */

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

WARNING: multiple messages have this Message-ID (diff)
From: Jesse Barnes <jesse.barnes@intel.com>
To: "Jeff Chua" <jeff.chua.linux@gmail.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"Dave Airlie" <airlied@linux.ie>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-acpi@vger.kernel.org,
	"suspend-devel List" <suspend-devel@lists.sourceforge.net>,
	"Greg KH" <gregkh@suse.de>
Subject: Re: 2.6.25-rc2 System no longer powers off after suspend-to-disk. Screen becomes green.
Date: Wed, 20 Feb 2008 12:09:03 -0800	[thread overview]
Message-ID: <200802201209.03807.jesse.barnes@intel.com> (raw)
In-Reply-To: <200802201118.08468.jesse.barnes@intel.com>

On Wednesday, February 20, 2008 11:18 am Jesse Barnes wrote:
> On Wednesday, February 20, 2008 11:10 am Jeff Chua wrote:
> > On Feb 21, 2008 2:53 AM, Jesse Barnes <jesse.barnes@intel.com> wrote:
> > > > So, next I'll try "shutdown" to see if it work. I was using
> > > > "platform".
> > >
> > > Ok, that would be good to try.
> >
> > "shutdown" does power down properly. But still green on resume.
>
> Ok, so Linus' theory about something later in the resume path trying to
> touch video is looking good.
>
> Rafael, is there anyway to prevent the device shutdown in the hibernate
> path?

Given the way the PM core works, do we need to set a flag like this?  I really 
hope there's a better way of doing this...

Thanks,
Jesse

diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 4048f39..a2d6242 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -238,6 +238,13 @@ static void i915_restore_vga(struct drm_device *dev)
 
 }
 
+/*
+ * If we're doing a suspend to disk, we don't want to power off the device.
+ * Unfortunately, the PM core doesn't tell us if we're headed for a regular
+ * S3 state or that it's about to shut down the machine, so we use this flag.
+ */
+static int i915_hibernate;
+
 static int i915_suspend(struct drm_device *dev, pm_message_t state)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -252,6 +259,9 @@ static int i915_suspend(struct drm_device *dev, 
pm_message_t state)
 	if (state.event == PM_EVENT_PRETHAW)
 		return 0;
 
+	if (state.event == PM_EVENT_FREEZE)
+		i915_hibernate = 1;
+
 	pci_save_state(dev->pdev);
 	pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);
 
@@ -366,7 +376,7 @@ static int i915_suspend(struct drm_device *dev, 
pm_message_t state)
 
 	i915_save_vga(dev);
 
-	if (state.event == PM_EVENT_SUSPEND) {
+	if (!i915_hibernate) {
 		/* Shut down the device */
 		pci_disable_device(dev->pdev);
 		pci_set_power_state(dev->pdev, PCI_D3hot);
@@ -385,6 +395,8 @@ static int i915_resume(struct drm_device *dev)
 	if (pci_enable_device(dev->pdev))
 		return -1;
 
+	i915_hibernate = 0;
+
 	pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);
 
 	/* Pipe & plane A info */

  reply	other threads:[~2008-02-20 20:09 UTC|newest]

Thread overview: 186+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-20 17:17 2.6.25-rc2 System no longer powers off after suspend-to-disk. Screen becomes green Jeff Chua
2008-02-20 17:19 ` Jeff Chua
2008-02-20 17:19   ` Jeff Chua
2008-02-20 17:28 ` Linus Torvalds
2008-02-20 17:28   ` Linus Torvalds
2008-02-20 17:37   ` Jeff Chua
2008-02-20 17:52     ` Linus Torvalds
2008-02-20 17:52       ` Linus Torvalds
2008-02-20 18:02       ` Jeff Chua
2008-02-21 19:43         ` [Suspend-devel] 2.6.25-rc2 System no longer powers off aftersuspend-to-disk. " Romano Giannetti
2008-02-21 19:43           ` Romano Giannetti
2008-02-21 21:02           ` Jesse Barnes
2008-02-21 21:02             ` [Suspend-devel] " Jesse Barnes
2008-02-22  0:20             ` Jeff Chua
2008-02-22  0:23               ` Jesse Barnes
2008-02-22  0:42                 ` Jeff Chua
2008-02-22  0:42                   ` [Suspend-devel] " Jeff Chua
2008-02-22  0:46                   ` Jesse Barnes
2008-02-22  0:52                     ` Jeff Chua
2008-02-22  0:52                       ` [Suspend-devel] " Jeff Chua
2008-02-22  1:02                       ` Jesse Barnes
2008-02-22  1:02                         ` [Suspend-devel] " Jesse Barnes
2008-02-22  1:27                         ` Jeff Chua
2008-02-22  1:27                           ` [Suspend-devel] " Jeff Chua
2008-02-22  1:28                         ` Linus Torvalds
2008-02-22  1:28                           ` [Suspend-devel] " Linus Torvalds
2008-02-22  1:35                           ` Jesse Barnes
2008-02-22 10:37                   ` Matthew Garrett
2008-02-22 13:06                     ` Ingo Molnar
2008-02-22 16:10                       ` Rafael J. Wysocki
2008-02-22 16:50                       ` Linus Torvalds
2008-02-22 18:01                       ` Matthew Garrett
2008-02-23 11:17                         ` Ingo Molnar
2008-02-22  0:31               ` Rafael J. Wysocki
2008-02-22  0:42                 ` Jeff Chua
2008-02-22  0:42                   ` [Suspend-devel] " Jeff Chua
2008-02-22  1:01                   ` Jeff Chua
2008-02-22  1:01                     ` [Suspend-devel] " Jeff Chua
2008-02-22  1:06                     ` Rafael J. Wysocki
2008-02-22  1:06                       ` [Suspend-devel] " Rafael J. Wysocki
2008-02-22  0:46                 ` Linus Torvalds
2008-02-22  0:46                   ` [Suspend-devel] " Linus Torvalds
2008-02-22  0:54                   ` Rafael J. Wysocki
2008-02-22  0:54                     ` [Suspend-devel] " Rafael J. Wysocki
2008-02-22  1:13                     ` Jesse Barnes
2008-02-22  1:44                       ` Jesse Barnes
2008-02-22 23:31                         ` i915 hibernation patch (was: Re: [Suspend-devel] 2.6.25-rc2 System no longer powers off aftersuspend-to-disk. Screen becomes green.) Rafael J. Wysocki
2008-02-23  1:00                           ` Linus Torvalds
2008-02-23  1:55                             ` Rafael J. Wysocki
2008-02-23  2:07                               ` Linus Torvalds
2008-02-23  2:07                                 ` Linus Torvalds
2008-02-23  4:36                                 ` Jeff Chua
2008-02-23 18:13                                   ` [PATCH] PM: Introduce PM_EVENT_HIBERNATE (was: Re: i915 hibernation patch (was: Re: 2.6.25-rc2 System no longer ...)) Rafael J. Wysocki
2008-02-23 18:13                                   ` Rafael J. Wysocki
2008-02-23 18:43                                     ` Linus Torvalds
2008-02-24  8:29                                       ` Pavel Machek
2008-02-24  8:29                                       ` Pavel Machek
2008-02-24 15:21                                       ` Jeff Chua
2008-02-24 15:21                                       ` Jeff Chua
2008-02-23 18:43                                     ` Linus Torvalds
2008-02-24  4:16                                     ` Mirco Tischler
2008-02-24 11:11                                       ` Rafael J. Wysocki
2008-02-24 11:11                                       ` Rafael J. Wysocki
2008-02-24 11:11                                         ` Rafael J. Wysocki
2008-02-24 11:25                                         ` Rafael J. Wysocki
2008-02-24 11:25                                           ` Rafael J. Wysocki
2008-02-24 11:25                                         ` Rafael J. Wysocki
2008-02-24  4:16                                     ` Mirco Tischler
2008-02-23  4:36                                 ` i915 hibernation patch (was: Re: [Suspend-devel] 2.6.25-rc2 System no longer powers off aftersuspend-to-disk. Screen becomes green.) Jeff Chua
2008-02-23 11:17                               ` Pavel Machek
2008-02-23 11:17                               ` Pavel Machek
2008-02-23  1:55                             ` Rafael J. Wysocki
2008-02-23  1:00                           ` Linus Torvalds
2008-02-22 23:31                         ` Rafael J. Wysocki
2008-02-20 17:54   ` 2.6.25-rc2 System no longer powers off after suspend-to-disk. Screen becomes green Jeff Chua
2008-02-20 17:54     ` Jeff Chua
2008-02-20 18:37     ` Linus Torvalds
2008-02-20 18:37       ` Linus Torvalds
2008-02-18  6:31       ` [Suspend-devel] " Pavel Machek
2008-02-20 18:49       ` Jeff Chua
2008-02-20 19:25         ` Matthew Garrett
2008-02-20 19:25           ` Matthew Garrett
2008-02-20 18:57       ` Jesse Barnes
2008-02-20 17:50 ` Jesse Barnes
2008-02-20 17:50   ` Jesse Barnes
2008-02-20 18:29   ` Jeff Chua
2008-02-20 18:29     ` Jeff Chua
2008-02-20 18:53     ` Jesse Barnes
2008-02-20 19:10       ` Jeff Chua
2008-02-20 19:18         ` Jesse Barnes
2008-02-20 19:18           ` Jesse Barnes
2008-02-20 20:09           ` Jesse Barnes [this message]
2008-02-20 20:09             ` Jesse Barnes
2008-02-20 20:14             ` Rafael J. Wysocki
2008-02-20 20:29               ` Linus Torvalds
2008-02-20 20:29                 ` Linus Torvalds
2008-02-20 20:33                 ` Pablo Sanchez
2008-02-20 20:33                   ` [Suspend-devel] " Pablo Sanchez
2008-02-20 20:41                 ` Jesse Barnes
2008-02-20 20:41                   ` Jesse Barnes
2008-02-20 21:13                   ` Linus Torvalds
2008-02-20 21:44                     ` Jesse Barnes
2008-02-20 21:44                       ` Jesse Barnes
2008-02-20 22:22                       ` Linus Torvalds
2008-02-20 22:22                         ` Linus Torvalds
2008-02-21  8:30                         ` david
2008-02-21  8:30                           ` david
2008-02-22 16:56                           ` Mark Lord
2008-02-22 17:02                             ` Rafael J. Wysocki
2008-02-22 17:32                               ` Mark Lord
2008-02-22 17:44                                 ` Rafael J. Wysocki
2008-02-22 19:23                                   ` david
2008-02-22 23:16                                     ` Rafael J. Wysocki
2008-02-20 22:36                       ` Rafael J. Wysocki
2008-02-20 22:36                         ` Rafael J. Wysocki
2008-02-20 23:13                         ` Linus Torvalds
2008-02-20 23:35                           ` Rafael J. Wysocki
2008-02-20 23:35                             ` Rafael J. Wysocki
2008-02-21  0:00                             ` Linus Torvalds
2008-02-21  0:00                               ` Linus Torvalds
2008-02-21  0:13                               ` Rafael J. Wysocki
2008-02-21  0:13                                 ` Rafael J. Wysocki
2008-02-21  0:25                                 ` Linus Torvalds
2008-02-21  0:25                                   ` Linus Torvalds
2008-02-21  0:59                                   ` Rafael J. Wysocki
2008-02-22 16:54                             ` Mark Lord
2008-02-20 22:45                       ` Nigel Cunningham
2008-02-20 22:45                         ` Nigel Cunningham
2008-02-21  0:13                         ` Matthew Garrett
2008-02-21  0:40                           ` Nigel Cunningham
2008-02-21  0:46                             ` Greg KH
2008-02-21  1:17                               ` Nigel Cunningham
2008-02-21  4:43                                 ` Greg KH
2008-02-21  6:05                                   ` Nigel Cunningham
2008-02-21  6:37                                     ` Greg KH
2008-02-21  1:10                             ` Matthew Garrett
2008-02-21  1:25                               ` Nigel Cunningham
2008-02-20 20:45                 ` Rafael J. Wysocki
2008-02-20 20:45                   ` [Suspend-devel] " Rafael J. Wysocki
2008-02-20 21:26                   ` Alexey Starikovskiy
2008-02-20 21:37         ` Jesse Barnes
2008-02-21  0:35           ` Jeff Chua
2008-02-21  0:39             ` Jesse Barnes
2008-02-21  1:19               ` Jeff Chua
2008-02-21  1:19                 ` Jeff Chua
2008-02-21  1:21                 ` Jesse Barnes
2008-02-21  1:49                   ` Jeff Chua
2008-02-21  1:49                     ` Jeff Chua
2008-02-21  2:00               ` Jeff Chua
2008-02-21  2:00                 ` Jeff Chua
2008-02-21 16:27                 ` [Suspend-devel] " Rafael J. Wysocki
2008-02-21 16:27                 ` Rafael J. Wysocki
2008-02-21 18:34                   ` Jesse Barnes
2008-02-21 20:30                     ` Rafael J. Wysocki
2008-02-21 20:30                     ` Rafael J. Wysocki
2008-02-21 22:11                     ` Rafael J. Wysocki
2008-02-21 22:11                     ` Rafael J. Wysocki
2008-02-21 23:45                       ` Jesse Barnes
2008-02-21 23:45                       ` Jesse Barnes
2008-02-22  0:28                         ` Rafael J. Wysocki
2008-02-22  0:28                         ` Rafael J. Wysocki
2008-02-22  0:48                         ` Jeff Chua
2008-02-22  0:48                         ` Jeff Chua
2008-02-21 18:34                   ` Jesse Barnes
2008-02-20 22:32         ` Jesse Barnes
2008-02-20 22:32           ` Jesse Barnes
2008-02-20 23:03           ` Jesse Barnes
2008-02-20 23:03             ` Jesse Barnes
2008-02-20 23:34             ` Jesse Barnes
2008-02-20 23:34               ` Jesse Barnes
2008-02-20 23:49               ` Rafael J. Wysocki
2008-02-20 23:49                 ` Rafael J. Wysocki
2008-02-21  0:17                 ` Jesse Barnes
2008-02-21  0:17                   ` Jesse Barnes
2008-02-21  1:07                   ` [Suspend-devel] " Rafael J. Wysocki
2008-02-20 18:47 ` Mark Lord
  -- strict thread matches above, loose matches on Subject: below --
2008-02-20  0:53 Jeff Chua
2008-02-20  0:53 ` Jeff Chua
2008-02-20  1:00 ` Jesse Barnes
2008-02-20  1:00   ` Jesse Barnes
2008-02-20  1:06   ` Rafael J. Wysocki
2008-02-20  2:28   ` Linus Torvalds
2008-02-20  2:28     ` Linus Torvalds
2008-02-20  4:32     ` Jesse Barnes
2008-02-20  6:19       ` Jeff Chua
2008-02-20  6:19         ` Jeff Chua

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=200802201209.03807.jesse.barnes@intel.com \
    --to=jesse.barnes@intel.com \
    --cc=airlied@linux.ie \
    --cc=gregkh@suse.de \
    --cc=jeff.chua.linux@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=suspend-devel@lists.sourceforge.net \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.