[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 27 Jun 2005 21:36:34 +0000 (14:36 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 27 Jun 2005 22:11:43 +0000 (15:11 -0700)
This patch removes CONFIG_PMAC_PBOOK (PowerBook support).  This is now
split into CONFIG_PMAC_MEDIABAY for the actual hotswap bay that some
powerbooks have, CONFIG_PM for power management related code, and just left
out of any CONFIG_* option for some generally useful stuff that can be used
on non-laptops as well.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
20 files changed:
arch/ppc/platforms/pmac_sleep.S
arch/ppc/platforms/pmac_time.c
drivers/block/swim3.c
drivers/char/misc.c
drivers/ide/ppc/pmac.c
drivers/ieee1394/ohci1394.c
drivers/macintosh/Kconfig
drivers/macintosh/Makefile
drivers/macintosh/adb.c
drivers/macintosh/via-pmu.c
drivers/usb/host/ohci-pci.c
drivers/video/aty/aty128fb.c
drivers/video/chipsfb.c
include/linux/pmu.h
sound/oss/dmasound/dmasound_awacs.c
sound/ppc/awacs.c
sound/ppc/daca.c
sound/ppc/pmac.c
sound/ppc/pmac.h
sound/ppc/tumbler.c

index f459ade1bd6309769c7ff2617641edc0bd087349..016a74649155b83b8547ba2b85656a7914e78674 100644 (file)
@@ -46,7 +46,7 @@
        .section .text
        .align  5
 
        .section .text
        .align  5
 
-#if defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ_PMAC)
+#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC)
 
 /* This gets called by via-pmu.c late during the sleep process.
  * The PMU was already send the sleep command and will shut us down
 
 /* This gets called by via-pmu.c late during the sleep process.
  * The PMU was already send the sleep command and will shut us down
@@ -382,7 +382,7 @@ turn_on_mmu:
        isync
        rfi
 
        isync
        rfi
 
-#endif /* defined(CONFIG_PMAC_PBOOK) || defined(CONFIG_CPU_FREQ) */
+#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */
 
        .section .data
        .balign L1_CACHE_LINE_SIZE
 
        .section .data
        .balign L1_CACHE_LINE_SIZE
index de60ccc7db9f267d4d525113dd95be83af9c0833..778ce4fec36836db8d7a3b53ed86960fa863986d 100644 (file)
@@ -206,7 +206,7 @@ via_calibrate_decr(void)
        return 1;
 }
 
        return 1;
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /*
  * Reset the time after a sleep.
  */
 /*
  * Reset the time after a sleep.
  */
@@ -238,7 +238,7 @@ time_sleep_notify(struct pmu_sleep_notifier *self, int when)
 static struct pmu_sleep_notifier time_sleep_notifier __pmacdata = {
        time_sleep_notify, SLEEP_LEVEL_MISC,
 };
 static struct pmu_sleep_notifier time_sleep_notifier __pmacdata = {
        time_sleep_notify, SLEEP_LEVEL_MISC,
 };
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 /*
  * Query the OF and get the decr frequency.
 
 /*
  * Query the OF and get the decr frequency.
@@ -251,9 +251,9 @@ pmac_calibrate_decr(void)
        struct device_node *cpu;
        unsigned int freq, *fp;
 
        struct device_node *cpu;
        unsigned int freq, *fp;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        pmu_register_sleep_notifier(&time_sleep_notifier);
        pmu_register_sleep_notifier(&time_sleep_notifier);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
        /* We assume MacRISC2 machines have correct device-tree
         * calibration. That's better since the VIA itself seems
 
        /* We assume MacRISC2 machines have correct device-tree
         * calibration. That's better since the VIA itself seems
index 5b09cf154ac7f3d9f29e1569952f53bebdd2cb71..e5f7494c00eed322d946269a568acf9240632c55 100644 (file)
@@ -253,7 +253,7 @@ static int floppy_revalidate(struct gendisk *disk);
 static int swim3_add_device(struct device_node *swims);
 int swim3_init(void);
 
 static int swim3_add_device(struct device_node *swims);
 int swim3_init(void);
 
-#ifndef CONFIG_PMAC_PBOOK
+#ifndef CONFIG_PMAC_MEDIABAY
 #define check_media_bay(which, what)   1
 #endif
 
 #define check_media_bay(which, what)   1
 #endif
 
@@ -297,9 +297,11 @@ static void do_fd_request(request_queue_t * q)
        int i;
        for(i=0;i<floppy_count;i++)
        {
        int i;
        for(i=0;i<floppy_count;i++)
        {
+#ifdef CONFIG_PMAC_MEDIABAY
                if (floppy_states[i].media_bay &&
                        check_media_bay(floppy_states[i].media_bay, MB_FD))
                        continue;
                if (floppy_states[i].media_bay &&
                        check_media_bay(floppy_states[i].media_bay, MB_FD))
                        continue;
+#endif /* CONFIG_PMAC_MEDIABAY */
                start_request(&floppy_states[i]);
        }
        sti();
                start_request(&floppy_states[i]);
        }
        sti();
@@ -856,8 +858,10 @@ static int floppy_ioctl(struct inode *inode, struct file *filp,
        if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
                return -EPERM;
 
        if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
                return -EPERM;
 
+#ifdef CONFIG_PMAC_MEDIABAY
        if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                return -ENXIO;
        if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                return -ENXIO;
+#endif
 
        switch (cmd) {
        case FDEJECT:
 
        switch (cmd) {
        case FDEJECT:
@@ -881,8 +885,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
        int n, err = 0;
 
        if (fs->ref_count == 0) {
        int n, err = 0;
 
        if (fs->ref_count == 0) {
+#ifdef CONFIG_PMAC_MEDIABAY
                if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                        return -ENXIO;
                if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                        return -ENXIO;
+#endif
                out_8(&sw->setup, S_IBM_DRIVE | S_FCLK_DIV2);
                out_8(&sw->control_bic, 0xff);
                out_8(&sw->mode, 0x95);
                out_8(&sw->setup, S_IBM_DRIVE | S_FCLK_DIV2);
                out_8(&sw->control_bic, 0xff);
                out_8(&sw->mode, 0x95);
@@ -967,8 +973,10 @@ static int floppy_revalidate(struct gendisk *disk)
        struct swim3 __iomem *sw;
        int ret, n;
 
        struct swim3 __iomem *sw;
        int ret, n;
 
+#ifdef CONFIG_PMAC_MEDIABAY
        if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                return -ENXIO;
        if (fs->media_bay && check_media_bay(fs->media_bay, MB_FD))
                return -ENXIO;
+#endif
 
        sw = fs->swim3;
        grab_drive(fs, revalidating, 0);
 
        sw = fs->swim3;
        grab_drive(fs, revalidating, 0);
index 31cf84d690266652fb2ad57a040b1380123b45f4..931efd58f87a2d4270a7180f2fd9b7c22bcbfa81 100644 (file)
@@ -308,9 +308,6 @@ static int __init misc_init(void)
 #endif
 #ifdef CONFIG_BVME6000
        rtc_DP8570A_init();
 #endif
 #ifdef CONFIG_BVME6000
        rtc_DP8570A_init();
-#endif
-#ifdef CONFIG_PMAC_PBOOK
-       pmu_device_init();
 #endif
        if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
                printk("unable to get major %d for misc devices\n",
 #endif
        if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) {
                printk("unable to get major %d for misc devices\n",
index 569f16767442bf7fc0193425579a33b0eb4fb289..818380b5fd277e402b2da9a51c419ce0c601c3d6 100644 (file)
@@ -1324,9 +1324,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
        /* XXX FIXME: Media bay stuff need re-organizing */
        if (np->parent && np->parent->name
            && strcasecmp(np->parent->name, "media-bay") == 0) {
        /* XXX FIXME: Media bay stuff need re-organizing */
        if (np->parent && np->parent->name
            && strcasecmp(np->parent->name, "media-bay") == 0) {
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PMAC_MEDIABAY
                media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
                media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq, hwif->index);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PMAC_MEDIABAY */
                pmif->mediabay = 1;
                if (!bidp)
                        pmif->aapl_bus_id = 1;
                pmif->mediabay = 1;
                if (!bidp)
                        pmif->aapl_bus_id = 1;
@@ -1382,10 +1382,10 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
               hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
               pmif->mediabay ? " (mediabay)" : "", hwif->irq);
                        
               hwif->index, model_name[pmif->kind], pmif->aapl_bus_id,
               pmif->mediabay ? " (mediabay)" : "", hwif->irq);
                        
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PMAC_MEDIABAY
        if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)
                hwif->noprobe = 0;
        if (pmif->mediabay && check_media_bay_by_base(pmif->regbase, MB_CD) == 0)
                hwif->noprobe = 0;
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PMAC_MEDIABAY */
 
        hwif->sg_max_nents = MAX_DCMDS;
 
 
        hwif->sg_max_nents = MAX_DCMDS;
 
index 36e25ac823dc73c2f69c58e391dd4382af59de55..b3d3d22fde64d4262a2aae4fe194a2ac4b067d11 100644 (file)
@@ -3538,8 +3538,8 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
 
 static int ohci1394_pci_resume (struct pci_dev *pdev)
 {
 
 static int ohci1394_pci_resume (struct pci_dev *pdev)
 {
-#ifdef CONFIG_PMAC_PBOOK
-       {
+#ifdef CONFIG_PPC_PMAC
+       if (_machine == _MACH_Pmac) {
                struct device_node *of_node;
 
                /* Re-enable 1394 */
                struct device_node *of_node;
 
                /* Re-enable 1394 */
@@ -3547,7 +3547,7 @@ static int ohci1394_pci_resume (struct pci_dev *pdev)
                if (of_node)
                        pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1);
        }
                if (of_node)
                        pmac_call_feature (PMAC_FTR_1394_ENABLE, of_node, 0, 1);
        }
-#endif
+#endif /* CONFIG_PPC_PMAC */
 
        pci_enable_device(pdev);
 
 
        pci_enable_device(pdev);
 
@@ -3557,8 +3557,8 @@ static int ohci1394_pci_resume (struct pci_dev *pdev)
 
 static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 
 static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 {
-#ifdef CONFIG_PMAC_PBOOK
-       {
+#ifdef CONFIG_PPC_PMAC
+       if (_machine == _MACH_Pmac) {
                struct device_node *of_node;
 
                /* Disable 1394 */
                struct device_node *of_node;
 
                /* Disable 1394 */
index b0ace5bc950ce2c3441ddac24027f0bac45a20dc..91691a6c004e4dd33d2bb3e9eed8896ee8f3c2a6 100644 (file)
@@ -86,33 +86,18 @@ config PMAC_SMU
          on the "SMU" system control chip which replaces the old PMU.
          If you don't know, say Y.
 
          on the "SMU" system control chip which replaces the old PMU.
          If you don't know, say Y.
 
-config PMAC_PBOOK
-       bool "Power management support for PowerBooks"
-       depends on ADB_PMU
-       ---help---
-         This provides support for putting a PowerBook to sleep; it also
-         enables media bay support.  Power management works on the
-         PB2400/3400/3500, Wallstreet, Lombard, and Bronze PowerBook G3 and
-         the Titanium Powerbook G4, as well as the iBooks.  You should get
-         the power management daemon, pmud, to make it work and you must have
-         the /dev/pmu device (see the pmud README).
-
-         Get pmud from <ftp://ftp.samba.org/pub/ppclinux/pmud/>.
-
-         If you have a PowerBook, you should say Y here.
-
-         You may also want to compile the dma sound driver as a module and
-         have it autoloaded. The act of removing the module shuts down the
-         sound hardware for more power savings.
-
-config PM
-       bool
-       depends on PPC_PMAC && ADB_PMU && PMAC_PBOOK
-       default y
-
 config PMAC_APM_EMU
        tristate "APM emulation"
 config PMAC_APM_EMU
        tristate "APM emulation"
-       depends on PMAC_PBOOK
+       depends on PPC_PMAC && PPC32 && PM
+
+config PMAC_MEDIABAY
+       bool "Support PowerBook hotswap media bay"
+       depends on PPC_PMAC && PPC32
+       help
+         This option adds support for older PowerBook's hotswap media bay
+         that can contains batteries, floppy drives, or IDE devices. PCI
+         devices are not fully supported in the bay as I never had one to
+         try with
 
 # made a separate option since backlight may end up beeing used
 # on non-powerbook machines (but only on PMU based ones AFAIK)
 
 # made a separate option since backlight may end up beeing used
 # on non-powerbook machines (but only on PMU based ones AFAIK)
index b3f88a4fcef77eaa912f31898eb9f903a4f89034..f5ae171dbfef3b537ce98139dd7fe3e78ddad249 100644 (file)
@@ -6,7 +6,7 @@
 
 obj-$(CONFIG_PPC_PMAC)         += macio_asic.o
 
 
 obj-$(CONFIG_PPC_PMAC)         += macio_asic.o
 
-obj-$(CONFIG_PMAC_PBOOK)       += mediabay.o
+obj-$(CONFIG_PMAC_MEDIABAY)    += mediabay.o
 obj-$(CONFIG_MAC_EMUMOUSEBTN)  += mac_hid.o
 obj-$(CONFIG_INPUT_ADBHID)     += adbhid.o
 obj-$(CONFIG_ANSLCD)           += ans-lcd.o
 obj-$(CONFIG_MAC_EMUMOUSEBTN)  += mac_hid.o
 obj-$(CONFIG_INPUT_ADBHID)     += adbhid.o
 obj-$(CONFIG_ANSLCD)           += ans-lcd.o
index 493e2afa191cec0d56e92a62dfe2d13a301cbb4e..c0dc1e3fa58bfa1f28074f136de8bcfa8d269cca 100644 (file)
@@ -90,7 +90,7 @@ static int sleepy_trackpad;
 static int autopoll_devs;
 int __adb_probe_sync;
 
 static int autopoll_devs;
 int __adb_probe_sync;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
 static struct pmu_sleep_notifier adb_sleep_notifier = {
        adb_notify_sleep,
 static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
 static struct pmu_sleep_notifier adb_sleep_notifier = {
        adb_notify_sleep,
@@ -320,9 +320,9 @@ int __init adb_init(void)
                printk(KERN_WARNING "Warning: no ADB interface detected\n");
                adb_controller = NULL;
        } else {
                printk(KERN_WARNING "Warning: no ADB interface detected\n");
                adb_controller = NULL;
        } else {
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
                pmu_register_sleep_notifier(&adb_sleep_notifier);
                pmu_register_sleep_notifier(&adb_sleep_notifier);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 #ifdef CONFIG_PPC
                if (machine_is_compatible("AAPL,PowerBook1998") ||
                        machine_is_compatible("PowerBook1,1"))
 #ifdef CONFIG_PPC
                if (machine_is_compatible("AAPL,PowerBook1998") ||
                        machine_is_compatible("PowerBook1,1"))
@@ -337,7 +337,7 @@ int __init adb_init(void)
 
 __initcall(adb_init);
 
 
 __initcall(adb_init);
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /*
  * notify clients before sleep and reset bus afterwards
  */
 /*
  * notify clients before sleep and reset bus afterwards
  */
@@ -378,7 +378,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
        }
        return PBOOK_SLEEP_OK;
 }
        }
        return PBOOK_SLEEP_OK;
 }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 static int
 do_adb_reset_bus(void)
 
 static int
 do_adb_reset_bus(void)
index 5375df03c6f3132e516fd6af1febb49d5fda8cba..4a0a0ad2d03c09e7bff0e9185c4355e274514264 100644 (file)
@@ -155,10 +155,10 @@ static spinlock_t pmu_lock;
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
 static u8 pmu_intr_mask;
 static int pmu_version;
 static int drop_interrupts;
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 static int option_lid_wakeup = 1;
 static int sleep_in_progress;
 static int option_lid_wakeup = 1;
 static int sleep_in_progress;
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 static unsigned long async_req_locks;
 static unsigned int pmu_irq_stats[11];
 
 static unsigned long async_req_locks;
 static unsigned int pmu_irq_stats[11];
 
@@ -168,7 +168,6 @@ static struct proc_dir_entry *proc_pmu_irqstats;
 static struct proc_dir_entry *proc_pmu_options;
 static int option_server_mode;
 
 static struct proc_dir_entry *proc_pmu_options;
 static int option_server_mode;
 
-#ifdef CONFIG_PMAC_PBOOK
 int pmu_battery_count;
 int pmu_cur_battery;
 unsigned int pmu_power_flags;
 int pmu_battery_count;
 int pmu_cur_battery;
 unsigned int pmu_power_flags;
@@ -176,7 +175,6 @@ struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
 static int query_batt_timer = BATTERY_POLLING_COUNT;
 static struct adb_request batt_req;
 static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES];
 static int query_batt_timer = BATTERY_POLLING_COUNT;
 static struct adb_request batt_req;
 static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES];
-#endif /* CONFIG_PMAC_PBOOK */
 
 #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
 extern int disable_kernel_backlight;
 
 #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
 extern int disable_kernel_backlight;
@@ -210,11 +208,9 @@ static int proc_get_irqstats(char *page, char **start, off_t off,
 static int pmu_set_backlight_level(int level, void* data);
 static int pmu_set_backlight_enable(int on, int level, void* data);
 #endif /* CONFIG_PMAC_BACKLIGHT */
 static int pmu_set_backlight_level(int level, void* data);
 static int pmu_set_backlight_enable(int on, int level, void* data);
 #endif /* CONFIG_PMAC_BACKLIGHT */
-#ifdef CONFIG_PMAC_PBOOK
 static void pmu_pass_intr(unsigned char *data, int len);
 static int proc_get_batt(char *page, char **start, off_t off,
                        int count, int *eof, void *data);
 static void pmu_pass_intr(unsigned char *data, int len);
 static int proc_get_batt(char *page, char **start, off_t off,
                        int count, int *eof, void *data);
-#endif /* CONFIG_PMAC_PBOOK */
 static int proc_read_options(char *page, char **start, off_t off,
                        int count, int *eof, void *data);
 static int proc_write_options(struct file *file, const char __user *buffer,
 static int proc_read_options(char *page, char **start, off_t off,
                        int count, int *eof, void *data);
 static int proc_write_options(struct file *file, const char __user *buffer,
@@ -407,9 +403,7 @@ static int __init via_pmu_start(void)
 
        bright_req_1.complete = 1;
        bright_req_2.complete = 1;
 
        bright_req_1.complete = 1;
        bright_req_2.complete = 1;
-#ifdef CONFIG_PMAC_PBOOK
        batt_req.complete = 1;
        batt_req.complete = 1;
-#endif
 
 #ifdef CONFIG_PPC32
        if (pmu_kind == PMU_KEYLARGO_BASED)
 
 #ifdef CONFIG_PPC32
        if (pmu_kind == PMU_KEYLARGO_BASED)
@@ -468,7 +462,7 @@ static int __init via_pmu_dev_init(void)
        register_backlight_controller(&pmu_backlight_controller, NULL, "pmu");
 #endif /* CONFIG_PMAC_BACKLIGHT */
 
        register_backlight_controller(&pmu_backlight_controller, NULL, "pmu");
 #endif /* CONFIG_PMAC_BACKLIGHT */
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PPC32
        if (machine_is_compatible("AAPL,3400/2400") ||
                machine_is_compatible("AAPL,3500")) {
                int mb = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
        if (machine_is_compatible("AAPL,3400/2400") ||
                machine_is_compatible("AAPL,3500")) {
                int mb = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
@@ -496,20 +490,19 @@ static int __init via_pmu_dev_init(void)
                                pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART;
                }
        }
                                pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART;
                }
        }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PPC32 */
+
        /* Create /proc/pmu */
        proc_pmu_root = proc_mkdir("pmu", NULL);
        if (proc_pmu_root) {
        /* Create /proc/pmu */
        proc_pmu_root = proc_mkdir("pmu", NULL);
        if (proc_pmu_root) {
-#ifdef CONFIG_PMAC_PBOOK
-               int i;
+               long i;
 
                for (i=0; i<pmu_battery_count; i++) {
                        char title[16];
 
                for (i=0; i<pmu_battery_count; i++) {
                        char title[16];
-                       sprintf(title, "battery_%d", i);
+                       sprintf(title, "battery_%ld", i);
                        proc_pmu_batt[i] = create_proc_read_entry(title, 0, proc_pmu_root,
                                                proc_get_batt, (void *)i);
                }
                        proc_pmu_batt[i] = create_proc_read_entry(title, 0, proc_pmu_root,
                                                proc_get_batt, (void *)i);
                }
-#endif /* CONFIG_PMAC_PBOOK */
 
                proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root,
                                        proc_get_info, NULL);
 
                proc_pmu_info = create_proc_read_entry("info", 0, proc_pmu_root,
                                        proc_get_info, NULL);
@@ -629,8 +622,6 @@ static void pmu_set_server_mode(int server_mode)
        pmu_wait_complete(&req);
 }
 
        pmu_wait_complete(&req);
 }
 
-#ifdef CONFIG_PMAC_PBOOK
-
 /* This new version of the code for 2400/3400/3500 powerbooks
  * is inspired from the implementation in gkrellm-pmu
  */
 /* This new version of the code for 2400/3400/3500 powerbooks
  * is inspired from the implementation in gkrellm-pmu
  */
@@ -813,8 +804,6 @@ query_battery_state(void)
                        2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1);
 }
 
                        2, PMU_SMART_BATTERY_STATE, pmu_cur_battery+1);
 }
 
-#endif /* CONFIG_PMAC_PBOOK */
-
 static int __pmac
 proc_get_info(char *page, char **start, off_t off,
                int count, int *eof, void *data)
 static int __pmac
 proc_get_info(char *page, char **start, off_t off,
                int count, int *eof, void *data)
@@ -823,11 +812,9 @@ proc_get_info(char *page, char **start, off_t off,
 
        p += sprintf(p, "PMU driver version     : %d\n", PMU_DRIVER_VERSION);
        p += sprintf(p, "PMU firmware version   : %02x\n", pmu_version);
 
        p += sprintf(p, "PMU driver version     : %d\n", PMU_DRIVER_VERSION);
        p += sprintf(p, "PMU firmware version   : %02x\n", pmu_version);
-#ifdef CONFIG_PMAC_PBOOK
        p += sprintf(p, "AC Power               : %d\n",
                ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0));
        p += sprintf(p, "Battery count          : %d\n", pmu_battery_count);
        p += sprintf(p, "AC Power               : %d\n",
                ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0));
        p += sprintf(p, "Battery count          : %d\n", pmu_battery_count);
-#endif /* CONFIG_PMAC_PBOOK */
 
        return p - page;
 }
 
        return p - page;
 }
@@ -859,12 +846,11 @@ proc_get_irqstats(char *page, char **start, off_t off,
        return p - page;
 }
 
        return p - page;
 }
 
-#ifdef CONFIG_PMAC_PBOOK
 static int __pmac
 proc_get_batt(char *page, char **start, off_t off,
                int count, int *eof, void *data)
 {
 static int __pmac
 proc_get_batt(char *page, char **start, off_t off,
                int count, int *eof, void *data)
 {
-       int batnum = (int)data;
+       long batnum = (long)data;
        char *p = page;
        
        p += sprintf(p, "\n");
        char *p = page;
        
        p += sprintf(p, "\n");
@@ -883,7 +869,6 @@ proc_get_batt(char *page, char **start, off_t off,
 
        return p - page;
 }
 
        return p - page;
 }
-#endif /* CONFIG_PMAC_PBOOK */
 
 static int __pmac
 proc_read_options(char *page, char **start, off_t off,
 
 static int __pmac
 proc_read_options(char *page, char **start, off_t off,
@@ -891,11 +876,11 @@ proc_read_options(char *page, char **start, off_t off,
 {
        char *p = page;
 
 {
        char *p = page;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                p += sprintf(p, "lid_wakeup=%d\n", option_lid_wakeup);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif
        if (pmu_kind == PMU_KEYLARGO_BASED)
                p += sprintf(p, "server_mode=%d\n", option_server_mode);
 
        if (pmu_kind == PMU_KEYLARGO_BASED)
                p += sprintf(p, "server_mode=%d\n", option_server_mode);
 
@@ -932,12 +917,12 @@ proc_write_options(struct file *file, const char __user *buffer,
        *(val++) = 0;
        while(*val == ' ')
                val++;
        *(val++) = 0;
        while(*val == ' ')
                val++;
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                if (!strcmp(label, "lid_wakeup"))
                        option_lid_wakeup = ((*val) == '1');
        if (pmu_kind == PMU_KEYLARGO_BASED &&
            pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) >= 0)
                if (!strcmp(label, "lid_wakeup"))
                        option_lid_wakeup = ((*val) == '1');
-#endif /* CONFIG_PMAC_PBOOK */
+#endif
        if (pmu_kind == PMU_KEYLARGO_BASED && !strcmp(label, "server_mode")) {
                int new_value;
                new_value = ((*val) == '1');
        if (pmu_kind == PMU_KEYLARGO_BASED && !strcmp(label, "server_mode")) {
                int new_value;
                new_value = ((*val) == '1');
@@ -1432,7 +1417,6 @@ next:
        }
        /* Tick interrupt */
        else if ((1 << pirq) & PMU_INT_TICK) {
        }
        /* Tick interrupt */
        else if ((1 << pirq) & PMU_INT_TICK) {
-#ifdef CONFIG_PMAC_PBOOK
                /* Environement or tick interrupt, query batteries */
                if (pmu_battery_count) {
                        if ((--query_batt_timer) == 0) {
                /* Environement or tick interrupt, query batteries */
                if (pmu_battery_count) {
                        if ((--query_batt_timer) == 0) {
@@ -1447,7 +1431,6 @@ next:
                pmu_pass_intr(data, len);
        } else {
               pmu_pass_intr(data, len);
                pmu_pass_intr(data, len);
        } else {
               pmu_pass_intr(data, len);
-#endif /* CONFIG_PMAC_PBOOK */
        }
        goto next;
 }
        }
        goto next;
 }
@@ -2062,7 +2045,7 @@ pmu_i2c_simple_write(int bus, int addr,  u8* data, int len)
        return -1;
 }
 
        return -1;
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 
 static LIST_HEAD(sleep_notifiers);
 
 
 static LIST_HEAD(sleep_notifiers);
 
@@ -2715,6 +2698,8 @@ powerbook_sleep_3400(void)
        return 0;
 }
 
        return 0;
 }
 
+#endif /* CONFIG_PM */
+
 /*
  * Support for /dev/pmu device
  */
 /*
  * Support for /dev/pmu device
  */
@@ -2894,11 +2879,11 @@ static int __pmac
 pmu_ioctl(struct inode * inode, struct file *filp,
                     u_int cmd, u_long arg)
 {
 pmu_ioctl(struct inode * inode, struct file *filp,
                     u_int cmd, u_long arg)
 {
-       struct pmu_private *pp = filp->private_data;
        __u32 __user *argp = (__u32 __user *)arg;
        __u32 __user *argp = (__u32 __user *)arg;
-       int error;
+       int error = -EINVAL;
 
        switch (cmd) {
 
        switch (cmd) {
+#ifdef CONFIG_PM
        case PMU_IOC_SLEEP:
                if (!capable(CAP_SYS_ADMIN))
                        return -EACCES;
        case PMU_IOC_SLEEP:
                if (!capable(CAP_SYS_ADMIN))
                        return -EACCES;
@@ -2920,12 +2905,13 @@ pmu_ioctl(struct inode * inode, struct file *filp,
                        error = -ENOSYS;
                }
                sleep_in_progress = 0;
                        error = -ENOSYS;
                }
                sleep_in_progress = 0;
-               return error;
+               break;
        case PMU_IOC_CAN_SLEEP:
                if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0)
                        return put_user(0, argp);
                else
                        return put_user(1, argp);
        case PMU_IOC_CAN_SLEEP:
                if (pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,0,-1) < 0)
                        return put_user(0, argp);
                else
                        return put_user(1, argp);
+#endif /* CONFIG_PM */
 
 #ifdef CONFIG_PMAC_BACKLIGHT
        /* Backlight should have its own device or go via
 
 #ifdef CONFIG_PMAC_BACKLIGHT
        /* Backlight should have its own device or go via
@@ -2946,11 +2932,13 @@ pmu_ioctl(struct inode * inode, struct file *filp,
                error = get_user(value, argp);
                if (!error)
                        error = set_backlight_level(value);
                error = get_user(value, argp);
                if (!error)
                        error = set_backlight_level(value);
-               return error;
+               break;
        }
 #ifdef CONFIG_INPUT_ADBHID
        case PMU_IOC_GRAB_BACKLIGHT: {
        }
 #ifdef CONFIG_INPUT_ADBHID
        case PMU_IOC_GRAB_BACKLIGHT: {
+               struct pmu_private *pp = filp->private_data;
                unsigned long flags;
                unsigned long flags;
+
                if (pp->backlight_locker)
                        return 0;
                pp->backlight_locker = 1;
                if (pp->backlight_locker)
                        return 0;
                pp->backlight_locker = 1;
@@ -2966,7 +2954,7 @@ pmu_ioctl(struct inode * inode, struct file *filp,
        case PMU_IOC_HAS_ADB:
                return put_user(pmu_has_adb, argp);
        }
        case PMU_IOC_HAS_ADB:
                return put_user(pmu_has_adb, argp);
        }
-       return -EINVAL;
+       return error;
 }
 
 static struct file_operations pmu_device_fops __pmacdata = {
 }
 
 static struct file_operations pmu_device_fops __pmacdata = {
@@ -2982,14 +2970,16 @@ static struct miscdevice pmu_device __pmacdata = {
        PMU_MINOR, "pmu", &pmu_device_fops
 };
 
        PMU_MINOR, "pmu", &pmu_device_fops
 };
 
-void pmu_device_init(void)
+static int pmu_device_init(void)
 {
        if (!via)
 {
        if (!via)
-               return;
+               return 0;
        if (misc_register(&pmu_device) < 0)
                printk(KERN_ERR "via-pmu: cannot register misc device.\n");
        if (misc_register(&pmu_device) < 0)
                printk(KERN_ERR "via-pmu: cannot register misc device.\n");
+       return 0;
 }
 }
-#endif /* CONFIG_PMAC_PBOOK */
+device_initcall(pmu_device_init);
+
 
 #ifdef DEBUG_SLEEP
 static inline void  __pmac
 
 #ifdef DEBUG_SLEEP
 static inline void  __pmac
@@ -3157,12 +3147,12 @@ EXPORT_SYMBOL(pmu_i2c_combined_read);
 EXPORT_SYMBOL(pmu_i2c_stdsub_write);
 EXPORT_SYMBOL(pmu_i2c_simple_read);
 EXPORT_SYMBOL(pmu_i2c_simple_write);
 EXPORT_SYMBOL(pmu_i2c_stdsub_write);
 EXPORT_SYMBOL(pmu_i2c_simple_read);
 EXPORT_SYMBOL(pmu_i2c_simple_write);
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 EXPORT_SYMBOL(pmu_register_sleep_notifier);
 EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
 EXPORT_SYMBOL(pmu_enable_irled);
 EXPORT_SYMBOL(pmu_battery_count);
 EXPORT_SYMBOL(pmu_batteries);
 EXPORT_SYMBOL(pmu_power_flags);
 EXPORT_SYMBOL(pmu_register_sleep_notifier);
 EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
 EXPORT_SYMBOL(pmu_enable_irled);
 EXPORT_SYMBOL(pmu_battery_count);
 EXPORT_SYMBOL(pmu_batteries);
 EXPORT_SYMBOL(pmu_power_flags);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 
index 57fd07d005493bb49525806d5fb61928021262c1..eede6be098d2c4b5e68c96aa0fa485ec64b8a1ae 100644 (file)
  * This file is licenced under the GPL.
  */
  
  * This file is licenced under the GPL.
  */
  
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PPC_PMAC
 #include <asm/machdep.h>
 #include <asm/pmac_feature.h>
 #include <asm/pci-bridge.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/pmac_feature.h>
 #include <asm/pci-bridge.h>
 #include <asm/prom.h>
-#ifndef CONFIG_PM
-#      define CONFIG_PM
-#endif
 #endif
 
 #ifndef CONFIG_PCI
 #endif
 
 #ifndef CONFIG_PCI
@@ -132,7 +129,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
        /* let things settle down a bit */
        msleep (100);
        
        /* let things settle down a bit */
        msleep (100);
        
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PPC_PMAC
        if (_machine == _MACH_Pmac) {
                struct device_node      *of_node;
  
        if (_machine == _MACH_Pmac) {
                struct device_node      *of_node;
  
@@ -141,7 +138,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
                if (of_node)
                        pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
        }
                if (of_node)
                        pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
        }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PPC_PMAC */
        return 0;
 }
 
        return 0;
 }
 
@@ -151,7 +148,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
        int                     retval = 0;
 
        struct ohci_hcd         *ohci = hcd_to_ohci (hcd);
        int                     retval = 0;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PPC_PMAC
        if (_machine == _MACH_Pmac) {
                struct device_node *of_node;
 
        if (_machine == _MACH_Pmac) {
                struct device_node *of_node;
 
@@ -160,7 +157,7 @@ static int ohci_pci_resume (struct usb_hcd *hcd)
                if (of_node)
                        pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
        }
                if (of_node)
                        pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
        }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PPC_PMAC */
 
        /* resume root hub */
        if (time_before (jiffies, ohci->next_statechange))
 
        /* resume root hub */
        if (time_before (jiffies, ohci->next_statechange))
index 9789115980a5ff0a3074a3495f6a9928745dca69..7bc1d44d88147d5368e2301a78254dba1f25f4bd 100644 (file)
@@ -350,10 +350,8 @@ static int default_vmode __initdata = VMODE_1024_768_60;
 static int default_cmode __initdata = CMODE_8;
 #endif
 
 static int default_cmode __initdata = CMODE_8;
 #endif
 
-#ifdef CONFIG_PMAC_PBOOK
 static int default_crt_on __initdata = 0;
 static int default_lcd_on __initdata = 1;
 static int default_crt_on __initdata = 0;
 static int default_lcd_on __initdata = 1;
-#endif
 
 #ifdef CONFIG_MTRR
 static int mtrr = 1;
 
 #ifdef CONFIG_MTRR
 static int mtrr = 1;
@@ -1249,7 +1247,6 @@ static int aty128_crtc_to_var(const struct aty128_crtc *crtc,
        return 0;
 }
 
        return 0;
 }
 
-#ifdef CONFIG_PMAC_PBOOK
 static void aty128_set_crt_enable(struct aty128fb_par *par, int on)
 {
        if (on) {
 static void aty128_set_crt_enable(struct aty128fb_par *par, int on)
 {
        if (on) {
@@ -1284,7 +1281,6 @@ static void aty128_set_lcd_enable(struct aty128fb_par *par, int on)
                aty_st_le32(LVDS_GEN_CNTL, reg);
        }
 }
                aty_st_le32(LVDS_GEN_CNTL, reg);
        }
 }
-#endif /* CONFIG_PMAC_PBOOK */
 
 static void aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par)
 {
 
 static void aty128_set_pll(struct aty128_pll *pll, const struct aty128fb_par *par)
 {
@@ -1491,12 +1487,10 @@ static int aty128fb_set_par(struct fb_info *info)
        info->fix.visual = par->crtc.bpp == 8 ? FB_VISUAL_PSEUDOCOLOR
                : FB_VISUAL_DIRECTCOLOR;
 
        info->fix.visual = par->crtc.bpp == 8 ? FB_VISUAL_PSEUDOCOLOR
                : FB_VISUAL_DIRECTCOLOR;
 
-#ifdef CONFIG_PMAC_PBOOK
        if (par->chip_gen == rage_M3) {
                aty128_set_crt_enable(par, par->crt_on);
                aty128_set_lcd_enable(par, par->lcd_on);
        }
        if (par->chip_gen == rage_M3) {
                aty128_set_crt_enable(par, par->crt_on);
                aty128_set_lcd_enable(par, par->lcd_on);
        }
-#endif
        if (par->accel_flags & FB_ACCELF_TEXT)
                aty128_init_engine(par);
 
        if (par->accel_flags & FB_ACCELF_TEXT)
                aty128_init_engine(par);
 
@@ -1652,7 +1646,6 @@ static int __init aty128fb_setup(char *options)
                return 0;
 
        while ((this_opt = strsep(&options, ",")) != NULL) {
                return 0;
 
        while ((this_opt = strsep(&options, ",")) != NULL) {
-#ifdef CONFIG_PMAC_PBOOK
                if (!strncmp(this_opt, "lcd:", 4)) {
                        default_lcd_on = simple_strtoul(this_opt+4, NULL, 0);
                        continue;
                if (!strncmp(this_opt, "lcd:", 4)) {
                        default_lcd_on = simple_strtoul(this_opt+4, NULL, 0);
                        continue;
@@ -1660,7 +1653,6 @@ static int __init aty128fb_setup(char *options)
                        default_crt_on = simple_strtoul(this_opt+4, NULL, 0);
                        continue;
                }
                        default_crt_on = simple_strtoul(this_opt+4, NULL, 0);
                        continue;
                }
-#endif
 #ifdef CONFIG_MTRR
                if(!strncmp(this_opt, "nomtrr", 6)) {
                        mtrr = 0;
 #ifdef CONFIG_MTRR
                if(!strncmp(this_opt, "nomtrr", 6)) {
                        mtrr = 0;
@@ -1752,10 +1744,8 @@ static int __init aty128_init(struct pci_dev *pdev, const struct pci_device_id *
        info->fbops = &aty128fb_ops;
        info->flags = FBINFO_FLAG_DEFAULT;
 
        info->fbops = &aty128fb_ops;
        info->flags = FBINFO_FLAG_DEFAULT;
 
-#ifdef CONFIG_PMAC_PBOOK
        par->lcd_on = default_lcd_on;
        par->crt_on = default_crt_on;
        par->lcd_on = default_lcd_on;
        par->crt_on = default_crt_on;
-#endif
 
        var = default_var;
 #ifdef CONFIG_PPC_PMAC
 
        var = default_var;
 #ifdef CONFIG_PPC_PMAC
@@ -2035,12 +2025,10 @@ static int aty128fb_blank(int blank, struct fb_info *fb)
 
        aty_st_8(CRTC_EXT_CNTL+1, state);
 
 
        aty_st_8(CRTC_EXT_CNTL+1, state);
 
-#ifdef CONFIG_PMAC_PBOOK
        if (par->chip_gen == rage_M3) {
                aty128_set_crt_enable(par, par->crt_on && !blank);
                aty128_set_lcd_enable(par, par->lcd_on && !blank);
        }
        if (par->chip_gen == rage_M3) {
                aty128_set_crt_enable(par, par->crt_on && !blank);
                aty128_set_lcd_enable(par, par->lcd_on && !blank);
        }
-#endif 
 #ifdef CONFIG_PMAC_BACKLIGHT
        if ((_machine == _MACH_Pmac) && !blank)
                set_backlight_enable(1);
 #ifdef CONFIG_PMAC_BACKLIGHT
        if ((_machine == _MACH_Pmac) && !blank)
                set_backlight_enable(1);
@@ -2124,7 +2112,6 @@ static int aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
                          u_long arg, struct fb_info *info)
 {
 static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
                          u_long arg, struct fb_info *info)
 {
-#ifdef CONFIG_PMAC_PBOOK
        struct aty128fb_par *par = info->par;
        u32 value;
        int rc;
        struct aty128fb_par *par = info->par;
        u32 value;
        int rc;
@@ -2149,7 +2136,6 @@ static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
                value = (par->crt_on << 1) | par->lcd_on;
                return put_user(value, (__u32 __user *)arg);
        }
                value = (par->crt_on << 1) | par->lcd_on;
                return put_user(value, (__u32 __user *)arg);
        }
-#endif
        return -EINVAL;
 }
 
        return -EINVAL;
 }
 
index 95e72550d43ff4b373ec3615b57b9399ce574a76..e75a965ec760324ff3ebe5705ebdeb4fb4c97ac6 100644 (file)
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/console.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 #include <asm/backlight.h>
 #endif
 #include <asm/io.h>
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 #include <asm/backlight.h>
 #endif
-#ifdef CONFIG_PMAC_PBOOK
-#include <linux/adb.h>
-#include <linux/pmu.h>
-#endif
 
 /*
  * Since we access the display with inb/outb to fixed port numbers,
  * we can only handle one 6555x chip.  -- paulus
  */
 
 /*
  * Since we access the display with inb/outb to fixed port numbers,
  * we can only handle one 6555x chip.  -- paulus
  */
-static struct fb_info chipsfb_info;
-
 #define write_ind(num, val, ap, dp)    do { \
        outb((num), (ap)); outb((val), (dp)); \
 } while (0)
 #define write_ind(num, val, ap, dp)    do { \
        outb((num), (ap)); outb((val), (dp)); \
 } while (0)
@@ -74,14 +69,6 @@ static struct fb_info chipsfb_info;
        inb(0x3da); read_ind(num, var, 0x3c0, 0x3c1); \
 } while (0)
 
        inb(0x3da); read_ind(num, var, 0x3c0, 0x3c1); \
 } while (0)
 
-#ifdef CONFIG_PMAC_PBOOK
-static unsigned char *save_framebuffer;
-int chips_sleep_notify(struct pmu_sleep_notifier *self, int when);
-static struct pmu_sleep_notifier chips_sleep_notifier = {
-       chips_sleep_notify, SLEEP_LEVEL_VIDEO,
-};
-#endif
-
 /*
  * Exported functions
  */
 /*
  * Exported functions
  */
@@ -356,6 +343,8 @@ static struct fb_var_screeninfo chipsfb_var __initdata = {
 
 static void __init init_chips(struct fb_info *p, unsigned long addr)
 {
 
 static void __init init_chips(struct fb_info *p, unsigned long addr)
 {
+       memset(p->screen_base, 0, 0x100000);
+
        p->fix = chipsfb_fix;
        p->fix.smem_start = addr;
 
        p->fix = chipsfb_fix;
        p->fix.smem_start = addr;
 
@@ -366,34 +355,41 @@ static void __init init_chips(struct fb_info *p, unsigned long addr)
 
        fb_alloc_cmap(&p->cmap, 256, 0);
 
 
        fb_alloc_cmap(&p->cmap, 256, 0);
 
-       if (register_framebuffer(p) < 0) {
-               printk(KERN_ERR "C&T 65550 framebuffer failed to register\n");
-               return;
-       }
-
-       printk(KERN_INFO "fb%d: Chips 65550 frame buffer (%dK RAM detected)\n",
-               p->node, p->fix.smem_len / 1024);
-
        chips_hw_init();
 }
 
 static int __devinit
 chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 {
        chips_hw_init();
 }
 
 static int __devinit
 chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
 {
-       struct fb_info *p = &chipsfb_info;
+       struct fb_info *p;
        unsigned long addr, size;
        unsigned short cmd;
        unsigned long addr, size;
        unsigned short cmd;
+       int rc = -ENODEV;
+
+       if (pci_enable_device(dp) < 0) {
+               dev_err(&dp->dev, "Cannot enable PCI device\n");
+               goto err_out;
+       }
 
        if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
 
        if ((dp->resource[0].flags & IORESOURCE_MEM) == 0)
-               return -ENODEV;
+               goto err_disable;
        addr = pci_resource_start(dp, 0);
        size = pci_resource_len(dp, 0);
        if (addr == 0)
        addr = pci_resource_start(dp, 0);
        size = pci_resource_len(dp, 0);
        if (addr == 0)
-               return -ENODEV;
-       if (p->screen_base != 0)
-               return -EBUSY;
-       if (!request_mem_region(addr, size, "chipsfb"))
-               return -EBUSY;
+               goto err_disable;
+
+       p = framebuffer_alloc(0, &dp->dev);
+       if (p == NULL) {
+               dev_err(&dp->dev, "Cannot allocate framebuffer structure\n");
+               rc = -ENOMEM;
+               goto err_disable;
+       }
+
+       if (pci_request_region(dp, 0, "chipsfb") != 0) {
+               dev_err(&dp->dev, "Cannot request framebuffer\n");
+               rc = -EBUSY;
+               goto err_release_fb;
+       }
 
 #ifdef __BIG_ENDIAN
        addr += 0x800000;       // Use big-endian aperture
 
 #ifdef __BIG_ENDIAN
        addr += 0x800000;       // Use big-endian aperture
@@ -411,37 +407,89 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
        set_backlight_enable(1);
 #endif /* CONFIG_PMAC_BACKLIGHT */
 
        set_backlight_enable(1);
 #endif /* CONFIG_PMAC_BACKLIGHT */
 
+#ifdef CONFIG_PPC
        p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE);
        p->screen_base = __ioremap(addr, 0x200000, _PAGE_NO_CACHE);
+#else
+       p->screen_base = ioremap(addr, 0x200000);
+#endif
        if (p->screen_base == NULL) {
        if (p->screen_base == NULL) {
-               release_mem_region(addr, size);
-               return -ENOMEM;
+               dev_err(&dp->dev, "Cannot map framebuffer\n");
+               rc = -ENOMEM;
+               goto err_release_pci;
        }
        }
+
+       pci_set_drvdata(dp, p);
        p->device = &dp->dev;
        p->device = &dp->dev;
+
        init_chips(p, addr);
 
        init_chips(p, addr);
 
-#ifdef CONFIG_PMAC_PBOOK
-       pmu_register_sleep_notifier(&chips_sleep_notifier);
-#endif /* CONFIG_PMAC_PBOOK */
+       if (register_framebuffer(p) < 0) {
+               dev_err(&dp->dev,"C&T 65550 framebuffer failed to register\n");
+               goto err_unmap;
+       }
+
+       dev_info(&dp->dev,"fb%d: Chips 65550 frame buffer"
+                " (%dK RAM detected)\n",
+                p->node, p->fix.smem_len / 1024);
 
 
-       pci_set_drvdata(dp, p);
        return 0;
        return 0;
+
+ err_unmap:
+       iounmap(p->screen_base);
+ err_release_pci:
+       pci_release_region(dp, 0);
+ err_release_fb:
+       framebuffer_release(p);
+ err_disable:
+ err_out:
+       return rc;
 }
 
 static void __devexit chipsfb_remove(struct pci_dev *dp)
 {
        struct fb_info *p = pci_get_drvdata(dp);
 
 }
 
 static void __devexit chipsfb_remove(struct pci_dev *dp)
 {
        struct fb_info *p = pci_get_drvdata(dp);
 
-       if (p != &chipsfb_info || p->screen_base == NULL)
+       if (p->screen_base == NULL)
                return;
        unregister_framebuffer(p);
        iounmap(p->screen_base);
        p->screen_base = NULL;
                return;
        unregister_framebuffer(p);
        iounmap(p->screen_base);
        p->screen_base = NULL;
-       release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0));
+       pci_release_region(dp, 0);
+}
+
+#ifdef CONFIG_PM
+static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+        struct fb_info *p = pci_get_drvdata(pdev);
+
+       if (state == pdev->dev.power.power_state)
+               return 0;
+       if (state != PM_SUSPEND_MEM)
+               goto done;
+
+       acquire_console_sem();
+       chipsfb_blank(1, p);
+       fb_set_suspend(p, 1);
+       release_console_sem();
+ done:
+       pdev->dev.power.power_state = state;
+       return 0;
+}
+
+static int chipsfb_pci_resume(struct pci_dev *pdev)
+{
+        struct fb_info *p = pci_get_drvdata(pdev);
 
 
-#ifdef CONFIG_PMAC_PBOOK
-       pmu_unregister_sleep_notifier(&chips_sleep_notifier);
-#endif /* CONFIG_PMAC_PBOOK */
+       acquire_console_sem();
+       fb_set_suspend(p, 0);
+       chipsfb_blank(0, p);
+       release_console_sem();
+
+       pdev->dev.power.power_state = PMSG_ON;
+       return 0;
 }
 }
+#endif /* CONFIG_PM */
+
 
 static struct pci_device_id chipsfb_pci_tbl[] = {
        { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_65550, PCI_ANY_ID, PCI_ANY_ID },
 
 static struct pci_device_id chipsfb_pci_tbl[] = {
        { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_65550, PCI_ANY_ID, PCI_ANY_ID },
@@ -455,6 +503,10 @@ static struct pci_driver chipsfb_driver = {
        .id_table =     chipsfb_pci_tbl,
        .probe =        chipsfb_pci_init,
        .remove =       __devexit_p(chipsfb_remove),
        .id_table =     chipsfb_pci_tbl,
        .probe =        chipsfb_pci_init,
        .remove =       __devexit_p(chipsfb_remove),
+#ifdef CONFIG_PM
+       .suspend =      chipsfb_pci_suspend,
+       .resume =       chipsfb_pci_resume,
+#endif
 };
 
 int __init chips_init(void)
 };
 
 int __init chips_init(void)
@@ -472,48 +524,4 @@ static void __exit chipsfb_exit(void)
        pci_unregister_driver(&chipsfb_driver);
 }
 
        pci_unregister_driver(&chipsfb_driver);
 }
 
-#ifdef CONFIG_PMAC_PBOOK
-/*
- * Save the contents of the frame buffer when we go to sleep,
- * and restore it when we wake up again.
- */
-int
-chips_sleep_notify(struct pmu_sleep_notifier *self, int when)
-{
-       struct fb_info *p = &chipsfb_info;
-       int nb = p->var.yres * p->fix.line_length;
-
-       if (p->screen_base == NULL)
-               return PBOOK_SLEEP_OK;
-
-       switch (when) {
-       case PBOOK_SLEEP_REQUEST:
-               save_framebuffer = vmalloc(nb);
-               if (save_framebuffer == NULL)
-                       return PBOOK_SLEEP_REFUSE;
-               break;
-       case PBOOK_SLEEP_REJECT:
-               if (save_framebuffer) {
-                       vfree(save_framebuffer);
-                       save_framebuffer = NULL;
-               }
-               break;
-       case PBOOK_SLEEP_NOW:
-               chipsfb_blank(1, p);
-               if (save_framebuffer)
-                       memcpy(save_framebuffer, p->screen_base, nb);
-               break;
-       case PBOOK_WAKE:
-               if (save_framebuffer) {
-                       memcpy(p->screen_base, save_framebuffer, nb);
-                       vfree(save_framebuffer);
-                       save_framebuffer = NULL;
-               }
-               chipsfb_blank(0, p);
-               break;
-       }
-       return PBOOK_SLEEP_OK;
-}
-#endif /* CONFIG_PMAC_PBOOK */
-
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");
index 6d73eada277e34acb74391ba5b0eb323e4707679..373bd3b9b330f2db82c06d3ef59ec0f9e1829834 100644 (file)
@@ -166,7 +166,7 @@ extern int pmu_i2c_simple_read(int bus, int addr,  u8* data, int len);
 extern int pmu_i2c_simple_write(int bus, int addr,  u8* data, int len);
 
 
 extern int pmu_i2c_simple_write(int bus, int addr,  u8* data, int len);
 
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /*
  * Stuff for putting the powerbook to sleep and waking it again.
  *
 /*
  * Stuff for putting the powerbook to sleep and waking it again.
  *
@@ -208,6 +208,8 @@ struct pmu_sleep_notifier
 int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
 int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
 
 int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
 int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
 
+#endif /* CONFIG_PM */
+
 #define PMU_MAX_BATTERIES      2
 
 /* values for pmu_power_flags */
 #define PMU_MAX_BATTERIES      2
 
 /* values for pmu_power_flags */
@@ -235,6 +237,4 @@ extern int pmu_battery_count;
 extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
 extern unsigned int pmu_power_flags;
 
 extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
 extern unsigned int pmu_power_flags;
 
-#endif /* CONFIG_PMAC_PBOOK */
-
 #endif /* __KERNEL__ */
 #endif /* __KERNEL__ */
index 33108661e671340d75a0a373fab0933525e86242..2704e1598addd4438a9bb1bd7d8b0c1611e1d08b 100644 (file)
@@ -255,7 +255,7 @@ static int awacs_burgundy_read_mvolume(unsigned address);
 
 static volatile struct dbdma_cmd *emergency_dbdma_cmd;
 
 
 static volatile struct dbdma_cmd *emergency_dbdma_cmd;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /*
  * Stuff for restoring after a sleep.
  */
 /*
  * Stuff for restoring after a sleep.
  */
@@ -263,7 +263,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when);
 struct pmu_sleep_notifier awacs_sleep_notifier = {
        awacs_sleep_notify, SLEEP_LEVEL_SOUND,
 };
 struct pmu_sleep_notifier awacs_sleep_notifier = {
        awacs_sleep_notify, SLEEP_LEVEL_SOUND,
 };
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 /* for (soft) sample rate translations */
 int expand_bal;                /* Balance factor for expanding (not volume!) */
 
 /* for (soft) sample rate translations */
 int expand_bal;                /* Balance factor for expanding (not volume!) */
@@ -675,7 +675,7 @@ static void PMacIrqCleanup(void)
        kfree(awacs_rx_cmd_space);
        kfree(beep_dbdma_cmd_space);
        kfree(beep_buf);
        kfree(awacs_rx_cmd_space);
        kfree(beep_dbdma_cmd_space);
        kfree(beep_buf);
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        pmu_unregister_sleep_notifier(&awacs_sleep_notifier);
 #endif
 }
        pmu_unregister_sleep_notifier(&awacs_sleep_notifier);
 #endif
 }
@@ -1415,7 +1415,7 @@ load_awacs(void)
        }
 }
 
        }
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /*
  * Save state when going to sleep, restore it afterwards.
  */
 /*
  * Save state when going to sleep, restore it afterwards.
  */
@@ -1551,7 +1551,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
        }
        return PBOOK_SLEEP_OK;
 }
        }
        return PBOOK_SLEEP_OK;
 }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 
 /* All the burgundy functions: */
 
 
 /* All the burgundy functions: */
@@ -3053,9 +3053,9 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
        if ((res=setup_beep()))
                return res ;
 
        if ((res=setup_beep()))
                return res ;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        pmu_register_sleep_notifier(&awacs_sleep_notifier);
        pmu_register_sleep_notifier(&awacs_sleep_notifier);
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
        /* Powerbooks have odd ways of enabling inputs such as
           an expansion-bay CD or sound from an internal modem
 
        /* Powerbooks have odd ways of enabling inputs such as
           an expansion-bay CD or sound from an internal modem
index e052bd071e5bf1875af5732995e7871e26045d1c..061e52d3d771b4e39226a07de44bf58d4b606825 100644 (file)
@@ -90,7 +90,7 @@ snd_pmac_awacs_write_noreg(pmac_t *chip, int reg, int val)
        snd_pmac_awacs_write(chip, val | (reg << 12));
 }
 
        snd_pmac_awacs_write(chip, val | (reg << 12));
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /* Recalibrate chip */
 static void screamer_recalibrate(pmac_t *chip)
 {
 /* Recalibrate chip */
 static void screamer_recalibrate(pmac_t *chip)
 {
@@ -642,7 +642,7 @@ static void awacs_restore_all_regs(pmac_t *chip)
        }
 }
 
        }
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 static void snd_pmac_awacs_suspend(pmac_t *chip)
 {
        snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1]
 static void snd_pmac_awacs_suspend(pmac_t *chip)
 {
        snd_pmac_awacs_write_noreg(chip, 1, (chip->awacs_reg[1]
@@ -676,7 +676,7 @@ static void snd_pmac_awacs_resume(pmac_t *chip)
        }
 #endif
 }
        }
 #endif
 }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 #ifdef PMAC_SUPPORT_AUTOMUTE
 /*
 
 #ifdef PMAC_SUPPORT_AUTOMUTE
 /*
@@ -883,7 +883,7 @@ snd_pmac_awacs_init(pmac_t *chip)
         * set lowlevel callbacks
         */
        chip->set_format = snd_pmac_awacs_set_format;
         * set lowlevel callbacks
         */
        chip->set_format = snd_pmac_awacs_set_format;
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        chip->suspend = snd_pmac_awacs_suspend;
        chip->resume = snd_pmac_awacs_resume;
 #endif
        chip->suspend = snd_pmac_awacs_suspend;
        chip->resume = snd_pmac_awacs_resume;
 #endif
index f24a91693616f622925988adcf23f970651537e6..a737f298e77da31228d766e8676d65454590ee63 100644 (file)
@@ -218,7 +218,7 @@ static snd_kcontrol_new_t daca_mixers[] = {
 };
 
 
 };
 
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 static void daca_resume(pmac_t *chip)
 {
        pmac_daca_t *mix = chip->mixer_data;
 static void daca_resume(pmac_t *chip)
 {
        pmac_daca_t *mix = chip->mixer_data;
@@ -227,7 +227,7 @@ static void daca_resume(pmac_t *chip)
                                  mix->amp_on ? 0x05 : 0x04);
        daca_set_volume(mix);
 }
                                  mix->amp_on ? 0x05 : 0x04);
        daca_set_volume(mix);
 }
-#endif /* CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
 
 
 static void daca_cleanup(pmac_t *chip)
 
 
 static void daca_cleanup(pmac_t *chip)
@@ -275,7 +275,7 @@ int __init snd_pmac_daca_init(pmac_t *chip)
                        return err;
        }
 
                        return err;
        }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        chip->resume = daca_resume;
 #endif
 
        chip->resume = daca_resume;
 #endif
 
index 080ef3928465cd1c55256b131d4cb9eaf2fee089..75b8b74230367cc1f4bc7c9c0ec1c656d0705044 100644 (file)
@@ -36,7 +36,7 @@
 #include <asm/pci-bridge.h>
 
 
 #include <asm/pci-bridge.h>
 
 
-#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
+#ifdef CONFIG_PM
 static int snd_pmac_register_sleep_notifier(pmac_t *chip);
 static int snd_pmac_unregister_sleep_notifier(pmac_t *chip);
 static int snd_pmac_suspend(snd_card_t *card, pm_message_t state);
 static int snd_pmac_register_sleep_notifier(pmac_t *chip);
 static int snd_pmac_unregister_sleep_notifier(pmac_t *chip);
 static int snd_pmac_suspend(snd_card_t *card, pm_message_t state);
@@ -782,7 +782,7 @@ static int snd_pmac_free(pmac_t *chip)
        }
 
        snd_pmac_sound_feature(chip, 0);
        }
 
        snd_pmac_sound_feature(chip, 0);
-#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
+#ifdef CONFIG_PM
        snd_pmac_unregister_sleep_notifier(chip);
 #endif
 
        snd_pmac_unregister_sleep_notifier(chip);
 #endif
 
@@ -1292,7 +1292,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
        /* Reset dbdma channels */
        snd_pmac_dbdma_reset(chip);
 
        /* Reset dbdma channels */
        snd_pmac_dbdma_reset(chip);
 
-#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
+#ifdef CONFIG_PM
        /* add sleep notifier */
        if (! snd_pmac_register_sleep_notifier(chip))
                snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip);
        /* add sleep notifier */
        if (! snd_pmac_register_sleep_notifier(chip))
                snd_card_set_pm_callback(chip->card, snd_pmac_suspend, snd_pmac_resume, chip);
@@ -1316,7 +1316,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
  * sleep notify for powerbook
  */
 
  * sleep notify for powerbook
  */
 
-#if defined(CONFIG_PM) && defined(CONFIG_PMAC_PBOOK)
+#ifdef CONFIG_PM
 
 /*
  * Save state when going to sleep, restore it afterwards.
 
 /*
  * Save state when going to sleep, restore it afterwards.
@@ -1414,4 +1414,5 @@ static int snd_pmac_unregister_sleep_notifier(pmac_t *chip)
        return 0;
 }
 
        return 0;
 }
 
-#endif /* CONFIG_PM && CONFIG_PMAC_PBOOK */
+#endif /* CONFIG_PM */
+
index 0a84c05f714b2c27ff40b3e3f02ed61c925a94b2..582db522011978849a8f0f2deb09a6e8a30d7d31 100644 (file)
@@ -167,7 +167,7 @@ struct snd_pmac {
        void (*set_format)(pmac_t *chip);
        void (*update_automute)(pmac_t *chip, int do_notify);
        int (*detect_headphone)(pmac_t *chip);
        void (*set_format)(pmac_t *chip);
        void (*update_automute)(pmac_t *chip, int do_notify);
        int (*detect_headphone)(pmac_t *chip);
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        void (*suspend)(pmac_t *chip);
        void (*resume)(pmac_t *chip);
 #endif
        void (*suspend)(pmac_t *chip);
        void (*resume)(pmac_t *chip);
 #endif
index 9332237cb6a46ed290daf1df57597e2030339fcc..36c5d5d45bb1302bf0765f73ff2c41a8358a6005 100644 (file)
@@ -1128,7 +1128,7 @@ static void tumbler_reset_audio(pmac_t *chip)
        }
 }
 
        }
 }
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
 /* suspend mixer */
 static void tumbler_suspend(pmac_t *chip)
 {
 /* suspend mixer */
 static void tumbler_suspend(pmac_t *chip)
 {
@@ -1370,7 +1370,7 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
        if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
                return err;
 
        if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
                return err;
 
-#ifdef CONFIG_PMAC_PBOOK
+#ifdef CONFIG_PM
        chip->suspend = tumbler_suspend;
        chip->resume = tumbler_resume;
 #endif
        chip->suspend = tumbler_suspend;
        chip->resume = tumbler_resume;
 #endif