aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c2
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/seq/seq_memory.c4
-rw-r--r--sound/isa/wavefront/wavefront_synth.c7
-rw-r--r--sound/oss/ad1848.c92
-rw-r--r--sound/oss/ad1889.c2
-rw-r--r--sound/oss/btaudio.c2
-rw-r--r--sound/oss/cmpci.c2
-rw-r--r--sound/oss/cs4281/cs4281m.c23
-rw-r--r--sound/oss/cs4281/cs4281pm-24.c39
-rw-r--r--sound/oss/cs46xx.c62
-rw-r--r--sound/oss/cs46xxpm-24.h4
-rw-r--r--sound/oss/dmasound/dac3550a.c6
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c81
-rw-r--r--sound/oss/dmasound/tas_common.c6
-rw-r--r--sound/oss/emu10k1/main.c2
-rw-r--r--sound/oss/es1370.c2
-rw-r--r--sound/oss/es1371.c2
-rw-r--r--sound/oss/i810_audio.c18
-rw-r--r--sound/oss/ite8172.c2
-rw-r--r--sound/oss/kahlua.c2
-rw-r--r--sound/oss/maestro.c151
-rw-r--r--sound/oss/nec_vrc5477.c2
-rw-r--r--sound/oss/nm256_audio.c49
-rw-r--r--sound/oss/opl3sa2.c110
-rw-r--r--sound/oss/rme96xx.c2
-rw-r--r--sound/oss/sonicvibes.c2
-rw-r--r--sound/oss/ymfpci.c2
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c2
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c2
-rw-r--r--sound/ppc/keywest.c5
-rw-r--r--sound/ppc/pmac.c100
-rw-r--r--sound/ppc/pmac.h3
33 files changed, 151 insertions, 641 deletions
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 5e9a81ab99..54147c1f63 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -17,11 +17,11 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/amba/bus.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/sizes.h> 24#include <asm/sizes.h>
24#include <asm/hardware/amba.h>
25 25
26#include <sound/driver.h> 26#include <sound/driver.h>
27#include <sound/core.h> 27#include <sound/core.h>
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 16df1246a1..7fd072392c 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2135,9 +2135,7 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size
2135 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; 2135 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
2136 if (substream == NULL) 2136 if (substream == NULL)
2137 return -ENXIO; 2137 return -ENXIO;
2138 up(&file->f_dentry->d_inode->i_sem);
2139 result = snd_pcm_oss_write1(substream, buf, count); 2138 result = snd_pcm_oss_write1(substream, buf, count);
2140 down(&file->f_dentry->d_inode->i_sem);
2141#ifdef OSS_DEBUG 2139#ifdef OSS_DEBUG
2142 printk("pcm_oss: write %li bytes (wrote %li bytes)\n", (long)count, (long)result); 2140 printk("pcm_oss: write %li bytes (wrote %li bytes)\n", (long)count, (long)result);
2143#endif 2141#endif
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 9ee6c177db..40b4f679c8 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -32,10 +32,6 @@
32#include "seq_info.h" 32#include "seq_info.h"
33#include "seq_lock.h" 33#include "seq_lock.h"
34 34
35/* semaphore in struct file record */
36#define semaphore_of(fp) ((fp)->f_dentry->d_inode->i_sem)
37
38
39static inline int snd_seq_pool_available(struct snd_seq_pool *pool) 35static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
40{ 36{
41 return pool->total_elements - atomic_read(&pool->counter); 37 return pool->total_elements - atomic_read(&pool->counter);
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 679d0ae97e..ed81eec6e7 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -115,18 +115,11 @@ MODULE_PARM_DESC(osrun_time, "how many seconds to wait for the ICS2115 OS");
115 115
116#ifdef WF_DEBUG 116#ifdef WF_DEBUG
117 117
118#if defined(NEW_MACRO_VARARGS) || __GNUC__ >= 3
119#define DPRINT(cond, ...) \ 118#define DPRINT(cond, ...) \
120 if ((dev->debug & (cond)) == (cond)) { \ 119 if ((dev->debug & (cond)) == (cond)) { \
121 snd_printk (__VA_ARGS__); \ 120 snd_printk (__VA_ARGS__); \
122 } 121 }
123#else 122#else
124#define DPRINT(cond, args...) \
125 if ((dev->debug & (cond)) == (cond)) { \
126 snd_printk (args); \
127 }
128#endif
129#else
130#define DPRINT(cond, args...) 123#define DPRINT(cond, args...)
131#endif /* WF_DEBUG */ 124#endif /* WF_DEBUG */
132 125
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index 3f30c57676..49796be955 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/ad1889.c b/sound/oss/ad1889.c
index 2cfd214e4c..a0d73f3431 100644
--- a/sound/oss/ad1889.c
+++ b/sound/oss/ad1889.c
@@ -1089,7 +1089,7 @@ static struct pci_driver ad1889_driver = {
1089 1089
1090static int __init ad1889_init_module(void) 1090static int __init ad1889_init_module(void)
1091{ 1091{
1092 return pci_module_init(&ad1889_driver); 1092 return pci_register_driver(&ad1889_driver);
1093} 1093}
1094 1094
1095static void ad1889_exit_module(void) 1095static void ad1889_exit_module(void)
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index a85093fec7..4007a5680a 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -1101,7 +1101,7 @@ static int btaudio_init_module(void)
1101 digital ? "digital" : "", 1101 digital ? "digital" : "",
1102 analog && digital ? "+" : "", 1102 analog && digital ? "+" : "",
1103 analog ? "analog" : ""); 1103 analog ? "analog" : "");
1104 return pci_module_init(&btaudio_pci_driver); 1104 return pci_register_driver(&btaudio_pci_driver);
1105} 1105}
1106 1106
1107static void btaudio_cleanup_module(void) 1107static void btaudio_cleanup_module(void)
diff --git a/sound/oss/cmpci.c b/sound/oss/cmpci.c
index 74dcca78c6..7cfbb08db5 100644
--- a/sound/oss/cmpci.c
+++ b/sound/oss/cmpci.c
@@ -3366,7 +3366,7 @@ static struct pci_driver cm_driver = {
3366static int __init init_cmpci(void) 3366static int __init init_cmpci(void)
3367{ 3367{
3368 printk(KERN_INFO "cmpci: version $Revision: 6.82 $ time " __TIME__ " " __DATE__ "\n"); 3368 printk(KERN_INFO "cmpci: version $Revision: 6.82 $ time " __TIME__ " " __DATE__ "\n");
3369 return pci_module_init(&cm_driver); 3369 return pci_register_driver(&cm_driver);
3370} 3370}
3371 3371
3372static void __exit cleanup_cmpci(void) 3372static void __exit cleanup_cmpci(void)
diff --git a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
index adc689649f..0720365f64 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
@@ -4477,7 +4461,7 @@ static int __init cs4281_init_module(void)
4477 printk(KERN_INFO "cs4281: version v%d.%02d.%d time " __TIME__ " " 4461 printk(KERN_INFO "cs4281: version v%d.%02d.%d time " __TIME__ " "
4478 __DATE__ "\n", CS4281_MAJOR_VERSION, CS4281_MINOR_VERSION, 4462 __DATE__ "\n", CS4281_MAJOR_VERSION, CS4281_MINOR_VERSION,
4479 CS4281_ARCH); 4463 CS4281_ARCH);
4480 rtn = pci_module_init(&cs4281_pci_driver); 4464 rtn = pci_register_driver(&cs4281_pci_driver);
4481 4465
4482 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, 4466 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2,
4483 printk(KERN_INFO "cs4281: cs4281_init_module()- (%d)\n",rtn)); 4467 printk(KERN_INFO "cs4281: cs4281_init_module()- (%d)\n",rtn));
@@ -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 d2a453aff0..90cbd76795 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 cb998e8c0f..58e25c82ea 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
@@ -5711,7 +5690,7 @@ static int __init cs46xx_init_module(void)
5711 int rtn = 0; 5690 int rtn = 0;
5712 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO 5691 CS_DBGOUT(CS_INIT | CS_FUNCTION, 2, printk(KERN_INFO
5713 "cs46xx: cs46xx_init_module()+ \n")); 5692 "cs46xx: cs46xx_init_module()+ \n"));
5714 rtn = pci_module_init(&cs46xx_pci_driver); 5693 rtn = pci_register_driver(&cs46xx_pci_driver);
5715 5694
5716 if(rtn == -ENODEV) 5695 if(rtn == -ENODEV)
5717 { 5696 {
@@ -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 e220bd7240..ad82db84d0 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/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c
index 533895eba0..7360d8954d 100644
--- a/sound/oss/dmasound/dac3550a.c
+++ b/sound/oss/dmasound/dac3550a.c
@@ -41,10 +41,10 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address);
41static int daca_detach_client(struct i2c_client *client); 41static int daca_detach_client(struct i2c_client *client);
42 42
43struct i2c_driver daca_driver = { 43struct i2c_driver daca_driver = {
44 .owner = THIS_MODULE, 44 .driver = {
45 .name = "DAC3550A driver V " DACA_VERSION, 45 .name = "DAC3550A driver V " DACA_VERSION,
46 },
46 .id = I2C_DRIVERID_DACA, 47 .id = I2C_DRIVERID_DACA,
47 .flags = I2C_DF_NOTIFY,
48 .attach_adapter = daca_attach_adapter, 48 .attach_adapter = daca_attach_adapter,
49 .detach_client = daca_detach_client, 49 .detach_client = daca_detach_client,
50}; 50};
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index cebd881b91..74f975676c 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -125,6 +125,7 @@ static int awacs_rate_index;
125static int awacs_subframe; 125static int awacs_subframe;
126static struct device_node* awacs_node; 126static struct device_node* awacs_node;
127static struct device_node* i2s_node; 127static struct device_node* i2s_node;
128static struct resource awacs_rsrc[3];
128 129
129static char awacs_name[64]; 130static char awacs_name[64];
130static int awacs_revision; 131static int awacs_revision;
@@ -667,9 +668,12 @@ static void PMacIrqCleanup(void)
667 iounmap(awacs_txdma); 668 iounmap(awacs_txdma);
668 iounmap(awacs_rxdma); 669 iounmap(awacs_rxdma);
669 670
670 release_OF_resource(awacs_node, 0); 671 release_mem_region(awacs_rsrc[0].start,
671 release_OF_resource(awacs_node, 1); 672 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
672 release_OF_resource(awacs_node, 2); 673 release_mem_region(awacs_rsrc[1].start,
674 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
675 release_mem_region(awacs_rsrc[2].start,
676 awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
673 677
674 kfree(awacs_tx_cmd_space); 678 kfree(awacs_tx_cmd_space);
675 kfree(awacs_rx_cmd_space); 679 kfree(awacs_rx_cmd_space);
@@ -2863,46 +2867,58 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2863 * other info if necessary (early AWACS we want to read chip ids) 2867 * other info if necessary (early AWACS we want to read chip ids)
2864 */ 2868 */
2865 2869
2866 if (io->n_addrs < 3 || io->n_intrs < 3) { 2870 if (of_get_address(io, 2, NULL, NULL) == NULL || io->n_intrs < 3) {
2867 /* OK - maybe we need to use the 'awacs' node (on earlier 2871 /* OK - maybe we need to use the 'awacs' node (on earlier
2868 * machines). 2872 * machines).
2869 */ 2873 */
2870 if (awacs_node) { 2874 if (awacs_node) {
2871 io = awacs_node ; 2875 io = awacs_node ;
2872 if (io->n_addrs < 3 || io->n_intrs < 3) { 2876 if (of_get_address(io, 2, NULL, NULL) == NULL ||
2873 printk("dmasound_pmac: can't use %s" 2877 io->n_intrs < 3) {
2874 " (%d addrs, %d intrs)\n", 2878 printk("dmasound_pmac: can't use %s\n",
2875 io->full_name, io->n_addrs, io->n_intrs); 2879 io->full_name);
2876 return -ENODEV; 2880 return -ENODEV;
2877 } 2881 }
2878 } else { 2882 } else
2879 printk("dmasound_pmac: can't use %s (%d addrs, %d intrs)\n", 2883 printk("dmasound_pmac: can't use %s\n", io->full_name);
2880 io->full_name, io->n_addrs, io->n_intrs);
2881 }
2882 } 2884 }
2883 2885
2884 if (!request_OF_resource(io, 0, NULL)) { 2886 if (of_address_to_resource(io, 0, &awacs_rsrc[0]) ||
2887 request_mem_region(awacs_rsrc[0].start,
2888 awacs_rsrc[0].end - awacs_rsrc[0].start + 1,
2889 " (IO)") == NULL) {
2885 printk(KERN_ERR "dmasound: can't request IO resource !\n"); 2890 printk(KERN_ERR "dmasound: can't request IO resource !\n");
2886 return -ENODEV; 2891 return -ENODEV;
2887 } 2892 }
2888 if (!request_OF_resource(io, 1, " (tx dma)")) { 2893 if (of_address_to_resource(io, 1, &awacs_rsrc[1]) ||
2889 release_OF_resource(io, 0); 2894 request_mem_region(awacs_rsrc[1].start,
2890 printk(KERN_ERR "dmasound: can't request TX DMA resource !\n"); 2895 awacs_rsrc[1].end - awacs_rsrc[1].start + 1,
2896 " (tx dma)") == NULL) {
2897 release_mem_region(awacs_rsrc[0].start,
2898 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2899 printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n");
2891 return -ENODEV; 2900 return -ENODEV;
2892 } 2901 }
2893 2902 if (of_address_to_resource(io, 2, &awacs_rsrc[2]) ||
2894 if (!request_OF_resource(io, 2, " (rx dma)")) { 2903 request_mem_region(awacs_rsrc[2].start,
2895 release_OF_resource(io, 0); 2904 awacs_rsrc[2].end - awacs_rsrc[2].start + 1,
2896 release_OF_resource(io, 1); 2905 " (rx dma)") == NULL) {
2897 printk(KERN_ERR "dmasound: can't request RX DMA resource !\n"); 2906 release_mem_region(awacs_rsrc[0].start,
2907 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2908 release_mem_region(awacs_rsrc[1].start,
2909 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
2910 printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n");
2898 return -ENODEV; 2911 return -ENODEV;
2899 } 2912 }
2900 2913
2901 awacs_beep_dev = input_allocate_device(); 2914 awacs_beep_dev = input_allocate_device();
2902 if (!awacs_beep_dev) { 2915 if (!awacs_beep_dev) {
2903 release_OF_resource(io, 0); 2916 release_mem_region(awacs_rsrc[0].start,
2904 release_OF_resource(io, 1); 2917 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2905 release_OF_resource(io, 2); 2918 release_mem_region(awacs_rsrc[1].start,
2919 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
2920 release_mem_region(awacs_rsrc[2].start,
2921 awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
2906 printk(KERN_ERR "dmasound: can't allocate input device !\n"); 2922 printk(KERN_ERR "dmasound: can't allocate input device !\n");
2907 return -ENOMEM; 2923 return -ENOMEM;
2908 } 2924 }
@@ -2916,11 +2932,11 @@ printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2916 2932
2917 /* all OF versions I've seen use this value */ 2933 /* all OF versions I've seen use this value */
2918 if (i2s_node) 2934 if (i2s_node)
2919 i2s = ioremap(io->addrs[0].address, 0x1000); 2935 i2s = ioremap(awacs_rsrc[0].start, 0x1000);
2920 else 2936 else
2921 awacs = ioremap(io->addrs[0].address, 0x1000); 2937 awacs = ioremap(awacs_rsrc[0].start, 0x1000);
2922 awacs_txdma = ioremap(io->addrs[1].address, 0x100); 2938 awacs_txdma = ioremap(awacs_rsrc[1].start, 0x100);
2923 awacs_rxdma = ioremap(io->addrs[2].address, 0x100); 2939 awacs_rxdma = ioremap(awacs_rsrc[2].start, 0x100);
2924 2940
2925 /* first of all make sure that the chip is powered up....*/ 2941 /* first of all make sure that the chip is powered up....*/
2926 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, io, 0, 1); 2942 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, io, 0, 1);
@@ -3083,9 +3099,10 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
3083 struct device_node* mio; 3099 struct device_node* mio;
3084 macio_base = NULL; 3100 macio_base = NULL;
3085 for (mio = io->parent; mio; mio = mio->parent) { 3101 for (mio = io->parent; mio; mio = mio->parent) {
3086 if (strcmp(mio->name, "mac-io") == 0 3102 if (strcmp(mio->name, "mac-io") == 0) {
3087 && mio->n_addrs > 0) { 3103 struct resource r;
3088 macio_base = ioremap(mio->addrs[0].address, 0x40); 3104 if (of_address_to_resource(mio, 0, &r) == 0)
3105 macio_base = ioremap(r.start, 0x40);
3089 break; 3106 break;
3090 } 3107 }
3091 } 3108 }
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c
index d36a1fe2fc..81315996c0 100644
--- a/sound/oss/dmasound/tas_common.c
+++ b/sound/oss/dmasound/tas_common.c
@@ -47,9 +47,9 @@ static int tas_attach_adapter(struct i2c_adapter *);
47static int tas_detach_client(struct i2c_client *); 47static int tas_detach_client(struct i2c_client *);
48 48
49struct i2c_driver tas_driver = { 49struct i2c_driver tas_driver = {
50 .owner = THIS_MODULE, 50 .driver = {
51 .name = "tas", 51 .name = "tas",
52 .flags = I2C_DF_NOTIFY, 52 },
53 .attach_adapter = tas_attach_adapter, 53 .attach_adapter = tas_attach_adapter,
54 .detach_client = tas_detach_client, 54 .detach_client = tas_detach_client,
55}; 55};
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 9b905bae42..23241cbdd9 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -1428,7 +1428,7 @@ static int __init emu10k1_init_module(void)
1428{ 1428{
1429 printk(KERN_INFO "Creative EMU10K1 PCI Audio Driver, version " DRIVER_VERSION ", " __TIME__ " " __DATE__ "\n"); 1429 printk(KERN_INFO "Creative EMU10K1 PCI Audio Driver, version " DRIVER_VERSION ", " __TIME__ " " __DATE__ "\n");
1430 1430
1431 return pci_module_init(&emu10k1_pci_driver); 1431 return pci_register_driver(&emu10k1_pci_driver);
1432} 1432}
1433 1433
1434static void __exit emu10k1_cleanup_module(void) 1434static void __exit emu10k1_cleanup_module(void)
diff --git a/sound/oss/es1370.c b/sound/oss/es1370.c
index 8538085086..ae55c53661 100644
--- a/sound/oss/es1370.c
+++ b/sound/oss/es1370.c
@@ -2779,7 +2779,7 @@ static struct pci_driver es1370_driver = {
2779static int __init init_es1370(void) 2779static int __init init_es1370(void)
2780{ 2780{
2781 printk(KERN_INFO "es1370: version v0.38 time " __TIME__ " " __DATE__ "\n"); 2781 printk(KERN_INFO "es1370: version v0.38 time " __TIME__ " " __DATE__ "\n");
2782 return pci_module_init(&es1370_driver); 2782 return pci_register_driver(&es1370_driver);
2783} 2783}
2784 2784
2785static void __exit cleanup_es1370(void) 2785static void __exit cleanup_es1370(void)
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
index 12a56d5ab4..5c697f1625 100644
--- a/sound/oss/es1371.c
+++ b/sound/oss/es1371.c
@@ -3090,7 +3090,7 @@ static struct pci_driver es1371_driver = {
3090static int __init init_es1371(void) 3090static int __init init_es1371(void)
3091{ 3091{
3092 printk(KERN_INFO PFX "version v0.32 time " __TIME__ " " __DATE__ "\n"); 3092 printk(KERN_INFO PFX "version v0.32 time " __TIME__ " " __DATE__ "\n");
3093 return pci_module_init(&es1371_driver); 3093 return pci_register_driver(&es1371_driver);
3094} 3094}
3095 3095
3096static void __exit cleanup_es1371(void) 3096static void __exit cleanup_es1371(void)
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index b9a640fe48..4600cd6742 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -3359,12 +3359,6 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
3359 goto out_region2; 3359 goto out_region2;
3360 } 3360 }
3361 3361
3362 if (request_irq(card->irq, &i810_interrupt, SA_SHIRQ,
3363 card_names[pci_id->driver_data], card)) {
3364 printk(KERN_ERR "i810_audio: unable to allocate irq %d\n", card->irq);
3365 goto out_pio;
3366 }
3367
3368 if (card->use_mmio) { 3362 if (card->use_mmio) {
3369 if (request_mem_region(card->ac97base_mmio_phys, 512, "ich_audio MMBAR")) { 3363 if (request_mem_region(card->ac97base_mmio_phys, 512, "ich_audio MMBAR")) {
3370 if ((card->ac97base_mmio = ioremap(card->ac97base_mmio_phys, 512))) { /*@FIXME can ioremap fail? don't know (jsaw) */ 3364 if ((card->ac97base_mmio = ioremap(card->ac97base_mmio_phys, 512))) { /*@FIXME can ioremap fail? don't know (jsaw) */
@@ -3395,10 +3389,8 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
3395 } 3389 }
3396 3390
3397 /* initialize AC97 codec and register /dev/mixer */ 3391 /* initialize AC97 codec and register /dev/mixer */
3398 if (i810_ac97_init(card) <= 0) { 3392 if (i810_ac97_init(card) <= 0)
3399 free_irq(card->irq, card);
3400 goto out_iospace; 3393 goto out_iospace;
3401 }
3402 pci_set_drvdata(pci_dev, card); 3394 pci_set_drvdata(pci_dev, card);
3403 3395
3404 if(clocking == 0) { 3396 if(clocking == 0) {
@@ -3410,7 +3402,6 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
3410 if ((card->dev_audio = register_sound_dsp(&i810_audio_fops, -1)) < 0) { 3402 if ((card->dev_audio = register_sound_dsp(&i810_audio_fops, -1)) < 0) {
3411 int i; 3403 int i;
3412 printk(KERN_ERR "i810_audio: couldn't register DSP device!\n"); 3404 printk(KERN_ERR "i810_audio: couldn't register DSP device!\n");
3413 free_irq(card->irq, card);
3414 for (i = 0; i < NR_AC97; i++) 3405 for (i = 0; i < NR_AC97; i++)
3415 if (card->ac97_codec[i] != NULL) { 3406 if (card->ac97_codec[i] != NULL) {
3416 unregister_sound_mixer(card->ac97_codec[i]->dev_mixer); 3407 unregister_sound_mixer(card->ac97_codec[i]->dev_mixer);
@@ -3419,6 +3410,13 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
3419 goto out_iospace; 3410 goto out_iospace;
3420 } 3411 }
3421 3412
3413 if (request_irq(card->irq, &i810_interrupt, SA_SHIRQ,
3414 card_names[pci_id->driver_data], card)) {
3415 printk(KERN_ERR "i810_audio: unable to allocate irq %d\n", card->irq);
3416 goto out_iospace;
3417 }
3418
3419
3422 card->initializing = 0; 3420 card->initializing = 0;
3423 return 0; 3421 return 0;
3424 3422
diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c
index 26e5944b6b..8fd2f9a9e6 100644
--- a/sound/oss/ite8172.c
+++ b/sound/oss/ite8172.c
@@ -2206,7 +2206,7 @@ static struct pci_driver it8172_driver = {
2206static int __init init_it8172(void) 2206static int __init init_it8172(void)
2207{ 2207{
2208 info("version v0.5 time " __TIME__ " " __DATE__); 2208 info("version v0.5 time " __TIME__ " " __DATE__);
2209 return pci_module_init(&it8172_driver); 2209 return pci_register_driver(&it8172_driver);
2210} 2210}
2211 2211
2212static void __exit cleanup_it8172(void) 2212static void __exit cleanup_it8172(void)
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c
index 808c5ef969..2835a7c038 100644
--- a/sound/oss/kahlua.c
+++ b/sound/oss/kahlua.c
@@ -218,7 +218,7 @@ static struct pci_driver kahlua_driver = {
218static int __init kahlua_init_module(void) 218static int __init kahlua_init_module(void)
219{ 219{
220 printk(KERN_INFO "Cyrix Kahlua VSA1 XpressAudio support (c) Copyright 2003 Red Hat Inc\n"); 220 printk(KERN_INFO "Cyrix Kahlua VSA1 XpressAudio support (c) Copyright 2003 Red Hat Inc\n");
221 return pci_module_init(&kahlua_driver); 221 return pci_register_driver(&kahlua_driver);
222} 222}
223 223
224static void __devexit kahlua_cleanup_module(void) 224static void __devexit kahlua_cleanup_module(void)
diff --git a/sound/oss/maestro.c b/sound/oss/maestro.c
index 3abd3541cb..d4b569acf7 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;
@@ -3634,7 +3624,7 @@ static int __init init_maestro(void)
3634{ 3624{
3635 int rc; 3625 int rc;
3636 3626
3637 rc = pci_module_init(&maestro_pci_driver); 3627 rc = pci_register_driver(&maestro_pci_driver);
3638 if (rc < 0) 3628 if (rc < 0)
3639 return rc; 3629 return rc;
3640 3630
@@ -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/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
index 9ac4bf7e1e..fbb9170e8e 100644
--- a/sound/oss/nec_vrc5477.c
+++ b/sound/oss/nec_vrc5477.c
@@ -2045,7 +2045,7 @@ static struct pci_driver vrc5477_ac97_driver = {
2045static int __init init_vrc5477_ac97(void) 2045static int __init init_vrc5477_ac97(void)
2046{ 2046{
2047 printk("Vrc5477 AC97 driver: version v0.2 time " __TIME__ " " __DATE__ " by Jun Sun\n"); 2047 printk("Vrc5477 AC97 driver: version v0.2 time " __TIME__ " " __DATE__ " by Jun Sun\n");
2048 return pci_module_init(&vrc5477_ac97_driver); 2048 return pci_register_driver(&vrc5477_ac97_driver);
2049} 2049}
2050 2050
2051static void __exit cleanup_vrc5477_ac97(void) 2051static void __exit cleanup_vrc5477_ac97(void)
diff --git a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c
index 0ce2c404a7..7de079b202 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{
@@ -1690,13 +1644,12 @@ module_param(force_load, bool, 0);
1690static int __init do_init_nm256(void) 1644static int __init do_init_nm256(void)
1691{ 1645{
1692 printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, version 1.1p\n"); 1646 printk (KERN_INFO "NeoMagic 256AV/256ZX audio driver, version 1.1p\n");
1693 return pci_module_init(&nm256_pci_driver); 1647 return pci_register_driver(&nm256_pci_driver);
1694} 1648}
1695 1649
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 cd41d0e470..5cecdbcbea 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 }
diff --git a/sound/oss/rme96xx.c b/sound/oss/rme96xx.c
index 318dc51009..faa0b7919b 100644
--- a/sound/oss/rme96xx.c
+++ b/sound/oss/rme96xx.c
@@ -1095,7 +1095,7 @@ static int __init init_rme96xx(void)
1095 devices = ((devices-1) & RME96xx_MASK_DEVS) + 1; 1095 devices = ((devices-1) & RME96xx_MASK_DEVS) + 1;
1096 printk(KERN_INFO RME_MESS" reserving %d dsp device(s)\n",devices); 1096 printk(KERN_INFO RME_MESS" reserving %d dsp device(s)\n",devices);
1097 numcards = 0; 1097 numcards = 0;
1098 return pci_module_init(&rme96xx_driver); 1098 return pci_register_driver(&rme96xx_driver);
1099} 1099}
1100 1100
1101static void __exit cleanup_rme96xx(void) 1101static void __exit cleanup_rme96xx(void)
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 17d0e461f8..71b05e2f69 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -2765,7 +2765,7 @@ static int __init init_sonicvibes(void)
2765 if (!(wavetable_mem = __get_free_pages(GFP_KERNEL, 20-PAGE_SHIFT))) 2765 if (!(wavetable_mem = __get_free_pages(GFP_KERNEL, 20-PAGE_SHIFT)))
2766 printk(KERN_INFO "sv: cannot allocate 1MB of contiguous nonpageable memory for wavetable data\n"); 2766 printk(KERN_INFO "sv: cannot allocate 1MB of contiguous nonpageable memory for wavetable data\n");
2767#endif 2767#endif
2768 return pci_module_init(&sv_driver); 2768 return pci_register_driver(&sv_driver);
2769} 2769}
2770 2770
2771static void __exit cleanup_sonicvibes(void) 2771static void __exit cleanup_sonicvibes(void)
diff --git a/sound/oss/ymfpci.c b/sound/oss/ymfpci.c
index 8dae59bd05..f8bd72e46f 100644
--- a/sound/oss/ymfpci.c
+++ b/sound/oss/ymfpci.c
@@ -2680,7 +2680,7 @@ static struct pci_driver ymfpci_driver = {
2680 2680
2681static int __init ymf_init_module(void) 2681static int __init ymf_init_module(void)
2682{ 2682{
2683 return pci_module_init(&ymfpci_driver); 2683 return pci_register_driver(&ymfpci_driver);
2684} 2684}
2685 2685
2686static void __exit ymf_cleanup_module (void) 2686static void __exit ymf_cleanup_module (void)
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 202c7cf3e3..f36ede8274 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -385,7 +385,7 @@ static struct pci_driver driver = {
385 385
386static int __init alsa_card_cs5535audio_init(void) 386static int __init alsa_card_cs5535audio_init(void)
387{ 387{
388 return pci_module_init(&driver); 388 return pci_register_driver(&driver);
389} 389}
390 390
391static void __exit alsa_card_cs5535audio_exit(void) 391static void __exit alsa_card_cs5535audio_exit(void)
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index 09cb250d58..962e6d5255 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -209,7 +209,7 @@ static int pdacf_pcm_prepare(struct snd_pcm_substream *subs)
209 case SNDRV_PCM_FORMAT_S24_3LE: 209 case SNDRV_PCM_FORMAT_S24_3LE:
210 case SNDRV_PCM_FORMAT_S24_3BE: 210 case SNDRV_PCM_FORMAT_S24_3BE:
211 chip->pcm_sample = 3; 211 chip->pcm_sample = 3;
212 /* fall trough */ 212 /* fall through */
213 default: /* 24-bit */ 213 default: /* 24-bit */
214 aval = AK4117_DIF_24R; 214 aval = AK4117_DIF_24R;
215 chip->pcm_frame = 3; 215 chip->pcm_frame = 3;
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index 097fbcfc5d..6058c2dd1b 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -41,9 +41,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter);
41static int keywest_detach_client(struct i2c_client *client); 41static int keywest_detach_client(struct i2c_client *client);
42 42
43struct i2c_driver keywest_driver = { 43struct i2c_driver keywest_driver = {
44 .name = "PMac Keywest Audio", 44 .driver = {
45 .name = "PMac Keywest Audio",
46 },
45 .id = I2C_DRIVERID_KEYWEST, 47 .id = I2C_DRIVERID_KEYWEST,
46 .flags = I2C_DF_NOTIFY,
47 .attach_adapter = &keywest_attach_adapter, 48 .attach_adapter = &keywest_attach_adapter,
48 .detach_client = &keywest_detach_client, 49 .detach_client = &keywest_detach_client,
49}; 50};
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 9b2b00fdc1..a642e4cfcf 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -803,21 +803,17 @@ static int snd_pmac_free(struct snd_pmac *chip)
803 iounmap(chip->playback.dma); 803 iounmap(chip->playback.dma);
804 if (chip->capture.dma) 804 if (chip->capture.dma)
805 iounmap(chip->capture.dma); 805 iounmap(chip->capture.dma);
806#ifndef CONFIG_PPC64 806
807 if (chip->node) { 807 if (chip->node) {
808 int i; 808 int i;
809
810 for (i = 0; i < 3; i++) { 809 for (i = 0; i < 3; i++) {
811 if (chip->of_requested & (1 << i)) { 810 if (chip->requested & (1 << i))
812 if (chip->is_k2) 811 release_mem_region(chip->rsrc[i].start,
813 release_OF_resource(chip->node->parent, 812 chip->rsrc[i].end -
814 i); 813 chip->rsrc[i].start + 1);
815 else
816 release_OF_resource(chip->node, i);
817 }
818 } 814 }
819 } 815 }
820#endif /* CONFIG_PPC64 */ 816
821 if (chip->pdev) 817 if (chip->pdev)
822 pci_dev_put(chip->pdev); 818 pci_dev_put(chip->pdev);
823 kfree(chip); 819 kfree(chip);
@@ -991,6 +987,11 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
991 chip->can_byte_swap = 0; /* FIXME: check this */ 987 chip->can_byte_swap = 0; /* FIXME: check this */
992 chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ 988 chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */
993 break; 989 break;
990 default:
991 printk(KERN_ERR "snd: Unknown layout ID 0x%x\n",
992 layout_id);
993 return -ENODEV;
994
994 } 995 }
995 } 996 }
996 prop = (unsigned int *)get_property(sound, "device-id", NULL); 997 prop = (unsigned int *)get_property(sound, "device-id", NULL);
@@ -1175,46 +1176,69 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1175 } 1176 }
1176 1177
1177 np = chip->node; 1178 np = chip->node;
1179 chip->requested = 0;
1178 if (chip->is_k2) { 1180 if (chip->is_k2) {
1179 if (np->parent->n_addrs < 2 || np->n_intrs < 3) { 1181 static char *rnames[] = {
1182 "Sound Control", "Sound DMA" };
1183 if (np->n_intrs < 3) {
1180 err = -ENODEV; 1184 err = -ENODEV;
1181 goto __error; 1185 goto __error;
1182 } 1186 }
1183 for (i = 0; i < 2; i++) { 1187 for (i = 0; i < 2; i ++) {
1184#ifndef CONFIG_PPC64 1188 if (of_address_to_resource(np->parent, i,
1185 static char *name[2] = { "- Control", "- DMA" }; 1189 &chip->rsrc[i])) {
1186 if (! request_OF_resource(np->parent, i, name[i])) { 1190 printk(KERN_ERR "snd: can't translate rsrc "
1187 snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); 1191 " %d (%s)\n", i, rnames[i]);
1192 err = -ENODEV;
1193 goto __error;
1194 }
1195 if (request_mem_region(chip->rsrc[i].start,
1196 chip->rsrc[i].end -
1197 chip->rsrc[i].start + 1,
1198 rnames[i]) == NULL) {
1199 printk(KERN_ERR "snd: can't request rsrc "
1200 " %d (%s: 0x%08lx:%08lx)\n",
1201 i, rnames[i], chip->rsrc[i].start,
1202 chip->rsrc[i].end);
1188 err = -ENODEV; 1203 err = -ENODEV;
1189 goto __error; 1204 goto __error;
1190 } 1205 }
1191 chip->of_requested |= (1 << i); 1206 chip->requested |= (1 << i);
1192#endif /* CONFIG_PPC64 */
1193 ctrl_addr = np->parent->addrs[0].address;
1194 txdma_addr = np->parent->addrs[1].address;
1195 rxdma_addr = txdma_addr + 0x100;
1196 } 1207 }
1197 1208 ctrl_addr = chip->rsrc[0].start;
1209 txdma_addr = chip->rsrc[1].start;
1210 rxdma_addr = txdma_addr + 0x100;
1198 } else { 1211 } else {
1199 if (np->n_addrs < 3 || np->n_intrs < 3) { 1212 static char *rnames[] = {
1213 "Sound Control", "Sound Tx DMA", "Sound Rx DMA" };
1214 if (np->n_intrs < 3) {
1200 err = -ENODEV; 1215 err = -ENODEV;
1201 goto __error; 1216 goto __error;
1202 } 1217 }
1203 1218 for (i = 0; i < 3; i ++) {
1204 for (i = 0; i < 3; i++) { 1219 if (of_address_to_resource(np->parent, i,
1205#ifndef CONFIG_PPC64 1220 &chip->rsrc[i])) {
1206 static char *name[3] = { "- Control", "- Tx DMA", "- Rx DMA" }; 1221 printk(KERN_ERR "snd: can't translate rsrc "
1207 if (! request_OF_resource(np, i, name[i])) { 1222 " %d (%s)\n", i, rnames[i]);
1208 snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); 1223 err = -ENODEV;
1224 goto __error;
1225 }
1226 if (request_mem_region(chip->rsrc[i].start,
1227 chip->rsrc[i].end -
1228 chip->rsrc[i].start + 1,
1229 rnames[i]) == NULL) {
1230 printk(KERN_ERR "snd: can't request rsrc "
1231 " %d (%s: 0x%08lx:%08lx)\n",
1232 i, rnames[i], chip->rsrc[i].start,
1233 chip->rsrc[i].end);
1209 err = -ENODEV; 1234 err = -ENODEV;
1210 goto __error; 1235 goto __error;
1211 } 1236 }
1212 chip->of_requested |= (1 << i); 1237 chip->requested |= (1 << i);
1213#endif /* CONFIG_PPC64 */
1214 ctrl_addr = np->addrs[0].address;
1215 txdma_addr = np->addrs[1].address;
1216 rxdma_addr = np->addrs[2].address;
1217 } 1238 }
1239 ctrl_addr = chip->rsrc[0].start;
1240 txdma_addr = chip->rsrc[1].start;
1241 rxdma_addr = chip->rsrc[2].start;
1218 } 1242 }
1219 1243
1220 chip->awacs = ioremap(ctrl_addr, 0x1000); 1244 chip->awacs = ioremap(ctrl_addr, 0x1000);
@@ -1266,9 +1290,11 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1266 } else if (chip->is_pbook_G3) { 1290 } else if (chip->is_pbook_G3) {
1267 struct device_node* mio; 1291 struct device_node* mio;
1268 for (mio = chip->node->parent; mio; mio = mio->parent) { 1292 for (mio = chip->node->parent; mio; mio = mio->parent) {
1269 if (strcmp(mio->name, "mac-io") == 0 1293 if (strcmp(mio->name, "mac-io") == 0) {
1270 && mio->n_addrs > 0) { 1294 struct resource r;
1271 chip->macio_base = ioremap(mio->addrs[0].address, 0x40); 1295 if (of_address_to_resource(mio, 0, &r) == 0)
1296 chip->macio_base =
1297 ioremap(r.start, 0x40);
1272 break; 1298 break;
1273 } 1299 }
1274 } 1300 }
diff --git a/sound/ppc/pmac.h b/sound/ppc/pmac.h
index 086da7a189..3a9bd4dbb9 100644
--- a/sound/ppc/pmac.h
+++ b/sound/ppc/pmac.h
@@ -113,7 +113,8 @@ struct snd_pmac {
113 unsigned int initialized : 1; 113 unsigned int initialized : 1;
114 unsigned int feature_is_set : 1; 114 unsigned int feature_is_set : 1;
115 115
116 unsigned int of_requested; 116 unsigned int requested;
117 struct resource rsrc[3];
117 118
118 int num_freqs; 119 int num_freqs;
119 int *freq_table; 120 int *freq_table;