Commit bcbfc29d authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] update aty128fb sleep/wakeup code for new powermac changes

This patch updates aty128fb power management code to the changes of the
powermac sleep mecanism.  It makes the driver use the new hook for early
wakeup, adds the call to the arch code indicating wether it can wakeup the
chip, etc...  This patch shouldn't break non-ppc, but this should be
tested.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 24ddf24c
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include <asm/io.h> #include <asm/io.h>
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
#include <asm/pmac_feature.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#include "../macmodes.h" #include "../macmodes.h"
...@@ -167,6 +168,7 @@ static int aty128_probe(struct pci_dev *pdev, ...@@ -167,6 +168,7 @@ static int aty128_probe(struct pci_dev *pdev,
static void aty128_remove(struct pci_dev *pdev); static void aty128_remove(struct pci_dev *pdev);
static int aty128_pci_suspend(struct pci_dev *pdev, u32 state); static int aty128_pci_suspend(struct pci_dev *pdev, u32 state);
static int aty128_pci_resume(struct pci_dev *pdev); static int aty128_pci_resume(struct pci_dev *pdev);
static int aty128_do_resume(struct pci_dev *pdev);
/* supported Rage128 chipsets */ /* supported Rage128 chipsets */
static struct pci_device_id aty128_pci_tbl[] = { static struct pci_device_id aty128_pci_tbl[] = {
...@@ -1705,6 +1707,18 @@ int __init aty128fb_setup(char *options) ...@@ -1705,6 +1707,18 @@ int __init aty128fb_setup(char *options)
* Initialisation * Initialisation
*/ */
#ifdef CONFIG_PPC_PMAC
static void aty128_early_resume(void *data)
{
struct aty128fb_par *par = data;
if (try_acquire_console_sem())
return;
aty128_do_resume(par->pdev);
release_console_sem();
}
#endif /* CONFIG_PPC_PMAC */
static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
struct fb_info *info = pci_get_drvdata(pdev); struct fb_info *info = pci_get_drvdata(pdev);
...@@ -1749,6 +1763,13 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id * ...@@ -1749,6 +1763,13 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *
var = default_var; var = default_var;
#ifdef CONFIG_PPC_PMAC #ifdef CONFIG_PPC_PMAC
if (_machine == _MACH_Pmac) { if (_machine == _MACH_Pmac) {
/* Indicate sleep capability */
if (par->chip_gen == rage_M3) {
pmac_call_feature(PMAC_FTR_DEVICE_CAN_WAKE, NULL, 0, 1);
pmac_set_early_video_resume(aty128_early_resume, par);
}
/* Find default mode */
if (mode_option) { if (mode_option) {
if (!mac_find_mode(&var, info, mode_option, 8)) if (!mac_find_mode(&var, info, mode_option, 8))
var = default_var; var = default_var;
...@@ -2365,7 +2386,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state) ...@@ -2365,7 +2386,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, u32 state)
return 0; return 0;
} }
static int aty128_pci_resume(struct pci_dev *pdev) static int aty128_do_resume(struct pci_dev *pdev)
{ {
struct fb_info *info = pci_get_drvdata(pdev); struct fb_info *info = pci_get_drvdata(pdev);
struct aty128fb_par *par = info->par; struct aty128fb_par *par = info->par;
...@@ -2373,8 +2394,6 @@ static int aty128_pci_resume(struct pci_dev *pdev) ...@@ -2373,8 +2394,6 @@ static int aty128_pci_resume(struct pci_dev *pdev)
if (pdev->dev.power.power_state == 0) if (pdev->dev.power.power_state == 0)
return 0; return 0;
acquire_console_sem();
/* Wakeup chip */ /* Wakeup chip */
if (pdev->dev.power.power_state == 2) if (pdev->dev.power.power_state == 2)
aty128_set_suspend(par, 0); aty128_set_suspend(par, 0);
...@@ -2394,8 +2413,6 @@ static int aty128_pci_resume(struct pci_dev *pdev) ...@@ -2394,8 +2413,6 @@ static int aty128_pci_resume(struct pci_dev *pdev)
par->lock_blank = 0; par->lock_blank = 0;
aty128fb_blank(0, info); aty128fb_blank(0, info);
release_console_sem();
pdev->dev.power.power_state = 0; pdev->dev.power.power_state = 0;
printk(KERN_DEBUG "aty128fb: resumed !\n"); printk(KERN_DEBUG "aty128fb: resumed !\n");
...@@ -2403,6 +2420,18 @@ static int aty128_pci_resume(struct pci_dev *pdev) ...@@ -2403,6 +2420,18 @@ static int aty128_pci_resume(struct pci_dev *pdev)
return 0; return 0;
} }
static int aty128_pci_resume(struct pci_dev *pdev)
{
int rc;
acquire_console_sem();
rc = aty128_do_resume(pdev);
release_console_sem();
return rc;
}
int __init aty128fb_init(void) int __init aty128fb_init(void)
{ {
#ifndef MODULE #ifndef MODULE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment