aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-01-06 15:59:59 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-06 15:59:59 -0500
commitccf18968b1bbc2fb117190a1984ac2a826dac228 (patch)
tree7bc8fbf5722aecf1e84fa50c31c657864cba1daa /sound
parente91c021c487110386a07facd0396e6c3b7cf9c1f (diff)
parentd99cf9d679a520d67f81d805b7cb91c68e1847f0 (diff)
Merge ../torvalds-2.6/
Diffstat (limited to 'sound')
-rw-r--r--sound/oss/ad1848.c92
-rw-r--r--sound/oss/cs4281/cs4281m.c21
-rw-r--r--sound/oss/cs4281/cs4281pm-24.c39
-rw-r--r--sound/oss/cs46xx.c60
-rw-r--r--sound/oss/cs46xxpm-24.h4
-rw-r--r--sound/oss/maestro.c149
-rw-r--r--sound/oss/nm256_audio.c47
-rw-r--r--sound/oss/opl3sa2.c110
8 files changed, 1 insertions, 521 deletions
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index 3f30c57676c1..49796be955f3 100644
--- a/sound/oss/ad1848.c
+++ b/sound/oss/ad1848.c
@@ -46,8 +46,6 @@
46#include <linux/interrupt.h> 46#include <linux/interrupt.h>
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/stddef.h> 48#include <linux/stddef.h>
49#include <linux/pm.h>
50#include <linux/pm_legacy.h>
51#include <linux/isapnp.h> 49#include <linux/isapnp.h>
52#include <linux/pnp.h> 50#include <linux/pnp.h>
53#include <linux/spinlock.h> 51#include <linux/spinlock.h>
@@ -105,9 +103,6 @@ typedef struct
105 int irq_ok; 103 int irq_ok;
106 mixer_ents *mix_devices; 104 mixer_ents *mix_devices;
107 int mixer_output_port; 105 int mixer_output_port;
108
109 /* Power management */
110 struct pm_dev *pmdev;
111} ad1848_info; 106} ad1848_info;
112 107
113typedef struct ad1848_port_info 108typedef struct ad1848_port_info
@@ -201,7 +196,6 @@ static void ad1848_halt(int dev);
201static void ad1848_halt_input(int dev); 196static void ad1848_halt_input(int dev);
202static void ad1848_halt_output(int dev); 197static void ad1848_halt_output(int dev);
203static void ad1848_trigger(int dev, int bits); 198static void ad1848_trigger(int dev, int bits);
204static int ad1848_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
205 199
206#ifndef EXCLUDE_TIMERS 200#ifndef EXCLUDE_TIMERS
207static int ad1848_tmr_install(int dev); 201static int ad1848_tmr_install(int dev);
@@ -2027,10 +2021,6 @@ int ad1848_init (char *name, struct resource *ports, int irq, int dma_playback,
2027 2021
2028 nr_ad1848_devs++; 2022 nr_ad1848_devs++;
2029 2023
2030 devc->pmdev = pm_register(PM_ISA_DEV, my_dev, ad1848_pm_callback);
2031 if (devc->pmdev)
2032 devc->pmdev->data = devc;
2033
2034 ad1848_init_hw(devc); 2024 ad1848_init_hw(devc);
2035 2025
2036 if (irq > 0) 2026 if (irq > 0)
@@ -2197,9 +2187,6 @@ void ad1848_unload(int io_base, int irq, int dma_playback, int dma_capture, int
2197 if(mixer>=0) 2187 if(mixer>=0)
2198 sound_unload_mixerdev(mixer); 2188 sound_unload_mixerdev(mixer);
2199 2189
2200 if (devc->pmdev)
2201 pm_unregister(devc->pmdev);
2202
2203 nr_ad1848_devs--; 2190 nr_ad1848_devs--;
2204 for ( ; i < nr_ad1848_devs ; i++) 2191 for ( ; i < nr_ad1848_devs ; i++)
2205 adev_info[i] = adev_info[i+1]; 2192 adev_info[i] = adev_info[i+1];
@@ -2811,85 +2798,6 @@ static int ad1848_tmr_install(int dev)
2811} 2798}
2812#endif /* EXCLUDE_TIMERS */ 2799#endif /* EXCLUDE_TIMERS */
2813 2800
2814static int ad1848_suspend(ad1848_info *devc)
2815{
2816 unsigned long flags;
2817
2818 spin_lock_irqsave(&devc->lock,flags);
2819
2820 ad_mute(devc);
2821
2822 spin_unlock_irqrestore(&devc->lock,flags);
2823 return 0;
2824}
2825
2826static int ad1848_resume(ad1848_info *devc)
2827{
2828 int mixer_levels[32], i;
2829
2830 /* Thinkpad is a bit more of PITA than normal. The BIOS tends to
2831 restore it in a different config to the one we use. Need to
2832 fix this somehow */
2833
2834 /* store old mixer levels */
2835 memcpy(mixer_levels, devc->levels, sizeof (mixer_levels));
2836 ad1848_init_hw(devc);
2837
2838 /* restore mixer levels */
2839 for (i = 0; i < 32; i++)
2840 ad1848_mixer_set(devc, devc->dev_no, mixer_levels[i]);
2841
2842 if (!devc->subtype) {
2843 static signed char interrupt_bits[12] = { -1, -1, -1, -1, -1, 0x00, -1, 0x08, -1, 0x10, 0x18, 0x20 };
2844 static char dma_bits[4] = { 1, 2, 0, 3 };
2845 unsigned long flags;
2846 signed char bits;
2847 char dma2_bit = 0;
2848
2849 int config_port = devc->base + 0;
2850
2851 bits = interrupt_bits[devc->irq];
2852 if (bits == -1) {
2853 printk(KERN_ERR "MSS: Bad IRQ %d\n", devc->irq);
2854 return -1;
2855 }
2856
2857 spin_lock_irqsave(&devc->lock,flags);
2858
2859 outb((bits | 0x40), config_port);
2860
2861 if (devc->dma2 != -1 && devc->dma2 != devc->dma1)
2862 if ( (devc->dma1 == 0 && devc->dma2 == 1) ||
2863 (devc->dma1 == 1 && devc->dma2 == 0) ||
2864 (devc->dma1 == 3 && devc->dma2 == 0))
2865 dma2_bit = 0x04;
2866
2867 outb((bits | dma_bits[devc->dma1] | dma2_bit), config_port);
2868 spin_unlock_irqrestore(&devc->lock,flags);
2869 }
2870
2871 return 0;
2872}
2873
2874static int ad1848_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
2875{
2876 ad1848_info *devc = dev->data;
2877 if (devc) {
2878 DEB(printk("ad1848: pm event received: 0x%x\n", rqst));
2879
2880 switch (rqst) {
2881 case PM_SUSPEND:
2882 ad1848_suspend(devc);
2883 break;
2884 case PM_RESUME:
2885 ad1848_resume(devc);
2886 break;
2887 }
2888 }
2889 return 0;
2890}
2891
2892
2893EXPORT_SYMBOL(ad1848_detect); 2801EXPORT_SYMBOL(ad1848_detect);
2894EXPORT_SYMBOL(ad1848_init); 2802EXPORT_SYMBOL(ad1848_init);
2895EXPORT_SYMBOL(ad1848_unload); 2803EXPORT_SYMBOL(ad1848_unload);
diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
index adc689649fe1..46dd41dc2a34 100644
--- a/sound/oss/cs4281/cs4281m.c
+++ b/sound/oss/cs4281/cs4281m.c
@@ -298,7 +298,6 @@ struct cs4281_state {
298 struct cs4281_pipeline pl[CS4281_NUMBER_OF_PIPELINES]; 298 struct cs4281_pipeline pl[CS4281_NUMBER_OF_PIPELINES];
299}; 299};
300 300
301#include <linux/pm_legacy.h>
302#include "cs4281pm-24.c" 301#include "cs4281pm-24.c"
303 302
304#if CSDEBUG 303#if CSDEBUG
@@ -4256,9 +4255,6 @@ static void __devinit cs4281_InitPM(struct cs4281_state *s)
4256static int __devinit cs4281_probe(struct pci_dev *pcidev, 4255static int __devinit cs4281_probe(struct pci_dev *pcidev,
4257 const struct pci_device_id *pciid) 4256 const struct pci_device_id *pciid)
4258{ 4257{
4259#ifndef NOT_CS4281_PM
4260 struct pm_dev *pmdev;
4261#endif
4262 struct cs4281_state *s; 4258 struct cs4281_state *s;
4263 dma_addr_t dma_mask; 4259 dma_addr_t dma_mask;
4264 mm_segment_t fs; 4260 mm_segment_t fs;
@@ -4374,19 +4370,7 @@ static int __devinit cs4281_probe(struct pci_dev *pcidev,
4374 } 4370 }
4375#ifndef NOT_CS4281_PM 4371#ifndef NOT_CS4281_PM
4376 cs4281_InitPM(s); 4372 cs4281_InitPM(s);
4377 pmdev = cs_pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev), cs4281_pm_callback); 4373 s->pm.flags |= CS4281_PM_NOT_REGISTERED;
4378 if (pmdev)
4379 {
4380 CS_DBGOUT(CS_INIT | CS_PM, 4, printk(KERN_INFO
4381 "cs4281: probe() pm_register() succeeded (%p).\n", pmdev));
4382 pmdev->data = s;
4383 }
4384 else
4385 {
4386 CS_DBGOUT(CS_INIT | CS_PM | CS_ERROR, 0, printk(KERN_INFO
4387 "cs4281: probe() pm_register() failed (%p).\n", pmdev));
4388 s->pm.flags |= CS4281_PM_NOT_REGISTERED;
4389 }
4390#endif 4374#endif
4391 4375
4392 pci_set_master(pcidev); // enable bus mastering 4376 pci_set_master(pcidev); // enable bus mastering
@@ -4487,9 +4471,6 @@ static int __init cs4281_init_module(void)
4487static void __exit cs4281_cleanup_module(void) 4471static void __exit cs4281_cleanup_module(void)
4488{ 4472{
4489 pci_unregister_driver(&cs4281_pci_driver); 4473 pci_unregister_driver(&cs4281_pci_driver);
4490#ifndef NOT_CS4281_PM
4491 cs_pm_unregister_all(cs4281_pm_callback);
4492#endif
4493 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, 4474 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2,
4494 printk(KERN_INFO "cs4281: cleanup_cs4281() finished\n")); 4475 printk(KERN_INFO "cs4281: cleanup_cs4281() finished\n"));
4495} 4476}
diff --git a/sound/oss/cs4281/cs4281pm-24.c b/sound/oss/cs4281/cs4281pm-24.c
index d2a453aff0aa..90cbd7679534 100644
--- a/sound/oss/cs4281/cs4281pm-24.c
+++ b/sound/oss/cs4281/cs4281pm-24.c
@@ -27,9 +27,6 @@
27#ifndef NOT_CS4281_PM 27#ifndef NOT_CS4281_PM
28#include <linux/pm.h> 28#include <linux/pm.h>
29 29
30#define cs_pm_register(a, b, c) pm_register((a), (b), (c));
31#define cs_pm_unregister_all(a) pm_unregister_all((a));
32
33static int cs4281_suspend(struct cs4281_state *s); 30static int cs4281_suspend(struct cs4281_state *s);
34static int cs4281_resume(struct cs4281_state *s); 31static int cs4281_resume(struct cs4281_state *s);
35/* 32/*
@@ -41,42 +38,6 @@ static int cs4281_resume(struct cs4281_state *s);
41#define CS4281_SUSPEND_TBL cs4281_suspend_null 38#define CS4281_SUSPEND_TBL cs4281_suspend_null
42#define CS4281_RESUME_TBL cs4281_resume_null 39#define CS4281_RESUME_TBL cs4281_resume_null
43 40
44static int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
45{
46 struct cs4281_state *state;
47
48 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
49 "cs4281: cs4281_pm_callback dev=%p rqst=0x%x state=%p\n",
50 dev,(unsigned)rqst,data));
51 state = (struct cs4281_state *) dev->data;
52 if (state) {
53 switch(rqst) {
54 case PM_SUSPEND:
55 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
56 "cs4281: PM suspend request\n"));
57 if(cs4281_suspend(state))
58 {
59 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
60 "cs4281: PM suspend request refused\n"));
61 return 1;
62 }
63 break;
64 case PM_RESUME:
65 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
66 "cs4281: PM resume request\n"));
67 if(cs4281_resume(state))
68 {
69 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
70 "cs4281: PM resume request refused\n"));
71 return 1;
72 }
73 break;
74 }
75 }
76
77 return 0;
78}
79
80#else /* CS4281_PM */ 41#else /* CS4281_PM */
81#define CS4281_SUSPEND_TBL cs4281_suspend_null 42#define CS4281_SUSPEND_TBL cs4281_suspend_null
82#define CS4281_RESUME_TBL cs4281_resume_null 43#define CS4281_RESUME_TBL cs4281_resume_null
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
index cb998e8c0fdd..0da4d93f04a6 100644
--- a/sound/oss/cs46xx.c
+++ b/sound/oss/cs46xx.c
@@ -391,10 +391,6 @@ static void cs461x_clear_serial_FIFOs(struct cs_card *card, int type);
391static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state); 391static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state);
392static int cs46xx_resume_tbl(struct pci_dev *pcidev); 392static int cs46xx_resume_tbl(struct pci_dev *pcidev);
393 393
394#ifndef CS46XX_ACPI_SUPPORT
395static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
396#endif
397
398#if CSDEBUG 394#if CSDEBUG
399 395
400/* DEBUG ROUTINES */ 396/* DEBUG ROUTINES */
@@ -5320,7 +5316,6 @@ static const char fndmsg[] = KERN_INFO "cs46xx: Found %d audio device(s).\n";
5320static int __devinit cs46xx_probe(struct pci_dev *pci_dev, 5316static int __devinit cs46xx_probe(struct pci_dev *pci_dev,
5321 const struct pci_device_id *pciid) 5317 const struct pci_device_id *pciid)
5322{ 5318{
5323 struct pm_dev *pmdev;
5324 int i,j; 5319 int i,j;
5325 u16 ss_card, ss_vendor; 5320 u16 ss_card, ss_vendor;
5326 struct cs_card *card; 5321 struct cs_card *card;
@@ -5530,22 +5525,6 @@ static int __devinit cs46xx_probe(struct pci_dev *pci_dev,
5530 PCI_SET_DMA_MASK(pci_dev, dma_mask); 5525 PCI_SET_DMA_MASK(pci_dev, dma_mask);
5531 list_add(&card->list, &cs46xx_devs); 5526 list_add(&card->list, &cs46xx_devs);
5532 5527
5533 pmdev = cs_pm_register(PM_PCI_DEV, PM_PCI_ID(pci_dev), cs46xx_pm_callback);
5534 if (pmdev)
5535 {
5536 CS_DBGOUT(CS_INIT | CS_PM, 4, printk(KERN_INFO
5537 "cs46xx: probe() pm_register() succeeded (%p).\n",
5538 pmdev));
5539 pmdev->data = card;
5540 }
5541 else
5542 {
5543 CS_DBGOUT(CS_INIT | CS_PM | CS_ERROR, 2, printk(KERN_INFO
5544 "cs46xx: probe() pm_register() failed (%p).\n",
5545 pmdev));
5546 card->pm.flags |= CS46XX_PM_NOT_REGISTERED;
5547 }
5548
5549 CS_DBGOUT(CS_PM, 9, printk(KERN_INFO "cs46xx: pm.flags=0x%x card=%p\n", 5528 CS_DBGOUT(CS_PM, 9, printk(KERN_INFO "cs46xx: pm.flags=0x%x card=%p\n",
5550 (unsigned)card->pm.flags,card)); 5529 (unsigned)card->pm.flags,card));
5551 5530
@@ -5727,7 +5706,6 @@ static int __init cs46xx_init_module(void)
5727static void __exit cs46xx_cleanup_module(void) 5706static void __exit cs46xx_cleanup_module(void)
5728{ 5707{
5729 pci_unregister_driver(&cs46xx_pci_driver); 5708 pci_unregister_driver(&cs46xx_pci_driver);
5730 cs_pm_unregister_all(cs46xx_pm_callback);
5731 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, 5709 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2,
5732 printk(KERN_INFO "cs46xx: cleanup_cs46xx() finished\n")); 5710 printk(KERN_INFO "cs46xx: cleanup_cs46xx() finished\n"));
5733} 5711}
@@ -5735,44 +5713,6 @@ static void __exit cs46xx_cleanup_module(void)
5735module_init(cs46xx_init_module); 5713module_init(cs46xx_init_module);
5736module_exit(cs46xx_cleanup_module); 5714module_exit(cs46xx_cleanup_module);
5737 5715
5738#ifndef CS46XX_ACPI_SUPPORT
5739static int cs46xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
5740{
5741 struct cs_card *card;
5742
5743 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
5744 "cs46xx: cs46xx_pm_callback dev=%p rqst=0x%x card=%p\n",
5745 dev,(unsigned)rqst,data));
5746 card = (struct cs_card *) dev->data;
5747 if (card) {
5748 switch(rqst) {
5749 case PM_SUSPEND:
5750 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
5751 "cs46xx: PM suspend request\n"));
5752 if(cs46xx_suspend(card, PMSG_SUSPEND))
5753 {
5754 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
5755 "cs46xx: PM suspend request refused\n"));
5756 return 1;
5757 }
5758 break;
5759 case PM_RESUME:
5760 CS_DBGOUT(CS_PM, 2, printk(KERN_INFO
5761 "cs46xx: PM resume request\n"));
5762 if(cs46xx_resume(card))
5763 {
5764 CS_DBGOUT(CS_ERROR, 2, printk(KERN_INFO
5765 "cs46xx: PM resume request refused\n"));
5766 return 1;
5767 }
5768 break;
5769 }
5770 }
5771
5772 return 0;
5773}
5774#endif
5775
5776#if CS46XX_ACPI_SUPPORT 5716#if CS46XX_ACPI_SUPPORT
5777static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state) 5717static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state)
5778{ 5718{
diff --git a/sound/oss/cs46xxpm-24.h b/sound/oss/cs46xxpm-24.h
index e220bd7240f1..ad82db84d013 100644
--- a/sound/oss/cs46xxpm-24.h
+++ b/sound/oss/cs46xxpm-24.h
@@ -38,13 +38,9 @@
38*/ 38*/
39static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state); 39static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state);
40static int cs46xx_resume_tbl(struct pci_dev *pcidev); 40static int cs46xx_resume_tbl(struct pci_dev *pcidev);
41#define cs_pm_register(a, b, c) NULL
42#define cs_pm_unregister_all(a)
43#define CS46XX_SUSPEND_TBL cs46xx_suspend_tbl 41#define CS46XX_SUSPEND_TBL cs46xx_suspend_tbl
44#define CS46XX_RESUME_TBL cs46xx_resume_tbl 42#define CS46XX_RESUME_TBL cs46xx_resume_tbl
45#else 43#else
46#define cs_pm_register(a, b, c) pm_register((a), (b), (c));
47#define cs_pm_unregister_all(a) pm_unregister_all((a));
48#define CS46XX_SUSPEND_TBL cs46xx_null 44#define CS46XX_SUSPEND_TBL cs46xx_null
49#define CS46XX_RESUME_TBL cs46xx_null 45#define CS46XX_RESUME_TBL cs46xx_null
50#endif 46#endif
diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c
index 3abd3541cbc7..f9ac5b16f61a 100644
--- a/sound/oss/maestro.c
+++ b/sound/oss/maestro.c
@@ -230,10 +230,6 @@
230#include <asm/page.h> 230#include <asm/page.h>
231#include <asm/uaccess.h> 231#include <asm/uaccess.h>
232 232
233#include <linux/pm.h>
234#include <linux/pm_legacy.h>
235static int maestro_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *d);
236
237#include "maestro.h" 233#include "maestro.h"
238 234
239static struct pci_driver maestro_pci_driver; 235static struct pci_driver maestro_pci_driver;
@@ -3404,7 +3400,6 @@ maestro_probe(struct pci_dev *pcidev,const struct pci_device_id *pdid)
3404 int i, ret; 3400 int i, ret;
3405 struct ess_card *card; 3401 struct ess_card *card;
3406 struct ess_state *ess; 3402 struct ess_state *ess;
3407 struct pm_dev *pmdev;
3408 int num = 0; 3403 int num = 0;
3409 3404
3410/* when built into the kernel, we only print version if device is found */ 3405/* when built into the kernel, we only print version if device is found */
@@ -3450,11 +3445,6 @@ maestro_probe(struct pci_dev *pcidev,const struct pci_device_id *pdid)
3450 memset(card, 0, sizeof(*card)); 3445 memset(card, 0, sizeof(*card));
3451 card->pcidev = pcidev; 3446 card->pcidev = pcidev;
3452 3447
3453 pmdev = pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev),
3454 maestro_pm_callback);
3455 if (pmdev)
3456 pmdev->data = card;
3457
3458 card->iobase = iobase; 3448 card->iobase = iobase;
3459 card->card_type = card_type; 3449 card->card_type = card_type;
3460 card->irq = pcidev->irq; 3450 card->irq = pcidev->irq;
@@ -3670,7 +3660,6 @@ static int maestro_notifier(struct notifier_block *nb, unsigned long event, void
3670static void cleanup_maestro(void) { 3660static void cleanup_maestro(void) {
3671 M_printk("maestro: unloading\n"); 3661 M_printk("maestro: unloading\n");
3672 pci_unregister_driver(&maestro_pci_driver); 3662 pci_unregister_driver(&maestro_pci_driver);
3673 pm_unregister_all(maestro_pm_callback);
3674 unregister_reboot_notifier(&maestro_nb); 3663 unregister_reboot_notifier(&maestro_nb);
3675} 3664}
3676 3665
@@ -3691,143 +3680,5 @@ check_suspend(struct ess_card *card)
3691 current->state = TASK_RUNNING; 3680 current->state = TASK_RUNNING;
3692} 3681}
3693 3682
3694static int
3695maestro_suspend(struct ess_card *card)
3696{
3697 unsigned long flags;
3698 int i,j;
3699
3700 spin_lock_irqsave(&card->lock,flags); /* over-kill */
3701
3702 M_printk("maestro: apm in dev %p\n",card);
3703
3704 /* we have to read from the apu regs, need
3705 to power it up */
3706 maestro_power(card,ACPI_D0);
3707
3708 for(i=0;i<NR_DSPS;i++) {
3709 struct ess_state *s = &card->channels[i];
3710
3711 if(s->dev_audio == -1)
3712 continue;
3713
3714 M_printk("maestro: stopping apus for device %d\n",i);
3715 stop_dac(s);
3716 stop_adc(s);
3717 for(j=0;j<6;j++)
3718 card->apu_map[s->apu[j]][5]=apu_get_register(s,j,5);
3719
3720 }
3721
3722 /* get rid of interrupts? */
3723 if( card->dsps_open > 0)
3724 stop_bob(&card->channels[0]);
3725
3726 card->in_suspend++;
3727
3728 spin_unlock_irqrestore(&card->lock,flags);
3729
3730 /* we trust in the bios to power down the chip on suspend.
3731 * XXX I'm also not sure that in_suspend will protect
3732 * against all reg accesses from here on out.
3733 */
3734 return 0;
3735}
3736static int
3737maestro_resume(struct ess_card *card)
3738{
3739 unsigned long flags;
3740 int i;
3741
3742 spin_lock_irqsave(&card->lock,flags); /* over-kill */
3743
3744 card->in_suspend = 0;
3745
3746 M_printk("maestro: resuming card at %p\n",card);
3747
3748 /* restore all our config */
3749 maestro_config(card);
3750 /* need to restore the base pointers.. */
3751 if(card->dmapages)
3752 set_base_registers(&card->channels[0],card->dmapages);
3753
3754 mixer_push_state(card);
3755
3756 /* set each channels' apu control registers before
3757 * restoring audio
3758 */
3759 for(i=0;i<NR_DSPS;i++) {
3760 struct ess_state *s = &card->channels[i];
3761 int chan,reg;
3762
3763 if(s->dev_audio == -1)
3764 continue;
3765
3766 for(chan = 0 ; chan < 6 ; chan++) {
3767 wave_set_register(s,s->apu[chan]<<3,s->apu_base[chan]);
3768 for(reg = 1 ; reg < NR_APU_REGS ; reg++)
3769 apu_set_register(s,chan,reg,s->card->apu_map[s->apu[chan]][reg]);
3770 }
3771 for(chan = 0 ; chan < 6 ; chan++)
3772 apu_set_register(s,chan,0,s->card->apu_map[s->apu[chan]][0] & 0xFF0F);
3773 }
3774
3775 /* now we flip on the music */
3776
3777 if( card->dsps_open <= 0) {
3778 /* this card's idle */
3779 maestro_power(card,ACPI_D2);
3780 } else {
3781 /* ok, we're actually playing things on
3782 this card */
3783 maestro_power(card,ACPI_D0);
3784 start_bob(&card->channels[0]);
3785 for(i=0;i<NR_DSPS;i++) {
3786 struct ess_state *s = &card->channels[i];
3787
3788 /* these use the apu_mode, and can handle
3789 spurious calls */
3790 start_dac(s);
3791 start_adc(s);
3792 }
3793 }
3794
3795 spin_unlock_irqrestore(&card->lock,flags);
3796
3797 /* all right, we think things are ready,
3798 wake up people who were using the device
3799 when we suspended */
3800 wake_up(&(card->suspend_queue));
3801
3802 return 0;
3803}
3804
3805int
3806maestro_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
3807{
3808 struct ess_card *card = (struct ess_card*) dev->data;
3809
3810 if ( ! card ) goto out;
3811
3812 M_printk("maestro: pm event 0x%x received for card %p\n", rqst, card);
3813
3814 switch (rqst) {
3815 case PM_SUSPEND:
3816 maestro_suspend(card);
3817 break;
3818 case PM_RESUME:
3819 maestro_resume(card);
3820 break;
3821 /*
3822 * we'd also like to find out about
3823 * power level changes because some biosen
3824 * do mean things to the maestro when they
3825 * change their power state.
3826 */
3827 }
3828out:
3829 return 0;
3830}
3831
3832module_init(init_maestro); 3683module_init(init_maestro);
3833module_exit(cleanup_maestro); 3684module_exit(cleanup_maestro);
diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c
index 0ce2c404a730..42d8f05689c2 100644
--- a/sound/oss/nm256_audio.c
+++ b/sound/oss/nm256_audio.c
@@ -24,8 +24,6 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/pm.h>
28#include <linux/pm_legacy.h>
29#include <linux/delay.h> 27#include <linux/delay.h>
30#include <linux/spinlock.h> 28#include <linux/spinlock.h>
31#include "sound_config.h" 29#include "sound_config.h"
@@ -49,7 +47,6 @@ static int nm256_grabInterrupt (struct nm256_info *card);
49static int nm256_releaseInterrupt (struct nm256_info *card); 47static int nm256_releaseInterrupt (struct nm256_info *card);
50static irqreturn_t nm256_interrupt (int irq, void *dev_id, struct pt_regs *dummy); 48static irqreturn_t nm256_interrupt (int irq, void *dev_id, struct pt_regs *dummy);
51static irqreturn_t nm256_interrupt_zx (int irq, void *dev_id, struct pt_regs *dummy); 49static irqreturn_t nm256_interrupt_zx (int irq, void *dev_id, struct pt_regs *dummy);
52static int handle_pm_event (struct pm_dev *dev, pm_request_t rqst, void *data);
53 50
54/* These belong in linux/pci.h. */ 51/* These belong in linux/pci.h. */
55#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005 52#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
@@ -992,15 +989,6 @@ nm256_install_mixer (struct nm256_info *card)
992 return 0; 989 return 0;
993} 990}
994 991
995/* Perform a full reset on the hardware; this is invoked when an APM
996 resume event occurs. */
997static void
998nm256_full_reset (struct nm256_info *card)
999{
1000 nm256_initHw (card);
1001 ac97_reset (&(card->mdev));
1002}
1003
1004/* 992/*
1005 * See if the signature left by the NM256 BIOS is intact; if so, we use 993 * See if the signature left by the NM256 BIOS is intact; if so, we use
1006 * the associated address as the end of our audio buffer in the video 994 * the associated address as the end of our audio buffer in the video
@@ -1053,7 +1041,6 @@ static int __devinit
1053nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr) 1041nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
1054{ 1042{
1055 struct nm256_info *card; 1043 struct nm256_info *card;
1056 struct pm_dev *pmdev;
1057 int x; 1044 int x;
1058 1045
1059 if (pci_enable_device(pcidev)) 1046 if (pci_enable_device(pcidev))
@@ -1234,43 +1221,10 @@ nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)
1234 1221
1235 nm256_install_mixer (card); 1222 nm256_install_mixer (card);
1236 1223
1237 pmdev = pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev), handle_pm_event);
1238 if (pmdev)
1239 pmdev->data = card;
1240
1241 return 1; 1224 return 1;
1242} 1225}
1243 1226
1244 1227
1245/*
1246 * PM event handler, so the card is properly reinitialized after a power
1247 * event.
1248 */
1249static int
1250handle_pm_event (struct pm_dev *dev, pm_request_t rqst, void *data)
1251{
1252 struct nm256_info *crd = (struct nm256_info*) dev->data;
1253 if (crd) {
1254 switch (rqst) {
1255 case PM_SUSPEND:
1256 break;
1257 case PM_RESUME:
1258 {
1259 int playing = crd->playing;
1260 nm256_full_reset (crd);
1261 /*
1262 * A little ugly, but that's ok; pretend the
1263 * block we were playing is done.
1264 */
1265 if (playing)
1266 DMAbuf_outputintr (crd->dev_for_play, 1);
1267 }
1268 break;
1269 }
1270 }
1271 return 0;
1272}
1273
1274static int __devinit 1228static int __devinit
1275nm256_probe(struct pci_dev *pcidev,const struct pci_device_id *pciid) 1229nm256_probe(struct pci_dev *pcidev,const struct pci_device_id *pciid)
1276{ 1230{
@@ -1696,7 +1650,6 @@ static int __init do_init_nm256(void)
1696static void __exit cleanup_nm256 (void) 1650static void __exit cleanup_nm256 (void)
1697{ 1651{
1698 pci_unregister_driver(&nm256_pci_driver); 1652 pci_unregister_driver(&nm256_pci_driver);
1699 pm_unregister_all (&handle_pm_event);
1700} 1653}
1701 1654
1702module_init(do_init_nm256); 1655module_init(do_init_nm256);
diff --git a/sound/oss/opl3sa2.c b/sound/oss/opl3sa2.c
index cd41d0e4706a..5cecdbcbea9d 100644
--- a/sound/oss/opl3sa2.c
+++ b/sound/oss/opl3sa2.c
@@ -69,8 +69,6 @@
69#include <linux/init.h> 69#include <linux/init.h>
70#include <linux/module.h> 70#include <linux/module.h>
71#include <linux/delay.h> 71#include <linux/delay.h>
72#include <linux/pm.h>
73#include <linux/pm_legacy.h>
74#include "sound_config.h" 72#include "sound_config.h"
75 73
76#include "ad1848.h" 74#include "ad1848.h"
@@ -139,10 +137,6 @@ typedef struct {
139 struct pnp_dev* pdev; 137 struct pnp_dev* pdev;
140 int activated; /* Whether said devices have been activated */ 138 int activated; /* Whether said devices have been activated */
141#endif 139#endif
142#ifdef CONFIG_PM_LEGACY
143 unsigned int in_suspend;
144 struct pm_dev *pmdev;
145#endif
146 unsigned int card; 140 unsigned int card;
147 int chipset; /* What's my version(s)? */ 141 int chipset; /* What's my version(s)? */
148 char *chipset_name; 142 char *chipset_name;
@@ -341,22 +335,6 @@ static void opl3sa2_mixer_reset(opl3sa2_state_t* devc)
341 } 335 }
342} 336}
343 337
344/* Currently only used for power management */
345#ifdef CONFIG_PM_LEGACY
346static void opl3sa2_mixer_restore(opl3sa2_state_t* devc)
347{
348 if (devc) {
349 opl3sa2_set_volume(devc, devc->volume_l, devc->volume_r);
350 opl3sa2_set_mic(devc, devc->mic);
351
352 if (devc->chipset == CHIPSET_OPL3SA3) {
353 opl3sa3_set_bass(devc, devc->bass_l, devc->bass_r);
354 opl3sa3_set_treble(devc, devc->treble_l, devc->treble_r);
355 }
356 }
357}
358#endif /* CONFIG_PM_LEGACY */
359
360static inline void arg_to_vol_mono(unsigned int vol, int* value) 338static inline void arg_to_vol_mono(unsigned int vol, int* value)
361{ 339{
362 int left; 340 int left;
@@ -832,84 +810,6 @@ static struct pnp_driver opl3sa2_driver = {
832 810
833/* End of component functions */ 811/* End of component functions */
834 812
835#ifdef CONFIG_PM_LEGACY
836
837static DEFINE_SPINLOCK(opl3sa2_lock);
838
839/* Power Management support functions */
840static int opl3sa2_suspend(struct pm_dev *pdev, unsigned int pm_mode)
841{
842 unsigned long flags;
843 opl3sa2_state_t *p;
844
845 if (!pdev)
846 return -EINVAL;
847
848 spin_lock_irqsave(&opl3sa2_lock,flags);
849
850 p = (opl3sa2_state_t *) pdev->data;
851 switch (pm_mode) {
852 case 1:
853 pm_mode = OPL3SA2_PM_MODE1;
854 break;
855 case 2:
856 pm_mode = OPL3SA2_PM_MODE2;
857 break;
858 case 3:
859 pm_mode = OPL3SA2_PM_MODE3;
860 break;
861 default:
862 /* we don't know howto handle this... */
863 spin_unlock_irqrestore(&opl3sa2_lock, flags);
864 return -EBUSY;
865 }
866
867 p->in_suspend = 1;
868
869 /* its supposed to automute before suspending, so we won't bother */
870 opl3sa2_write(p->cfg_port, OPL3SA2_PM, pm_mode);
871 /* wait a while for the clock oscillator to stabilise */
872 mdelay(10);
873
874 spin_unlock_irqrestore(&opl3sa2_lock,flags);
875 return 0;
876}
877
878static int opl3sa2_resume(struct pm_dev *pdev)
879{
880 unsigned long flags;
881 opl3sa2_state_t *p;
882
883 if (!pdev)
884 return -EINVAL;
885
886 p = (opl3sa2_state_t *) pdev->data;
887 spin_lock_irqsave(&opl3sa2_lock,flags);
888
889 /* I don't think this is necessary */
890 opl3sa2_write(p->cfg_port, OPL3SA2_PM, OPL3SA2_PM_MODE0);
891 opl3sa2_mixer_restore(p);
892 p->in_suspend = 0;
893
894 spin_unlock_irqrestore(&opl3sa2_lock,flags);
895 return 0;
896}
897
898static int opl3sa2_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data)
899{
900 unsigned long mode = (unsigned long)data;
901
902 switch (rqst) {
903 case PM_SUSPEND:
904 return opl3sa2_suspend(pdev, mode);
905
906 case PM_RESUME:
907 return opl3sa2_resume(pdev);
908 }
909 return 0;
910}
911#endif /* CONFIG_PM_LEGACY */
912
913/* 813/*
914 * Install OPL3-SA2 based card(s). 814 * Install OPL3-SA2 based card(s).
915 * 815 *
@@ -1021,12 +921,6 @@ static int __init init_opl3sa2(void)
1021 921
1022 /* ewww =) */ 922 /* ewww =) */
1023 opl3sa2_state[card].card = card; 923 opl3sa2_state[card].card = card;
1024#ifdef CONFIG_PM_LEGACY
1025 /* register our power management capabilities */
1026 opl3sa2_state[card].pmdev = pm_register(PM_ISA_DEV, card, opl3sa2_pm_callback);
1027 if (opl3sa2_state[card].pmdev)
1028 opl3sa2_state[card].pmdev->data = &opl3sa2_state[card];
1029#endif /* CONFIG_PM_LEGACY */
1030 924
1031 /* 925 /*
1032 * Set the Yamaha 3D enhancement mode (aka Ymersion) if asked to and 926 * Set the Yamaha 3D enhancement mode (aka Ymersion) if asked to and
@@ -1083,10 +977,6 @@ static void __exit cleanup_opl3sa2(void)
1083 int card; 977 int card;
1084 978
1085 for(card = 0; card < opl3sa2_cards_num; card++) { 979 for(card = 0; card < opl3sa2_cards_num; card++) {
1086#ifdef CONFIG_PM_LEGACY
1087 if (opl3sa2_state[card].pmdev)
1088 pm_unregister(opl3sa2_state[card].pmdev);
1089#endif
1090 if (opl3sa2_state[card].cfg_mpu.slots[1] != -1) { 980 if (opl3sa2_state[card].cfg_mpu.slots[1] != -1) {
1091 unload_opl3sa2_mpu(&opl3sa2_state[card].cfg_mpu); 981 unload_opl3sa2_mpu(&opl3sa2_state[card].cfg_mpu);
1092 } 982 }