aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-06-27 17:36:34 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-27 18:11:43 -0400
commit8c8709334cec803368a432a33e0f2e116d48fe07 (patch)
treef3298ae6d844e548c36df9fc3bfb5a3662d4e45d
parentfcd16cc084f2b98ab64d27721abdb941f3d9c4cb (diff)
[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK
This patch removes CONFIG_PMAC_PBOOK (PowerBook support). This is now split into CONFIG_PMAC_MEDIABAY for the actual hotswap bay that some powerbooks have, CONFIG_PM for power management related code, and just left out of any CONFIG_* option for some generally useful stuff that can be used on non-laptops as well. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc/platforms/pmac_sleep.S4
-rw-r--r--arch/ppc/platforms/pmac_time.c8
-rw-r--r--drivers/block/swim3.c10
-rw-r--r--drivers/char/misc.c3
-rw-r--r--drivers/ide/ppc/pmac.c8
-rw-r--r--drivers/ieee1394/ohci1394.c10
-rw-r--r--drivers/macintosh/Kconfig35
-rw-r--r--drivers/macintosh/Makefile2
-rw-r--r--drivers/macintosh/adb.c10
-rw-r--r--drivers/macintosh/via-pmu.c70
-rw-r--r--drivers/usb/host/ohci-pci.c13
-rw-r--r--drivers/video/aty/aty128fb.c14
-rw-r--r--drivers/video/chipsfb.c176
-rw-r--r--include/linux/pmu.h6
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c14
-rw-r--r--sound/ppc/awacs.c8
-rw-r--r--sound/ppc/daca.c6
-rw-r--r--sound/ppc/pmac.c11
-rw-r--r--sound/ppc/pmac.h2
-rw-r--r--sound/ppc/tumbler.c4
20 files changed, 193 insertions, 221 deletions
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S
index f459ade1bd63..016a74649155 100644
--- a/arch/ppc/platforms/pmac_sleep.S
+++ b/arch/ppc/platforms/pmac_sleep.S
@@ -46,7 +46,7 @@
46 .section .text 46 .section .text
47 .align 5 47 .align 5
48 48
49#if defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ_PMAC) 49#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC)
50 50
51/* This gets called by via-pmu.c late during the sleep process. 51/* This gets called by via-pmu.c late during the sleep process.
52 * The PMU was already send the sleep command and will shut us down 52 * The PMU was already send the sleep command and will shut us down
@@ -382,7 +382,7 @@ turn_on_mmu:
382 isync 382 isync
383 rfi 383 rfi
384 384
385#endif /* defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ) */ 385#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */
386 386
387 .section .data 387 .section .data
388 .balign L1_CACHE_LINE_SIZE 388 .balign L1_CACHE_LINE_SIZE
diff --git a/arch/ppc/platforms/pmac_time.c b/arch/ppc/platforms/pmac_time.c
index de60ccc7db9f..778ce4fec368 100644
--- a/arch/ppc/platforms/pmac_time.c
+++ b/arch/ppc/platforms/pmac_time.c
@@ -206,7 +206,7 @@ via_calibrate_decr(void)
206 return 1; 206 return 1;
207} 207}
208 208
209#ifdef CONFIG_PMAC_PBOOK 209#ifdef CONFIG_PM
210/* 210/*
211 * Reset the time after a sleep. 211 * Reset the time after a sleep.
212 */ 212 */
@@ -238,7 +238,7 @@ time_sleep_notify(struct pmu_sleep_notifier *self, int when)
238static struct pmu_sleep_notifier time_sleep_notifier __pmacdata = { 238static struct pmu_sleep_notifier time_sleep_notifier __pmacdata = {
239 time_sleep_notify, SLEEP_LEVEL_MISC, 239 time_sleep_notify, SLEEP_LEVEL_MISC,
240}; 240};
241#endif /* CONFIG_PMAC_PBOOK */ 241#endif /* CONFIG_PM */
242 242
243/* 243/*
244 * Query the OF and get the decr frequency. 244 * Query the OF and get the decr frequency.
@@ -251,9 +251,9 @@ pmac_calibrate_decr(void)
251 struct device_node *cpu; 251 struct device_node *cpu;
252 unsigned int freq, *fp; 252 unsigned int freq, *fp;
253 253
254#ifdef CONFIG_PMAC_PBOOK 254#ifdef CONFIG_PM
255 pmu_register_sleep_notifier(&time_sleep_notifier); 255 pmu_register_sleep_notifier(&time_sleep_notifier);
256#endif /* CONFIG_PMAC_PBOOK */ 256#endif /* CONFIG_PM */
257 257
258 /* We assume MacRISC2 machines have correct device-tree 258 /* We assume MacRISC2 machines have correct device-tree
259 * calibration. That's better since the VIA itself seems 259 * calibration. That's better since the VIA itself seems
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 5b09cf154ac7..e5f7494c00ee 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -253,7 +253,7 @@ static int floppy_revalidate(struct gendisk *disk);
253static int swim3_add_device(struct device_node *swims); 253static int swim3_add_device(struct device_node *swims);
254int swim3_init(void); 254int swim3_init(void);
255 255
256#ifndef CONFIG_PMAC_PBOOK 256#ifndef CONFIG_PMAC_MEDIABAY
257#define check_media_bay(which, what) 1 257#define check_media_bay(which, what) 1
258#endif 258#endif
259 259
@@ -297,9 +297,11 @@ static void do_fd_request(request_queue_t * q)
297 int i; 297 int i;
298 for(i=0;i<floppy_count;i++) 298 for(i=0;i<floppy_count;i++)
299 { 299 {
300#ifdef CONFIG_PMAC_MEDIABAY
300 if (floppy_states[i].media_bay && 301 if (floppy_states[i].media_bay &&
301 check_media_bay(floppy_states[i].media_bay, MB_FD)) 302 check_media_bay(floppy_states[i].media_bay, MB_FD))
302 continue; 303 continue;
304#endif /* CONFIG_PMAC_MEDIABAY */
303 start_request(&floppy_states[i]); 305 start_request(&floppy_states[i]);
304 } 306 }
305 sti(); 307 sti();
@@ -856,8 +858,10 @@ static int floppy_ioctl(struct inode *inode, struct file *filp,
856 if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN)) 858 if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
857 return -EPERM; 859 return -EPERM;
858 860
861#ifdef CONFIG_PMAC_MEDIABAY
859 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD)) 862 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
860 return -ENXIO; 863 return -ENXIO;
864#endif
861 865
862 switch (cmd) { 866 switch (cmd) {
863 case FDEJECT: 867 case FDEJECT:
@@ -881,8 +885,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
881 int n, err = 0; 885 int n, err = 0;
882 886
883 if (fs->ref_count == 0) { 887 if (fs->ref_count == 0) {
888#ifdef CONFIG_PMAC_MEDIABAY
884 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD)) 889 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
885 return -ENXIO; 890 return -ENXIO;
891#endif
886 out_8(&sw->setup, S_IBM_DRIVE | S_FCLK_DIV2); 892 out_8(&sw->setup, S_IBM_DRIVE | S_FCLK_DIV2);
887 out_8(&sw->control_bic, 0xff); 893 out_8(&sw->control_bic, 0xff);
888 out_8(&sw->mode, 0x95); 894 out_8(&sw->mode, 0x95);
@@ -967,8 +973,10 @@ static int floppy_revalidate(struct gendisk *disk)
967 struct swim3 __iomem *sw; 973 struct swim3 __iomem *sw;
968 int ret, n; 974 int ret, n;
969 975
976#ifdef CONFIG_PMAC_MEDIABAY
970 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD)) 977 if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
971 return -ENXIO; 978 return -ENXIO;
979#endif
972 980
973 sw = fs->swim3; 981 sw = fs->swim3;
974 grab_drive(fs, revalidating, 0); 982 grab_drive(fs, revalidating, 0);
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 31cf84d69026..931efd58f87a 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -309,9 +309,6 @@ static int __init misc_init(void)
309#ifdef CONFIG_BVME6000 309#ifdef CONFIG_BVME6000
310 rtc_DP8570A_init(); 310 rtc_DP8570A_init();
311#endif 311#endif
312#ifdef CONFIG_PMAC_PBOOK
313 pmu_device_init();
314#endif
315 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) { 312 if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
316 printk("unable to get major %d for misc devices\n", 313 printk("unable to get major %d for misc devices\n",
317 MISC_MAJOR); 314 MISC_MAJOR);
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 569f16767442..818380b5fd27 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1324,9 +1324,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1324 /* XXX FIXME: Media bay stuff need re-organizing */ 1324 /* XXX FIXME: Media bay stuff need re-organizing */
1325 if (np->parent && np->parent->name 1325 if (np->parent && np->parent->name
1326 && strcasecmp(np->parent->name, "media-bay") == 0) { 1326 && strcasecmp(np->parent->name, "media-bay") == 0) {
1327#ifdef CONFIG_PMAC_PBOOK 1327#ifdef CONFIG_PMAC_MEDIABAY
1328 media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index); 1328 media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
1329#endif /* CONFIG_PMAC_PBOOK */ 1329#endif /* CONFIG_PMAC_MEDIABAY */
1330 pmif->mediabay = 1; 1330 pmif->mediabay = 1;
1331 if (!bidp) 1331 if (!bidp)
1332 pmif->aapl_bus_id = 1; 1332 pmif->aapl_bus_id = 1;
@@ -1382,10 +1382,10 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1382 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id, 1382 hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
1383 pmif->mediabay ? " (mediabay)" : "", hwif->irq); 1383 pmif->mediabay ? " (mediabay)" : "", hwif->irq);
1384 1384
1385#ifdef CONFIG_PMAC_PBOOK 1385#ifdef CONFIG_PMAC_MEDIABAY
1386 if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0) 1386 if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)
1387 hwif->noprobe = 0; 1387 hwif->noprobe = 0;
1388#endif /* CONFIG_PMAC_PBOOK */ 1388#endif /* CONFIG_PMAC_MEDIABAY */
1389 1389
1390 hwif->sg_max_nents = MAX_DCMDS; 1390 hwif->sg_max_nents = MAX_DCMDS;
1391 1391
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 36e25ac823dc..b3d3d22fde64 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -3538,8 +3538,8 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
3538 3538
3539static int ohci1394_pci_resume (struct pci_dev *pdev) 3539static int ohci1394_pci_resume (struct pci_dev *pdev)
3540{ 3540{
3541#ifdef CONFIG_PMAC_PBOOK 3541#ifdef CONFIG_PPC_PMAC
3542 { 3542 if (_machine == _MACH_Pmac) {
3543 struct device_node *of_node; 3543 struct device_node *of_node;
3544 3544
3545 /* Re-enable 1394 */ 3545 /* Re-enable 1394 */
@@ -3547,7 +3547,7 @@ static int ohci1394_pci_resume (struct pci_dev *pdev)
3547 if (of_node) 3547 if (of_node)
3548 pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1); 3548 pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1);
3549 } 3549 }
3550#endif 3550#endif /* CONFIG_PPC_PMAC */
3551 3551
3552 pci_enable_device(pdev); 3552 pci_enable_device(pdev);
3553 3553
@@ -3557,8 +3557,8 @@ static int ohci1394_pci_resume (struct pci_dev *pdev)
3557 3557
3558static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state) 3558static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
3559{ 3559{
3560#ifdef CONFIG_PMAC_PBOOK 3560#ifdef CONFIG_PPC_PMAC
3561 { 3561 if (_machine == _MACH_Pmac) {
3562 struct device_node *of_node; 3562 struct device_node *of_node;
3563 3563
3564 /* Disable 1394 */ 3564 /* Disable 1394 */
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index b0ace5bc950c..91691a6c004e 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -86,33 +86,18 @@ config PMAC_SMU
86 on the "SMU" system control chip which replaces the old PMU. 86 on the "SMU" system control chip which replaces the old PMU.
87 If you don't know, say Y. 87 If you don't know, say Y.
88 88
89config PMAC_PBOOK
90 bool "Power management support for PowerBooks"
91 depends on ADB_PMU
92 ---help---
93 This provides support for putting a PowerBook to sleep; it also
94 enables media bay support. Power management works on the
95 PB2400/3400/3500, Wallstreet, Lombard, and Bronze PowerBook G3 and
96 the Titanium Powerbook G4, as well as the iBooks. You should get
97 the power management daemon, pmud, to make it work and you must have
98 the /dev/pmu device (see the pmud README).
99
100 Get pmud from <ftp://ftp.samba.org/pub/ppclinux/pmud/>.
101
102 If you have a PowerBook, you should say Y here.
103
104 You may also want to compile the dma sound driver as a module and
105 have it autoloaded. The act of removing the module shuts down the
106 sound hardware for more power savings.
107
108config PM
109 bool
110 depends on PPC_PMAC && ADB_PMU && PMAC_PBOOK
111 default y
112
113config PMAC_APM_EMU 89config PMAC_APM_EMU
114 tristate "APM emulation" 90 tristate "APM emulation"
115 depends on PMAC_PBOOK 91 depends on PPC_PMAC && PPC32 && PM
92
93config PMAC_MEDIABAY
94 bool "Support PowerBook hotswap media bay"
95 depends on PPC_PMAC && PPC32
96 help
97 This option adds support for older PowerBook's hotswap media bay
98 that can contains batteries, floppy drives, or IDE devices. PCI
99 devices are not fully supported in the bay as I never had one to
100 try with
116 101
117# made a separate option since backlight may end up beeing used 102# made a separate option since backlight may end up beeing used
118# on non-powerbook machines (but only on PMU based ones AFAIK) 103# on non-powerbook machines (but only on PMU based ones AFAIK)
diff --git a/drivers/macintosh/Makefile b/drivers/macintosh/Makefile
index b3f88a4fcef7..f5ae171dbfef 100644
--- a/drivers/macintosh/Makefile
+++ b/drivers/macintosh/Makefile
@@ -6,7 +6,7 @@
6 6
7obj-$(CONFIG_PPC_PMAC) += macio_asic.o 7obj-$(CONFIG_PPC_PMAC) += macio_asic.o
8 8
9obj-$(CONFIG_PMAC_PBOOK) += mediabay.o 9obj-$(CONFIG_PMAC_MEDIABAY) += mediabay.o
10obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o 10obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o
11obj-$(CONFIG_INPUT_ADBHID) += adbhid.o 11obj-$(CONFIG_INPUT_ADBHID) += adbhid.o
12obj-$(CONFIG_ANSLCD) += ans-lcd.o 12obj-$(CONFIG_ANSLCD) += ans-lcd.o
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 493e2afa191c..c0dc1e3fa58b 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -90,7 +90,7 @@ static int sleepy_trackpad;
90static int autopoll_devs; 90static int autopoll_devs;
91int __adb_probe_sync; 91int __adb_probe_sync;
92 92
93#ifdef CONFIG_PMAC_PBOOK 93#ifdef CONFIG_PM
94static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when); 94static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
95static struct pmu_sleep_notifier adb_sleep_notifier = { 95static struct pmu_sleep_notifier adb_sleep_notifier = {
96 adb_notify_sleep, 96 adb_notify_sleep,
@@ -320,9 +320,9 @@ int __init adb_init(void)
320 printk(KERN_WARNING "Warning: no ADB interface detected\n"); 320 printk(KERN_WARNING "Warning: no ADB interface detected\n");
321 adb_controller = NULL; 321 adb_controller = NULL;
322 } else { 322 } else {
323#ifdef CONFIG_PMAC_PBOOK 323#ifdef CONFIG_PM
324 pmu_register_sleep_notifier(&adb_sleep_notifier); 324 pmu_register_sleep_notifier(&adb_sleep_notifier);
325#endif /* CONFIG_PMAC_PBOOK */ 325#endif /* CONFIG_PM */
326#ifdef CONFIG_PPC 326#ifdef CONFIG_PPC
327 if (machine_is_compatible("AAPL,PowerBook1998") || 327 if (machine_is_compatible("AAPL,PowerBook1998") ||
328 machine_is_compatible("PowerBook1,1")) 328 machine_is_compatible("PowerBook1,1"))
@@ -337,7 +337,7 @@ int __init adb_init(void)
337 337
338__initcall(adb_init); 338__initcall(adb_init);
339 339
340#ifdef CONFIG_PMAC_PBOOK 340#ifdef CONFIG_PM
341/* 341/*
342 * notify clients before sleep and reset bus afterwards 342 * notify clients before sleep and reset bus afterwards
343 */ 343 */
@@ -378,7 +378,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
378 } 378 }
379 return PBOOK_SLEEP_OK; 379 return PBOOK_SLEEP_OK;
380} 380}
381#endif /* CONFIG_PMAC_PBOOK */ 381#endif /* CONFIG_PM */
382 382
383static int 383static int
384do_adb_reset_bus(void) 384do_adb_reset_bus(void)
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 5375df03c6f3..4a0a0ad2d03c 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -155,10 +155,10 @@ static spinlock_t pmu_lock;
155static u8 pmu_intr_mask; 155static u8 pmu_intr_mask;
156static int pmu_version; 156static int pmu_version;
157static int drop_interrupts; 157static int drop_interrupts;
158#ifdef CONFIG_PMAC_PBOOK 158#ifdef CONFIG_PM
159static int option_lid_wakeup = 1; 159static int option_lid_wakeup = 1;
160static int sleep_in_progress; 160static int sleep_in_progress;
161#endif /* CONFIG_PMAC_PBOOK */ 161#endif /* CONFIG_PM */
162static unsigned long async_req_locks; 162static unsigned long async_req_locks;
163static unsigned int pmu_irq_stats[11]; 163static unsigned int pmu_irq_stats[11];
164 164
@@ -168,7 +168,6 @@ static struct proc_dir_entry *proc_pmu_irqstats;
168static struct proc_dir_entry *proc_pmu_options; 168static struct proc_dir_entry *proc_pmu_options;
169static int option_server_mode; 169static int option_server_mode;
170 170
171#ifdef CONFIG_PMAC_PBOOK
172int pmu_battery_count; 171int pmu_battery_count;
173int pmu_cur_battery; 172int pmu_cur_battery;
174unsigned int pmu_power_flags; 173unsigned int pmu_power_flags;
@@ -176,7 +175,6 @@ struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
176static int query_batt_timer = BATTERY_POLLING_COUNT; 175static int query_batt_timer = BATTERY_POLLING_COUNT;
177static struct adb_request batt_req; 176static struct adb_request batt_req;
178static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES]; 177static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES];
179#endif /* CONFIG_PMAC_PBOOK */
180 178
181#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) 179#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
182extern int disable_kernel_backlight; 180extern int disable_kernel_backlight;
@@ -210,11 +208,9 @@ static int proc_get_irqstats(char *page, char **start, off_t off,
210static int pmu_set_backlight_level(int level, void* data); 208static int pmu_set_backlight_level(int level, void* data);
211static int pmu_set_backlight_enable(int on, int level, void* data); 209static int pmu_set_backlight_enable(int on, int level, void* data);
212#endif /* CONFIG_PMAC_BACKLIGHT */ 210#endif /* CONFIG_PMAC_BACKLIGHT */
213#ifdef CONFIG_PMAC_PBOOK
214static void pmu_pass_intr(unsigned char *data, int len); 211static void pmu_pass_intr(unsigned char *data, int len);
215static int proc_get_batt(char *page, char **start, off_t off, 212static int proc_get_batt(char *page, char **start, off_t off,
216 int count, int *eof, void *data); 213 int count, int *eof, void *data);
217#endif /* CONFIG_PMAC_PBOOK */
218static int proc_read_options(char *page, char **start, off_t off, 214static int proc_read_options(char *page, char **start, off_t off,
219 int count, int *eof, void *data); 215 int count, int *eof, void *data);
220static int proc_write_options(struct file *file, const char __user *buffer, 216static int proc_write_options(struct file *file, const char __user *buffer,
@@ -407,9 +403,7 @@ static int __init via_pmu_start(void)
407 403
408 bright_req_1.complete = 1; 404 bright_req_1.complete = 1;
409 bright_req_2.complete = 1; 405 bright_req_2.complete = 1;
410#ifdef CONFIG_PMAC_PBOOK
411 batt_req.complete = 1; 406 batt_req.complete = 1;
412#endif
413 407
414#ifdef CONFIG_PPC32 408#ifdef CONFIG_PPC32
415 if (pmu_kind == PMU_KEYLARGO_BASED) 409 if (pmu_kind == PMU_KEYLARGO_BASED)
@@ -468,7 +462,7 @@ static int __init via_pmu_dev_init(void)
468 register_backlight_controller(&pmu_backlight_controller, NULL, "pmu"); 462 register_backlight_controller(&pmu_backlight_controller, NULL, "pmu");
469#endif /* CONFIG_PMAC_BACKLIGHT */ 463#endif /* CONFIG_PMAC_BACKLIGHT */
470 464
471#ifdef CONFIG_PMAC_PBOOK 465#ifdef CONFIG_PPC32
472 if (machine_is_compatible("AAPL,3400/2400") || 466 if (machine_is_compatible("AAPL,3400/2400") ||
473 machine_is_compatible("AAPL,3500")) { 467 machine_is_compatible("AAPL,3500")) {
474 int mb = pmac_call_feature(PMAC_FTR_GET_MB_INFO, 468 int mb = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
@@ -496,20 +490,19 @@ static int __init via_pmu_dev_init(void)
496 pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; 490 pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART;
497 } 491 }
498 } 492 }
499#endif /* CONFIG_PMAC_PBOOK */ 493#endif /* CONFIG_PPC32 */
494
500 /* Create /proc/pmu */ 495 /* Create /proc/pmu */
501 proc_pmu_root = proc_mkdir("pmu", NULL); 496 proc_pmu_root = proc_mkdir("pmu", NULL);
502 if (proc_pmu_root) { 497 if (proc_pmu_root) {
503#ifdef CONFIG_PMAC_PBOOK 498 long i;
504 int i;
505 499
506 for (i=0; i<pmu_battery_count; i++) { 500 for (i=0; i<pmu_battery_count; i++) {
507 char title[16]; 501 char title[16];
508 sprintf(title, "battery_%d", i); 502 sprintf(title, "battery_%ld", i);
509 proc_pmu_batt[i] = create_proc_read_entry(title, 0, proc_pmu_root, 503 proc_pmu_batt[i] = create_proc_read_entry(title, 0, proc_pmu_root,
510 proc_get_batt, (void *)i); 504 proc_get_batt, (void *)i);
511 } 505 }
512#endif /* CONFIG_PMAC_PBOOK */
513 506
514 proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root, 507 proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root,
515 proc_get_info, NULL); 508 proc_get_info, NULL);
@@ -629,8 +622,6 @@ static void pmu_set_server_mode(int server_mode)
629 pmu_wait_complete(&req); 622 pmu_wait_complete(&req);
630} 623}
631 624
632#ifdef CONFIG_PMAC_PBOOK
633
634/* This new version of the code for 2400/3400/3500 powerbooks 625/* This new version of the code for 2400/3400/3500 powerbooks
635 * is inspired from the implementation in gkrellm-pmu 626 * is inspired from the implementation in gkrellm-pmu
636 */ 627 */
@@ -813,8 +804,6 @@ query_battery_state(void)
813 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1); 804 2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1);
814} 805}
815 806
816#endif /* CONFIG_PMAC_PBOOK */
817
818static int __pmac 807static int __pmac
819proc_get_info(char *page, char **start, off_t off, 808proc_get_info(char *page, char **start, off_t off,
820 int count, int *eof, void *data) 809 int count, int *eof, void *data)
@@ -823,11 +812,9 @@ proc_get_info(char *page, char **start, off_t off,
823 812
824 p += sprintf(p, "PMU driver version : %d\n", PMU_DRIVER_VERSION); 813 p += sprintf(p, "PMU driver version : %d\n", PMU_DRIVER_VERSION);
825 p += sprintf(p, "PMU firmware version : %02x\n", pmu_version); 814 p += sprintf(p, "PMU firmware version : %02x\n", pmu_version);
826#ifdef CONFIG_PMAC_PBOOK
827 p += sprintf(p, "AC Power : %d\n", 815 p += sprintf(p, "AC Power : %d\n",
828 ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0)); 816 ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0));
829 p += sprintf(p, "Battery count : %d\n", pmu_battery_count); 817 p += sprintf(p, "Battery count : %d\n", pmu_battery_count);
830#endif /* CONFIG_PMAC_PBOOK */
831 818
832 return p - page; 819 return p - page;
833} 820}
@@ -859,12 +846,11 @@ proc_get_irqstats(char *page, char **start, off_t off,
859 return p - page; 846 return p - page;
860} 847}
861 848
862#ifdef CONFIG_PMAC_PBOOK
863static int __pmac 849static int __pmac
864proc_get_batt(char *page, char **start, off_t off, 850proc_get_batt(char *page, char **start, off_t off,
865 int count, int *eof, void *data) 851 int count, int *eof, void *data)
866{ 852{
867 int batnum = (int)data; 853 long batnum = (long)data;
868 char *p = page; 854 char *p = page;
869 855
870 p += sprintf(p, "\n"); 856 p += sprintf(p, "\n");
@@ -883,7 +869,6 @@ proc_get_batt(char *page, char **start, off_t off,
883 869
884 return p - page; 870 return p - page;
885} 871}
886#endif /* CONFIG_PMAC_PBOOK */
887 872
888static int __pmac 873static int __pmac
889proc_read_options(char *page, char **start, off_t off, 874proc_read_options(char *page, char **start, off_t off,
@@ -891,11 +876,11 @@ proc_read_options(char *page, char **start, off_t off,
891{ 876{
892 char *p = page; 877 char *p = page;
893 878
894#ifdef CONFIG_PMAC_PBOOK 879#ifdef CONFIG_PM
895 if (pmu_kind == PMU_KEYLARGO_BASED && 880 if (pmu_kind == PMU_KEYLARGO_BASED &&
896 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) 881 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
897 p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); 882 p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
898#endif /* CONFIG_PMAC_PBOOK */ 883#endif
899 if (pmu_kind == PMU_KEYLARGO_BASED) 884 if (pmu_kind == PMU_KEYLARGO_BASED)
900 p += sprintf(p, "server_mode=%d\n", option_server_mode); 885 p += sprintf(p, "server_mode=%d\n", option_server_mode);
901 886
@@ -932,12 +917,12 @@ proc_write_options(struct file *file, const char __user *buffer,
932 *(val++) = 0; 917 *(val++) = 0;
933 while(*val == ' ') 918 while(*val == ' ')
934 val++; 919 val++;
935#ifdef CONFIG_PMAC_PBOOK 920#ifdef CONFIG_PM
936 if (pmu_kind == PMU_KEYLARGO_BASED && 921 if (pmu_kind == PMU_KEYLARGO_BASED &&
937 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) 922 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
938 if (!strcmp(label, "lid_wakeup")) 923 if (!strcmp(label, "lid_wakeup"))
939 option_lid_wakeup = ((*val) == '1'); 924 option_lid_wakeup = ((*val) == '1');
940#endif /* CONFIG_PMAC_PBOOK */ 925#endif
941 if (pmu_kind == PMU_KEYLARGO_BASED && !strcmp(label, "server_mode")) { 926 if (pmu_kind == PMU_KEYLARGO_BASED && !strcmp(label, "server_mode")) {
942 int new_value; 927 int new_value;
943 new_value = ((*val) == '1'); 928 new_value = ((*val) == '1');
@@ -1432,7 +1417,6 @@ next:
1432 } 1417 }
1433 /* Tick interrupt */ 1418 /* Tick interrupt */
1434 else if ((1 << pirq) & PMU_INT_TICK) { 1419 else if ((1 << pirq) & PMU_INT_TICK) {
1435#ifdef CONFIG_PMAC_PBOOK
1436 /* Environement or tick interrupt, query batteries */ 1420 /* Environement or tick interrupt, query batteries */
1437 if (pmu_battery_count) { 1421 if (pmu_battery_count) {
1438 if ((--query_batt_timer) == 0) { 1422 if ((--query_batt_timer) == 0) {
@@ -1447,7 +1431,6 @@ next:
1447 pmu_pass_intr(data, len); 1431 pmu_pass_intr(data, len);
1448 } else { 1432 } else {
1449 pmu_pass_intr(data, len); 1433 pmu_pass_intr(data, len);
1450#endif /* CONFIG_PMAC_PBOOK */
1451 } 1434 }
1452 goto next; 1435 goto next;
1453} 1436}
@@ -2062,7 +2045,7 @@ pmu_i2c_simple_write(int bus, int addr, u8* data, int len)
2062 return -1; 2045 return -1;
2063} 2046}
2064 2047
2065#ifdef CONFIG_PMAC_PBOOK 2048#ifdef CONFIG_PM
2066 2049
2067static LIST_HEAD(sleep_notifiers); 2050static LIST_HEAD(sleep_notifiers);
2068 2051
@@ -2715,6 +2698,8 @@ powerbook_sleep_3400(void)
2715 return 0; 2698 return 0;
2716} 2699}
2717 2700
2701#endif /* CONFIG_PM */
2702
2718/* 2703/*
2719 * Support for /dev/pmu device 2704 * Support for /dev/pmu device
2720 */ 2705 */
@@ -2894,11 +2879,11 @@ static int __pmac
2894pmu_ioctl(struct inode * inode, struct file *filp, 2879pmu_ioctl(struct inode * inode, struct file *filp,
2895 u_int cmd, u_long arg) 2880 u_int cmd, u_long arg)
2896{ 2881{
2897 struct pmu_private *pp = filp->private_data;
2898 __u32 __user *argp = (__u32 __user *)arg; 2882 __u32 __user *argp = (__u32 __user *)arg;
2899 int error; 2883 int error = -EINVAL;
2900 2884
2901 switch (cmd) { 2885 switch (cmd) {
2886#ifdef CONFIG_PM
2902 case PMU_IOC_SLEEP: 2887 case PMU_IOC_SLEEP:
2903 if (!capable(CAP_SYS_ADMIN)) 2888 if (!capable(CAP_SYS_ADMIN))
2904 return -EACCES; 2889 return -EACCES;
@@ -2920,12 +2905,13 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2920 error = -ENOSYS; 2905 error = -ENOSYS;
2921 } 2906 }
2922 sleep_in_progress = 0; 2907 sleep_in_progress = 0;
2923 return error; 2908 break;
2924 case PMU_IOC_CAN_SLEEP: 2909 case PMU_IOC_CAN_SLEEP:
2925 if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) 2910 if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0)
2926 return put_user(0, argp); 2911 return put_user(0, argp);
2927 else 2912 else
2928 return put_user(1, argp); 2913 return put_user(1, argp);
2914#endif /* CONFIG_PM */
2929 2915
2930#ifdef CONFIG_PMAC_BACKLIGHT 2916#ifdef CONFIG_PMAC_BACKLIGHT
2931 /* Backlight should have its own device or go via 2917 /* Backlight should have its own device or go via
@@ -2946,11 +2932,13 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2946 error = get_user(value, argp); 2932 error = get_user(value, argp);
2947 if (!error) 2933 if (!error)
2948 error = set_backlight_level(value); 2934 error = set_backlight_level(value);
2949 return error; 2935 break;
2950 } 2936 }
2951#ifdef CONFIG_INPUT_ADBHID 2937#ifdef CONFIG_INPUT_ADBHID
2952 case PMU_IOC_GRAB_BACKLIGHT: { 2938 case PMU_IOC_GRAB_BACKLIGHT: {
2939 struct pmu_private *pp = filp->private_data;
2953 unsigned long flags; 2940 unsigned long flags;
2941
2954 if (pp->backlight_locker) 2942 if (pp->backlight_locker)
2955 return 0; 2943 return 0;
2956 pp->backlight_locker = 1; 2944 pp->backlight_locker = 1;
@@ -2966,7 +2954,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2966 case PMU_IOC_HAS_ADB: 2954 case PMU_IOC_HAS_ADB:
2967 return put_user(pmu_has_adb, argp); 2955 return put_user(pmu_has_adb, argp);
2968 } 2956 }
2969 return -EINVAL; 2957 return error;
2970} 2958}
2971 2959
2972static struct file_operations pmu_device_fops __pmacdata = { 2960static struct file_operations pmu_device_fops __pmacdata = {
@@ -2982,14 +2970,16 @@ static struct miscdevice pmu_device __pmacdata = {
2982 PMU_MINOR, "pmu", &pmu_device_fops 2970 PMU_MINOR, "pmu", &pmu_device_fops
2983}; 2971};
2984 2972
2985void pmu_device_init(void) 2973static int pmu_device_init(void)
2986{ 2974{
2987 if (!via) 2975 if (!via)
2988 return; 2976 return 0;
2989 if (misc_register(&pmu_device) < 0) 2977 if (misc_register(&pmu_device) < 0)
2990 printk(KERN_ERR "via-pmu: cannot register misc device.\n"); 2978 printk(KERN_ERR "via-pmu: cannot register misc device.\n");
2979 return 0;
2991} 2980}
2992#endif /* CONFIG_PMAC_PBOOK */ 2981device_initcall(pmu_device_init);
2982
2993 2983
2994#ifdef DEBUG_SLEEP 2984#ifdef DEBUG_SLEEP
2995static inline void __pmac 2985static inline void __pmac
@@ -3157,12 +3147,12 @@ EXPORT_SYMBOL(pmu_i2c_combined_read);
3157EXPORT_SYMBOL(pmu_i2c_stdsub_write); 3147EXPORT_SYMBOL(pmu_i2c_stdsub_write);
3158EXPORT_SYMBOL(pmu_i2c_simple_read); 3148EXPORT_SYMBOL(pmu_i2c_simple_read);
3159EXPORT_SYMBOL(pmu_i2c_simple_write); 3149EXPORT_SYMBOL(pmu_i2c_simple_write);
3160#ifdef CONFIG_PMAC_PBOOK 3150#ifdef CONFIG_PM
3161EXPORT_SYMBOL(pmu_register_sleep_notifier); 3151EXPORT_SYMBOL(pmu_register_sleep_notifier);
3162EXPORT_SYMBOL(pmu_unregister_sleep_notifier); 3152EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
3163EXPORT_SYMBOL(pmu_enable_irled); 3153EXPORT_SYMBOL(pmu_enable_irled);
3164EXPORT_SYMBOL(pmu_battery_count); 3154EXPORT_SYMBOL(pmu_battery_count);
3165EXPORT_SYMBOL(pmu_batteries); 3155EXPORT_SYMBOL(pmu_batteries);
3166EXPORT_SYMBOL(pmu_power_flags); 3156EXPORT_SYMBOL(pmu_power_flags);
3167#endif /* CONFIG_PMAC_PBOOK */ 3157#endif /* CONFIG_PM */
3168 3158
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 57fd07d00549..eede6be098d2 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -14,14 +14,11 @@
14 * This file is licenced under the GPL. 14 * This file is licenced under the GPL.
15 */ 15 */
16 16
17#ifdef CONFIG_PMAC_PBOOK 17#ifdef CONFIG_PPC_PMAC
18#include <asm/machdep.h> 18#include <asm/machdep.h>
19#include <asm/pmac_feature.h> 19#include <asm/pmac_feature.h>
20#include <asm/pci-bridge.h> 20#include <asm/pci-bridge.h>
21#include <asm/prom.h> 21#include <asm/prom.h>
22#ifndef CONFIG_PM
23# define CONFIG_PM
24#endif
25#endif 22#endif
26 23
27#ifndef CONFIG_PCI 24#ifndef CONFIG_PCI
@@ -132,7 +129,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
132 /* let things settle down a bit */ 129 /* let things settle down a bit */
133 msleep (100); 130 msleep (100);
134 131
135#ifdef CONFIG_PMAC_PBOOK 132#ifdef CONFIG_PPC_PMAC
136 if (_machine == _MACH_Pmac) { 133 if (_machine == _MACH_Pmac) {
137 struct device_node *of_node; 134 struct device_node *of_node;
138 135
@@ -141,7 +138,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
141 if (of_node) 138 if (of_node)
142 pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0); 139 pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
143 } 140 }
144#endif /* CONFIG_PMAC_PBOOK */ 141#endif /* CONFIG_PPC_PMAC */
145 return 0; 142 return 0;
146} 143}
147 144
@@ -151,7 +148,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
151 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 148 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
152 int retval = 0; 149 int retval = 0;
153 150
154#ifdef CONFIG_PMAC_PBOOK 151#ifdef CONFIG_PPC_PMAC
155 if (_machine == _MACH_Pmac) { 152 if (_machine == _MACH_Pmac) {
156 struct device_node *of_node; 153 struct device_node *of_node;
157 154
@@ -160,7 +157,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
160 if (of_node) 157 if (of_node)
161 pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1); 158 pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
162 } 159 }
163#endif /* CONFIG_PMAC_PBOOK */ 160#endif /* CONFIG_PPC_PMAC */
164 161
165 /* resume root hub */ 162 /* resume root hub */
166 if (time_before (jiffies, ohci->next_statechange)) 163 if (time_before (jiffies, ohci->next_statechange))
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 9789115980a5..7bc1d44d8814 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -350,10 +350,8 @@ static int default_vmode __initdata = VMODE_1024_768_60;
350static int default_cmode __initdata = CMODE_8; 350static int default_cmode __initdata = CMODE_8;
351#endif 351#endif
352 352
353#ifdef CONFIG_PMAC_PBOOK
354static int default_crt_on __initdata = 0; 353static int default_crt_on __initdata = 0;
355static int default_lcd_on __initdata = 1; 354static int default_lcd_on __initdata = 1;
356#endif
357 355
358#ifdef CONFIG_MTRR 356#ifdef CONFIG_MTRR
359static int mtrr = 1; 357static int mtrr = 1;
@@ -1249,7 +1247,6 @@ static int aty128_crtc_to_var(const struct aty128_crtc *crtc,
1249 return 0; 1247 return 0;
1250} 1248}
1251 1249
1252#ifdef CONFIG_PMAC_PBOOK
1253static void aty128_set_crt_enable(struct aty128fb_par *par, int on) 1250static void aty128_set_crt_enable(struct aty128fb_par *par, int on)
1254{ 1251{
1255 if (on) { 1252 if (on) {
@@ -1284,7 +1281,6 @@ static void aty128_set_lcd_enable(struct aty128fb_par *par, int on)
1284 aty_st_le32(LVDS_GEN_CNTL, reg); 1281 aty_st_le32(LVDS_GEN_CNTL, reg);
1285 } 1282 }
1286} 1283}
1287#endif /* CONFIG_PMAC_PBOOK */
1288 1284
1289static void aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par) 1285static void aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par)
1290{ 1286{
@@ -1491,12 +1487,10 @@ static int aty128fb_set_par(struct fb_info *info)
1491 info->fix.visual = par->crtc.bpp == 8 ? FB_VISUAL_PSEUDOCOLOR 1487 info->fix.visual = par->crtc.bpp == 8 ? FB_VISUAL_PSEUDOCOLOR
1492 : FB_VISUAL_DIRECTCOLOR; 1488 : FB_VISUAL_DIRECTCOLOR;
1493 1489
1494#ifdef CONFIG_PMAC_PBOOK
1495 if (par->chip_gen == rage_M3) { 1490 if (par->chip_gen == rage_M3) {
1496 aty128_set_crt_enable(par, par->crt_on); 1491 aty128_set_crt_enable(par, par->crt_on);
1497 aty128_set_lcd_enable(par, par->lcd_on); 1492 aty128_set_lcd_enable(par, par->lcd_on);
1498 } 1493 }
1499#endif
1500 if (par->accel_flags & FB_ACCELF_TEXT) 1494 if (par->accel_flags & FB_ACCELF_TEXT)
1501 aty128_init_engine(par); 1495 aty128_init_engine(par);
1502 1496
@@ -1652,7 +1646,6 @@ static int __init aty128fb_setup(char *options)
1652 return 0; 1646 return 0;
1653 1647
1654 while ((this_opt = strsep(&options, ",")) != NULL) { 1648 while ((this_opt = strsep(&options, ",")) != NULL) {
1655#ifdef CONFIG_PMAC_PBOOK
1656 if (!strncmp(this_opt, "lcd:", 4)) { 1649 if (!strncmp(this_opt, "lcd:", 4)) {
1657 default_lcd_on = simple_strtoul(this_opt+4, NULL, 0); 1650 default_lcd_on = simple_strtoul(this_opt+4, NULL, 0);
1658 continue; 1651 continue;
@@ -1660,7 +1653,6 @@ static int __init aty128fb_setup(char *options)
1660 default_crt_on = simple_strtoul(this_opt+4, NULL, 0); 1653 default_crt_on = simple_strtoul(this_opt+4, NULL, 0);
1661 continue; 1654 continue;
1662 } 1655 }
1663#endif
1664#ifdef CONFIG_MTRR 1656#ifdef CONFIG_MTRR
1665 if(!strncmp(this_opt, "nomtrr", 6)) { 1657 if(!strncmp(this_opt, "nomtrr", 6)) {
1666 mtrr = 0; 1658 mtrr = 0;
@@ -1752,10 +1744,8 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *
1752 info->fbops = &aty128fb_ops; 1744 info->fbops = &aty128fb_ops;
1753 info->flags = FBINFO_FLAG_DEFAULT; 1745 info->flags = FBINFO_FLAG_DEFAULT;
1754 1746
1755#ifdef CONFIG_PMAC_PBOOK
1756 par->lcd_on = default_lcd_on; 1747 par->lcd_on = default_lcd_on;
1757 par->crt_on = default_crt_on; 1748 par->crt_on = default_crt_on;
1758#endif
1759 1749
1760 var = default_var; 1750 var = default_var;
1761#ifdef CONFIG_PPC_PMAC 1751#ifdef CONFIG_PPC_PMAC
@@ -2035,12 +2025,10 @@ static int aty128fb_blank(int blank, struct fb_info *fb)
2035 2025
2036 aty_st_8(CRTC_EXT_CNTL+1, state); 2026 aty_st_8(CRTC_EXT_CNTL+1, state);
2037 2027
2038#ifdef CONFIG_PMAC_PBOOK
2039 if (par->chip_gen == rage_M3) { 2028 if (par->chip_gen == rage_M3) {
2040 aty128_set_crt_enable(par, par->crt_on && !blank); 2029 aty128_set_crt_enable(par, par->crt_on && !blank);
2041 aty128_set_lcd_enable(par, par->lcd_on && !blank); 2030 aty128_set_lcd_enable(par, par->lcd_on && !blank);
2042 } 2031 }
2043#endif
2044#ifdef CONFIG_PMAC_BACKLIGHT 2032#ifdef CONFIG_PMAC_BACKLIGHT
2045 if ((_machine == _MACH_Pmac) && !blank) 2033 if ((_machine == _MACH_Pmac) && !blank)
2046 set_backlight_enable(1); 2034 set_backlight_enable(1);
@@ -2124,7 +2112,6 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2124static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, 2112static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
2125 u_long arg, struct fb_info *info) 2113 u_long arg, struct fb_info *info)
2126{ 2114{
2127#ifdef CONFIG_PMAC_PBOOK
2128 struct aty128fb_par *par = info->par; 2115 struct aty128fb_par *par = info->par;
2129 u32 value; 2116 u32 value;
2130 int rc; 2117 int rc;
@@ -2149,7 +2136,6 @@ static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
2149 value = (par->crt_on << 1) | par->lcd_on; 2136 value = (par->crt_on << 1) | par->lcd_on;
2150 return put_user(value, (__u32 __user *)arg); 2137 return put_user(value, (__u32 __user *)arg);
2151 } 2138 }
2152#endif
2153 return -EINVAL; 2139 return -EINVAL;
2154} 2140}
2155 2141
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index 95e72550d43f..e75a965ec760 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -28,22 +28,17 @@
28#include <linux/fb.h> 28#include <linux/fb.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/console.h>
31#include <asm/io.h> 32#include <asm/io.h>
32 33
33#ifdef CONFIG_PMAC_BACKLIGHT 34#ifdef CONFIG_PMAC_BACKLIGHT
34#include <asm/backlight.h> 35#include <asm/backlight.h>
35#endif 36#endif
36#ifdef CONFIG_PMAC_PBOOK
37#include <linux/adb.h>
38#include <linux/pmu.h>
39#endif
40 37
41/* 38/*
42 * Since we access the display with inb/outb to fixed port numbers, 39 * Since we access the display with inb/outb to fixed port numbers,
43 * we can only handle one 6555x chip. -- paulus 40 * we can only handle one 6555x chip. -- paulus
44 */ 41 */
45static struct fb_info chipsfb_info;
46
47#define write_ind(num, val, ap, dp) do { \ 42#define write_ind(num, val, ap, dp) do { \
48 outb((num), (ap)); outb((val), (dp)); \ 43 outb((num), (ap)); outb((val), (dp)); \
49} while (0) 44} while (0)
@@ -74,14 +69,6 @@ static struct fb_info chipsfb_info;
74 inb(0x3da); read_ind(num, var, 0x3c0, 0x3c1); \ 69 inb(0x3da); read_ind(num, var, 0x3c0, 0x3c1); \
75} while (0) 70} while (0)
76 71
77#ifdef CONFIG_PMAC_PBOOK
78static unsigned char *save_framebuffer;
79int chips_sleep_notify(struct pmu_sleep_notifier *self, int when);
80static struct pmu_sleep_notifier chips_sleep_notifier = {
81 chips_sleep_notify, SLEEP_LEVEL_VIDEO,
82};
83#endif
84
85/* 72/*
86 * Exported functions 73 * Exported functions
87 */ 74 */
@@ -356,6 +343,8 @@ static struct fb_var_screeninfo chipsfb_var __initdata = {
356 343
357static void __init init_chips(struct fb_info *p, unsigned long addr) 344static void __init init_chips(struct fb_info *p, unsigned long addr)
358{ 345{
346 memset(p->screen_base, 0, 0x100000);
347
359 p->fix = chipsfb_fix; 348 p->fix = chipsfb_fix;
360 p->fix.smem_start = addr; 349 p->fix.smem_start = addr;
361 350
@@ -366,34 +355,41 @@ static void __init init_chips(struct fb_info *p, unsigned long addr)
366 355
367 fb_alloc_cmap(&p->cmap, 256, 0); 356 fb_alloc_cmap(&p->cmap, 256, 0);
368 357
369 if (register_framebuffer(p) < 0) {
370 printk(KERN_ERR "C&T 65550 framebuffer failed to register\n");
371 return;
372 }
373
374 printk(KERN_INFO "fb%d: Chips 65550 frame buffer (%dK RAM detected)\n",
375 p->node, p->fix.smem_len / 1024);
376
377 chips_hw_init(); 358 chips_hw_init();
378} 359}
379 360
380static int __devinit 361static int __devinit
381chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) 362chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
382{ 363{
383 struct fb_info *p = &chipsfb_info; 364 struct fb_info *p;
384 unsigned long addr, size; 365 unsigned long addr, size;
385 unsigned short cmd; 366 unsigned short cmd;
367 int rc = -ENODEV;
368
369 if (pci_enable_device(dp) < 0) {
370 dev_err(&dp->dev, "Cannot enable PCI device\n");
371 goto err_out;
372 }
386 373
387 if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) 374 if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
388 return -ENODEV; 375 goto err_disable;
389 addr = pci_resource_start(dp, 0); 376 addr = pci_resource_start(dp, 0);
390 size = pci_resource_len(dp, 0); 377 size = pci_resource_len(dp, 0);
391 if (addr == 0) 378 if (addr == 0)
392 return -ENODEV; 379 goto err_disable;
393 if (p->screen_base != 0) 380
394 return -EBUSY; 381 p = framebuffer_alloc(0, &dp->dev);
395 if (!request_mem_region(addr, size, "chipsfb")) 382 if (p == NULL) {
396 return -EBUSY; 383 dev_err(&dp->dev, "Cannot allocate framebuffer structure\n");
384 rc = -ENOMEM;
385 goto err_disable;
386 }
387
388 if (pci_request_region(dp, 0, "chipsfb") != 0) {
389 dev_err(&dp->dev, "Cannot request framebuffer\n");
390 rc = -EBUSY;
391 goto err_release_fb;
392 }
397 393
398#ifdef __BIG_ENDIAN 394#ifdef __BIG_ENDIAN
399 addr += 0x800000; // Use big-endian aperture 395 addr += 0x800000; // Use big-endian aperture
@@ -411,37 +407,89 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
411 set_backlight_enable(1); 407 set_backlight_enable(1);
412#endif /* CONFIG_PMAC_BACKLIGHT */ 408#endif /* CONFIG_PMAC_BACKLIGHT */
413 409
410#ifdef CONFIG_PPC
414 p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE); 411 p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE);
412#else
413 p->screen_base = ioremap(addr, 0x200000);
414#endif
415 if (p->screen_base == NULL) { 415 if (p->screen_base == NULL) {
416 release_mem_region(addr, size); 416 dev_err(&dp->dev, "Cannot map framebuffer\n");
417 return -ENOMEM; 417 rc = -ENOMEM;
418 goto err_release_pci;
418 } 419 }
420
421 pci_set_drvdata(dp, p);
419 p->device = &dp->dev; 422 p->device = &dp->dev;
423
420 init_chips(p, addr); 424 init_chips(p, addr);
421 425
422#ifdef CONFIG_PMAC_PBOOK 426 if (register_framebuffer(p) < 0) {
423 pmu_register_sleep_notifier(&chips_sleep_notifier); 427 dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
424#endif /* CONFIG_PMAC_PBOOK */ 428 goto err_unmap;
429 }
430
431 dev_info(&dp->dev,"fb%d: Chips 65550 frame buffer"
432 " (%dK RAM detected)\n",
433 p->node, p->fix.smem_len / 1024);
425 434
426 pci_set_drvdata(dp, p);
427 return 0; 435 return 0;
436
437 err_unmap:
438 iounmap(p->screen_base);
439 err_release_pci:
440 pci_release_region(dp, 0);
441 err_release_fb:
442 framebuffer_release(p);
443 err_disable:
444 err_out:
445 return rc;
428} 446}
429 447
430static void __devexit chipsfb_remove(struct pci_dev *dp) 448static void __devexit chipsfb_remove(struct pci_dev *dp)
431{ 449{
432 struct fb_info *p = pci_get_drvdata(dp); 450 struct fb_info *p = pci_get_drvdata(dp);
433 451
434 if (p != &chipsfb_info || p->screen_base == NULL) 452 if (p->screen_base == NULL)
435 return; 453 return;
436 unregister_framebuffer(p); 454 unregister_framebuffer(p);
437 iounmap(p->screen_base); 455 iounmap(p->screen_base);
438 p->screen_base = NULL; 456 p->screen_base = NULL;
439 release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0)); 457 pci_release_region(dp, 0);
458}
459
460#ifdef CONFIG_PM
461static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
462{
463 struct fb_info *p = pci_get_drvdata(pdev);
464
465 if (state == pdev->dev.power.power_state)
466 return 0;
467 if (state != PM_SUSPEND_MEM)
468 goto done;
469
470 acquire_console_sem();
471 chipsfb_blank(1, p);
472 fb_set_suspend(p, 1);
473 release_console_sem();
474 done:
475 pdev->dev.power.power_state = state;
476 return 0;
477}
478
479static int chipsfb_pci_resume(struct pci_dev *pdev)
480{
481 struct fb_info *p = pci_get_drvdata(pdev);
440 482
441#ifdef CONFIG_PMAC_PBOOK 483 acquire_console_sem();
442 pmu_unregister_sleep_notifier(&chips_sleep_notifier); 484 fb_set_suspend(p, 0);
443#endif /* CONFIG_PMAC_PBOOK */ 485 chipsfb_blank(0, p);
486 release_console_sem();
487
488 pdev->dev.power.power_state = PMSG_ON;
489 return 0;
444} 490}
491#endif /* CONFIG_PM */
492
445 493
446static struct pci_device_id chipsfb_pci_tbl[] = { 494static struct pci_device_id chipsfb_pci_tbl[] = {
447 { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_65550, PCI_ANY_ID, PCI_ANY_ID }, 495 { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_65550, PCI_ANY_ID, PCI_ANY_ID },
@@ -455,6 +503,10 @@ static struct pci_driver chipsfb_driver = {
455 .id_table = chipsfb_pci_tbl, 503 .id_table = chipsfb_pci_tbl,
456 .probe = chipsfb_pci_init, 504 .probe = chipsfb_pci_init,
457 .remove = __devexit_p(chipsfb_remove), 505 .remove = __devexit_p(chipsfb_remove),
506#ifdef CONFIG_PM
507 .suspend = chipsfb_pci_suspend,
508 .resume = chipsfb_pci_resume,
509#endif
458}; 510};
459 511
460int __init chips_init(void) 512int __init chips_init(void)
@@ -472,48 +524,4 @@ static void __exit chipsfb_exit(void)
472 pci_unregister_driver(&chipsfb_driver); 524 pci_unregister_driver(&chipsfb_driver);
473} 525}
474 526
475#ifdef CONFIG_PMAC_PBOOK
476/*
477 * Save the contents of the frame buffer when we go to sleep,
478 * and restore it when we wake up again.
479 */
480int
481chips_sleep_notify(struct pmu_sleep_notifier *self, int when)
482{
483 struct fb_info *p = &chipsfb_info;
484 int nb = p->var.yres * p->fix.line_length;
485
486 if (p->screen_base == NULL)
487 return PBOOK_SLEEP_OK;
488
489 switch (when) {
490 case PBOOK_SLEEP_REQUEST:
491 save_framebuffer = vmalloc(nb);
492 if (save_framebuffer == NULL)
493 return PBOOK_SLEEP_REFUSE;
494 break;
495 case PBOOK_SLEEP_REJECT:
496 if (save_framebuffer) {
497 vfree(save_framebuffer);
498 save_framebuffer = NULL;
499 }
500 break;
501 case PBOOK_SLEEP_NOW:
502 chipsfb_blank(1, p);
503 if (save_framebuffer)
504 memcpy(save_framebuffer, p->screen_base, nb);
505 break;
506 case PBOOK_WAKE:
507 if (save_framebuffer) {
508 memcpy(p->screen_base, save_framebuffer, nb);
509 vfree(save_framebuffer);
510 save_framebuffer = NULL;
511 }
512 chipsfb_blank(0, p);
513 break;
514 }
515 return PBOOK_SLEEP_OK;
516}
517#endif /* CONFIG_PMAC_PBOOK */
518
519MODULE_LICENSE("GPL"); 527MODULE_LICENSE("GPL");
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 6d73eada277e..373bd3b9b330 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -166,7 +166,7 @@ extern int pmu_i2c_simple_read(int bus, int addr, u8* data, int len);
166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len); 166extern int pmu_i2c_simple_write(int bus, int addr, u8* data, int len);
167 167
168 168
169#ifdef CONFIG_PMAC_PBOOK 169#ifdef CONFIG_PM
170/* 170/*
171 * Stuff for putting the powerbook to sleep and waking it again. 171 * Stuff for putting the powerbook to sleep and waking it again.
172 * 172 *
@@ -208,6 +208,8 @@ struct pmu_sleep_notifier
208int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier); 208int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
209int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier); 209int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
210 210
211#endif /* CONFIG_PM */
212
211#define PMU_MAX_BATTERIES 2 213#define PMU_MAX_BATTERIES 2
212 214
213/* values for pmu_power_flags */ 215/* values for pmu_power_flags */
@@ -235,6 +237,4 @@ extern int pmu_battery_count;
235extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES]; 237extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
236extern unsigned int pmu_power_flags; 238extern unsigned int pmu_power_flags;
237 239
238#endif /* CONFIG_PMAC_PBOOK */
239
240#endif /* __KERNEL__ */ 240#endif /* __KERNEL__ */
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 33108661e671..2704e1598add 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -255,7 +255,7 @@ static int awacs_burgundy_read_mvolume(unsigned address);
255 255
256static volatile struct dbdma_cmd *emergency_dbdma_cmd; 256static volatile struct dbdma_cmd *emergency_dbdma_cmd;
257 257
258#ifdef CONFIG_PMAC_PBOOK 258#ifdef CONFIG_PM
259/* 259/*
260 * Stuff for restoring after a sleep. 260 * Stuff for restoring after a sleep.
261 */ 261 */
@@ -263,7 +263,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when);
263struct pmu_sleep_notifier awacs_sleep_notifier = { 263struct pmu_sleep_notifier awacs_sleep_notifier = {
264 awacs_sleep_notify, SLEEP_LEVEL_SOUND, 264 awacs_sleep_notify, SLEEP_LEVEL_SOUND,
265}; 265};
266#endif /* CONFIG_PMAC_PBOOK */ 266#endif /* CONFIG_PM */
267 267
268/* for (soft) sample rate translations */ 268/* for (soft) sample rate translations */
269int expand_bal; /* Balance factor for expanding (not volume!) */ 269int expand_bal; /* Balance factor for expanding (not volume!) */
@@ -675,7 +675,7 @@ static void PMacIrqCleanup(void)
675 kfree(awacs_rx_cmd_space); 675 kfree(awacs_rx_cmd_space);
676 kfree(beep_dbdma_cmd_space); 676 kfree(beep_dbdma_cmd_space);
677 kfree(beep_buf); 677 kfree(beep_buf);
678#ifdef CONFIG_PMAC_PBOOK 678#ifdef CONFIG_PM
679 pmu_unregister_sleep_notifier(&awacs_sleep_notifier); 679 pmu_unregister_sleep_notifier(&awacs_sleep_notifier);
680#endif 680#endif
681} 681}
@@ -1415,7 +1415,7 @@ load_awacs(void)
1415 } 1415 }
1416} 1416}
1417 1417
1418#ifdef CONFIG_PMAC_PBOOK 1418#ifdef CONFIG_PM
1419/* 1419/*
1420 * Save state when going to sleep, restore it afterwards. 1420 * Save state when going to sleep, restore it afterwards.
1421 */ 1421 */
@@ -1551,7 +1551,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
1551 } 1551 }
1552 return PBOOK_SLEEP_OK; 1552 return PBOOK_SLEEP_OK;
1553} 1553}
1554#endif /* CONFIG_PMAC_PBOOK */ 1554#endif /* CONFIG_PM */
1555 1555
1556 1556
1557/* All the burgundy functions: */ 1557/* All the burgundy functions: */
@@ -3053,9 +3053,9 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
3053 if ((res=setup_beep())) 3053 if ((res=setup_beep()))
3054 return res ; 3054 return res ;
3055 3055
3056#ifdef CONFIG_PMAC_PBOOK 3056#ifdef CONFIG_PM
3057 pmu_register_sleep_notifier(&awacs_sleep_notifier); 3057 pmu_register_sleep_notifier(&awacs_sleep_notifier);
3058#endif /* CONFIG_PMAC_PBOOK */ 3058#endif /* CONFIG_PM */
3059 3059
3060 /* Powerbooks have odd ways of enabling inputs such as 3060 /* Powerbooks have odd ways of enabling inputs such as
3061 an expansion-bay CD or sound from an internal modem 3061 an expansion-bay CD or sound from an internal modem
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index e052bd071e5b..061e52d3d771 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -90,7 +90,7 @@ snd_pmac_awacs_write_noreg(pmac_t *chip, int reg, int val)
90 snd_pmac_awacs_write(chip, val | (reg << 12)); 90 snd_pmac_awacs_write(chip, val | (reg << 12));
91} 91}
92 92
93#ifdef CONFIG_PMAC_PBOOK 93#ifdef CONFIG_PM
94/* Recalibrate chip */ 94/* Recalibrate chip */
95static void screamer_recalibrate(pmac_t *chip) 95static void screamer_recalibrate(pmac_t *chip)
96{ 96{
@@ -642,7 +642,7 @@ static void awacs_restore_all_regs(pmac_t *chip)
642 } 642 }
643} 643}
644 644
645#ifdef CONFIG_PMAC_PBOOK 645#ifdef CONFIG_PM
646static void snd_pmac_awacs_suspend(pmac_t *chip) 646static void snd_pmac_awacs_suspend(pmac_t *chip)
647{ 647{
648 snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1] 648 snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1]
@@ -676,7 +676,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip)
676 } 676 }
677#endif 677#endif
678} 678}
679#endif /* CONFIG_PMAC_PBOOK */ 679#endif /* CONFIG_PM */
680 680
681#ifdef PMAC_SUPPORT_AUTOMUTE 681#ifdef PMAC_SUPPORT_AUTOMUTE
682/* 682/*
@@ -883,7 +883,7 @@ snd_pmac_awacs_init(pmac_t *chip)
883 * set lowlevel callbacks 883 * set lowlevel callbacks
884 */ 884 */
885 chip->set_format = snd_pmac_awacs_set_format; 885 chip->set_format = snd_pmac_awacs_set_format;
886#ifdef CONFIG_PMAC_PBOOK 886#ifdef CONFIG_PM
887 chip->suspend = snd_pmac_awacs_suspend; 887 chip->suspend = snd_pmac_awacs_suspend;
888 chip->resume = snd_pmac_awacs_resume; 888 chip->resume = snd_pmac_awacs_resume;
889#endif 889#endif
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index f24a91693616..a737f298e77d 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -218,7 +218,7 @@ static snd_kcontrol_new_t daca_mixers[] = {
218}; 218};
219 219
220 220
221#ifdef CONFIG_PMAC_PBOOK 221#ifdef CONFIG_PM
222static void daca_resume(pmac_t *chip) 222static void daca_resume(pmac_t *chip)
223{ 223{
224 pmac_daca_t *mix = chip->mixer_data; 224 pmac_daca_t *mix = chip->mixer_data;
@@ -227,7 +227,7 @@ static void daca_resume(pmac_t *chip)
227 mix->amp_on ? 0x05 : 0x04); 227 mix->amp_on ? 0x05 : 0x04);
228 daca_set_volume(mix); 228 daca_set_volume(mix);
229} 229}
230#endif /* CONFIG_PMAC_PBOOK */ 230#endif /* CONFIG_PM */
231 231
232 232
233static void daca_cleanup(pmac_t *chip) 233static void daca_cleanup(pmac_t *chip)
@@ -275,7 +275,7 @@ int __init snd_pmac_daca_init(pmac_t *chip)
275 return err; 275 return err;
276 } 276 }
277 277
278#ifdef CONFIG_PMAC_PBOOK 278#ifdef CONFIG_PM
279 chip->resume = daca_resume; 279 chip->resume = daca_resume;
280#endif 280#endif
281 281
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 080ef3928465..75b8b7423036 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -36,7 +36,7 @@
36#include <asm/pci-bridge.h> 36#include <asm/pci-bridge.h>
37 37
38 38
39#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK) 39#ifdef CONFIG_PM
40static int snd_pmac_register_sleep_notifier(pmac_t *chip); 40static int snd_pmac_register_sleep_notifier(pmac_t *chip);
41static int snd_pmac_unregister_sleep_notifier(pmac_t *chip); 41static int snd_pmac_unregister_sleep_notifier(pmac_t *chip);
42static int snd_pmac_suspend(snd_card_t *card, pm_message_t state); 42static int snd_pmac_suspend(snd_card_t *card, pm_message_t state);
@@ -782,7 +782,7 @@ static int snd_pmac_free(pmac_t *chip)
782 } 782 }
783 783
784 snd_pmac_sound_feature(chip, 0); 784 snd_pmac_sound_feature(chip, 0);
785#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK) 785#ifdef CONFIG_PM
786 snd_pmac_unregister_sleep_notifier(chip); 786 snd_pmac_unregister_sleep_notifier(chip);
787#endif 787#endif
788 788
@@ -1292,7 +1292,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
1292 /* Reset dbdma channels */ 1292 /* Reset dbdma channels */
1293 snd_pmac_dbdma_reset(chip); 1293 snd_pmac_dbdma_reset(chip);
1294 1294
1295#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK) 1295#ifdef CONFIG_PM
1296 /* add sleep notifier */ 1296 /* add sleep notifier */
1297 if (! snd_pmac_register_sleep_notifier(chip)) 1297 if (! snd_pmac_register_sleep_notifier(chip))
1298 snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip); 1298 snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip);
@@ -1316,7 +1316,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
1316 * sleep notify for powerbook 1316 * sleep notify for powerbook
1317 */ 1317 */
1318 1318
1319#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK) 1319#ifdef CONFIG_PM
1320 1320
1321/* 1321/*
1322 * Save state when going to sleep, restore it afterwards. 1322 * Save state when going to sleep, restore it afterwards.
@@ -1414,4 +1414,5 @@ static int snd_pmac_unregister_sleep_notifier(pmac_t *chip)
1414 return 0; 1414 return 0;
1415} 1415}
1416 1416
1417#endif /* CONFIG_PM && CONFIG_PMAC_PBOOK */ 1417#endif /* CONFIG_PM */
1418
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h
index 0a84c05f714b..582db5220119 100644
--- a/sound/ppc/pmac.h
+++ b/sound/ppc/pmac.h
@@ -167,7 +167,7 @@ struct snd_pmac {
167 void (*set_format)(pmac_t *chip); 167 void (*set_format)(pmac_t *chip);
168 void (*update_automute)(pmac_t *chip, int do_notify); 168 void (*update_automute)(pmac_t *chip, int do_notify);
169 int (*detect_headphone)(pmac_t *chip); 169 int (*detect_headphone)(pmac_t *chip);
170#ifdef CONFIG_PMAC_PBOOK 170#ifdef CONFIG_PM
171 void (*suspend)(pmac_t *chip); 171 void (*suspend)(pmac_t *chip);
172 void (*resume)(pmac_t *chip); 172 void (*resume)(pmac_t *chip);
173#endif 173#endif
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 9332237cb6a4..36c5d5d45bb1 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -1128,7 +1128,7 @@ static void tumbler_reset_audio(pmac_t *chip)
1128 } 1128 }
1129} 1129}
1130 1130
1131#ifdef CONFIG_PMAC_PBOOK 1131#ifdef CONFIG_PM
1132/* suspend mixer */ 1132/* suspend mixer */
1133static void tumbler_suspend(pmac_t *chip) 1133static void tumbler_suspend(pmac_t *chip)
1134{ 1134{
@@ -1370,7 +1370,7 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0) 1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
1371 return err; 1371 return err;
1372 1372
1373#ifdef CONFIG_PMAC_PBOOK 1373#ifdef CONFIG_PM
1374 chip->suspend = tumbler_suspend; 1374 chip->suspend = tumbler_suspend;
1375 chip->resume = tumbler_resume; 1375 chip->resume = tumbler_resume;
1376#endif 1376#endif