aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/adb.c5
-rw-r--r--drivers/macintosh/adbhid.c2
-rw-r--r--drivers/macintosh/macio_sysfs.c12
-rw-r--r--drivers/macintosh/mediabay.c27
-rw-r--r--drivers/macintosh/smu.c38
-rw-r--r--drivers/macintosh/therm_adt746x.c2
-rw-r--r--drivers/macintosh/therm_pm72.c4
-rw-r--r--drivers/macintosh/therm_windtunnel.c18
-rw-r--r--drivers/macintosh/via-pmu68k.c5
9 files changed, 63 insertions, 50 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 40c70ba62bf0..e5d446804d32 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -46,7 +46,6 @@
46#endif 46#endif
47 47
48 48
49EXPORT_SYMBOL(adb_controller);
50EXPORT_SYMBOL(adb_client_list); 49EXPORT_SYMBOL(adb_client_list);
51 50
52extern struct adb_driver via_macii_driver; 51extern struct adb_driver via_macii_driver;
@@ -80,7 +79,7 @@ static struct adb_driver *adb_driver_list[] = {
80 79
81static struct class *adb_dev_class; 80static struct class *adb_dev_class;
82 81
83struct adb_driver *adb_controller; 82static struct adb_driver *adb_controller;
84BLOCKING_NOTIFIER_HEAD(adb_client_list); 83BLOCKING_NOTIFIER_HEAD(adb_client_list);
85static int adb_got_sleep; 84static int adb_got_sleep;
86static int adb_inited; 85static int adb_inited;
@@ -290,7 +289,7 @@ static int adb_resume(struct platform_device *dev)
290} 289}
291#endif /* CONFIG_PM */ 290#endif /* CONFIG_PM */
292 291
293int __init adb_init(void) 292static int __init adb_init(void)
294{ 293{
295 struct adb_driver *driver; 294 struct adb_driver *driver;
296 int i; 295 int i;
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index ef4c117ea35f..59ea520a5d7a 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -75,7 +75,7 @@ static struct notifier_block adbhid_adb_notifier = {
75#define ADB_KEY_POWER_OLD 0x7e 75#define ADB_KEY_POWER_OLD 0x7e
76#define ADB_KEY_POWER 0x7f 76#define ADB_KEY_POWER 0x7f
77 77
78u16 adb_to_linux_keycodes[128] = { 78static const u16 adb_to_linux_keycodes[128] = {
79 /* 0x00 */ KEY_A, /* 30 */ 79 /* 0x00 */ KEY_A, /* 30 */
80 /* 0x01 */ KEY_S, /* 31 */ 80 /* 0x01 */ KEY_S, /* 31 */
81 /* 0x02 */ KEY_D, /* 32 */ 81 /* 0x02 */ KEY_D, /* 32 */
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 112e5ef728f1..9e9453b58425 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -44,7 +44,7 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
44 struct of_device *ofdev = to_of_device(dev); 44 struct of_device *ofdev = to_of_device(dev);
45 int len; 45 int len;
46 46
47 len = of_device_get_modalias(ofdev, buf, PAGE_SIZE); 47 len = of_device_get_modalias(ofdev, buf, PAGE_SIZE - 2);
48 48
49 buf[len] = '\n'; 49 buf[len] = '\n';
50 buf[len+1] = 0; 50 buf[len+1] = 0;
@@ -52,6 +52,15 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
52 return len+1; 52 return len+1;
53} 53}
54 54
55static ssize_t devspec_show(struct device *dev,
56 struct device_attribute *attr, char *buf)
57{
58 struct of_device *ofdev;
59
60 ofdev = to_of_device(dev);
61 return sprintf(buf, "%s\n", ofdev->node->full_name);
62}
63
55macio_config_of_attr (name, "%s\n"); 64macio_config_of_attr (name, "%s\n");
56macio_config_of_attr (type, "%s\n"); 65macio_config_of_attr (type, "%s\n");
57 66
@@ -60,5 +69,6 @@ struct device_attribute macio_dev_attrs[] = {
60 __ATTR_RO(type), 69 __ATTR_RO(type),
61 __ATTR_RO(compatible), 70 __ATTR_RO(compatible),
62 __ATTR_RO(modalias), 71 __ATTR_RO(modalias),
72 __ATTR_RO(devspec),
63 __ATTR_NULL 73 __ATTR_NULL
64}; 74};
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 818aba368541..b1e5b4705250 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -21,6 +21,7 @@
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 <linux/kthread.h>
24#include <linux/mutex.h>
24#include <asm/prom.h> 25#include <asm/prom.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/io.h> 27#include <asm/io.h>
@@ -77,7 +78,7 @@ struct media_bay_info {
77 int index; 78 int index;
78 int cached_gpio; 79 int cached_gpio;
79 int sleeping; 80 int sleeping;
80 struct semaphore lock; 81 struct mutex lock;
81#ifdef CONFIG_BLK_DEV_IDE_PMAC 82#ifdef CONFIG_BLK_DEV_IDE_PMAC
82 ide_hwif_t *cd_port; 83 ide_hwif_t *cd_port;
83 void __iomem *cd_base; 84 void __iomem *cd_base;
@@ -459,27 +460,27 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
459 if (bay->mdev && which_bay == bay->mdev->ofdev.node) { 460 if (bay->mdev && which_bay == bay->mdev->ofdev.node) {
460 int timeout = 5000, index = hwif->index; 461 int timeout = 5000, index = hwif->index;
461 462
462 down(&bay->lock); 463 mutex_lock(&bay->lock);
463 464
464 bay->cd_port = hwif; 465 bay->cd_port = hwif;
465 bay->cd_base = (void __iomem *) base; 466 bay->cd_base = (void __iomem *) base;
466 bay->cd_irq = irq; 467 bay->cd_irq = irq;
467 468
468 if ((MB_CD != bay->content_id) || bay->state != mb_up) { 469 if ((MB_CD != bay->content_id) || bay->state != mb_up) {
469 up(&bay->lock); 470 mutex_unlock(&bay->lock);
470 return 0; 471 return 0;
471 } 472 }
472 printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i); 473 printk(KERN_DEBUG "Registered ide%d for media bay %d\n", index, i);
473 do { 474 do {
474 if (MB_IDE_READY(i)) { 475 if (MB_IDE_READY(i)) {
475 bay->cd_index = index; 476 bay->cd_index = index;
476 up(&bay->lock); 477 mutex_unlock(&bay->lock);
477 return 0; 478 return 0;
478 } 479 }
479 mdelay(1); 480 mdelay(1);
480 } while(--timeout); 481 } while(--timeout);
481 printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i); 482 printk(KERN_DEBUG "Timeount waiting IDE in bay %d\n", i);
482 up(&bay->lock); 483 mutex_unlock(&bay->lock);
483 return -ENODEV; 484 return -ENODEV;
484 } 485 }
485 } 486 }
@@ -617,10 +618,10 @@ static int media_bay_task(void *x)
617 618
618 while (!kthread_should_stop()) { 619 while (!kthread_should_stop()) {
619 for (i = 0; i < media_bay_count; ++i) { 620 for (i = 0; i < media_bay_count; ++i) {
620 down(&media_bays[i].lock); 621 mutex_lock(&media_bays[i].lock);
621 if (!media_bays[i].sleeping) 622 if (!media_bays[i].sleeping)
622 media_bay_step(i); 623 media_bay_step(i);
623 up(&media_bays[i].lock); 624 mutex_unlock(&media_bays[i].lock);
624 } 625 }
625 626
626 msleep_interruptible(MB_POLL_DELAY); 627 msleep_interruptible(MB_POLL_DELAY);
@@ -660,7 +661,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
660 bay->index = i; 661 bay->index = i;
661 bay->ops = match->data; 662 bay->ops = match->data;
662 bay->sleeping = 0; 663 bay->sleeping = 0;
663 init_MUTEX(&bay->lock); 664 mutex_init(&bay->lock);
664 665
665 /* Init HW probing */ 666 /* Init HW probing */
666 if (bay->ops->init) 667 if (bay->ops->init)
@@ -698,10 +699,10 @@ static int media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
698 699
699 if (state.event != mdev->ofdev.dev.power.power_state.event 700 if (state.event != mdev->ofdev.dev.power.power_state.event
700 && (state.event & PM_EVENT_SLEEP)) { 701 && (state.event & PM_EVENT_SLEEP)) {
701 down(&bay->lock); 702 mutex_lock(&bay->lock);
702 bay->sleeping = 1; 703 bay->sleeping = 1;
703 set_mb_power(bay, 0); 704 set_mb_power(bay, 0);
704 up(&bay->lock); 705 mutex_unlock(&bay->lock);
705 msleep(MB_POLL_DELAY); 706 msleep(MB_POLL_DELAY);
706 mdev->ofdev.dev.power.power_state = state; 707 mdev->ofdev.dev.power.power_state = state;
707 } 708 }
@@ -720,12 +721,12 @@ static int media_bay_resume(struct macio_dev *mdev)
720 they seem to help the 3400 get it right. 721 they seem to help the 3400 get it right.
721 */ 722 */
722 /* Force MB power to 0 */ 723 /* Force MB power to 0 */
723 down(&bay->lock); 724 mutex_lock(&bay->lock);
724 set_mb_power(bay, 0); 725 set_mb_power(bay, 0);
725 msleep(MB_POWER_DELAY); 726 msleep(MB_POWER_DELAY);
726 if (bay->ops->content(bay) != bay->content_id) { 727 if (bay->ops->content(bay) != bay->content_id) {
727 printk("mediabay%d: content changed during sleep...\n", bay->index); 728 printk("mediabay%d: content changed during sleep...\n", bay->index);
728 up(&bay->lock); 729 mutex_unlock(&bay->lock);
729 return 0; 730 return 0;
730 } 731 }
731 set_mb_power(bay, 1); 732 set_mb_power(bay, 1);
@@ -741,7 +742,7 @@ static int media_bay_resume(struct macio_dev *mdev)
741 } while((bay->state != mb_empty) && 742 } while((bay->state != mb_empty) &&
742 (bay->state != mb_up)); 743 (bay->state != mb_up));
743 bay->sleeping = 0; 744 bay->sleeping = 0;
744 up(&bay->lock); 745 mutex_unlock(&bay->lock);
745 } 746 }
746 return 0; 747 return 0;
747} 748}
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 32cb0298f88e..96faa799b82a 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -36,6 +36,8 @@
36#include <linux/sysdev.h> 36#include <linux/sysdev.h>
37#include <linux/poll.h> 37#include <linux/poll.h>
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/of_device.h>
40#include <linux/of_platform.h>
39 41
40#include <asm/byteorder.h> 42#include <asm/byteorder.h>
41#include <asm/io.h> 43#include <asm/io.h>
@@ -46,8 +48,6 @@
46#include <asm/sections.h> 48#include <asm/sections.h>
47#include <asm/abs_addr.h> 49#include <asm/abs_addr.h>
48#include <asm/uaccess.h> 50#include <asm/uaccess.h>
49#include <asm/of_device.h>
50#include <asm/of_platform.h>
51 51
52#define VERSION "0.7" 52#define VERSION "0.7"
53#define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp." 53#define AUTHOR "(c) 2005 Benjamin Herrenschmidt, IBM Corp."
@@ -475,6 +475,7 @@ int __init smu_init (void)
475{ 475{
476 struct device_node *np; 476 struct device_node *np;
477 const u32 *data; 477 const u32 *data;
478 int ret = 0;
478 479
479 np = of_find_node_by_type(NULL, "smu"); 480 np = of_find_node_by_type(NULL, "smu");
480 if (np == NULL) 481 if (np == NULL)
@@ -484,16 +485,11 @@ int __init smu_init (void)
484 485
485 if (smu_cmdbuf_abs == 0) { 486 if (smu_cmdbuf_abs == 0) {
486 printk(KERN_ERR "SMU: Command buffer not allocated !\n"); 487 printk(KERN_ERR "SMU: Command buffer not allocated !\n");
487 of_node_put(np); 488 ret = -EINVAL;
488 return -EINVAL; 489 goto fail_np;
489 } 490 }
490 491
491 smu = alloc_bootmem(sizeof(struct smu_device)); 492 smu = alloc_bootmem(sizeof(struct smu_device));
492 if (smu == NULL) {
493 of_node_put(np);
494 return -ENOMEM;
495 }
496 memset(smu, 0, sizeof(*smu));
497 493
498 spin_lock_init(&smu->lock); 494 spin_lock_init(&smu->lock);
499 INIT_LIST_HEAD(&smu->cmd_list); 495 INIT_LIST_HEAD(&smu->cmd_list);
@@ -511,14 +507,14 @@ int __init smu_init (void)
511 smu->db_node = of_find_node_by_name(NULL, "smu-doorbell"); 507 smu->db_node = of_find_node_by_name(NULL, "smu-doorbell");
512 if (smu->db_node == NULL) { 508 if (smu->db_node == NULL) {
513 printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); 509 printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
514 goto fail; 510 ret = -ENXIO;
511 goto fail_bootmem;
515 } 512 }
516 data = of_get_property(smu->db_node, "reg", NULL); 513 data = of_get_property(smu->db_node, "reg", NULL);
517 if (data == NULL) { 514 if (data == NULL) {
518 of_node_put(smu->db_node);
519 smu->db_node = NULL;
520 printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n"); 515 printk(KERN_ERR "SMU: Can't find doorbell GPIO address !\n");
521 goto fail; 516 ret = -ENXIO;
517 goto fail_db_node;
522 } 518 }
523 519
524 /* Current setup has one doorbell GPIO that does both doorbell 520 /* Current setup has one doorbell GPIO that does both doorbell
@@ -552,7 +548,8 @@ int __init smu_init (void)
552 smu->db_buf = ioremap(0x8000860c, 0x1000); 548 smu->db_buf = ioremap(0x8000860c, 0x1000);
553 if (smu->db_buf == NULL) { 549 if (smu->db_buf == NULL) {
554 printk(KERN_ERR "SMU: Can't map doorbell buffer pointer !\n"); 550 printk(KERN_ERR "SMU: Can't map doorbell buffer pointer !\n");
555 goto fail; 551 ret = -ENXIO;
552 goto fail_msg_node;
556 } 553 }
557 554
558 /* U3 has an issue with NAP mode when issuing SMU commands */ 555 /* U3 has an issue with NAP mode when issuing SMU commands */
@@ -563,10 +560,17 @@ int __init smu_init (void)
563 sys_ctrler = SYS_CTRLER_SMU; 560 sys_ctrler = SYS_CTRLER_SMU;
564 return 0; 561 return 0;
565 562
566 fail: 563fail_msg_node:
564 if (smu->msg_node)
565 of_node_put(smu->msg_node);
566fail_db_node:
567 of_node_put(smu->db_node);
568fail_bootmem:
569 free_bootmem((unsigned long)smu, sizeof(struct smu_device));
567 smu = NULL; 570 smu = NULL;
568 return -ENXIO; 571fail_np:
569 572 of_node_put(np);
573 return ret;
570} 574}
571 575
572 576
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index 5366dc93fb38..22bf981d393b 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -24,13 +24,13 @@
24#include <linux/kthread.h> 24#include <linux/kthread.h>
25#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
26#include <linux/freezer.h> 26#include <linux/freezer.h>
27#include <linux/of_platform.h>
27 28
28#include <asm/prom.h> 29#include <asm/prom.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/sections.h> 33#include <asm/sections.h>
33#include <asm/of_platform.h>
34 34
35#undef DEBUG 35#undef DEBUG
36 36
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index ddfb426a9abd..817607e2af6a 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -123,14 +123,14 @@
123#include <linux/i2c.h> 123#include <linux/i2c.h>
124#include <linux/kthread.h> 124#include <linux/kthread.h>
125#include <linux/mutex.h> 125#include <linux/mutex.h>
126#include <linux/of_device.h>
127#include <linux/of_platform.h>
126#include <asm/prom.h> 128#include <asm/prom.h>
127#include <asm/machdep.h> 129#include <asm/machdep.h>
128#include <asm/io.h> 130#include <asm/io.h>
129#include <asm/system.h> 131#include <asm/system.h>
130#include <asm/sections.h> 132#include <asm/sections.h>
131#include <asm/of_device.h>
132#include <asm/macio.h> 133#include <asm/macio.h>
133#include <asm/of_platform.h>
134 134
135#include "therm_pm72.h" 135#include "therm_pm72.h"
136 136
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index d11821af3b8d..3da0a02efd76 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -37,13 +37,13 @@
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#include <linux/kthread.h>
40#include <linux/of_platform.h>
40 41
41#include <asm/prom.h> 42#include <asm/prom.h>
42#include <asm/machdep.h> 43#include <asm/machdep.h>
43#include <asm/io.h> 44#include <asm/io.h>
44#include <asm/system.h> 45#include <asm/system.h>
45#include <asm/sections.h> 46#include <asm/sections.h>
46#include <asm/of_platform.h>
47#include <asm/macio.h> 47#include <asm/macio.h>
48 48
49#define LOG_TEMP 0 /* continously log temperature */ 49#define LOG_TEMP 0 /* continously log temperature */
@@ -62,7 +62,7 @@ static struct {
62 volatile int running; 62 volatile int running;
63 struct task_struct *poll_task; 63 struct task_struct *poll_task;
64 64
65 struct semaphore lock; 65 struct mutex lock;
66 struct of_device *of_dev; 66 struct of_device *of_dev;
67 67
68 struct i2c_client *thermostat; 68 struct i2c_client *thermostat;
@@ -286,23 +286,23 @@ restore_regs( void )
286 286
287static int control_loop(void *dummy) 287static int control_loop(void *dummy)
288{ 288{
289 down(&x.lock); 289 mutex_lock(&x.lock);
290 setup_hardware(); 290 setup_hardware();
291 up(&x.lock); 291 mutex_unlock(&x.lock);
292 292
293 for (;;) { 293 for (;;) {
294 msleep_interruptible(8000); 294 msleep_interruptible(8000);
295 if (kthread_should_stop()) 295 if (kthread_should_stop())
296 break; 296 break;
297 297
298 down(&x.lock); 298 mutex_lock(&x.lock);
299 poll_temp(); 299 poll_temp();
300 up(&x.lock); 300 mutex_unlock(&x.lock);
301 } 301 }
302 302
303 down(&x.lock); 303 mutex_lock(&x.lock);
304 restore_regs(); 304 restore_regs();
305 up(&x.lock); 305 mutex_unlock(&x.lock);
306 306
307 return 0; 307 return 0;
308} 308}
@@ -489,7 +489,7 @@ g4fan_init( void )
489 const struct apple_thermal_info *info; 489 const struct apple_thermal_info *info;
490 struct device_node *np; 490 struct device_node *np;
491 491
492 init_MUTEX( &x.lock ); 492 mutex_init(&x.lock);
493 493
494 if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) 494 if( !(np=of_find_node_by_name(NULL, "power-mgt")) )
495 return -ENODEV; 495 return -ENODEV;
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index e2f84da09e7c..b64741c95ac4 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -101,7 +101,6 @@ static int pmu_kind = PMU_UNKNOWN;
101static int pmu_fully_inited; 101static int pmu_fully_inited;
102 102
103int asleep; 103int asleep;
104BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
105 104
106static int pmu_probe(void); 105static int pmu_probe(void);
107static int pmu_init(void); 106static int pmu_init(void);
@@ -741,8 +740,8 @@ pmu_handle_data(unsigned char *data, int len)
741 } 740 }
742} 741}
743 742
744int backlight_level = -1; 743static int backlight_level = -1;
745int backlight_enabled = 0; 744static int backlight_enabled = 0;
746 745
747#define LEVEL_TO_BRIGHT(lev) ((lev) < 1? 0x7f: 0x4a - ((lev) << 1)) 746#define LEVEL_TO_BRIGHT(lev) ((lev) < 1? 0x7f: 0x4a - ((lev) << 1))
748 747