From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Antonino A. Daplas" <adaplas@gmail.com>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: atyfb: Early video resume for PowerMacs
Date: Thu, 20 Dec 2007 14:59:36 +1100 [thread overview]
Message-ID: <1198123176.31714.8.camel@pasglop> (raw)
This adds support for early resuming of the video driver on some
powermacs that support it. Makes video come back earlier and thus
debugging of suspend/resume problems easier.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
This is for 2.6.25
Index: linux-merge/drivers/video/aty/atyfb_base.c
===================================================================
--- linux-merge.orig/drivers/video/aty/atyfb_base.c 2007-12-20 14:50:23.000000000 +1100
+++ linux-merge/drivers/video/aty/atyfb_base.c 2007-12-20 14:58:44.000000000 +1100
@@ -76,6 +76,7 @@
#ifdef __powerpc__
#include <asm/machdep.h>
+#include <asm/pmac_feature.h>
#include <asm/prom.h>
#include "../macmodes.h"
#endif
@@ -2057,17 +2058,18 @@ static int atyfb_pci_suspend(struct pci_
#ifdef CONFIG_PPC_PMAC
/* Set chip to "suspend" mode */
- if (aty_power_mgmt(1, par)) {
- par->asleep = 0;
- par->lock_blank = 0;
- atyfb_blank(FB_BLANK_UNBLANK, info);
- fb_set_suspend(info, 0);
- release_console_sem();
- return -EIO;
- }
-#else
+ if (machine_is(powermac)) {
+ if (aty_power_mgmt(1, par)) {
+ par->asleep = 0;
+ par->lock_blank = 0;
+ atyfb_blank(FB_BLANK_UNBLANK, info);
+ fb_set_suspend(info, 0);
+ release_console_sem();
+ return -EIO;
+ }
+ } else
+#endif /* CONFIG_PPC_PMAC */
pci_set_power_state(pdev, pci_choose_state(pdev, state));
-#endif
release_console_sem();
@@ -2076,7 +2078,7 @@ static int atyfb_pci_suspend(struct pci_
return 0;
}
-static int atyfb_pci_resume(struct pci_dev *pdev)
+static int atyfb_do_resume(struct pci_dev *pdev)
{
struct fb_info *info = pci_get_drvdata(pdev);
struct atyfb_par *par = (struct atyfb_par *) info->par;
@@ -2084,14 +2086,14 @@ static int atyfb_pci_resume(struct pci_d
if (pdev->dev.power.power_state.event == PM_EVENT_ON)
return 0;
- acquire_console_sem();
+ pci_set_power_state(pdev, PCI_D0);
#ifdef CONFIG_PPC_PMAC
- if (pdev->dev.power.power_state.event == 2)
- aty_power_mgmt(0, par);
-#else
- pci_set_power_state(pdev, PCI_D0);
-#endif
+ if (machine_is(powermac)) {
+ if (pdev->dev.power.power_state.event == 2)
+ aty_power_mgmt(0, par);
+ }
+#endif /* CONFIG_PPC_PMAC */
aty_resume_chip(info);
@@ -2107,13 +2109,34 @@ static int atyfb_pci_resume(struct pci_d
par->lock_blank = 0;
atyfb_blank(FB_BLANK_UNBLANK, info);
- release_console_sem();
-
pdev->dev.power.power_state = PMSG_ON;
return 0;
}
+static int atyfb_pci_resume(struct pci_dev *pdev)
+{
+ int rc;
+
+ acquire_console_sem();
+ rc = atyfb_do_resume(pdev);
+ release_console_sem();
+
+ return rc;
+}
+
+#ifdef CONFIG_PPC_PMAC
+static void atyfb_early_resume(void *data)
+{
+ struct atyfb_par *par = data;
+
+ if (try_acquire_console_sem())
+ return;
+ atyfb_do_resume(par->pdev);
+ release_console_sem();
+}
+#endif /* CONFIG_PPC_PMAC */
+
#endif /* defined(CONFIG_PM) && defined(CONFIG_PCI) */
/* Backlight */
@@ -2596,7 +2619,7 @@ static int __devinit aty_init(struct fb_
}
memset(&var, 0, sizeof(var));
-#ifdef CONFIG_PPC
+#ifdef CONFIG_PPC_PMAC
if (machine_is(powermac)) {
/*
* FIXME: The NVRAM stuff should be put in a Mac-specific file, as it
@@ -2631,7 +2654,8 @@ static int __devinit aty_init(struct fb_
&var))
has_var = 1;
}
- }
+ pmac_set_early_video_resume(atyfb_early_resume, par);
+}
#endif /* !CONFIG_PPC */
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
next reply other threads:[~2007-12-20 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-20 3:59 Benjamin Herrenschmidt [this message]
2007-12-20 4:56 ` atyfb: Early video resume for PowerMacs Benjamin Herrenschmidt
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=1198123176.31714.8.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=adaplas@gmail.com \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/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;
as well as URLs for NNTP newsgroup(s).