diff options
| author | Paul Mackerras <paulus@samba.org> | 2007-08-28 01:56:11 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2007-08-28 01:56:11 -0400 |
| commit | 35438c4327df18dbf5e7f597b69299119f4a14de (patch) | |
| tree | a4589d731015db93f2eba8f84ffb1f48a8084020 /drivers/macintosh | |
| parent | 2f6c9d961081dc7b109eb19166244bcb2a5dfc28 (diff) | |
| parent | b07d68b5ca4d55a16fab223d63d5fb36f89ff42f (diff) | |
Merge branch 'linux-2.6' into for-2.6.24
Diffstat (limited to 'drivers/macintosh')
| -rw-r--r-- | drivers/macintosh/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/macintosh/adb.c | 4 | ||||
| -rw-r--r-- | drivers/macintosh/mac_hid.c | 1 | ||||
| -rw-r--r-- | drivers/macintosh/via-pmu.c | 34 | ||||
| -rw-r--r-- | drivers/macintosh/via-pmu68k.c | 240 |
5 files changed, 25 insertions, 259 deletions
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index dbe96268866e..56cd8998fe4b 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
| @@ -3,6 +3,11 @@ menuconfig MACINTOSH_DRIVERS | |||
| 3 | bool "Macintosh device drivers" | 3 | bool "Macintosh device drivers" |
| 4 | depends on PPC || MAC || X86 | 4 | depends on PPC || MAC || X86 |
| 5 | default y if (PPC_PMAC || MAC) | 5 | default y if (PPC_PMAC || MAC) |
| 6 | ---help--- | ||
| 7 | Say Y here to get to see options for devices used with Macintosh | ||
| 8 | computers. This option alone does not add any kernel code. | ||
| 9 | |||
| 10 | If you say N, all options in this submenu will be skipped and disabled. | ||
| 6 | 11 | ||
| 7 | if MACINTOSH_DRIVERS | 12 | if MACINTOSH_DRIVERS |
| 8 | 13 | ||
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index bc77c5e2ca9f..5c742a526082 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
| @@ -89,7 +89,7 @@ static int sleepy_trackpad; | |||
| 89 | static int autopoll_devs; | 89 | static int autopoll_devs; |
| 90 | int __adb_probe_sync; | 90 | int __adb_probe_sync; |
| 91 | 91 | ||
| 92 | #ifdef CONFIG_PM | 92 | #ifdef CONFIG_PM_SLEEP |
| 93 | static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when); | 93 | static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when); |
| 94 | static struct pmu_sleep_notifier adb_sleep_notifier = { | 94 | static struct pmu_sleep_notifier adb_sleep_notifier = { |
| 95 | adb_notify_sleep, | 95 | adb_notify_sleep, |
| @@ -313,7 +313,7 @@ int __init adb_init(void) | |||
| 313 | printk(KERN_WARNING "Warning: no ADB interface detected\n"); | 313 | printk(KERN_WARNING "Warning: no ADB interface detected\n"); |
| 314 | adb_controller = NULL; | 314 | adb_controller = NULL; |
| 315 | } else { | 315 | } else { |
| 316 | #ifdef CONFIG_PM | 316 | #ifdef CONFIG_PM_SLEEP |
| 317 | pmu_register_sleep_notifier(&adb_sleep_notifier); | 317 | pmu_register_sleep_notifier(&adb_sleep_notifier); |
| 318 | #endif /* CONFIG_PM */ | 318 | #endif /* CONFIG_PM */ |
| 319 | #ifdef CONFIG_PPC | 319 | #ifdef CONFIG_PPC |
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 76c1e8e4a487..33dee3a773ed 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/sysctl.h> | 13 | #include <linux/sysctl.h> |
| 14 | #include <linux/input.h> | 14 | #include <linux/input.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/kbd_kern.h> | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | static struct input_dev *emumousebtn; | 19 | static struct input_dev *emumousebtn; |
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 5eee480245f3..f7c509b7a8ea 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c | |||
| @@ -152,10 +152,10 @@ static spinlock_t pmu_lock; | |||
| 152 | static u8 pmu_intr_mask; | 152 | static u8 pmu_intr_mask; |
| 153 | static int pmu_version; | 153 | static int pmu_version; |
| 154 | static int drop_interrupts; | 154 | static int drop_interrupts; |
| 155 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 155 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 156 | static int option_lid_wakeup = 1; | 156 | static int option_lid_wakeup = 1; |
| 157 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 157 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 158 | #if (defined(CONFIG_PM)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY) | 158 | #if (defined(CONFIG_PM_SLEEP)&&defined(CONFIG_PPC32))||defined(CONFIG_PMAC_BACKLIGHT_LEGACY) |
| 159 | static int sleep_in_progress; | 159 | static int sleep_in_progress; |
| 160 | #endif | 160 | #endif |
| 161 | static unsigned long async_req_locks; | 161 | static unsigned long async_req_locks; |
| @@ -875,7 +875,7 @@ proc_read_options(char *page, char **start, off_t off, | |||
| 875 | { | 875 | { |
| 876 | char *p = page; | 876 | char *p = page; |
| 877 | 877 | ||
| 878 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 878 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 879 | if (pmu_kind == PMU_KEYLARGO_BASED && | 879 | if (pmu_kind == PMU_KEYLARGO_BASED && |
| 880 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) | 880 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) |
| 881 | p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); | 881 | p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup); |
| @@ -916,7 +916,7 @@ proc_write_options(struct file *file, const char __user *buffer, | |||
| 916 | *(val++) = 0; | 916 | *(val++) = 0; |
| 917 | while(*val == ' ') | 917 | while(*val == ' ') |
| 918 | val++; | 918 | val++; |
| 919 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 919 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 920 | if (pmu_kind == PMU_KEYLARGO_BASED && | 920 | if (pmu_kind == PMU_KEYLARGO_BASED && |
| 921 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) | 921 | pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0) |
| 922 | if (!strcmp(label, "lid_wakeup")) | 922 | if (!strcmp(label, "lid_wakeup")) |
| @@ -1738,7 +1738,7 @@ pmu_present(void) | |||
| 1738 | return via != 0; | 1738 | return via != 0; |
| 1739 | } | 1739 | } |
| 1740 | 1740 | ||
| 1741 | #ifdef CONFIG_PM | 1741 | #ifdef CONFIG_PM_SLEEP |
| 1742 | 1742 | ||
| 1743 | static LIST_HEAD(sleep_notifiers); | 1743 | static LIST_HEAD(sleep_notifiers); |
| 1744 | 1744 | ||
| @@ -1769,9 +1769,9 @@ pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* n) | |||
| 1769 | return 0; | 1769 | return 0; |
| 1770 | } | 1770 | } |
| 1771 | EXPORT_SYMBOL(pmu_unregister_sleep_notifier); | 1771 | EXPORT_SYMBOL(pmu_unregister_sleep_notifier); |
| 1772 | #endif /* CONFIG_PM */ | 1772 | #endif /* CONFIG_PM_SLEEP */ |
| 1773 | 1773 | ||
| 1774 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 1774 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 1775 | 1775 | ||
| 1776 | /* Sleep is broadcast last-to-first */ | 1776 | /* Sleep is broadcast last-to-first */ |
| 1777 | static void broadcast_sleep(int when) | 1777 | static void broadcast_sleep(int when) |
| @@ -2390,7 +2390,7 @@ powerbook_sleep_3400(void) | |||
| 2390 | return 0; | 2390 | return 0; |
| 2391 | } | 2391 | } |
| 2392 | 2392 | ||
| 2393 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 2393 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 2394 | 2394 | ||
| 2395 | /* | 2395 | /* |
| 2396 | * Support for /dev/pmu device | 2396 | * Support for /dev/pmu device |
| @@ -2573,7 +2573,7 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
| 2573 | int error = -EINVAL; | 2573 | int error = -EINVAL; |
| 2574 | 2574 | ||
| 2575 | switch (cmd) { | 2575 | switch (cmd) { |
| 2576 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 2576 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 2577 | case PMU_IOC_SLEEP: | 2577 | case PMU_IOC_SLEEP: |
| 2578 | if (!capable(CAP_SYS_ADMIN)) | 2578 | if (!capable(CAP_SYS_ADMIN)) |
| 2579 | return -EACCES; | 2579 | return -EACCES; |
| @@ -2601,7 +2601,7 @@ pmu_ioctl(struct inode * inode, struct file *filp, | |||
| 2601 | return put_user(0, argp); | 2601 | return put_user(0, argp); |
| 2602 | else | 2602 | else |
| 2603 | return put_user(1, argp); | 2603 | return put_user(1, argp); |
| 2604 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 2604 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 2605 | 2605 | ||
| 2606 | #ifdef CONFIG_PMAC_BACKLIGHT_LEGACY | 2606 | #ifdef CONFIG_PMAC_BACKLIGHT_LEGACY |
| 2607 | /* Compatibility ioctl's for backlight */ | 2607 | /* Compatibility ioctl's for backlight */ |
| @@ -2757,7 +2757,7 @@ pmu_polled_request(struct adb_request *req) | |||
| 2757 | * to do suspend-to-disk. | 2757 | * to do suspend-to-disk. |
| 2758 | */ | 2758 | */ |
| 2759 | 2759 | ||
| 2760 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 2760 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 2761 | 2761 | ||
| 2762 | int pmu_sys_suspended; | 2762 | int pmu_sys_suspended; |
| 2763 | 2763 | ||
| @@ -2792,7 +2792,7 @@ static int pmu_sys_resume(struct sys_device *sysdev) | |||
| 2792 | return 0; | 2792 | return 0; |
| 2793 | } | 2793 | } |
| 2794 | 2794 | ||
| 2795 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 2795 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 2796 | 2796 | ||
| 2797 | static struct sysdev_class pmu_sysclass = { | 2797 | static struct sysdev_class pmu_sysclass = { |
| 2798 | set_kset_name("pmu"), | 2798 | set_kset_name("pmu"), |
| @@ -2803,10 +2803,10 @@ static struct sys_device device_pmu = { | |||
| 2803 | }; | 2803 | }; |
| 2804 | 2804 | ||
| 2805 | static struct sysdev_driver driver_pmu = { | 2805 | static struct sysdev_driver driver_pmu = { |
| 2806 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 2806 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 2807 | .suspend = &pmu_sys_suspend, | 2807 | .suspend = &pmu_sys_suspend, |
| 2808 | .resume = &pmu_sys_resume, | 2808 | .resume = &pmu_sys_resume, |
| 2809 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 2809 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 2810 | }; | 2810 | }; |
| 2811 | 2811 | ||
| 2812 | static int __init init_pmu_sysfs(void) | 2812 | static int __init init_pmu_sysfs(void) |
| @@ -2841,10 +2841,10 @@ EXPORT_SYMBOL(pmu_wait_complete); | |||
| 2841 | EXPORT_SYMBOL(pmu_suspend); | 2841 | EXPORT_SYMBOL(pmu_suspend); |
| 2842 | EXPORT_SYMBOL(pmu_resume); | 2842 | EXPORT_SYMBOL(pmu_resume); |
| 2843 | EXPORT_SYMBOL(pmu_unlock); | 2843 | EXPORT_SYMBOL(pmu_unlock); |
| 2844 | #if defined(CONFIG_PM) && defined(CONFIG_PPC32) | 2844 | #if defined(CONFIG_PM_SLEEP) && defined(CONFIG_PPC32) |
| 2845 | EXPORT_SYMBOL(pmu_enable_irled); | 2845 | EXPORT_SYMBOL(pmu_enable_irled); |
| 2846 | EXPORT_SYMBOL(pmu_battery_count); | 2846 | EXPORT_SYMBOL(pmu_battery_count); |
| 2847 | EXPORT_SYMBOL(pmu_batteries); | 2847 | EXPORT_SYMBOL(pmu_batteries); |
| 2848 | EXPORT_SYMBOL(pmu_power_flags); | 2848 | EXPORT_SYMBOL(pmu_power_flags); |
| 2849 | #endif /* CONFIG_PM && CONFIG_PPC32 */ | 2849 | #endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ |
| 2850 | 2850 | ||
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c index dfdf11c1eec4..e2f84da09e7c 100644 --- a/drivers/macintosh/via-pmu68k.c +++ b/drivers/macintosh/via-pmu68k.c | |||
| @@ -818,243 +818,3 @@ pmu_present(void) | |||
| 818 | { | 818 | { |
| 819 | return (pmu_kind != PMU_UNKNOWN); | 819 | return (pmu_kind != PMU_UNKNOWN); |
| 820 | } | 820 | } |
| 821 | |||
| 822 | #if 0 /* needs some work for 68K */ | ||
| 823 | |||
| 824 | /* | ||
| 825 | * This struct is used to store config register values for | ||
| 826 | * PCI devices which may get powered off when we sleep. | ||
| 827 | */ | ||
| 828 | static struct pci_save { | ||
| 829 | u16 command; | ||
| 830 | u16 cache_lat; | ||
| 831 | u16 intr; | ||
| 832 | } *pbook_pci_saves; | ||
| 833 | static int n_pbook_pci_saves; | ||
| 834 | |||
| 835 | static inline void | ||
| 836 | pbook_pci_save(void) | ||
| 837 | { | ||
| 838 | int npci; | ||
| 839 | struct pci_dev *pd = NULL; | ||
| 840 | struct pci_save *ps; | ||
| 841 | |||
| 842 | npci = 0; | ||
| 843 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) | ||
| 844 | ++npci; | ||
| 845 | n_pbook_pci_saves = npci; | ||
| 846 | if (npci == 0) | ||
| 847 | return; | ||
| 848 | ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL); | ||
| 849 | pbook_pci_saves = ps; | ||
| 850 | if (ps == NULL) | ||
| 851 | return; | ||
| 852 | |||
| 853 | pd = NULL; | ||
| 854 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
| 855 | pci_read_config_word(pd, PCI_COMMAND, &ps->command); | ||
| 856 | pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat); | ||
| 857 | pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr); | ||
| 858 | ++ps; | ||
| 859 | --npci; | ||
| 860 | } | ||
| 861 | } | ||
| 862 | |||
| 863 | static inline void | ||
| 864 | pbook_pci_restore(void) | ||
| 865 | { | ||
| 866 | u16 cmd; | ||
| 867 | struct pci_save *ps = pbook_pci_saves; | ||
| 868 | struct pci_dev *pd = NULL; | ||
| 869 | int j; | ||
| 870 | |||
| 871 | while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) { | ||
| 872 | if (ps->command == 0) | ||
| 873 | continue; | ||
| 874 | pci_read_config_word(pd, PCI_COMMAND, &cmd); | ||
| 875 | if ((ps->command & ~cmd) == 0) | ||
| 876 | continue; | ||
| 877 | switch (pd->hdr_type) { | ||
| 878 | case PCI_HEADER_TYPE_NORMAL: | ||
| 879 | for (j = 0; j < 6; ++j) | ||
| 880 | pci_write_config_dword(pd, | ||
| 881 | PCI_BASE_ADDRESS_0 + j*4, | ||
| 882 | pd->resource[j].start); | ||
| 883 | pci_write_config_dword(pd, PCI_ROM_ADDRESS, | ||
| 884 | pd->resource[PCI_ROM_RESOURCE].start); | ||
| 885 | pci_write_config_word(pd, PCI_CACHE_LINE_SIZE, | ||
| 886 | ps->cache_lat); | ||
| 887 | pci_write_config_word(pd, PCI_INTERRUPT_LINE, | ||
| 888 | ps->intr); | ||
| 889 | pci_write_config_word(pd, PCI_COMMAND, ps->command); | ||
| 890 | break; | ||
| 891 | /* other header types not restored at present */ | ||
| 892 | } | ||
| 893 | } | ||
| 894 | } | ||
| 895 | |||
| 896 | /* | ||
| 897 | * Put the powerbook to sleep. | ||
| 898 | */ | ||
| 899 | #define IRQ_ENABLE ((unsigned int *)0xf3000024) | ||
| 900 | #define MEM_CTRL ((unsigned int *)0xf8000070) | ||
| 901 | |||
| 902 | int powerbook_sleep(void) | ||
| 903 | { | ||
| 904 | int ret, i, x; | ||
| 905 | static int save_backlight; | ||
| 906 | static unsigned int save_irqen; | ||
| 907 | unsigned long msr; | ||
| 908 | unsigned int hid0; | ||
| 909 | unsigned long p, wait; | ||
| 910 | struct adb_request sleep_req; | ||
| 911 | |||
| 912 | /* Notify device drivers */ | ||
| 913 | ret = blocking_notifier_call_chain(&sleep_notifier_list, | ||
| 914 | PBOOK_SLEEP, NULL); | ||
| 915 | if (ret & NOTIFY_STOP_MASK) | ||
| 916 | return -EBUSY; | ||
| 917 | |||
| 918 | /* Sync the disks. */ | ||
| 919 | /* XXX It would be nice to have some way to ensure that | ||
| 920 | * nobody is dirtying any new buffers while we wait. */ | ||
| 921 | sys_sync(); | ||
| 922 | |||
| 923 | /* Turn off the display backlight */ | ||
| 924 | save_backlight = backlight_enabled; | ||
| 925 | if (save_backlight) | ||
| 926 | pmu_enable_backlight(0); | ||
| 927 | |||
| 928 | /* Give the disks a little time to actually finish writing */ | ||
| 929 | for (wait = jiffies + (HZ/4); time_before(jiffies, wait); ) | ||
| 930 | mb(); | ||
| 931 | |||
| 932 | /* Disable all interrupts except pmu */ | ||
| 933 | save_irqen = in_le32(IRQ_ENABLE); | ||
| 934 | for (i = 0; i < 32; ++i) | ||
| 935 | if (i != vias->intrs[0].line && (save_irqen & (1 << i))) | ||
| 936 | disable_irq(i); | ||
| 937 | asm volatile("mtdec %0" : : "r" (0x7fffffff)); | ||
| 938 | |||
| 939 | /* Save the state of PCI config space for some slots */ | ||
| 940 | pbook_pci_save(); | ||
| 941 | |||
| 942 | /* Set the memory controller to keep the memory refreshed | ||
| 943 | while we're asleep */ | ||
| 944 | for (i = 0x403f; i >= 0x4000; --i) { | ||
| 945 | out_be32(MEM_CTRL, i); | ||
| 946 | do { | ||
| 947 | x = (in_be32(MEM_CTRL) >> 16) & 0x3ff; | ||
| 948 | } while (x == 0); | ||
| 949 | if (x >= 0x100) | ||
| 950 | break; | ||
| 951 | } | ||
| 952 | |||
| 953 | /* Ask the PMU to put us to sleep */ | ||
| 954 | pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T'); | ||
| 955 | while (!sleep_req.complete) | ||
| 956 | mb(); | ||
| 957 | /* displacement-flush the L2 cache - necessary? */ | ||
| 958 | for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000) | ||
| 959 | i = *(volatile int *)p; | ||
| 960 | asleep = 1; | ||
| 961 | |||
| 962 | /* Put the CPU into sleep mode */ | ||
| 963 | asm volatile("mfspr %0,1008" : "=r" (hid0) :); | ||
| 964 | hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP; | ||
| 965 | asm volatile("mtspr 1008,%0" : : "r" (hid0)); | ||
| 966 | local_save_flags(msr); | ||
| 967 | msr |= MSR_POW | MSR_EE; | ||
| 968 | local_irq_restore(msr); | ||
| 969 | udelay(10); | ||
| 970 | |||
| 971 | /* OK, we're awake again, start restoring things */ | ||
| 972 | out_be32(MEM_CTRL, 0x3f); | ||
| 973 | pbook_pci_restore(); | ||
| 974 | |||
| 975 | /* wait for the PMU interrupt sequence to complete */ | ||
| 976 | while (asleep) | ||
| 977 | mb(); | ||
| 978 | |||
| 979 | /* reenable interrupts */ | ||
| 980 | for (i = 0; i < 32; ++i) | ||
| 981 | if (i != vias->intrs[0].line && (save_irqen & (1 << i))) | ||
| 982 | enable_irq(i); | ||
| 983 | |||
| 984 | /* Notify drivers */ | ||
| 985 | blocking_notifier_call_chain(&sleep_notifier_list, PBOOK_WAKE, NULL); | ||
| 986 | |||
| 987 | /* reenable ADB autopoll */ | ||
| 988 | pmu_adb_autopoll(adb_dev_map); | ||
| 989 | |||
| 990 | /* Turn on the screen backlight, if it was on before */ | ||
| 991 | if (save_backlight) | ||
| 992 | pmu_enable_backlight(1); | ||
| 993 | |||
| 994 | /* Wait for the hard disk to spin up */ | ||
| 995 | |||
| 996 | return 0; | ||
| 997 | } | ||
| 998 | |||
| 999 | /* | ||
| 1000 | * Support for /dev/pmu device | ||
| 1001 | */ | ||
| 1002 | static int pmu_open(struct inode *inode, struct file *file) | ||
| 1003 | { | ||
| 1004 | return 0; | ||
| 1005 | } | ||
| 1006 | |||
| 1007 | static ssize_t pmu_read(struct file *file, char *buf, | ||
| 1008 | size_t count, loff_t *ppos) | ||
| 1009 | { | ||
| 1010 | return 0; | ||
| 1011 | } | ||
| 1012 | |||
| 1013 | static ssize_t pmu_write(struct file *file, const char *buf, | ||
| 1014 | size_t count, loff_t *ppos) | ||
| 1015 | { | ||
| 1016 | return 0; | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | static int pmu_ioctl(struct inode * inode, struct file *filp, | ||
| 1020 | u_int cmd, u_long arg) | ||
| 1021 | { | ||
| 1022 | int error; | ||
| 1023 | __u32 value; | ||
| 1024 | |||
| 1025 | switch (cmd) { | ||
| 1026 | case PMU_IOC_SLEEP: | ||
| 1027 | return -ENOSYS; | ||
| 1028 | case PMU_IOC_GET_BACKLIGHT: | ||
| 1029 | return put_user(backlight_level, (__u32 *)arg); | ||
| 1030 | case PMU_IOC_SET_BACKLIGHT: | ||
| 1031 | error = get_user(value, (__u32 *)arg); | ||
| 1032 | if (!error) | ||
| 1033 | pmu_set_brightness(value); | ||
| 1034 | return error; | ||
| 1035 | case PMU_IOC_GET_MODEL: | ||
| 1036 | return put_user(pmu_kind, (__u32 *)arg); | ||
| 1037 | } | ||
| 1038 | return -EINVAL; | ||
| 1039 | } | ||
| 1040 | |||
| 1041 | static const struct file_operations pmu_device_fops = { | ||
| 1042 | .read = pmu_read, | ||
| 1043 | .write = pmu_write, | ||
| 1044 | .ioctl = pmu_ioctl, | ||
| 1045 | .open = pmu_open, | ||
| 1046 | }; | ||
| 1047 | |||
| 1048 | static struct miscdevice pmu_device = { | ||
| 1049 | PMU_MINOR, "pmu", &pmu_device_fops | ||
| 1050 | }; | ||
| 1051 | |||
| 1052 | void pmu_device_init(void) | ||
| 1053 | { | ||
| 1054 | if (!via) | ||
| 1055 | return; | ||
| 1056 | if (misc_register(&pmu_device) < 0) | ||
| 1057 | printk(KERN_ERR "via-pmu68k: cannot register misc device.\n"); | ||
| 1058 | } | ||
| 1059 | #endif /* CONFIG_PMAC_PBOOK */ | ||
| 1060 | |||
