diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-20 17:39:47 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-20 17:39:47 -0500 |
commit | 55fa518867978e1f5fd8353098f80d125ac734d7 (patch) | |
tree | 3502b331c1f9ec4cac25dc8ba30b6a0a324e350c /sound | |
parent | bb1f24bf00a85f666b56a09b7cdbfd221af16c2c (diff) | |
parent | eea0579fc85e64e9f05361d5aacf496fe7a151aa (diff) |
Merge branch 'topic/pcsp-fix' into topic/misc
Diffstat (limited to 'sound')
60 files changed, 855 insertions, 546 deletions
diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h index 622cd37a0118..a0f223c13f66 100644 --- a/sound/aoa/soundbus/soundbus.h +++ b/sound/aoa/soundbus/soundbus.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #ifndef __SOUNDBUS_H | 8 | #ifndef __SOUNDBUS_H |
9 | #define __SOUNDBUS_H | 9 | #define __SOUNDBUS_H |
10 | 10 | ||
11 | #include <asm/of_device.h> | 11 | #include <linux/of_device.h> |
12 | #include <sound/pcm.h> | 12 | #include <sound/pcm.h> |
13 | #include <linux/list.h> | 13 | #include <linux/list.h> |
14 | 14 | ||
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index cba71d867542..c2635beb4c88 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -44,7 +44,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { | |||
44 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { | 44 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { |
45 | .name = "AC97 PCM out", | 45 | .name = "AC97 PCM out", |
46 | .dev_addr = __PREG(PCDR), | 46 | .dev_addr = __PREG(PCDR), |
47 | .drcmr = &DRCMRTXPCDR, | 47 | .drcmr = &DRCMR(12), |
48 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 48 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
49 | DCMD_BURST32 | DCMD_WIDTH4, | 49 | DCMD_BURST32 | DCMD_WIDTH4, |
50 | }; | 50 | }; |
@@ -52,7 +52,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { | |||
52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { | 52 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { |
53 | .name = "AC97 PCM in", | 53 | .name = "AC97 PCM in", |
54 | .dev_addr = __PREG(PCDR), | 54 | .dev_addr = __PREG(PCDR), |
55 | .drcmr = &DRCMRRXPCDR, | 55 | .drcmr = &DRCMR(11), |
56 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 56 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
57 | DCMD_BURST32 | DCMD_WIDTH4, | 57 | DCMD_BURST32 | DCMD_WIDTH4, |
58 | }; | 58 | }; |
diff --git a/sound/core/control.c b/sound/core/control.c index b0bf42691047..636b3b52ef8b 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -113,7 +113,6 @@ static int snd_ctl_release(struct inode *inode, struct file *file) | |||
113 | unsigned int idx; | 113 | unsigned int idx; |
114 | 114 | ||
115 | ctl = file->private_data; | 115 | ctl = file->private_data; |
116 | fasync_helper(-1, file, 0, &ctl->fasync); | ||
117 | file->private_data = NULL; | 116 | file->private_data = NULL; |
118 | card = ctl->card; | 117 | card = ctl->card; |
119 | write_lock_irqsave(&card->ctl_files_rwlock, flags); | 118 | write_lock_irqsave(&card->ctl_files_rwlock, flags); |
diff --git a/sound/core/init.c b/sound/core/init.c index 8af467df9245..b47ff8b44be8 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -264,8 +264,11 @@ static int snd_disconnect_release(struct inode *inode, struct file *file) | |||
264 | } | 264 | } |
265 | spin_unlock(&shutdown_lock); | 265 | spin_unlock(&shutdown_lock); |
266 | 266 | ||
267 | if (likely(df)) | 267 | if (likely(df)) { |
268 | if ((file->f_flags & FASYNC) && df->disconnected_f_op->fasync) | ||
269 | df->disconnected_f_op->fasync(-1, file, 0); | ||
268 | return df->disconnected_f_op->release(inode, file); | 270 | return df->disconnected_f_op->release(inode, file); |
271 | } | ||
269 | 272 | ||
270 | panic("%s(%p, %p) failed!", __func__, inode, file); | 273 | panic("%s(%p, %p) failed!", __func__, inode, file); |
271 | } | 274 | } |
@@ -549,9 +552,9 @@ int snd_card_register(struct snd_card *card) | |||
549 | return -EINVAL; | 552 | return -EINVAL; |
550 | #ifndef CONFIG_SYSFS_DEPRECATED | 553 | #ifndef CONFIG_SYSFS_DEPRECATED |
551 | if (!card->card_dev) { | 554 | if (!card->card_dev) { |
552 | card->card_dev = device_create_drvdata(sound_class, card->dev, | 555 | card->card_dev = device_create(sound_class, card->dev, |
553 | MKDEV(0, 0), NULL, | 556 | MKDEV(0, 0), NULL, |
554 | "card%i", card->number); | 557 | "card%i", card->number); |
555 | if (IS_ERR(card->card_dev)) | 558 | if (IS_ERR(card->card_dev)) |
556 | card->card_dev = NULL; | 559 | card->card_dev = NULL; |
557 | } | 560 | } |
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index a7b46ec72f32..1b3534d67686 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c | |||
@@ -33,9 +33,6 @@ | |||
33 | #include <linux/moduleparam.h> | 33 | #include <linux/moduleparam.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <sound/memalloc.h> | 35 | #include <sound/memalloc.h> |
36 | #ifdef CONFIG_SBUS | ||
37 | #include <asm/sbus.h> | ||
38 | #endif | ||
39 | 36 | ||
40 | 37 | ||
41 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); | 38 | MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); |
@@ -162,39 +159,6 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr, | |||
162 | } | 159 | } |
163 | #endif /* CONFIG_HAS_DMA */ | 160 | #endif /* CONFIG_HAS_DMA */ |
164 | 161 | ||
165 | #ifdef CONFIG_SBUS | ||
166 | |||
167 | static void *snd_malloc_sbus_pages(struct device *dev, size_t size, | ||
168 | dma_addr_t *dma_addr) | ||
169 | { | ||
170 | struct sbus_dev *sdev = (struct sbus_dev *)dev; | ||
171 | int pg; | ||
172 | void *res; | ||
173 | |||
174 | if (WARN_ON(!dma_addr)) | ||
175 | return NULL; | ||
176 | pg = get_order(size); | ||
177 | res = sbus_alloc_consistent(sdev, PAGE_SIZE * (1 << pg), dma_addr); | ||
178 | if (res != NULL) | ||
179 | inc_snd_pages(pg); | ||
180 | return res; | ||
181 | } | ||
182 | |||
183 | static void snd_free_sbus_pages(struct device *dev, size_t size, | ||
184 | void *ptr, dma_addr_t dma_addr) | ||
185 | { | ||
186 | struct sbus_dev *sdev = (struct sbus_dev *)dev; | ||
187 | int pg; | ||
188 | |||
189 | if (ptr == NULL) | ||
190 | return; | ||
191 | pg = get_order(size); | ||
192 | dec_snd_pages(pg); | ||
193 | sbus_free_consistent(sdev, PAGE_SIZE * (1 << pg), ptr, dma_addr); | ||
194 | } | ||
195 | |||
196 | #endif /* CONFIG_SBUS */ | ||
197 | |||
198 | /* | 162 | /* |
199 | * | 163 | * |
200 | * ALSA generic memory management | 164 | * ALSA generic memory management |
@@ -231,11 +195,6 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size, | |||
231 | dmab->area = snd_malloc_pages(size, (unsigned long)device); | 195 | dmab->area = snd_malloc_pages(size, (unsigned long)device); |
232 | dmab->addr = 0; | 196 | dmab->addr = 0; |
233 | break; | 197 | break; |
234 | #ifdef CONFIG_SBUS | ||
235 | case SNDRV_DMA_TYPE_SBUS: | ||
236 | dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr); | ||
237 | break; | ||
238 | #endif | ||
239 | #ifdef CONFIG_HAS_DMA | 198 | #ifdef CONFIG_HAS_DMA |
240 | case SNDRV_DMA_TYPE_DEV: | 199 | case SNDRV_DMA_TYPE_DEV: |
241 | dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); | 200 | dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); |
@@ -306,11 +265,6 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab) | |||
306 | case SNDRV_DMA_TYPE_CONTINUOUS: | 265 | case SNDRV_DMA_TYPE_CONTINUOUS: |
307 | snd_free_pages(dmab->area, dmab->bytes); | 266 | snd_free_pages(dmab->area, dmab->bytes); |
308 | break; | 267 | break; |
309 | #ifdef CONFIG_SBUS | ||
310 | case SNDRV_DMA_TYPE_SBUS: | ||
311 | snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); | ||
312 | break; | ||
313 | #endif | ||
314 | #ifdef CONFIG_HAS_DMA | 268 | #ifdef CONFIG_HAS_DMA |
315 | case SNDRV_DMA_TYPE_DEV: | 269 | case SNDRV_DMA_TYPE_DEV: |
316 | snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); | 270 | snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); |
@@ -419,7 +373,7 @@ static int snd_mem_proc_read(struct seq_file *seq, void *offset) | |||
419 | long pages = snd_allocated_pages >> (PAGE_SHIFT-12); | 373 | long pages = snd_allocated_pages >> (PAGE_SHIFT-12); |
420 | struct snd_mem_list *mem; | 374 | struct snd_mem_list *mem; |
421 | int devno; | 375 | int devno; |
422 | static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; | 376 | static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG" }; |
423 | 377 | ||
424 | mutex_lock(&list_mutex); | 378 | mutex_lock(&list_mutex); |
425 | seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", | 379 | seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 1af62b8b86c6..e17836680f49 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2283,7 +2283,7 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
2283 | int idx, err; | 2283 | int idx, err; |
2284 | struct snd_pcm_oss_file *pcm_oss_file; | 2284 | struct snd_pcm_oss_file *pcm_oss_file; |
2285 | struct snd_pcm_substream *substream; | 2285 | struct snd_pcm_substream *substream; |
2286 | unsigned int f_mode = file->f_mode; | 2286 | fmode_t f_mode = file->f_mode; |
2287 | 2287 | ||
2288 | if (rpcm_oss_file) | 2288 | if (rpcm_oss_file) |
2289 | *rpcm_oss_file = NULL; | 2289 | *rpcm_oss_file = NULL; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index aef18682c035..a789efc9df39 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -2169,7 +2169,6 @@ static int snd_pcm_release(struct inode *inode, struct file *file) | |||
2169 | if (snd_BUG_ON(!substream)) | 2169 | if (snd_BUG_ON(!substream)) |
2170 | return -ENXIO; | 2170 | return -ENXIO; |
2171 | pcm = substream->pcm; | 2171 | pcm = substream->pcm; |
2172 | fasync_helper(-1, file, 0, &substream->runtime->fasync); | ||
2173 | mutex_lock(&pcm->open_mutex); | 2172 | mutex_lock(&pcm->open_mutex); |
2174 | snd_pcm_release_substream(substream); | 2173 | snd_pcm_release_substream(substream); |
2175 | kfree(pcm_file); | 2174 | kfree(pcm_file); |
diff --git a/sound/core/sound.c b/sound/core/sound.c index c0685e2f0afa..44a69bb8d4f0 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -274,9 +274,8 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | |||
274 | return minor; | 274 | return minor; |
275 | } | 275 | } |
276 | snd_minors[minor] = preg; | 276 | snd_minors[minor] = preg; |
277 | preg->dev = device_create_drvdata(sound_class, device, | 277 | preg->dev = device_create(sound_class, device, MKDEV(major, minor), |
278 | MKDEV(major, minor), | 278 | private_data, "%s", name); |
279 | private_data, "%s", name); | ||
280 | if (IS_ERR(preg->dev)) { | 279 | if (IS_ERR(preg->dev)) { |
281 | snd_minors[minor] = NULL; | 280 | snd_minors[minor] = NULL; |
282 | mutex_unlock(&sound_mutex); | 281 | mutex_unlock(&sound_mutex); |
diff --git a/sound/core/timer.c b/sound/core/timer.c index e582face89d2..c584408c9f17 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -1263,7 +1263,6 @@ static int snd_timer_user_release(struct inode *inode, struct file *file) | |||
1263 | if (file->private_data) { | 1263 | if (file->private_data) { |
1264 | tu = file->private_data; | 1264 | tu = file->private_data; |
1265 | file->private_data = NULL; | 1265 | file->private_data = NULL; |
1266 | fasync_helper(-1, file, 0, &tu->fasync); | ||
1267 | if (tu->timeri) | 1266 | if (tu->timeri) |
1268 | snd_timer_close(tu->timeri); | 1267 | snd_timer_close(tu->timeri); |
1269 | kfree(tu->queue); | 1268 | kfree(tu->queue); |
diff --git a/sound/drivers/pcsp/pcsp.h b/sound/drivers/pcsp/pcsp.h index 70533a333b5b..cdef2664218f 100644 --- a/sound/drivers/pcsp/pcsp.h +++ b/sound/drivers/pcsp/pcsp.h | |||
@@ -62,6 +62,8 @@ struct snd_pcsp { | |||
62 | unsigned short port, irq, dma; | 62 | unsigned short port, irq, dma; |
63 | spinlock_t substream_lock; | 63 | spinlock_t substream_lock; |
64 | struct snd_pcm_substream *playback_substream; | 64 | struct snd_pcm_substream *playback_substream; |
65 | unsigned int fmt_size; | ||
66 | unsigned int is_signed; | ||
65 | size_t playback_ptr; | 67 | size_t playback_ptr; |
66 | size_t period_ptr; | 68 | size_t period_ptr; |
67 | atomic_t timer_active; | 69 | atomic_t timer_active; |
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index 40f95f549d2b..84cc2658c05b 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c | |||
@@ -36,12 +36,13 @@ static void pcsp_call_pcm_elapsed(unsigned long priv) | |||
36 | 36 | ||
37 | static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0); | 37 | static DECLARE_TASKLET(pcsp_pcm_tasklet, pcsp_call_pcm_elapsed, 0); |
38 | 38 | ||
39 | enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | 39 | /* write the port and returns the next expire time in ns; |
40 | * called at the trigger-start and in hrtimer callback | ||
41 | */ | ||
42 | static unsigned long pcsp_timer_update(struct hrtimer *handle) | ||
40 | { | 43 | { |
41 | unsigned char timer_cnt, val; | 44 | unsigned char timer_cnt, val; |
42 | int fmt_size, periods_elapsed; | ||
43 | u64 ns; | 45 | u64 ns; |
44 | size_t period_bytes, buffer_bytes; | ||
45 | struct snd_pcm_substream *substream; | 46 | struct snd_pcm_substream *substream; |
46 | struct snd_pcm_runtime *runtime; | 47 | struct snd_pcm_runtime *runtime; |
47 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); | 48 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); |
@@ -51,28 +52,25 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
51 | outb(chip->val61, 0x61); | 52 | outb(chip->val61, 0x61); |
52 | chip->thalf = 0; | 53 | chip->thalf = 0; |
53 | if (!atomic_read(&chip->timer_active)) | 54 | if (!atomic_read(&chip->timer_active)) |
54 | goto stop; | 55 | return 0; |
55 | hrtimer_forward(&chip->timer, chip->timer.expires, | 56 | return chip->ns_rem; |
56 | ktime_set(0, chip->ns_rem)); | ||
57 | return HRTIMER_RESTART; | ||
58 | } | 57 | } |
59 | 58 | ||
60 | if (!atomic_read(&chip->timer_active)) | 59 | if (!atomic_read(&chip->timer_active)) |
61 | goto stop; | 60 | return 0; |
62 | substream = chip->playback_substream; | 61 | substream = chip->playback_substream; |
63 | if (!substream) | 62 | if (!substream) |
64 | goto stop; | 63 | return 0; |
65 | 64 | ||
66 | runtime = substream->runtime; | 65 | runtime = substream->runtime; |
67 | fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3; | ||
68 | /* assume it is mono! */ | 66 | /* assume it is mono! */ |
69 | val = runtime->dma_area[chip->playback_ptr + fmt_size - 1]; | 67 | val = runtime->dma_area[chip->playback_ptr + chip->fmt_size - 1]; |
70 | if (snd_pcm_format_signed(runtime->format)) | 68 | if (chip->is_signed) |
71 | val ^= 0x80; | 69 | val ^= 0x80; |
72 | timer_cnt = val * CUR_DIV() / 256; | 70 | timer_cnt = val * CUR_DIV() / 256; |
73 | 71 | ||
74 | if (timer_cnt && chip->enable) { | 72 | if (timer_cnt && chip->enable) { |
75 | spin_lock(&i8253_lock); | 73 | spin_lock_irqsave(&i8253_lock, flags); |
76 | if (!nforce_wa) { | 74 | if (!nforce_wa) { |
77 | outb_p(chip->val61, 0x61); | 75 | outb_p(chip->val61, 0x61); |
78 | outb_p(timer_cnt, 0x42); | 76 | outb_p(timer_cnt, 0x42); |
@@ -81,14 +79,39 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
81 | outb(chip->val61 ^ 2, 0x61); | 79 | outb(chip->val61 ^ 2, 0x61); |
82 | chip->thalf = 1; | 80 | chip->thalf = 1; |
83 | } | 81 | } |
84 | spin_unlock(&i8253_lock); | 82 | spin_unlock_irqrestore(&i8253_lock, flags); |
85 | } | 83 | } |
86 | 84 | ||
85 | chip->ns_rem = PCSP_PERIOD_NS(); | ||
86 | ns = (chip->thalf ? PCSP_CALC_NS(timer_cnt) : chip->ns_rem); | ||
87 | chip->ns_rem -= ns; | ||
88 | return ns; | ||
89 | } | ||
90 | |||
91 | enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | ||
92 | { | ||
93 | struct snd_pcsp *chip = container_of(handle, struct snd_pcsp, timer); | ||
94 | struct snd_pcm_substream *substream; | ||
95 | int periods_elapsed, pointer_update; | ||
96 | size_t period_bytes, buffer_bytes; | ||
97 | unsigned long ns; | ||
98 | unsigned long flags; | ||
99 | |||
100 | pointer_update = !chip->thalf; | ||
101 | ns = pcsp_timer_update(handle); | ||
102 | if (!ns) | ||
103 | return HRTIMER_NORESTART; | ||
104 | |||
105 | /* update the playback position */ | ||
106 | substream = chip->playback_substream; | ||
107 | if (!substream) | ||
108 | return HRTIMER_NORESTART; | ||
109 | |||
87 | period_bytes = snd_pcm_lib_period_bytes(substream); | 110 | period_bytes = snd_pcm_lib_period_bytes(substream); |
88 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); | 111 | buffer_bytes = snd_pcm_lib_buffer_bytes(substream); |
89 | 112 | ||
90 | spin_lock_irqsave(&chip->substream_lock, flags); | 113 | spin_lock_irqsave(&chip->substream_lock, flags); |
91 | chip->playback_ptr += PCSP_INDEX_INC() * fmt_size; | 114 | chip->playback_ptr += PCSP_INDEX_INC() * chip->fmt_size; |
92 | periods_elapsed = chip->playback_ptr - chip->period_ptr; | 115 | periods_elapsed = chip->playback_ptr - chip->period_ptr; |
93 | if (periods_elapsed < 0) { | 116 | if (periods_elapsed < 0) { |
94 | #if PCSP_DEBUG | 117 | #if PCSP_DEBUG |
@@ -106,31 +129,27 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle) | |||
106 | if (periods_elapsed) { | 129 | if (periods_elapsed) { |
107 | chip->period_ptr += periods_elapsed * period_bytes; | 130 | chip->period_ptr += periods_elapsed * period_bytes; |
108 | chip->period_ptr %= buffer_bytes; | 131 | chip->period_ptr %= buffer_bytes; |
109 | tasklet_schedule(&pcsp_pcm_tasklet); | ||
110 | } | 132 | } |
111 | spin_unlock_irqrestore(&chip->substream_lock, flags); | 133 | spin_unlock_irqrestore(&chip->substream_lock, flags); |
112 | 134 | ||
113 | if (!atomic_read(&chip->timer_active)) | 135 | if (periods_elapsed) |
114 | goto stop; | 136 | tasklet_schedule(&pcsp_pcm_tasklet); |
115 | 137 | ||
116 | chip->ns_rem = PCSP_PERIOD_NS(); | 138 | hrtimer_forward(handle, hrtimer_get_expires(handle), ns_to_ktime(ns)); |
117 | ns = (chip->thalf ? PCSP_CALC_NS(timer_cnt) : chip->ns_rem); | ||
118 | chip->ns_rem -= ns; | ||
119 | hrtimer_forward(&chip->timer, chip->timer.expires, ktime_set(0, ns)); | ||
120 | return HRTIMER_RESTART; | ||
121 | 139 | ||
122 | stop: | 140 | return HRTIMER_RESTART; |
123 | return HRTIMER_NORESTART; | ||
124 | } | 141 | } |
125 | 142 | ||
126 | static void pcsp_start_playing(struct snd_pcsp *chip) | 143 | static int pcsp_start_playing(struct snd_pcsp *chip) |
127 | { | 144 | { |
145 | unsigned long ns; | ||
146 | |||
128 | #if PCSP_DEBUG | 147 | #if PCSP_DEBUG |
129 | printk(KERN_INFO "PCSP: start_playing called\n"); | 148 | printk(KERN_INFO "PCSP: start_playing called\n"); |
130 | #endif | 149 | #endif |
131 | if (atomic_read(&chip->timer_active)) { | 150 | if (atomic_read(&chip->timer_active)) { |
132 | printk(KERN_ERR "PCSP: Timer already active\n"); | 151 | printk(KERN_ERR "PCSP: Timer already active\n"); |
133 | return; | 152 | return -EIO; |
134 | } | 153 | } |
135 | 154 | ||
136 | spin_lock(&i8253_lock); | 155 | spin_lock(&i8253_lock); |
@@ -140,7 +159,12 @@ static void pcsp_start_playing(struct snd_pcsp *chip) | |||
140 | atomic_set(&chip->timer_active, 1); | 159 | atomic_set(&chip->timer_active, 1); |
141 | chip->thalf = 0; | 160 | chip->thalf = 0; |
142 | 161 | ||
143 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); | 162 | ns = pcsp_timer_update(&pcsp_chip.timer); |
163 | if (!ns) | ||
164 | return -EIO; | ||
165 | |||
166 | hrtimer_start(&pcsp_chip.timer, ktime_set(0, ns), HRTIMER_MODE_REL); | ||
167 | return 0; | ||
144 | } | 168 | } |
145 | 169 | ||
146 | static void pcsp_stop_playing(struct snd_pcsp *chip) | 170 | static void pcsp_stop_playing(struct snd_pcsp *chip) |
@@ -220,6 +244,9 @@ static int snd_pcsp_playback_prepare(struct snd_pcm_substream *substream) | |||
220 | pcsp_sync_stop(chip); | 244 | pcsp_sync_stop(chip); |
221 | chip->playback_ptr = 0; | 245 | chip->playback_ptr = 0; |
222 | chip->period_ptr = 0; | 246 | chip->period_ptr = 0; |
247 | chip->fmt_size = | ||
248 | snd_pcm_format_physical_width(substream->runtime->format) >> 3; | ||
249 | chip->is_signed = snd_pcm_format_signed(substream->runtime->format); | ||
223 | return 0; | 250 | return 0; |
224 | } | 251 | } |
225 | 252 | ||
@@ -232,8 +259,7 @@ static int snd_pcsp_trigger(struct snd_pcm_substream *substream, int cmd) | |||
232 | switch (cmd) { | 259 | switch (cmd) { |
233 | case SNDRV_PCM_TRIGGER_START: | 260 | case SNDRV_PCM_TRIGGER_START: |
234 | case SNDRV_PCM_TRIGGER_RESUME: | 261 | case SNDRV_PCM_TRIGGER_RESUME: |
235 | pcsp_start_playing(chip); | 262 | return pcsp_start_playing(chip); |
236 | break; | ||
237 | case SNDRV_PCM_TRIGGER_STOP: | 263 | case SNDRV_PCM_TRIGGER_STOP: |
238 | case SNDRV_PCM_TRIGGER_SUSPEND: | 264 | case SNDRV_PCM_TRIGGER_SUSPEND: |
239 | pcsp_stop_playing(chip); | 265 | pcsp_stop_playing(chip); |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 83e90057270e..c13a178383ba 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -87,8 +87,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea) | |||
87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, | 87 | static int snd_tea575x_ioctl(struct inode *inode, struct file *file, |
88 | unsigned int cmd, unsigned long data) | 88 | unsigned int cmd, unsigned long data) |
89 | { | 89 | { |
90 | struct video_device *dev = video_devdata(file); | 90 | struct snd_tea575x *tea = video_drvdata(file); |
91 | struct snd_tea575x *tea = video_get_drvdata(dev); | ||
92 | void __user *arg = (void __user *)data; | 91 | void __user *arg = (void __user *)data; |
93 | 92 | ||
94 | switch(cmd) { | 93 | switch(cmd) { |
@@ -175,6 +174,21 @@ static void snd_tea575x_release(struct video_device *vfd) | |||
175 | { | 174 | { |
176 | } | 175 | } |
177 | 176 | ||
177 | static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) | ||
178 | { | ||
179 | struct snd_tea575x *tea = video_drvdata(file); | ||
180 | |||
181 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; | ||
182 | } | ||
183 | |||
184 | static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) | ||
185 | { | ||
186 | struct snd_tea575x *tea = video_drvdata(file); | ||
187 | |||
188 | clear_bit(0, &tea->in_use); | ||
189 | return 0; | ||
190 | } | ||
191 | |||
178 | /* | 192 | /* |
179 | * initialize all the tea575x chips | 193 | * initialize all the tea575x chips |
180 | */ | 194 | */ |
@@ -193,9 +207,10 @@ void snd_tea575x_init(struct snd_tea575x *tea) | |||
193 | tea->vd.release = snd_tea575x_release; | 207 | tea->vd.release = snd_tea575x_release; |
194 | video_set_drvdata(&tea->vd, tea); | 208 | video_set_drvdata(&tea->vd, tea); |
195 | tea->vd.fops = &tea->fops; | 209 | tea->vd.fops = &tea->fops; |
210 | tea->in_use = 0; | ||
196 | tea->fops.owner = tea->card->module; | 211 | tea->fops.owner = tea->card->module; |
197 | tea->fops.open = video_exclusive_open; | 212 | tea->fops.open = snd_tea575x_exclusive_open; |
198 | tea->fops.release = video_exclusive_release; | 213 | tea->fops.release = snd_tea575x_exclusive_release; |
199 | tea->fops.ioctl = snd_tea575x_ioctl; | 214 | tea->fops.ioctl = snd_tea575x_ioctl; |
200 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { | 215 | if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) { |
201 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); | 216 | snd_printk(KERN_ERR "unable to register tea575x tuner\n"); |
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 660beb41f767..ce0aa044e274 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig | |||
@@ -211,7 +211,7 @@ config SND_GUSCLASSIC | |||
211 | 211 | ||
212 | config SND_GUSEXTREME | 212 | config SND_GUSEXTREME |
213 | tristate "Gravis UltraSound Extreme" | 213 | tristate "Gravis UltraSound Extreme" |
214 | select SND_HWDEP | 214 | select SND_OPL3_LIB |
215 | select SND_MPU401_UART | 215 | select SND_MPU401_UART |
216 | select SND_PCM | 216 | select SND_PCM |
217 | help | 217 | help |
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 23018a7c063a..81e1f443d094 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -93,7 +93,7 @@ static struct au1550_state { | |||
93 | spinlock_t lock; | 93 | spinlock_t lock; |
94 | struct mutex open_mutex; | 94 | struct mutex open_mutex; |
95 | struct mutex sem; | 95 | struct mutex sem; |
96 | mode_t open_mode; | 96 | fmode_t open_mode; |
97 | wait_queue_head_t open_wait; | 97 | wait_queue_head_t open_wait; |
98 | 98 | ||
99 | struct dmabuf { | 99 | struct dmabuf { |
diff --git a/sound/oss/dmasound/dmasound.h b/sound/oss/dmasound/dmasound.h index d978b0096564..1308d8d34186 100644 --- a/sound/oss/dmasound/dmasound.h +++ b/sound/oss/dmasound/dmasound.h | |||
@@ -129,7 +129,7 @@ typedef struct { | |||
129 | int (*mixer_ioctl)(u_int, u_long); /* optional */ | 129 | int (*mixer_ioctl)(u_int, u_long); /* optional */ |
130 | int (*write_sq_setup)(void); /* optional */ | 130 | int (*write_sq_setup)(void); /* optional */ |
131 | int (*read_sq_setup)(void); /* optional */ | 131 | int (*read_sq_setup)(void); /* optional */ |
132 | int (*sq_open)(mode_t); /* optional */ | 132 | int (*sq_open)(fmode_t); /* optional */ |
133 | int (*state_info)(char *, size_t); /* optional */ | 133 | int (*state_info)(char *, size_t); /* optional */ |
134 | void (*abort_read)(void); /* optional */ | 134 | void (*abort_read)(void); /* optional */ |
135 | int min_dsp_speed; | 135 | int min_dsp_speed; |
@@ -235,7 +235,7 @@ struct sound_queue { | |||
235 | */ | 235 | */ |
236 | int active; | 236 | int active; |
237 | wait_queue_head_t action_queue, open_queue, sync_queue; | 237 | wait_queue_head_t action_queue, open_queue, sync_queue; |
238 | int open_mode; | 238 | int non_blocking; |
239 | int busy, syncing, xruns, died; | 239 | int busy, syncing, xruns, died; |
240 | }; | 240 | }; |
241 | 241 | ||
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 285239d64b82..4d45bd63718b 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -143,7 +143,7 @@ static int AtaMixerIoctl(u_int cmd, u_long arg); | |||
143 | static int TTMixerIoctl(u_int cmd, u_long arg); | 143 | static int TTMixerIoctl(u_int cmd, u_long arg); |
144 | static int FalconMixerIoctl(u_int cmd, u_long arg); | 144 | static int FalconMixerIoctl(u_int cmd, u_long arg); |
145 | static int AtaWriteSqSetup(void); | 145 | static int AtaWriteSqSetup(void); |
146 | static int AtaSqOpen(mode_t mode); | 146 | static int AtaSqOpen(fmode_t mode); |
147 | static int TTStateInfo(char *buffer, size_t space); | 147 | static int TTStateInfo(char *buffer, size_t space); |
148 | static int FalconStateInfo(char *buffer, size_t space); | 148 | static int FalconStateInfo(char *buffer, size_t space); |
149 | 149 | ||
@@ -1461,7 +1461,7 @@ static int AtaWriteSqSetup(void) | |||
1461 | return 0 ; | 1461 | return 0 ; |
1462 | } | 1462 | } |
1463 | 1463 | ||
1464 | static int AtaSqOpen(mode_t mode) | 1464 | static int AtaSqOpen(fmode_t mode) |
1465 | { | 1465 | { |
1466 | write_sq_ignore_int = 1; | 1466 | write_sq_ignore_int = 1; |
1467 | return 0 ; | 1467 | return 0 ; |
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 95fc5c681755..793b7f478433 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -212,7 +212,7 @@ static int irq_installed; | |||
212 | #endif /* MODULE */ | 212 | #endif /* MODULE */ |
213 | 213 | ||
214 | /* control over who can modify resources shared between play/record */ | 214 | /* control over who can modify resources shared between play/record */ |
215 | static mode_t shared_resource_owner; | 215 | static fmode_t shared_resource_owner; |
216 | static int shared_resources_initialised; | 216 | static int shared_resources_initialised; |
217 | 217 | ||
218 | /* | 218 | /* |
@@ -603,7 +603,7 @@ static ssize_t sq_write(struct file *file, const char __user *src, size_t uLeft, | |||
603 | while (uLeft) { | 603 | while (uLeft) { |
604 | while (write_sq.count >= write_sq.max_active) { | 604 | while (write_sq.count >= write_sq.max_active) { |
605 | sq_play(); | 605 | sq_play(); |
606 | if (write_sq.open_mode & O_NONBLOCK) | 606 | if (write_sq.non_blocking) |
607 | return uWritten > 0 ? uWritten : -EAGAIN; | 607 | return uWritten > 0 ? uWritten : -EAGAIN; |
608 | SLEEP(write_sq.action_queue); | 608 | SLEEP(write_sq.action_queue); |
609 | if (signal_pending(current)) | 609 | if (signal_pending(current)) |
@@ -668,7 +668,7 @@ static inline void sq_init_waitqueue(struct sound_queue *sq) | |||
668 | 668 | ||
669 | #if 0 /* blocking open() */ | 669 | #if 0 /* blocking open() */ |
670 | static inline void sq_wake_up(struct sound_queue *sq, struct file *file, | 670 | static inline void sq_wake_up(struct sound_queue *sq, struct file *file, |
671 | mode_t mode) | 671 | fmode_t mode) |
672 | { | 672 | { |
673 | if (file->f_mode & mode) { | 673 | if (file->f_mode & mode) { |
674 | sq->busy = 0; /* CHECK: IS THIS OK??? */ | 674 | sq->busy = 0; /* CHECK: IS THIS OK??? */ |
@@ -677,7 +677,7 @@ static inline void sq_wake_up(struct sound_queue *sq, struct file *file, | |||
677 | } | 677 | } |
678 | #endif | 678 | #endif |
679 | 679 | ||
680 | static int sq_open2(struct sound_queue *sq, struct file *file, mode_t mode, | 680 | static int sq_open2(struct sound_queue *sq, struct file *file, fmode_t mode, |
681 | int numbufs, int bufsize) | 681 | int numbufs, int bufsize) |
682 | { | 682 | { |
683 | int rc = 0; | 683 | int rc = 0; |
@@ -718,7 +718,7 @@ static int sq_open2(struct sound_queue *sq, struct file *file, mode_t mode, | |||
718 | return rc; | 718 | return rc; |
719 | } | 719 | } |
720 | 720 | ||
721 | sq->open_mode = file->f_mode; | 721 | sq->non_blocking = file->f_flags & O_NONBLOCK; |
722 | } | 722 | } |
723 | return rc; | 723 | return rc; |
724 | } | 724 | } |
@@ -891,10 +891,10 @@ static int sq_release(struct inode *inode, struct file *file) | |||
891 | is the owner - if we have problems. | 891 | is the owner - if we have problems. |
892 | */ | 892 | */ |
893 | 893 | ||
894 | static int shared_resources_are_mine(mode_t md) | 894 | static int shared_resources_are_mine(fmode_t md) |
895 | { | 895 | { |
896 | if (shared_resource_owner) | 896 | if (shared_resource_owner) |
897 | return (shared_resource_owner & md ) ; | 897 | return (shared_resource_owner & md) != 0; |
898 | else { | 898 | else { |
899 | shared_resource_owner = md ; | 899 | shared_resource_owner = md ; |
900 | return 1 ; | 900 | return 1 ; |
diff --git a/sound/oss/msnd.h b/sound/oss/msnd.h index 61b3955481c5..c8be47ec2b7e 100644 --- a/sound/oss/msnd.h +++ b/sound/oss/msnd.h | |||
@@ -211,7 +211,7 @@ typedef struct multisound_dev { | |||
211 | 211 | ||
212 | /* State variables */ | 212 | /* State variables */ |
213 | enum { msndClassic, msndPinnacle } type; | 213 | enum { msndClassic, msndPinnacle } type; |
214 | mode_t mode; | 214 | fmode_t mode; |
215 | unsigned long flags; | 215 | unsigned long flags; |
216 | #define F_RESETTING 0 | 216 | #define F_RESETTING 0 |
217 | #define F_HAVEDIGITAL 1 | 217 | #define F_HAVEDIGITAL 1 |
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index b493660deb36..e5d423994918 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <asm/cpu/dac.h> | 26 | #include <asm/cpu/dac.h> |
27 | #include <asm/cpu/timer.h> | 27 | #include <asm/cpu/timer.h> |
28 | #include <asm/machvec.h> | 28 | #include <asm/machvec.h> |
29 | #include <asm/hp6xx.h> | 29 | #include <mach/hp6xx.h> |
30 | #include <asm/hd64461.h> | 30 | #include <asm/hd64461.h> |
31 | 31 | ||
32 | #define MODNAME "sh_dac_audio" | 32 | #define MODNAME "sh_dac_audio" |
diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h index 1a00a3210616..55271fbe7f49 100644 --- a/sound/oss/sound_config.h +++ b/sound/oss/sound_config.h | |||
@@ -110,24 +110,16 @@ struct channel_info { | |||
110 | #define OPEN_WRITE PCM_ENABLE_OUTPUT | 110 | #define OPEN_WRITE PCM_ENABLE_OUTPUT |
111 | #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) | 111 | #define OPEN_READWRITE (OPEN_READ|OPEN_WRITE) |
112 | 112 | ||
113 | #if OPEN_READ == FMODE_READ && OPEN_WRITE == FMODE_WRITE | ||
114 | |||
115 | static inline int translate_mode(struct file *file) | ||
116 | { | ||
117 | return file->f_mode; | ||
118 | } | ||
119 | |||
120 | #else | ||
121 | |||
122 | static inline int translate_mode(struct file *file) | 113 | static inline int translate_mode(struct file *file) |
123 | { | 114 | { |
124 | return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) | | 115 | if (OPEN_READ == (__force int)FMODE_READ && |
125 | ((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0); | 116 | OPEN_WRITE == (__force int)FMODE_WRITE) |
117 | return (__force int)(file->f_mode & (FMODE_READ | FMODE_WRITE)); | ||
118 | else | ||
119 | return ((file->f_mode & FMODE_READ) ? OPEN_READ : 0) | | ||
120 | ((file->f_mode & FMODE_WRITE) ? OPEN_WRITE : 0); | ||
126 | } | 121 | } |
127 | 122 | ||
128 | #endif | ||
129 | |||
130 | |||
131 | #include "sound_calls.h" | 123 | #include "sound_calls.h" |
132 | #include "dev_table.h" | 124 | #include "dev_table.h" |
133 | 125 | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 7d89c081a086..61aaedae6b7e 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -560,19 +560,18 @@ static int __init oss_init(void) | |||
560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); | 560 | sound_dmap_flag = (dmabuf > 0 ? 1 : 0); |
561 | 561 | ||
562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { | 562 | for (i = 0; i < ARRAY_SIZE(dev_list); i++) { |
563 | device_create_drvdata(sound_class, NULL, | 563 | device_create(sound_class, NULL, |
564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), | 564 | MKDEV(SOUND_MAJOR, dev_list[i].minor), NULL, |
565 | NULL, "%s", dev_list[i].name); | 565 | "%s", dev_list[i].name); |
566 | 566 | ||
567 | if (!dev_list[i].num) | 567 | if (!dev_list[i].num) |
568 | continue; | 568 | continue; |
569 | 569 | ||
570 | for (j = 1; j < *dev_list[i].num; j++) | 570 | for (j = 1; j < *dev_list[i].num; j++) |
571 | device_create_drvdata(sound_class, NULL, | 571 | device_create(sound_class, NULL, |
572 | MKDEV(SOUND_MAJOR, | 572 | MKDEV(SOUND_MAJOR, |
573 | dev_list[i].minor + (j*0x10)), | 573 | dev_list[i].minor + (j*0x10)), |
574 | NULL, | 574 | NULL, "%s%d", dev_list[i].name, j); |
575 | "%s%d", dev_list[i].name, j); | ||
576 | } | 575 | } |
577 | 576 | ||
578 | if (sound_nblocks >= 1024) | 577 | if (sound_nblocks >= 1024) |
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 044453a4ee5b..41562ecde5bb 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -295,7 +295,7 @@ struct cs4297a_state { | |||
295 | struct mutex open_mutex; | 295 | struct mutex open_mutex; |
296 | struct mutex open_sem_adc; | 296 | struct mutex open_sem_adc; |
297 | struct mutex open_sem_dac; | 297 | struct mutex open_sem_dac; |
298 | mode_t open_mode; | 298 | fmode_t open_mode; |
299 | wait_queue_head_t open_wait; | 299 | wait_queue_head_t open_wait; |
300 | wait_queue_head_t open_wait_adc; | 300 | wait_queue_head_t open_wait_adc; |
301 | wait_queue_head_t open_wait_dac; | 301 | wait_queue_head_t open_wait_dac; |
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index dcbb3f739e61..78b8acc7c3b9 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c | |||
@@ -1509,7 +1509,7 @@ typedef struct vwsnd_dev { | |||
1509 | struct mutex open_mutex; | 1509 | struct mutex open_mutex; |
1510 | struct mutex io_mutex; | 1510 | struct mutex io_mutex; |
1511 | struct mutex mix_mutex; | 1511 | struct mutex mix_mutex; |
1512 | mode_t open_mode; | 1512 | fmode_t open_mode; |
1513 | wait_queue_head_t open_wait; | 1513 | wait_queue_head_t open_wait; |
1514 | 1514 | ||
1515 | lithium_t lith; | 1515 | lithium_t lith; |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 92f3a976ef2e..a7f38e63303f 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -932,7 +932,7 @@ snd_ad1889_create(struct snd_card *card, | |||
932 | goto free_and_ret; | 932 | goto free_and_ret; |
933 | 933 | ||
934 | chip->bar = pci_resource_start(pci, 0); | 934 | chip->bar = pci_resource_start(pci, 0); |
935 | chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0)); | 935 | chip->iobase = pci_ioremap_bar(pci, 0); |
936 | if (chip->iobase == NULL) { | 936 | if (chip->iobase == NULL) { |
937 | printk(KERN_ERR PFX "unable to reserve region.\n"); | 937 | printk(KERN_ERR PFX "unable to reserve region.\n"); |
938 | err = -EBUSY; | 938 | err = -EBUSY; |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 085a52b8c807..226fe8237d31 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1609,7 +1609,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1609 | return err; | 1609 | return err; |
1610 | } | 1610 | } |
1611 | chip->addr = pci_resource_start(pci, 0); | 1611 | chip->addr = pci_resource_start(pci, 0); |
1612 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); | 1612 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
1613 | if (chip->remap_addr == NULL) { | 1613 | if (chip->remap_addr == NULL) { |
1614 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); | 1614 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1615 | snd_atiixp_free(chip); | 1615 | snd_atiixp_free(chip); |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 2f106306c7fe..0e6e5cc1c501 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1252,7 +1252,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, | |||
1252 | return err; | 1252 | return err; |
1253 | } | 1253 | } |
1254 | chip->addr = pci_resource_start(pci, 0); | 1254 | chip->addr = pci_resource_start(pci, 0); |
1255 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0)); | 1255 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
1256 | if (chip->remap_addr == NULL) { | 1256 | if (chip->remap_addr == NULL) { |
1257 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); | 1257 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1258 | snd_atiixp_free(chip); | 1258 | snd_atiixp_free(chip); |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index 68368e490074..a36d4d1fd419 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -180,8 +180,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) | |||
180 | if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0) | 180 | if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0) |
181 | goto regions_out; | 181 | goto regions_out; |
182 | 182 | ||
183 | chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), | 183 | chip->mmio = pci_ioremap_bar(pci, 0); |
184 | pci_resource_len(pci, 0)); | ||
185 | if (!chip->mmio) { | 184 | if (!chip->mmio) { |
186 | printk(KERN_ERR "MMIO area remap failed.\n"); | 185 | printk(KERN_ERR "MMIO area remap failed.\n"); |
187 | err = -ENOMEM; | 186 | err = -ENOMEM; |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 3aa8d973540a..1aa1c0402540 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -749,8 +749,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, | |||
749 | pci_disable_device(pci); | 749 | pci_disable_device(pci); |
750 | return err; | 750 | return err; |
751 | } | 751 | } |
752 | chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), | 752 | chip->mmio = pci_ioremap_bar(pci, 0); |
753 | pci_resource_len(pci, 0)); | ||
754 | if (!chip->mmio) { | 753 | if (!chip->mmio) { |
755 | snd_printk(KERN_ERR "cannot remap io memory\n"); | 754 | snd_printk(KERN_ERR "cannot remap io memory\n"); |
756 | err = -ENOMEM; | 755 | err = -ENOMEM; |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index ef9308f7c45b..192e7842e181 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -1382,8 +1382,8 @@ static int __devinit snd_cs4281_create(struct snd_card *card, | |||
1382 | chip->ba0_addr = pci_resource_start(pci, 0); | 1382 | chip->ba0_addr = pci_resource_start(pci, 0); |
1383 | chip->ba1_addr = pci_resource_start(pci, 1); | 1383 | chip->ba1_addr = pci_resource_start(pci, 1); |
1384 | 1384 | ||
1385 | chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0)); | 1385 | chip->ba0 = pci_ioremap_bar(pci, 0); |
1386 | chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1)); | 1386 | chip->ba1 = pci_ioremap_bar(pci, 1); |
1387 | if (!chip->ba0 || !chip->ba1) { | 1387 | if (!chip->ba0 || !chip->ba1) { |
1388 | snd_cs4281_free(chip); | 1388 | snd_cs4281_free(chip); |
1389 | return -ENOMEM; | 1389 | return -ENOMEM; |
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 4ba2db2f4250..6dea5b5cc774 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -132,7 +132,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card, | |||
132 | } | 132 | } |
133 | chip->pci_base = pci_resource_start(pci, 0); | 133 | chip->pci_base = pci_resource_start(pci, 0); |
134 | 134 | ||
135 | mem = ioremap_nocache(chip->pci_base, pci_resource_len(pci, 0)); | 135 | mem = pci_ioremap_bar(pci, 0); |
136 | if (mem == NULL) { | 136 | if (mem == NULL) { |
137 | kfree(chip); | 137 | kfree(chip); |
138 | pci_disable_device(pci); | 138 | pci_disable_device(pci); |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 9b77b3e0fa98..3ecd7e797dee 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -37,6 +37,9 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
37 | container_of(work, struct hda_beep, beep_work); | 37 | container_of(work, struct hda_beep, beep_work); |
38 | struct hda_codec *codec = beep->codec; | 38 | struct hda_codec *codec = beep->codec; |
39 | 39 | ||
40 | if (!beep->enabled) | ||
41 | return; | ||
42 | |||
40 | /* generate tone */ | 43 | /* generate tone */ |
41 | snd_hda_codec_write_cache(codec, beep->nid, 0, | 44 | snd_hda_codec_write_cache(codec, beep->nid, 0, |
42 | AC_VERB_SET_BEEP_CONTROL, beep->tone); | 45 | AC_VERB_SET_BEEP_CONTROL, beep->tone); |
@@ -85,6 +88,10 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
85 | snprintf(beep->phys, sizeof(beep->phys), | 88 | snprintf(beep->phys, sizeof(beep->phys), |
86 | "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); | 89 | "card%d/codec#%d/beep0", codec->bus->card->number, codec->addr); |
87 | input_dev = input_allocate_device(); | 90 | input_dev = input_allocate_device(); |
91 | if (!input_dev) { | ||
92 | kfree(beep); | ||
93 | return -ENOMEM; | ||
94 | } | ||
88 | 95 | ||
89 | /* setup digital beep device */ | 96 | /* setup digital beep device */ |
90 | input_dev->name = "HDA Digital PCBeep"; | 97 | input_dev->name = "HDA Digital PCBeep"; |
@@ -115,6 +122,7 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
115 | beep->nid = nid; | 122 | beep->nid = nid; |
116 | beep->dev = input_dev; | 123 | beep->dev = input_dev; |
117 | beep->codec = codec; | 124 | beep->codec = codec; |
125 | beep->enabled = 1; | ||
118 | codec->beep = beep; | 126 | codec->beep = beep; |
119 | 127 | ||
120 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | 128 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index de4036e6e710..b9679f081cae 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h | |||
@@ -31,6 +31,7 @@ struct hda_beep { | |||
31 | char phys[32]; | 31 | char phys[32]; |
32 | int tone; | 32 | int tone; |
33 | int nid; | 33 | int nid; |
34 | int enabled; | ||
34 | struct work_struct beep_work; /* scheduled task for beep event */ | 35 | struct work_struct beep_work; /* scheduled task for beep event */ |
35 | }; | 36 | }; |
36 | 37 | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 6447754ae56e..ba1ab737b55f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -64,6 +64,7 @@ static struct hda_vendor_id hda_vendor_ids[] = { | |||
64 | { 0x14f1, "Conexant" }, | 64 | { 0x14f1, "Conexant" }, |
65 | { 0x17e8, "Chrontel" }, | 65 | { 0x17e8, "Chrontel" }, |
66 | { 0x1854, "LG" }, | 66 | { 0x1854, "LG" }, |
67 | { 0x1aec, "Wolfson Microelectronics" }, | ||
67 | { 0x434d, "C-Media" }, | 68 | { 0x434d, "C-Media" }, |
68 | { 0x8384, "SigmaTel" }, | 69 | { 0x8384, "SigmaTel" }, |
69 | {} /* terminator */ | 70 | {} /* terminator */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9f316c1b2790..35722ec920cb 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/pci.h> | 46 | #include <linux/pci.h> |
47 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
48 | #include <linux/reboot.h> | ||
48 | #include <sound/core.h> | 49 | #include <sound/core.h> |
49 | #include <sound/initval.h> | 50 | #include <sound/initval.h> |
50 | #include "hda_codec.h" | 51 | #include "hda_codec.h" |
@@ -397,6 +398,9 @@ struct azx { | |||
397 | 398 | ||
398 | /* for pending irqs */ | 399 | /* for pending irqs */ |
399 | struct work_struct irq_pending_work; | 400 | struct work_struct irq_pending_work; |
401 | |||
402 | /* reboot notifier (for mysterious hangup problem at power-down) */ | ||
403 | struct notifier_block reboot_notifier; | ||
400 | }; | 404 | }; |
401 | 405 | ||
402 | /* driver types */ | 406 | /* driver types */ |
@@ -1979,12 +1983,36 @@ static int azx_resume(struct pci_dev *pci) | |||
1979 | 1983 | ||
1980 | 1984 | ||
1981 | /* | 1985 | /* |
1986 | * reboot notifier for hang-up problem at power-down | ||
1987 | */ | ||
1988 | static int azx_halt(struct notifier_block *nb, unsigned long event, void *buf) | ||
1989 | { | ||
1990 | struct azx *chip = container_of(nb, struct azx, reboot_notifier); | ||
1991 | azx_stop_chip(chip); | ||
1992 | return NOTIFY_OK; | ||
1993 | } | ||
1994 | |||
1995 | static void azx_notifier_register(struct azx *chip) | ||
1996 | { | ||
1997 | chip->reboot_notifier.notifier_call = azx_halt; | ||
1998 | register_reboot_notifier(&chip->reboot_notifier); | ||
1999 | } | ||
2000 | |||
2001 | static void azx_notifier_unregister(struct azx *chip) | ||
2002 | { | ||
2003 | if (chip->reboot_notifier.notifier_call) | ||
2004 | unregister_reboot_notifier(&chip->reboot_notifier); | ||
2005 | } | ||
2006 | |||
2007 | /* | ||
1982 | * destructor | 2008 | * destructor |
1983 | */ | 2009 | */ |
1984 | static int azx_free(struct azx *chip) | 2010 | static int azx_free(struct azx *chip) |
1985 | { | 2011 | { |
1986 | int i; | 2012 | int i; |
1987 | 2013 | ||
2014 | azx_notifier_unregister(chip); | ||
2015 | |||
1988 | if (chip->initialized) { | 2016 | if (chip->initialized) { |
1989 | azx_clear_irq_pending(chip); | 2017 | azx_clear_irq_pending(chip); |
1990 | for (i = 0; i < chip->num_streams; i++) | 2018 | for (i = 0; i < chip->num_streams; i++) |
@@ -2158,7 +2186,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2158 | } | 2186 | } |
2159 | 2187 | ||
2160 | chip->addr = pci_resource_start(pci, 0); | 2188 | chip->addr = pci_resource_start(pci, 0); |
2161 | chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci,0)); | 2189 | chip->remap_addr = pci_ioremap_bar(pci, 0); |
2162 | if (chip->remap_addr == NULL) { | 2190 | if (chip->remap_addr == NULL) { |
2163 | snd_printk(KERN_ERR SFX "ioremap error\n"); | 2191 | snd_printk(KERN_ERR SFX "ioremap error\n"); |
2164 | err = -ENXIO; | 2192 | err = -ENXIO; |
@@ -2348,6 +2376,7 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2348 | pci_set_drvdata(pci, card); | 2376 | pci_set_drvdata(pci, card); |
2349 | chip->running = 1; | 2377 | chip->running = 1; |
2350 | power_down_all_codecs(chip); | 2378 | power_down_all_codecs(chip); |
2379 | azx_notifier_register(chip); | ||
2351 | 2380 | ||
2352 | dev++; | 2381 | dev++; |
2353 | return err; | 2382 | return err; |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 743d77922bce..c39af986bff1 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -483,6 +483,8 @@ static void print_gpio(struct snd_info_buffer *buffer, | |||
483 | (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, | 483 | (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, |
484 | (gpio & AC_GPIO_WAKE) ? 1 : 0); | 484 | (gpio & AC_GPIO_WAKE) ? 1 : 0); |
485 | max = gpio & AC_GPIO_IO_COUNT; | 485 | max = gpio & AC_GPIO_IO_COUNT; |
486 | if (!max || max > 8) | ||
487 | return; | ||
486 | enable = snd_hda_codec_read(codec, nid, 0, | 488 | enable = snd_hda_codec_read(codec, nid, 0, |
487 | AC_VERB_GET_GPIO_MASK, 0); | 489 | AC_VERB_GET_GPIO_MASK, 0); |
488 | direction = snd_hda_codec_read(codec, nid, 0, | 490 | direction = snd_hda_codec_read(codec, nid, 0, |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 2b00c4afdf97..686c77491dea 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -3860,6 +3860,9 @@ static const char *ad1884a_models[AD1884A_MODELS] = { | |||
3860 | 3860 | ||
3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | 3861 | static struct snd_pci_quirk ad1884a_cfg_tbl[] = { |
3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3862 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3863 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | ||
3864 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), | ||
3865 | SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), | ||
3863 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 3866 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
3864 | {} | 3867 | {} |
3865 | }; | 3868 | }; |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 1a65775d28e1..2eed2c8b98da 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -116,6 +116,7 @@ static int nvhdmi_build_pcms(struct hda_codec *codec) | |||
116 | codec->pcm_info = info; | 116 | codec->pcm_info = info; |
117 | 117 | ||
118 | info->name = "NVIDIA HDMI"; | 118 | info->name = "NVIDIA HDMI"; |
119 | info->pcm_type = HDA_PCM_TYPE_HDMI; | ||
119 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; | 120 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; |
120 | 121 | ||
121 | return 0; | 122 | return 0; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e72707cb60a3..a378c0145125 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -307,6 +307,13 @@ struct alc_spec { | |||
307 | /* for PLL fix */ | 307 | /* for PLL fix */ |
308 | hda_nid_t pll_nid; | 308 | hda_nid_t pll_nid; |
309 | unsigned int pll_coef_idx, pll_coef_bit; | 309 | unsigned int pll_coef_idx, pll_coef_bit; |
310 | |||
311 | #ifdef SND_HDA_NEEDS_RESUME | ||
312 | #define ALC_MAX_PINS 16 | ||
313 | unsigned int num_pins; | ||
314 | hda_nid_t pin_nids[ALC_MAX_PINS]; | ||
315 | unsigned int pin_cfgs[ALC_MAX_PINS]; | ||
316 | #endif | ||
310 | }; | 317 | }; |
311 | 318 | ||
312 | /* | 319 | /* |
@@ -822,6 +829,7 @@ static void alc_sku_automute(struct hda_codec *codec) | |||
822 | spec->jack_present ? 0 : PIN_OUT); | 829 | spec->jack_present ? 0 : PIN_OUT); |
823 | } | 830 | } |
824 | 831 | ||
832 | #if 0 /* it's broken in some acses -- temporarily disabled */ | ||
825 | static void alc_mic_automute(struct hda_codec *codec) | 833 | static void alc_mic_automute(struct hda_codec *codec) |
826 | { | 834 | { |
827 | struct alc_spec *spec = codec->spec; | 835 | struct alc_spec *spec = codec->spec; |
@@ -842,6 +850,9 @@ static void alc_mic_automute(struct hda_codec *codec) | |||
842 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, | 850 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic, |
843 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 851 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
844 | } | 852 | } |
853 | #else | ||
854 | #define alc_mic_automute(codec) /* NOP */ | ||
855 | #endif /* disabled */ | ||
845 | 856 | ||
846 | /* unsolicited event for HP jack sensing */ | 857 | /* unsolicited event for HP jack sensing */ |
847 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | 858 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
@@ -1051,12 +1062,14 @@ do_sku: | |||
1051 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1062 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1052 | AC_USRSP_EN | ALC880_HP_EVENT); | 1063 | AC_USRSP_EN | ALC880_HP_EVENT); |
1053 | 1064 | ||
1065 | #if 0 /* it's broken in some acses -- temporarily disabled */ | ||
1054 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && | 1066 | if (spec->autocfg.input_pins[AUTO_PIN_MIC] && |
1055 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) | 1067 | spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]) |
1056 | snd_hda_codec_write(codec, | 1068 | snd_hda_codec_write(codec, |
1057 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, | 1069 | spec->autocfg.input_pins[AUTO_PIN_MIC], 0, |
1058 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1070 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1059 | AC_USRSP_EN | ALC880_MIC_EVENT); | 1071 | AC_USRSP_EN | ALC880_MIC_EVENT); |
1072 | #endif /* disabled */ | ||
1060 | 1073 | ||
1061 | spec->unsol_event = alc_sku_unsol_event; | 1074 | spec->unsol_event = alc_sku_unsol_event; |
1062 | } | 1075 | } |
@@ -2778,6 +2791,64 @@ static void alc_free(struct hda_codec *codec) | |||
2778 | codec->spec = NULL; /* to be sure */ | 2791 | codec->spec = NULL; /* to be sure */ |
2779 | } | 2792 | } |
2780 | 2793 | ||
2794 | #ifdef SND_HDA_NEEDS_RESUME | ||
2795 | static void store_pin_configs(struct hda_codec *codec) | ||
2796 | { | ||
2797 | struct alc_spec *spec = codec->spec; | ||
2798 | hda_nid_t nid, end_nid; | ||
2799 | |||
2800 | end_nid = codec->start_nid + codec->num_nodes; | ||
2801 | for (nid = codec->start_nid; nid < end_nid; nid++) { | ||
2802 | unsigned int wid_caps = get_wcaps(codec, nid); | ||
2803 | unsigned int wid_type = | ||
2804 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
2805 | if (wid_type != AC_WID_PIN) | ||
2806 | continue; | ||
2807 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) | ||
2808 | break; | ||
2809 | spec->pin_nids[spec->num_pins] = nid; | ||
2810 | spec->pin_cfgs[spec->num_pins] = | ||
2811 | snd_hda_codec_read(codec, nid, 0, | ||
2812 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
2813 | spec->num_pins++; | ||
2814 | } | ||
2815 | } | ||
2816 | |||
2817 | static void resume_pin_configs(struct hda_codec *codec) | ||
2818 | { | ||
2819 | struct alc_spec *spec = codec->spec; | ||
2820 | int i; | ||
2821 | |||
2822 | for (i = 0; i < spec->num_pins; i++) { | ||
2823 | hda_nid_t pin_nid = spec->pin_nids[i]; | ||
2824 | unsigned int pin_config = spec->pin_cfgs[i]; | ||
2825 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2826 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | ||
2827 | pin_config & 0x000000ff); | ||
2828 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2829 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | ||
2830 | (pin_config & 0x0000ff00) >> 8); | ||
2831 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2832 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | ||
2833 | (pin_config & 0x00ff0000) >> 16); | ||
2834 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2835 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
2836 | pin_config >> 24); | ||
2837 | } | ||
2838 | } | ||
2839 | |||
2840 | static int alc_resume(struct hda_codec *codec) | ||
2841 | { | ||
2842 | resume_pin_configs(codec); | ||
2843 | codec->patch_ops.init(codec); | ||
2844 | snd_hda_codec_resume_amp(codec); | ||
2845 | snd_hda_codec_resume_cache(codec); | ||
2846 | return 0; | ||
2847 | } | ||
2848 | #else | ||
2849 | #define store_pin_configs(codec) | ||
2850 | #endif | ||
2851 | |||
2781 | /* | 2852 | /* |
2782 | */ | 2853 | */ |
2783 | static struct hda_codec_ops alc_patch_ops = { | 2854 | static struct hda_codec_ops alc_patch_ops = { |
@@ -2786,6 +2857,9 @@ static struct hda_codec_ops alc_patch_ops = { | |||
2786 | .init = alc_init, | 2857 | .init = alc_init, |
2787 | .free = alc_free, | 2858 | .free = alc_free, |
2788 | .unsol_event = alc_unsol_event, | 2859 | .unsol_event = alc_unsol_event, |
2860 | #ifdef SND_HDA_NEEDS_RESUME | ||
2861 | .resume = alc_resume, | ||
2862 | #endif | ||
2789 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 2863 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
2790 | .check_power_status = alc_check_power_status, | 2864 | .check_power_status = alc_check_power_status, |
2791 | #endif | 2865 | #endif |
@@ -3832,6 +3906,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
3832 | spec->num_mux_defs = 1; | 3906 | spec->num_mux_defs = 1; |
3833 | spec->input_mux = &spec->private_imux; | 3907 | spec->input_mux = &spec->private_imux; |
3834 | 3908 | ||
3909 | store_pin_configs(codec); | ||
3835 | return 1; | 3910 | return 1; |
3836 | } | 3911 | } |
3837 | 3912 | ||
@@ -4996,7 +5071,7 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
4996 | */ | 5071 | */ |
4997 | 5072 | ||
4998 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | 5073 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
4999 | const char *pfx) | 5074 | const char *pfx, int *vol_bits) |
5000 | { | 5075 | { |
5001 | hda_nid_t nid_vol; | 5076 | hda_nid_t nid_vol; |
5002 | unsigned long vol_val, sw_val; | 5077 | unsigned long vol_val, sw_val; |
@@ -5018,10 +5093,14 @@ static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | |||
5018 | } else | 5093 | } else |
5019 | return 0; /* N/A */ | 5094 | return 0; /* N/A */ |
5020 | 5095 | ||
5021 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | 5096 | if (!(*vol_bits & (1 << nid_vol))) { |
5022 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | 5097 | /* first control for the volume widget */ |
5023 | if (err < 0) | 5098 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
5024 | return err; | 5099 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
5100 | if (err < 0) | ||
5101 | return err; | ||
5102 | *vol_bits |= (1 << nid_vol); | ||
5103 | } | ||
5025 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); | 5104 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
5026 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); | 5105 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
5027 | if (err < 0) | 5106 | if (err < 0) |
@@ -5035,6 +5114,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5035 | { | 5114 | { |
5036 | hda_nid_t nid; | 5115 | hda_nid_t nid; |
5037 | int err; | 5116 | int err; |
5117 | int vols = 0; | ||
5038 | 5118 | ||
5039 | spec->multiout.num_dacs = 1; | 5119 | spec->multiout.num_dacs = 1; |
5040 | spec->multiout.dac_nids = spec->private_dac_nids; | 5120 | spec->multiout.dac_nids = spec->private_dac_nids; |
@@ -5042,21 +5122,22 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5042 | 5122 | ||
5043 | nid = cfg->line_out_pins[0]; | 5123 | nid = cfg->line_out_pins[0]; |
5044 | if (nid) { | 5124 | if (nid) { |
5045 | err = alc260_add_playback_controls(spec, nid, "Front"); | 5125 | err = alc260_add_playback_controls(spec, nid, "Front", &vols); |
5046 | if (err < 0) | 5126 | if (err < 0) |
5047 | return err; | 5127 | return err; |
5048 | } | 5128 | } |
5049 | 5129 | ||
5050 | nid = cfg->speaker_pins[0]; | 5130 | nid = cfg->speaker_pins[0]; |
5051 | if (nid) { | 5131 | if (nid) { |
5052 | err = alc260_add_playback_controls(spec, nid, "Speaker"); | 5132 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); |
5053 | if (err < 0) | 5133 | if (err < 0) |
5054 | return err; | 5134 | return err; |
5055 | } | 5135 | } |
5056 | 5136 | ||
5057 | nid = cfg->hp_pins[0]; | 5137 | nid = cfg->hp_pins[0]; |
5058 | if (nid) { | 5138 | if (nid) { |
5059 | err = alc260_add_playback_controls(spec, nid, "Headphone"); | 5139 | err = alc260_add_playback_controls(spec, nid, "Headphone", |
5140 | &vols); | ||
5060 | if (err < 0) | 5141 | if (err < 0) |
5061 | return err; | 5142 | return err; |
5062 | } | 5143 | } |
@@ -5244,6 +5325,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5244 | } | 5325 | } |
5245 | spec->num_mixers++; | 5326 | spec->num_mixers++; |
5246 | 5327 | ||
5328 | store_pin_configs(codec); | ||
5247 | return 1; | 5329 | return 1; |
5248 | } | 5330 | } |
5249 | 5331 | ||
@@ -8332,6 +8414,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
8332 | static struct snd_pci_quirk alc883_cfg_tbl[] = { | 8414 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
8333 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | 8415 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
8334 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8416 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
8417 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | ||
8335 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | 8418 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
8336 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | 8419 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
8337 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | 8420 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
@@ -8386,6 +8469,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8386 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8469 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8387 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | 8470 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
8388 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | 8471 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
8472 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | ||
8389 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8473 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
8390 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8474 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
8391 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | 8475 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
@@ -10307,6 +10391,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
10307 | if (err < 0) | 10391 | if (err < 0) |
10308 | return err; | 10392 | return err; |
10309 | 10393 | ||
10394 | store_pin_configs(codec); | ||
10310 | return 1; | 10395 | return 1; |
10311 | } | 10396 | } |
10312 | 10397 | ||
@@ -11441,6 +11526,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
11441 | if (err < 0) | 11526 | if (err < 0) |
11442 | return err; | 11527 | return err; |
11443 | 11528 | ||
11529 | store_pin_configs(codec); | ||
11444 | return 1; | 11530 | return 1; |
11445 | } | 11531 | } |
11446 | 11532 | ||
@@ -12160,8 +12246,26 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
12160 | return 0; | 12246 | return 0; |
12161 | } | 12247 | } |
12162 | 12248 | ||
12163 | #define alc269_auto_create_analog_input_ctls \ | 12249 | static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, |
12164 | alc880_auto_create_analog_input_ctls | 12250 | const struct auto_pin_cfg *cfg) |
12251 | { | ||
12252 | int err; | ||
12253 | |||
12254 | err = alc880_auto_create_analog_input_ctls(spec, cfg); | ||
12255 | if (err < 0) | ||
12256 | return err; | ||
12257 | /* digital-mic input pin is excluded in alc880_auto_create..() | ||
12258 | * because it's under 0x18 | ||
12259 | */ | ||
12260 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | ||
12261 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | ||
12262 | struct hda_input_mux *imux = &spec->private_imux; | ||
12263 | imux->items[imux->num_items].label = "Int Mic"; | ||
12264 | imux->items[imux->num_items].index = 0x05; | ||
12265 | imux->num_items++; | ||
12266 | } | ||
12267 | return 0; | ||
12268 | } | ||
12165 | 12269 | ||
12166 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 12270 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
12167 | #define alc269_loopbacks alc880_loopbacks | 12271 | #define alc269_loopbacks alc880_loopbacks |
@@ -12224,6 +12328,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
12224 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; | 12328 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
12225 | spec->num_mixers++; | 12329 | spec->num_mixers++; |
12226 | 12330 | ||
12331 | store_pin_configs(codec); | ||
12227 | return 1; | 12332 | return 1; |
12228 | } | 12333 | } |
12229 | 12334 | ||
@@ -13310,6 +13415,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
13310 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; | 13415 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
13311 | spec->num_mixers++; | 13416 | spec->num_mixers++; |
13312 | 13417 | ||
13418 | store_pin_configs(codec); | ||
13313 | return 1; | 13419 | return 1; |
13314 | } | 13420 | } |
13315 | 13421 | ||
@@ -14421,6 +14527,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
14421 | if (err < 0) | 14527 | if (err < 0) |
14422 | return err; | 14528 | return err; |
14423 | 14529 | ||
14530 | store_pin_configs(codec); | ||
14424 | return 1; | 14531 | return 1; |
14425 | } | 14532 | } |
14426 | 14533 | ||
@@ -16252,6 +16359,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
16252 | 16359 | ||
16253 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; | 16360 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
16254 | spec->num_mixers++; | 16361 | spec->num_mixers++; |
16362 | |||
16363 | store_pin_configs(codec); | ||
16255 | return 1; | 16364 | return 1; |
16256 | } | 16365 | } |
16257 | 16366 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a2ac7205d45d..9563b5bbb272 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -36,9 +36,11 @@ | |||
36 | #include "hda_beep.h" | 36 | #include "hda_beep.h" |
37 | 37 | ||
38 | #define NUM_CONTROL_ALLOC 32 | 38 | #define NUM_CONTROL_ALLOC 32 |
39 | |||
40 | #define STAC_VREF_EVENT 0x00 | ||
41 | #define STAC_INSERT_EVENT 0x10 | ||
39 | #define STAC_PWR_EVENT 0x20 | 42 | #define STAC_PWR_EVENT 0x20 |
40 | #define STAC_HP_EVENT 0x30 | 43 | #define STAC_HP_EVENT 0x30 |
41 | #define STAC_VREF_EVENT 0x40 | ||
42 | 44 | ||
43 | enum { | 45 | enum { |
44 | STAC_REF, | 46 | STAC_REF, |
@@ -69,6 +71,7 @@ enum { | |||
69 | enum { | 71 | enum { |
70 | STAC_92HD73XX_REF, | 72 | STAC_92HD73XX_REF, |
71 | STAC_DELL_M6, | 73 | STAC_DELL_M6, |
74 | STAC_DELL_EQ, | ||
72 | STAC_92HD73XX_MODELS | 75 | STAC_92HD73XX_MODELS |
73 | }; | 76 | }; |
74 | 77 | ||
@@ -211,7 +214,7 @@ struct sigmatel_spec { | |||
211 | /* i/o switches */ | 214 | /* i/o switches */ |
212 | unsigned int io_switch[2]; | 215 | unsigned int io_switch[2]; |
213 | unsigned int clfe_swap; | 216 | unsigned int clfe_swap; |
214 | unsigned int hp_switch; | 217 | unsigned int hp_switch; /* NID of HP as line-out */ |
215 | unsigned int aloopback; | 218 | unsigned int aloopback; |
216 | 219 | ||
217 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 220 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
@@ -566,10 +569,8 @@ static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, | |||
566 | nid = codec->slave_dig_outs[smux_idx - 1]; | 569 | nid = codec->slave_dig_outs[smux_idx - 1]; |
567 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) | 570 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
568 | val = AMP_OUT_MUTE; | 571 | val = AMP_OUT_MUTE; |
569 | if (smux_idx == 0) | ||
570 | nid = spec->multiout.dig_out_nid; | ||
571 | else | 572 | else |
572 | nid = codec->slave_dig_outs[smux_idx - 1]; | 573 | val = AMP_OUT_UNMUTE; |
573 | /* un/mute SPDIF out */ | 574 | /* un/mute SPDIF out */ |
574 | snd_hda_codec_write_cache(codec, nid, 0, | 575 | snd_hda_codec_write_cache(codec, nid, 0, |
575 | AC_VERB_SET_AMP_GAIN_MUTE, val); | 576 | AC_VERB_SET_AMP_GAIN_MUTE, val); |
@@ -775,9 +776,7 @@ static struct hda_verb dell_eq_core_init[] = { | |||
775 | }; | 776 | }; |
776 | 777 | ||
777 | static struct hda_verb dell_m6_core_init[] = { | 778 | static struct hda_verb dell_m6_core_init[] = { |
778 | /* set master volume to max value without distortion | 779 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
779 | * and direct control */ | ||
780 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, | ||
781 | /* setup audio connections */ | 780 | /* setup audio connections */ |
782 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | 781 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
783 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | 782 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
@@ -1282,7 +1281,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1282 | return err; | 1281 | return err; |
1283 | spec->multiout.share_spdif = 1; | 1282 | spec->multiout.share_spdif = 1; |
1284 | } | 1283 | } |
1285 | if (spec->dig_in_nid && (!spec->gpio_dir & 0x01)) { | 1284 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
1286 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 1285 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
1287 | if (err < 0) | 1286 | if (err < 0) |
1288 | return err; | 1287 | return err; |
@@ -1602,11 +1601,13 @@ static unsigned int dell_m6_pin_configs[13] = { | |||
1602 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1601 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1603 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1602 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1604 | [STAC_DELL_M6] = dell_m6_pin_configs, | 1603 | [STAC_DELL_M6] = dell_m6_pin_configs, |
1604 | [STAC_DELL_EQ] = dell_m6_pin_configs, | ||
1605 | }; | 1605 | }; |
1606 | 1606 | ||
1607 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1607 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1608 | [STAC_92HD73XX_REF] = "ref", | 1608 | [STAC_92HD73XX_REF] = "ref", |
1609 | [STAC_DELL_M6] = "dell-m6", | 1609 | [STAC_DELL_M6] = "dell-m6", |
1610 | [STAC_DELL_EQ] = "dell-eq", | ||
1610 | }; | 1611 | }; |
1611 | 1612 | ||
1612 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | 1613 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
@@ -1687,6 +1688,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1687 | /* SigmaTel reference board */ | 1688 | /* SigmaTel reference board */ |
1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1689 | "DFI LanParty", STAC_92HD71BXX_REF), | 1690 | "DFI LanParty", STAC_92HD71BXX_REF), |
1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, | ||
1692 | "HP dv5", STAC_HP_M4), | ||
1693 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, | ||
1694 | "HP dv7", STAC_HP_M4), | ||
1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
1691 | "unknown HP", STAC_HP_M4), | 1696 | "unknown HP", STAC_HP_M4), |
1692 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
@@ -2444,7 +2449,7 @@ static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | |||
2444 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2445 | struct sigmatel_spec *spec = codec->spec; | 2450 | struct sigmatel_spec *spec = codec->spec; |
2446 | 2451 | ||
2447 | ucontrol->value.integer.value[0] = spec->hp_switch; | 2452 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
2448 | return 0; | 2453 | return 0; |
2449 | } | 2454 | } |
2450 | 2455 | ||
@@ -2453,8 +2458,9 @@ static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
2453 | { | 2458 | { |
2454 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2455 | struct sigmatel_spec *spec = codec->spec; | 2460 | struct sigmatel_spec *spec = codec->spec; |
2456 | 2461 | int nid = kcontrol->private_value; | |
2457 | spec->hp_switch = ucontrol->value.integer.value[0]; | 2462 | |
2463 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; | ||
2458 | 2464 | ||
2459 | /* check to be sure that the ports are upto date with | 2465 | /* check to be sure that the ports are upto date with |
2460 | * switch changes | 2466 | * switch changes |
@@ -2587,8 +2593,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2587 | }; | 2593 | }; |
2588 | 2594 | ||
2589 | /* add dynamic controls */ | 2595 | /* add dynamic controls */ |
2590 | static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | 2596 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
2591 | int idx, const char *name, unsigned long val) | 2597 | struct snd_kcontrol_new *ktemp, |
2598 | int idx, const char *name, | ||
2599 | unsigned long val) | ||
2592 | { | 2600 | { |
2593 | struct snd_kcontrol_new *knew; | 2601 | struct snd_kcontrol_new *knew; |
2594 | 2602 | ||
@@ -2607,20 +2615,29 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | |||
2607 | } | 2615 | } |
2608 | 2616 | ||
2609 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 2617 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
2610 | *knew = stac92xx_control_templates[type]; | 2618 | *knew = *ktemp; |
2611 | knew->index = idx; | 2619 | knew->index = idx; |
2612 | knew->name = kstrdup(name, GFP_KERNEL); | 2620 | knew->name = kstrdup(name, GFP_KERNEL); |
2613 | if (! knew->name) | 2621 | if (!knew->name) |
2614 | return -ENOMEM; | 2622 | return -ENOMEM; |
2615 | knew->private_value = val; | 2623 | knew->private_value = val; |
2616 | spec->num_kctl_used++; | 2624 | spec->num_kctl_used++; |
2617 | return 0; | 2625 | return 0; |
2618 | } | 2626 | } |
2619 | 2627 | ||
2628 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, | ||
2629 | int type, int idx, const char *name, | ||
2630 | unsigned long val) | ||
2631 | { | ||
2632 | return stac92xx_add_control_temp(spec, | ||
2633 | &stac92xx_control_templates[type], | ||
2634 | idx, name, val); | ||
2635 | } | ||
2636 | |||
2620 | 2637 | ||
2621 | /* add dynamic controls */ | 2638 | /* add dynamic controls */ |
2622 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, | 2639 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
2623 | const char *name, unsigned long val) | 2640 | const char *name, unsigned long val) |
2624 | { | 2641 | { |
2625 | return stac92xx_add_control_idx(spec, type, 0, name, val); | 2642 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
2626 | } | 2643 | } |
@@ -2863,7 +2880,8 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2863 | if (cfg->hp_outs > 1) { | 2880 | if (cfg->hp_outs > 1) { |
2864 | err = stac92xx_add_control(spec, | 2881 | err = stac92xx_add_control(spec, |
2865 | STAC_CTL_WIDGET_HP_SWITCH, | 2882 | STAC_CTL_WIDGET_HP_SWITCH, |
2866 | "Headphone as Line Out Switch", 0); | 2883 | "Headphone as Line Out Switch", |
2884 | cfg->hp_pins[cfg->hp_outs - 1]); | ||
2867 | if (err < 0) | 2885 | if (err < 0) |
2868 | return err; | 2886 | return err; |
2869 | } | 2887 | } |
@@ -3061,6 +3079,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | |||
3061 | return 0; | 3079 | return 0; |
3062 | } | 3080 | } |
3063 | 3081 | ||
3082 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
3083 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info | ||
3084 | |||
3085 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, | ||
3086 | struct snd_ctl_elem_value *ucontrol) | ||
3087 | { | ||
3088 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3089 | ucontrol->value.integer.value[0] = codec->beep->enabled; | ||
3090 | return 0; | ||
3091 | } | ||
3092 | |||
3093 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, | ||
3094 | struct snd_ctl_elem_value *ucontrol) | ||
3095 | { | ||
3096 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3097 | int enabled = !!ucontrol->value.integer.value[0]; | ||
3098 | if (codec->beep->enabled != enabled) { | ||
3099 | codec->beep->enabled = enabled; | ||
3100 | return 1; | ||
3101 | } | ||
3102 | return 0; | ||
3103 | } | ||
3104 | |||
3105 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { | ||
3106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3107 | .info = stac92xx_dig_beep_switch_info, | ||
3108 | .get = stac92xx_dig_beep_switch_get, | ||
3109 | .put = stac92xx_dig_beep_switch_put, | ||
3110 | }; | ||
3111 | |||
3112 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) | ||
3113 | { | ||
3114 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, | ||
3115 | 0, "PC Beep Playback Switch", 0); | ||
3116 | } | ||
3117 | #endif | ||
3118 | |||
3064 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | 3119 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
3065 | { | 3120 | { |
3066 | struct sigmatel_spec *spec = codec->spec; | 3121 | struct sigmatel_spec *spec = codec->spec; |
@@ -3367,6 +3422,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3367 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | 3422 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
3368 | if (spec->digbeep_nid > 0) { | 3423 | if (spec->digbeep_nid > 0) { |
3369 | hda_nid_t nid = spec->digbeep_nid; | 3424 | hda_nid_t nid = spec->digbeep_nid; |
3425 | unsigned int caps; | ||
3370 | 3426 | ||
3371 | err = stac92xx_auto_create_beep_ctls(codec, nid); | 3427 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
3372 | if (err < 0) | 3428 | if (err < 0) |
@@ -3374,6 +3430,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3374 | err = snd_hda_attach_beep_device(codec, nid); | 3430 | err = snd_hda_attach_beep_device(codec, nid); |
3375 | if (err < 0) | 3431 | if (err < 0) |
3376 | return err; | 3432 | return err; |
3433 | /* if no beep switch is available, make its own one */ | ||
3434 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3435 | if (codec->beep && | ||
3436 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { | ||
3437 | err = stac92xx_beep_switch_ctl(codec); | ||
3438 | if (err < 0) | ||
3439 | return err; | ||
3440 | } | ||
3377 | } | 3441 | } |
3378 | #endif | 3442 | #endif |
3379 | 3443 | ||
@@ -3531,6 +3595,12 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) | |||
3531 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) | 3595 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
3532 | return err; | 3596 | return err; |
3533 | 3597 | ||
3598 | if (spec->num_muxes > 0) { | ||
3599 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3600 | if (err < 0) | ||
3601 | return err; | ||
3602 | } | ||
3603 | |||
3534 | if (spec->autocfg.dig_out_pin) | 3604 | if (spec->autocfg.dig_out_pin) |
3535 | spec->multiout.dig_out_nid = 0x05; | 3605 | spec->multiout.dig_out_nid = 0x05; |
3536 | if (spec->autocfg.dig_in_pin) | 3606 | if (spec->autocfg.dig_in_pin) |
@@ -3648,14 +3718,18 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3648 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3718 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3649 | hda_nid_t nid = cfg->input_pins[i]; | 3719 | hda_nid_t nid = cfg->input_pins[i]; |
3650 | if (nid) { | 3720 | if (nid) { |
3651 | unsigned int pinctl = snd_hda_codec_read(codec, nid, | 3721 | unsigned int pinctl; |
3652 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3722 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
3653 | /* if PINCTL already set then skip */ | 3723 | /* for mic pins, force to initialize */ |
3654 | if (pinctl & AC_PINCAP_IN) | 3724 | pinctl = stac92xx_get_vref(codec, nid); |
3655 | continue; | 3725 | } else { |
3656 | pinctl = AC_PINCTL_IN_EN; | 3726 | pinctl = snd_hda_codec_read(codec, nid, 0, |
3657 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3727 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3658 | pinctl |= stac92xx_get_vref(codec, nid); | 3728 | /* if PINCTL already set then skip */ |
3729 | if (pinctl & AC_PINCTL_IN_EN) | ||
3730 | continue; | ||
3731 | } | ||
3732 | pinctl |= AC_PINCTL_IN_EN; | ||
3659 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3733 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
3660 | } | 3734 | } |
3661 | } | 3735 | } |
@@ -3777,11 +3851,30 @@ static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
3777 | return 0; | 3851 | return 0; |
3778 | } | 3852 | } |
3779 | 3853 | ||
3854 | /* return non-zero if the hp-pin of the given array index isn't | ||
3855 | * a jack-detection target | ||
3856 | */ | ||
3857 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) | ||
3858 | { | ||
3859 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3860 | |||
3861 | /* ignore sensing of shared line and mic jacks */ | ||
3862 | if (spec->line_switch && | ||
3863 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE]) | ||
3864 | return 1; | ||
3865 | if (spec->mic_switch && | ||
3866 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC]) | ||
3867 | return 1; | ||
3868 | /* ignore if the pin is set as line-out */ | ||
3869 | if (cfg->hp_pins[i] == spec->hp_switch) | ||
3870 | return 1; | ||
3871 | return 0; | ||
3872 | } | ||
3873 | |||
3780 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | 3874 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
3781 | { | 3875 | { |
3782 | struct sigmatel_spec *spec = codec->spec; | 3876 | struct sigmatel_spec *spec = codec->spec; |
3783 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3877 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3784 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; | ||
3785 | int i, presence; | 3878 | int i, presence; |
3786 | 3879 | ||
3787 | presence = 0; | 3880 | presence = 0; |
@@ -3792,15 +3885,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3792 | for (i = 0; i < cfg->hp_outs; i++) { | 3885 | for (i = 0; i < cfg->hp_outs; i++) { |
3793 | if (presence) | 3886 | if (presence) |
3794 | break; | 3887 | break; |
3795 | if (spec->hp_switch && cfg->hp_pins[i] == nid) | 3888 | if (no_hp_sensing(spec, i)) |
3796 | break; | 3889 | continue; |
3797 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3890 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3798 | } | 3891 | } |
3799 | 3892 | ||
3800 | if (presence) { | 3893 | if (presence) { |
3801 | /* disable lineouts, enable hp */ | 3894 | /* disable lineouts */ |
3802 | if (spec->hp_switch) | 3895 | if (spec->hp_switch) |
3803 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3896 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
3897 | AC_PINCTL_OUT_EN); | ||
3804 | for (i = 0; i < cfg->line_outs; i++) | 3898 | for (i = 0; i < cfg->line_outs; i++) |
3805 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 3899 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
3806 | AC_PINCTL_OUT_EN); | 3900 | AC_PINCTL_OUT_EN); |
@@ -3812,9 +3906,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3812 | spec->gpio_dir, spec->gpio_data & | 3906 | spec->gpio_dir, spec->gpio_data & |
3813 | ~spec->eapd_mask); | 3907 | ~spec->eapd_mask); |
3814 | } else { | 3908 | } else { |
3815 | /* enable lineouts, disable hp */ | 3909 | /* enable lineouts */ |
3816 | if (spec->hp_switch) | 3910 | if (spec->hp_switch) |
3817 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3911 | stac92xx_set_pinctl(codec, spec->hp_switch, |
3912 | AC_PINCTL_OUT_EN); | ||
3818 | for (i = 0; i < cfg->line_outs; i++) | 3913 | for (i = 0; i < cfg->line_outs; i++) |
3819 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 3914 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
3820 | AC_PINCTL_OUT_EN); | 3915 | AC_PINCTL_OUT_EN); |
@@ -3826,8 +3921,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3826 | spec->gpio_dir, spec->gpio_data | | 3921 | spec->gpio_dir, spec->gpio_data | |
3827 | spec->eapd_mask); | 3922 | spec->eapd_mask); |
3828 | } | 3923 | } |
3829 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) | 3924 | /* toggle hp outs */ |
3830 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3925 | for (i = 0; i < cfg->hp_outs; i++) { |
3926 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; | ||
3927 | if (no_hp_sensing(spec, i)) | ||
3928 | continue; | ||
3929 | if (presence) | ||
3930 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); | ||
3931 | else | ||
3932 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); | ||
3933 | } | ||
3831 | } | 3934 | } |
3832 | 3935 | ||
3833 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3936 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |
@@ -4133,12 +4236,17 @@ again: | |||
4133 | sizeof(stac92hd73xx_dmux)); | 4236 | sizeof(stac92hd73xx_dmux)); |
4134 | 4237 | ||
4135 | switch (spec->board_config) { | 4238 | switch (spec->board_config) { |
4136 | case STAC_DELL_M6: | 4239 | case STAC_DELL_EQ: |
4137 | spec->init = dell_eq_core_init; | 4240 | spec->init = dell_eq_core_init; |
4241 | /* fallthru */ | ||
4242 | case STAC_DELL_M6: | ||
4138 | spec->num_smuxes = 0; | 4243 | spec->num_smuxes = 0; |
4139 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | 4244 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
4140 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | 4245 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
4141 | spec->num_amps = 1; | 4246 | spec->num_amps = 1; |
4247 | |||
4248 | if (!spec->init) | ||
4249 | spec->init = dell_m6_core_init; | ||
4142 | switch (codec->subsystem_id) { | 4250 | switch (codec->subsystem_id) { |
4143 | case 0x1028025e: /* Analog Mics */ | 4251 | case 0x1028025e: /* Analog Mics */ |
4144 | case 0x1028025f: | 4252 | case 0x1028025f: |
@@ -4148,8 +4256,6 @@ again: | |||
4148 | break; | 4256 | break; |
4149 | case 0x10280271: /* Digital Mics */ | 4257 | case 0x10280271: /* Digital Mics */ |
4150 | case 0x10280272: | 4258 | case 0x10280272: |
4151 | spec->init = dell_m6_core_init; | ||
4152 | /* fall-through */ | ||
4153 | case 0x10280254: | 4259 | case 0x10280254: |
4154 | case 0x10280255: | 4260 | case 0x10280255: |
4155 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4261 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
@@ -4376,6 +4482,13 @@ again: | |||
4376 | stac92xx_set_config_regs(codec); | 4482 | stac92xx_set_config_regs(codec); |
4377 | } | 4483 | } |
4378 | 4484 | ||
4485 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4486 | /* GPIO0 = EAPD */ | ||
4487 | spec->gpio_mask = 0x01; | ||
4488 | spec->gpio_dir = 0x01; | ||
4489 | spec->gpio_data = 0x01; | ||
4490 | } | ||
4491 | |||
4379 | switch (codec->vendor_id) { | 4492 | switch (codec->vendor_id) { |
4380 | case 0x111d76b6: /* 4 Port without Analog Mixer */ | 4493 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
4381 | case 0x111d76b7: | 4494 | case 0x111d76b7: |
@@ -4386,10 +4499,10 @@ again: | |||
4386 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 4499 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
4387 | break; | 4500 | break; |
4388 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4501 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4389 | switch (codec->subsystem_id) { | 4502 | switch (spec->board_config) { |
4390 | case 0x103c361a: | 4503 | case STAC_HP_M4: |
4391 | /* Enable VREF power saving on GPIO1 detect */ | 4504 | /* Enable VREF power saving on GPIO1 detect */ |
4392 | snd_hda_codec_write(codec, codec->afg, 0, | 4505 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4393 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | 4506 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
4394 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4507 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4395 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4508 | AC_VERB_SET_UNSOLICITED_ENABLE, |
@@ -4435,13 +4548,6 @@ again: | |||
4435 | spec->aloopback_mask = 0x50; | 4548 | spec->aloopback_mask = 0x50; |
4436 | spec->aloopback_shift = 0; | 4549 | spec->aloopback_shift = 0; |
4437 | 4550 | ||
4438 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4439 | /* GPIO0 = EAPD */ | ||
4440 | spec->gpio_mask = 0x01; | ||
4441 | spec->gpio_dir = 0x01; | ||
4442 | spec->gpio_data = 0x01; | ||
4443 | } | ||
4444 | |||
4445 | spec->powerdown_adcs = 1; | 4551 | spec->powerdown_adcs = 1; |
4446 | spec->digbeep_nid = 0x26; | 4552 | spec->digbeep_nid = 0x26; |
4447 | spec->mux_nids = stac92hd71bxx_mux_nids; | 4553 | spec->mux_nids = stac92hd71bxx_mux_nids; |
@@ -4789,7 +4895,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4789 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); | 4895 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
4790 | 4896 | ||
4791 | /* Enable unsol response for GPIO4/Dock HP connection */ | 4897 | /* Enable unsol response for GPIO4/Dock HP connection */ |
4792 | snd_hda_codec_write(codec, codec->afg, 0, | 4898 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4793 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); | 4899 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
4794 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4900 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4795 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4901 | AC_VERB_SET_UNSOLICITED_ENABLE, |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index fd9a117f37a4..f23a73577c22 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1315,8 +1315,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1315 | } | 1315 | } |
1316 | for (i = 0; i < 2; i++) { | 1316 | for (i = 0; i < 2; i++) { |
1317 | mgr->mem[i].phys = pci_resource_start(pci, i); | 1317 | mgr->mem[i].phys = pci_resource_start(pci, i); |
1318 | mgr->mem[i].virt = ioremap_nocache(mgr->mem[i].phys, | 1318 | mgr->mem[i].virt = pci_ioremap_bar(pci, i); |
1319 | pci_resource_len(pci, i)); | ||
1320 | if (!mgr->mem[i].virt) { | 1319 | if (!mgr->mem[i].virt) { |
1321 | printk(KERN_ERR "unable to remap resource 0x%lx\n", | 1320 | printk(KERN_ERR "unable to remap resource 0x%lx\n", |
1322 | mgr->mem[i].phys); | 1321 | mgr->mem[i].phys); |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 58621206a2b3..7d2b136295d5 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1230,8 +1230,11 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id | |||
1230 | return -ENOMEM; | 1230 | return -ENOMEM; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) | 1233 | if (snd_BUG_ON(pci_id->driver_data >= PCI_ID_LAST)) { |
1234 | kfree(mgr); | ||
1235 | pci_disable_device(pci); | ||
1234 | return -ENODEV; | 1236 | return -ENODEV; |
1237 | } | ||
1235 | card_name = pcxhr_board_params[pci_id->driver_data].board_name; | 1238 | card_name = pcxhr_board_params[pci_id->driver_data].board_name; |
1236 | mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips; | 1239 | mgr->playback_chips = pcxhr_board_params[pci_id->driver_data].playback_chips; |
1237 | mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips; | 1240 | mgr->capture_chips = pcxhr_board_params[pci_id->driver_data].capture_chips; |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index d723543beadd..736246f98acc 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -4548,11 +4548,20 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4548 | { | 4548 | { |
4549 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; | 4549 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; |
4550 | void __user *argp = (void __user *)arg; | 4550 | void __user *argp = (void __user *)arg; |
4551 | int err; | ||
4551 | 4552 | ||
4552 | switch (cmd) { | 4553 | switch (cmd) { |
4553 | case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { | 4554 | case SNDRV_HDSP_IOCTL_GET_PEAK_RMS: { |
4554 | struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg; | 4555 | struct hdsp_peak_rms __user *peak_rms = (struct hdsp_peak_rms __user *)arg; |
4555 | 4556 | ||
4557 | err = hdsp_check_for_iobox(hdsp); | ||
4558 | if (err < 0) | ||
4559 | return err; | ||
4560 | |||
4561 | err = hdsp_check_for_firmware(hdsp, 1); | ||
4562 | if (err < 0) | ||
4563 | return err; | ||
4564 | |||
4556 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4565 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { |
4557 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); | 4566 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware needs to be uploaded to the card.\n"); |
4558 | return -EINVAL; | 4567 | return -EINVAL; |
@@ -4572,10 +4581,14 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4572 | unsigned long flags; | 4581 | unsigned long flags; |
4573 | int i; | 4582 | int i; |
4574 | 4583 | ||
4575 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4584 | err = hdsp_check_for_iobox(hdsp); |
4576 | snd_printk(KERN_ERR "Hammerfall-DSP: Firmware needs to be uploaded to the card.\n"); | 4585 | if (err < 0) |
4577 | return -EINVAL; | 4586 | return err; |
4578 | } | 4587 | |
4588 | err = hdsp_check_for_firmware(hdsp, 1); | ||
4589 | if (err < 0) | ||
4590 | return err; | ||
4591 | |||
4579 | spin_lock_irqsave(&hdsp->lock, flags); | 4592 | spin_lock_irqsave(&hdsp->lock, flags); |
4580 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); | 4593 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); |
4581 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); | 4594 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); |
@@ -5045,6 +5058,10 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5045 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 5058 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ |
5046 | ssleep(2); | 5059 | ssleep(2); |
5047 | 5060 | ||
5061 | err = hdsp_check_for_iobox(hdsp); | ||
5062 | if (err < 0) | ||
5063 | return err; | ||
5064 | |||
5048 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 5065 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
5049 | #ifdef HDSP_FW_LOADER | 5066 | #ifdef HDSP_FW_LOADER |
5050 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) | 5067 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) |
@@ -5057,7 +5074,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5057 | /* init is complete, we return */ | 5074 | /* init is complete, we return */ |
5058 | return 0; | 5075 | return 0; |
5059 | #endif | 5076 | #endif |
5060 | /* no iobox connected, we defer initialization */ | 5077 | /* we defer initialization */ |
5061 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); | 5078 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); |
5062 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) | 5079 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5063 | return err; | 5080 | return err; |
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 20d0e328288a..8f9e3859c37c 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -666,6 +666,7 @@ static int snd_ps3_init_avsetting(struct snd_ps3_card_info *card) | |||
666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; | 666 | card->avs.avs_audio_width = PS3AV_CMD_AUDIO_WORD_BITS_16; |
667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; | 667 | card->avs.avs_audio_format = PS3AV_CMD_AUDIO_FORMAT_PCM; |
668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; | 668 | card->avs.avs_audio_source = PS3AV_CMD_AUDIO_SOURCE_SERIAL; |
669 | memcpy(card->avs.avs_cs_info, ps3av_mode_cs_info, 8); | ||
669 | 670 | ||
670 | ret = snd_ps3_change_avsetting(card); | 671 | ret = snd_ps3_change_avsetting(card); |
671 | 672 | ||
@@ -685,6 +686,7 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
685 | { | 686 | { |
686 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); | 687 | struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); |
687 | struct snd_ps3_avsetting_info avs; | 688 | struct snd_ps3_avsetting_info avs; |
689 | int ret; | ||
688 | 690 | ||
689 | avs = card->avs; | 691 | avs = card->avs; |
690 | 692 | ||
@@ -729,19 +731,92 @@ static int snd_ps3_set_avsetting(struct snd_pcm_substream *substream) | |||
729 | return 1; | 731 | return 1; |
730 | } | 732 | } |
731 | 733 | ||
732 | if ((card->avs.avs_audio_width != avs.avs_audio_width) || | 734 | memcpy(avs.avs_cs_info, ps3av_mode_cs_info, 8); |
733 | (card->avs.avs_audio_rate != avs.avs_audio_rate)) { | ||
734 | card->avs = avs; | ||
735 | snd_ps3_change_avsetting(card); | ||
736 | 735 | ||
736 | if (memcmp(&card->avs, &avs, sizeof(avs))) { | ||
737 | pr_debug("%s: after freq=%d width=%d\n", __func__, | 737 | pr_debug("%s: after freq=%d width=%d\n", __func__, |
738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); | 738 | card->avs.avs_audio_rate, card->avs.avs_audio_width); |
739 | 739 | ||
740 | return 0; | 740 | card->avs = avs; |
741 | snd_ps3_change_avsetting(card); | ||
742 | ret = 0; | ||
741 | } else | 743 | } else |
744 | ret = 1; | ||
745 | |||
746 | /* check CS non-audio bit and mute accordingly */ | ||
747 | if (avs.avs_cs_info[0] & 0x02) | ||
748 | ps3av_audio_mute_analog(1); /* mute if non-audio */ | ||
749 | else | ||
750 | ps3av_audio_mute_analog(0); | ||
751 | |||
752 | return ret; | ||
753 | } | ||
754 | |||
755 | /* | ||
756 | * SPDIF status bits controls | ||
757 | */ | ||
758 | static int snd_ps3_spdif_mask_info(struct snd_kcontrol *kcontrol, | ||
759 | struct snd_ctl_elem_info *uinfo) | ||
760 | { | ||
761 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | ||
762 | uinfo->count = 1; | ||
763 | return 0; | ||
764 | } | ||
765 | |||
766 | /* FIXME: ps3av_set_audio_mode() assumes only consumer mode */ | ||
767 | static int snd_ps3_spdif_cmask_get(struct snd_kcontrol *kcontrol, | ||
768 | struct snd_ctl_elem_value *ucontrol) | ||
769 | { | ||
770 | memset(ucontrol->value.iec958.status, 0xff, 8); | ||
771 | return 0; | ||
772 | } | ||
773 | |||
774 | static int snd_ps3_spdif_pmask_get(struct snd_kcontrol *kcontrol, | ||
775 | struct snd_ctl_elem_value *ucontrol) | ||
776 | { | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | static int snd_ps3_spdif_default_get(struct snd_kcontrol *kcontrol, | ||
781 | struct snd_ctl_elem_value *ucontrol) | ||
782 | { | ||
783 | memcpy(ucontrol->value.iec958.status, ps3av_mode_cs_info, 8); | ||
784 | return 0; | ||
785 | } | ||
786 | |||
787 | static int snd_ps3_spdif_default_put(struct snd_kcontrol *kcontrol, | ||
788 | struct snd_ctl_elem_value *ucontrol) | ||
789 | { | ||
790 | if (memcmp(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8)) { | ||
791 | memcpy(ps3av_mode_cs_info, ucontrol->value.iec958.status, 8); | ||
742 | return 1; | 792 | return 1; |
793 | } | ||
794 | return 0; | ||
743 | } | 795 | } |
744 | 796 | ||
797 | static struct snd_kcontrol_new spdif_ctls[] = { | ||
798 | { | ||
799 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
800 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
801 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), | ||
802 | .info = snd_ps3_spdif_mask_info, | ||
803 | .get = snd_ps3_spdif_cmask_get, | ||
804 | }, | ||
805 | { | ||
806 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | ||
807 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
808 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), | ||
809 | .info = snd_ps3_spdif_mask_info, | ||
810 | .get = snd_ps3_spdif_pmask_get, | ||
811 | }, | ||
812 | { | ||
813 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | ||
814 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | ||
815 | .info = snd_ps3_spdif_mask_info, | ||
816 | .get = snd_ps3_spdif_default_get, | ||
817 | .put = snd_ps3_spdif_default_put, | ||
818 | }, | ||
819 | }; | ||
745 | 820 | ||
746 | 821 | ||
747 | static int snd_ps3_map_mmio(void) | 822 | static int snd_ps3_map_mmio(void) |
@@ -842,7 +917,7 @@ static void snd_ps3_audio_set_base_addr(uint64_t ioaddr_start) | |||
842 | 917 | ||
843 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | 918 | static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) |
844 | { | 919 | { |
845 | int ret; | 920 | int i, ret; |
846 | u64 lpar_addr, lpar_size; | 921 | u64 lpar_addr, lpar_size; |
847 | 922 | ||
848 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); | 923 | BUG_ON(!firmware_has_feature(FW_FEATURE_PS3_LV1)); |
@@ -903,6 +978,15 @@ static int __init snd_ps3_driver_probe(struct ps3_system_bus_device *dev) | |||
903 | strcpy(the_card.card->driver, "PS3"); | 978 | strcpy(the_card.card->driver, "PS3"); |
904 | strcpy(the_card.card->shortname, "PS3"); | 979 | strcpy(the_card.card->shortname, "PS3"); |
905 | strcpy(the_card.card->longname, "PS3 sound"); | 980 | strcpy(the_card.card->longname, "PS3 sound"); |
981 | |||
982 | /* create control elements */ | ||
983 | for (i = 0; i < ARRAY_SIZE(spdif_ctls); i++) { | ||
984 | ret = snd_ctl_add(the_card.card, | ||
985 | snd_ctl_new1(&spdif_ctls[i], &the_card)); | ||
986 | if (ret < 0) | ||
987 | goto clean_card; | ||
988 | } | ||
989 | |||
906 | /* create PCM devices instance */ | 990 | /* create PCM devices instance */ |
907 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ | 991 | /* NOTE:this driver works assuming pcm:substream = 1:1 */ |
908 | ret = snd_pcm_new(the_card.card, | 992 | ret = snd_pcm_new(the_card.card, |
diff --git a/sound/ppc/snd_ps3.h b/sound/ppc/snd_ps3.h index 4b7e6fbbe500..326fb29e82d8 100644 --- a/sound/ppc/snd_ps3.h +++ b/sound/ppc/snd_ps3.h | |||
@@ -51,6 +51,7 @@ struct snd_ps3_avsetting_info { | |||
51 | uint32_t avs_audio_width; | 51 | uint32_t avs_audio_width; |
52 | uint32_t avs_audio_format; /* fixed */ | 52 | uint32_t avs_audio_format; /* fixed */ |
53 | uint32_t avs_audio_source; /* fixed */ | 53 | uint32_t avs_audio_source; /* fixed */ |
54 | unsigned char avs_cs_info[8]; | ||
54 | }; | 55 | }; |
55 | /* | 56 | /* |
56 | * PS3 audio 'card' instance | 57 | * PS3 audio 'card' instance |
diff --git a/sound/soc/at32/playpaq_wm8510.c b/sound/soc/at32/playpaq_wm8510.c index 98a2d5826a85..b1966e4dfcd3 100644 --- a/sound/soc/at32/playpaq_wm8510.c +++ b/sound/soc/at32/playpaq_wm8510.c | |||
@@ -304,7 +304,7 @@ static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = { | |||
304 | 304 | ||
305 | 305 | ||
306 | 306 | ||
307 | static const char *intercon[][3] = { | 307 | static const struct snd_soc_dapm_route intercon[] = { |
308 | /* speaker connected to SPKOUT */ | 308 | /* speaker connected to SPKOUT */ |
309 | {"Ext Spk", NULL, "SPKOUTP"}, | 309 | {"Ext Spk", NULL, "SPKOUTP"}, |
310 | {"Ext Spk", NULL, "SPKOUTN"}, | 310 | {"Ext Spk", NULL, "SPKOUTN"}, |
@@ -312,9 +312,6 @@ static const char *intercon[][3] = { | |||
312 | {"Mic Bias", NULL, "Int Mic"}, | 312 | {"Mic Bias", NULL, "Int Mic"}, |
313 | {"MICN", NULL, "Mic Bias"}, | 313 | {"MICN", NULL, "Mic Bias"}, |
314 | {"MICP", NULL, "Mic Bias"}, | 314 | {"MICP", NULL, "Mic Bias"}, |
315 | |||
316 | /* Terminator */ | ||
317 | {NULL, NULL, NULL}, | ||
318 | }; | 315 | }; |
319 | 316 | ||
320 | 317 | ||
@@ -334,11 +331,8 @@ static int playpaq_wm8510_init(struct snd_soc_codec *codec) | |||
334 | /* | 331 | /* |
335 | * Setup audio path interconnects | 332 | * Setup audio path interconnects |
336 | */ | 333 | */ |
337 | for (i = 0; intercon[i][0] != NULL; i++) { | 334 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); |
338 | snd_soc_dapm_connect_input(codec, | 335 | |
339 | intercon[i][0], | ||
340 | intercon[i][1], intercon[i][2]); | ||
341 | } | ||
342 | 336 | ||
343 | 337 | ||
344 | /* always connected pins */ | 338 | /* always connected pins */ |
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 827587f08180..e020c160ee44 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c | |||
@@ -70,12 +70,24 @@ static struct sport_param sport_params[2] = { | |||
70 | } | 70 | } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static u16 sport_req[][7] = { | 73 | /* |
74 | { P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | 74 | * Setting the TFS pin selector for SPORT 0 based on whether the selected |
75 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0}, | 75 | * port id F or G. If the port is F then no conflict should exist for the |
76 | { P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, | 76 | * TFS. When Port G is selected and EMAC then there is a conflict between |
77 | P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0}, | 77 | * the PHY interrupt line and TFS. Current settings prevent the conflict |
78 | }; | 78 | * by ignoring the TFS pin when Port G is selected. This allows both |
79 | * ssm2602 using Port G and EMAC concurrently. | ||
80 | */ | ||
81 | #ifdef CONFIG_BF527_SPORT0_PORTF | ||
82 | #define LOCAL_SPORT0_TFS (P_SPORT0_TFS) | ||
83 | #else | ||
84 | #define LOCAL_SPORT0_TFS (0) | ||
85 | #endif | ||
86 | |||
87 | static u16 sport_req[][7] = { {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, | ||
88 | P_SPORT0_DRPRI, P_SPORT0_RSCLK, LOCAL_SPORT0_TFS, 0}, | ||
89 | {P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS, P_SPORT1_DRPRI, | ||
90 | P_SPORT1_RSCLK, P_SPORT1_TFS, 0} }; | ||
79 | 91 | ||
80 | static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | 92 | static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, |
81 | unsigned int fmt) | 93 | unsigned int fmt) |
@@ -98,23 +110,21 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
98 | ret = -EINVAL; | 110 | ret = -EINVAL; |
99 | break; | 111 | break; |
100 | default: | 112 | default: |
113 | printk(KERN_ERR "%s: Unknown DAI format type\n", __func__); | ||
101 | ret = -EINVAL; | 114 | ret = -EINVAL; |
102 | break; | 115 | break; |
103 | } | 116 | } |
104 | 117 | ||
105 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 118 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
106 | case SND_SOC_DAIFMT_CBS_CFS: | ||
107 | ret = -EINVAL; | ||
108 | break; | ||
109 | case SND_SOC_DAIFMT_CBM_CFS: | ||
110 | ret = -EINVAL; | ||
111 | break; | ||
112 | case SND_SOC_DAIFMT_CBM_CFM: | 119 | case SND_SOC_DAIFMT_CBM_CFM: |
113 | break; | 120 | break; |
121 | case SND_SOC_DAIFMT_CBS_CFS: | ||
122 | case SND_SOC_DAIFMT_CBM_CFS: | ||
114 | case SND_SOC_DAIFMT_CBS_CFM: | 123 | case SND_SOC_DAIFMT_CBS_CFM: |
115 | ret = -EINVAL; | 124 | ret = -EINVAL; |
116 | break; | 125 | break; |
117 | default: | 126 | default: |
127 | printk(KERN_ERR "%s: Unknown DAI master type\n", __func__); | ||
118 | ret = -EINVAL; | 128 | ret = -EINVAL; |
119 | break; | 129 | break; |
120 | } | 130 | } |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 05336ed7e493..cff276ee261e 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -863,17 +863,21 @@ static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
863 | return -EINVAL; | 863 | return -EINVAL; |
864 | } | 864 | } |
865 | 865 | ||
866 | /* interface format */ | 866 | /* |
867 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 867 | * match both interface format and signal polarities since they |
868 | case SND_SOC_DAIFMT_I2S: | 868 | * are fixed |
869 | */ | ||
870 | switch (fmt & (SND_SOC_DAIFMT_FORMAT_MASK | | ||
871 | SND_SOC_DAIFMT_INV_MASK)) { | ||
872 | case (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF): | ||
869 | break; | 873 | break; |
870 | case SND_SOC_DAIFMT_DSP_A: | 874 | case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF): |
871 | iface_breg |= (0x01 << 6); | 875 | iface_breg |= (0x01 << 6); |
872 | break; | 876 | break; |
873 | case SND_SOC_DAIFMT_RIGHT_J: | 877 | case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF): |
874 | iface_breg |= (0x02 << 6); | 878 | iface_breg |= (0x02 << 6); |
875 | break; | 879 | break; |
876 | case SND_SOC_DAIFMT_LEFT_J: | 880 | case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF): |
877 | iface_breg |= (0x03 << 6); | 881 | iface_breg |= (0x03 << 6); |
878 | break; | 882 | break; |
879 | default: | 883 | default: |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index aba402b3c999..945b32ed9884 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -140,7 +140,7 @@ SOC_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0), | |||
140 | 140 | ||
141 | SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), | 141 | SOC_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0), |
142 | SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), | 142 | SOC_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0), |
143 | SOC_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0), | 143 | SOC_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0), |
144 | SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), | 144 | SOC_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0), |
145 | SOC_ENUM("ALC Function", wm9713_enum[6]), | 145 | SOC_ENUM("ALC Function", wm9713_enum[6]), |
146 | SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), | 146 | SOC_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0), |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 86923299bc10..94a02eaa4825 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
@@ -277,7 +277,7 @@ static int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd) | |||
277 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; | 277 | struct mpc52xx_psc __iomem *regs = psc_i2s->psc_regs; |
278 | u16 imr; | 278 | u16 imr; |
279 | u8 psc_cmd; | 279 | u8 psc_cmd; |
280 | long flags; | 280 | unsigned long flags; |
281 | 281 | ||
282 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 282 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) |
283 | s = &psc_i2s->capture; | 283 | s = &psc_i2s->capture; |
@@ -699,9 +699,11 @@ static ssize_t psc_i2s_stat_store(struct device *dev, | |||
699 | return count; | 699 | return count; |
700 | } | 700 | } |
701 | 701 | ||
702 | DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL); | 702 | static DEVICE_ATTR(status, 0644, psc_i2s_status_show, NULL); |
703 | DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); | 703 | static DEVICE_ATTR(playback_underrun, 0644, psc_i2s_stat_show, |
704 | DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, psc_i2s_stat_store); | 704 | psc_i2s_stat_store); |
705 | static DEVICE_ATTR(capture_overrun, 0644, psc_i2s_stat_show, | ||
706 | psc_i2s_stat_store); | ||
705 | 707 | ||
706 | /* --------------------------------------------------------------------- | 708 | /* --------------------------------------------------------------------- |
707 | * OF platform bus binding code: | 709 | * OF platform bus binding code: |
@@ -819,8 +821,8 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
819 | 821 | ||
820 | /* Register the SYSFS files */ | 822 | /* Register the SYSFS files */ |
821 | rc = device_create_file(psc_i2s->dev, &dev_attr_status); | 823 | rc = device_create_file(psc_i2s->dev, &dev_attr_status); |
822 | rc = device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); | 824 | rc |= device_create_file(psc_i2s->dev, &dev_attr_capture_overrun); |
823 | rc = device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); | 825 | rc |= device_create_file(psc_i2s->dev, &dev_attr_playback_underrun); |
824 | if (rc) | 826 | if (rc) |
825 | dev_info(psc_i2s->dev, "error creating sysfs files\n"); | 827 | dev_info(psc_i2s->dev, "error creating sysfs files\n"); |
826 | 828 | ||
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 0a063a98a661..8485a8a9d0ff 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | struct omap_mcbsp_data { | 43 | struct omap_mcbsp_data { |
44 | unsigned int bus_id; | 44 | unsigned int bus_id; |
45 | struct omap_mcbsp_reg_cfg regs; | 45 | struct omap_mcbsp_reg_cfg regs; |
46 | unsigned int fmt; | ||
46 | /* | 47 | /* |
47 | * Flags indicating is the bus already activated and configured by | 48 | * Flags indicating is the bus already activated and configured by |
48 | * another substream | 49 | * another substream |
@@ -200,6 +201,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
200 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 201 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
201 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 202 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
202 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; | 203 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; |
204 | int wlen; | ||
203 | unsigned long port; | 205 | unsigned long port; |
204 | 206 | ||
205 | if (cpu_class_is_omap1()) { | 207 | if (cpu_class_is_omap1()) { |
@@ -244,19 +246,29 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
244 | switch (params_format(params)) { | 246 | switch (params_format(params)) { |
245 | case SNDRV_PCM_FORMAT_S16_LE: | 247 | case SNDRV_PCM_FORMAT_S16_LE: |
246 | /* Set word lengths */ | 248 | /* Set word lengths */ |
249 | wlen = 16; | ||
247 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); | 250 | regs->rcr2 |= RWDLEN2(OMAP_MCBSP_WORD_16); |
248 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); | 251 | regs->rcr1 |= RWDLEN1(OMAP_MCBSP_WORD_16); |
249 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); | 252 | regs->xcr2 |= XWDLEN2(OMAP_MCBSP_WORD_16); |
250 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); | 253 | regs->xcr1 |= XWDLEN1(OMAP_MCBSP_WORD_16); |
251 | /* Set FS period and length in terms of bit clock periods */ | ||
252 | regs->srgr2 |= FPER(16 * 2 - 1); | ||
253 | regs->srgr1 |= FWID(16 - 1); | ||
254 | break; | 254 | break; |
255 | default: | 255 | default: |
256 | /* Unsupported PCM format */ | 256 | /* Unsupported PCM format */ |
257 | return -EINVAL; | 257 | return -EINVAL; |
258 | } | 258 | } |
259 | 259 | ||
260 | /* Set FS period and length in terms of bit clock periods */ | ||
261 | switch (mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | ||
262 | case SND_SOC_DAIFMT_I2S: | ||
263 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
264 | regs->srgr1 |= FWID(wlen - 1); | ||
265 | break; | ||
266 | case SND_SOC_DAIFMT_DSP_A: | ||
267 | regs->srgr2 |= FPER(wlen * 2 - 1); | ||
268 | regs->srgr1 |= FWID(wlen * 2 - 2); | ||
269 | break; | ||
270 | } | ||
271 | |||
260 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); | 272 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); |
261 | mcbsp_data->configured = 1; | 273 | mcbsp_data->configured = 1; |
262 | 274 | ||
@@ -276,6 +288,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
276 | if (mcbsp_data->configured) | 288 | if (mcbsp_data->configured) |
277 | return 0; | 289 | return 0; |
278 | 290 | ||
291 | mcbsp_data->fmt = fmt; | ||
279 | memset(regs, 0, sizeof(*regs)); | 292 | memset(regs, 0, sizeof(*regs)); |
280 | /* Generic McBSP register settings */ | 293 | /* Generic McBSP register settings */ |
281 | regs->spcr2 |= XINTM(3) | FREE; | 294 | regs->spcr2 |= XINTM(3) | FREE; |
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index dd7fa0b329c7..2718eaf7895f 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c | |||
@@ -18,13 +18,13 @@ | |||
18 | #include <linux/timer.h> | 18 | #include <linux/timer.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/gpio.h> | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 23 | #include <sound/pcm.h> |
23 | #include <sound/soc.h> | 24 | #include <sound/soc.h> |
24 | #include <sound/soc-dapm.h> | 25 | #include <sound/soc-dapm.h> |
25 | 26 | ||
26 | #include <asm/mach-types.h> | 27 | #include <asm/mach-types.h> |
27 | #include <asm/hardware/scoop.h> | ||
28 | #include <mach/pxa-regs.h> | 28 | #include <mach/pxa-regs.h> |
29 | #include <mach/hardware.h> | 29 | #include <mach/hardware.h> |
30 | #include <mach/corgi.h> | 30 | #include <mach/corgi.h> |
@@ -54,8 +54,8 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
54 | switch (corgi_jack_func) { | 54 | switch (corgi_jack_func) { |
55 | case CORGI_HP: | 55 | case CORGI_HP: |
56 | /* set = unmute headphone */ | 56 | /* set = unmute headphone */ |
57 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 57 | gpio_set_value(CORGI_GPIO_MUTE_L, 1); |
58 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 58 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
59 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 59 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
60 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 60 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
61 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 61 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
@@ -63,24 +63,24 @@ static void corgi_ext_control(struct snd_soc_codec *codec) | |||
63 | break; | 63 | break; |
64 | case CORGI_MIC: | 64 | case CORGI_MIC: |
65 | /* reset = mute headphone */ | 65 | /* reset = mute headphone */ |
66 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 66 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
67 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 67 | gpio_set_value(CORGI_GPIO_MUTE_R, 0); |
68 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 68 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
69 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 69 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
70 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 70 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
72 | break; | 72 | break; |
73 | case CORGI_LINE: | 73 | case CORGI_LINE: |
74 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 74 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
75 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 75 | gpio_set_value(CORGI_GPIO_MUTE_R, 0); |
76 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 76 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
77 | snd_soc_dapm_enable_pin(codec, "Line Jack"); | 77 | snd_soc_dapm_enable_pin(codec, "Line Jack"); |
78 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 78 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
79 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 79 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
80 | break; | 80 | break; |
81 | case CORGI_HEADSET: | 81 | case CORGI_HEADSET: |
82 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 82 | gpio_set_value(CORGI_GPIO_MUTE_L, 0); |
83 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 83 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
84 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 84 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
85 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 85 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
86 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); | 86 | snd_soc_dapm_disable_pin(codec, "Headphone Jack"); |
@@ -114,8 +114,8 @@ static int corgi_shutdown(struct snd_pcm_substream *substream) | |||
114 | struct snd_soc_codec *codec = rtd->socdev->codec; | 114 | struct snd_soc_codec *codec = rtd->socdev->codec; |
115 | 115 | ||
116 | /* set = unmute headphone */ | 116 | /* set = unmute headphone */ |
117 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_L); | 117 | gpio_set_value(CORGI_GPIO_MUTE_L, 1); |
118 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MUTE_R); | 118 | gpio_set_value(CORGI_GPIO_MUTE_R, 1); |
119 | return 0; | 119 | return 0; |
120 | } | 120 | } |
121 | 121 | ||
@@ -218,22 +218,14 @@ static int corgi_set_spk(struct snd_kcontrol *kcontrol, | |||
218 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, | 218 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, |
219 | struct snd_kcontrol *k, int event) | 219 | struct snd_kcontrol *k, int event) |
220 | { | 220 | { |
221 | if (SND_SOC_DAPM_EVENT_ON(event)) | 221 | gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event)); |
222 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
223 | else | ||
224 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
225 | |||
226 | return 0; | 222 | return 0; |
227 | } | 223 | } |
228 | 224 | ||
229 | static int corgi_mic_event(struct snd_soc_dapm_widget *w, | 225 | static int corgi_mic_event(struct snd_soc_dapm_widget *w, |
230 | struct snd_kcontrol *k, int event) | 226 | struct snd_kcontrol *k, int event) |
231 | { | 227 | { |
232 | if (SND_SOC_DAPM_EVENT_ON(event)) | 228 | gpio_set_value(CORGI_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); |
233 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); | ||
234 | else | ||
235 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_MIC_BIAS); | ||
236 | |||
237 | return 0; | 229 | return 0; |
238 | } | 230 | } |
239 | 231 | ||
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index a80ae074b090..a7a3a9c5c6ff 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c | |||
@@ -49,7 +49,7 @@ struct snd_ac97_bus_ops soc_ac97_ops = { | |||
49 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | 49 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { |
50 | .name = "AC97 PCM Stereo out", | 50 | .name = "AC97 PCM Stereo out", |
51 | .dev_addr = __PREG(PCDR), | 51 | .dev_addr = __PREG(PCDR), |
52 | .drcmr = &DRCMRTXPCDR, | 52 | .drcmr = &DRCMR(12), |
53 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 53 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
54 | DCMD_BURST32 | DCMD_WIDTH4, | 54 | DCMD_BURST32 | DCMD_WIDTH4, |
55 | }; | 55 | }; |
@@ -57,7 +57,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { | |||
57 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { | 57 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { |
58 | .name = "AC97 PCM Stereo in", | 58 | .name = "AC97 PCM Stereo in", |
59 | .dev_addr = __PREG(PCDR), | 59 | .dev_addr = __PREG(PCDR), |
60 | .drcmr = &DRCMRRXPCDR, | 60 | .drcmr = &DRCMR(11), |
61 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 61 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
62 | DCMD_BURST32 | DCMD_WIDTH4, | 62 | DCMD_BURST32 | DCMD_WIDTH4, |
63 | }; | 63 | }; |
@@ -65,7 +65,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { | |||
65 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { | 65 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { |
66 | .name = "AC97 Aux PCM (Slot 5) Mono out", | 66 | .name = "AC97 Aux PCM (Slot 5) Mono out", |
67 | .dev_addr = __PREG(MODR), | 67 | .dev_addr = __PREG(MODR), |
68 | .drcmr = &DRCMRTXMODR, | 68 | .drcmr = &DRCMR(10), |
69 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 69 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
70 | DCMD_BURST16 | DCMD_WIDTH2, | 70 | DCMD_BURST16 | DCMD_WIDTH2, |
71 | }; | 71 | }; |
@@ -73,7 +73,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { | |||
73 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { | 73 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { |
74 | .name = "AC97 Aux PCM (Slot 5) Mono in", | 74 | .name = "AC97 Aux PCM (Slot 5) Mono in", |
75 | .dev_addr = __PREG(MODR), | 75 | .dev_addr = __PREG(MODR), |
76 | .drcmr = &DRCMRRXMODR, | 76 | .drcmr = &DRCMR(9), |
77 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 77 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
78 | DCMD_BURST16 | DCMD_WIDTH2, | 78 | DCMD_BURST16 | DCMD_WIDTH2, |
79 | }; | 79 | }; |
@@ -81,7 +81,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_in = { | |||
81 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { | 81 | static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_mic_mono_in = { |
82 | .name = "AC97 Mic PCM (Slot 6) Mono in", | 82 | .name = "AC97 Mic PCM (Slot 6) Mono in", |
83 | .dev_addr = __PREG(MCDR), | 83 | .dev_addr = __PREG(MCDR), |
84 | .drcmr = &DRCMRRXMCDR, | 84 | .drcmr = &DRCMR(8), |
85 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 85 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
86 | DCMD_BURST16 | DCMD_WIDTH2, | 86 | DCMD_BURST16 | DCMD_WIDTH2, |
87 | }; | 87 | }; |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 64057b1d220d..e758034db5c3 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -39,6 +39,45 @@ struct pxa2xx_gpio { | |||
39 | u32 frm; | 39 | u32 frm; |
40 | }; | 40 | }; |
41 | 41 | ||
42 | /* | ||
43 | * I2S Controller Register and Bit Definitions | ||
44 | */ | ||
45 | #define SACR0 __REG(0x40400000) /* Global Control Register */ | ||
46 | #define SACR1 __REG(0x40400004) /* Serial Audio I 2 S/MSB-Justified Control Register */ | ||
47 | #define SASR0 __REG(0x4040000C) /* Serial Audio I 2 S/MSB-Justified Interface and FIFO Status Register */ | ||
48 | #define SAIMR __REG(0x40400014) /* Serial Audio Interrupt Mask Register */ | ||
49 | #define SAICR __REG(0x40400018) /* Serial Audio Interrupt Clear Register */ | ||
50 | #define SADIV __REG(0x40400060) /* Audio Clock Divider Register. */ | ||
51 | #define SADR __REG(0x40400080) /* Serial Audio Data Register (TX and RX FIFO access Register). */ | ||
52 | |||
53 | #define SACR0_RFTH(x) ((x) << 12) /* Rx FIFO Interrupt or DMA Trigger Threshold */ | ||
54 | #define SACR0_TFTH(x) ((x) << 8) /* Tx FIFO Interrupt or DMA Trigger Threshold */ | ||
55 | #define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */ | ||
56 | #define SACR0_EFWR (1 << 4) /* Enable EFWR Function */ | ||
57 | #define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */ | ||
58 | #define SACR0_BCKD (1 << 2) /* Bit Clock Direction */ | ||
59 | #define SACR0_ENB (1 << 0) /* Enable I2S Link */ | ||
60 | #define SACR1_ENLBF (1 << 5) /* Enable Loopback */ | ||
61 | #define SACR1_DRPL (1 << 4) /* Disable Replaying Function */ | ||
62 | #define SACR1_DREC (1 << 3) /* Disable Recording Function */ | ||
63 | #define SACR1_AMSL (1 << 0) /* Specify Alternate Mode */ | ||
64 | |||
65 | #define SASR0_I2SOFF (1 << 7) /* Controller Status */ | ||
66 | #define SASR0_ROR (1 << 6) /* Rx FIFO Overrun */ | ||
67 | #define SASR0_TUR (1 << 5) /* Tx FIFO Underrun */ | ||
68 | #define SASR0_RFS (1 << 4) /* Rx FIFO Service Request */ | ||
69 | #define SASR0_TFS (1 << 3) /* Tx FIFO Service Request */ | ||
70 | #define SASR0_BSY (1 << 2) /* I2S Busy */ | ||
71 | #define SASR0_RNE (1 << 1) /* Rx FIFO Not Empty */ | ||
72 | #define SASR0_TNF (1 << 0) /* Tx FIFO Not Empty */ | ||
73 | |||
74 | #define SAICR_ROR (1 << 6) /* Clear Rx FIFO Overrun Interrupt */ | ||
75 | #define SAICR_TUR (1 << 5) /* Clear Tx FIFO Underrun Interrupt */ | ||
76 | |||
77 | #define SAIMR_ROR (1 << 6) /* Enable Rx FIFO Overrun Condition Interrupt */ | ||
78 | #define SAIMR_TUR (1 << 5) /* Enable Tx FIFO Underrun Condition Interrupt */ | ||
79 | #define SAIMR_RFS (1 << 4) /* Enable Rx FIFO Service Interrupt */ | ||
80 | #define SAIMR_TFS (1 << 3) /* Enable Tx FIFO Service Interrupt */ | ||
42 | 81 | ||
43 | struct pxa_i2s_port { | 82 | struct pxa_i2s_port { |
44 | u32 sadiv; | 83 | u32 sadiv; |
@@ -54,7 +93,7 @@ static struct clk *clk_i2s; | |||
54 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | 93 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { |
55 | .name = "I2S PCM Stereo out", | 94 | .name = "I2S PCM Stereo out", |
56 | .dev_addr = __PREG(SADR), | 95 | .dev_addr = __PREG(SADR), |
57 | .drcmr = &DRCMRTXSADR, | 96 | .drcmr = &DRCMR(3), |
58 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | | 97 | .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | |
59 | DCMD_BURST32 | DCMD_WIDTH4, | 98 | DCMD_BURST32 | DCMD_WIDTH4, |
60 | }; | 99 | }; |
@@ -62,7 +101,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { | |||
62 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { | 101 | static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_in = { |
63 | .name = "I2S PCM Stereo in", | 102 | .name = "I2S PCM Stereo in", |
64 | .dev_addr = __PREG(SADR), | 103 | .dev_addr = __PREG(SADR), |
65 | .drcmr = &DRCMRRXSADR, | 104 | .drcmr = &DRCMR(2), |
66 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | | 105 | .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | |
67 | DCMD_BURST32 | DCMD_WIDTH4, | 106 | DCMD_BURST32 | DCMD_WIDTH4, |
68 | }; | 107 | }; |
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 8f89188e541e..d307b6757e95 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -19,16 +19,15 @@ | |||
19 | #include <linux/timer.h> | 19 | #include <linux/timer.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/gpio.h> | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
24 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
25 | #include <sound/soc-dapm.h> | 26 | #include <sound/soc-dapm.h> |
26 | 27 | ||
27 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
28 | #include <asm/hardware/scoop.h> | ||
29 | #include <mach/pxa-regs.h> | 29 | #include <mach/pxa-regs.h> |
30 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
31 | #include <mach/akita.h> | ||
32 | #include <mach/spitz.h> | 31 | #include <mach/spitz.h> |
33 | #include "../codecs/wm8750.h" | 32 | #include "../codecs/wm8750.h" |
34 | #include "pxa2xx-pcm.h" | 33 | #include "pxa2xx-pcm.h" |
@@ -63,8 +62,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
63 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 62 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
64 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 63 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
65 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | 64 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); |
66 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 65 | gpio_set_value(SPITZ_GPIO_MUTE_L, 1); |
67 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 66 | gpio_set_value(SPITZ_GPIO_MUTE_R, 1); |
68 | break; | 67 | break; |
69 | case SPITZ_MIC: | 68 | case SPITZ_MIC: |
70 | /* enable mic jack and bias, mute hp */ | 69 | /* enable mic jack and bias, mute hp */ |
@@ -72,8 +71,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
72 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 71 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
73 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 72 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
74 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 73 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
75 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 74 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
76 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 75 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
77 | break; | 76 | break; |
78 | case SPITZ_LINE: | 77 | case SPITZ_LINE: |
79 | /* enable line jack, disable mic bias and mute hp */ | 78 | /* enable line jack, disable mic bias and mute hp */ |
@@ -81,8 +80,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
81 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 80 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
82 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 81 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
83 | snd_soc_dapm_enable_pin(codec, "Line Jack"); | 82 | snd_soc_dapm_enable_pin(codec, "Line Jack"); |
84 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 83 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
85 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 84 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
86 | break; | 85 | break; |
87 | case SPITZ_HEADSET: | 86 | case SPITZ_HEADSET: |
88 | /* enable and unmute headset jack enable mic bias, mute L hp */ | 87 | /* enable and unmute headset jack enable mic bias, mute L hp */ |
@@ -90,8 +89,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
90 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | 89 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); |
91 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 90 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
92 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); | 91 | snd_soc_dapm_enable_pin(codec, "Headset Jack"); |
93 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 92 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
94 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 93 | gpio_set_value(SPITZ_GPIO_MUTE_R, 1); |
95 | break; | 94 | break; |
96 | case SPITZ_HP_OFF: | 95 | case SPITZ_HP_OFF: |
97 | 96 | ||
@@ -100,8 +99,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec) | |||
100 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); | 99 | snd_soc_dapm_disable_pin(codec, "Headset Jack"); |
101 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); | 100 | snd_soc_dapm_disable_pin(codec, "Mic Jack"); |
102 | snd_soc_dapm_disable_pin(codec, "Line Jack"); | 101 | snd_soc_dapm_disable_pin(codec, "Line Jack"); |
103 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); | 102 | gpio_set_value(SPITZ_GPIO_MUTE_L, 0); |
104 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); | 103 | gpio_set_value(SPITZ_GPIO_MUTE_R, 0); |
105 | break; | 104 | break; |
106 | } | 105 | } |
107 | snd_soc_dapm_sync(codec); | 106 | snd_soc_dapm_sync(codec); |
@@ -215,23 +214,14 @@ static int spitz_set_spk(struct snd_kcontrol *kcontrol, | |||
215 | static int spitz_mic_bias(struct snd_soc_dapm_widget *w, | 214 | static int spitz_mic_bias(struct snd_soc_dapm_widget *w, |
216 | struct snd_kcontrol *k, int event) | 215 | struct snd_kcontrol *k, int event) |
217 | { | 216 | { |
218 | if (machine_is_borzoi() || machine_is_spitz()) { | 217 | if (machine_is_borzoi() || machine_is_spitz()) |
219 | if (SND_SOC_DAPM_EVENT_ON(event)) | 218 | gpio_set_value(SPITZ_GPIO_MIC_BIAS, |
220 | set_scoop_gpio(&spitzscoop2_device.dev, | 219 | SND_SOC_DAPM_EVENT_ON(event)); |
221 | SPITZ_SCP2_MIC_BIAS); | 220 | |
222 | else | 221 | if (machine_is_akita()) |
223 | reset_scoop_gpio(&spitzscoop2_device.dev, | 222 | gpio_set_value(AKITA_GPIO_MIC_BIAS, |
224 | SPITZ_SCP2_MIC_BIAS); | 223 | SND_SOC_DAPM_EVENT_ON(event)); |
225 | } | ||
226 | 224 | ||
227 | if (machine_is_akita()) { | ||
228 | if (SND_SOC_DAPM_EVENT_ON(event)) | ||
229 | akita_set_ioexp(&akitaioexp_device.dev, | ||
230 | AKITA_IOEXP_MIC_BIAS); | ||
231 | else | ||
232 | akita_reset_ioexp(&akitaioexp_device.dev, | ||
233 | AKITA_IOEXP_MIC_BIAS); | ||
234 | } | ||
235 | return 0; | 225 | return 0; |
236 | } | 226 | } |
237 | 227 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 0af3bbde5bbe..16c7453f4946 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1462,7 +1462,7 @@ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, | |||
1462 | struct soc_mixer_control *mc = | 1462 | struct soc_mixer_control *mc = |
1463 | (struct soc_mixer_control *)kcontrol->private_value; | 1463 | (struct soc_mixer_control *)kcontrol->private_value; |
1464 | int max = mc->max; | 1464 | int max = mc->max; |
1465 | unsigned int shift = mc->min; | 1465 | unsigned int shift = mc->shift; |
1466 | unsigned int rshift = mc->rshift; | 1466 | unsigned int rshift = mc->rshift; |
1467 | 1467 | ||
1468 | if (max == 1) | 1468 | if (max == 1) |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index efbd0b37810a..7351db9606e4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -831,7 +831,7 @@ int snd_soc_dapm_sys_add(struct device *dev) | |||
831 | return ret; | 831 | return ret; |
832 | 832 | ||
833 | asoc_debugfs = debugfs_create_dir("asoc", NULL); | 833 | asoc_debugfs = debugfs_create_dir("asoc", NULL); |
834 | if (!IS_ERR(asoc_debugfs)) | 834 | if (!IS_ERR(asoc_debugfs) && asoc_debugfs) |
835 | debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs, | 835 | debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs, |
836 | &pop_time); | 836 | &pop_time); |
837 | else | 837 | else |
diff --git a/sound/sound_core.c b/sound/sound_core.c index ee66d43f848c..a75b289a5d78 100644 --- a/sound/sound_core.c +++ b/sound/sound_core.c | |||
@@ -220,9 +220,8 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati | |||
220 | else | 220 | else |
221 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); | 221 | sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); |
222 | 222 | ||
223 | device_create_drvdata(sound_class, dev, | 223 | device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor), |
224 | MKDEV(SOUND_MAJOR, s->unit_minor), | 224 | NULL, s->name+6); |
225 | NULL, s->name+6); | ||
226 | return r; | 225 | return r; |
227 | 226 | ||
228 | fail: | 227 | fail: |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index 49acee0c4840..f87933e48812 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for AMD7930 sound chips found on Sparcs. | 2 | * Driver for AMD7930 sound chips found on Sparcs. |
3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> | 3 | * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net> |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/amd7930.c which is: | 5 | * Based entirely upon drivers/sbus/audio/amd7930.c which is: |
6 | * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu) | 6 | * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu) |
@@ -35,6 +35,8 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/moduleparam.h> | 37 | #include <linux/moduleparam.h> |
38 | #include <linux/of.h> | ||
39 | #include <linux/of_device.h> | ||
38 | 40 | ||
39 | #include <sound/core.h> | 41 | #include <sound/core.h> |
40 | #include <sound/pcm.h> | 42 | #include <sound/pcm.h> |
@@ -44,7 +46,6 @@ | |||
44 | 46 | ||
45 | #include <asm/io.h> | 47 | #include <asm/io.h> |
46 | #include <asm/irq.h> | 48 | #include <asm/irq.h> |
47 | #include <asm/sbus.h> | ||
48 | #include <asm/prom.h> | 49 | #include <asm/prom.h> |
49 | 50 | ||
50 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 51 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
@@ -335,8 +336,8 @@ struct snd_amd7930 { | |||
335 | int pgain; | 336 | int pgain; |
336 | int mgain; | 337 | int mgain; |
337 | 338 | ||
339 | struct of_device *op; | ||
338 | unsigned int irq; | 340 | unsigned int irq; |
339 | unsigned int regs_size; | ||
340 | struct snd_amd7930 *next; | 341 | struct snd_amd7930 *next; |
341 | }; | 342 | }; |
342 | 343 | ||
@@ -905,13 +906,16 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd) | |||
905 | 906 | ||
906 | static int snd_amd7930_free(struct snd_amd7930 *amd) | 907 | static int snd_amd7930_free(struct snd_amd7930 *amd) |
907 | { | 908 | { |
909 | struct of_device *op = amd->op; | ||
910 | |||
908 | amd7930_idle(amd); | 911 | amd7930_idle(amd); |
909 | 912 | ||
910 | if (amd->irq) | 913 | if (amd->irq) |
911 | free_irq(amd->irq, amd); | 914 | free_irq(amd->irq, amd); |
912 | 915 | ||
913 | if (amd->regs) | 916 | if (amd->regs) |
914 | sbus_iounmap(amd->regs, amd->regs_size); | 917 | of_iounmap(&op->resource[0], amd->regs, |
918 | resource_size(&op->resource[0])); | ||
915 | 919 | ||
916 | kfree(amd); | 920 | kfree(amd); |
917 | 921 | ||
@@ -930,13 +934,12 @@ static struct snd_device_ops snd_amd7930_dev_ops = { | |||
930 | }; | 934 | }; |
931 | 935 | ||
932 | static int __devinit snd_amd7930_create(struct snd_card *card, | 936 | static int __devinit snd_amd7930_create(struct snd_card *card, |
933 | struct resource *rp, | 937 | struct of_device *op, |
934 | unsigned int reg_size, | ||
935 | int irq, int dev, | 938 | int irq, int dev, |
936 | struct snd_amd7930 **ramd) | 939 | struct snd_amd7930 **ramd) |
937 | { | 940 | { |
938 | unsigned long flags; | ||
939 | struct snd_amd7930 *amd; | 941 | struct snd_amd7930 *amd; |
942 | unsigned long flags; | ||
940 | int err; | 943 | int err; |
941 | 944 | ||
942 | *ramd = NULL; | 945 | *ramd = NULL; |
@@ -946,9 +949,10 @@ static int __devinit snd_amd7930_create(struct snd_card *card, | |||
946 | 949 | ||
947 | spin_lock_init(&amd->lock); | 950 | spin_lock_init(&amd->lock); |
948 | amd->card = card; | 951 | amd->card = card; |
949 | amd->regs_size = reg_size; | 952 | amd->op = op; |
950 | 953 | ||
951 | amd->regs = sbus_ioremap(rp, 0, amd->regs_size, "amd7930"); | 954 | amd->regs = of_ioremap(&op->resource[0], 0, |
955 | resource_size(&op->resource[0]), "amd7930"); | ||
952 | if (!amd->regs) { | 956 | if (!amd->regs) { |
953 | snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); | 957 | snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); |
954 | return -EIO; | 958 | return -EIO; |
@@ -997,12 +1001,15 @@ static int __devinit snd_amd7930_create(struct snd_card *card, | |||
997 | return 0; | 1001 | return 0; |
998 | } | 1002 | } |
999 | 1003 | ||
1000 | static int __devinit amd7930_attach_common(struct resource *rp, int irq) | 1004 | static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_device_id *match) |
1001 | { | 1005 | { |
1006 | struct resource *rp = &op->resource[0]; | ||
1002 | static int dev_num; | 1007 | static int dev_num; |
1003 | struct snd_card *card; | 1008 | struct snd_card *card; |
1004 | struct snd_amd7930 *amd; | 1009 | struct snd_amd7930 *amd; |
1005 | int err; | 1010 | int err, irq; |
1011 | |||
1012 | irq = op->irqs[0]; | ||
1006 | 1013 | ||
1007 | if (dev_num >= SNDRV_CARDS) | 1014 | if (dev_num >= SNDRV_CARDS) |
1008 | return -ENODEV; | 1015 | return -ENODEV; |
@@ -1023,8 +1030,7 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq) | |||
1023 | (unsigned long long)rp->start, | 1030 | (unsigned long long)rp->start, |
1024 | irq); | 1031 | irq); |
1025 | 1032 | ||
1026 | if ((err = snd_amd7930_create(card, rp, | 1033 | if ((err = snd_amd7930_create(card, op, |
1027 | (rp->end - rp->start) + 1, | ||
1028 | irq, dev_num, &amd)) < 0) | 1034 | irq, dev_num, &amd)) < 0) |
1029 | goto out_err; | 1035 | goto out_err; |
1030 | 1036 | ||
@@ -1049,43 +1055,7 @@ out_err: | |||
1049 | return err; | 1055 | return err; |
1050 | } | 1056 | } |
1051 | 1057 | ||
1052 | static int __devinit amd7930_obio_attach(struct device_node *dp) | 1058 | static const struct of_device_id amd7930_match[] = { |
1053 | { | ||
1054 | const struct linux_prom_registers *regs; | ||
1055 | const struct linux_prom_irqs *irqp; | ||
1056 | struct resource res, *rp; | ||
1057 | int len; | ||
1058 | |||
1059 | irqp = of_get_property(dp, "intr", &len); | ||
1060 | if (!irqp) { | ||
1061 | snd_printk("%s: Firmware node lacks IRQ property.\n", | ||
1062 | dp->full_name); | ||
1063 | return -ENODEV; | ||
1064 | } | ||
1065 | |||
1066 | regs = of_get_property(dp, "reg", &len); | ||
1067 | if (!regs) { | ||
1068 | snd_printk("%s: Firmware node lacks register property.\n", | ||
1069 | dp->full_name); | ||
1070 | return -ENODEV; | ||
1071 | } | ||
1072 | |||
1073 | rp = &res; | ||
1074 | rp->start = regs->phys_addr; | ||
1075 | rp->end = rp->start + regs->reg_size - 1; | ||
1076 | rp->flags = IORESOURCE_IO | (regs->which_io & 0xff); | ||
1077 | |||
1078 | return amd7930_attach_common(rp, irqp->pri); | ||
1079 | } | ||
1080 | |||
1081 | static int __devinit amd7930_sbus_probe(struct of_device *dev, const struct of_device_id *match) | ||
1082 | { | ||
1083 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); | ||
1084 | |||
1085 | return amd7930_attach_common(&sdev->resource[0], sdev->irqs[0]); | ||
1086 | } | ||
1087 | |||
1088 | static struct of_device_id amd7930_match[] = { | ||
1089 | { | 1059 | { |
1090 | .name = "audio", | 1060 | .name = "audio", |
1091 | }, | 1061 | }, |
@@ -1100,20 +1070,7 @@ static struct of_platform_driver amd7930_sbus_driver = { | |||
1100 | 1070 | ||
1101 | static int __init amd7930_init(void) | 1071 | static int __init amd7930_init(void) |
1102 | { | 1072 | { |
1103 | struct device_node *dp; | 1073 | return of_register_driver(&amd7930_sbus_driver, &of_bus_type); |
1104 | |||
1105 | /* Try to find the sun4c "audio" node first. */ | ||
1106 | dp = of_find_node_by_path("/"); | ||
1107 | dp = dp->child; | ||
1108 | while (dp) { | ||
1109 | if (!strcmp(dp->name, "audio")) | ||
1110 | amd7930_obio_attach(dp); | ||
1111 | |||
1112 | dp = dp->sibling; | ||
1113 | } | ||
1114 | |||
1115 | /* Probe each SBUS for amd7930 chips. */ | ||
1116 | return of_register_driver(&amd7930_sbus_driver, &sbus_bus_type); | ||
1117 | } | 1074 | } |
1118 | 1075 | ||
1119 | static void __exit amd7930_exit(void) | 1076 | static void __exit amd7930_exit(void) |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 791d2fb821d1..d44bf98e965e 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for CS4231 sound chips found on Sparcs. | 2 | * Driver for CS4231 sound chips found on Sparcs. |
3 | * Copyright (C) 2002 David S. Miller <davem@redhat.com> | 3 | * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net> |
4 | * | 4 | * |
5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: | 5 | * Based entirely upon drivers/sbus/audio/cs4231.c which is: |
6 | * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) | 6 | * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) |
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | 20 | #include <linux/of.h> | |
21 | #include <linux/of_device.h> | ||
21 | 22 | ||
22 | #include <sound/core.h> | 23 | #include <sound/core.h> |
23 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
@@ -29,13 +30,12 @@ | |||
29 | 30 | ||
30 | #ifdef CONFIG_SBUS | 31 | #ifdef CONFIG_SBUS |
31 | #define SBUS_SUPPORT | 32 | #define SBUS_SUPPORT |
32 | #include <asm/sbus.h> | ||
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) | 35 | #if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) |
36 | #define EBUS_SUPPORT | 36 | #define EBUS_SUPPORT |
37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <asm/ebus.h> | 38 | #include <asm/ebus_dma.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 41 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
@@ -70,8 +70,6 @@ struct cs4231_dma_control { | |||
70 | int (*request)(struct cs4231_dma_control *dma_cont, | 70 | int (*request)(struct cs4231_dma_control *dma_cont, |
71 | dma_addr_t bus_addr, size_t len); | 71 | dma_addr_t bus_addr, size_t len); |
72 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); | 72 | unsigned int (*address)(struct cs4231_dma_control *dma_cont); |
73 | void (*preallocate)(struct snd_cs4231 *chip, | ||
74 | struct snd_pcm *pcm); | ||
75 | #ifdef EBUS_SUPPORT | 73 | #ifdef EBUS_SUPPORT |
76 | struct ebus_dma_info ebus_info; | 74 | struct ebus_dma_info ebus_info; |
77 | #endif | 75 | #endif |
@@ -114,21 +112,12 @@ struct snd_cs4231 { | |||
114 | struct mutex mce_mutex; /* mutex for mce register */ | 112 | struct mutex mce_mutex; /* mutex for mce register */ |
115 | struct mutex open_mutex; /* mutex for ALSA open/close */ | 113 | struct mutex open_mutex; /* mutex for ALSA open/close */ |
116 | 114 | ||
117 | union { | 115 | struct of_device *op; |
118 | #ifdef SBUS_SUPPORT | ||
119 | struct sbus_dev *sdev; | ||
120 | #endif | ||
121 | #ifdef EBUS_SUPPORT | ||
122 | struct pci_dev *pdev; | ||
123 | #endif | ||
124 | } dev_u; | ||
125 | unsigned int irq[2]; | 116 | unsigned int irq[2]; |
126 | unsigned int regs_size; | 117 | unsigned int regs_size; |
127 | struct snd_cs4231 *next; | 118 | struct snd_cs4231 *next; |
128 | }; | 119 | }; |
129 | 120 | ||
130 | static struct snd_cs4231 *cs4231_list; | ||
131 | |||
132 | /* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for | 121 | /* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for |
133 | * now.... -DaveM | 122 | * now.... -DaveM |
134 | */ | 123 | */ |
@@ -267,27 +256,19 @@ static unsigned char snd_cs4231_original_image[32] = | |||
267 | 256 | ||
268 | static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) | 257 | static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) |
269 | { | 258 | { |
270 | #ifdef EBUS_SUPPORT | ||
271 | if (cp->flags & CS4231_FLAG_EBUS) | 259 | if (cp->flags & CS4231_FLAG_EBUS) |
272 | return readb(reg_addr); | 260 | return readb(reg_addr); |
273 | else | 261 | else |
274 | #endif | ||
275 | #ifdef SBUS_SUPPORT | ||
276 | return sbus_readb(reg_addr); | 262 | return sbus_readb(reg_addr); |
277 | #endif | ||
278 | } | 263 | } |
279 | 264 | ||
280 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, | 265 | static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, |
281 | void __iomem *reg_addr) | 266 | void __iomem *reg_addr) |
282 | { | 267 | { |
283 | #ifdef EBUS_SUPPORT | ||
284 | if (cp->flags & CS4231_FLAG_EBUS) | 268 | if (cp->flags & CS4231_FLAG_EBUS) |
285 | return writeb(val, reg_addr); | 269 | return writeb(val, reg_addr); |
286 | else | 270 | else |
287 | #endif | ||
288 | #ifdef SBUS_SUPPORT | ||
289 | return sbus_writeb(val, reg_addr); | 271 | return sbus_writeb(val, reg_addr); |
290 | #endif | ||
291 | } | 272 | } |
292 | 273 | ||
293 | /* | 274 | /* |
@@ -1258,7 +1239,9 @@ static int __init snd_cs4231_pcm(struct snd_card *card) | |||
1258 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; | 1239 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; |
1259 | strcpy(pcm->name, "CS4231"); | 1240 | strcpy(pcm->name, "CS4231"); |
1260 | 1241 | ||
1261 | chip->p_dma.preallocate(chip, pcm); | 1242 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1243 | &chip->op->dev, | ||
1244 | 64 * 1024, 128 * 1024); | ||
1262 | 1245 | ||
1263 | chip->pcm = pcm; | 1246 | chip->pcm = pcm; |
1264 | 1247 | ||
@@ -1627,8 +1610,7 @@ static int __init cs4231_attach_finish(struct snd_card *card) | |||
1627 | if (err < 0) | 1610 | if (err < 0) |
1628 | goto out_err; | 1611 | goto out_err; |
1629 | 1612 | ||
1630 | chip->next = cs4231_list; | 1613 | dev_set_drvdata(&chip->op->dev, chip); |
1631 | cs4231_list = chip; | ||
1632 | 1614 | ||
1633 | dev++; | 1615 | dev++; |
1634 | return 0; | 1616 | return 0; |
@@ -1783,24 +1765,19 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
1783 | return sbus_readl(base->regs + base->dir + APCVA); | 1765 | return sbus_readl(base->regs + base->dir + APCVA); |
1784 | } | 1766 | } |
1785 | 1767 | ||
1786 | static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) | ||
1787 | { | ||
1788 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS, | ||
1789 | snd_dma_sbus_data(chip->dev_u.sdev), | ||
1790 | 64 * 1024, 128 * 1024); | ||
1791 | } | ||
1792 | |||
1793 | /* | 1768 | /* |
1794 | * Init and exit routines | 1769 | * Init and exit routines |
1795 | */ | 1770 | */ |
1796 | 1771 | ||
1797 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) | 1772 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) |
1798 | { | 1773 | { |
1774 | struct of_device *op = chip->op; | ||
1775 | |||
1799 | if (chip->irq[0]) | 1776 | if (chip->irq[0]) |
1800 | free_irq(chip->irq[0], chip); | 1777 | free_irq(chip->irq[0], chip); |
1801 | 1778 | ||
1802 | if (chip->port) | 1779 | if (chip->port) |
1803 | sbus_iounmap(chip->port, chip->regs_size); | 1780 | of_iounmap(&op->resource[0], chip->port, chip->regs_size); |
1804 | 1781 | ||
1805 | return 0; | 1782 | return 0; |
1806 | } | 1783 | } |
@@ -1817,7 +1794,7 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = { | |||
1817 | }; | 1794 | }; |
1818 | 1795 | ||
1819 | static int __init snd_cs4231_sbus_create(struct snd_card *card, | 1796 | static int __init snd_cs4231_sbus_create(struct snd_card *card, |
1820 | struct sbus_dev *sdev, | 1797 | struct of_device *op, |
1821 | int dev) | 1798 | int dev) |
1822 | { | 1799 | { |
1823 | struct snd_cs4231 *chip = card->private_data; | 1800 | struct snd_cs4231 *chip = card->private_data; |
@@ -1828,13 +1805,13 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1828 | spin_lock_init(&chip->p_dma.sbus_info.lock); | 1805 | spin_lock_init(&chip->p_dma.sbus_info.lock); |
1829 | mutex_init(&chip->mce_mutex); | 1806 | mutex_init(&chip->mce_mutex); |
1830 | mutex_init(&chip->open_mutex); | 1807 | mutex_init(&chip->open_mutex); |
1831 | chip->dev_u.sdev = sdev; | 1808 | chip->op = op; |
1832 | chip->regs_size = sdev->reg_addrs[0].reg_size; | 1809 | chip->regs_size = resource_size(&op->resource[0]); |
1833 | memcpy(&chip->image, &snd_cs4231_original_image, | 1810 | memcpy(&chip->image, &snd_cs4231_original_image, |
1834 | sizeof(snd_cs4231_original_image)); | 1811 | sizeof(snd_cs4231_original_image)); |
1835 | 1812 | ||
1836 | chip->port = sbus_ioremap(&sdev->resource[0], 0, | 1813 | chip->port = of_ioremap(&op->resource[0], 0, |
1837 | chip->regs_size, "cs4231"); | 1814 | chip->regs_size, "cs4231"); |
1838 | if (!chip->port) { | 1815 | if (!chip->port) { |
1839 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); | 1816 | snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); |
1840 | return -EIO; | 1817 | return -EIO; |
@@ -1849,22 +1826,20 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1849 | chip->p_dma.enable = sbus_dma_enable; | 1826 | chip->p_dma.enable = sbus_dma_enable; |
1850 | chip->p_dma.request = sbus_dma_request; | 1827 | chip->p_dma.request = sbus_dma_request; |
1851 | chip->p_dma.address = sbus_dma_addr; | 1828 | chip->p_dma.address = sbus_dma_addr; |
1852 | chip->p_dma.preallocate = sbus_dma_preallocate; | ||
1853 | 1829 | ||
1854 | chip->c_dma.prepare = sbus_dma_prepare; | 1830 | chip->c_dma.prepare = sbus_dma_prepare; |
1855 | chip->c_dma.enable = sbus_dma_enable; | 1831 | chip->c_dma.enable = sbus_dma_enable; |
1856 | chip->c_dma.request = sbus_dma_request; | 1832 | chip->c_dma.request = sbus_dma_request; |
1857 | chip->c_dma.address = sbus_dma_addr; | 1833 | chip->c_dma.address = sbus_dma_addr; |
1858 | chip->c_dma.preallocate = sbus_dma_preallocate; | ||
1859 | 1834 | ||
1860 | if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, | 1835 | if (request_irq(op->irqs[0], snd_cs4231_sbus_interrupt, |
1861 | IRQF_SHARED, "cs4231", chip)) { | 1836 | IRQF_SHARED, "cs4231", chip)) { |
1862 | snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n", | 1837 | snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n", |
1863 | dev, sdev->irqs[0]); | 1838 | dev, op->irqs[0]); |
1864 | snd_cs4231_sbus_free(chip); | 1839 | snd_cs4231_sbus_free(chip); |
1865 | return -EBUSY; | 1840 | return -EBUSY; |
1866 | } | 1841 | } |
1867 | chip->irq[0] = sdev->irqs[0]; | 1842 | chip->irq[0] = op->irqs[0]; |
1868 | 1843 | ||
1869 | if (snd_cs4231_probe(chip) < 0) { | 1844 | if (snd_cs4231_probe(chip) < 0) { |
1870 | snd_cs4231_sbus_free(chip); | 1845 | snd_cs4231_sbus_free(chip); |
@@ -1881,9 +1856,9 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card, | |||
1881 | return 0; | 1856 | return 0; |
1882 | } | 1857 | } |
1883 | 1858 | ||
1884 | static int __init cs4231_sbus_attach(struct sbus_dev *sdev) | 1859 | static int __devinit cs4231_sbus_probe(struct of_device *op, const struct of_device_id *match) |
1885 | { | 1860 | { |
1886 | struct resource *rp = &sdev->resource[0]; | 1861 | struct resource *rp = &op->resource[0]; |
1887 | struct snd_card *card; | 1862 | struct snd_card *card; |
1888 | int err; | 1863 | int err; |
1889 | 1864 | ||
@@ -1895,9 +1870,9 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev) | |||
1895 | card->shortname, | 1870 | card->shortname, |
1896 | rp->flags & 0xffL, | 1871 | rp->flags & 0xffL, |
1897 | (unsigned long long)rp->start, | 1872 | (unsigned long long)rp->start, |
1898 | sdev->irqs[0]); | 1873 | op->irqs[0]); |
1899 | 1874 | ||
1900 | err = snd_cs4231_sbus_create(card, sdev, dev); | 1875 | err = snd_cs4231_sbus_create(card, op, dev); |
1901 | if (err < 0) { | 1876 | if (err < 0) { |
1902 | snd_card_free(card); | 1877 | snd_card_free(card); |
1903 | return err; | 1878 | return err; |
@@ -1950,30 +1925,25 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
1950 | return ebus_dma_addr(&dma_cont->ebus_info); | 1925 | return ebus_dma_addr(&dma_cont->ebus_info); |
1951 | } | 1926 | } |
1952 | 1927 | ||
1953 | static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) | ||
1954 | { | ||
1955 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1956 | snd_dma_pci_data(chip->dev_u.pdev), | ||
1957 | 64*1024, 128*1024); | ||
1958 | } | ||
1959 | |||
1960 | /* | 1928 | /* |
1961 | * Init and exit routines | 1929 | * Init and exit routines |
1962 | */ | 1930 | */ |
1963 | 1931 | ||
1964 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) | 1932 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) |
1965 | { | 1933 | { |
1934 | struct of_device *op = chip->op; | ||
1935 | |||
1966 | if (chip->c_dma.ebus_info.regs) { | 1936 | if (chip->c_dma.ebus_info.regs) { |
1967 | ebus_dma_unregister(&chip->c_dma.ebus_info); | 1937 | ebus_dma_unregister(&chip->c_dma.ebus_info); |
1968 | iounmap(chip->c_dma.ebus_info.regs); | 1938 | of_iounmap(&op->resource[2], chip->c_dma.ebus_info.regs, 0x10); |
1969 | } | 1939 | } |
1970 | if (chip->p_dma.ebus_info.regs) { | 1940 | if (chip->p_dma.ebus_info.regs) { |
1971 | ebus_dma_unregister(&chip->p_dma.ebus_info); | 1941 | ebus_dma_unregister(&chip->p_dma.ebus_info); |
1972 | iounmap(chip->p_dma.ebus_info.regs); | 1942 | of_iounmap(&op->resource[1], chip->p_dma.ebus_info.regs, 0x10); |
1973 | } | 1943 | } |
1974 | 1944 | ||
1975 | if (chip->port) | 1945 | if (chip->port) |
1976 | iounmap(chip->port); | 1946 | of_iounmap(&op->resource[0], chip->port, 0x10); |
1977 | 1947 | ||
1978 | return 0; | 1948 | return 0; |
1979 | } | 1949 | } |
@@ -1990,7 +1960,7 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = { | |||
1990 | }; | 1960 | }; |
1991 | 1961 | ||
1992 | static int __init snd_cs4231_ebus_create(struct snd_card *card, | 1962 | static int __init snd_cs4231_ebus_create(struct snd_card *card, |
1993 | struct linux_ebus_device *edev, | 1963 | struct of_device *op, |
1994 | int dev) | 1964 | int dev) |
1995 | { | 1965 | { |
1996 | struct snd_cs4231 *chip = card->private_data; | 1966 | struct snd_cs4231 *chip = card->private_data; |
@@ -2002,35 +1972,35 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2002 | mutex_init(&chip->mce_mutex); | 1972 | mutex_init(&chip->mce_mutex); |
2003 | mutex_init(&chip->open_mutex); | 1973 | mutex_init(&chip->open_mutex); |
2004 | chip->flags |= CS4231_FLAG_EBUS; | 1974 | chip->flags |= CS4231_FLAG_EBUS; |
2005 | chip->dev_u.pdev = edev->bus->self; | 1975 | chip->op = op; |
2006 | memcpy(&chip->image, &snd_cs4231_original_image, | 1976 | memcpy(&chip->image, &snd_cs4231_original_image, |
2007 | sizeof(snd_cs4231_original_image)); | 1977 | sizeof(snd_cs4231_original_image)); |
2008 | strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)"); | 1978 | strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)"); |
2009 | chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; | 1979 | chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; |
2010 | chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; | 1980 | chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; |
2011 | chip->c_dma.ebus_info.client_cookie = chip; | 1981 | chip->c_dma.ebus_info.client_cookie = chip; |
2012 | chip->c_dma.ebus_info.irq = edev->irqs[0]; | 1982 | chip->c_dma.ebus_info.irq = op->irqs[0]; |
2013 | strcpy(chip->p_dma.ebus_info.name, "cs4231(play)"); | 1983 | strcpy(chip->p_dma.ebus_info.name, "cs4231(play)"); |
2014 | chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; | 1984 | chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; |
2015 | chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; | 1985 | chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; |
2016 | chip->p_dma.ebus_info.client_cookie = chip; | 1986 | chip->p_dma.ebus_info.client_cookie = chip; |
2017 | chip->p_dma.ebus_info.irq = edev->irqs[1]; | 1987 | chip->p_dma.ebus_info.irq = op->irqs[1]; |
2018 | 1988 | ||
2019 | chip->p_dma.prepare = _ebus_dma_prepare; | 1989 | chip->p_dma.prepare = _ebus_dma_prepare; |
2020 | chip->p_dma.enable = _ebus_dma_enable; | 1990 | chip->p_dma.enable = _ebus_dma_enable; |
2021 | chip->p_dma.request = _ebus_dma_request; | 1991 | chip->p_dma.request = _ebus_dma_request; |
2022 | chip->p_dma.address = _ebus_dma_addr; | 1992 | chip->p_dma.address = _ebus_dma_addr; |
2023 | chip->p_dma.preallocate = _ebus_dma_preallocate; | ||
2024 | 1993 | ||
2025 | chip->c_dma.prepare = _ebus_dma_prepare; | 1994 | chip->c_dma.prepare = _ebus_dma_prepare; |
2026 | chip->c_dma.enable = _ebus_dma_enable; | 1995 | chip->c_dma.enable = _ebus_dma_enable; |
2027 | chip->c_dma.request = _ebus_dma_request; | 1996 | chip->c_dma.request = _ebus_dma_request; |
2028 | chip->c_dma.address = _ebus_dma_addr; | 1997 | chip->c_dma.address = _ebus_dma_addr; |
2029 | chip->c_dma.preallocate = _ebus_dma_preallocate; | ||
2030 | 1998 | ||
2031 | chip->port = ioremap(edev->resource[0].start, 0x10); | 1999 | chip->port = of_ioremap(&op->resource[0], 0, 0x10, "cs4231"); |
2032 | chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10); | 2000 | chip->p_dma.ebus_info.regs = |
2033 | chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10); | 2001 | of_ioremap(&op->resource[1], 0, 0x10, "cs4231_pdma"); |
2002 | chip->c_dma.ebus_info.regs = | ||
2003 | of_ioremap(&op->resource[2], 0, 0x10, "cs4231_cdma"); | ||
2034 | if (!chip->port || !chip->p_dma.ebus_info.regs || | 2004 | if (!chip->port || !chip->p_dma.ebus_info.regs || |
2035 | !chip->c_dma.ebus_info.regs) { | 2005 | !chip->c_dma.ebus_info.regs) { |
2036 | snd_cs4231_ebus_free(chip); | 2006 | snd_cs4231_ebus_free(chip); |
@@ -2078,7 +2048,7 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card, | |||
2078 | return 0; | 2048 | return 0; |
2079 | } | 2049 | } |
2080 | 2050 | ||
2081 | static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | 2051 | static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_device_id *match) |
2082 | { | 2052 | { |
2083 | struct snd_card *card; | 2053 | struct snd_card *card; |
2084 | int err; | 2054 | int err; |
@@ -2089,10 +2059,10 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | |||
2089 | 2059 | ||
2090 | sprintf(card->longname, "%s at 0x%lx, irq %d", | 2060 | sprintf(card->longname, "%s at 0x%lx, irq %d", |
2091 | card->shortname, | 2061 | card->shortname, |
2092 | edev->resource[0].start, | 2062 | op->resource[0].start, |
2093 | edev->irqs[0]); | 2063 | op->irqs[0]); |
2094 | 2064 | ||
2095 | err = snd_cs4231_ebus_create(card, edev, dev); | 2065 | err = snd_cs4231_ebus_create(card, op, dev); |
2096 | if (err < 0) { | 2066 | if (err < 0) { |
2097 | snd_card_free(card); | 2067 | snd_card_free(card); |
2098 | return err; | 2068 | return err; |
@@ -2102,68 +2072,57 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) | |||
2102 | } | 2072 | } |
2103 | #endif | 2073 | #endif |
2104 | 2074 | ||
2105 | static int __init cs4231_init(void) | 2075 | static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match) |
2106 | { | 2076 | { |
2107 | #ifdef SBUS_SUPPORT | ||
2108 | struct sbus_bus *sbus; | ||
2109 | struct sbus_dev *sdev; | ||
2110 | #endif | ||
2111 | #ifdef EBUS_SUPPORT | 2077 | #ifdef EBUS_SUPPORT |
2112 | struct linux_ebus *ebus; | 2078 | if (!strcmp(op->node->parent->name, "ebus")) |
2113 | struct linux_ebus_device *edev; | 2079 | return cs4231_ebus_probe(op, match); |
2114 | #endif | 2080 | #endif |
2115 | int found; | ||
2116 | |||
2117 | found = 0; | ||
2118 | |||
2119 | #ifdef SBUS_SUPPORT | 2081 | #ifdef SBUS_SUPPORT |
2120 | for_all_sbusdev(sdev, sbus) { | 2082 | if (!strcmp(op->node->parent->name, "sbus") || |
2121 | if (!strcmp(sdev->prom_name, "SUNW,CS4231")) { | 2083 | !strcmp(op->node->parent->name, "sbi")) |
2122 | if (cs4231_sbus_attach(sdev) == 0) | 2084 | return cs4231_sbus_probe(op, match); |
2123 | found++; | ||
2124 | } | ||
2125 | } | ||
2126 | #endif | 2085 | #endif |
2127 | #ifdef EBUS_SUPPORT | 2086 | return -ENODEV; |
2128 | for_each_ebus(ebus) { | 2087 | } |
2129 | for_each_ebusdev(edev, ebus) { | ||
2130 | int match = 0; | ||
2131 | |||
2132 | if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) { | ||
2133 | match = 1; | ||
2134 | } else if (!strcmp(edev->prom_node->name, "audio")) { | ||
2135 | const char *compat; | ||
2136 | |||
2137 | compat = of_get_property(edev->prom_node, | ||
2138 | "compatible", NULL); | ||
2139 | if (compat && !strcmp(compat, "SUNW,CS4231")) | ||
2140 | match = 1; | ||
2141 | } | ||
2142 | 2088 | ||
2143 | if (match && | 2089 | static int __devexit cs4231_remove(struct of_device *op) |
2144 | cs4231_ebus_attach(edev) == 0) | 2090 | { |
2145 | found++; | 2091 | struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); |
2146 | } | ||
2147 | } | ||
2148 | #endif | ||
2149 | 2092 | ||
2093 | snd_card_free(chip->card); | ||
2150 | 2094 | ||
2151 | return (found > 0) ? 0 : -EIO; | 2095 | return 0; |
2152 | } | 2096 | } |
2153 | 2097 | ||
2154 | static void __exit cs4231_exit(void) | 2098 | static const struct of_device_id cs4231_match[] = { |
2155 | { | 2099 | { |
2156 | struct snd_cs4231 *p = cs4231_list; | 2100 | .name = "SUNW,CS4231", |
2101 | }, | ||
2102 | { | ||
2103 | .name = "audio", | ||
2104 | .compatible = "SUNW,CS4231", | ||
2105 | }, | ||
2106 | {}, | ||
2107 | }; | ||
2157 | 2108 | ||
2158 | while (p != NULL) { | 2109 | MODULE_DEVICE_TABLE(of, cs4231_match); |
2159 | struct snd_cs4231 *next = p->next; | ||
2160 | 2110 | ||
2161 | snd_card_free(p->card); | 2111 | static struct of_platform_driver cs4231_driver = { |
2112 | .name = "audio", | ||
2113 | .match_table = cs4231_match, | ||
2114 | .probe = cs4231_probe, | ||
2115 | .remove = __devexit_p(cs4231_remove), | ||
2116 | }; | ||
2162 | 2117 | ||
2163 | p = next; | 2118 | static int __init cs4231_init(void) |
2164 | } | 2119 | { |
2120 | return of_register_driver(&cs4231_driver, &of_bus_type); | ||
2121 | } | ||
2165 | 2122 | ||
2166 | cs4231_list = NULL; | 2123 | static void __exit cs4231_exit(void) |
2124 | { | ||
2125 | of_unregister_driver(&cs4231_driver); | ||
2167 | } | 2126 | } |
2168 | 2127 | ||
2169 | module_init(cs4231_init); | 2128 | module_init(cs4231_init); |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index c534a2a849fa..23ed6f04a718 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <linux/delay.h> | 57 | #include <linux/delay.h> |
58 | #include <linux/irq.h> | 58 | #include <linux/irq.h> |
59 | #include <linux/io.h> | 59 | #include <linux/io.h> |
60 | #include <linux/dma-mapping.h> | ||
60 | 61 | ||
61 | #include <sound/core.h> | 62 | #include <sound/core.h> |
62 | #include <sound/pcm.h> | 63 | #include <sound/pcm.h> |
@@ -66,7 +67,7 @@ | |||
66 | #include <sound/initval.h> | 67 | #include <sound/initval.h> |
67 | 68 | ||
68 | #include <linux/of.h> | 69 | #include <linux/of.h> |
69 | #include <asm/sbus.h> | 70 | #include <linux/of_device.h> |
70 | #include <asm/atomic.h> | 71 | #include <asm/atomic.h> |
71 | 72 | ||
72 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); | 73 | MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); |
@@ -297,7 +298,7 @@ struct dbri_streaminfo { | |||
297 | /* This structure holds the information for both chips (DBRI & CS4215) */ | 298 | /* This structure holds the information for both chips (DBRI & CS4215) */ |
298 | struct snd_dbri { | 299 | struct snd_dbri { |
299 | int regs_size, irq; /* Needed for unload */ | 300 | int regs_size, irq; /* Needed for unload */ |
300 | struct sbus_dev *sdev; /* SBUS device info */ | 301 | struct of_device *op; /* OF device info */ |
301 | spinlock_t lock; | 302 | spinlock_t lock; |
302 | 303 | ||
303 | struct dbri_dma *dma; /* Pointer to our DMA block */ | 304 | struct dbri_dma *dma; /* Pointer to our DMA block */ |
@@ -2093,14 +2094,15 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream, | |||
2093 | */ | 2094 | */ |
2094 | if (info->dvma_buffer == 0) { | 2095 | if (info->dvma_buffer == 0) { |
2095 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | 2096 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) |
2096 | direction = SBUS_DMA_TODEVICE; | 2097 | direction = DMA_TO_DEVICE; |
2097 | else | 2098 | else |
2098 | direction = SBUS_DMA_FROMDEVICE; | 2099 | direction = DMA_FROM_DEVICE; |
2099 | 2100 | ||
2100 | info->dvma_buffer = sbus_map_single(dbri->sdev, | 2101 | info->dvma_buffer = |
2101 | runtime->dma_area, | 2102 | dma_map_single(&dbri->op->dev, |
2102 | params_buffer_bytes(hw_params), | 2103 | runtime->dma_area, |
2103 | direction); | 2104 | params_buffer_bytes(hw_params), |
2105 | direction); | ||
2104 | } | 2106 | } |
2105 | 2107 | ||
2106 | direction = params_buffer_bytes(hw_params); | 2108 | direction = params_buffer_bytes(hw_params); |
@@ -2121,12 +2123,12 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream) | |||
2121 | */ | 2123 | */ |
2122 | if (info->dvma_buffer) { | 2124 | if (info->dvma_buffer) { |
2123 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) | 2125 | if (DBRI_STREAMNO(substream) == DBRI_PLAY) |
2124 | direction = SBUS_DMA_TODEVICE; | 2126 | direction = DMA_TO_DEVICE; |
2125 | else | 2127 | else |
2126 | direction = SBUS_DMA_FROMDEVICE; | 2128 | direction = DMA_FROM_DEVICE; |
2127 | 2129 | ||
2128 | sbus_unmap_single(dbri->sdev, info->dvma_buffer, | 2130 | dma_unmap_single(&dbri->op->dev, info->dvma_buffer, |
2129 | substream->runtime->buffer_size, direction); | 2131 | substream->runtime->buffer_size, direction); |
2130 | info->dvma_buffer = 0; | 2132 | info->dvma_buffer = 0; |
2131 | } | 2133 | } |
2132 | if (info->pipe != -1) { | 2134 | if (info->pipe != -1) { |
@@ -2519,31 +2521,34 @@ static void __devinit snd_dbri_proc(struct snd_card *card) | |||
2519 | static void snd_dbri_free(struct snd_dbri *dbri); | 2521 | static void snd_dbri_free(struct snd_dbri *dbri); |
2520 | 2522 | ||
2521 | static int __devinit snd_dbri_create(struct snd_card *card, | 2523 | static int __devinit snd_dbri_create(struct snd_card *card, |
2522 | struct sbus_dev *sdev, | 2524 | struct of_device *op, |
2523 | int irq, int dev) | 2525 | int irq, int dev) |
2524 | { | 2526 | { |
2525 | struct snd_dbri *dbri = card->private_data; | 2527 | struct snd_dbri *dbri = card->private_data; |
2526 | int err; | 2528 | int err; |
2527 | 2529 | ||
2528 | spin_lock_init(&dbri->lock); | 2530 | spin_lock_init(&dbri->lock); |
2529 | dbri->sdev = sdev; | 2531 | dbri->op = op; |
2530 | dbri->irq = irq; | 2532 | dbri->irq = irq; |
2531 | 2533 | ||
2532 | dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma), | 2534 | dbri->dma = dma_alloc_coherent(&op->dev, |
2533 | &dbri->dma_dvma); | 2535 | sizeof(struct dbri_dma), |
2536 | &dbri->dma_dvma, GFP_ATOMIC); | ||
2537 | if (!dbri->dma) | ||
2538 | return -ENOMEM; | ||
2534 | memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); | 2539 | memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); |
2535 | 2540 | ||
2536 | dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", | 2541 | dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", |
2537 | dbri->dma, dbri->dma_dvma); | 2542 | dbri->dma, dbri->dma_dvma); |
2538 | 2543 | ||
2539 | /* Map the registers into memory. */ | 2544 | /* Map the registers into memory. */ |
2540 | dbri->regs_size = sdev->reg_addrs[0].reg_size; | 2545 | dbri->regs_size = resource_size(&op->resource[0]); |
2541 | dbri->regs = sbus_ioremap(&sdev->resource[0], 0, | 2546 | dbri->regs = of_ioremap(&op->resource[0], 0, |
2542 | dbri->regs_size, "DBRI Registers"); | 2547 | dbri->regs_size, "DBRI Registers"); |
2543 | if (!dbri->regs) { | 2548 | if (!dbri->regs) { |
2544 | printk(KERN_ERR "DBRI: could not allocate registers\n"); | 2549 | printk(KERN_ERR "DBRI: could not allocate registers\n"); |
2545 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | 2550 | dma_free_coherent(&op->dev, sizeof(struct dbri_dma), |
2546 | (void *)dbri->dma, dbri->dma_dvma); | 2551 | (void *)dbri->dma, dbri->dma_dvma); |
2547 | return -EIO; | 2552 | return -EIO; |
2548 | } | 2553 | } |
2549 | 2554 | ||
@@ -2551,9 +2556,9 @@ static int __devinit snd_dbri_create(struct snd_card *card, | |||
2551 | "DBRI audio", dbri); | 2556 | "DBRI audio", dbri); |
2552 | if (err) { | 2557 | if (err) { |
2553 | printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); | 2558 | printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); |
2554 | sbus_iounmap(dbri->regs, dbri->regs_size); | 2559 | of_iounmap(&op->resource[0], dbri->regs, dbri->regs_size); |
2555 | sbus_free_consistent(sdev, sizeof(struct dbri_dma), | 2560 | dma_free_coherent(&op->dev, sizeof(struct dbri_dma), |
2556 | (void *)dbri->dma, dbri->dma_dvma); | 2561 | (void *)dbri->dma, dbri->dma_dvma); |
2557 | return err; | 2562 | return err; |
2558 | } | 2563 | } |
2559 | 2564 | ||
@@ -2577,27 +2582,23 @@ static void snd_dbri_free(struct snd_dbri *dbri) | |||
2577 | free_irq(dbri->irq, dbri); | 2582 | free_irq(dbri->irq, dbri); |
2578 | 2583 | ||
2579 | if (dbri->regs) | 2584 | if (dbri->regs) |
2580 | sbus_iounmap(dbri->regs, dbri->regs_size); | 2585 | of_iounmap(&dbri->op->resource[0], dbri->regs, dbri->regs_size); |
2581 | 2586 | ||
2582 | if (dbri->dma) | 2587 | if (dbri->dma) |
2583 | sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), | 2588 | dma_free_coherent(&dbri->op->dev, |
2584 | (void *)dbri->dma, dbri->dma_dvma); | 2589 | sizeof(struct dbri_dma), |
2590 | (void *)dbri->dma, dbri->dma_dvma); | ||
2585 | } | 2591 | } |
2586 | 2592 | ||
2587 | static int __devinit dbri_probe(struct of_device *of_dev, | 2593 | static int __devinit dbri_probe(struct of_device *op, const struct of_device_id *match) |
2588 | const struct of_device_id *match) | ||
2589 | { | 2594 | { |
2590 | struct sbus_dev *sdev = to_sbus_device(&of_dev->dev); | ||
2591 | struct snd_dbri *dbri; | 2595 | struct snd_dbri *dbri; |
2592 | int irq; | ||
2593 | struct resource *rp; | 2596 | struct resource *rp; |
2594 | struct snd_card *card; | 2597 | struct snd_card *card; |
2595 | static int dev = 0; | 2598 | static int dev = 0; |
2599 | int irq; | ||
2596 | int err; | 2600 | int err; |
2597 | 2601 | ||
2598 | dprintk(D_GEN, "DBRI: Found %s in SBUS slot %d\n", | ||
2599 | sdev->prom_name, sdev->slot); | ||
2600 | |||
2601 | if (dev >= SNDRV_CARDS) | 2602 | if (dev >= SNDRV_CARDS) |
2602 | return -ENODEV; | 2603 | return -ENODEV; |
2603 | if (!enable[dev]) { | 2604 | if (!enable[dev]) { |
@@ -2605,7 +2606,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2605 | return -ENOENT; | 2606 | return -ENOENT; |
2606 | } | 2607 | } |
2607 | 2608 | ||
2608 | irq = sdev->irqs[0]; | 2609 | irq = op->irqs[0]; |
2609 | if (irq <= 0) { | 2610 | if (irq <= 0) { |
2610 | printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev); | 2611 | printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev); |
2611 | return -ENODEV; | 2612 | return -ENODEV; |
@@ -2618,12 +2619,12 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2618 | 2619 | ||
2619 | strcpy(card->driver, "DBRI"); | 2620 | strcpy(card->driver, "DBRI"); |
2620 | strcpy(card->shortname, "Sun DBRI"); | 2621 | strcpy(card->shortname, "Sun DBRI"); |
2621 | rp = &sdev->resource[0]; | 2622 | rp = &op->resource[0]; |
2622 | sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d", | 2623 | sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d", |
2623 | card->shortname, | 2624 | card->shortname, |
2624 | rp->flags & 0xffL, (unsigned long long)rp->start, irq); | 2625 | rp->flags & 0xffL, (unsigned long long)rp->start, irq); |
2625 | 2626 | ||
2626 | err = snd_dbri_create(card, sdev, irq, dev); | 2627 | err = snd_dbri_create(card, op, irq, dev); |
2627 | if (err < 0) { | 2628 | if (err < 0) { |
2628 | snd_card_free(card); | 2629 | snd_card_free(card); |
2629 | return err; | 2630 | return err; |
@@ -2640,7 +2641,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2640 | 2641 | ||
2641 | /* /proc file handling */ | 2642 | /* /proc file handling */ |
2642 | snd_dbri_proc(card); | 2643 | snd_dbri_proc(card); |
2643 | dev_set_drvdata(&of_dev->dev, card); | 2644 | dev_set_drvdata(&op->dev, card); |
2644 | 2645 | ||
2645 | err = snd_card_register(card); | 2646 | err = snd_card_register(card); |
2646 | if (err < 0) | 2647 | if (err < 0) |
@@ -2648,7 +2649,7 @@ static int __devinit dbri_probe(struct of_device *of_dev, | |||
2648 | 2649 | ||
2649 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", | 2650 | printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", |
2650 | dev, dbri->regs, | 2651 | dev, dbri->regs, |
2651 | dbri->irq, sdev->prom_name[9], dbri->mm.version); | 2652 | dbri->irq, op->node->name[9], dbri->mm.version); |
2652 | dev++; | 2653 | dev++; |
2653 | 2654 | ||
2654 | return 0; | 2655 | return 0; |
@@ -2659,19 +2660,19 @@ _err: | |||
2659 | return err; | 2660 | return err; |
2660 | } | 2661 | } |
2661 | 2662 | ||
2662 | static int __devexit dbri_remove(struct of_device *dev) | 2663 | static int __devexit dbri_remove(struct of_device *op) |
2663 | { | 2664 | { |
2664 | struct snd_card *card = dev_get_drvdata(&dev->dev); | 2665 | struct snd_card *card = dev_get_drvdata(&op->dev); |
2665 | 2666 | ||
2666 | snd_dbri_free(card->private_data); | 2667 | snd_dbri_free(card->private_data); |
2667 | snd_card_free(card); | 2668 | snd_card_free(card); |
2668 | 2669 | ||
2669 | dev_set_drvdata(&dev->dev, NULL); | 2670 | dev_set_drvdata(&op->dev, NULL); |
2670 | 2671 | ||
2671 | return 0; | 2672 | return 0; |
2672 | } | 2673 | } |
2673 | 2674 | ||
2674 | static struct of_device_id dbri_match[] = { | 2675 | static const struct of_device_id dbri_match[] = { |
2675 | { | 2676 | { |
2676 | .name = "SUNW,DBRIe", | 2677 | .name = "SUNW,DBRIe", |
2677 | }, | 2678 | }, |
@@ -2693,7 +2694,7 @@ static struct of_platform_driver dbri_sbus_driver = { | |||
2693 | /* Probe for the dbri chip and then attach the driver. */ | 2694 | /* Probe for the dbri chip and then attach the driver. */ |
2694 | static int __init dbri_init(void) | 2695 | static int __init dbri_init(void) |
2695 | { | 2696 | { |
2696 | return of_register_driver(&dbri_sbus_driver, &sbus_bus_type); | 2697 | return of_register_driver(&dbri_sbus_driver, &of_bus_type); |
2697 | } | 2698 | } |
2698 | 2699 | ||
2699 | static void __exit dbri_exit(void) | 2700 | static void __exit dbri_exit(void) |