diff options
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/adb.c | 174 | ||||
-rw-r--r-- | drivers/macintosh/mediabay.c | 14 | ||||
-rw-r--r-- | drivers/macintosh/therm_adt746x.c | 24 | ||||
-rw-r--r-- | drivers/macintosh/therm_pm72.c | 64 | ||||
-rw-r--r-- | drivers/macintosh/therm_windtunnel.c | 42 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu-backlight.c | 48 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu.c | 664 |
7 files changed, 365 insertions, 665 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index b7adde4324e4..7ce0ea64465c 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
36 | #include <linux/completion.h> | 36 | #include <linux/completion.h> |
37 | #include <linux/device.h> | 37 | #include <linux/device.h> |
38 | #include <linux/kthread.h> | ||
38 | 39 | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | #include <asm/semaphore.h> | 41 | #include <asm/semaphore.h> |
@@ -82,21 +83,11 @@ struct adb_driver *adb_controller; | |||
82 | BLOCKING_NOTIFIER_HEAD(adb_client_list); | 83 | BLOCKING_NOTIFIER_HEAD(adb_client_list); |
83 | static int adb_got_sleep; | 84 | static int adb_got_sleep; |
84 | static int adb_inited; | 85 | static int adb_inited; |
85 | static pid_t adb_probe_task_pid; | ||
86 | static DECLARE_MUTEX(adb_probe_mutex); | 86 | static DECLARE_MUTEX(adb_probe_mutex); |
87 | static struct completion adb_probe_task_comp; | ||
88 | static int sleepy_trackpad; | 87 | static int sleepy_trackpad; |
89 | static int autopoll_devs; | 88 | static int autopoll_devs; |
90 | int __adb_probe_sync; | 89 | int __adb_probe_sync; |
91 | 90 | ||
92 | #ifdef CONFIG_PM_SLEEP | ||
93 | static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when); | ||
94 | static struct pmu_sleep_notifier adb_sleep_notifier = { | ||
95 | adb_notify_sleep, | ||
96 | SLEEP_LEVEL_ADB, | ||
97 | }; | ||
98 | #endif | ||
99 | |||
100 | static int adb_scan_bus(void); | 91 | static int adb_scan_bus(void); |
101 | static int do_adb_reset_bus(void); | 92 | static int do_adb_reset_bus(void); |
102 | static void adbdev_init(void); | 93 | static void adbdev_init(void); |
@@ -134,16 +125,6 @@ static void printADBreply(struct adb_request *req) | |||
134 | } | 125 | } |
135 | #endif | 126 | #endif |
136 | 127 | ||
137 | |||
138 | static __inline__ void adb_wait_ms(unsigned int ms) | ||
139 | { | ||
140 | if (current->pid && adb_probe_task_pid && | ||
141 | adb_probe_task_pid == current->pid) | ||
142 | msleep(ms); | ||
143 | else | ||
144 | mdelay(ms); | ||
145 | } | ||
146 | |||
147 | static int adb_scan_bus(void) | 128 | static int adb_scan_bus(void) |
148 | { | 129 | { |
149 | int i, highFree=0, noMovement; | 130 | int i, highFree=0, noMovement; |
@@ -248,13 +229,10 @@ static int adb_scan_bus(void) | |||
248 | static int | 229 | static int |
249 | adb_probe_task(void *x) | 230 | adb_probe_task(void *x) |
250 | { | 231 | { |
251 | strcpy(current->comm, "kadbprobe"); | ||
252 | |||
253 | printk(KERN_INFO "adb: starting probe task...\n"); | 232 | printk(KERN_INFO "adb: starting probe task...\n"); |
254 | do_adb_reset_bus(); | 233 | do_adb_reset_bus(); |
255 | printk(KERN_INFO "adb: finished probe task...\n"); | 234 | printk(KERN_INFO "adb: finished probe task...\n"); |
256 | 235 | ||
257 | adb_probe_task_pid = 0; | ||
258 | up(&adb_probe_mutex); | 236 | up(&adb_probe_mutex); |
259 | 237 | ||
260 | return 0; | 238 | return 0; |
@@ -263,7 +241,7 @@ adb_probe_task(void *x) | |||
263 | static void | 241 | static void |
264 | __adb_probe_task(struct work_struct *bullshit) | 242 | __adb_probe_task(struct work_struct *bullshit) |
265 | { | 243 | { |
266 | adb_probe_task_pid = kernel_thread(adb_probe_task, NULL, SIGCHLD | CLONE_KERNEL); | 244 | kthread_run(adb_probe_task, NULL, "kadbprobe"); |
267 | } | 245 | } |
268 | 246 | ||
269 | static DECLARE_WORK(adb_reset_work, __adb_probe_task); | 247 | static DECLARE_WORK(adb_reset_work, __adb_probe_task); |
@@ -281,6 +259,36 @@ adb_reset_bus(void) | |||
281 | return 0; | 259 | return 0; |
282 | } | 260 | } |
283 | 261 | ||
262 | #ifdef CONFIG_PM | ||
263 | /* | ||
264 | * notify clients before sleep | ||
265 | */ | ||
266 | static int adb_suspend(struct platform_device *dev, pm_message_t state) | ||
267 | { | ||
268 | adb_got_sleep = 1; | ||
269 | /* We need to get a lock on the probe thread */ | ||
270 | down(&adb_probe_mutex); | ||
271 | /* Stop autopoll */ | ||
272 | if (adb_controller->autopoll) | ||
273 | adb_controller->autopoll(0); | ||
274 | blocking_notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL); | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * reset bus after sleep | ||
281 | */ | ||
282 | static int adb_resume(struct platform_device *dev) | ||
283 | { | ||
284 | adb_got_sleep = 0; | ||
285 | up(&adb_probe_mutex); | ||
286 | adb_reset_bus(); | ||
287 | |||
288 | return 0; | ||
289 | } | ||
290 | #endif /* CONFIG_PM */ | ||
291 | |||
284 | int __init adb_init(void) | 292 | int __init adb_init(void) |
285 | { | 293 | { |
286 | struct adb_driver *driver; | 294 | struct adb_driver *driver; |
@@ -313,15 +321,12 @@ int __init adb_init(void) | |||
313 | printk(KERN_WARNING "Warning: no ADB interface detected\n"); | 321 | printk(KERN_WARNING "Warning: no ADB interface detected\n"); |
314 | adb_controller = NULL; | 322 | adb_controller = NULL; |
315 | } else { | 323 | } else { |
316 | #ifdef CONFIG_PM_SLEEP | ||
317 | pmu_register_sleep_notifier(&adb_sleep_notifier); | ||
318 | #endif /* CONFIG_PM */ | ||
319 | #ifdef CONFIG_PPC | 324 | #ifdef CONFIG_PPC |
320 | if (machine_is_compatible("AAPL,PowerBook1998") || | 325 | if (machine_is_compatible("AAPL,PowerBook1998") || |
321 | machine_is_compatible("PowerBook1,1")) | 326 | machine_is_compatible("PowerBook1,1")) |
322 | sleepy_trackpad = 1; | 327 | sleepy_trackpad = 1; |
323 | #endif /* CONFIG_PPC */ | 328 | #endif /* CONFIG_PPC */ |
324 | init_completion(&adb_probe_task_comp); | 329 | |
325 | adbdev_init(); | 330 | adbdev_init(); |
326 | adb_reset_bus(); | 331 | adb_reset_bus(); |
327 | } | 332 | } |
@@ -330,33 +335,6 @@ int __init adb_init(void) | |||
330 | 335 | ||
331 | __initcall(adb_init); | 336 | __initcall(adb_init); |
332 | 337 | ||
333 | #ifdef CONFIG_PM | ||
334 | /* | ||
335 | * notify clients before sleep and reset bus afterwards | ||
336 | */ | ||
337 | void | ||
338 | adb_notify_sleep(struct pmu_sleep_notifier *self, int when) | ||
339 | { | ||
340 | switch (when) { | ||
341 | case PBOOK_SLEEP_REQUEST: | ||
342 | adb_got_sleep = 1; | ||
343 | /* We need to get a lock on the probe thread */ | ||
344 | down(&adb_probe_mutex); | ||
345 | /* Stop autopoll */ | ||
346 | if (adb_controller->autopoll) | ||
347 | adb_controller->autopoll(0); | ||
348 | blocking_notifier_call_chain(&adb_client_list, | ||
349 | ADB_MSG_POWERDOWN, NULL); | ||
350 | break; | ||
351 | case PBOOK_WAKE: | ||
352 | adb_got_sleep = 0; | ||
353 | up(&adb_probe_mutex); | ||
354 | adb_reset_bus(); | ||
355 | break; | ||
356 | } | ||
357 | } | ||
358 | #endif /* CONFIG_PM */ | ||
359 | |||
360 | static int | 338 | static int |
361 | do_adb_reset_bus(void) | 339 | do_adb_reset_bus(void) |
362 | { | 340 | { |
@@ -373,7 +351,7 @@ do_adb_reset_bus(void) | |||
373 | 351 | ||
374 | if (sleepy_trackpad) { | 352 | if (sleepy_trackpad) { |
375 | /* Let the trackpad settle down */ | 353 | /* Let the trackpad settle down */ |
376 | adb_wait_ms(500); | 354 | msleep(500); |
377 | } | 355 | } |
378 | 356 | ||
379 | down(&adb_handler_sem); | 357 | down(&adb_handler_sem); |
@@ -389,7 +367,7 @@ do_adb_reset_bus(void) | |||
389 | 367 | ||
390 | if (sleepy_trackpad) { | 368 | if (sleepy_trackpad) { |
391 | /* Let the trackpad settle down */ | 369 | /* Let the trackpad settle down */ |
392 | adb_wait_ms(1500); | 370 | msleep(1500); |
393 | } | 371 | } |
394 | 372 | ||
395 | if (!ret) { | 373 | if (!ret) { |
@@ -413,41 +391,27 @@ adb_poll(void) | |||
413 | adb_controller->poll(); | 391 | adb_controller->poll(); |
414 | } | 392 | } |
415 | 393 | ||
416 | static void | 394 | static void adb_sync_req_done(struct adb_request *req) |
417 | adb_probe_wakeup(struct adb_request *req) | ||
418 | { | 395 | { |
419 | complete(&adb_probe_task_comp); | 396 | struct completion *comp = req->arg; |
420 | } | ||
421 | 397 | ||
422 | /* Static request used during probe */ | 398 | complete(comp); |
423 | static struct adb_request adb_sreq; | 399 | } |
424 | static unsigned long adb_sreq_lock; // Use semaphore ! */ | ||
425 | 400 | ||
426 | int | 401 | int |
427 | adb_request(struct adb_request *req, void (*done)(struct adb_request *), | 402 | adb_request(struct adb_request *req, void (*done)(struct adb_request *), |
428 | int flags, int nbytes, ...) | 403 | int flags, int nbytes, ...) |
429 | { | 404 | { |
430 | va_list list; | 405 | va_list list; |
431 | int i, use_sreq; | 406 | int i; |
432 | int rc; | 407 | int rc; |
408 | struct completion comp; | ||
433 | 409 | ||
434 | if ((adb_controller == NULL) || (adb_controller->send_request == NULL)) | 410 | if ((adb_controller == NULL) || (adb_controller->send_request == NULL)) |
435 | return -ENXIO; | 411 | return -ENXIO; |
436 | if (nbytes < 1) | 412 | if (nbytes < 1) |
437 | return -EINVAL; | 413 | return -EINVAL; |
438 | if (req == NULL && (flags & ADBREQ_NOSEND)) | 414 | |
439 | return -EINVAL; | ||
440 | |||
441 | if (req == NULL) { | ||
442 | if (test_and_set_bit(0,&adb_sreq_lock)) { | ||
443 | printk("adb.c: Warning: contention on static request !\n"); | ||
444 | return -EPERM; | ||
445 | } | ||
446 | req = &adb_sreq; | ||
447 | flags |= ADBREQ_SYNC; | ||
448 | use_sreq = 1; | ||
449 | } else | ||
450 | use_sreq = 0; | ||
451 | req->nbytes = nbytes+1; | 415 | req->nbytes = nbytes+1; |
452 | req->done = done; | 416 | req->done = done; |
453 | req->reply_expected = flags & ADBREQ_REPLY; | 417 | req->reply_expected = flags & ADBREQ_REPLY; |
@@ -460,25 +424,18 @@ adb_request(struct adb_request *req, void (*done)(struct adb_request *), | |||
460 | if (flags & ADBREQ_NOSEND) | 424 | if (flags & ADBREQ_NOSEND) |
461 | return 0; | 425 | return 0; |
462 | 426 | ||
463 | /* Synchronous requests send from the probe thread cause it to | 427 | /* Synchronous requests block using an on-stack completion */ |
464 | * block. Beware that the "done" callback will be overriden ! | 428 | if (flags & ADBREQ_SYNC) { |
465 | */ | 429 | WARN_ON(done); |
466 | if ((flags & ADBREQ_SYNC) && | 430 | req->done = adb_sync_req_done; |
467 | (current->pid && adb_probe_task_pid && | 431 | req->arg = ∁ |
468 | adb_probe_task_pid == current->pid)) { | 432 | init_completion(&comp); |
469 | req->done = adb_probe_wakeup; | ||
470 | rc = adb_controller->send_request(req, 0); | ||
471 | if (rc || req->complete) | ||
472 | goto bail; | ||
473 | wait_for_completion(&adb_probe_task_comp); | ||
474 | rc = 0; | ||
475 | goto bail; | ||
476 | } | 433 | } |
477 | 434 | ||
478 | rc = adb_controller->send_request(req, flags & ADBREQ_SYNC); | 435 | rc = adb_controller->send_request(req, 0); |
479 | bail: | 436 | |
480 | if (use_sreq) | 437 | if ((flags & ADBREQ_SYNC) && !rc && !req->complete) |
481 | clear_bit(0, &adb_sreq_lock); | 438 | wait_for_completion(&comp); |
482 | 439 | ||
483 | return rc; | 440 | return rc; |
484 | } | 441 | } |
@@ -864,7 +821,29 @@ static const struct file_operations adb_fops = { | |||
864 | .release = adb_release, | 821 | .release = adb_release, |
865 | }; | 822 | }; |
866 | 823 | ||
867 | static void | 824 | static struct platform_driver adb_pfdrv = { |
825 | .driver = { | ||
826 | .name = "adb", | ||
827 | }, | ||
828 | #ifdef CONFIG_PM | ||
829 | .suspend = adb_suspend, | ||
830 | .resume = adb_resume, | ||
831 | #endif | ||
832 | }; | ||
833 | |||
834 | static struct platform_device adb_pfdev = { | ||
835 | .name = "adb", | ||
836 | }; | ||
837 | |||
838 | static int __init | ||
839 | adb_dummy_probe(struct platform_device *dev) | ||
840 | { | ||
841 | if (dev == &adb_pfdev) | ||
842 | return 0; | ||
843 | return -ENODEV; | ||
844 | } | ||
845 | |||
846 | static void __init | ||
868 | adbdev_init(void) | 847 | adbdev_init(void) |
869 | { | 848 | { |
870 | if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) { | 849 | if (register_chrdev(ADB_MAJOR, "adb", &adb_fops)) { |
@@ -876,4 +855,7 @@ adbdev_init(void) | |||
876 | if (IS_ERR(adb_dev_class)) | 855 | if (IS_ERR(adb_dev_class)) |
877 | return; | 856 | return; |
878 | device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), "adb"); | 857 | device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), "adb"); |
858 | |||
859 | platform_device_register(&adb_pfdev); | ||
860 | platform_driver_probe(&adb_pfdrv, adb_dummy_probe); | ||
879 | } | 861 | } |
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index eaba4a9b231e..18dde2a27209 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/stddef.h> | 20 | #include <linux/stddef.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/ide.h> | 22 | #include <linux/ide.h> |
23 | #include <linux/kthread.h> | ||
23 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
24 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
25 | #include <asm/io.h> | 26 | #include <asm/io.h> |
@@ -35,7 +36,6 @@ | |||
35 | 36 | ||
36 | 37 | ||
37 | #define MB_DEBUG | 38 | #define MB_DEBUG |
38 | #define MB_IGNORE_SIGNALS | ||
39 | 39 | ||
40 | #ifdef MB_DEBUG | 40 | #ifdef MB_DEBUG |
41 | #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) | 41 | #define MBDBG(fmt, arg...) printk(KERN_INFO fmt , ## arg) |
@@ -623,12 +623,7 @@ static int media_bay_task(void *x) | |||
623 | { | 623 | { |
624 | int i; | 624 | int i; |
625 | 625 | ||
626 | strcpy(current->comm, "media-bay"); | 626 | while (!kthread_should_stop()) { |
627 | #ifdef MB_IGNORE_SIGNALS | ||
628 | sigfillset(¤t->blocked); | ||
629 | #endif | ||
630 | |||
631 | for (;;) { | ||
632 | for (i = 0; i < media_bay_count; ++i) { | 627 | for (i = 0; i < media_bay_count; ++i) { |
633 | down(&media_bays[i].lock); | 628 | down(&media_bays[i].lock); |
634 | if (!media_bays[i].sleeping) | 629 | if (!media_bays[i].sleeping) |
@@ -637,9 +632,8 @@ static int media_bay_task(void *x) | |||
637 | } | 632 | } |
638 | 633 | ||
639 | msleep_interruptible(MB_POLL_DELAY); | 634 | msleep_interruptible(MB_POLL_DELAY); |
640 | if (signal_pending(current)) | ||
641 | return 0; | ||
642 | } | 635 | } |
636 | return 0; | ||
643 | } | 637 | } |
644 | 638 | ||
645 | static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match) | 639 | static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match) |
@@ -700,7 +694,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de | |||
700 | 694 | ||
701 | /* Startup kernel thread */ | 695 | /* Startup kernel thread */ |
702 | if (i == 0) | 696 | if (i == 0) |
703 | kernel_thread(media_bay_task, NULL, CLONE_KERNEL); | 697 | kthread_run(media_bay_task, NULL, "media-bay"); |
704 | 698 | ||
705 | return 0; | 699 | return 0; |
706 | 700 | ||
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 276945d51513..54f4942a2968 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
@@ -553,6 +553,7 @@ thermostat_init(void) | |||
553 | struct device_node* np; | 553 | struct device_node* np; |
554 | const u32 *prop; | 554 | const u32 *prop; |
555 | int i = 0, offset = 0; | 555 | int i = 0, offset = 0; |
556 | int err; | ||
556 | 557 | ||
557 | np = of_find_node_by_name(NULL, "fan"); | 558 | np = of_find_node_by_name(NULL, "fan"); |
558 | if (!np) | 559 | if (!np) |
@@ -612,17 +613,20 @@ thermostat_init(void) | |||
612 | return -ENODEV; | 613 | return -ENODEV; |
613 | } | 614 | } |
614 | 615 | ||
615 | device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); | 616 | err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); |
616 | device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); | 617 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); |
617 | device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); | 618 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); |
618 | device_create_file(&of_dev->dev, &dev_attr_sensor2_limit); | 619 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_limit); |
619 | device_create_file(&of_dev->dev, &dev_attr_sensor1_location); | 620 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_location); |
620 | device_create_file(&of_dev->dev, &dev_attr_sensor2_location); | 621 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_location); |
621 | device_create_file(&of_dev->dev, &dev_attr_limit_adjust); | 622 | err |= device_create_file(&of_dev->dev, &dev_attr_limit_adjust); |
622 | device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed); | 623 | err |= device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed); |
623 | device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed); | 624 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed); |
624 | if(therm_type == ADT7460) | 625 | if(therm_type == ADT7460) |
625 | device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); | 626 | err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); |
627 | if (err) | ||
628 | printk(KERN_WARNING | ||
629 | "Failed to create tempertaure attribute file(s).\n"); | ||
626 | 630 | ||
627 | #ifndef CONFIG_I2C_POWERMAC | 631 | #ifndef CONFIG_I2C_POWERMAC |
628 | request_module("i2c-powermac"); | 632 | request_module("i2c-powermac"); |
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index e43554e754a4..1e0a69a5e815 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
@@ -121,6 +121,7 @@ | |||
121 | #include <linux/reboot.h> | 121 | #include <linux/reboot.h> |
122 | #include <linux/kmod.h> | 122 | #include <linux/kmod.h> |
123 | #include <linux/i2c.h> | 123 | #include <linux/i2c.h> |
124 | #include <linux/kthread.h> | ||
124 | #include <asm/prom.h> | 125 | #include <asm/prom.h> |
125 | #include <asm/machdep.h> | 126 | #include <asm/machdep.h> |
126 | #include <asm/io.h> | 127 | #include <asm/io.h> |
@@ -161,7 +162,7 @@ static struct slots_pid_state slots_state; | |||
161 | static int state; | 162 | static int state; |
162 | static int cpu_count; | 163 | static int cpu_count; |
163 | static int cpu_pid_type; | 164 | static int cpu_pid_type; |
164 | static pid_t ctrl_task; | 165 | static struct task_struct *ctrl_task; |
165 | static struct completion ctrl_complete; | 166 | static struct completion ctrl_complete; |
166 | static int critical_state; | 167 | static int critical_state; |
167 | static int rackmac; | 168 | static int rackmac; |
@@ -1156,6 +1157,8 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state) | |||
1156 | */ | 1157 | */ |
1157 | static int init_cpu_state(struct cpu_pid_state *state, int index) | 1158 | static int init_cpu_state(struct cpu_pid_state *state, int index) |
1158 | { | 1159 | { |
1160 | int err; | ||
1161 | |||
1159 | state->index = index; | 1162 | state->index = index; |
1160 | state->first = 1; | 1163 | state->first = 1; |
1161 | state->rpm = (cpu_pid_type == CPU_PID_TYPE_RACKMAC) ? 4000 : 1000; | 1164 | state->rpm = (cpu_pid_type == CPU_PID_TYPE_RACKMAC) ? 4000 : 1000; |
@@ -1181,18 +1184,21 @@ static int init_cpu_state(struct cpu_pid_state *state, int index) | |||
1181 | DBG("CPU %d Using %d power history entries\n", index, state->count_power); | 1184 | DBG("CPU %d Using %d power history entries\n", index, state->count_power); |
1182 | 1185 | ||
1183 | if (index == 0) { | 1186 | if (index == 0) { |
1184 | device_create_file(&of_dev->dev, &dev_attr_cpu0_temperature); | 1187 | err = device_create_file(&of_dev->dev, &dev_attr_cpu0_temperature); |
1185 | device_create_file(&of_dev->dev, &dev_attr_cpu0_voltage); | 1188 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_voltage); |
1186 | device_create_file(&of_dev->dev, &dev_attr_cpu0_current); | 1189 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_current); |
1187 | device_create_file(&of_dev->dev, &dev_attr_cpu0_exhaust_fan_rpm); | 1190 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_exhaust_fan_rpm); |
1188 | device_create_file(&of_dev->dev, &dev_attr_cpu0_intake_fan_rpm); | 1191 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu0_intake_fan_rpm); |
1189 | } else { | 1192 | } else { |
1190 | device_create_file(&of_dev->dev, &dev_attr_cpu1_temperature); | 1193 | err = device_create_file(&of_dev->dev, &dev_attr_cpu1_temperature); |
1191 | device_create_file(&of_dev->dev, &dev_attr_cpu1_voltage); | 1194 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu1_voltage); |
1192 | device_create_file(&of_dev->dev, &dev_attr_cpu1_current); | 1195 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu1_current); |
1193 | device_create_file(&of_dev->dev, &dev_attr_cpu1_exhaust_fan_rpm); | 1196 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu1_exhaust_fan_rpm); |
1194 | device_create_file(&of_dev->dev, &dev_attr_cpu1_intake_fan_rpm); | 1197 | err |= device_create_file(&of_dev->dev, &dev_attr_cpu1_intake_fan_rpm); |
1195 | } | 1198 | } |
1199 | if (err) | ||
1200 | printk(KERN_WARNING "Failed to create some of the atribute" | ||
1201 | "files for CPU %d\n", index); | ||
1196 | 1202 | ||
1197 | return 0; | 1203 | return 0; |
1198 | fail: | 1204 | fail: |
@@ -1328,6 +1334,7 @@ static int init_backside_state(struct backside_pid_state *state) | |||
1328 | { | 1334 | { |
1329 | struct device_node *u3; | 1335 | struct device_node *u3; |
1330 | int u3h = 1; /* conservative by default */ | 1336 | int u3h = 1; /* conservative by default */ |
1337 | int err; | ||
1331 | 1338 | ||
1332 | /* | 1339 | /* |
1333 | * There are different PID params for machines with U3 and machines | 1340 | * There are different PID params for machines with U3 and machines |
@@ -1379,8 +1386,11 @@ static int init_backside_state(struct backside_pid_state *state) | |||
1379 | if (state->monitor == NULL) | 1386 | if (state->monitor == NULL) |
1380 | return -ENODEV; | 1387 | return -ENODEV; |
1381 | 1388 | ||
1382 | device_create_file(&of_dev->dev, &dev_attr_backside_temperature); | 1389 | err = device_create_file(&of_dev->dev, &dev_attr_backside_temperature); |
1383 | device_create_file(&of_dev->dev, &dev_attr_backside_fan_pwm); | 1390 | err |= device_create_file(&of_dev->dev, &dev_attr_backside_fan_pwm); |
1391 | if (err) | ||
1392 | printk(KERN_WARNING "Failed to create attribute file(s)" | ||
1393 | " for backside fan\n"); | ||
1384 | 1394 | ||
1385 | return 0; | 1395 | return 0; |
1386 | } | 1396 | } |
@@ -1491,6 +1501,8 @@ static void do_monitor_drives(struct drives_pid_state *state) | |||
1491 | */ | 1501 | */ |
1492 | static int init_drives_state(struct drives_pid_state *state) | 1502 | static int init_drives_state(struct drives_pid_state *state) |
1493 | { | 1503 | { |
1504 | int err; | ||
1505 | |||
1494 | state->ticks = 1; | 1506 | state->ticks = 1; |
1495 | state->first = 1; | 1507 | state->first = 1; |
1496 | state->rpm = 1000; | 1508 | state->rpm = 1000; |
@@ -1499,8 +1511,11 @@ static int init_drives_state(struct drives_pid_state *state) | |||
1499 | if (state->monitor == NULL) | 1511 | if (state->monitor == NULL) |
1500 | return -ENODEV; | 1512 | return -ENODEV; |
1501 | 1513 | ||
1502 | device_create_file(&of_dev->dev, &dev_attr_drives_temperature); | 1514 | err = device_create_file(&of_dev->dev, &dev_attr_drives_temperature); |
1503 | device_create_file(&of_dev->dev, &dev_attr_drives_fan_rpm); | 1515 | err |= device_create_file(&of_dev->dev, &dev_attr_drives_fan_rpm); |
1516 | if (err) | ||
1517 | printk(KERN_WARNING "Failed to create attribute file(s)" | ||
1518 | " for drives bay fan\n"); | ||
1504 | 1519 | ||
1505 | return 0; | 1520 | return 0; |
1506 | } | 1521 | } |
@@ -1621,7 +1636,9 @@ static int init_dimms_state(struct dimm_pid_state *state) | |||
1621 | if (state->monitor == NULL) | 1636 | if (state->monitor == NULL) |
1622 | return -ENODEV; | 1637 | return -ENODEV; |
1623 | 1638 | ||
1624 | device_create_file(&of_dev->dev, &dev_attr_dimms_temperature); | 1639 | if (device_create_file(&of_dev->dev, &dev_attr_dimms_temperature)) |
1640 | printk(KERN_WARNING "Failed to create attribute file" | ||
1641 | " for DIMM temperature\n"); | ||
1625 | 1642 | ||
1626 | return 0; | 1643 | return 0; |
1627 | } | 1644 | } |
@@ -1731,6 +1748,8 @@ static void do_monitor_slots(struct slots_pid_state *state) | |||
1731 | */ | 1748 | */ |
1732 | static int init_slots_state(struct slots_pid_state *state) | 1749 | static int init_slots_state(struct slots_pid_state *state) |
1733 | { | 1750 | { |
1751 | int err; | ||
1752 | |||
1734 | state->ticks = 1; | 1753 | state->ticks = 1; |
1735 | state->first = 1; | 1754 | state->first = 1; |
1736 | state->pwm = 50; | 1755 | state->pwm = 50; |
@@ -1739,8 +1758,11 @@ static int init_slots_state(struct slots_pid_state *state) | |||
1739 | if (state->monitor == NULL) | 1758 | if (state->monitor == NULL) |
1740 | return -ENODEV; | 1759 | return -ENODEV; |
1741 | 1760 | ||
1742 | device_create_file(&of_dev->dev, &dev_attr_slots_temperature); | 1761 | err = device_create_file(&of_dev->dev, &dev_attr_slots_temperature); |
1743 | device_create_file(&of_dev->dev, &dev_attr_slots_fan_pwm); | 1762 | err |= device_create_file(&of_dev->dev, &dev_attr_slots_fan_pwm); |
1763 | if (err) | ||
1764 | printk(KERN_WARNING "Failed to create attribute file(s)" | ||
1765 | " for slots bay fan\n"); | ||
1744 | 1766 | ||
1745 | return 0; | 1767 | return 0; |
1746 | } | 1768 | } |
@@ -1779,8 +1801,6 @@ static int call_critical_overtemp(void) | |||
1779 | */ | 1801 | */ |
1780 | static int main_control_loop(void *x) | 1802 | static int main_control_loop(void *x) |
1781 | { | 1803 | { |
1782 | daemonize("kfand"); | ||
1783 | |||
1784 | DBG("main_control_loop started\n"); | 1804 | DBG("main_control_loop started\n"); |
1785 | 1805 | ||
1786 | down(&driver_lock); | 1806 | down(&driver_lock); |
@@ -1956,7 +1976,7 @@ static void start_control_loops(void) | |||
1956 | { | 1976 | { |
1957 | init_completion(&ctrl_complete); | 1977 | init_completion(&ctrl_complete); |
1958 | 1978 | ||
1959 | ctrl_task = kernel_thread(main_control_loop, NULL, SIGCHLD | CLONE_KERNEL); | 1979 | ctrl_task = kthread_run(main_control_loop, NULL, "kfand"); |
1960 | } | 1980 | } |
1961 | 1981 | ||
1962 | /* | 1982 | /* |
@@ -1964,7 +1984,7 @@ static void start_control_loops(void) | |||
1964 | */ | 1984 | */ |
1965 | static void stop_control_loops(void) | 1985 | static void stop_control_loops(void) |
1966 | { | 1986 | { |
1967 | if (ctrl_task != 0) | 1987 | if (ctrl_task) |
1968 | wait_for_completion(&ctrl_complete); | 1988 | wait_for_completion(&ctrl_complete); |
1969 | } | 1989 | } |
1970 | 1990 | ||
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index b66da74caa55..d11821af3b8d 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | #include <linux/init.h> | 38 | #include <linux/init.h> |
39 | #include <linux/kthread.h> | ||
39 | 40 | ||
40 | #include <asm/prom.h> | 41 | #include <asm/prom.h> |
41 | #include <asm/machdep.h> | 42 | #include <asm/machdep.h> |
@@ -59,8 +60,7 @@ I2C_CLIENT_INSMOD; | |||
59 | 60 | ||
60 | static struct { | 61 | static struct { |
61 | volatile int running; | 62 | volatile int running; |
62 | struct completion completion; | 63 | struct task_struct *poll_task; |
63 | pid_t poll_task; | ||
64 | 64 | ||
65 | struct semaphore lock; | 65 | struct semaphore lock; |
66 | struct of_device *of_dev; | 66 | struct of_device *of_dev; |
@@ -221,6 +221,7 @@ static void | |||
221 | setup_hardware( void ) | 221 | setup_hardware( void ) |
222 | { | 222 | { |
223 | int val; | 223 | int val; |
224 | int err; | ||
224 | 225 | ||
225 | /* save registers (if we unload the module) */ | 226 | /* save registers (if we unload the module) */ |
226 | x.r0 = read_reg( x.fan, 0x00, 1 ); | 227 | x.r0 = read_reg( x.fan, 0x00, 1 ); |
@@ -263,8 +264,11 @@ setup_hardware( void ) | |||
263 | x.upind = -1; | 264 | x.upind = -1; |
264 | /* tune_fan( fan_up_table[x.upind].fan_setting ); */ | 265 | /* tune_fan( fan_up_table[x.upind].fan_setting ); */ |
265 | 266 | ||
266 | device_create_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); | 267 | err = device_create_file( &x.of_dev->dev, &dev_attr_cpu_temperature ); |
267 | device_create_file( &x.of_dev->dev, &dev_attr_case_temperature ); | 268 | err |= device_create_file( &x.of_dev->dev, &dev_attr_case_temperature ); |
269 | if (err) | ||
270 | printk(KERN_WARNING | ||
271 | "Failed to create temperature attribute file(s).\n"); | ||
268 | } | 272 | } |
269 | 273 | ||
270 | static void | 274 | static void |
@@ -280,27 +284,27 @@ restore_regs( void ) | |||
280 | write_reg( x.fan, 0x00, x.r0, 1 ); | 284 | write_reg( x.fan, 0x00, x.r0, 1 ); |
281 | } | 285 | } |
282 | 286 | ||
283 | static int | 287 | static int control_loop(void *dummy) |
284 | control_loop( void *dummy ) | ||
285 | { | 288 | { |
286 | daemonize("g4fand"); | 289 | down(&x.lock); |
287 | |||
288 | down( &x.lock ); | ||
289 | setup_hardware(); | 290 | setup_hardware(); |
291 | up(&x.lock); | ||
290 | 292 | ||
291 | while( x.running ) { | 293 | for (;;) { |
292 | up( &x.lock ); | ||
293 | |||
294 | msleep_interruptible(8000); | 294 | msleep_interruptible(8000); |
295 | 295 | if (kthread_should_stop()) | |
296 | down( &x.lock ); | 296 | break; |
297 | |||
298 | down(&x.lock); | ||
297 | poll_temp(); | 299 | poll_temp(); |
300 | up(&x.lock); | ||
298 | } | 301 | } |
299 | 302 | ||
303 | down(&x.lock); | ||
300 | restore_regs(); | 304 | restore_regs(); |
301 | up( &x.lock ); | 305 | up(&x.lock); |
302 | 306 | ||
303 | complete_and_exit( &x.completion, 0 ); | 307 | return 0; |
304 | } | 308 | } |
305 | 309 | ||
306 | 310 | ||
@@ -320,8 +324,7 @@ do_attach( struct i2c_adapter *adapter ) | |||
320 | ret = i2c_probe( adapter, &addr_data, &do_probe ); | 324 | ret = i2c_probe( adapter, &addr_data, &do_probe ); |
321 | if( x.thermostat && x.fan ) { | 325 | if( x.thermostat && x.fan ) { |
322 | x.running = 1; | 326 | x.running = 1; |
323 | init_completion( &x.completion ); | 327 | x.poll_task = kthread_run(control_loop, NULL, "g4fand"); |
324 | x.poll_task = kernel_thread( control_loop, NULL, SIGCHLD | CLONE_KERNEL ); | ||
325 | } | 328 | } |
326 | } | 329 | } |
327 | return ret; | 330 | return ret; |
@@ -337,7 +340,8 @@ do_detach( struct i2c_client *client ) | |||
337 | else { | 340 | else { |
338 | if( x.running ) { | 341 | if( x.running ) { |
339 | x.running = 0; | 342 | x.running = 0; |
340 | wait_for_completion( &x.completion ); | 343 | kthread_stop(x.poll_task); |
344 | x.poll_task = NULL; | ||
341 | } | 345 | } |
342 | if( client == x.thermostat ) | 346 | if( client == x.thermostat ) |
343 | x.thermostat = NULL; | 347 | x.thermostat = NULL; |
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 7e27071746e4..741a2e3f4fc6 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -22,7 +22,7 @@ static u8 bl_curve[FB_BACKLIGHT_LEVELS]; | |||
22 | 22 | ||
23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) | 23 | static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) |
24 | { | 24 | { |
25 | unsigned int i, flat, count, range = (max - min); | 25 | int i, flat, count, range = (max - min); |
26 | 26 | ||
27 | bl_curve[0] = off; | 27 | bl_curve[0] = off; |
28 | 28 | ||
@@ -68,17 +68,11 @@ static int pmu_backlight_get_level_brightness(int level) | |||
68 | return pmulevel; | 68 | return pmulevel; |
69 | } | 69 | } |
70 | 70 | ||
71 | static int pmu_backlight_update_status(struct backlight_device *bd) | 71 | static int __pmu_backlight_update_status(struct backlight_device *bd) |
72 | { | 72 | { |
73 | struct adb_request req; | 73 | struct adb_request req; |
74 | unsigned long flags; | ||
75 | int level = bd->props.brightness; | 74 | int level = bd->props.brightness; |
76 | 75 | ||
77 | spin_lock_irqsave(&pmu_backlight_lock, flags); | ||
78 | |||
79 | /* Don't update brightness when sleeping */ | ||
80 | if (sleeping) | ||
81 | goto out; | ||
82 | 76 | ||
83 | if (bd->props.power != FB_BLANK_UNBLANK || | 77 | if (bd->props.power != FB_BLANK_UNBLANK || |
84 | bd->props.fb_blank != FB_BLANK_UNBLANK) | 78 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
@@ -99,12 +93,23 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
99 | pmu_wait_complete(&req); | 93 | pmu_wait_complete(&req); |
100 | } | 94 | } |
101 | 95 | ||
102 | out: | ||
103 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); | ||
104 | |||
105 | return 0; | 96 | return 0; |
106 | } | 97 | } |
107 | 98 | ||
99 | static int pmu_backlight_update_status(struct backlight_device *bd) | ||
100 | { | ||
101 | unsigned long flags; | ||
102 | int rc = 0; | ||
103 | |||
104 | spin_lock_irqsave(&pmu_backlight_lock, flags); | ||
105 | /* Don't update brightness when sleeping */ | ||
106 | if (!sleeping) | ||
107 | rc = __pmu_backlight_update_status(bd); | ||
108 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); | ||
109 | return rc; | ||
110 | } | ||
111 | |||
112 | |||
108 | static int pmu_backlight_get_brightness(struct backlight_device *bd) | 113 | static int pmu_backlight_get_brightness(struct backlight_device *bd) |
109 | { | 114 | { |
110 | return bd->props.brightness; | 115 | return bd->props.brightness; |
@@ -123,6 +128,16 @@ void pmu_backlight_set_sleep(int sleep) | |||
123 | 128 | ||
124 | spin_lock_irqsave(&pmu_backlight_lock, flags); | 129 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
125 | sleeping = sleep; | 130 | sleeping = sleep; |
131 | if (pmac_backlight) { | ||
132 | if (sleep) { | ||
133 | struct adb_request req; | ||
134 | |||
135 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL, | ||
136 | PMU_POW_BACKLIGHT | PMU_POW_OFF); | ||
137 | pmu_wait_complete(&req); | ||
138 | } else | ||
139 | __pmu_backlight_update_status(pmac_backlight); | ||
140 | } | ||
126 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); | 141 | spin_unlock_irqrestore(&pmu_backlight_lock, flags); |
127 | } | 142 | } |
128 | #endif /* CONFIG_PM */ | 143 | #endif /* CONFIG_PM */ |
@@ -148,8 +163,8 @@ void __init pmu_backlight_init() | |||
148 | 163 | ||
149 | bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data); | 164 | bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data); |
150 | if (IS_ERR(bd)) { | 165 | if (IS_ERR(bd)) { |
151 | printk("pmubl: Backlight registration failed\n"); | 166 | printk(KERN_ERR "PMU Backlight registration failed\n"); |
152 | goto error; | 167 | return; |
153 | } | 168 | } |
154 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 169 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
155 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); | 170 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); |
@@ -171,10 +186,5 @@ void __init pmu_backlight_init() | |||
171 | bd->props.power = FB_BLANK_UNBLANK; | 186 | bd->props.power = FB_BLANK_UNBLANK; |
172 | backlight_update_status(bd); | 187 | backlight_update_status(bd); |
173 | 188 | ||
174 | printk("pmubl: Backlight initialized (%s)\n", name); | 189 | printk(KERN_INFO "PMU Backlight initialized (%s)\n", name); |
175 | |||
176 | return; | ||
177 | |||
178 | error: | ||
179 | return; | ||
180 | } | 190 | } |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index ac420b17e16f..ebec663d5d37 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
@@ -10,13 +10,11 @@ | |||
10 | * | 10 | * |
11 | * Copyright (C) 1998 Paul Mackerras and Fabio Riccardi. | 11 | * Copyright (C) 1998 Paul Mackerras and Fabio Riccardi. |
12 | * Copyright (C) 2001-2002 Benjamin Herrenschmidt | 12 | * Copyright (C) 2001-2002 Benjamin Herrenschmidt |
13 | * Copyright (C) 2006-2007 Johannes Berg | ||
13 | * | 14 | * |
14 | * THIS DRIVER IS BECOMING A TOTAL MESS ! | 15 | * THIS DRIVER IS BECOMING A TOTAL MESS ! |
15 | * - Cleanup atomically disabling reply to PMU events after | 16 | * - Cleanup atomically disabling reply to PMU events after |
16 | * a sleep or a freq. switch | 17 | * a sleep or a freq. switch |
17 | * - Move sleep code out of here to pmac_pm, merge into new | ||
18 | * common PM infrastructure | ||
19 | * - Save/Restore PCI space properly | ||
20 | * | 18 | * |
21 | */ | 19 | */ |
22 | #include <stdarg.h> | 20 | #include <stdarg.h> |
@@ -33,7 +31,6 @@ | |||
33 | #include <linux/adb.h> | 31 | #include <linux/adb.h> |
34 | #include <linux/pmu.h> | 32 | #include <linux/pmu.h> |
35 | #include <linux/cuda.h> | 33 | #include <linux/cuda.h> |
36 | #include <linux/smp_lock.h> | ||
37 | #include <linux/module.h> | 34 | #include <linux/module.h> |
38 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
39 | #include <linux/pm.h> | 36 | #include <linux/pm.h> |
@@ -65,9 +62,7 @@ | |||
65 | #include "via-pmu-event.h" | 62 | #include "via-pmu-event.h" |
66 | 63 | ||
67 | /* Some compile options */ | 64 | /* Some compile options */ |
68 | #undef SUSPEND_USES_PMU | 65 | #undef DEBUG_SLEEP |
69 | #define DEBUG_SLEEP | ||
70 | #undef HACKED_PCI_SAVE | ||
71 | 66 | ||
72 | /* Misc minor number allocated for /dev/pmu */ | 67 | /* Misc minor number allocated for /dev/pmu */ |
73 | #define PMU_MINOR 154 | 68 | #define PMU_MINOR 154 |
@@ -152,12 +147,9 @@ static spinlock_t pmu_lock; | |||
152 | static u8 pmu_intr_mask; | 147 | static u8 pmu_intr_mask; |
153 | static int pmu_version; | 148 | static int pmu_version; |
154 | static int drop_interrupts; | 149 | static int drop_interrupts; |
155 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 150 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
156 | static int option_lid_wakeup = 1; | 151 | static int option_lid_wakeup = 1; |
157 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | 152 | #endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ |
158 | #if (defined(CONFIG_PM_SLEEP)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY) | ||
159 | static int sleep_in_progress; | ||
160 | #endif | ||
161 | static unsigned long async_req_locks; | 153 | static unsigned long async_req_locks; |
162 | static unsigned int pmu_irq_stats[11]; | 154 | static unsigned int pmu_irq_stats[11]; |
163 | 155 | ||
@@ -177,7 +169,6 @@ static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES]; | |||
177 | 169 | ||
178 | int __fake_sleep; | 170 | int __fake_sleep; |
179 | int asleep; | 171 | int asleep; |
180 | BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); | ||
181 | 172 | ||
182 | #ifdef CONFIG_ADB | 173 | #ifdef CONFIG_ADB |
183 | static int adb_dev_map; | 174 | static int adb_dev_map; |
@@ -224,7 +215,7 @@ extern void enable_kernel_fp(void); | |||
224 | 215 | ||
225 | #ifdef DEBUG_SLEEP | 216 | #ifdef DEBUG_SLEEP |
226 | int pmu_polled_request(struct adb_request *req); | 217 | int pmu_polled_request(struct adb_request *req); |
227 | int pmu_wink(struct adb_request *req); | 218 | void pmu_blink(int n); |
228 | #endif | 219 | #endif |
229 | 220 | ||
230 | /* | 221 | /* |
@@ -875,7 +866,7 @@ proc_read_options(char *page, char **start, off_t off, | |||
875 | { | 866 | { |
876 | char *p = page; | 867 | char *p = page; |
877 | 868 | ||
878 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 869 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
879 | if (pmu_kind == PMU_KEYLARGO_BASED && | 870 | if (pmu_kind == PMU_KEYLARGO_BASED && |
880 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) | 871 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) |
881 | p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); | 872 | p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); |
@@ -916,7 +907,7 @@ proc_write_options(struct file *file, const char __user *buffer, | |||
916 | *(val++) = 0; | 907 | *(val++) = 0; |
917 | while(*val == ' ') | 908 | while(*val == ' ') |
918 | val++; | 909 | val++; |
919 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 910 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
920 | if (pmu_kind == PMU_KEYLARGO_BASED && | 911 | if (pmu_kind == PMU_KEYLARGO_BASED && |
921 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) | 912 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) |
922 | if (!strcmp(label, "lid_wakeup")) | 913 | if (!strcmp(label, "lid_wakeup")) |
@@ -1256,9 +1247,7 @@ void | |||
1256 | pmu_suspend(void) | 1247 | pmu_suspend(void) |
1257 | { | 1248 | { |
1258 | unsigned long flags; | 1249 | unsigned long flags; |
1259 | #ifdef SUSPEND_USES_PMU | 1250 | |
1260 | struct adb_request *req; | ||
1261 | #endif | ||
1262 | if (!via) | 1251 | if (!via) |
1263 | return; | 1252 | return; |
1264 | 1253 | ||
@@ -1276,17 +1265,10 @@ pmu_suspend(void) | |||
1276 | via_pmu_interrupt(0, NULL); | 1265 | via_pmu_interrupt(0, NULL); |
1277 | spin_lock_irqsave(&pmu_lock, flags); | 1266 | spin_lock_irqsave(&pmu_lock, flags); |
1278 | if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) { | 1267 | if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) { |
1279 | #ifdef SUSPEND_USES_PMU | ||
1280 | pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0); | ||
1281 | spin_unlock_irqrestore(&pmu_lock, flags); | ||
1282 | while(!req.complete) | ||
1283 | pmu_poll(); | ||
1284 | #else /* SUSPEND_USES_PMU */ | ||
1285 | if (gpio_irq >= 0) | 1268 | if (gpio_irq >= 0) |
1286 | disable_irq_nosync(gpio_irq); | 1269 | disable_irq_nosync(gpio_irq); |
1287 | out_8(&via[IER], CB1_INT | IER_CLR); | 1270 | out_8(&via[IER], CB1_INT | IER_CLR); |
1288 | spin_unlock_irqrestore(&pmu_lock, flags); | 1271 | spin_unlock_irqrestore(&pmu_lock, flags); |
1289 | #endif /* SUSPEND_USES_PMU */ | ||
1290 | break; | 1272 | break; |
1291 | } | 1273 | } |
1292 | } while (1); | 1274 | } while (1); |
@@ -1307,18 +1289,11 @@ pmu_resume(void) | |||
1307 | return; | 1289 | return; |
1308 | } | 1290 | } |
1309 | adb_int_pending = 1; | 1291 | adb_int_pending = 1; |
1310 | #ifdef SUSPEND_USES_PMU | ||
1311 | pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask); | ||
1312 | spin_unlock_irqrestore(&pmu_lock, flags); | ||
1313 | while(!req.complete) | ||
1314 | pmu_poll(); | ||
1315 | #else /* SUSPEND_USES_PMU */ | ||
1316 | if (gpio_irq >= 0) | 1292 | if (gpio_irq >= 0) |
1317 | enable_irq(gpio_irq); | 1293 | enable_irq(gpio_irq); |
1318 | out_8(&via[IER], CB1_INT | IER_SET); | 1294 | out_8(&via[IER], CB1_INT | IER_SET); |
1319 | spin_unlock_irqrestore(&pmu_lock, flags); | 1295 | spin_unlock_irqrestore(&pmu_lock, flags); |
1320 | pmu_poll(); | 1296 | pmu_poll(); |
1321 | #endif /* SUSPEND_USES_PMU */ | ||
1322 | } | 1297 | } |
1323 | 1298 | ||
1324 | /* Interrupt data could be the result data from an ADB cmd */ | 1299 | /* Interrupt data could be the result data from an ADB cmd */ |
@@ -1738,228 +1713,7 @@ pmu_present(void) | |||
1738 | return via != 0; | 1713 | return via != 0; |
1739 | } | 1714 | } |
1740 | 1715 | ||
1741 | #ifdef CONFIG_PM_SLEEP | 1716 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
1742 | |||
1743 | static LIST_HEAD(sleep_notifiers); | ||
1744 | |||
1745 | int | ||
1746 | pmu_register_sleep_notifier(struct pmu_sleep_notifier *n) | ||
1747 | { | ||
1748 | struct list_head *list; | ||
1749 | struct pmu_sleep_notifier *notifier; | ||
1750 | |||
1751 | for (list = sleep_notifiers.next; list != &sleep_notifiers; | ||
1752 | list = list->next) { | ||
1753 | notifier = list_entry(list, struct pmu_sleep_notifier, list); | ||
1754 | if (n->priority > notifier->priority) | ||
1755 | break; | ||
1756 | } | ||
1757 | __list_add(&n->list, list->prev, list); | ||
1758 | return 0; | ||
1759 | } | ||
1760 | EXPORT_SYMBOL(pmu_register_sleep_notifier); | ||
1761 | |||
1762 | int | ||
1763 | pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n) | ||
1764 | { | ||
1765 | if (n->list.next == 0) | ||
1766 | return -ENOENT; | ||
1767 | list_del(&n->list); | ||
1768 | n->list.next = NULL; | ||
1769 | return 0; | ||
1770 | } | ||
1771 | EXPORT_SYMBOL(pmu_unregister_sleep_notifier); | ||
1772 | #endif /* CONFIG_PM_SLEEP */ | ||
1773 | |||
1774 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | ||
1775 | |||
1776 | /* Sleep is broadcast last-to-first */ | ||
1777 | static void broadcast_sleep(int when) | ||
1778 | { | ||
1779 | struct list_head *list; | ||
1780 | struct pmu_sleep_notifier *notifier; | ||
1781 | |||
1782 | for (list = sleep_notifiers.prev; list != &sleep_notifiers; | ||
1783 | list = list->prev) { | ||
1784 | notifier = list_entry(list, struct pmu_sleep_notifier, list); | ||
1785 | notifier->notifier_call(notifier, when); | ||
1786 | } | ||
1787 | } | ||
1788 | |||
1789 | /* Wake is broadcast first-to-last */ | ||
1790 | static void broadcast_wake(void) | ||
1791 | { | ||
1792 | struct list_head *list; | ||
1793 | struct pmu_sleep_notifier *notifier; | ||
1794 | |||
1795 | for (list = sleep_notifiers.next; list != &sleep_notifiers; | ||
1796 | list = list->next) { | ||
1797 | notifier = list_entry(list, struct pmu_sleep_notifier, list); | ||
1798 | notifier->notifier_call(notifier, PBOOK_WAKE); | ||
1799 | } | ||
1800 | } | ||
1801 | |||
1802 | /* | ||
1803 | * This struct is used to store config register values for | ||
1804 | * PCI devices which may get powered off when we sleep. | ||
1805 | */ | ||
1806 | static struct pci_save { | ||
1807 | #ifndef HACKED_PCI_SAVE | ||
1808 | u16 command; | ||
1809 | u16 cache_lat; | ||
1810 | u16 intr; | ||
1811 | u32 rom_address; | ||
1812 | #else | ||
1813 | u32 config[16]; | ||
1814 | #endif | ||
1815 | } *pbook_pci_saves; | ||
1816 | static int pbook_npci_saves; | ||
1817 | |||
1818 | static void | ||
1819 | pbook_alloc_pci_save(void) | ||
1820 | { | ||
1821 | int npci; | ||
1822 | struct pci_dev *pd = NULL; | ||
1823 | |||
1824 | npci = 0; | ||
1825 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
1826 | ++npci; | ||
1827 | } | ||
1828 | if (npci == 0) | ||
1829 | return; | ||
1830 | pbook_pci_saves = (struct pci_save *) | ||
1831 | kmalloc(npci * sizeof(struct pci_save), GFP_KERNEL); | ||
1832 | pbook_npci_saves = npci; | ||
1833 | } | ||
1834 | |||
1835 | static void | ||
1836 | pbook_free_pci_save(void) | ||
1837 | { | ||
1838 | if (pbook_pci_saves == NULL) | ||
1839 | return; | ||
1840 | kfree(pbook_pci_saves); | ||
1841 | pbook_pci_saves = NULL; | ||
1842 | pbook_npci_saves = 0; | ||
1843 | } | ||
1844 | |||
1845 | static void | ||
1846 | pbook_pci_save(void) | ||
1847 | { | ||
1848 | struct pci_save *ps = pbook_pci_saves; | ||
1849 | struct pci_dev *pd = NULL; | ||
1850 | int npci = pbook_npci_saves; | ||
1851 | |||
1852 | if (ps == NULL) | ||
1853 | return; | ||
1854 | |||
1855 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
1856 | if (npci-- == 0) { | ||
1857 | pci_dev_put(pd); | ||
1858 | return; | ||
1859 | } | ||
1860 | #ifndef HACKED_PCI_SAVE | ||
1861 | pci_read_config_word(pd, PCI_COMMAND, &ps->command); | ||
1862 | pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); | ||
1863 | pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr); | ||
1864 | pci_read_config_dword(pd, PCI_ROM_ADDRESS, &ps->rom_address); | ||
1865 | #else | ||
1866 | int i; | ||
1867 | for (i=1;i<16;i++) | ||
1868 | pci_read_config_dword(pd, i<<4, &ps->config[i]); | ||
1869 | #endif | ||
1870 | ++ps; | ||
1871 | } | ||
1872 | } | ||
1873 | |||
1874 | /* For this to work, we must take care of a few things: If gmac was enabled | ||
1875 | * during boot, it will be in the pci dev list. If it's disabled at this point | ||
1876 | * (and it will probably be), then you can't access it's config space. | ||
1877 | */ | ||
1878 | static void | ||
1879 | pbook_pci_restore(void) | ||
1880 | { | ||
1881 | u16 cmd; | ||
1882 | struct pci_save *ps = pbook_pci_saves - 1; | ||
1883 | struct pci_dev *pd = NULL; | ||
1884 | int npci = pbook_npci_saves; | ||
1885 | int j; | ||
1886 | |||
1887 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
1888 | #ifdef HACKED_PCI_SAVE | ||
1889 | int i; | ||
1890 | if (npci-- == 0) { | ||
1891 | pci_dev_put(pd); | ||
1892 | return; | ||
1893 | } | ||
1894 | ps++; | ||
1895 | for (i=2;i<16;i++) | ||
1896 | pci_write_config_dword(pd, i<<4, ps->config[i]); | ||
1897 | pci_write_config_dword(pd, 4, ps->config[1]); | ||
1898 | #else | ||
1899 | if (npci-- == 0) | ||
1900 | return; | ||
1901 | ps++; | ||
1902 | if (ps->command == 0) | ||
1903 | continue; | ||
1904 | pci_read_config_word(pd, PCI_COMMAND, &cmd); | ||
1905 | if ((ps->command & ~cmd) == 0) | ||
1906 | continue; | ||
1907 | switch (pd->hdr_type) { | ||
1908 | case PCI_HEADER_TYPE_NORMAL: | ||
1909 | for (j = 0; j < 6; ++j) | ||
1910 | pci_write_config_dword(pd, | ||
1911 | PCI_BASE_ADDRESS_0 + j*4, | ||
1912 | pd->resource[j].start); | ||
1913 | pci_write_config_dword(pd, PCI_ROM_ADDRESS, | ||
1914 | ps->rom_address); | ||
1915 | pci_write_config_word(pd, PCI_CACHE_LINE_SIZE, | ||
1916 | ps->cache_lat); | ||
1917 | pci_write_config_word(pd, PCI_INTERRUPT_LINE, | ||
1918 | ps->intr); | ||
1919 | pci_write_config_word(pd, PCI_COMMAND, ps->command); | ||
1920 | break; | ||
1921 | } | ||
1922 | #endif | ||
1923 | } | ||
1924 | } | ||
1925 | |||
1926 | #ifdef DEBUG_SLEEP | ||
1927 | /* N.B. This doesn't work on the 3400 */ | ||
1928 | void | ||
1929 | pmu_blink(int n) | ||
1930 | { | ||
1931 | struct adb_request req; | ||
1932 | |||
1933 | memset(&req, 0, sizeof(req)); | ||
1934 | |||
1935 | for (; n > 0; --n) { | ||
1936 | req.nbytes = 4; | ||
1937 | req.done = NULL; | ||
1938 | req.data[0] = 0xee; | ||
1939 | req.data[1] = 4; | ||
1940 | req.data[2] = 0; | ||
1941 | req.data[3] = 1; | ||
1942 | req.reply[0] = ADB_RET_OK; | ||
1943 | req.reply_len = 1; | ||
1944 | req.reply_expected = 0; | ||
1945 | pmu_polled_request(&req); | ||
1946 | mdelay(50); | ||
1947 | req.nbytes = 4; | ||
1948 | req.done = NULL; | ||
1949 | req.data[0] = 0xee; | ||
1950 | req.data[1] = 4; | ||
1951 | req.data[2] = 0; | ||
1952 | req.data[3] = 0; | ||
1953 | req.reply[0] = ADB_RET_OK; | ||
1954 | req.reply_len = 1; | ||
1955 | req.reply_expected = 0; | ||
1956 | pmu_polled_request(&req); | ||
1957 | mdelay(50); | ||
1958 | } | ||
1959 | mdelay(50); | ||
1960 | } | ||
1961 | #endif | ||
1962 | |||
1963 | /* | 1717 | /* |
1964 | * Put the powerbook to sleep. | 1718 | * Put the powerbook to sleep. |
1965 | */ | 1719 | */ |
@@ -1994,134 +1748,6 @@ restore_via_state(void) | |||
1994 | out_8(&via[IER], IER_SET | SR_INT | CB1_INT); | 1748 | out_8(&via[IER], IER_SET | SR_INT | CB1_INT); |
1995 | } | 1749 | } |
1996 | 1750 | ||
1997 | extern void pmu_backlight_set_sleep(int sleep); | ||
1998 | |||
1999 | static int | ||
2000 | pmac_suspend_devices(void) | ||
2001 | { | ||
2002 | int ret; | ||
2003 | |||
2004 | pm_prepare_console(); | ||
2005 | |||
2006 | /* Notify old-style device drivers */ | ||
2007 | broadcast_sleep(PBOOK_SLEEP_REQUEST); | ||
2008 | |||
2009 | /* Sync the disks. */ | ||
2010 | /* XXX It would be nice to have some way to ensure that | ||
2011 | * nobody is dirtying any new buffers while we wait. That | ||
2012 | * could be achieved using the refrigerator for processes | ||
2013 | * that swsusp uses | ||
2014 | */ | ||
2015 | sys_sync(); | ||
2016 | |||
2017 | broadcast_sleep(PBOOK_SLEEP_NOW); | ||
2018 | |||
2019 | /* Send suspend call to devices, hold the device core's dpm_sem */ | ||
2020 | ret = device_suspend(PMSG_SUSPEND); | ||
2021 | if (ret) { | ||
2022 | broadcast_wake(); | ||
2023 | printk(KERN_ERR "Driver sleep failed\n"); | ||
2024 | return -EBUSY; | ||
2025 | } | ||
2026 | |||
2027 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2028 | /* Tell backlight code not to muck around with the chip anymore */ | ||
2029 | pmu_backlight_set_sleep(1); | ||
2030 | #endif | ||
2031 | |||
2032 | /* Call platform functions marked "on sleep" */ | ||
2033 | pmac_pfunc_i2c_suspend(); | ||
2034 | pmac_pfunc_base_suspend(); | ||
2035 | |||
2036 | /* Stop preemption */ | ||
2037 | preempt_disable(); | ||
2038 | |||
2039 | /* Make sure the decrementer won't interrupt us */ | ||
2040 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
2041 | /* Make sure any pending DEC interrupt occurring while we did | ||
2042 | * the above didn't re-enable the DEC */ | ||
2043 | mb(); | ||
2044 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
2045 | |||
2046 | /* We can now disable MSR_EE. This code of course works properly only | ||
2047 | * on UP machines... For SMP, if we ever implement sleep, we'll have to | ||
2048 | * stop the "other" CPUs way before we do all that stuff. | ||
2049 | */ | ||
2050 | local_irq_disable(); | ||
2051 | |||
2052 | /* Broadcast power down irq | ||
2053 | * This isn't that useful in most cases (only directly wired devices can | ||
2054 | * use this but still... This will take care of sysdev's as well, so | ||
2055 | * we exit from here with local irqs disabled and PIC off. | ||
2056 | */ | ||
2057 | ret = device_power_down(PMSG_SUSPEND); | ||
2058 | if (ret) { | ||
2059 | wakeup_decrementer(); | ||
2060 | local_irq_enable(); | ||
2061 | preempt_enable(); | ||
2062 | device_resume(); | ||
2063 | broadcast_wake(); | ||
2064 | printk(KERN_ERR "Driver powerdown failed\n"); | ||
2065 | return -EBUSY; | ||
2066 | } | ||
2067 | |||
2068 | /* Wait for completion of async requests */ | ||
2069 | while (!batt_req.complete) | ||
2070 | pmu_poll(); | ||
2071 | |||
2072 | /* Giveup the lazy FPU & vec so we don't have to back them | ||
2073 | * up from the low level code | ||
2074 | */ | ||
2075 | enable_kernel_fp(); | ||
2076 | |||
2077 | #ifdef CONFIG_ALTIVEC | ||
2078 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | ||
2079 | enable_kernel_altivec(); | ||
2080 | #endif /* CONFIG_ALTIVEC */ | ||
2081 | |||
2082 | return 0; | ||
2083 | } | ||
2084 | |||
2085 | static int | ||
2086 | pmac_wakeup_devices(void) | ||
2087 | { | ||
2088 | mdelay(100); | ||
2089 | |||
2090 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2091 | /* Tell backlight code it can use the chip again */ | ||
2092 | pmu_backlight_set_sleep(0); | ||
2093 | #endif | ||
2094 | |||
2095 | /* Power back up system devices (including the PIC) */ | ||
2096 | device_power_up(); | ||
2097 | |||
2098 | /* Force a poll of ADB interrupts */ | ||
2099 | adb_int_pending = 1; | ||
2100 | via_pmu_interrupt(0, NULL); | ||
2101 | |||
2102 | /* Restart jiffies & scheduling */ | ||
2103 | wakeup_decrementer(); | ||
2104 | |||
2105 | /* Re-enable local CPU interrupts */ | ||
2106 | local_irq_enable(); | ||
2107 | mdelay(10); | ||
2108 | preempt_enable(); | ||
2109 | |||
2110 | /* Call platform functions marked "on wake" */ | ||
2111 | pmac_pfunc_base_resume(); | ||
2112 | pmac_pfunc_i2c_resume(); | ||
2113 | |||
2114 | /* Resume devices */ | ||
2115 | device_resume(); | ||
2116 | |||
2117 | /* Notify old style drivers */ | ||
2118 | broadcast_wake(); | ||
2119 | |||
2120 | pm_restore_console(); | ||
2121 | |||
2122 | return 0; | ||
2123 | } | ||
2124 | |||
2125 | #define GRACKLE_PM (1<<7) | 1751 | #define GRACKLE_PM (1<<7) |
2126 | #define GRACKLE_DOZE (1<<5) | 1752 | #define GRACKLE_DOZE (1<<5) |
2127 | #define GRACKLE_NAP (1<<4) | 1753 | #define GRACKLE_NAP (1<<4) |
@@ -2132,19 +1758,12 @@ static int powerbook_sleep_grackle(void) | |||
2132 | unsigned long save_l2cr; | 1758 | unsigned long save_l2cr; |
2133 | unsigned short pmcr1; | 1759 | unsigned short pmcr1; |
2134 | struct adb_request req; | 1760 | struct adb_request req; |
2135 | int ret; | ||
2136 | struct pci_dev *grackle; | 1761 | struct pci_dev *grackle; |
2137 | 1762 | ||
2138 | grackle = pci_get_bus_and_slot(0, 0); | 1763 | grackle = pci_get_bus_and_slot(0, 0); |
2139 | if (!grackle) | 1764 | if (!grackle) |
2140 | return -ENODEV; | 1765 | return -ENODEV; |
2141 | 1766 | ||
2142 | ret = pmac_suspend_devices(); | ||
2143 | if (ret) { | ||
2144 | printk(KERN_ERR "Sleep rejected by devices\n"); | ||
2145 | return ret; | ||
2146 | } | ||
2147 | |||
2148 | /* Turn off various things. Darwin does some retry tests here... */ | 1767 | /* Turn off various things. Darwin does some retry tests here... */ |
2149 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE); | 1768 | pmu_request(&req, NULL, 2, PMU_POWER_CTRL0, PMU_POW0_OFF|PMU_POW0_HARD_DRIVE); |
2150 | pmu_wait_complete(&req); | 1769 | pmu_wait_complete(&req); |
@@ -2207,8 +1826,6 @@ static int powerbook_sleep_grackle(void) | |||
2207 | PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY); | 1826 | PMU_POW_ON|PMU_POW_BACKLIGHT|PMU_POW_CHARGER|PMU_POW_IRLED|PMU_POW_MEDIABAY); |
2208 | pmu_wait_complete(&req); | 1827 | pmu_wait_complete(&req); |
2209 | 1828 | ||
2210 | pmac_wakeup_devices(); | ||
2211 | |||
2212 | return 0; | 1829 | return 0; |
2213 | } | 1830 | } |
2214 | 1831 | ||
@@ -2218,7 +1835,6 @@ powerbook_sleep_Core99(void) | |||
2218 | unsigned long save_l2cr; | 1835 | unsigned long save_l2cr; |
2219 | unsigned long save_l3cr; | 1836 | unsigned long save_l3cr; |
2220 | struct adb_request req; | 1837 | struct adb_request req; |
2221 | int ret; | ||
2222 | 1838 | ||
2223 | if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) { | 1839 | if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) { |
2224 | printk(KERN_ERR "Sleep mode not supported on this machine\n"); | 1840 | printk(KERN_ERR "Sleep mode not supported on this machine\n"); |
@@ -2228,12 +1844,6 @@ powerbook_sleep_Core99(void) | |||
2228 | if (num_online_cpus() > 1 || cpu_is_offline(0)) | 1844 | if (num_online_cpus() > 1 || cpu_is_offline(0)) |
2229 | return -EAGAIN; | 1845 | return -EAGAIN; |
2230 | 1846 | ||
2231 | ret = pmac_suspend_devices(); | ||
2232 | if (ret) { | ||
2233 | printk(KERN_ERR "Sleep rejected by devices\n"); | ||
2234 | return ret; | ||
2235 | } | ||
2236 | |||
2237 | /* Stop environment and ADB interrupts */ | 1847 | /* Stop environment and ADB interrupts */ |
2238 | pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0); | 1848 | pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, 0); |
2239 | pmu_wait_complete(&req); | 1849 | pmu_wait_complete(&req); |
@@ -2304,45 +1914,33 @@ powerbook_sleep_Core99(void) | |||
2304 | /* Restore LPJ, cpufreq will adjust the cpu frequency */ | 1914 | /* Restore LPJ, cpufreq will adjust the cpu frequency */ |
2305 | loops_per_jiffy /= 2; | 1915 | loops_per_jiffy /= 2; |
2306 | 1916 | ||
2307 | pmac_wakeup_devices(); | ||
2308 | |||
2309 | return 0; | 1917 | return 0; |
2310 | } | 1918 | } |
2311 | 1919 | ||
2312 | #define PB3400_MEM_CTRL 0xf8000000 | 1920 | #define PB3400_MEM_CTRL 0xf8000000 |
2313 | #define PB3400_MEM_CTRL_SLEEP 0x70 | 1921 | #define PB3400_MEM_CTRL_SLEEP 0x70 |
2314 | 1922 | ||
2315 | static int | 1923 | static void __iomem *pb3400_mem_ctrl; |
2316 | powerbook_sleep_3400(void) | 1924 | |
1925 | static void powerbook_sleep_init_3400(void) | ||
1926 | { | ||
1927 | /* map in the memory controller registers */ | ||
1928 | pb3400_mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100); | ||
1929 | if (pb3400_mem_ctrl == NULL) | ||
1930 | printk(KERN_WARNING "ioremap failed: sleep won't be possible"); | ||
1931 | } | ||
1932 | |||
1933 | static int powerbook_sleep_3400(void) | ||
2317 | { | 1934 | { |
2318 | int ret, i, x; | 1935 | int i, x; |
2319 | unsigned int hid0; | 1936 | unsigned int hid0; |
2320 | unsigned long p; | 1937 | unsigned long msr; |
2321 | struct adb_request sleep_req; | 1938 | struct adb_request sleep_req; |
2322 | void __iomem *mem_ctrl; | ||
2323 | unsigned int __iomem *mem_ctrl_sleep; | 1939 | unsigned int __iomem *mem_ctrl_sleep; |
2324 | 1940 | ||
2325 | /* first map in the memory controller registers */ | 1941 | if (pb3400_mem_ctrl == NULL) |
2326 | mem_ctrl = ioremap(PB3400_MEM_CTRL, 0x100); | ||
2327 | if (mem_ctrl == NULL) { | ||
2328 | printk("powerbook_sleep_3400: ioremap failed\n"); | ||
2329 | return -ENOMEM; | 1942 | return -ENOMEM; |
2330 | } | 1943 | mem_ctrl_sleep = pb3400_mem_ctrl + PB3400_MEM_CTRL_SLEEP; |
2331 | mem_ctrl_sleep = mem_ctrl + PB3400_MEM_CTRL_SLEEP; | ||
2332 | |||
2333 | /* Allocate room for PCI save */ | ||
2334 | pbook_alloc_pci_save(); | ||
2335 | |||
2336 | ret = pmac_suspend_devices(); | ||
2337 | if (ret) { | ||
2338 | pbook_free_pci_save(); | ||
2339 | iounmap(mem_ctrl); | ||
2340 | printk(KERN_ERR "Sleep rejected by devices\n"); | ||
2341 | return ret; | ||
2342 | } | ||
2343 | |||
2344 | /* Save the state of PCI config space for some slots */ | ||
2345 | pbook_pci_save(); | ||
2346 | 1944 | ||
2347 | /* Set the memory controller to keep the memory refreshed | 1945 | /* Set the memory controller to keep the memory refreshed |
2348 | while we're asleep */ | 1946 | while we're asleep */ |
@@ -2357,41 +1955,34 @@ powerbook_sleep_3400(void) | |||
2357 | 1955 | ||
2358 | /* Ask the PMU to put us to sleep */ | 1956 | /* Ask the PMU to put us to sleep */ |
2359 | pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); | 1957 | pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); |
2360 | while (!sleep_req.complete) | 1958 | pmu_wait_complete(&sleep_req); |
2361 | mb(); | 1959 | pmu_unlock(); |
2362 | 1960 | ||
2363 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,1); | 1961 | pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, 1); |
2364 | 1962 | ||
2365 | /* displacement-flush the L2 cache - necessary? */ | ||
2366 | for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000) | ||
2367 | i = *(volatile int *)p; | ||
2368 | asleep = 1; | 1963 | asleep = 1; |
2369 | 1964 | ||
2370 | /* Put the CPU into sleep mode */ | 1965 | /* Put the CPU into sleep mode */ |
2371 | hid0 = mfspr(SPRN_HID0); | 1966 | hid0 = mfspr(SPRN_HID0); |
2372 | hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP; | 1967 | hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP; |
2373 | mtspr(SPRN_HID0, hid0); | 1968 | mtspr(SPRN_HID0, hid0); |
2374 | mtmsr(mfmsr() | MSR_POW | MSR_EE); | 1969 | local_irq_enable(); |
2375 | udelay(10); | 1970 | msr = mfmsr() | MSR_POW; |
1971 | while (asleep) { | ||
1972 | mb(); | ||
1973 | mtmsr(msr); | ||
1974 | isync(); | ||
1975 | } | ||
1976 | local_irq_disable(); | ||
2376 | 1977 | ||
2377 | /* OK, we're awake again, start restoring things */ | 1978 | /* OK, we're awake again, start restoring things */ |
2378 | out_be32(mem_ctrl_sleep, 0x3f); | 1979 | out_be32(mem_ctrl_sleep, 0x3f); |
2379 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,0); | 1980 | pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, 0); |
2380 | pbook_pci_restore(); | ||
2381 | pmu_unlock(); | ||
2382 | |||
2383 | /* wait for the PMU interrupt sequence to complete */ | ||
2384 | while (asleep) | ||
2385 | mb(); | ||
2386 | |||
2387 | pmac_wakeup_devices(); | ||
2388 | pbook_free_pci_save(); | ||
2389 | iounmap(mem_ctrl); | ||
2390 | 1981 | ||
2391 | return 0; | 1982 | return 0; |
2392 | } | 1983 | } |
2393 | 1984 | ||
2394 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | 1985 | #endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ |
2395 | 1986 | ||
2396 | /* | 1987 | /* |
2397 | * Support for /dev/pmu device | 1988 | * Support for /dev/pmu device |
@@ -2548,7 +2139,6 @@ pmu_release(struct inode *inode, struct file *file) | |||
2548 | struct pmu_private *pp = file->private_data; | 2139 | struct pmu_private *pp = file->private_data; |
2549 | unsigned long flags; | 2140 | unsigned long flags; |
2550 | 2141 | ||
2551 | lock_kernel(); | ||
2552 | if (pp != 0) { | 2142 | if (pp != 0) { |
2553 | file->private_data = NULL; | 2143 | file->private_data = NULL; |
2554 | spin_lock_irqsave(&all_pvt_lock, flags); | 2144 | spin_lock_irqsave(&all_pvt_lock, flags); |
@@ -2562,10 +2152,96 @@ pmu_release(struct inode *inode, struct file *file) | |||
2562 | 2152 | ||
2563 | kfree(pp); | 2153 | kfree(pp); |
2564 | } | 2154 | } |
2565 | unlock_kernel(); | ||
2566 | return 0; | 2155 | return 0; |
2567 | } | 2156 | } |
2568 | 2157 | ||
2158 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) | ||
2159 | static void pmac_suspend_disable_irqs(void) | ||
2160 | { | ||
2161 | /* Call platform functions marked "on sleep" */ | ||
2162 | pmac_pfunc_i2c_suspend(); | ||
2163 | pmac_pfunc_base_suspend(); | ||
2164 | } | ||
2165 | |||
2166 | static int powerbook_sleep(suspend_state_t state) | ||
2167 | { | ||
2168 | int error = 0; | ||
2169 | |||
2170 | /* Wait for completion of async requests */ | ||
2171 | while (!batt_req.complete) | ||
2172 | pmu_poll(); | ||
2173 | |||
2174 | /* Giveup the lazy FPU & vec so we don't have to back them | ||
2175 | * up from the low level code | ||
2176 | */ | ||
2177 | enable_kernel_fp(); | ||
2178 | |||
2179 | #ifdef CONFIG_ALTIVEC | ||
2180 | if (cpu_has_feature(CPU_FTR_ALTIVEC)) | ||
2181 | enable_kernel_altivec(); | ||
2182 | #endif /* CONFIG_ALTIVEC */ | ||
2183 | |||
2184 | switch (pmu_kind) { | ||
2185 | case PMU_OHARE_BASED: | ||
2186 | error = powerbook_sleep_3400(); | ||
2187 | break; | ||
2188 | case PMU_HEATHROW_BASED: | ||
2189 | case PMU_PADDINGTON_BASED: | ||
2190 | error = powerbook_sleep_grackle(); | ||
2191 | break; | ||
2192 | case PMU_KEYLARGO_BASED: | ||
2193 | error = powerbook_sleep_Core99(); | ||
2194 | break; | ||
2195 | default: | ||
2196 | return -ENOSYS; | ||
2197 | } | ||
2198 | |||
2199 | if (error) | ||
2200 | return error; | ||
2201 | |||
2202 | mdelay(100); | ||
2203 | |||
2204 | return 0; | ||
2205 | } | ||
2206 | |||
2207 | static void pmac_suspend_enable_irqs(void) | ||
2208 | { | ||
2209 | /* Force a poll of ADB interrupts */ | ||
2210 | adb_int_pending = 1; | ||
2211 | via_pmu_interrupt(0, NULL); | ||
2212 | |||
2213 | mdelay(10); | ||
2214 | |||
2215 | /* Call platform functions marked "on wake" */ | ||
2216 | pmac_pfunc_base_resume(); | ||
2217 | pmac_pfunc_i2c_resume(); | ||
2218 | } | ||
2219 | |||
2220 | static int pmu_sleep_valid(suspend_state_t state) | ||
2221 | { | ||
2222 | return state == PM_SUSPEND_MEM | ||
2223 | && (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) >= 0); | ||
2224 | } | ||
2225 | |||
2226 | static struct platform_suspend_ops pmu_pm_ops = { | ||
2227 | .enter = powerbook_sleep, | ||
2228 | .valid = pmu_sleep_valid, | ||
2229 | }; | ||
2230 | |||
2231 | static int register_pmu_pm_ops(void) | ||
2232 | { | ||
2233 | if (pmu_kind == PMU_OHARE_BASED) | ||
2234 | powerbook_sleep_init_3400(); | ||
2235 | ppc_md.suspend_disable_irqs = pmac_suspend_disable_irqs; | ||
2236 | ppc_md.suspend_enable_irqs = pmac_suspend_enable_irqs; | ||
2237 | suspend_set_ops(&pmu_pm_ops); | ||
2238 | |||
2239 | return 0; | ||
2240 | } | ||
2241 | |||
2242 | device_initcall(register_pmu_pm_ops); | ||
2243 | #endif | ||
2244 | |||
2569 | static int | 2245 | static int |
2570 | pmu_ioctl(struct inode * inode, struct file *filp, | 2246 | pmu_ioctl(struct inode * inode, struct file *filp, |
2571 | u_int cmd, u_long arg) | 2247 | u_int cmd, u_long arg) |
@@ -2574,35 +2250,15 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
2574 | int error = -EINVAL; | 2250 | int error = -EINVAL; |
2575 | 2251 | ||
2576 | switch (cmd) { | 2252 | switch (cmd) { |
2577 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | ||
2578 | case PMU_IOC_SLEEP: | 2253 | case PMU_IOC_SLEEP: |
2579 | if (!capable(CAP_SYS_ADMIN)) | 2254 | if (!capable(CAP_SYS_ADMIN)) |
2580 | return -EACCES; | 2255 | return -EACCES; |
2581 | if (sleep_in_progress) | 2256 | return pm_suspend(PM_SUSPEND_MEM); |
2582 | return -EBUSY; | ||
2583 | sleep_in_progress = 1; | ||
2584 | switch (pmu_kind) { | ||
2585 | case PMU_OHARE_BASED: | ||
2586 | error = powerbook_sleep_3400(); | ||
2587 | break; | ||
2588 | case PMU_HEATHROW_BASED: | ||
2589 | case PMU_PADDINGTON_BASED: | ||
2590 | error = powerbook_sleep_grackle(); | ||
2591 | break; | ||
2592 | case PMU_KEYLARGO_BASED: | ||
2593 | error = powerbook_sleep_Core99(); | ||
2594 | break; | ||
2595 | default: | ||
2596 | error = -ENOSYS; | ||
2597 | } | ||
2598 | sleep_in_progress = 0; | ||
2599 | break; | ||
2600 | case PMU_IOC_CAN_SLEEP: | 2257 | case PMU_IOC_CAN_SLEEP: |
2601 | if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0) | 2258 | if (pmac_call_feature(PMAC_FTR_SLEEP_STATE, NULL, 0, -1) < 0) |
2602 | return put_user(0, argp); | 2259 | return put_user(0, argp); |
2603 | else | 2260 | else |
2604 | return put_user(1, argp); | 2261 | return put_user(1, argp); |
2605 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | ||
2606 | 2262 | ||
2607 | #ifdef CONFIG_PMAC_BACKLIGHT_LEGACY | 2263 | #ifdef CONFIG_PMAC_BACKLIGHT_LEGACY |
2608 | /* Compatibility ioctl's for backlight */ | 2264 | /* Compatibility ioctl's for backlight */ |
@@ -2610,9 +2266,6 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
2610 | { | 2266 | { |
2611 | int brightness; | 2267 | int brightness; |
2612 | 2268 | ||
2613 | if (sleep_in_progress) | ||
2614 | return -EBUSY; | ||
2615 | |||
2616 | brightness = pmac_backlight_get_legacy_brightness(); | 2269 | brightness = pmac_backlight_get_legacy_brightness(); |
2617 | if (brightness < 0) | 2270 | if (brightness < 0) |
2618 | return brightness; | 2271 | return brightness; |
@@ -2624,9 +2277,6 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
2624 | { | 2277 | { |
2625 | int brightness; | 2278 | int brightness; |
2626 | 2279 | ||
2627 | if (sleep_in_progress) | ||
2628 | return -EBUSY; | ||
2629 | |||
2630 | error = get_user(brightness, argp); | 2280 | error = get_user(brightness, argp); |
2631 | if (error) | 2281 | if (error) |
2632 | return error; | 2282 | return error; |
@@ -2751,15 +2401,43 @@ pmu_polled_request(struct adb_request *req) | |||
2751 | local_irq_restore(flags); | 2401 | local_irq_restore(flags); |
2752 | return 0; | 2402 | return 0; |
2753 | } | 2403 | } |
2754 | #endif /* DEBUG_SLEEP */ | ||
2755 | 2404 | ||
2405 | /* N.B. This doesn't work on the 3400 */ | ||
2406 | void pmu_blink(int n) | ||
2407 | { | ||
2408 | struct adb_request req; | ||
2756 | 2409 | ||
2757 | /* FIXME: This is a temporary set of callbacks to enable us | 2410 | memset(&req, 0, sizeof(req)); |
2758 | * to do suspend-to-disk. | ||
2759 | */ | ||
2760 | 2411 | ||
2761 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 2412 | for (; n > 0; --n) { |
2413 | req.nbytes = 4; | ||
2414 | req.done = NULL; | ||
2415 | req.data[0] = 0xee; | ||
2416 | req.data[1] = 4; | ||
2417 | req.data[2] = 0; | ||
2418 | req.data[3] = 1; | ||
2419 | req.reply[0] = ADB_RET_OK; | ||
2420 | req.reply_len = 1; | ||
2421 | req.reply_expected = 0; | ||
2422 | pmu_polled_request(&req); | ||
2423 | mdelay(50); | ||
2424 | req.nbytes = 4; | ||
2425 | req.done = NULL; | ||
2426 | req.data[0] = 0xee; | ||
2427 | req.data[1] = 4; | ||
2428 | req.data[2] = 0; | ||
2429 | req.data[3] = 0; | ||
2430 | req.reply[0] = ADB_RET_OK; | ||
2431 | req.reply_len = 1; | ||
2432 | req.reply_expected = 0; | ||
2433 | pmu_polled_request(&req); | ||
2434 | mdelay(50); | ||
2435 | } | ||
2436 | mdelay(50); | ||
2437 | } | ||
2438 | #endif /* DEBUG_SLEEP */ | ||
2762 | 2439 | ||
2440 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) | ||
2763 | int pmu_sys_suspended; | 2441 | int pmu_sys_suspended; |
2764 | 2442 | ||
2765 | static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) | 2443 | static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) |
@@ -2767,10 +2445,15 @@ static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) | |||
2767 | if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended) | 2445 | if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended) |
2768 | return 0; | 2446 | return 0; |
2769 | 2447 | ||
2770 | /* Suspend PMU event interrupts */ | 2448 | /* Suspend PMU event interrupts */\ |
2771 | pmu_suspend(); | 2449 | pmu_suspend(); |
2772 | |||
2773 | pmu_sys_suspended = 1; | 2450 | pmu_sys_suspended = 1; |
2451 | |||
2452 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2453 | /* Tell backlight code not to muck around with the chip anymore */ | ||
2454 | pmu_backlight_set_sleep(1); | ||
2455 | #endif | ||
2456 | |||
2774 | return 0; | 2457 | return 0; |
2775 | } | 2458 | } |
2776 | 2459 | ||
@@ -2785,15 +2468,18 @@ static int pmu_sys_resume(struct sys_device *sysdev) | |||
2785 | pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); | 2468 | pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); |
2786 | pmu_wait_complete(&req); | 2469 | pmu_wait_complete(&req); |
2787 | 2470 | ||
2471 | #ifdef CONFIG_PMAC_BACKLIGHT | ||
2472 | /* Tell backlight code it can use the chip again */ | ||
2473 | pmu_backlight_set_sleep(0); | ||
2474 | #endif | ||
2788 | /* Resume PMU event interrupts */ | 2475 | /* Resume PMU event interrupts */ |
2789 | pmu_resume(); | 2476 | pmu_resume(); |
2790 | |||
2791 | pmu_sys_suspended = 0; | 2477 | pmu_sys_suspended = 0; |
2792 | 2478 | ||
2793 | return 0; | 2479 | return 0; |
2794 | } | 2480 | } |
2795 | 2481 | ||
2796 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | 2482 | #endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ |
2797 | 2483 | ||
2798 | static struct sysdev_class pmu_sysclass = { | 2484 | static struct sysdev_class pmu_sysclass = { |
2799 | .name = "pmu", | 2485 | .name = "pmu", |
@@ -2804,10 +2490,10 @@ static struct sys_device device_pmu = { | |||
2804 | }; | 2490 | }; |
2805 | 2491 | ||
2806 | static struct sysdev_driver driver_pmu = { | 2492 | static struct sysdev_driver driver_pmu = { |
2807 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 2493 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
2808 | .suspend = &pmu_sys_suspend, | 2494 | .suspend = &pmu_sys_suspend, |
2809 | .resume = &pmu_sys_resume, | 2495 | .resume = &pmu_sys_resume, |
2810 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | 2496 | #endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ |
2811 | }; | 2497 | }; |
2812 | 2498 | ||
2813 | static int __init init_pmu_sysfs(void) | 2499 | static int __init init_pmu_sysfs(void) |
@@ -2842,10 +2528,10 @@ EXPORT_SYMBOL(pmu_wait_complete); | |||
2842 | EXPORT_SYMBOL(pmu_suspend); | 2528 | EXPORT_SYMBOL(pmu_suspend); |
2843 | EXPORT_SYMBOL(pmu_resume); | 2529 | EXPORT_SYMBOL(pmu_resume); |
2844 | EXPORT_SYMBOL(pmu_unlock); | 2530 | EXPORT_SYMBOL(pmu_unlock); |
2845 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) | 2531 | #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) |
2846 | EXPORT_SYMBOL(pmu_enable_irled); | 2532 | EXPORT_SYMBOL(pmu_enable_irled); |
2847 | EXPORT_SYMBOL(pmu_battery_count); | 2533 | EXPORT_SYMBOL(pmu_battery_count); |
2848 | EXPORT_SYMBOL(pmu_batteries); | 2534 | EXPORT_SYMBOL(pmu_batteries); |
2849 | EXPORT_SYMBOL(pmu_power_flags); | 2535 | EXPORT_SYMBOL(pmu_power_flags); |
2850 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ | 2536 | #endif /* CONFIG_SUSPEND && CONFIG_PPC32 */ |
2851 | 2537 | ||