diff options
Diffstat (limited to 'sound')
154 files changed, 3586 insertions, 2825 deletions
diff --git a/sound/Kconfig b/sound/Kconfig index b65ee4701f98..d8f11408ce27 100644 --- a/sound/Kconfig +++ b/sound/Kconfig | |||
@@ -48,6 +48,14 @@ config SND | |||
48 | 48 | ||
49 | For more information, see <http://www.alsa-project.org/> | 49 | For more information, see <http://www.alsa-project.org/> |
50 | 50 | ||
51 | config SND_AC97_CODEC | ||
52 | tristate | ||
53 | select SND_PCM | ||
54 | select SND_AC97_BUS | ||
55 | |||
56 | config SND_AC97_BUS | ||
57 | tristate | ||
58 | |||
51 | source "sound/core/Kconfig" | 59 | source "sound/core/Kconfig" |
52 | 60 | ||
53 | source "sound/drivers/Kconfig" | 61 | source "sound/drivers/Kconfig" |
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 48cf45cfd0b7..82718836f937 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig | |||
@@ -127,12 +127,6 @@ config SND_DEBUG | |||
127 | help | 127 | help |
128 | Say Y here to enable ALSA debug code. | 128 | Say Y here to enable ALSA debug code. |
129 | 129 | ||
130 | config SND_DEBUG_MEMORY | ||
131 | bool "Debug memory" | ||
132 | depends on SND_DEBUG | ||
133 | help | ||
134 | Say Y here to enable debugging of memory allocations. | ||
135 | |||
136 | config SND_DEBUG_DETECT | 130 | config SND_DEBUG_DETECT |
137 | bool "Debug detection" | 131 | bool "Debug detection" |
138 | depends on SND_DEBUG | 132 | depends on SND_DEBUG |
diff --git a/sound/core/Makefile b/sound/core/Makefile index 969d75528bde..5a01c76d02e8 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile | |||
@@ -3,8 +3,7 @@ | |||
3 | # Copyright (c) 1999,2001 by Jaroslav Kysela <perex@suse.cz> | 3 | # Copyright (c) 1999,2001 by Jaroslav Kysela <perex@suse.cz> |
4 | # | 4 | # |
5 | 5 | ||
6 | snd-objs := sound.o init.o memory.o info.o control.o misc.o \ | 6 | snd-objs := sound.o init.o memory.o info.o control.o misc.o device.o |
7 | device.o wrappers.o | ||
8 | ifeq ($(CONFIG_ISA_DMA_API),y) | 7 | ifeq ($(CONFIG_ISA_DMA_API),y) |
9 | snd-objs += isadma.o | 8 | snd-objs += isadma.o |
10 | endif | 9 | endif |
diff --git a/sound/core/control.c b/sound/core/control.c index 736edf358e05..212c46a94376 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -144,7 +144,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id) | |||
144 | snd_ctl_file_t *ctl; | 144 | snd_ctl_file_t *ctl; |
145 | snd_kctl_event_t *ev; | 145 | snd_kctl_event_t *ev; |
146 | 146 | ||
147 | snd_runtime_check(card != NULL && id != NULL, return); | 147 | snd_assert(card != NULL && id != NULL, return); |
148 | read_lock(&card->ctl_files_rwlock); | 148 | read_lock(&card->ctl_files_rwlock); |
149 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) | 149 | #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) |
150 | card->mixer_oss_change_count++; | 150 | card->mixer_oss_change_count++; |
@@ -193,8 +193,8 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access) | |||
193 | snd_kcontrol_t *kctl; | 193 | snd_kcontrol_t *kctl; |
194 | unsigned int idx; | 194 | unsigned int idx; |
195 | 195 | ||
196 | snd_runtime_check(control != NULL, return NULL); | 196 | snd_assert(control != NULL, return NULL); |
197 | snd_runtime_check(control->count > 0, return NULL); | 197 | snd_assert(control->count > 0, return NULL); |
198 | kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); | 198 | kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); |
199 | if (kctl == NULL) | 199 | if (kctl == NULL) |
200 | return NULL; | 200 | return NULL; |
@@ -220,7 +220,7 @@ snd_kcontrol_t *snd_ctl_new1(const snd_kcontrol_new_t * ncontrol, void *private_ | |||
220 | snd_kcontrol_t kctl; | 220 | snd_kcontrol_t kctl; |
221 | unsigned int access; | 221 | unsigned int access; |
222 | 222 | ||
223 | snd_runtime_check(ncontrol != NULL, return NULL); | 223 | snd_assert(ncontrol != NULL, return NULL); |
224 | snd_assert(ncontrol->info != NULL, return NULL); | 224 | snd_assert(ncontrol->info != NULL, return NULL); |
225 | memset(&kctl, 0, sizeof(kctl)); | 225 | memset(&kctl, 0, sizeof(kctl)); |
226 | kctl.id.iface = ncontrol->iface; | 226 | kctl.id.iface = ncontrol->iface; |
@@ -309,7 +309,7 @@ int snd_ctl_add(snd_card_t * card, snd_kcontrol_t * kcontrol) | |||
309 | snd_ctl_elem_id_t id; | 309 | snd_ctl_elem_id_t id; |
310 | unsigned int idx; | 310 | unsigned int idx; |
311 | 311 | ||
312 | snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL); | 312 | snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); |
313 | snd_assert(kcontrol->info != NULL, return -EINVAL); | 313 | snd_assert(kcontrol->info != NULL, return -EINVAL); |
314 | id = kcontrol->id; | 314 | id = kcontrol->id; |
315 | down_write(&card->controls_rwsem); | 315 | down_write(&card->controls_rwsem); |
@@ -355,7 +355,7 @@ int snd_ctl_remove(snd_card_t * card, snd_kcontrol_t * kcontrol) | |||
355 | snd_ctl_elem_id_t id; | 355 | snd_ctl_elem_id_t id; |
356 | unsigned int idx; | 356 | unsigned int idx; |
357 | 357 | ||
358 | snd_runtime_check(card != NULL && kcontrol != NULL, return -EINVAL); | 358 | snd_assert(card != NULL && kcontrol != NULL, return -EINVAL); |
359 | list_del(&kcontrol->list); | 359 | list_del(&kcontrol->list); |
360 | card->controls_count -= kcontrol->count; | 360 | card->controls_count -= kcontrol->count; |
361 | id = kcontrol->id; | 361 | id = kcontrol->id; |
@@ -468,7 +468,7 @@ snd_kcontrol_t *snd_ctl_find_numid(snd_card_t * card, unsigned int numid) | |||
468 | struct list_head *list; | 468 | struct list_head *list; |
469 | snd_kcontrol_t *kctl; | 469 | snd_kcontrol_t *kctl; |
470 | 470 | ||
471 | snd_runtime_check(card != NULL && numid != 0, return NULL); | 471 | snd_assert(card != NULL && numid != 0, return NULL); |
472 | list_for_each(list, &card->controls) { | 472 | list_for_each(list, &card->controls) { |
473 | kctl = snd_kcontrol(list); | 473 | kctl = snd_kcontrol(list); |
474 | if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) | 474 | if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid) |
@@ -494,7 +494,7 @@ snd_kcontrol_t *snd_ctl_find_id(snd_card_t * card, snd_ctl_elem_id_t *id) | |||
494 | struct list_head *list; | 494 | struct list_head *list; |
495 | snd_kcontrol_t *kctl; | 495 | snd_kcontrol_t *kctl; |
496 | 496 | ||
497 | snd_runtime_check(card != NULL && id != NULL, return NULL); | 497 | snd_assert(card != NULL && id != NULL, return NULL); |
498 | if (id->numid != 0) | 498 | if (id->numid != 0) |
499 | return snd_ctl_find_numid(card, id->numid); | 499 | return snd_ctl_find_numid(card, id->numid); |
500 | list_for_each(list, &card->controls) { | 500 | list_for_each(list, &card->controls) { |
@@ -1215,7 +1215,7 @@ static int _snd_ctl_unregister_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head | |||
1215 | struct list_head *list; | 1215 | struct list_head *list; |
1216 | snd_kctl_ioctl_t *p; | 1216 | snd_kctl_ioctl_t *p; |
1217 | 1217 | ||
1218 | snd_runtime_check(fcn != NULL, return -EINVAL); | 1218 | snd_assert(fcn != NULL, return -EINVAL); |
1219 | down_write(&snd_ioctl_rwsem); | 1219 | down_write(&snd_ioctl_rwsem); |
1220 | list_for_each(list, lists) { | 1220 | list_for_each(list, lists) { |
1221 | p = list_entry(list, snd_kctl_ioctl_t, list); | 1221 | p = list_entry(list, snd_kctl_ioctl_t, list); |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 9383f1294fb5..e91cee35a4b9 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -81,20 +81,16 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
81 | int err; | 81 | int err; |
82 | wait_queue_t wait; | 82 | wait_queue_t wait; |
83 | 83 | ||
84 | switch (major) { | 84 | if (major == snd_major) { |
85 | case CONFIG_SND_MAJOR: | ||
86 | cardnum = SNDRV_MINOR_CARD(iminor(inode)); | 85 | cardnum = SNDRV_MINOR_CARD(iminor(inode)); |
87 | device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP; | 86 | device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_HWDEP; |
88 | break; | ||
89 | #ifdef CONFIG_SND_OSSEMUL | 87 | #ifdef CONFIG_SND_OSSEMUL |
90 | case SOUND_MAJOR: | 88 | } else if (major == SOUND_MAJOR) { |
91 | cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode)); | 89 | cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode)); |
92 | device = 0; | 90 | device = 0; |
93 | break; | ||
94 | #endif | 91 | #endif |
95 | default: | 92 | } else |
96 | return -ENXIO; | 93 | return -ENXIO; |
97 | } | ||
98 | cardnum %= SNDRV_CARDS; | 94 | cardnum %= SNDRV_CARDS; |
99 | device %= SNDRV_MINOR_HWDEPS; | 95 | device %= SNDRV_MINOR_HWDEPS; |
100 | hw = snd_hwdep_devices[(cardnum * SNDRV_MINOR_HWDEPS) + device]; | 96 | hw = snd_hwdep_devices[(cardnum * SNDRV_MINOR_HWDEPS) + device]; |
diff --git a/sound/core/info.c b/sound/core/info.c index 37024d68a26e..39f9b97d9219 100644 --- a/sound/core/info.c +++ b/sound/core/info.c | |||
@@ -566,7 +566,6 @@ int __init snd_info_init(void) | |||
566 | } | 566 | } |
567 | #endif | 567 | #endif |
568 | snd_info_version_init(); | 568 | snd_info_version_init(); |
569 | snd_memory_info_init(); | ||
570 | snd_minor_info_init(); | 569 | snd_minor_info_init(); |
571 | snd_minor_info_oss_init(); | 570 | snd_minor_info_oss_init(); |
572 | snd_card_info_init(); | 571 | snd_card_info_init(); |
@@ -578,7 +577,6 @@ int __exit snd_info_done(void) | |||
578 | snd_card_info_done(); | 577 | snd_card_info_done(); |
579 | snd_minor_info_oss_done(); | 578 | snd_minor_info_oss_done(); |
580 | snd_minor_info_done(); | 579 | snd_minor_info_done(); |
581 | snd_memory_info_done(); | ||
582 | snd_info_version_done(); | 580 | snd_info_version_done(); |
583 | if (snd_proc_root) { | 581 | if (snd_proc_root) { |
584 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) | 582 | #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) |
diff --git a/sound/core/init.c b/sound/core/init.c index 41e224986f35..d9ee27ae9a51 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -420,7 +420,7 @@ int snd_card_register(snd_card_t * card) | |||
420 | int err; | 420 | int err; |
421 | snd_info_entry_t *entry; | 421 | snd_info_entry_t *entry; |
422 | 422 | ||
423 | snd_runtime_check(card != NULL, return -EINVAL); | 423 | snd_assert(card != NULL, return -EINVAL); |
424 | if ((err = snd_device_register_all(card)) < 0) | 424 | if ((err = snd_device_register_all(card)) < 0) |
425 | return err; | 425 | return err; |
426 | write_lock(&snd_card_rwlock); | 426 | write_lock(&snd_card_rwlock); |
@@ -524,7 +524,8 @@ int __init snd_card_info_init(void) | |||
524 | snd_info_entry_t *entry; | 524 | snd_info_entry_t *entry; |
525 | 525 | ||
526 | entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL); | 526 | entry = snd_info_create_module_entry(THIS_MODULE, "cards", NULL); |
527 | snd_runtime_check(entry != NULL, return -ENOMEM); | 527 | if (! entry) |
528 | return -ENOMEM; | ||
528 | entry->c.text.read_size = PAGE_SIZE; | 529 | entry->c.text.read_size = PAGE_SIZE; |
529 | entry->c.text.read = snd_card_info_read; | 530 | entry->c.text.read = snd_card_info_read; |
530 | if (snd_info_register(entry) < 0) { | 531 | if (snd_info_register(entry) < 0) { |
@@ -840,7 +841,7 @@ static int snd_generic_resume(struct device *dev) | |||
840 | card = get_snd_generic_card(dev); | 841 | card = get_snd_generic_card(dev); |
841 | if (card->power_state == SNDRV_CTL_POWER_D0) | 842 | if (card->power_state == SNDRV_CTL_POWER_D0) |
842 | return 0; | 843 | return 0; |
843 | if (card->pm_suspend) | 844 | if (card->pm_resume) |
844 | card->pm_resume(card); | 845 | card->pm_resume(card); |
845 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 846 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
846 | return 0; | 847 | return 0; |
diff --git a/sound/core/memory.c b/sound/core/memory.c index 7d8e2eebba51..862d62d2e144 100644 --- a/sound/core/memory.c +++ b/sound/core/memory.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | 2 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> |
3 | * | 3 | * |
4 | * Memory allocation helpers. | 4 | * Misc memory accessors |
5 | * | 5 | * |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -20,221 +20,9 @@ | |||
20 | * | 20 | * |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <sound/driver.h> | 23 | #include <linux/config.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <linux/init.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/time.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <sound/core.h> | ||
31 | #include <sound/info.h> | ||
32 | |||
33 | /* | ||
34 | * memory allocation helpers and debug routines | ||
35 | */ | ||
36 | |||
37 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
38 | |||
39 | struct snd_alloc_track { | ||
40 | unsigned long magic; | ||
41 | void *caller; | ||
42 | size_t size; | ||
43 | struct list_head list; | ||
44 | long data[0]; | ||
45 | }; | ||
46 | |||
47 | #define snd_alloc_track_entry(obj) (struct snd_alloc_track *)((char*)obj - (unsigned long)((struct snd_alloc_track *)0)->data) | ||
48 | |||
49 | static long snd_alloc_kmalloc; | ||
50 | static long snd_alloc_vmalloc; | ||
51 | static LIST_HEAD(snd_alloc_kmalloc_list); | ||
52 | static LIST_HEAD(snd_alloc_vmalloc_list); | ||
53 | static DEFINE_SPINLOCK(snd_alloc_kmalloc_lock); | ||
54 | static DEFINE_SPINLOCK(snd_alloc_vmalloc_lock); | ||
55 | #define KMALLOC_MAGIC 0x87654321 | ||
56 | #define VMALLOC_MAGIC 0x87654320 | ||
57 | static snd_info_entry_t *snd_memory_info_entry; | ||
58 | |||
59 | void __init snd_memory_init(void) | ||
60 | { | ||
61 | snd_alloc_kmalloc = 0; | ||
62 | snd_alloc_vmalloc = 0; | ||
63 | } | ||
64 | |||
65 | void snd_memory_done(void) | ||
66 | { | ||
67 | struct list_head *head; | ||
68 | struct snd_alloc_track *t; | ||
69 | |||
70 | if (snd_alloc_kmalloc > 0) | ||
71 | snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc); | ||
72 | if (snd_alloc_vmalloc > 0) | ||
73 | snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc); | ||
74 | list_for_each_prev(head, &snd_alloc_kmalloc_list) { | ||
75 | t = list_entry(head, struct snd_alloc_track, list); | ||
76 | if (t->magic != KMALLOC_MAGIC) { | ||
77 | snd_printk(KERN_ERR "Corrupted kmalloc\n"); | ||
78 | break; | ||
79 | } | ||
80 | snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); | ||
81 | } | ||
82 | list_for_each_prev(head, &snd_alloc_vmalloc_list) { | ||
83 | t = list_entry(head, struct snd_alloc_track, list); | ||
84 | if (t->magic != VMALLOC_MAGIC) { | ||
85 | snd_printk(KERN_ERR "Corrupted vmalloc\n"); | ||
86 | break; | ||
87 | } | ||
88 | snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | static void *__snd_kmalloc(size_t size, gfp_t flags, void *caller) | ||
93 | { | ||
94 | unsigned long cpu_flags; | ||
95 | struct snd_alloc_track *t; | ||
96 | void *ptr; | ||
97 | |||
98 | ptr = snd_wrapper_kmalloc(size + sizeof(struct snd_alloc_track), flags); | ||
99 | if (ptr != NULL) { | ||
100 | t = (struct snd_alloc_track *)ptr; | ||
101 | t->magic = KMALLOC_MAGIC; | ||
102 | t->caller = caller; | ||
103 | spin_lock_irqsave(&snd_alloc_kmalloc_lock, cpu_flags); | ||
104 | list_add_tail(&t->list, &snd_alloc_kmalloc_list); | ||
105 | spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, cpu_flags); | ||
106 | t->size = size; | ||
107 | snd_alloc_kmalloc += size; | ||
108 | ptr = t->data; | ||
109 | } | ||
110 | return ptr; | ||
111 | } | ||
112 | |||
113 | #define _snd_kmalloc(size, flags) __snd_kmalloc((size), (flags), __builtin_return_address(0)); | ||
114 | void *snd_hidden_kmalloc(size_t size, gfp_t flags) | ||
115 | { | ||
116 | return _snd_kmalloc(size, flags); | ||
117 | } | ||
118 | |||
119 | void *snd_hidden_kzalloc(size_t size, gfp_t flags) | ||
120 | { | ||
121 | void *ret = _snd_kmalloc(size, flags); | ||
122 | if (ret) | ||
123 | memset(ret, 0, size); | ||
124 | return ret; | ||
125 | } | ||
126 | EXPORT_SYMBOL(snd_hidden_kzalloc); | ||
127 | |||
128 | void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags) | ||
129 | { | ||
130 | void *ret = NULL; | ||
131 | if (n != 0 && size > INT_MAX / n) | ||
132 | return ret; | ||
133 | return snd_hidden_kzalloc(n * size, flags); | ||
134 | } | ||
135 | |||
136 | void snd_hidden_kfree(const void *obj) | ||
137 | { | ||
138 | unsigned long flags; | ||
139 | struct snd_alloc_track *t; | ||
140 | if (obj == NULL) | ||
141 | return; | ||
142 | t = snd_alloc_track_entry(obj); | ||
143 | if (t->magic != KMALLOC_MAGIC) { | ||
144 | snd_printk(KERN_WARNING "bad kfree (called from %p)\n", __builtin_return_address(0)); | ||
145 | return; | ||
146 | } | ||
147 | spin_lock_irqsave(&snd_alloc_kmalloc_lock, flags); | ||
148 | list_del(&t->list); | ||
149 | spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, flags); | ||
150 | t->magic = 0; | ||
151 | snd_alloc_kmalloc -= t->size; | ||
152 | obj = t; | ||
153 | snd_wrapper_kfree(obj); | ||
154 | } | ||
155 | |||
156 | void *snd_hidden_vmalloc(unsigned long size) | ||
157 | { | ||
158 | void *ptr; | ||
159 | ptr = snd_wrapper_vmalloc(size + sizeof(struct snd_alloc_track)); | ||
160 | if (ptr) { | ||
161 | struct snd_alloc_track *t = (struct snd_alloc_track *)ptr; | ||
162 | t->magic = VMALLOC_MAGIC; | ||
163 | t->caller = __builtin_return_address(0); | ||
164 | spin_lock(&snd_alloc_vmalloc_lock); | ||
165 | list_add_tail(&t->list, &snd_alloc_vmalloc_list); | ||
166 | spin_unlock(&snd_alloc_vmalloc_lock); | ||
167 | t->size = size; | ||
168 | snd_alloc_vmalloc += size; | ||
169 | ptr = t->data; | ||
170 | } | ||
171 | return ptr; | ||
172 | } | ||
173 | |||
174 | void snd_hidden_vfree(void *obj) | ||
175 | { | ||
176 | struct snd_alloc_track *t; | ||
177 | if (obj == NULL) | ||
178 | return; | ||
179 | t = snd_alloc_track_entry(obj); | ||
180 | if (t->magic != VMALLOC_MAGIC) { | ||
181 | snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0)); | ||
182 | return; | ||
183 | } | ||
184 | spin_lock(&snd_alloc_vmalloc_lock); | ||
185 | list_del(&t->list); | ||
186 | spin_unlock(&snd_alloc_vmalloc_lock); | ||
187 | t->magic = 0; | ||
188 | snd_alloc_vmalloc -= t->size; | ||
189 | obj = t; | ||
190 | snd_wrapper_vfree(obj); | ||
191 | } | ||
192 | |||
193 | char *snd_hidden_kstrdup(const char *s, gfp_t flags) | ||
194 | { | ||
195 | int len; | ||
196 | char *buf; | ||
197 | |||
198 | if (!s) return NULL; | ||
199 | |||
200 | len = strlen(s) + 1; | ||
201 | buf = _snd_kmalloc(len, flags); | ||
202 | if (buf) | ||
203 | memcpy(buf, s, len); | ||
204 | return buf; | ||
205 | } | ||
206 | |||
207 | static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) | ||
208 | { | ||
209 | snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc); | ||
210 | snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc); | ||
211 | } | ||
212 | |||
213 | int __init snd_memory_info_init(void) | ||
214 | { | ||
215 | snd_info_entry_t *entry; | ||
216 | |||
217 | entry = snd_info_create_module_entry(THIS_MODULE, "meminfo", NULL); | ||
218 | if (entry) { | ||
219 | entry->c.text.read_size = 256; | ||
220 | entry->c.text.read = snd_memory_info_read; | ||
221 | if (snd_info_register(entry) < 0) { | ||
222 | snd_info_free_entry(entry); | ||
223 | entry = NULL; | ||
224 | } | ||
225 | } | ||
226 | snd_memory_info_entry = entry; | ||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | int __exit snd_memory_info_done(void) | ||
231 | { | ||
232 | if (snd_memory_info_entry) | ||
233 | snd_info_unregister(snd_memory_info_entry); | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | #endif /* CONFIG_SND_DEBUG_MEMORY */ | ||
238 | 26 | ||
239 | /** | 27 | /** |
240 | * copy_to_user_fromio - copy data from mmio-space to user-space | 28 | * copy_to_user_fromio - copy data from mmio-space to user-space |
diff --git a/sound/core/misc.c b/sound/core/misc.c index 1a81fe4df218..b53e563c09e6 100644 --- a/sound/core/misc.c +++ b/sound/core/misc.c | |||
@@ -23,17 +23,15 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/ioport.h> | ||
26 | #include <sound/core.h> | 27 | #include <sound/core.h> |
27 | 28 | ||
28 | int snd_task_name(struct task_struct *task, char *name, size_t size) | 29 | void release_and_free_resource(struct resource *res) |
29 | { | 30 | { |
30 | unsigned int idx; | 31 | if (res) { |
31 | 32 | release_resource(res); | |
32 | snd_assert(task != NULL && name != NULL && size >= 2, return -EINVAL); | 33 | kfree(res); |
33 | for (idx = 0; idx < sizeof(task->comm) && idx + 1 < size; idx++) | 34 | } |
34 | name[idx] = task->comm[idx]; | ||
35 | name[idx] = '\0'; | ||
36 | return 0; | ||
37 | } | 35 | } |
38 | 36 | ||
39 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 37 | #ifdef CONFIG_SND_VERBOSE_PRINTK |
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 69e1059112d1..214933cf5d49 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -521,9 +521,13 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
521 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 521 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
522 | if (uinfo == NULL || uctl == NULL) | 522 | if (uinfo == NULL || uctl == NULL) |
523 | goto __unalloc; | 523 | goto __unalloc; |
524 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 524 | if (kctl->info(kctl, uinfo)) |
525 | snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); | 525 | goto __unalloc; |
526 | snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); | 526 | if (kctl->get(kctl, uctl)) |
527 | goto __unalloc; | ||
528 | if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN && | ||
529 | uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1) | ||
530 | goto __unalloc; | ||
527 | *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]); | 531 | *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]); |
528 | if (uinfo->count > 1) | 532 | if (uinfo->count > 1) |
529 | *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]); | 533 | *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]); |
@@ -555,8 +559,10 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
555 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 559 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
556 | if (uinfo == NULL || uctl == NULL) | 560 | if (uinfo == NULL || uctl == NULL) |
557 | goto __unalloc; | 561 | goto __unalloc; |
558 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 562 | if (kctl->info(kctl, uinfo)) |
559 | snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); | 563 | goto __unalloc; |
564 | if (kctl->get(kctl, uctl)) | ||
565 | goto __unalloc; | ||
560 | if (!uctl->value.integer.value[0]) { | 566 | if (!uctl->value.integer.value[0]) { |
561 | *left = 0; | 567 | *left = 0; |
562 | if (uinfo->count == 1) | 568 | if (uinfo->count == 1) |
@@ -616,12 +622,16 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer, | |||
616 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 622 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
617 | if (uinfo == NULL || uctl == NULL) | 623 | if (uinfo == NULL || uctl == NULL) |
618 | goto __unalloc; | 624 | goto __unalloc; |
619 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 625 | if (kctl->info(kctl, uinfo)) |
620 | snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); | 626 | goto __unalloc; |
627 | if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN && | ||
628 | uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1) | ||
629 | goto __unalloc; | ||
621 | uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max); | 630 | uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max); |
622 | if (uinfo->count > 1) | 631 | if (uinfo->count > 1) |
623 | uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max); | 632 | uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max); |
624 | snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); | 633 | if ((res = kctl->put(kctl, uctl)) < 0) |
634 | goto __unalloc; | ||
625 | if (res > 0) | 635 | if (res > 0) |
626 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 636 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
627 | __unalloc: | 637 | __unalloc: |
@@ -653,7 +663,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
653 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | 663 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
654 | if (uinfo == NULL || uctl == NULL) | 664 | if (uinfo == NULL || uctl == NULL) |
655 | goto __unalloc; | 665 | goto __unalloc; |
656 | snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); | 666 | if (kctl->info(kctl, uinfo)) |
667 | goto __unalloc; | ||
657 | if (uinfo->count > 1) { | 668 | if (uinfo->count > 1) { |
658 | uctl->value.integer.value[0] = left > 0 ? 1 : 0; | 669 | uctl->value.integer.value[0] = left > 0 ? 1 : 0; |
659 | uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0; | 670 | uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0; |
@@ -664,7 +675,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer, | |||
664 | } else { | 675 | } else { |
665 | uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0; | 676 | uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0; |
666 | } | 677 | } |
667 | snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); | 678 | if ((res = kctl->put(kctl, uctl)) < 0) |
679 | goto __unalloc; | ||
668 | if (res > 0) | 680 | if (res > 0) |
669 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 681 | snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
670 | __unalloc: | 682 | __unalloc: |
@@ -776,9 +788,14 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
776 | } | 788 | } |
777 | down_read(&card->controls_rwsem); | 789 | down_read(&card->controls_rwsem); |
778 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 790 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
779 | snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); | 791 | if (! kctl) { |
780 | snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); | 792 | err = -ENOENT; |
781 | snd_runtime_check(!(err = kctl->get(kctl, uctl)), goto __unlock); | 793 | goto __unlock; |
794 | } | ||
795 | if ((err = kctl->info(kctl, uinfo)) < 0) | ||
796 | goto __unlock; | ||
797 | if ((err = kctl->get(kctl, uctl)) < 0) | ||
798 | goto __unlock; | ||
782 | for (idx = 0; idx < 32; idx++) { | 799 | for (idx = 0; idx < 32; idx++) { |
783 | if (!(mixer->mask_recsrc & (1 << idx))) | 800 | if (!(mixer->mask_recsrc & (1 << idx))) |
784 | continue; | 801 | continue; |
@@ -821,8 +838,12 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
821 | } | 838 | } |
822 | down_read(&card->controls_rwsem); | 839 | down_read(&card->controls_rwsem); |
823 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); | 840 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
824 | snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); | 841 | if (! kctl) { |
825 | snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); | 842 | err = -ENOENT; |
843 | goto __unlock; | ||
844 | } | ||
845 | if ((err = kctl->info(kctl, uinfo)) < 0) | ||
846 | goto __unlock; | ||
826 | for (idx = 0; idx < 32; idx++) { | 847 | for (idx = 0; idx < 32; idx++) { |
827 | if (!(mixer->mask_recsrc & (1 << idx))) | 848 | if (!(mixer->mask_recsrc & (1 << idx))) |
828 | continue; | 849 | continue; |
@@ -836,10 +857,11 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int | |||
836 | break; | 857 | break; |
837 | slot = NULL; | 858 | slot = NULL; |
838 | } | 859 | } |
839 | snd_runtime_check(slot != NULL, goto __unlock); | 860 | if (! slot) |
861 | goto __unlock; | ||
840 | for (idx = 0; idx < uinfo->count; idx++) | 862 | for (idx = 0; idx < uinfo->count; idx++) |
841 | uctl->value.enumerated.item[idx] = slot->capture_item; | 863 | uctl->value.enumerated.item[idx] = slot->capture_item; |
842 | snd_runtime_check((err = kctl->put(kctl, uctl)) >= 0, ); | 864 | err = kctl->put(kctl, uctl); |
843 | if (err > 0) | 865 | if (err > 0) |
844 | snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); | 866 | snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); |
845 | err = 0; | 867 | err = 0; |
@@ -1008,7 +1030,8 @@ static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_os | |||
1008 | up_read(&mixer->card->controls_rwsem); | 1030 | up_read(&mixer->card->controls_rwsem); |
1009 | if (slot.present != 0) { | 1031 | if (slot.present != 0) { |
1010 | pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); | 1032 | pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); |
1011 | snd_runtime_check(pslot != NULL, return -ENOMEM); | 1033 | if (! pslot) |
1034 | return -ENOMEM; | ||
1012 | *pslot = slot; | 1035 | *pslot = slot; |
1013 | pslot->signature = SNDRV_MIXER_OSS_SIGNATURE; | 1036 | pslot->signature = SNDRV_MIXER_OSS_SIGNATURE; |
1014 | pslot->assigned = ptr; | 1037 | pslot->assigned = ptr; |
@@ -1271,7 +1294,8 @@ static int snd_mixer_oss_notify_handler(snd_card_t * card, int cmd) | |||
1271 | card, 0, | 1294 | card, 0, |
1272 | &snd_mixer_oss_reg, | 1295 | &snd_mixer_oss_reg, |
1273 | name)) < 0) { | 1296 | name)) < 0) { |
1274 | snd_printk("unable to register OSS mixer device %i:%i\n", card->number, 0); | 1297 | snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n", |
1298 | card->number, 0); | ||
1275 | kfree(mixer); | 1299 | kfree(mixer); |
1276 | return err; | 1300 | return err; |
1277 | } | 1301 | } |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 842c28b2ed55..bcc970759134 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -1821,6 +1821,17 @@ static int snd_pcm_oss_open_file(struct file *file, | |||
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | 1823 | ||
1824 | static int snd_task_name(struct task_struct *task, char *name, size_t size) | ||
1825 | { | ||
1826 | unsigned int idx; | ||
1827 | |||
1828 | snd_assert(task != NULL && name != NULL && size >= 2, return -EINVAL); | ||
1829 | for (idx = 0; idx < sizeof(task->comm) && idx + 1 < size; idx++) | ||
1830 | name[idx] = task->comm[idx]; | ||
1831 | name[idx] = '\0'; | ||
1832 | return 0; | ||
1833 | } | ||
1834 | |||
1824 | static int snd_pcm_oss_open(struct inode *inode, struct file *file) | 1835 | static int snd_pcm_oss_open(struct inode *inode, struct file *file) |
1825 | { | 1836 | { |
1826 | int minor = iminor(inode); | 1837 | int minor = iminor(inode); |
@@ -2446,7 +2457,8 @@ static void register_oss_dsp(snd_pcm_t *pcm, int index) | |||
2446 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, | 2457 | if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM, |
2447 | pcm->card, index, &snd_pcm_oss_reg, | 2458 | pcm->card, index, &snd_pcm_oss_reg, |
2448 | name) < 0) { | 2459 | name) < 0) { |
2449 | snd_printk("unable to register OSS PCM device %i:%i\n", pcm->card->number, pcm->device); | 2460 | snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n", |
2461 | pcm->card->number, pcm->device); | ||
2450 | } | 2462 | } |
2451 | } | 2463 | } |
2452 | 2464 | ||
@@ -2528,11 +2540,13 @@ static int __init alsa_pcm_oss_init(void) | |||
2528 | /* check device map table */ | 2540 | /* check device map table */ |
2529 | for (i = 0; i < SNDRV_CARDS; i++) { | 2541 | for (i = 0; i < SNDRV_CARDS; i++) { |
2530 | if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { | 2542 | if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) { |
2531 | snd_printk("invalid dsp_map[%d] = %d\n", i, dsp_map[i]); | 2543 | snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n", |
2544 | i, dsp_map[i]); | ||
2532 | dsp_map[i] = 0; | 2545 | dsp_map[i] = 0; |
2533 | } | 2546 | } |
2534 | if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { | 2547 | if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) { |
2535 | snd_printk("invalid adsp_map[%d] = %d\n", i, adsp_map[i]); | 2548 | snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n", |
2549 | i, adsp_map[i]); | ||
2536 | adsp_map[i] = 1; | 2550 | adsp_map[i] = 1; |
2537 | } | 2551 | } |
2538 | } | 2552 | } |
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 1be470e942ef..184e74b75ba9 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -273,7 +273,8 @@ static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buff | |||
273 | snd_pcm_info_t *info; | 273 | snd_pcm_info_t *info; |
274 | int err; | 274 | int err; |
275 | 275 | ||
276 | snd_runtime_check(substream, return); | 276 | if (! substream) |
277 | return; | ||
277 | 278 | ||
278 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 279 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
279 | if (! info) { | 280 | if (! info) { |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 0503980c23d9..3dbf9bf2ac16 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -152,13 +152,12 @@ static inline snd_pcm_uframes_t snd_pcm_update_hw_ptr_pos(snd_pcm_substream_t *s | |||
152 | if (pos == SNDRV_PCM_POS_XRUN) | 152 | if (pos == SNDRV_PCM_POS_XRUN) |
153 | return pos; /* XRUN */ | 153 | return pos; /* XRUN */ |
154 | if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP) | 154 | if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP) |
155 | snd_timestamp_now((snd_timestamp_t*)&runtime->status->tstamp, runtime->tstamp_timespec); | 155 | getnstimeofday((struct timespec *)&runtime->status->tstamp); |
156 | #ifdef CONFIG_SND_DEBUG | 156 | #ifdef CONFIG_SND_DEBUG |
157 | if (pos >= runtime->buffer_size) { | 157 | if (pos >= runtime->buffer_size) { |
158 | snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); | 158 | snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size); |
159 | } else | 159 | } |
160 | #endif | 160 | #endif |
161 | snd_runtime_check(pos < runtime->buffer_size, return 0); | ||
162 | pos -= pos % runtime->min_align; | 161 | pos -= pos % runtime->min_align; |
163 | return pos; | 162 | return pos; |
164 | } | 163 | } |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index e97b2d162cc7..16e252f54954 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -565,9 +565,9 @@ int snd_pcm_status(snd_pcm_substream_t *substream, | |||
565 | if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP) | 565 | if (runtime->tstamp_mode & SNDRV_PCM_TSTAMP_MMAP) |
566 | status->tstamp = runtime->status->tstamp; | 566 | status->tstamp = runtime->status->tstamp; |
567 | else | 567 | else |
568 | snd_timestamp_now(&status->tstamp, runtime->tstamp_timespec); | 568 | getnstimeofday(&status->tstamp); |
569 | } else | 569 | } else |
570 | snd_timestamp_now(&status->tstamp, runtime->tstamp_timespec); | 570 | getnstimeofday(&status->tstamp); |
571 | status->appl_ptr = runtime->control->appl_ptr; | 571 | status->appl_ptr = runtime->control->appl_ptr; |
572 | status->hw_ptr = runtime->status->hw_ptr; | 572 | status->hw_ptr = runtime->status->hw_ptr; |
573 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 573 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
@@ -652,7 +652,7 @@ static void snd_pcm_trigger_tstamp(snd_pcm_substream_t *substream) | |||
652 | if (runtime->trigger_master == NULL) | 652 | if (runtime->trigger_master == NULL) |
653 | return; | 653 | return; |
654 | if (runtime->trigger_master == substream) { | 654 | if (runtime->trigger_master == substream) { |
655 | snd_timestamp_now(&runtime->trigger_tstamp, runtime->tstamp_timespec); | 655 | getnstimeofday(&runtime->trigger_tstamp); |
656 | } else { | 656 | } else { |
657 | snd_pcm_trigger_tstamp(runtime->trigger_master); | 657 | snd_pcm_trigger_tstamp(runtime->trigger_master); |
658 | runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; | 658 | runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; |
@@ -1522,7 +1522,6 @@ static int snd_pcm_drop(snd_pcm_substream_t *substream) | |||
1522 | 1522 | ||
1523 | 1523 | ||
1524 | /* WARNING: Don't forget to fput back the file */ | 1524 | /* WARNING: Don't forget to fput back the file */ |
1525 | extern int snd_major; | ||
1526 | static struct file *snd_pcm_file_fd(int fd) | 1525 | static struct file *snd_pcm_file_fd(int fd) |
1527 | { | 1526 | { |
1528 | struct file *file; | 1527 | struct file *file; |
@@ -2053,7 +2052,8 @@ static int snd_pcm_open(struct inode *inode, struct file *file) | |||
2053 | snd_pcm_file_t *pcm_file; | 2052 | snd_pcm_file_t *pcm_file; |
2054 | wait_queue_t wait; | 2053 | wait_queue_t wait; |
2055 | 2054 | ||
2056 | snd_runtime_check(device >= SNDRV_MINOR_PCM_PLAYBACK && device < SNDRV_MINOR_DEVICES, return -ENXIO); | 2055 | if (device < SNDRV_MINOR_PCM_PLAYBACK || device >= SNDRV_MINOR_DEVICES) |
2056 | return -ENXIO; | ||
2057 | pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device % SNDRV_MINOR_PCMS)]; | 2057 | pcm = snd_pcm_devices[(cardnum * SNDRV_PCM_DEVICES) + (device % SNDRV_MINOR_PCMS)]; |
2058 | if (pcm == NULL) { | 2058 | if (pcm == NULL) { |
2059 | err = -ENODEV; | 2059 | err = -ENODEV; |
@@ -2445,14 +2445,8 @@ static int snd_pcm_common_ioctl1(snd_pcm_substream_t *substream, | |||
2445 | return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; | 2445 | return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; |
2446 | case SNDRV_PCM_IOCTL_INFO: | 2446 | case SNDRV_PCM_IOCTL_INFO: |
2447 | return snd_pcm_info_user(substream, arg); | 2447 | return snd_pcm_info_user(substream, arg); |
2448 | case SNDRV_PCM_IOCTL_TSTAMP: | 2448 | case SNDRV_PCM_IOCTL_TSTAMP: /* just for compatibility */ |
2449 | { | ||
2450 | int xarg; | ||
2451 | if (get_user(xarg, (int __user *)arg)) | ||
2452 | return -EFAULT; | ||
2453 | substream->runtime->tstamp_timespec = xarg ? 1 : 0; | ||
2454 | return 0; | 2449 | return 0; |
2455 | } | ||
2456 | case SNDRV_PCM_IOCTL_HW_REFINE: | 2450 | case SNDRV_PCM_IOCTL_HW_REFINE: |
2457 | return snd_pcm_hw_refine_user(substream, arg); | 2451 | return snd_pcm_hw_refine_user(substream, arg); |
2458 | case SNDRV_PCM_IOCTL_HW_PARAMS: | 2452 | case SNDRV_PCM_IOCTL_HW_PARAMS: |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 7c20eafecb8a..d033e61c05c7 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -378,24 +378,20 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
378 | struct list_head *list; | 378 | struct list_head *list; |
379 | snd_ctl_file_t *kctl; | 379 | snd_ctl_file_t *kctl; |
380 | 380 | ||
381 | switch (maj) { | 381 | if (maj == snd_major) { |
382 | case CONFIG_SND_MAJOR: | ||
383 | cardnum = SNDRV_MINOR_CARD(iminor(inode)); | 382 | cardnum = SNDRV_MINOR_CARD(iminor(inode)); |
384 | cardnum %= SNDRV_CARDS; | 383 | cardnum %= SNDRV_CARDS; |
385 | device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_RAWMIDI; | 384 | device = SNDRV_MINOR_DEVICE(iminor(inode)) - SNDRV_MINOR_RAWMIDI; |
386 | device %= SNDRV_MINOR_RAWMIDIS; | 385 | device %= SNDRV_MINOR_RAWMIDIS; |
387 | break; | ||
388 | #ifdef CONFIG_SND_OSSEMUL | 386 | #ifdef CONFIG_SND_OSSEMUL |
389 | case SOUND_MAJOR: | 387 | } else if (maj == SOUND_MAJOR) { |
390 | cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode)); | 388 | cardnum = SNDRV_MINOR_OSS_CARD(iminor(inode)); |
391 | cardnum %= SNDRV_CARDS; | 389 | cardnum %= SNDRV_CARDS; |
392 | device = SNDRV_MINOR_OSS_DEVICE(iminor(inode)) == SNDRV_MINOR_OSS_MIDI ? | 390 | device = SNDRV_MINOR_OSS_DEVICE(iminor(inode)) == SNDRV_MINOR_OSS_MIDI ? |
393 | midi_map[cardnum] : amidi_map[cardnum]; | 391 | midi_map[cardnum] : amidi_map[cardnum]; |
394 | break; | ||
395 | #endif | 392 | #endif |
396 | default: | 393 | } else |
397 | return -ENXIO; | 394 | return -ENXIO; |
398 | } | ||
399 | 395 | ||
400 | rmidi = snd_rawmidi_devices[(cardnum * SNDRV_RAWMIDI_DEVICES) + device]; | 396 | rmidi = snd_rawmidi_devices[(cardnum * SNDRV_RAWMIDI_DEVICES) + device]; |
401 | if (rmidi == NULL) | 397 | if (rmidi == NULL) |
@@ -411,7 +407,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
411 | if (err < 0) | 407 | if (err < 0) |
412 | return -ENODEV; | 408 | return -ENODEV; |
413 | fflags = snd_rawmidi_file_flags(file); | 409 | fflags = snd_rawmidi_file_flags(file); |
414 | if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */ | 410 | if ((file->f_flags & O_APPEND) || maj == SOUND_MAJOR) /* OSS emul? */ |
415 | fflags |= SNDRV_RAWMIDI_LFLG_APPEND; | 411 | fflags |= SNDRV_RAWMIDI_LFLG_APPEND; |
416 | fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK; | 412 | fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK; |
417 | rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL); | 413 | rawmidi_file = kmalloc(sizeof(*rawmidi_file), GFP_KERNEL); |
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c index bd5d584d284d..c3c18568207e 100644 --- a/sound/core/rtctimer.c +++ b/sound/core/rtctimer.c | |||
@@ -60,7 +60,6 @@ static struct _snd_timer_hardware rtc_hw = { | |||
60 | 60 | ||
61 | static int rtctimer_freq = RTC_FREQ; /* frequency */ | 61 | static int rtctimer_freq = RTC_FREQ; /* frequency */ |
62 | static snd_timer_t *rtctimer; | 62 | static snd_timer_t *rtctimer; |
63 | static atomic_t rtc_inc = ATOMIC_INIT(0); | ||
64 | static rtc_task_t rtc_task; | 63 | static rtc_task_t rtc_task; |
65 | 64 | ||
66 | 65 | ||
@@ -94,7 +93,6 @@ rtctimer_start(snd_timer_t *timer) | |||
94 | snd_assert(rtc != NULL, return -EINVAL); | 93 | snd_assert(rtc != NULL, return -EINVAL); |
95 | rtc_control(rtc, RTC_IRQP_SET, rtctimer_freq); | 94 | rtc_control(rtc, RTC_IRQP_SET, rtctimer_freq); |
96 | rtc_control(rtc, RTC_PIE_ON, 0); | 95 | rtc_control(rtc, RTC_PIE_ON, 0); |
97 | atomic_set(&rtc_inc, 0); | ||
98 | return 0; | 96 | return 0; |
99 | } | 97 | } |
100 | 98 | ||
@@ -112,12 +110,7 @@ rtctimer_stop(snd_timer_t *timer) | |||
112 | */ | 110 | */ |
113 | static void rtctimer_interrupt(void *private_data) | 111 | static void rtctimer_interrupt(void *private_data) |
114 | { | 112 | { |
115 | int ticks; | 113 | snd_timer_interrupt(private_data, 1); |
116 | |||
117 | atomic_inc(&rtc_inc); | ||
118 | ticks = atomic_read(&rtc_inc); | ||
119 | snd_timer_interrupt((snd_timer_t*)private_data, ticks); | ||
120 | atomic_sub(ticks, &rtc_inc); | ||
121 | } | 114 | } |
122 | 115 | ||
123 | 116 | ||
@@ -126,17 +119,13 @@ static void rtctimer_interrupt(void *private_data) | |||
126 | */ | 119 | */ |
127 | static int __init rtctimer_init(void) | 120 | static int __init rtctimer_init(void) |
128 | { | 121 | { |
129 | int order, err; | 122 | int err; |
130 | snd_timer_t *timer; | 123 | snd_timer_t *timer; |
131 | 124 | ||
132 | if (rtctimer_freq < 2 || rtctimer_freq > 8192) { | 125 | if (rtctimer_freq < 2 || rtctimer_freq > 8192 || |
133 | snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); | 126 | (rtctimer_freq & (rtctimer_freq - 1)) != 0) { |
134 | return -EINVAL; | 127 | snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", |
135 | } | 128 | rtctimer_freq); |
136 | for (order = 1; rtctimer_freq > order; order <<= 1) | ||
137 | ; | ||
138 | if (rtctimer_freq != order) { | ||
139 | snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); | ||
140 | return -EINVAL; | 129 | return -EINVAL; |
141 | } | 130 | } |
142 | 131 | ||
@@ -145,6 +134,7 @@ static int __init rtctimer_init(void) | |||
145 | if (err < 0) | 134 | if (err < 0) |
146 | return err; | 135 | return err; |
147 | 136 | ||
137 | timer->module = THIS_MODULE; | ||
148 | strcpy(timer->name, "RTC timer"); | 138 | strcpy(timer->name, "RTC timer"); |
149 | timer->hw = rtc_hw; | 139 | timer->hw = rtc_hw; |
150 | timer->hw.resolution = NANO_SEC / rtctimer_freq; | 140 | timer->hw.resolution = NANO_SEC / rtctimer_freq; |
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c index 019d43a462d7..1d525b13ebb6 100644 --- a/sound/core/seq/seq_instr.c +++ b/sound/core/seq/seq_instr.c | |||
@@ -109,8 +109,7 @@ void snd_seq_instr_list_free(snd_seq_kinstr_list_t **list_ptr) | |||
109 | spin_lock_irqsave(&list->lock, flags); | 109 | spin_lock_irqsave(&list->lock, flags); |
110 | while (instr->use) { | 110 | while (instr->use) { |
111 | spin_unlock_irqrestore(&list->lock, flags); | 111 | spin_unlock_irqrestore(&list->lock, flags); |
112 | set_current_state(TASK_INTERRUPTIBLE); | 112 | schedule_timeout_interruptible(1); |
113 | schedule_timeout(1); | ||
114 | spin_lock_irqsave(&list->lock, flags); | 113 | spin_lock_irqsave(&list->lock, flags); |
115 | } | 114 | } |
116 | spin_unlock_irqrestore(&list->lock, flags); | 115 | spin_unlock_irqrestore(&list->lock, flags); |
@@ -199,10 +198,8 @@ int snd_seq_instr_list_free_cond(snd_seq_kinstr_list_t *list, | |||
199 | while (flist) { | 198 | while (flist) { |
200 | instr = flist; | 199 | instr = flist; |
201 | flist = instr->next; | 200 | flist = instr->next; |
202 | while (instr->use) { | 201 | while (instr->use) |
203 | set_current_state(TASK_INTERRUPTIBLE); | 202 | schedule_timeout_interruptible(1); |
204 | schedule_timeout(1); | ||
205 | } | ||
206 | if (snd_seq_instr_free(instr, atomic)<0) | 203 | if (snd_seq_instr_free(instr, atomic)<0) |
207 | snd_printk(KERN_WARNING "instrument free problem\n"); | 204 | snd_printk(KERN_WARNING "instrument free problem\n"); |
208 | instr = next; | 205 | instr = next; |
@@ -554,8 +551,7 @@ static int instr_free(snd_seq_kinstr_ops_t *ops, | |||
554 | instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); | 551 | instr->ops->notify(instr->ops->private_data, instr, SNDRV_SEQ_INSTR_NOTIFY_REMOVE); |
555 | while (instr->use) { | 552 | while (instr->use) { |
556 | spin_unlock_irqrestore(&list->lock, flags); | 553 | spin_unlock_irqrestore(&list->lock, flags); |
557 | set_current_state(TASK_INTERRUPTIBLE); | 554 | schedule_timeout_interruptible(1); |
558 | schedule_timeout(1); | ||
559 | spin_lock_irqsave(&list->lock, flags); | 555 | spin_lock_irqsave(&list->lock, flags); |
560 | } | 556 | } |
561 | spin_unlock_irqrestore(&list->lock, flags); | 557 | spin_unlock_irqrestore(&list->lock, flags); |
diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index b09cee058fa7..a837a94b2d2a 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c | |||
@@ -39,8 +39,7 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) | |||
39 | snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); | 39 | snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line); |
40 | break; | 40 | break; |
41 | } | 41 | } |
42 | set_current_state(TASK_UNINTERRUPTIBLE); | 42 | schedule_timeout_uninterruptible(1); |
43 | schedule_timeout(1); | ||
44 | max_count--; | 43 | max_count--; |
45 | } | 44 | } |
46 | } | 45 | } |
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c index d4d7d326c4b1..8416bcffa091 100644 --- a/sound/core/seq/seq_memory.c +++ b/sound/core/seq/seq_memory.c | |||
@@ -423,8 +423,7 @@ int snd_seq_pool_done(pool_t *pool) | |||
423 | snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); | 423 | snd_printk(KERN_WARNING "snd_seq_pool_done timeout: %d cells remain\n", atomic_read(&pool->counter)); |
424 | break; | 424 | break; |
425 | } | 425 | } |
426 | set_current_state(TASK_UNINTERRUPTIBLE); | 426 | schedule_timeout_uninterruptible(1); |
427 | schedule_timeout(1); | ||
428 | max_count--; | 427 | max_count--; |
429 | } | 428 | } |
430 | 429 | ||
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index b4674ae3bc30..f89f40f44876 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c | |||
@@ -449,11 +449,9 @@ snd_seq_midisynth_unregister_port(snd_seq_device_t *dev) | |||
449 | client->ports_per_device[device] = 0; | 449 | client->ports_per_device[device] = 0; |
450 | msynth = client->ports[device]; | 450 | msynth = client->ports[device]; |
451 | client->ports[device] = NULL; | 451 | client->ports[device] = NULL; |
452 | snd_runtime_check(msynth != NULL || ports <= 0, goto __skip); | ||
453 | for (p = 0; p < ports; p++) | 452 | for (p = 0; p < ports; p++) |
454 | snd_seq_midisynth_delete(&msynth[p]); | 453 | snd_seq_midisynth_delete(&msynth[p]); |
455 | kfree(msynth); | 454 | kfree(msynth); |
456 | __skip: | ||
457 | client->num_ports--; | 455 | client->num_ports--; |
458 | if (client->num_ports <= 0) { | 456 | if (client->num_ports <= 0) { |
459 | snd_seq_delete_kernel_client(client->seq_client); | 457 | snd_seq_delete_kernel_client(client->seq_client); |
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index b57a3c07ff6f..65b64a7c456d 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c | |||
@@ -34,10 +34,15 @@ extern int seq_default_timer_device; | |||
34 | extern int seq_default_timer_subdevice; | 34 | extern int seq_default_timer_subdevice; |
35 | extern int seq_default_timer_resolution; | 35 | extern int seq_default_timer_resolution; |
36 | 36 | ||
37 | /* allowed sequencer timer frequencies, in Hz */ | ||
38 | #define MIN_FREQUENCY 10 | ||
39 | #define MAX_FREQUENCY 6250 | ||
40 | #define DEFAULT_FREQUENCY 1000 | ||
41 | |||
37 | #define SKEW_BASE 0x10000 /* 16bit shift */ | 42 | #define SKEW_BASE 0x10000 /* 16bit shift */ |
38 | 43 | ||
39 | static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, | 44 | static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, |
40 | int tempo, int ppq, int nticks) | 45 | int tempo, int ppq) |
41 | { | 46 | { |
42 | if (tempo < 1000000) | 47 | if (tempo < 1000000) |
43 | tick->resolution = (tempo * 1000) / ppq; | 48 | tick->resolution = (tempo * 1000) / ppq; |
@@ -51,7 +56,6 @@ static void snd_seq_timer_set_tick_resolution(seq_timer_tick_t *tick, | |||
51 | } | 56 | } |
52 | if (tick->resolution <= 0) | 57 | if (tick->resolution <= 0) |
53 | tick->resolution = 1; | 58 | tick->resolution = 1; |
54 | tick->resolution *= nticks; | ||
55 | snd_seq_timer_update_tick(tick, 0); | 59 | snd_seq_timer_update_tick(tick, 0); |
56 | } | 60 | } |
57 | 61 | ||
@@ -100,7 +104,7 @@ void snd_seq_timer_defaults(seq_timer_t * tmr) | |||
100 | /* setup defaults */ | 104 | /* setup defaults */ |
101 | tmr->ppq = 96; /* 96 PPQ */ | 105 | tmr->ppq = 96; /* 96 PPQ */ |
102 | tmr->tempo = 500000; /* 120 BPM */ | 106 | tmr->tempo = 500000; /* 120 BPM */ |
103 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq, 1); | 107 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); |
104 | tmr->running = 0; | 108 | tmr->running = 0; |
105 | 109 | ||
106 | tmr->type = SNDRV_SEQ_TIMER_ALSA; | 110 | tmr->type = SNDRV_SEQ_TIMER_ALSA; |
@@ -183,7 +187,7 @@ int snd_seq_timer_set_tempo(seq_timer_t * tmr, int tempo) | |||
183 | spin_lock_irqsave(&tmr->lock, flags); | 187 | spin_lock_irqsave(&tmr->lock, flags); |
184 | if ((unsigned int)tempo != tmr->tempo) { | 188 | if ((unsigned int)tempo != tmr->tempo) { |
185 | tmr->tempo = tempo; | 189 | tmr->tempo = tempo; |
186 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq, 1); | 190 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); |
187 | } | 191 | } |
188 | spin_unlock_irqrestore(&tmr->lock, flags); | 192 | spin_unlock_irqrestore(&tmr->lock, flags); |
189 | return 0; | 193 | return 0; |
@@ -207,7 +211,7 @@ int snd_seq_timer_set_ppq(seq_timer_t * tmr, int ppq) | |||
207 | } | 211 | } |
208 | 212 | ||
209 | tmr->ppq = ppq; | 213 | tmr->ppq = ppq; |
210 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq, 1); | 214 | snd_seq_timer_set_tick_resolution(&tmr->tick, tmr->tempo, tmr->ppq); |
211 | spin_unlock_irqrestore(&tmr->lock, flags); | 215 | spin_unlock_irqrestore(&tmr->lock, flags); |
212 | return 0; | 216 | return 0; |
213 | } | 217 | } |
@@ -326,17 +330,26 @@ int snd_seq_timer_stop(seq_timer_t * tmr) | |||
326 | static int initialize_timer(seq_timer_t *tmr) | 330 | static int initialize_timer(seq_timer_t *tmr) |
327 | { | 331 | { |
328 | snd_timer_t *t; | 332 | snd_timer_t *t; |
333 | unsigned long freq; | ||
334 | |||
329 | t = tmr->timeri->timer; | 335 | t = tmr->timeri->timer; |
330 | snd_assert(t, return -EINVAL); | 336 | snd_assert(t, return -EINVAL); |
331 | 337 | ||
338 | freq = tmr->preferred_resolution; | ||
339 | if (!freq) | ||
340 | freq = DEFAULT_FREQUENCY; | ||
341 | else if (freq < MIN_FREQUENCY) | ||
342 | freq = MIN_FREQUENCY; | ||
343 | else if (freq > MAX_FREQUENCY) | ||
344 | freq = MAX_FREQUENCY; | ||
345 | |||
332 | tmr->ticks = 1; | 346 | tmr->ticks = 1; |
333 | if (tmr->preferred_resolution && | 347 | if (!(t->hw.flags & SNDRV_TIMER_HW_SLAVE)) { |
334 | ! (t->hw.flags & SNDRV_TIMER_HW_SLAVE)) { | ||
335 | unsigned long r = t->hw.resolution; | 348 | unsigned long r = t->hw.resolution; |
336 | if (! r && t->hw.c_resolution) | 349 | if (! r && t->hw.c_resolution) |
337 | r = t->hw.c_resolution(t); | 350 | r = t->hw.c_resolution(t); |
338 | if (r) { | 351 | if (r) { |
339 | tmr->ticks = (unsigned int)(1000000000uL / (r * tmr->preferred_resolution)); | 352 | tmr->ticks = (unsigned int)(1000000000uL / (r * freq)); |
340 | if (! tmr->ticks) | 353 | if (! tmr->ticks) |
341 | tmr->ticks = 1; | 354 | tmr->ticks = 1; |
342 | } | 355 | } |
diff --git a/sound/core/sound.c b/sound/core/sound.c index b57519a3e3d9..1139dd8ca8eb 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -130,7 +130,7 @@ static int snd_open(struct inode *inode, struct file *file) | |||
130 | struct file_operations *old_fops; | 130 | struct file_operations *old_fops; |
131 | int err = 0; | 131 | int err = 0; |
132 | 132 | ||
133 | if (dev != SNDRV_MINOR_SEQUENCER && dev != SNDRV_MINOR_TIMER) { | 133 | if (dev != SNDRV_MINOR_GLOBAL) { |
134 | if (snd_cards[card] == NULL) { | 134 | if (snd_cards[card] == NULL) { |
135 | #ifdef CONFIG_KMOD | 135 | #ifdef CONFIG_KMOD |
136 | snd_request_card(card); | 136 | snd_request_card(card); |
@@ -287,7 +287,7 @@ static void snd_minor_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buf | |||
287 | for (card = 0; card < SNDRV_CARDS; card++) { | 287 | for (card = 0; card < SNDRV_CARDS; card++) { |
288 | list_for_each(list, &snd_minors_hash[card]) { | 288 | list_for_each(list, &snd_minors_hash[card]) { |
289 | mptr = list_entry(list, snd_minor_t, list); | 289 | mptr = list_entry(list, snd_minor_t, list); |
290 | if (SNDRV_MINOR_DEVICE(mptr->number) != SNDRV_MINOR_SEQUENCER) { | 290 | if (SNDRV_MINOR_DEVICE(mptr->number) != SNDRV_MINOR_GLOBAL) { |
291 | if ((device = mptr->device) >= 0) | 291 | if ((device = mptr->device) >= 0) |
292 | snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", mptr->number, card, device, mptr->comment); | 292 | snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", mptr->number, card, device, mptr->comment); |
293 | else | 293 | else |
@@ -350,9 +350,7 @@ static int __init alsa_sound_init(void) | |||
350 | devfs_remove("snd"); | 350 | devfs_remove("snd"); |
351 | return -EIO; | 351 | return -EIO; |
352 | } | 352 | } |
353 | snd_memory_init(); | ||
354 | if (snd_info_init() < 0) { | 353 | if (snd_info_init() < 0) { |
355 | snd_memory_done(); | ||
356 | unregister_chrdev(major, "alsa"); | 354 | unregister_chrdev(major, "alsa"); |
357 | devfs_remove("snd"); | 355 | devfs_remove("snd"); |
358 | return -ENOMEM; | 356 | return -ENOMEM; |
@@ -381,7 +379,6 @@ static void __exit alsa_sound_exit(void) | |||
381 | #endif | 379 | #endif |
382 | snd_info_minor_unregister(); | 380 | snd_info_minor_unregister(); |
383 | snd_info_done(); | 381 | snd_info_done(); |
384 | snd_memory_done(); | ||
385 | if (unregister_chrdev(major, "alsa") != 0) | 382 | if (unregister_chrdev(major, "alsa") != 0) |
386 | snd_printk(KERN_ERR "unable to unregister major device number %d\n", major); | 383 | snd_printk(KERN_ERR "unable to unregister major device number %d\n", major); |
387 | devfs_remove("snd"); | 384 | devfs_remove("snd"); |
@@ -403,14 +400,6 @@ EXPORT_SYMBOL(snd_register_oss_device); | |||
403 | EXPORT_SYMBOL(snd_unregister_oss_device); | 400 | EXPORT_SYMBOL(snd_unregister_oss_device); |
404 | #endif | 401 | #endif |
405 | /* memory.c */ | 402 | /* memory.c */ |
406 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
407 | EXPORT_SYMBOL(snd_hidden_kmalloc); | ||
408 | EXPORT_SYMBOL(snd_hidden_kcalloc); | ||
409 | EXPORT_SYMBOL(snd_hidden_kfree); | ||
410 | EXPORT_SYMBOL(snd_hidden_vmalloc); | ||
411 | EXPORT_SYMBOL(snd_hidden_vfree); | ||
412 | EXPORT_SYMBOL(snd_hidden_kstrdup); | ||
413 | #endif | ||
414 | EXPORT_SYMBOL(copy_to_user_fromio); | 403 | EXPORT_SYMBOL(copy_to_user_fromio); |
415 | EXPORT_SYMBOL(copy_from_user_toio); | 404 | EXPORT_SYMBOL(copy_from_user_toio); |
416 | /* init.c */ | 405 | /* init.c */ |
@@ -487,17 +476,10 @@ EXPORT_SYMBOL(snd_ctl_unregister_ioctl_compat); | |||
487 | EXPORT_SYMBOL(snd_ctl_elem_read); | 476 | EXPORT_SYMBOL(snd_ctl_elem_read); |
488 | EXPORT_SYMBOL(snd_ctl_elem_write); | 477 | EXPORT_SYMBOL(snd_ctl_elem_write); |
489 | /* misc.c */ | 478 | /* misc.c */ |
490 | EXPORT_SYMBOL(snd_task_name); | 479 | EXPORT_SYMBOL(release_and_free_resource); |
491 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 480 | #ifdef CONFIG_SND_VERBOSE_PRINTK |
492 | EXPORT_SYMBOL(snd_verbose_printk); | 481 | EXPORT_SYMBOL(snd_verbose_printk); |
493 | #endif | 482 | #endif |
494 | #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) | 483 | #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) |
495 | EXPORT_SYMBOL(snd_verbose_printd); | 484 | EXPORT_SYMBOL(snd_verbose_printd); |
496 | #endif | 485 | #endif |
497 | /* wrappers */ | ||
498 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
499 | EXPORT_SYMBOL(snd_wrapper_kmalloc); | ||
500 | EXPORT_SYMBOL(snd_wrapper_kfree); | ||
501 | EXPORT_SYMBOL(snd_wrapper_vmalloc); | ||
502 | EXPORT_SYMBOL(snd_wrapper_vfree); | ||
503 | #endif | ||
diff --git a/sound/core/timer.c b/sound/core/timer.c index 22b104624084..1b90a38d10ff 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(timer_limit, "Maximum global timers in system."); | |||
55 | 55 | ||
56 | typedef struct { | 56 | typedef struct { |
57 | snd_timer_instance_t *timeri; | 57 | snd_timer_instance_t *timeri; |
58 | int tread; /* enhanced read with timestamps and events */ | 58 | int tread; /* enhanced read with timestamps and events */ |
59 | unsigned long ticks; | 59 | unsigned long ticks; |
60 | unsigned long overrun; | 60 | unsigned long overrun; |
61 | int qhead; | 61 | int qhead; |
@@ -95,7 +95,8 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left); | |||
95 | * create a timer instance with the given owner string. | 95 | * create a timer instance with the given owner string. |
96 | * when timer is not NULL, increments the module counter | 96 | * when timer is not NULL, increments the module counter |
97 | */ | 97 | */ |
98 | static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) | 98 | static snd_timer_instance_t *snd_timer_instance_new(char *owner, |
99 | snd_timer_t *timer) | ||
99 | { | 100 | { |
100 | snd_timer_instance_t *timeri; | 101 | snd_timer_instance_t *timeri; |
101 | timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); | 102 | timeri = kzalloc(sizeof(*timeri), GFP_KERNEL); |
@@ -113,7 +114,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti | |||
113 | INIT_LIST_HEAD(&timeri->slave_active_head); | 114 | INIT_LIST_HEAD(&timeri->slave_active_head); |
114 | 115 | ||
115 | timeri->timer = timer; | 116 | timeri->timer = timer; |
116 | if (timer && timer->card && !try_module_get(timer->card->module)) { | 117 | if (timer && !try_module_get(timer->module)) { |
117 | kfree(timeri->owner); | 118 | kfree(timeri->owner); |
118 | kfree(timeri); | 119 | kfree(timeri); |
119 | return NULL; | 120 | return NULL; |
@@ -131,7 +132,7 @@ static snd_timer_t *snd_timer_find(snd_timer_id_t *tid) | |||
131 | struct list_head *p; | 132 | struct list_head *p; |
132 | 133 | ||
133 | list_for_each(p, &snd_timer_list) { | 134 | list_for_each(p, &snd_timer_list) { |
134 | timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 135 | timer = list_entry(p, snd_timer_t, device_list); |
135 | 136 | ||
136 | if (timer->tmr_class != tid->dev_class) | 137 | if (timer->tmr_class != tid->dev_class) |
137 | continue; | 138 | continue; |
@@ -186,13 +187,14 @@ static void snd_timer_check_slave(snd_timer_instance_t *slave) | |||
186 | 187 | ||
187 | /* FIXME: it's really dumb to look up all entries.. */ | 188 | /* FIXME: it's really dumb to look up all entries.. */ |
188 | list_for_each(p, &snd_timer_list) { | 189 | list_for_each(p, &snd_timer_list) { |
189 | timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 190 | timer = list_entry(p, snd_timer_t, device_list); |
190 | list_for_each(q, &timer->open_list_head) { | 191 | list_for_each(q, &timer->open_list_head) { |
191 | master = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, open_list); | 192 | master = list_entry(q, snd_timer_instance_t, open_list); |
192 | if (slave->slave_class == master->slave_class && | 193 | if (slave->slave_class == master->slave_class && |
193 | slave->slave_id == master->slave_id) { | 194 | slave->slave_id == master->slave_id) { |
194 | list_del(&slave->open_list); | 195 | list_del(&slave->open_list); |
195 | list_add_tail(&slave->open_list, &master->slave_list_head); | 196 | list_add_tail(&slave->open_list, |
197 | &master->slave_list_head); | ||
196 | spin_lock_irq(&slave_active_lock); | 198 | spin_lock_irq(&slave_active_lock); |
197 | slave->master = master; | 199 | slave->master = master; |
198 | slave->timer = master->timer; | 200 | slave->timer = master->timer; |
@@ -216,7 +218,7 @@ static void snd_timer_check_master(snd_timer_instance_t *master) | |||
216 | 218 | ||
217 | /* check all pending slaves */ | 219 | /* check all pending slaves */ |
218 | list_for_each_safe(p, n, &snd_timer_slave_list) { | 220 | list_for_each_safe(p, n, &snd_timer_slave_list) { |
219 | slave = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); | 221 | slave = list_entry(p, snd_timer_instance_t, open_list); |
220 | if (slave->slave_class == master->slave_class && | 222 | if (slave->slave_class == master->slave_class && |
221 | slave->slave_id == master->slave_id) { | 223 | slave->slave_id == master->slave_id) { |
222 | list_del(p); | 224 | list_del(p); |
@@ -225,7 +227,8 @@ static void snd_timer_check_master(snd_timer_instance_t *master) | |||
225 | slave->master = master; | 227 | slave->master = master; |
226 | slave->timer = master->timer; | 228 | slave->timer = master->timer; |
227 | if (slave->flags & SNDRV_TIMER_IFLG_RUNNING) | 229 | if (slave->flags & SNDRV_TIMER_IFLG_RUNNING) |
228 | list_add_tail(&slave->active_list, &master->slave_active_head); | 230 | list_add_tail(&slave->active_list, |
231 | &master->slave_active_head); | ||
229 | spin_unlock_irq(&slave_active_lock); | 232 | spin_unlock_irq(&slave_active_lock); |
230 | } | 233 | } |
231 | } | 234 | } |
@@ -241,7 +244,7 @@ int snd_timer_open(snd_timer_instance_t **ti, | |||
241 | { | 244 | { |
242 | snd_timer_t *timer; | 245 | snd_timer_t *timer; |
243 | snd_timer_instance_t *timeri = NULL; | 246 | snd_timer_instance_t *timeri = NULL; |
244 | 247 | ||
245 | if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) { | 248 | if (tid->dev_class == SNDRV_TIMER_CLASS_SLAVE) { |
246 | /* open a slave instance */ | 249 | /* open a slave instance */ |
247 | if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE || | 250 | if (tid->dev_sclass <= SNDRV_TIMER_SCLASS_NONE || |
@@ -251,6 +254,10 @@ int snd_timer_open(snd_timer_instance_t **ti, | |||
251 | } | 254 | } |
252 | down(®ister_mutex); | 255 | down(®ister_mutex); |
253 | timeri = snd_timer_instance_new(owner, NULL); | 256 | timeri = snd_timer_instance_new(owner, NULL); |
257 | if (!timeri) { | ||
258 | up(®ister_mutex); | ||
259 | return -ENOMEM; | ||
260 | } | ||
254 | timeri->slave_class = tid->dev_sclass; | 261 | timeri->slave_class = tid->dev_sclass; |
255 | timeri->slave_id = tid->device; | 262 | timeri->slave_id = tid->device; |
256 | timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; | 263 | timeri->flags |= SNDRV_TIMER_IFLG_SLAVE; |
@@ -272,33 +279,36 @@ int snd_timer_open(snd_timer_instance_t **ti, | |||
272 | timer = snd_timer_find(tid); | 279 | timer = snd_timer_find(tid); |
273 | } | 280 | } |
274 | #endif | 281 | #endif |
275 | if (timer) { | 282 | if (!timer) { |
276 | if (!list_empty(&timer->open_list_head)) { | ||
277 | timeri = (snd_timer_instance_t *)list_entry(timer->open_list_head.next, snd_timer_instance_t, open_list); | ||
278 | if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { | ||
279 | up(®ister_mutex); | ||
280 | return -EBUSY; | ||
281 | } | ||
282 | } | ||
283 | timeri = snd_timer_instance_new(owner, timer); | ||
284 | if (timeri) { | ||
285 | timeri->slave_class = tid->dev_sclass; | ||
286 | timeri->slave_id = slave_id; | ||
287 | if (list_empty(&timer->open_list_head) && timer->hw.open) | ||
288 | timer->hw.open(timer); | ||
289 | list_add_tail(&timeri->open_list, &timer->open_list_head); | ||
290 | snd_timer_check_master(timeri); | ||
291 | } | ||
292 | } else { | ||
293 | up(®ister_mutex); | 283 | up(®ister_mutex); |
294 | return -ENODEV; | 284 | return -ENODEV; |
295 | } | 285 | } |
286 | if (!list_empty(&timer->open_list_head)) { | ||
287 | timeri = list_entry(timer->open_list_head.next, | ||
288 | snd_timer_instance_t, open_list); | ||
289 | if (timeri->flags & SNDRV_TIMER_IFLG_EXCLUSIVE) { | ||
290 | up(®ister_mutex); | ||
291 | return -EBUSY; | ||
292 | } | ||
293 | } | ||
294 | timeri = snd_timer_instance_new(owner, timer); | ||
295 | if (!timeri) { | ||
296 | up(®ister_mutex); | ||
297 | return -ENOMEM; | ||
298 | } | ||
299 | timeri->slave_class = tid->dev_sclass; | ||
300 | timeri->slave_id = slave_id; | ||
301 | if (list_empty(&timer->open_list_head) && timer->hw.open) | ||
302 | timer->hw.open(timer); | ||
303 | list_add_tail(&timeri->open_list, &timer->open_list_head); | ||
304 | snd_timer_check_master(timeri); | ||
296 | up(®ister_mutex); | 305 | up(®ister_mutex); |
297 | *ti = timeri; | 306 | *ti = timeri; |
298 | return 0; | 307 | return 0; |
299 | } | 308 | } |
300 | 309 | ||
301 | static int _snd_timer_stop(snd_timer_instance_t * timeri, int keep_flag, enum sndrv_timer_event event); | 310 | static int _snd_timer_stop(snd_timer_instance_t * timeri, |
311 | int keep_flag, enum sndrv_timer_event event); | ||
302 | 312 | ||
303 | /* | 313 | /* |
304 | * close a timer instance | 314 | * close a timer instance |
@@ -338,11 +348,12 @@ int snd_timer_close(snd_timer_instance_t * timeri) | |||
338 | spin_unlock_irq(&timer->lock); | 348 | spin_unlock_irq(&timer->lock); |
339 | down(®ister_mutex); | 349 | down(®ister_mutex); |
340 | list_del(&timeri->open_list); | 350 | list_del(&timeri->open_list); |
341 | if (timer && list_empty(&timer->open_list_head) && timer->hw.close) | 351 | if (timer && list_empty(&timer->open_list_head) && |
352 | timer->hw.close) | ||
342 | timer->hw.close(timer); | 353 | timer->hw.close(timer); |
343 | /* remove slave links */ | 354 | /* remove slave links */ |
344 | list_for_each_safe(p, n, &timeri->slave_list_head) { | 355 | list_for_each_safe(p, n, &timeri->slave_list_head) { |
345 | slave = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); | 356 | slave = list_entry(p, snd_timer_instance_t, open_list); |
346 | spin_lock_irq(&slave_active_lock); | 357 | spin_lock_irq(&slave_active_lock); |
347 | _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); | 358 | _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); |
348 | list_del(p); | 359 | list_del(p); |
@@ -357,8 +368,8 @@ int snd_timer_close(snd_timer_instance_t * timeri) | |||
357 | timeri->private_free(timeri); | 368 | timeri->private_free(timeri); |
358 | kfree(timeri->owner); | 369 | kfree(timeri->owner); |
359 | kfree(timeri); | 370 | kfree(timeri); |
360 | if (timer && timer->card) | 371 | if (timer) |
361 | module_put(timer->card->module); | 372 | module_put(timer->module); |
362 | return 0; | 373 | return 0; |
363 | } | 374 | } |
364 | 375 | ||
@@ -376,7 +387,8 @@ unsigned long snd_timer_resolution(snd_timer_instance_t * timeri) | |||
376 | return 0; | 387 | return 0; |
377 | } | 388 | } |
378 | 389 | ||
379 | static void snd_timer_notify1(snd_timer_instance_t *ti, enum sndrv_timer_event event) | 390 | static void snd_timer_notify1(snd_timer_instance_t *ti, |
391 | enum sndrv_timer_event event) | ||
380 | { | 392 | { |
381 | snd_timer_t *timer; | 393 | snd_timer_t *timer; |
382 | unsigned long flags; | 394 | unsigned long flags; |
@@ -385,9 +397,11 @@ static void snd_timer_notify1(snd_timer_instance_t *ti, enum sndrv_timer_event e | |||
385 | struct list_head *n; | 397 | struct list_head *n; |
386 | struct timespec tstamp; | 398 | struct timespec tstamp; |
387 | 399 | ||
388 | snd_timestamp_now(&tstamp, 1); | 400 | getnstimeofday(&tstamp); |
389 | snd_assert(event >= SNDRV_TIMER_EVENT_START && event <= SNDRV_TIMER_EVENT_PAUSE, return); | 401 | snd_assert(event >= SNDRV_TIMER_EVENT_START && |
390 | if (event == SNDRV_TIMER_EVENT_START || event == SNDRV_TIMER_EVENT_CONTINUE) | 402 | event <= SNDRV_TIMER_EVENT_PAUSE, return); |
403 | if (event == SNDRV_TIMER_EVENT_START || | ||
404 | event == SNDRV_TIMER_EVENT_CONTINUE) | ||
391 | resolution = snd_timer_resolution(ti); | 405 | resolution = snd_timer_resolution(ti); |
392 | if (ti->ccallback) | 406 | if (ti->ccallback) |
393 | ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); | 407 | ti->ccallback(ti, SNDRV_TIMER_EVENT_START, &tstamp, resolution); |
@@ -400,14 +414,15 @@ static void snd_timer_notify1(snd_timer_instance_t *ti, enum sndrv_timer_event e | |||
400 | return; | 414 | return; |
401 | spin_lock_irqsave(&timer->lock, flags); | 415 | spin_lock_irqsave(&timer->lock, flags); |
402 | list_for_each(n, &ti->slave_active_head) { | 416 | list_for_each(n, &ti->slave_active_head) { |
403 | ts = (snd_timer_instance_t *)list_entry(n, snd_timer_instance_t, active_list); | 417 | ts = list_entry(n, snd_timer_instance_t, active_list); |
404 | if (ts->ccallback) | 418 | if (ts->ccallback) |
405 | ts->ccallback(ti, event + 100, &tstamp, resolution); | 419 | ts->ccallback(ti, event + 100, &tstamp, resolution); |
406 | } | 420 | } |
407 | spin_unlock_irqrestore(&timer->lock, flags); | 421 | spin_unlock_irqrestore(&timer->lock, flags); |
408 | } | 422 | } |
409 | 423 | ||
410 | static int snd_timer_start1(snd_timer_t *timer, snd_timer_instance_t *timeri, unsigned long sticks) | 424 | static int snd_timer_start1(snd_timer_t *timer, snd_timer_instance_t *timeri, |
425 | unsigned long sticks) | ||
411 | { | 426 | { |
412 | list_del(&timeri->active_list); | 427 | list_del(&timeri->active_list); |
413 | list_add_tail(&timeri->active_list, &timer->active_list_head); | 428 | list_add_tail(&timeri->active_list, &timer->active_list_head); |
@@ -434,14 +449,15 @@ static int snd_timer_start_slave(snd_timer_instance_t *timeri) | |||
434 | spin_lock_irqsave(&slave_active_lock, flags); | 449 | spin_lock_irqsave(&slave_active_lock, flags); |
435 | timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; | 450 | timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; |
436 | if (timeri->master) | 451 | if (timeri->master) |
437 | list_add_tail(&timeri->active_list, &timeri->master->slave_active_head); | 452 | list_add_tail(&timeri->active_list, |
453 | &timeri->master->slave_active_head); | ||
438 | spin_unlock_irqrestore(&slave_active_lock, flags); | 454 | spin_unlock_irqrestore(&slave_active_lock, flags); |
439 | return 1; /* delayed start */ | 455 | return 1; /* delayed start */ |
440 | } | 456 | } |
441 | 457 | ||
442 | /* | 458 | /* |
443 | * start the timer instance | 459 | * start the timer instance |
444 | */ | 460 | */ |
445 | int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks) | 461 | int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks) |
446 | { | 462 | { |
447 | snd_timer_t *timer; | 463 | snd_timer_t *timer; |
@@ -467,7 +483,8 @@ int snd_timer_start(snd_timer_instance_t * timeri, unsigned int ticks) | |||
467 | return result; | 483 | return result; |
468 | } | 484 | } |
469 | 485 | ||
470 | static int _snd_timer_stop(snd_timer_instance_t * timeri, int keep_flag, enum sndrv_timer_event event) | 486 | static int _snd_timer_stop(snd_timer_instance_t * timeri, |
487 | int keep_flag, enum sndrv_timer_event event) | ||
471 | { | 488 | { |
472 | snd_timer_t *timer; | 489 | snd_timer_t *timer; |
473 | unsigned long flags; | 490 | unsigned long flags; |
@@ -501,7 +518,8 @@ static int _snd_timer_stop(snd_timer_instance_t * timeri, int keep_flag, enum sn | |||
501 | } | 518 | } |
502 | } | 519 | } |
503 | if (!keep_flag) | 520 | if (!keep_flag) |
504 | timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING|SNDRV_TIMER_IFLG_START); | 521 | timeri->flags &= |
522 | ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); | ||
505 | spin_unlock_irqrestore(&timer->lock, flags); | 523 | spin_unlock_irqrestore(&timer->lock, flags); |
506 | __end: | 524 | __end: |
507 | if (event != SNDRV_TIMER_EVENT_RESOLUTION) | 525 | if (event != SNDRV_TIMER_EVENT_RESOLUTION) |
@@ -578,7 +596,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left) | |||
578 | struct list_head *p; | 596 | struct list_head *p; |
579 | 597 | ||
580 | list_for_each(p, &timer->active_list_head) { | 598 | list_for_each(p, &timer->active_list_head) { |
581 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); | 599 | ti = list_entry(p, snd_timer_instance_t, active_list); |
582 | if (ti->flags & SNDRV_TIMER_IFLG_START) { | 600 | if (ti->flags & SNDRV_TIMER_IFLG_START) { |
583 | ti->flags &= ~SNDRV_TIMER_IFLG_START; | 601 | ti->flags &= ~SNDRV_TIMER_IFLG_START; |
584 | ti->flags |= SNDRV_TIMER_IFLG_RUNNING; | 602 | ti->flags |= SNDRV_TIMER_IFLG_RUNNING; |
@@ -615,11 +633,11 @@ static void snd_timer_tasklet(unsigned long arg) | |||
615 | /* now process all callbacks */ | 633 | /* now process all callbacks */ |
616 | while (!list_empty(&timer->sack_list_head)) { | 634 | while (!list_empty(&timer->sack_list_head)) { |
617 | p = timer->sack_list_head.next; /* get first item */ | 635 | p = timer->sack_list_head.next; /* get first item */ |
618 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list); | 636 | ti = list_entry(p, snd_timer_instance_t, ack_list); |
619 | 637 | ||
620 | /* remove from ack_list and make empty */ | 638 | /* remove from ack_list and make empty */ |
621 | list_del_init(p); | 639 | list_del_init(p); |
622 | 640 | ||
623 | ticks = ti->pticks; | 641 | ticks = ti->pticks; |
624 | ti->pticks = 0; | 642 | ti->pticks = 0; |
625 | resolution = ti->resolution; | 643 | resolution = ti->resolution; |
@@ -644,7 +662,7 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) | |||
644 | { | 662 | { |
645 | snd_timer_instance_t *ti, *ts; | 663 | snd_timer_instance_t *ti, *ts; |
646 | unsigned long resolution, ticks; | 664 | unsigned long resolution, ticks; |
647 | struct list_head *p, *q, *n; | 665 | struct list_head *p, *q, *n, *ack_list_head; |
648 | int use_tasklet = 0; | 666 | int use_tasklet = 0; |
649 | 667 | ||
650 | if (timer == NULL) | 668 | if (timer == NULL) |
@@ -659,11 +677,12 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) | |||
659 | resolution = timer->hw.resolution; | 677 | resolution = timer->hw.resolution; |
660 | 678 | ||
661 | /* loop for all active instances | 679 | /* loop for all active instances |
662 | * here we cannot use list_for_each because the active_list of a processed | 680 | * Here we cannot use list_for_each because the active_list of a |
663 | * instance is relinked to done_list_head before callback is called. | 681 | * processed instance is relinked to done_list_head before the callback |
682 | * is called. | ||
664 | */ | 683 | */ |
665 | list_for_each_safe(p, n, &timer->active_list_head) { | 684 | list_for_each_safe(p, n, &timer->active_list_head) { |
666 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); | 685 | ti = list_entry(p, snd_timer_instance_t, active_list); |
667 | if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING)) | 686 | if (!(ti->flags & SNDRV_TIMER_IFLG_RUNNING)) |
668 | continue; | 687 | continue; |
669 | ti->pticks += ticks_left; | 688 | ti->pticks += ticks_left; |
@@ -681,26 +700,19 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) | |||
681 | if (--timer->running) | 700 | if (--timer->running) |
682 | list_del(p); | 701 | list_del(p); |
683 | } | 702 | } |
684 | if (list_empty(&ti->ack_list)) { | 703 | if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || |
685 | if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || | 704 | (ti->flags & SNDRV_TIMER_IFLG_FAST)) |
686 | (ti->flags & SNDRV_TIMER_IFLG_FAST)) { | 705 | ack_list_head = &timer->ack_list_head; |
687 | list_add_tail(&ti->ack_list, &timer->ack_list_head); | 706 | else |
688 | } else { | 707 | ack_list_head = &timer->sack_list_head; |
689 | list_add_tail(&ti->ack_list, &timer->sack_list_head); | 708 | if (list_empty(&ti->ack_list)) |
690 | } | 709 | list_add_tail(&ti->ack_list, ack_list_head); |
691 | } | ||
692 | list_for_each(q, &ti->slave_active_head) { | 710 | list_for_each(q, &ti->slave_active_head) { |
693 | ts = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, active_list); | 711 | ts = list_entry(q, snd_timer_instance_t, active_list); |
694 | ts->pticks = ti->pticks; | 712 | ts->pticks = ti->pticks; |
695 | ts->resolution = resolution; | 713 | ts->resolution = resolution; |
696 | if (list_empty(&ts->ack_list)) { | 714 | if (list_empty(&ts->ack_list)) |
697 | if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || | 715 | list_add_tail(&ts->ack_list, ack_list_head); |
698 | (ti->flags & SNDRV_TIMER_IFLG_FAST)) { | ||
699 | list_add_tail(&ts->ack_list, &timer->ack_list_head); | ||
700 | } else { | ||
701 | list_add_tail(&ts->ack_list, &timer->sack_list_head); | ||
702 | } | ||
703 | } | ||
704 | } | 716 | } |
705 | } | 717 | } |
706 | if (timer->flags & SNDRV_TIMER_FLG_RESCHED) | 718 | if (timer->flags & SNDRV_TIMER_FLG_RESCHED) |
@@ -723,11 +735,11 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) | |||
723 | /* now process all fast callbacks */ | 735 | /* now process all fast callbacks */ |
724 | while (!list_empty(&timer->ack_list_head)) { | 736 | while (!list_empty(&timer->ack_list_head)) { |
725 | p = timer->ack_list_head.next; /* get first item */ | 737 | p = timer->ack_list_head.next; /* get first item */ |
726 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, ack_list); | 738 | ti = list_entry(p, snd_timer_instance_t, ack_list); |
727 | 739 | ||
728 | /* remove from ack_list and make empty */ | 740 | /* remove from ack_list and make empty */ |
729 | list_del_init(p); | 741 | list_del_init(p); |
730 | 742 | ||
731 | ticks = ti->pticks; | 743 | ticks = ti->pticks; |
732 | ti->pticks = 0; | 744 | ti->pticks = 0; |
733 | 745 | ||
@@ -751,7 +763,8 @@ void snd_timer_interrupt(snd_timer_t * timer, unsigned long ticks_left) | |||
751 | 763 | ||
752 | */ | 764 | */ |
753 | 765 | ||
754 | int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t ** rtimer) | 766 | int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, |
767 | snd_timer_t **rtimer) | ||
755 | { | 768 | { |
756 | snd_timer_t *timer; | 769 | snd_timer_t *timer; |
757 | int err; | 770 | int err; |
@@ -779,9 +792,12 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t * | |||
779 | INIT_LIST_HEAD(&timer->ack_list_head); | 792 | INIT_LIST_HEAD(&timer->ack_list_head); |
780 | INIT_LIST_HEAD(&timer->sack_list_head); | 793 | INIT_LIST_HEAD(&timer->sack_list_head); |
781 | spin_lock_init(&timer->lock); | 794 | spin_lock_init(&timer->lock); |
782 | tasklet_init(&timer->task_queue, snd_timer_tasklet, (unsigned long)timer); | 795 | tasklet_init(&timer->task_queue, snd_timer_tasklet, |
796 | (unsigned long)timer); | ||
783 | if (card != NULL) { | 797 | if (card != NULL) { |
784 | if ((err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops)) < 0) { | 798 | timer->module = card->module; |
799 | err = snd_device_new(card, SNDRV_DEV_TIMER, timer, &ops); | ||
800 | if (err < 0) { | ||
785 | snd_timer_free(timer); | 801 | snd_timer_free(timer); |
786 | return err; | 802 | return err; |
787 | } | 803 | } |
@@ -811,14 +827,15 @@ static int snd_timer_dev_register(snd_device_t *dev) | |||
811 | snd_timer_t *timer1; | 827 | snd_timer_t *timer1; |
812 | struct list_head *p; | 828 | struct list_head *p; |
813 | 829 | ||
814 | snd_assert(timer != NULL && timer->hw.start != NULL && timer->hw.stop != NULL, return -ENXIO); | 830 | snd_assert(timer != NULL && timer->hw.start != NULL && |
831 | timer->hw.stop != NULL, return -ENXIO); | ||
815 | if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) && | 832 | if (!(timer->hw.flags & SNDRV_TIMER_HW_SLAVE) && |
816 | !timer->hw.resolution && timer->hw.c_resolution == NULL) | 833 | !timer->hw.resolution && timer->hw.c_resolution == NULL) |
817 | return -EINVAL; | 834 | return -EINVAL; |
818 | 835 | ||
819 | down(®ister_mutex); | 836 | down(®ister_mutex); |
820 | list_for_each(p, &snd_timer_list) { | 837 | list_for_each(p, &snd_timer_list) { |
821 | timer1 = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 838 | timer1 = list_entry(p, snd_timer_t, device_list); |
822 | if (timer1->tmr_class > timer->tmr_class) | 839 | if (timer1->tmr_class > timer->tmr_class) |
823 | break; | 840 | break; |
824 | if (timer1->tmr_class < timer->tmr_class) | 841 | if (timer1->tmr_class < timer->tmr_class) |
@@ -857,7 +874,7 @@ static int snd_timer_unregister(snd_timer_t *timer) | |||
857 | snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer); | 874 | snd_printk(KERN_WARNING "timer 0x%lx is busy?\n", (long)timer); |
858 | list_for_each_safe(p, n, &timer->open_list_head) { | 875 | list_for_each_safe(p, n, &timer->open_list_head) { |
859 | list_del_init(p); | 876 | list_del_init(p); |
860 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, open_list); | 877 | ti = list_entry(p, snd_timer_instance_t, open_list); |
861 | ti->timer = NULL; | 878 | ti->timer = NULL; |
862 | } | 879 | } |
863 | } | 880 | } |
@@ -872,15 +889,18 @@ static int snd_timer_dev_unregister(snd_device_t *device) | |||
872 | return snd_timer_unregister(timer); | 889 | return snd_timer_unregister(timer); |
873 | } | 890 | } |
874 | 891 | ||
875 | void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct timespec *tstamp) | 892 | void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, |
893 | struct timespec *tstamp) | ||
876 | { | 894 | { |
877 | unsigned long flags; | 895 | unsigned long flags; |
878 | unsigned long resolution = 0; | 896 | unsigned long resolution = 0; |
879 | snd_timer_instance_t *ti, *ts; | 897 | snd_timer_instance_t *ti, *ts; |
880 | struct list_head *p, *n; | 898 | struct list_head *p, *n; |
881 | 899 | ||
882 | snd_runtime_check(timer->hw.flags & SNDRV_TIMER_HW_SLAVE, return); | 900 | if (! (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)) |
883 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && event <= SNDRV_TIMER_EVENT_MRESUME, return); | 901 | return; |
902 | snd_assert(event >= SNDRV_TIMER_EVENT_MSTART && | ||
903 | event <= SNDRV_TIMER_EVENT_MRESUME, return); | ||
884 | spin_lock_irqsave(&timer->lock, flags); | 904 | spin_lock_irqsave(&timer->lock, flags); |
885 | if (event == SNDRV_TIMER_EVENT_MSTART || | 905 | if (event == SNDRV_TIMER_EVENT_MSTART || |
886 | event == SNDRV_TIMER_EVENT_MCONTINUE || | 906 | event == SNDRV_TIMER_EVENT_MCONTINUE || |
@@ -891,11 +911,11 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
891 | resolution = timer->hw.resolution; | 911 | resolution = timer->hw.resolution; |
892 | } | 912 | } |
893 | list_for_each(p, &timer->active_list_head) { | 913 | list_for_each(p, &timer->active_list_head) { |
894 | ti = (snd_timer_instance_t *)list_entry(p, snd_timer_instance_t, active_list); | 914 | ti = list_entry(p, snd_timer_instance_t, active_list); |
895 | if (ti->ccallback) | 915 | if (ti->ccallback) |
896 | ti->ccallback(ti, event, tstamp, resolution); | 916 | ti->ccallback(ti, event, tstamp, resolution); |
897 | list_for_each(n, &ti->slave_active_head) { | 917 | list_for_each(n, &ti->slave_active_head) { |
898 | ts = (snd_timer_instance_t *)list_entry(n, snd_timer_instance_t, active_list); | 918 | ts = list_entry(n, snd_timer_instance_t, active_list); |
899 | if (ts->ccallback) | 919 | if (ts->ccallback) |
900 | ts->ccallback(ts, event, tstamp, resolution); | 920 | ts->ccallback(ts, event, tstamp, resolution); |
901 | } | 921 | } |
@@ -909,7 +929,7 @@ void snd_timer_notify(snd_timer_t *timer, enum sndrv_timer_event event, struct t | |||
909 | int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer) | 929 | int snd_timer_global_new(char *id, int device, snd_timer_t **rtimer) |
910 | { | 930 | { |
911 | snd_timer_id_t tid; | 931 | snd_timer_id_t tid; |
912 | 932 | ||
913 | tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL; | 933 | tid.dev_class = SNDRV_TIMER_CLASS_GLOBAL; |
914 | tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; | 934 | tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; |
915 | tid.card = -1; | 935 | tid.card = -1; |
@@ -937,7 +957,7 @@ int snd_timer_global_unregister(snd_timer_t *timer) | |||
937 | return snd_timer_unregister(timer); | 957 | return snd_timer_unregister(timer); |
938 | } | 958 | } |
939 | 959 | ||
940 | /* | 960 | /* |
941 | * System timer | 961 | * System timer |
942 | */ | 962 | */ |
943 | 963 | ||
@@ -1013,7 +1033,8 @@ static int snd_timer_register_system(void) | |||
1013 | struct snd_timer_system_private *priv; | 1033 | struct snd_timer_system_private *priv; |
1014 | int err; | 1034 | int err; |
1015 | 1035 | ||
1016 | if ((err = snd_timer_global_new("system", SNDRV_TIMER_GLOBAL_SYSTEM, &timer)) < 0) | 1036 | err = snd_timer_global_new("system", SNDRV_TIMER_GLOBAL_SYSTEM, &timer); |
1037 | if (err < 0) | ||
1017 | return err; | 1038 | return err; |
1018 | strcpy(timer->name, "system timer"); | 1039 | strcpy(timer->name, "system timer"); |
1019 | timer->hw = snd_timer_system; | 1040 | timer->hw = snd_timer_system; |
@@ -1044,33 +1065,41 @@ static void snd_timer_proc_read(snd_info_entry_t *entry, | |||
1044 | 1065 | ||
1045 | down(®ister_mutex); | 1066 | down(®ister_mutex); |
1046 | list_for_each(p, &snd_timer_list) { | 1067 | list_for_each(p, &snd_timer_list) { |
1047 | timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 1068 | timer = list_entry(p, snd_timer_t, device_list); |
1048 | switch (timer->tmr_class) { | 1069 | switch (timer->tmr_class) { |
1049 | case SNDRV_TIMER_CLASS_GLOBAL: | 1070 | case SNDRV_TIMER_CLASS_GLOBAL: |
1050 | snd_iprintf(buffer, "G%i: ", timer->tmr_device); | 1071 | snd_iprintf(buffer, "G%i: ", timer->tmr_device); |
1051 | break; | 1072 | break; |
1052 | case SNDRV_TIMER_CLASS_CARD: | 1073 | case SNDRV_TIMER_CLASS_CARD: |
1053 | snd_iprintf(buffer, "C%i-%i: ", timer->card->number, timer->tmr_device); | 1074 | snd_iprintf(buffer, "C%i-%i: ", |
1075 | timer->card->number, timer->tmr_device); | ||
1054 | break; | 1076 | break; |
1055 | case SNDRV_TIMER_CLASS_PCM: | 1077 | case SNDRV_TIMER_CLASS_PCM: |
1056 | snd_iprintf(buffer, "P%i-%i-%i: ", timer->card->number, timer->tmr_device, timer->tmr_subdevice); | 1078 | snd_iprintf(buffer, "P%i-%i-%i: ", timer->card->number, |
1079 | timer->tmr_device, timer->tmr_subdevice); | ||
1057 | break; | 1080 | break; |
1058 | default: | 1081 | default: |
1059 | snd_iprintf(buffer, "?%i-%i-%i-%i: ", timer->tmr_class, timer->card ? timer->card->number : -1, timer->tmr_device, timer->tmr_subdevice); | 1082 | snd_iprintf(buffer, "?%i-%i-%i-%i: ", timer->tmr_class, |
1083 | timer->card ? timer->card->number : -1, | ||
1084 | timer->tmr_device, timer->tmr_subdevice); | ||
1060 | } | 1085 | } |
1061 | snd_iprintf(buffer, "%s :", timer->name); | 1086 | snd_iprintf(buffer, "%s :", timer->name); |
1062 | if (timer->hw.resolution) | 1087 | if (timer->hw.resolution) |
1063 | snd_iprintf(buffer, " %lu.%03luus (%lu ticks)", timer->hw.resolution / 1000, timer->hw.resolution % 1000, timer->hw.ticks); | 1088 | snd_iprintf(buffer, " %lu.%03luus (%lu ticks)", |
1089 | timer->hw.resolution / 1000, | ||
1090 | timer->hw.resolution % 1000, | ||
1091 | timer->hw.ticks); | ||
1064 | if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) | 1092 | if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) |
1065 | snd_iprintf(buffer, " SLAVE"); | 1093 | snd_iprintf(buffer, " SLAVE"); |
1066 | snd_iprintf(buffer, "\n"); | 1094 | snd_iprintf(buffer, "\n"); |
1067 | spin_lock_irqsave(&timer->lock, flags); | 1095 | spin_lock_irqsave(&timer->lock, flags); |
1068 | list_for_each(q, &timer->open_list_head) { | 1096 | list_for_each(q, &timer->open_list_head) { |
1069 | ti = (snd_timer_instance_t *)list_entry(q, snd_timer_instance_t, open_list); | 1097 | ti = list_entry(q, snd_timer_instance_t, open_list); |
1070 | snd_iprintf(buffer, " Client %s : %s : lost interrupts %li\n", | 1098 | snd_iprintf(buffer, " Client %s : %s\n", |
1071 | ti->owner ? ti->owner : "unknown", | 1099 | ti->owner ? ti->owner : "unknown", |
1072 | ti->flags & (SNDRV_TIMER_IFLG_START|SNDRV_TIMER_IFLG_RUNNING) ? "running" : "stopped", | 1100 | ti->flags & (SNDRV_TIMER_IFLG_START | |
1073 | ti->lost); | 1101 | SNDRV_TIMER_IFLG_RUNNING) |
1102 | ? "running" : "stopped"); | ||
1074 | } | 1103 | } |
1075 | spin_unlock_irqrestore(&timer->lock, flags); | 1104 | spin_unlock_irqrestore(&timer->lock, flags); |
1076 | } | 1105 | } |
@@ -1088,7 +1117,7 @@ static void snd_timer_user_interrupt(snd_timer_instance_t *timeri, | |||
1088 | snd_timer_user_t *tu = timeri->callback_data; | 1117 | snd_timer_user_t *tu = timeri->callback_data; |
1089 | snd_timer_read_t *r; | 1118 | snd_timer_read_t *r; |
1090 | int prev; | 1119 | int prev; |
1091 | 1120 | ||
1092 | spin_lock(&tu->qlock); | 1121 | spin_lock(&tu->qlock); |
1093 | if (tu->qused > 0) { | 1122 | if (tu->qused > 0) { |
1094 | prev = tu->qtail == 0 ? tu->queue_size - 1 : tu->qtail - 1; | 1123 | prev = tu->qtail == 0 ? tu->queue_size - 1 : tu->qtail - 1; |
@@ -1113,7 +1142,8 @@ static void snd_timer_user_interrupt(snd_timer_instance_t *timeri, | |||
1113 | wake_up(&tu->qchange_sleep); | 1142 | wake_up(&tu->qchange_sleep); |
1114 | } | 1143 | } |
1115 | 1144 | ||
1116 | static void snd_timer_user_append_to_tqueue(snd_timer_user_t *tu, snd_timer_tread_t *tread) | 1145 | static void snd_timer_user_append_to_tqueue(snd_timer_user_t *tu, |
1146 | snd_timer_tread_t *tread) | ||
1117 | { | 1147 | { |
1118 | if (tu->qused >= tu->queue_size) { | 1148 | if (tu->qused >= tu->queue_size) { |
1119 | tu->overrun++; | 1149 | tu->overrun++; |
@@ -1132,7 +1162,8 @@ static void snd_timer_user_ccallback(snd_timer_instance_t *timeri, | |||
1132 | snd_timer_user_t *tu = timeri->callback_data; | 1162 | snd_timer_user_t *tu = timeri->callback_data; |
1133 | snd_timer_tread_t r1; | 1163 | snd_timer_tread_t r1; |
1134 | 1164 | ||
1135 | if (event >= SNDRV_TIMER_EVENT_START && event <= SNDRV_TIMER_EVENT_PAUSE) | 1165 | if (event >= SNDRV_TIMER_EVENT_START && |
1166 | event <= SNDRV_TIMER_EVENT_PAUSE) | ||
1136 | tu->tstamp = *tstamp; | 1167 | tu->tstamp = *tstamp; |
1137 | if ((tu->filter & (1 << event)) == 0 || !tu->tread) | 1168 | if ((tu->filter & (1 << event)) == 0 || !tu->tread) |
1138 | return; | 1169 | return; |
@@ -1155,15 +1186,17 @@ static void snd_timer_user_tinterrupt(snd_timer_instance_t *timeri, | |||
1155 | struct timespec tstamp; | 1186 | struct timespec tstamp; |
1156 | int prev, append = 0; | 1187 | int prev, append = 0; |
1157 | 1188 | ||
1158 | snd_timestamp_zero(&tstamp); | 1189 | memset(&tstamp, 0, sizeof(tstamp)); |
1159 | spin_lock(&tu->qlock); | 1190 | spin_lock(&tu->qlock); |
1160 | if ((tu->filter & ((1 << SNDRV_TIMER_EVENT_RESOLUTION)|(1 << SNDRV_TIMER_EVENT_TICK))) == 0) { | 1191 | if ((tu->filter & ((1 << SNDRV_TIMER_EVENT_RESOLUTION) | |
1192 | (1 << SNDRV_TIMER_EVENT_TICK))) == 0) { | ||
1161 | spin_unlock(&tu->qlock); | 1193 | spin_unlock(&tu->qlock); |
1162 | return; | 1194 | return; |
1163 | } | 1195 | } |
1164 | if (tu->last_resolution != resolution || ticks > 0) | 1196 | if (tu->last_resolution != resolution || ticks > 0) |
1165 | snd_timestamp_now(&tstamp, 1); | 1197 | getnstimeofday(&tstamp); |
1166 | if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && tu->last_resolution != resolution) { | 1198 | if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && |
1199 | tu->last_resolution != resolution) { | ||
1167 | r1.event = SNDRV_TIMER_EVENT_RESOLUTION; | 1200 | r1.event = SNDRV_TIMER_EVENT_RESOLUTION; |
1168 | r1.tstamp = tstamp; | 1201 | r1.tstamp = tstamp; |
1169 | r1.val = resolution; | 1202 | r1.val = resolution; |
@@ -1201,7 +1234,7 @@ static void snd_timer_user_tinterrupt(snd_timer_instance_t *timeri, | |||
1201 | static int snd_timer_user_open(struct inode *inode, struct file *file) | 1234 | static int snd_timer_user_open(struct inode *inode, struct file *file) |
1202 | { | 1235 | { |
1203 | snd_timer_user_t *tu; | 1236 | snd_timer_user_t *tu; |
1204 | 1237 | ||
1205 | tu = kzalloc(sizeof(*tu), GFP_KERNEL); | 1238 | tu = kzalloc(sizeof(*tu), GFP_KERNEL); |
1206 | if (tu == NULL) | 1239 | if (tu == NULL) |
1207 | return -ENOMEM; | 1240 | return -ENOMEM; |
@@ -1210,7 +1243,8 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) | |||
1210 | init_MUTEX(&tu->tread_sem); | 1243 | init_MUTEX(&tu->tread_sem); |
1211 | tu->ticks = 1; | 1244 | tu->ticks = 1; |
1212 | tu->queue_size = 128; | 1245 | tu->queue_size = 128; |
1213 | tu->queue = (snd_timer_read_t *)kmalloc(tu->queue_size * sizeof(snd_timer_read_t), GFP_KERNEL); | 1246 | tu->queue = kmalloc(tu->queue_size * sizeof(snd_timer_read_t), |
1247 | GFP_KERNEL); | ||
1214 | if (tu->queue == NULL) { | 1248 | if (tu->queue == NULL) { |
1215 | kfree(tu); | 1249 | kfree(tu); |
1216 | return -ENOMEM; | 1250 | return -ENOMEM; |
@@ -1259,7 +1293,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) | |||
1259 | snd_timer_id_t id; | 1293 | snd_timer_id_t id; |
1260 | snd_timer_t *timer; | 1294 | snd_timer_t *timer; |
1261 | struct list_head *p; | 1295 | struct list_head *p; |
1262 | 1296 | ||
1263 | if (copy_from_user(&id, _tid, sizeof(id))) | 1297 | if (copy_from_user(&id, _tid, sizeof(id))) |
1264 | return -EFAULT; | 1298 | return -EFAULT; |
1265 | down(®ister_mutex); | 1299 | down(®ister_mutex); |
@@ -1267,7 +1301,8 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) | |||
1267 | if (list_empty(&snd_timer_list)) | 1301 | if (list_empty(&snd_timer_list)) |
1268 | snd_timer_user_zero_id(&id); | 1302 | snd_timer_user_zero_id(&id); |
1269 | else { | 1303 | else { |
1270 | timer = (snd_timer_t *)list_entry(snd_timer_list.next, snd_timer_t, device_list); | 1304 | timer = list_entry(snd_timer_list.next, |
1305 | snd_timer_t, device_list); | ||
1271 | snd_timer_user_copy_id(&id, timer); | 1306 | snd_timer_user_copy_id(&id, timer); |
1272 | } | 1307 | } |
1273 | } else { | 1308 | } else { |
@@ -1275,7 +1310,7 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) | |||
1275 | case SNDRV_TIMER_CLASS_GLOBAL: | 1310 | case SNDRV_TIMER_CLASS_GLOBAL: |
1276 | id.device = id.device < 0 ? 0 : id.device + 1; | 1311 | id.device = id.device < 0 ? 0 : id.device + 1; |
1277 | list_for_each(p, &snd_timer_list) { | 1312 | list_for_each(p, &snd_timer_list) { |
1278 | timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 1313 | timer = list_entry(p, snd_timer_t, device_list); |
1279 | if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) { | 1314 | if (timer->tmr_class > SNDRV_TIMER_CLASS_GLOBAL) { |
1280 | snd_timer_user_copy_id(&id, timer); | 1315 | snd_timer_user_copy_id(&id, timer); |
1281 | break; | 1316 | break; |
@@ -1299,12 +1334,16 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) | |||
1299 | if (id.device < 0) { | 1334 | if (id.device < 0) { |
1300 | id.device = 0; | 1335 | id.device = 0; |
1301 | } else { | 1336 | } else { |
1302 | id.subdevice = id.subdevice < 0 ? 0 : id.subdevice + 1; | 1337 | if (id.subdevice < 0) { |
1338 | id.subdevice = 0; | ||
1339 | } else { | ||
1340 | id.subdevice++; | ||
1341 | } | ||
1303 | } | 1342 | } |
1304 | } | 1343 | } |
1305 | } | 1344 | } |
1306 | list_for_each(p, &snd_timer_list) { | 1345 | list_for_each(p, &snd_timer_list) { |
1307 | timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 1346 | timer = list_entry(p, snd_timer_t, device_list); |
1308 | if (timer->tmr_class > id.dev_class) { | 1347 | if (timer->tmr_class > id.dev_class) { |
1309 | snd_timer_user_copy_id(&id, timer); | 1348 | snd_timer_user_copy_id(&id, timer); |
1310 | break; | 1349 | break; |
@@ -1343,9 +1382,10 @@ static int snd_timer_user_next_device(snd_timer_id_t __user *_tid) | |||
1343 | if (copy_to_user(_tid, &id, sizeof(*_tid))) | 1382 | if (copy_to_user(_tid, &id, sizeof(*_tid))) |
1344 | return -EFAULT; | 1383 | return -EFAULT; |
1345 | return 0; | 1384 | return 0; |
1346 | } | 1385 | } |
1347 | 1386 | ||
1348 | static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_ginfo) | 1387 | static int snd_timer_user_ginfo(struct file *file, |
1388 | snd_timer_ginfo_t __user *_ginfo) | ||
1349 | { | 1389 | { |
1350 | snd_timer_ginfo_t *ginfo; | 1390 | snd_timer_ginfo_t *ginfo; |
1351 | snd_timer_id_t tid; | 1391 | snd_timer_id_t tid; |
@@ -1389,7 +1429,8 @@ static int snd_timer_user_ginfo(struct file *file, snd_timer_ginfo_t __user *_gi | |||
1389 | return err; | 1429 | return err; |
1390 | } | 1430 | } |
1391 | 1431 | ||
1392 | static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user *_gparams) | 1432 | static int snd_timer_user_gparams(struct file *file, |
1433 | snd_timer_gparams_t __user *_gparams) | ||
1393 | { | 1434 | { |
1394 | snd_timer_gparams_t gparams; | 1435 | snd_timer_gparams_t gparams; |
1395 | snd_timer_t *t; | 1436 | snd_timer_t *t; |
@@ -1399,23 +1440,26 @@ static int snd_timer_user_gparams(struct file *file, snd_timer_gparams_t __user | |||
1399 | return -EFAULT; | 1440 | return -EFAULT; |
1400 | down(®ister_mutex); | 1441 | down(®ister_mutex); |
1401 | t = snd_timer_find(&gparams.tid); | 1442 | t = snd_timer_find(&gparams.tid); |
1402 | if (t != NULL) { | 1443 | if (!t) { |
1403 | if (list_empty(&t->open_list_head)) { | ||
1404 | if (t->hw.set_period) | ||
1405 | err = t->hw.set_period(t, gparams.period_num, gparams.period_den); | ||
1406 | else | ||
1407 | err = -ENOSYS; | ||
1408 | } else { | ||
1409 | err = -EBUSY; | ||
1410 | } | ||
1411 | } else { | ||
1412 | err = -ENODEV; | 1444 | err = -ENODEV; |
1445 | goto _error; | ||
1446 | } | ||
1447 | if (!list_empty(&t->open_list_head)) { | ||
1448 | err = -EBUSY; | ||
1449 | goto _error; | ||
1413 | } | 1450 | } |
1451 | if (!t->hw.set_period) { | ||
1452 | err = -ENOSYS; | ||
1453 | goto _error; | ||
1454 | } | ||
1455 | err = t->hw.set_period(t, gparams.period_num, gparams.period_den); | ||
1456 | _error: | ||
1414 | up(®ister_mutex); | 1457 | up(®ister_mutex); |
1415 | return err; | 1458 | return err; |
1416 | } | 1459 | } |
1417 | 1460 | ||
1418 | static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user *_gstatus) | 1461 | static int snd_timer_user_gstatus(struct file *file, |
1462 | snd_timer_gstatus_t __user *_gstatus) | ||
1419 | { | 1463 | { |
1420 | snd_timer_gstatus_t gstatus; | 1464 | snd_timer_gstatus_t gstatus; |
1421 | snd_timer_id_t tid; | 1465 | snd_timer_id_t tid; |
@@ -1435,7 +1479,8 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user | |||
1435 | else | 1479 | else |
1436 | gstatus.resolution = t->hw.resolution; | 1480 | gstatus.resolution = t->hw.resolution; |
1437 | if (t->hw.precise_resolution) { | 1481 | if (t->hw.precise_resolution) { |
1438 | t->hw.precise_resolution(t, &gstatus.resolution_num, &gstatus.resolution_den); | 1482 | t->hw.precise_resolution(t, &gstatus.resolution_num, |
1483 | &gstatus.resolution_den); | ||
1439 | } else { | 1484 | } else { |
1440 | gstatus.resolution_num = gstatus.resolution; | 1485 | gstatus.resolution_num = gstatus.resolution; |
1441 | gstatus.resolution_den = 1000000000uL; | 1486 | gstatus.resolution_den = 1000000000uL; |
@@ -1449,13 +1494,14 @@ static int snd_timer_user_gstatus(struct file *file, snd_timer_gstatus_t __user | |||
1449 | return err; | 1494 | return err; |
1450 | } | 1495 | } |
1451 | 1496 | ||
1452 | static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *_tselect) | 1497 | static int snd_timer_user_tselect(struct file *file, |
1498 | snd_timer_select_t __user *_tselect) | ||
1453 | { | 1499 | { |
1454 | snd_timer_user_t *tu; | 1500 | snd_timer_user_t *tu; |
1455 | snd_timer_select_t tselect; | 1501 | snd_timer_select_t tselect; |
1456 | char str[32]; | 1502 | char str[32]; |
1457 | int err = 0; | 1503 | int err = 0; |
1458 | 1504 | ||
1459 | tu = file->private_data; | 1505 | tu = file->private_data; |
1460 | down(&tu->tread_sem); | 1506 | down(&tu->tread_sem); |
1461 | if (tu->timeri) { | 1507 | if (tu->timeri) { |
@@ -1469,7 +1515,8 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user * | |||
1469 | sprintf(str, "application %i", current->pid); | 1515 | sprintf(str, "application %i", current->pid); |
1470 | if (tselect.id.dev_class != SNDRV_TIMER_CLASS_SLAVE) | 1516 | if (tselect.id.dev_class != SNDRV_TIMER_CLASS_SLAVE) |
1471 | tselect.id.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION; | 1517 | tselect.id.dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION; |
1472 | if ((err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid)) < 0) | 1518 | err = snd_timer_open(&tu->timeri, str, &tselect.id, current->pid); |
1519 | if (err < 0) | ||
1473 | goto __err; | 1520 | goto __err; |
1474 | 1521 | ||
1475 | kfree(tu->queue); | 1522 | kfree(tu->queue); |
@@ -1477,21 +1524,24 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user * | |||
1477 | kfree(tu->tqueue); | 1524 | kfree(tu->tqueue); |
1478 | tu->tqueue = NULL; | 1525 | tu->tqueue = NULL; |
1479 | if (tu->tread) { | 1526 | if (tu->tread) { |
1480 | tu->tqueue = (snd_timer_tread_t *)kmalloc(tu->queue_size * sizeof(snd_timer_tread_t), GFP_KERNEL); | 1527 | tu->tqueue = kmalloc(tu->queue_size * sizeof(snd_timer_tread_t), |
1528 | GFP_KERNEL); | ||
1481 | if (tu->tqueue == NULL) | 1529 | if (tu->tqueue == NULL) |
1482 | err = -ENOMEM; | 1530 | err = -ENOMEM; |
1483 | } else { | 1531 | } else { |
1484 | tu->queue = (snd_timer_read_t *)kmalloc(tu->queue_size * sizeof(snd_timer_read_t), GFP_KERNEL); | 1532 | tu->queue = kmalloc(tu->queue_size * sizeof(snd_timer_read_t), |
1533 | GFP_KERNEL); | ||
1485 | if (tu->queue == NULL) | 1534 | if (tu->queue == NULL) |
1486 | err = -ENOMEM; | 1535 | err = -ENOMEM; |
1487 | } | 1536 | } |
1488 | 1537 | ||
1489 | if (err < 0) { | 1538 | if (err < 0) { |
1490 | snd_timer_close(tu->timeri); | 1539 | snd_timer_close(tu->timeri); |
1491 | tu->timeri = NULL; | 1540 | tu->timeri = NULL; |
1492 | } else { | 1541 | } else { |
1493 | tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST; | 1542 | tu->timeri->flags |= SNDRV_TIMER_IFLG_FAST; |
1494 | tu->timeri->callback = tu->tread ? snd_timer_user_tinterrupt : snd_timer_user_interrupt; | 1543 | tu->timeri->callback = tu->tread |
1544 | ? snd_timer_user_tinterrupt : snd_timer_user_interrupt; | ||
1495 | tu->timeri->ccallback = snd_timer_user_ccallback; | 1545 | tu->timeri->ccallback = snd_timer_user_ccallback; |
1496 | tu->timeri->callback_data = (void *)tu; | 1546 | tu->timeri->callback_data = (void *)tu; |
1497 | } | 1547 | } |
@@ -1501,7 +1551,8 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user * | |||
1501 | return err; | 1551 | return err; |
1502 | } | 1552 | } |
1503 | 1553 | ||
1504 | static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info) | 1554 | static int snd_timer_user_info(struct file *file, |
1555 | snd_timer_info_t __user *_info) | ||
1505 | { | 1556 | { |
1506 | snd_timer_user_t *tu; | 1557 | snd_timer_user_t *tu; |
1507 | snd_timer_info_t *info; | 1558 | snd_timer_info_t *info; |
@@ -1528,7 +1579,8 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info | |||
1528 | return err; | 1579 | return err; |
1529 | } | 1580 | } |
1530 | 1581 | ||
1531 | static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_params) | 1582 | static int snd_timer_user_params(struct file *file, |
1583 | snd_timer_params_t __user *_params) | ||
1532 | { | 1584 | { |
1533 | snd_timer_user_t *tu; | 1585 | snd_timer_user_t *tu; |
1534 | snd_timer_params_t params; | 1586 | snd_timer_params_t params; |
@@ -1536,7 +1588,7 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1536 | snd_timer_read_t *tr; | 1588 | snd_timer_read_t *tr; |
1537 | snd_timer_tread_t *ttr; | 1589 | snd_timer_tread_t *ttr; |
1538 | int err; | 1590 | int err; |
1539 | 1591 | ||
1540 | tu = file->private_data; | 1592 | tu = file->private_data; |
1541 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1593 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1542 | t = tu->timeri->timer; | 1594 | t = tu->timeri->timer; |
@@ -1547,7 +1599,8 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1547 | err = -EINVAL; | 1599 | err = -EINVAL; |
1548 | goto _end; | 1600 | goto _end; |
1549 | } | 1601 | } |
1550 | if (params.queue_size > 0 && (params.queue_size < 32 || params.queue_size > 1024)) { | 1602 | if (params.queue_size > 0 && |
1603 | (params.queue_size < 32 || params.queue_size > 1024)) { | ||
1551 | err = -EINVAL; | 1604 | err = -EINVAL; |
1552 | goto _end; | 1605 | goto _end; |
1553 | } | 1606 | } |
@@ -1580,16 +1633,19 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1580 | if (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT) | 1633 | if (params.flags & SNDRV_TIMER_PSFLG_EARLY_EVENT) |
1581 | tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT; | 1634 | tu->timeri->flags |= SNDRV_TIMER_IFLG_EARLY_EVENT; |
1582 | spin_unlock_irq(&t->lock); | 1635 | spin_unlock_irq(&t->lock); |
1583 | if (params.queue_size > 0 && (unsigned int)tu->queue_size != params.queue_size) { | 1636 | if (params.queue_size > 0 && |
1637 | (unsigned int)tu->queue_size != params.queue_size) { | ||
1584 | if (tu->tread) { | 1638 | if (tu->tread) { |
1585 | ttr = (snd_timer_tread_t *)kmalloc(params.queue_size * sizeof(snd_timer_tread_t), GFP_KERNEL); | 1639 | ttr = kmalloc(params.queue_size * sizeof(*ttr), |
1640 | GFP_KERNEL); | ||
1586 | if (ttr) { | 1641 | if (ttr) { |
1587 | kfree(tu->tqueue); | 1642 | kfree(tu->tqueue); |
1588 | tu->queue_size = params.queue_size; | 1643 | tu->queue_size = params.queue_size; |
1589 | tu->tqueue = ttr; | 1644 | tu->tqueue = ttr; |
1590 | } | 1645 | } |
1591 | } else { | 1646 | } else { |
1592 | tr = (snd_timer_read_t *)kmalloc(params.queue_size * sizeof(snd_timer_read_t), GFP_KERNEL); | 1647 | tr = kmalloc(params.queue_size * sizeof(*tr), |
1648 | GFP_KERNEL); | ||
1593 | if (tr) { | 1649 | if (tr) { |
1594 | kfree(tu->queue); | 1650 | kfree(tu->queue); |
1595 | tu->queue_size = params.queue_size; | 1651 | tu->queue_size = params.queue_size; |
@@ -1613,7 +1669,6 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1613 | tu->qused++; | 1669 | tu->qused++; |
1614 | tu->qtail++; | 1670 | tu->qtail++; |
1615 | } | 1671 | } |
1616 | |||
1617 | } | 1672 | } |
1618 | tu->filter = params.filter; | 1673 | tu->filter = params.filter; |
1619 | tu->ticks = params.ticks; | 1674 | tu->ticks = params.ticks; |
@@ -1624,11 +1679,12 @@ static int snd_timer_user_params(struct file *file, snd_timer_params_t __user *_ | |||
1624 | return err; | 1679 | return err; |
1625 | } | 1680 | } |
1626 | 1681 | ||
1627 | static int snd_timer_user_status(struct file *file, snd_timer_status_t __user *_status) | 1682 | static int snd_timer_user_status(struct file *file, |
1683 | snd_timer_status_t __user *_status) | ||
1628 | { | 1684 | { |
1629 | snd_timer_user_t *tu; | 1685 | snd_timer_user_t *tu; |
1630 | snd_timer_status_t status; | 1686 | snd_timer_status_t status; |
1631 | 1687 | ||
1632 | tu = file->private_data; | 1688 | tu = file->private_data; |
1633 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1689 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1634 | memset(&status, 0, sizeof(status)); | 1690 | memset(&status, 0, sizeof(status)); |
@@ -1648,7 +1704,7 @@ static int snd_timer_user_start(struct file *file) | |||
1648 | { | 1704 | { |
1649 | int err; | 1705 | int err; |
1650 | snd_timer_user_t *tu; | 1706 | snd_timer_user_t *tu; |
1651 | 1707 | ||
1652 | tu = file->private_data; | 1708 | tu = file->private_data; |
1653 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1709 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1654 | snd_timer_stop(tu->timeri); | 1710 | snd_timer_stop(tu->timeri); |
@@ -1661,7 +1717,7 @@ static int snd_timer_user_stop(struct file *file) | |||
1661 | { | 1717 | { |
1662 | int err; | 1718 | int err; |
1663 | snd_timer_user_t *tu; | 1719 | snd_timer_user_t *tu; |
1664 | 1720 | ||
1665 | tu = file->private_data; | 1721 | tu = file->private_data; |
1666 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1722 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1667 | return (err = snd_timer_stop(tu->timeri)) < 0 ? err : 0; | 1723 | return (err = snd_timer_stop(tu->timeri)) < 0 ? err : 0; |
@@ -1671,7 +1727,7 @@ static int snd_timer_user_continue(struct file *file) | |||
1671 | { | 1727 | { |
1672 | int err; | 1728 | int err; |
1673 | snd_timer_user_t *tu; | 1729 | snd_timer_user_t *tu; |
1674 | 1730 | ||
1675 | tu = file->private_data; | 1731 | tu = file->private_data; |
1676 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1732 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1677 | tu->timeri->lost = 0; | 1733 | tu->timeri->lost = 0; |
@@ -1682,7 +1738,7 @@ static int snd_timer_user_pause(struct file *file) | |||
1682 | { | 1738 | { |
1683 | int err; | 1739 | int err; |
1684 | snd_timer_user_t *tu; | 1740 | snd_timer_user_t *tu; |
1685 | 1741 | ||
1686 | tu = file->private_data; | 1742 | tu = file->private_data; |
1687 | snd_assert(tu->timeri != NULL, return -ENXIO); | 1743 | snd_assert(tu->timeri != NULL, return -ENXIO); |
1688 | return (err = snd_timer_pause(tu->timeri)) < 0 ? err : 0; | 1744 | return (err = snd_timer_pause(tu->timeri)) < 0 ? err : 0; |
@@ -1695,12 +1751,13 @@ enum { | |||
1695 | SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23), | 1751 | SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23), |
1696 | }; | 1752 | }; |
1697 | 1753 | ||
1698 | static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 1754 | static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, |
1755 | unsigned long arg) | ||
1699 | { | 1756 | { |
1700 | snd_timer_user_t *tu; | 1757 | snd_timer_user_t *tu; |
1701 | void __user *argp = (void __user *)arg; | 1758 | void __user *argp = (void __user *)arg; |
1702 | int __user *p = argp; | 1759 | int __user *p = argp; |
1703 | 1760 | ||
1704 | tu = file->private_data; | 1761 | tu = file->private_data; |
1705 | switch (cmd) { | 1762 | switch (cmd) { |
1706 | case SNDRV_TIMER_IOCTL_PVERSION: | 1763 | case SNDRV_TIMER_IOCTL_PVERSION: |
@@ -1710,7 +1767,7 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned l | |||
1710 | case SNDRV_TIMER_IOCTL_TREAD: | 1767 | case SNDRV_TIMER_IOCTL_TREAD: |
1711 | { | 1768 | { |
1712 | int xarg; | 1769 | int xarg; |
1713 | 1770 | ||
1714 | down(&tu->tread_sem); | 1771 | down(&tu->tread_sem); |
1715 | if (tu->timeri) { /* too late */ | 1772 | if (tu->timeri) { /* too late */ |
1716 | up(&tu->tread_sem); | 1773 | up(&tu->tread_sem); |
@@ -1758,7 +1815,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on) | |||
1758 | { | 1815 | { |
1759 | snd_timer_user_t *tu; | 1816 | snd_timer_user_t *tu; |
1760 | int err; | 1817 | int err; |
1761 | 1818 | ||
1762 | tu = file->private_data; | 1819 | tu = file->private_data; |
1763 | err = fasync_helper(fd, file, on, &tu->fasync); | 1820 | err = fasync_helper(fd, file, on, &tu->fasync); |
1764 | if (err < 0) | 1821 | if (err < 0) |
@@ -1766,12 +1823,13 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on) | |||
1766 | return 0; | 1823 | return 0; |
1767 | } | 1824 | } |
1768 | 1825 | ||
1769 | static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_t count, loff_t *offset) | 1826 | static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, |
1827 | size_t count, loff_t *offset) | ||
1770 | { | 1828 | { |
1771 | snd_timer_user_t *tu; | 1829 | snd_timer_user_t *tu; |
1772 | long result = 0, unit; | 1830 | long result = 0, unit; |
1773 | int err = 0; | 1831 | int err = 0; |
1774 | 1832 | ||
1775 | tu = file->private_data; | 1833 | tu = file->private_data; |
1776 | unit = tu->tread ? sizeof(snd_timer_tread_t) : sizeof(snd_timer_read_t); | 1834 | unit = tu->tread ? sizeof(snd_timer_tread_t) : sizeof(snd_timer_read_t); |
1777 | spin_lock_irq(&tu->qlock); | 1835 | spin_lock_irq(&tu->qlock); |
@@ -1805,12 +1863,14 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, size_ | |||
1805 | goto _error; | 1863 | goto _error; |
1806 | 1864 | ||
1807 | if (tu->tread) { | 1865 | if (tu->tread) { |
1808 | if (copy_to_user(buffer, &tu->tqueue[tu->qhead++], sizeof(snd_timer_tread_t))) { | 1866 | if (copy_to_user(buffer, &tu->tqueue[tu->qhead++], |
1867 | sizeof(snd_timer_tread_t))) { | ||
1809 | err = -EFAULT; | 1868 | err = -EFAULT; |
1810 | goto _error; | 1869 | goto _error; |
1811 | } | 1870 | } |
1812 | } else { | 1871 | } else { |
1813 | if (copy_to_user(buffer, &tu->queue[tu->qhead++], sizeof(snd_timer_read_t))) { | 1872 | if (copy_to_user(buffer, &tu->queue[tu->qhead++], |
1873 | sizeof(snd_timer_read_t))) { | ||
1814 | err = -EFAULT; | 1874 | err = -EFAULT; |
1815 | goto _error; | 1875 | goto _error; |
1816 | } | 1876 | } |
@@ -1837,7 +1897,7 @@ static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait) | |||
1837 | tu = file->private_data; | 1897 | tu = file->private_data; |
1838 | 1898 | ||
1839 | poll_wait(file, &tu->qchange_sleep, wait); | 1899 | poll_wait(file, &tu->qchange_sleep, wait); |
1840 | 1900 | ||
1841 | mask = 0; | 1901 | mask = 0; |
1842 | if (tu->qused) | 1902 | if (tu->qused) |
1843 | mask |= POLLIN | POLLRDNORM; | 1903 | mask |= POLLIN | POLLRDNORM; |
@@ -1881,9 +1941,11 @@ static int __init alsa_timer_init(void) | |||
1881 | snd_info_entry_t *entry; | 1941 | snd_info_entry_t *entry; |
1882 | 1942 | ||
1883 | #ifdef SNDRV_OSS_INFO_DEV_TIMERS | 1943 | #ifdef SNDRV_OSS_INFO_DEV_TIMERS |
1884 | snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1, "system timer"); | 1944 | snd_oss_info_register(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1, |
1945 | "system timer"); | ||
1885 | #endif | 1946 | #endif |
1886 | if ((entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL)) != NULL) { | 1947 | entry = snd_info_create_module_entry(THIS_MODULE, "timers", NULL); |
1948 | if (entry != NULL) { | ||
1887 | entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128; | 1949 | entry->c.text.read_size = SNDRV_TIMER_DEVICES * 128; |
1888 | entry->c.text.read = snd_timer_proc_read; | 1950 | entry->c.text.read = snd_timer_proc_read; |
1889 | if (snd_info_register(entry) < 0) { | 1951 | if (snd_info_register(entry) < 0) { |
@@ -1893,10 +1955,12 @@ static int __init alsa_timer_init(void) | |||
1893 | } | 1955 | } |
1894 | snd_timer_proc_entry = entry; | 1956 | snd_timer_proc_entry = entry; |
1895 | if ((err = snd_timer_register_system()) < 0) | 1957 | if ((err = snd_timer_register_system()) < 0) |
1896 | snd_printk(KERN_ERR "unable to register system timer (%i)\n", err); | 1958 | snd_printk(KERN_ERR "unable to register system timer (%i)\n", |
1959 | err); | ||
1897 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, | 1960 | if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, |
1898 | NULL, 0, &snd_timer_reg, "timer"))<0) | 1961 | NULL, 0, &snd_timer_reg, "timer"))<0) |
1899 | snd_printk(KERN_ERR "unable to register timer device (%i)\n", err); | 1962 | snd_printk(KERN_ERR "unable to register timer device (%i)\n", |
1963 | err); | ||
1900 | return 0; | 1964 | return 0; |
1901 | } | 1965 | } |
1902 | 1966 | ||
@@ -1907,7 +1971,7 @@ static void __exit alsa_timer_exit(void) | |||
1907 | snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0); | 1971 | snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0); |
1908 | /* unregister the system timer */ | 1972 | /* unregister the system timer */ |
1909 | list_for_each_safe(p, n, &snd_timer_list) { | 1973 | list_for_each_safe(p, n, &snd_timer_list) { |
1910 | snd_timer_t *timer = (snd_timer_t *)list_entry(p, snd_timer_t, device_list); | 1974 | snd_timer_t *timer = list_entry(p, snd_timer_t, device_list); |
1911 | snd_timer_unregister(timer); | 1975 | snd_timer_unregister(timer); |
1912 | } | 1976 | } |
1913 | if (snd_timer_proc_entry) { | 1977 | if (snd_timer_proc_entry) { |
diff --git a/sound/core/wrappers.c b/sound/core/wrappers.c deleted file mode 100644 index 296b716f1376..000000000000 --- a/sound/core/wrappers.c +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * Various wrappers | ||
3 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | ||
4 | * | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/config.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/vmalloc.h> | ||
27 | #include <linux/fs.h> | ||
28 | |||
29 | #ifdef CONFIG_SND_DEBUG_MEMORY | ||
30 | void *snd_wrapper_kmalloc(size_t size, gfp_t flags) | ||
31 | { | ||
32 | return kmalloc(size, flags); | ||
33 | } | ||
34 | |||
35 | void snd_wrapper_kfree(const void *obj) | ||
36 | { | ||
37 | kfree(obj); | ||
38 | } | ||
39 | |||
40 | void *snd_wrapper_vmalloc(unsigned long size) | ||
41 | { | ||
42 | return vmalloc(size); | ||
43 | } | ||
44 | |||
45 | void snd_wrapper_vfree(void *obj) | ||
46 | { | ||
47 | vfree(obj); | ||
48 | } | ||
49 | #endif | ||
50 | |||
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index fe3f921ffbe3..bdeb2c00dac5 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c | |||
@@ -423,10 +423,7 @@ static void snd_mpu401_uart_free(snd_rawmidi_t *rmidi) | |||
423 | mpu401_t *mpu = rmidi->private_data; | 423 | mpu401_t *mpu = rmidi->private_data; |
424 | if (mpu->irq_flags && mpu->irq >= 0) | 424 | if (mpu->irq_flags && mpu->irq >= 0) |
425 | free_irq(mpu->irq, (void *) mpu); | 425 | free_irq(mpu->irq, (void *) mpu); |
426 | if (mpu->res) { | 426 | release_and_free_resource(mpu->res); |
427 | release_resource(mpu->res); | ||
428 | kfree_nocheck(mpu->res); | ||
429 | } | ||
430 | kfree(mpu); | 427 | kfree(mpu); |
431 | } | 428 | } |
432 | 429 | ||
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 3a25c89d2983..e9d52c668edc 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c | |||
@@ -717,10 +717,7 @@ static void free_mtpav(mtpav_t * crd) | |||
717 | spin_unlock_irqrestore(&crd->spinlock, flags); | 717 | spin_unlock_irqrestore(&crd->spinlock, flags); |
718 | if (crd->irq >= 0) | 718 | if (crd->irq >= 0) |
719 | free_irq(crd->irq, (void *)crd); | 719 | free_irq(crd->irq, (void *)crd); |
720 | if (crd->res_port) { | 720 | release_and_free_resource(crd->res_port); |
721 | release_resource(crd->res_port); | ||
722 | kfree_nocheck(crd->res_port); | ||
723 | } | ||
724 | kfree(crd); | 721 | kfree(crd); |
725 | } | 722 | } |
726 | 723 | ||
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c index 1f84d78260de..06246503083c 100644 --- a/sound/drivers/opl3/opl3_lib.c +++ b/sound/drivers/opl3/opl3_lib.c | |||
@@ -325,14 +325,8 @@ static int snd_opl3_free(opl3_t *opl3) | |||
325 | snd_assert(opl3 != NULL, return -ENXIO); | 325 | snd_assert(opl3 != NULL, return -ENXIO); |
326 | if (opl3->private_free) | 326 | if (opl3->private_free) |
327 | opl3->private_free(opl3); | 327 | opl3->private_free(opl3); |
328 | if (opl3->res_l_port) { | 328 | release_and_free_resource(opl3->res_l_port); |
329 | release_resource(opl3->res_l_port); | 329 | release_and_free_resource(opl3->res_r_port); |
330 | kfree_nocheck(opl3->res_l_port); | ||
331 | } | ||
332 | if (opl3->res_r_port) { | ||
333 | release_resource(opl3->res_r_port); | ||
334 | kfree_nocheck(opl3->res_r_port); | ||
335 | } | ||
336 | kfree(opl3); | 330 | kfree(opl3); |
337 | return 0; | 331 | return 0; |
338 | } | 332 | } |
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c index 380c2c704c54..4ae5dd8f011e 100644 --- a/sound/drivers/opl4/opl4_lib.c +++ b/sound/drivers/opl4/opl4_lib.c | |||
@@ -169,14 +169,8 @@ static void snd_opl4_free(opl4_t *opl4) | |||
169 | #ifdef CONFIG_PROC_FS | 169 | #ifdef CONFIG_PROC_FS |
170 | snd_opl4_free_proc(opl4); | 170 | snd_opl4_free_proc(opl4); |
171 | #endif | 171 | #endif |
172 | if (opl4->res_fm_port) { | 172 | release_and_free_resource(opl4->res_fm_port); |
173 | release_resource(opl4->res_fm_port); | 173 | release_and_free_resource(opl4->res_pcm_port); |
174 | kfree_nocheck(opl4->res_fm_port); | ||
175 | } | ||
176 | if (opl4->res_pcm_port) { | ||
177 | release_resource(opl4->res_pcm_port); | ||
178 | kfree_nocheck(opl4->res_pcm_port); | ||
179 | } | ||
180 | kfree(opl4); | 174 | kfree(opl4); |
181 | } | 175 | } |
182 | 176 | ||
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 416172ea1f47..1ed58df42671 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c | |||
@@ -749,10 +749,7 @@ static int snd_uart16550_free(snd_uart16550_t *uart) | |||
749 | { | 749 | { |
750 | if (uart->irq >= 0) | 750 | if (uart->irq >= 0) |
751 | free_irq(uart->irq, (void *)uart); | 751 | free_irq(uart->irq, (void *)uart); |
752 | if (uart->res_base) { | 752 | release_and_free_resource(uart->res_base); |
753 | release_resource(uart->res_base); | ||
754 | kfree_nocheck(uart->res_base); | ||
755 | } | ||
756 | kfree(uart); | 753 | kfree(uart); |
757 | return 0; | 754 | return 0; |
758 | }; | 755 | }; |
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index c2312d912fc7..2b46758fe86f 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c | |||
@@ -79,7 +79,7 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | |||
79 | /* already allocated */ | 79 | /* already allocated */ |
80 | if (runtime->dma_bytes >= size) | 80 | if (runtime->dma_bytes >= size) |
81 | return 0; /* already enough large */ | 81 | return 0; /* already enough large */ |
82 | vfree_nocheck(runtime->dma_area); /* bypass the memory wrapper */ | 82 | vfree(runtime->dma_area); |
83 | } | 83 | } |
84 | runtime->dma_area = vmalloc_32(size); | 84 | runtime->dma_area = vmalloc_32(size); |
85 | if (! runtime->dma_area) | 85 | if (! runtime->dma_area) |
@@ -98,7 +98,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | |||
98 | { | 98 | { |
99 | snd_pcm_runtime_t *runtime = subs->runtime; | 99 | snd_pcm_runtime_t *runtime = subs->runtime; |
100 | if (runtime->dma_area) { | 100 | if (runtime->dma_area) { |
101 | vfree_nocheck(runtime->dma_area); /* bypass the memory wrapper */ | 101 | vfree(runtime->dma_area); |
102 | runtime->dma_area = NULL; | 102 | runtime->dma_area = NULL; |
103 | } | 103 | } |
104 | return 0; | 104 | return 0; |
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index a21f7d541f86..1a05cfbdc7c6 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c | |||
@@ -75,7 +75,7 @@ int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned c | |||
75 | buf[0] = reg & 0x7f; | 75 | buf[0] = reg & 0x7f; |
76 | buf[1] = val; | 76 | buf[1] = val; |
77 | if ((err = snd_i2c_sendbytes(device, buf, 2)) != 2) { | 77 | if ((err = snd_i2c_sendbytes(device, buf, 2)) != 2) { |
78 | snd_printk("unable to send bytes 0x%02x:0x%02x to CS8427 (%i)\n", buf[0], buf[1], err); | 78 | snd_printk(KERN_ERR "unable to send bytes 0x%02x:0x%02x to CS8427 (%i)\n", buf[0], buf[1], err); |
79 | return err < 0 ? err : -EIO; | 79 | return err < 0 ? err : -EIO; |
80 | } | 80 | } |
81 | return 0; | 81 | return 0; |
@@ -87,11 +87,11 @@ static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg) | |||
87 | unsigned char buf; | 87 | unsigned char buf; |
88 | 88 | ||
89 | if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { | 89 | if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { |
90 | snd_printk("unable to send register 0x%x byte to CS8427\n", reg); | 90 | snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); |
91 | return err < 0 ? err : -EIO; | 91 | return err < 0 ? err : -EIO; |
92 | } | 92 | } |
93 | if ((err = snd_i2c_readbytes(device, &buf, 1)) != 1) { | 93 | if ((err = snd_i2c_readbytes(device, &buf, 1)) != 1) { |
94 | snd_printk("unable to read register 0x%x byte from CS8427\n", reg); | 94 | snd_printk(KERN_ERR "unable to read register 0x%x byte from CS8427\n", reg); |
95 | return err < 0 ? err : -EIO; | 95 | return err < 0 ? err : -EIO; |
96 | } | 96 | } |
97 | return buf; | 97 | return buf; |
@@ -210,7 +210,7 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, | |||
210 | snd_i2c_lock(bus); | 210 | snd_i2c_lock(bus); |
211 | if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) { | 211 | if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) { |
212 | snd_i2c_unlock(bus); | 212 | snd_i2c_unlock(bus); |
213 | snd_printk("unable to find CS8427 signature (expected 0x%x, read 0x%x), initialization is not completed\n", CS8427_VER8427A, err); | 213 | snd_printk(KERN_ERR "unable to find CS8427 signature (expected 0x%x, read 0x%x), initialization is not completed\n", CS8427_VER8427A, err); |
214 | return -EFAULT; | 214 | return -EFAULT; |
215 | } | 215 | } |
216 | /* turn off run bit while making changes to configuration */ | 216 | /* turn off run bit while making changes to configuration */ |
@@ -260,7 +260,7 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, | |||
260 | snd_i2c_sendbytes(device, buf, 1); | 260 | snd_i2c_sendbytes(device, buf, 1); |
261 | snd_i2c_readbytes(device, buf, 127); | 261 | snd_i2c_readbytes(device, buf, 127); |
262 | for (xx = 0; xx < 127; xx++) | 262 | for (xx = 0; xx < 127; xx++) |
263 | printk("reg[0x%x] = 0x%x\n", xx+1, buf[xx]); | 263 | printk(KERN_DEBUG "reg[0x%x] = 0x%x\n", xx+1, buf[xx]); |
264 | } | 264 | } |
265 | #endif | 265 | #endif |
266 | 266 | ||
@@ -302,8 +302,7 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427) | |||
302 | snd_i2c_unlock(cs8427->bus); | 302 | snd_i2c_unlock(cs8427->bus); |
303 | if (!(data & CS8427_UNLOCK)) | 303 | if (!(data & CS8427_UNLOCK)) |
304 | break; | 304 | break; |
305 | set_current_state(TASK_UNINTERRUPTIBLE); | 305 | schedule_timeout_uninterruptible(1); |
306 | schedule_timeout(1); | ||
307 | } | 306 | } |
308 | snd_i2c_lock(cs8427->bus); | 307 | snd_i2c_lock(cs8427->bus); |
309 | chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; | 308 | chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; |
@@ -354,12 +353,12 @@ static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, | |||
354 | 353 | ||
355 | snd_i2c_lock(device->bus); | 354 | snd_i2c_lock(device->bus); |
356 | if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { | 355 | if ((err = snd_i2c_sendbytes(device, ®, 1)) != 1) { |
357 | snd_printk("unable to send register 0x%x byte to CS8427\n", reg); | 356 | snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); |
358 | snd_i2c_unlock(device->bus); | 357 | snd_i2c_unlock(device->bus); |
359 | return err < 0 ? err : -EIO; | 358 | return err < 0 ? err : -EIO; |
360 | } | 359 | } |
361 | if ((err = snd_i2c_readbytes(device, ucontrol->value.bytes.data, 10)) != 10) { | 360 | if ((err = snd_i2c_readbytes(device, ucontrol->value.bytes.data, 10)) != 10) { |
362 | snd_printk("unable to read Q-subcode bytes from CS8427\n"); | 361 | snd_printk(KERN_ERR "unable to read Q-subcode bytes from CS8427\n"); |
363 | snd_i2c_unlock(device->bus); | 362 | snd_i2c_unlock(device->bus); |
364 | return err < 0 ? err : -EIO; | 363 | return err < 0 ? err : -EIO; |
365 | } | 364 | } |
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index af5eadcddd92..d351b3aa1916 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c | |||
@@ -56,9 +56,9 @@ static void reg_dump(ak4114_t *ak4114) | |||
56 | { | 56 | { |
57 | int i; | 57 | int i; |
58 | 58 | ||
59 | printk("AK4114 REG DUMP:\n"); | 59 | printk(KERN_DEBUG "AK4114 REG DUMP:\n"); |
60 | for (i = 0; i < 0x20; i++) | 60 | for (i = 0; i < 0x20; i++) |
61 | printk("reg[%02x] = %02x (%02x)\n", i, reg_read(ak4114, i), i < sizeof(ak4114->regmap) ? ak4114->regmap[i] : 0); | 61 | printk(KERN_DEBUG "reg[%02x] = %02x (%02x)\n", i, reg_read(ak4114, i), i < sizeof(ak4114->regmap) ? ak4114->regmap[i] : 0); |
62 | } | 62 | } |
63 | #endif | 63 | #endif |
64 | 64 | ||
@@ -552,7 +552,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) | |||
552 | if (!(flags & AK4114_CHECK_NO_RATE) && runtime && runtime->rate != res) { | 552 | if (!(flags & AK4114_CHECK_NO_RATE) && runtime && runtime->rate != res) { |
553 | snd_pcm_stream_lock_irqsave(ak4114->capture_substream, _flags); | 553 | snd_pcm_stream_lock_irqsave(ak4114->capture_substream, _flags); |
554 | if (snd_pcm_running(ak4114->capture_substream)) { | 554 | if (snd_pcm_running(ak4114->capture_substream)) { |
555 | // printk("rate changed (%i <- %i)\n", runtime->rate, res); | 555 | // printk(KERN_DEBUG "rate changed (%i <- %i)\n", runtime->rate, res); |
556 | snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING); | 556 | snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING); |
557 | res = 1; | 557 | res = 1; |
558 | } | 558 | } |
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index d51b51dd86d6..35b4584483a3 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c | |||
@@ -54,9 +54,9 @@ static void reg_dump(ak4117_t *ak4117) | |||
54 | { | 54 | { |
55 | int i; | 55 | int i; |
56 | 56 | ||
57 | printk("AK4117 REG DUMP:\n"); | 57 | printk(KERN_DEBUG "AK4117 REG DUMP:\n"); |
58 | for (i = 0; i < 0x1b; i++) | 58 | for (i = 0; i < 0x1b; i++) |
59 | printk("reg[%02x] = %02x (%02x)\n", i, reg_read(ak4117, i), i < sizeof(ak4117->regmap) ? ak4117->regmap[i] : 0); | 59 | printk(KERN_DEBUG "reg[%02x] = %02x (%02x)\n", i, reg_read(ak4117, i), i < sizeof(ak4117->regmap) ? ak4117->regmap[i] : 0); |
60 | } | 60 | } |
61 | #endif | 61 | #endif |
62 | 62 | ||
@@ -477,7 +477,7 @@ int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags) | |||
477 | goto __rate; | 477 | goto __rate; |
478 | rcs0 = reg_read(ak4117, AK4117_REG_RCS0); | 478 | rcs0 = reg_read(ak4117, AK4117_REG_RCS0); |
479 | rcs2 = reg_read(ak4117, AK4117_REG_RCS2); | 479 | rcs2 = reg_read(ak4117, AK4117_REG_RCS2); |
480 | // printk("AK IRQ: rcs0 = 0x%x, rcs1 = 0x%x, rcs2 = 0x%x\n", rcs0, rcs1, rcs2); | 480 | // printk(KERN_DEBUG "AK IRQ: rcs0 = 0x%x, rcs1 = 0x%x, rcs2 = 0x%x\n", rcs0, rcs1, rcs2); |
481 | spin_lock_irqsave(&ak4117->lock, _flags); | 481 | spin_lock_irqsave(&ak4117->lock, _flags); |
482 | if (rcs0 & AK4117_PAR) | 482 | if (rcs0 & AK4117_PAR) |
483 | ak4117->parity_errors++; | 483 | ak4117->parity_errors++; |
@@ -530,7 +530,7 @@ int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags) | |||
530 | if (!(flags & AK4117_CHECK_NO_RATE) && runtime && runtime->rate != res) { | 530 | if (!(flags & AK4117_CHECK_NO_RATE) && runtime && runtime->rate != res) { |
531 | snd_pcm_stream_lock_irqsave(ak4117->substream, _flags); | 531 | snd_pcm_stream_lock_irqsave(ak4117->substream, _flags); |
532 | if (snd_pcm_running(ak4117->substream)) { | 532 | if (snd_pcm_running(ak4117->substream)) { |
533 | // printk("rate changed (%i <- %i)\n", runtime->rate, res); | 533 | // printk(KERN_DEBUG "rate changed (%i <- %i)\n", runtime->rate, res); |
534 | snd_pcm_stop(ak4117->substream, SNDRV_PCM_STATE_DRAINING); | 534 | snd_pcm_stop(ak4117->substream, SNDRV_PCM_STATE_DRAINING); |
535 | wake_up(&runtime->sleep); | 535 | wake_up(&runtime->sleep); |
536 | res = 1; | 536 | res = 1; |
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c index fd65da654267..4fdd1fb57dfe 100644 --- a/sound/i2c/tea6330t.c +++ b/sound/i2c/tea6330t.c | |||
@@ -58,7 +58,7 @@ static void snd_tea6330t_set(tea6330t_t *tea, | |||
58 | unsigned char addr, unsigned char value) | 58 | unsigned char addr, unsigned char value) |
59 | { | 59 | { |
60 | #if 0 | 60 | #if 0 |
61 | printk("set - 0x%x/0x%x\n", addr, value); | 61 | printk(KERN_DEBUG "set - 0x%x/0x%x\n", addr, value); |
62 | #endif | 62 | #endif |
63 | snd_i2c_write(tea->bus, TEA6330T_ADDR, addr, value, 1); | 63 | snd_i2c_write(tea->bus, TEA6330T_ADDR, addr, value, 1); |
64 | } | 64 | } |
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index 27a9dcfbba00..7ae02396cae2 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c | |||
@@ -542,10 +542,7 @@ static int snd_ad1816a_probe(ad1816a_t *chip) | |||
542 | 542 | ||
543 | static int snd_ad1816a_free(ad1816a_t *chip) | 543 | static int snd_ad1816a_free(ad1816a_t *chip) |
544 | { | 544 | { |
545 | if (chip->res_port) { | 545 | release_and_free_resource(chip->res_port); |
546 | release_resource(chip->res_port); | ||
547 | kfree_nocheck(chip->res_port); | ||
548 | } | ||
549 | if (chip->irq >= 0) | 546 | if (chip->irq >= 0) |
550 | free_irq(chip->irq, (void *) chip); | 547 | free_irq(chip->irq, (void *) chip); |
551 | if (chip->dma1 >= 0) { | 548 | if (chip->dma1 >= 0) { |
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 303861cd03cd..891bacc94f68 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c | |||
@@ -109,7 +109,7 @@ void snd_ad1848_out(ad1848_t *chip, | |||
109 | udelay(100); | 109 | udelay(100); |
110 | #ifdef CONFIG_SND_DEBUG | 110 | #ifdef CONFIG_SND_DEBUG |
111 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) | 111 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) |
112 | snd_printk("auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 112 | snd_printk(KERN_WARNING "auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
113 | #endif | 113 | #endif |
114 | outb(chip->mce_bit | reg, AD1848P(chip, REGSEL)); | 114 | outb(chip->mce_bit | reg, AD1848P(chip, REGSEL)); |
115 | outb(chip->image[reg] = value, AD1848P(chip, REG)); | 115 | outb(chip->image[reg] = value, AD1848P(chip, REG)); |
@@ -139,7 +139,7 @@ static unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg) | |||
139 | udelay(100); | 139 | udelay(100); |
140 | #ifdef CONFIG_SND_DEBUG | 140 | #ifdef CONFIG_SND_DEBUG |
141 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) | 141 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) |
142 | snd_printk("auto calibration time out - reg = 0x%x\n", reg); | 142 | snd_printk(KERN_WARNING "auto calibration time out - reg = 0x%x\n", reg); |
143 | #endif | 143 | #endif |
144 | outb(chip->mce_bit | reg, AD1848P(chip, REGSEL)); | 144 | outb(chip->mce_bit | reg, AD1848P(chip, REGSEL)); |
145 | mb(); | 145 | mb(); |
@@ -185,13 +185,13 @@ static void snd_ad1848_mce_up(ad1848_t *chip) | |||
185 | udelay(100); | 185 | udelay(100); |
186 | #ifdef CONFIG_SND_DEBUG | 186 | #ifdef CONFIG_SND_DEBUG |
187 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) | 187 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) |
188 | snd_printk("mce_up - auto calibration time out (0)\n"); | 188 | snd_printk(KERN_WARNING "mce_up - auto calibration time out (0)\n"); |
189 | #endif | 189 | #endif |
190 | spin_lock_irqsave(&chip->reg_lock, flags); | 190 | spin_lock_irqsave(&chip->reg_lock, flags); |
191 | chip->mce_bit |= AD1848_MCE; | 191 | chip->mce_bit |= AD1848_MCE; |
192 | timeout = inb(AD1848P(chip, REGSEL)); | 192 | timeout = inb(AD1848P(chip, REGSEL)); |
193 | if (timeout == 0x80) | 193 | if (timeout == 0x80) |
194 | snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); | 194 | snd_printk(KERN_WARNING "mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); |
195 | if (!(timeout & AD1848_MCE)) | 195 | if (!(timeout & AD1848_MCE)) |
196 | outb(chip->mce_bit | (timeout & 0x1f), AD1848P(chip, REGSEL)); | 196 | outb(chip->mce_bit | (timeout & 0x1f), AD1848P(chip, REGSEL)); |
197 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 197 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -214,13 +214,13 @@ static void snd_ad1848_mce_down(ad1848_t *chip) | |||
214 | #endif | 214 | #endif |
215 | #ifdef CONFIG_SND_DEBUG | 215 | #ifdef CONFIG_SND_DEBUG |
216 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) | 216 | if (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) |
217 | snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", AD1848P(chip, REGSEL)); | 217 | snd_printk(KERN_WARNING "mce_down [0x%lx] - auto calibration time out (0)\n", AD1848P(chip, REGSEL)); |
218 | #endif | 218 | #endif |
219 | chip->mce_bit &= ~AD1848_MCE; | 219 | chip->mce_bit &= ~AD1848_MCE; |
220 | timeout = inb(AD1848P(chip, REGSEL)); | 220 | timeout = inb(AD1848P(chip, REGSEL)); |
221 | outb(chip->mce_bit | (timeout & 0x1f), AD1848P(chip, REGSEL)); | 221 | outb(chip->mce_bit | (timeout & 0x1f), AD1848P(chip, REGSEL)); |
222 | if (timeout == 0x80) | 222 | if (timeout == 0x80) |
223 | snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); | 223 | snd_printk(KERN_WARNING "mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); |
224 | if ((timeout & AD1848_MCE) == 0) { | 224 | if ((timeout & AD1848_MCE) == 0) { |
225 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 225 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
226 | return; | 226 | return; |
@@ -240,11 +240,10 @@ static void snd_ad1848_mce_down(ad1848_t *chip) | |||
240 | while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) { | 240 | while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) { |
241 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 241 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
242 | if (time <= 0) { | 242 | if (time <= 0) { |
243 | snd_printk("mce_down - auto calibration time out (2)\n"); | 243 | snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n"); |
244 | return; | 244 | return; |
245 | } | 245 | } |
246 | set_current_state(TASK_INTERRUPTIBLE); | 246 | time = schedule_timeout_interruptible(time); |
247 | time = schedule_timeout(time); | ||
248 | spin_lock_irqsave(&chip->reg_lock, flags); | 247 | spin_lock_irqsave(&chip->reg_lock, flags); |
249 | } | 248 | } |
250 | #if 0 | 249 | #if 0 |
@@ -254,11 +253,10 @@ static void snd_ad1848_mce_down(ad1848_t *chip) | |||
254 | while (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) { | 253 | while (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) { |
255 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 254 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
256 | if (time <= 0) { | 255 | if (time <= 0) { |
257 | snd_printk("mce_down - auto calibration time out (3)\n"); | 256 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); |
258 | return; | 257 | return; |
259 | } | 258 | } |
260 | set_current_state(TASK_INTERRUPTIBLE); | 259 | time = schedule_timeout_interruptible(time); |
261 | time = schedule_timeout(time); | ||
262 | spin_lock_irqsave(&chip->reg_lock, flags); | 260 | spin_lock_irqsave(&chip->reg_lock, flags); |
263 | } | 261 | } |
264 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 262 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -846,10 +844,7 @@ static int snd_ad1848_capture_close(snd_pcm_substream_t * substream) | |||
846 | 844 | ||
847 | static int snd_ad1848_free(ad1848_t *chip) | 845 | static int snd_ad1848_free(ad1848_t *chip) |
848 | { | 846 | { |
849 | if (chip->res_port) { | 847 | release_and_free_resource(chip->res_port); |
850 | release_resource(chip->res_port); | ||
851 | kfree_nocheck(chip->res_port); | ||
852 | } | ||
853 | if (chip->irq >= 0) | 848 | if (chip->irq >= 0) |
854 | free_irq(chip->irq, (void *) chip); | 849 | free_irq(chip->irq, (void *) chip); |
855 | if (chip->dma >= 0) { | 850 | if (chip->dma >= 0) { |
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 32318258cd8e..4af769030beb 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c | |||
@@ -1417,14 +1417,8 @@ static int snd_cs4231_pm_resume(snd_card_t *card) | |||
1417 | 1417 | ||
1418 | static int snd_cs4231_free(cs4231_t *chip) | 1418 | static int snd_cs4231_free(cs4231_t *chip) |
1419 | { | 1419 | { |
1420 | if (chip->res_port) { | 1420 | release_and_free_resource(chip->res_port); |
1421 | release_resource(chip->res_port); | 1421 | release_and_free_resource(chip->res_cport); |
1422 | kfree_nocheck(chip->res_port); | ||
1423 | } | ||
1424 | if (chip->res_cport) { | ||
1425 | release_resource(chip->res_cport); | ||
1426 | kfree_nocheck(chip->res_cport); | ||
1427 | } | ||
1428 | if (chip->irq >= 0) { | 1422 | if (chip->irq >= 0) { |
1429 | disable_irq(chip->irq); | 1423 | disable_irq(chip->irq); |
1430 | if (!(chip->hwshare & CS4231_HWSHARE_IRQ)) | 1424 | if (!(chip->hwshare & CS4231_HWSHARE_IRQ)) |
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index d28315dc72f7..d60a55e6a0b1 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c | |||
@@ -379,12 +379,8 @@ static void snd_card_cs4236_free(snd_card_t *card) | |||
379 | { | 379 | { |
380 | struct snd_card_cs4236 *acard = (struct snd_card_cs4236 *)card->private_data; | 380 | struct snd_card_cs4236 *acard = (struct snd_card_cs4236 *)card->private_data; |
381 | 381 | ||
382 | if (acard) { | 382 | if (acard) |
383 | if (acard->res_sb_port) { | 383 | release_and_free_resource(acard->res_sb_port); |
384 | release_resource(acard->res_sb_port); | ||
385 | kfree_nocheck(acard->res_sb_port); | ||
386 | } | ||
387 | } | ||
388 | } | 384 | } |
389 | 385 | ||
390 | #ifdef CONFIG_PNP | 386 | #ifdef CONFIG_PNP |
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 2128d4bdef41..1adb88d5f8f4 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c | |||
@@ -173,7 +173,10 @@ static unsigned char divisor_to_rate_register(unsigned int divisor) | |||
173 | case 2117: return 6; | 173 | case 2117: return 6; |
174 | case 2558: return 7; | 174 | case 2558: return 7; |
175 | default: | 175 | default: |
176 | snd_runtime_check(divisor >= 21 && divisor <= 192, return 192); | 176 | if (divisor < 21 || divisor > 192) { |
177 | snd_BUG(); | ||
178 | return 192; | ||
179 | } | ||
177 | return divisor; | 180 | return divisor; |
178 | } | 181 | } |
179 | } | 182 | } |
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index aac898765c02..2edc9c9f0445 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c | |||
@@ -606,8 +606,7 @@ static int snd_es1688_free(es1688_t *chip) | |||
606 | { | 606 | { |
607 | if (chip->res_port) { | 607 | if (chip->res_port) { |
608 | snd_es1688_init(chip, 0); | 608 | snd_es1688_init(chip, 0); |
609 | release_resource(chip->res_port); | 609 | release_and_free_resource(chip->res_port); |
610 | kfree_nocheck(chip->res_port); | ||
611 | } | 610 | } |
612 | if (chip->irq >= 0) | 611 | if (chip->irq >= 0) |
613 | free_irq(chip->irq, (void *) chip); | 612 | free_irq(chip->irq, (void *) chip); |
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index d0ea19f42703..970e2aaade27 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c | |||
@@ -173,7 +173,7 @@ static int snd_es18xx_dsp_command(es18xx_t *chip, unsigned char val) | |||
173 | outb(val, chip->port + 0x0C); | 173 | outb(val, chip->port + 0x0C); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | snd_printk("dsp_command: timeout (0x%x)\n", val); | 176 | snd_printk(KERN_ERR "dsp_command: timeout (0x%x)\n", val); |
177 | return -EINVAL; | 177 | return -EINVAL; |
178 | } | 178 | } |
179 | 179 | ||
@@ -184,7 +184,8 @@ static int snd_es18xx_dsp_get_byte(es18xx_t *chip) | |||
184 | for(i = MILLISECOND/10; i; i--) | 184 | for(i = MILLISECOND/10; i; i--) |
185 | if (inb(chip->port + 0x0C) & 0x40) | 185 | if (inb(chip->port + 0x0C) & 0x40) |
186 | return inb(chip->port + 0x0A); | 186 | return inb(chip->port + 0x0A); |
187 | snd_printk("dsp_get_byte failed: 0x%lx = 0x%x!!!\n", chip->port + 0x0A, inb(chip->port + 0x0A)); | 187 | snd_printk(KERN_ERR "dsp_get_byte failed: 0x%lx = 0x%x!!!\n", |
188 | chip->port + 0x0A, inb(chip->port + 0x0A)); | ||
188 | return -ENODEV; | 189 | return -ENODEV; |
189 | } | 190 | } |
190 | 191 | ||
@@ -204,7 +205,7 @@ static int snd_es18xx_write(es18xx_t *chip, | |||
204 | end: | 205 | end: |
205 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 206 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
206 | #ifdef REG_DEBUG | 207 | #ifdef REG_DEBUG |
207 | snd_printk("Reg %02x set to %02x\n", reg, data); | 208 | snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, data); |
208 | #endif | 209 | #endif |
209 | return ret; | 210 | return ret; |
210 | } | 211 | } |
@@ -223,7 +224,7 @@ static int snd_es18xx_read(es18xx_t *chip, unsigned char reg) | |||
223 | data = snd_es18xx_dsp_get_byte(chip); | 224 | data = snd_es18xx_dsp_get_byte(chip); |
224 | ret = data; | 225 | ret = data; |
225 | #ifdef REG_DEBUG | 226 | #ifdef REG_DEBUG |
226 | snd_printk("Reg %02x now is %02x (%d)\n", reg, data, ret); | 227 | snd_printk(KERN_DEBUG "Reg %02x now is %02x (%d)\n", reg, data, ret); |
227 | #endif | 228 | #endif |
228 | end: | 229 | end: |
229 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 230 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -259,7 +260,8 @@ static int snd_es18xx_bits(es18xx_t *chip, unsigned char reg, | |||
259 | if (ret < 0) | 260 | if (ret < 0) |
260 | goto end; | 261 | goto end; |
261 | #ifdef REG_DEBUG | 262 | #ifdef REG_DEBUG |
262 | snd_printk("Reg %02x was %02x, set to %02x (%d)\n", reg, old, new, ret); | 263 | snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x (%d)\n", |
264 | reg, old, new, ret); | ||
263 | #endif | 265 | #endif |
264 | } | 266 | } |
265 | ret = oval; | 267 | ret = oval; |
@@ -277,7 +279,7 @@ static inline void snd_es18xx_mixer_write(es18xx_t *chip, | |||
277 | outb(data, chip->port + 0x05); | 279 | outb(data, chip->port + 0x05); |
278 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 280 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
279 | #ifdef REG_DEBUG | 281 | #ifdef REG_DEBUG |
280 | snd_printk("Mixer reg %02x set to %02x\n", reg, data); | 282 | snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, data); |
281 | #endif | 283 | #endif |
282 | } | 284 | } |
283 | 285 | ||
@@ -290,7 +292,7 @@ static inline int snd_es18xx_mixer_read(es18xx_t *chip, unsigned char reg) | |||
290 | data = inb(chip->port + 0x05); | 292 | data = inb(chip->port + 0x05); |
291 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 293 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
292 | #ifdef REG_DEBUG | 294 | #ifdef REG_DEBUG |
293 | snd_printk("Mixer reg %02x now is %02x\n", reg, data); | 295 | snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data); |
294 | #endif | 296 | #endif |
295 | return data; | 297 | return data; |
296 | } | 298 | } |
@@ -309,7 +311,8 @@ static inline int snd_es18xx_mixer_bits(es18xx_t *chip, unsigned char reg, | |||
309 | new = (old & ~mask) | (val & mask); | 311 | new = (old & ~mask) | (val & mask); |
310 | outb(new, chip->port + 0x05); | 312 | outb(new, chip->port + 0x05); |
311 | #ifdef REG_DEBUG | 313 | #ifdef REG_DEBUG |
312 | snd_printk("Mixer reg %02x was %02x, set to %02x\n", reg, old, new); | 314 | snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x\n", |
315 | reg, old, new); | ||
313 | #endif | 316 | #endif |
314 | } | 317 | } |
315 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 318 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
@@ -329,7 +332,8 @@ static inline int snd_es18xx_mixer_writable(es18xx_t *chip, unsigned char reg, | |||
329 | new = inb(chip->port + 0x05); | 332 | new = inb(chip->port + 0x05); |
330 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 333 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
331 | #ifdef REG_DEBUG | 334 | #ifdef REG_DEBUG |
332 | snd_printk("Mixer reg %02x was %02x, set to %02x, now is %02x\n", reg, old, expected, new); | 335 | snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x, now is %02x\n", |
336 | reg, old, expected, new); | ||
333 | #endif | 337 | #endif |
334 | return expected == new; | 338 | return expected == new; |
335 | } | 339 | } |
@@ -1281,7 +1285,7 @@ static void __devinit snd_es18xx_config_write(es18xx_t *chip, | |||
1281 | outb(reg, chip->ctrl_port); | 1285 | outb(reg, chip->ctrl_port); |
1282 | outb(data, chip->ctrl_port + 1); | 1286 | outb(data, chip->ctrl_port + 1); |
1283 | #ifdef REG_DEBUG | 1287 | #ifdef REG_DEBUG |
1284 | snd_printk("Config reg %02x set to %02x\n", reg, data); | 1288 | snd_printk(KERN_DEBUG "Config reg %02x set to %02x\n", reg, data); |
1285 | #endif | 1289 | #endif |
1286 | } | 1290 | } |
1287 | 1291 | ||
@@ -1346,7 +1350,7 @@ static int __devinit snd_es18xx_initialize(es18xx_t *chip) | |||
1346 | irqmask = 3; | 1350 | irqmask = 3; |
1347 | break; | 1351 | break; |
1348 | default: | 1352 | default: |
1349 | snd_printk("invalid irq %d\n", chip->irq); | 1353 | snd_printk(KERN_ERR "invalid irq %d\n", chip->irq); |
1350 | return -ENODEV; | 1354 | return -ENODEV; |
1351 | } | 1355 | } |
1352 | switch (chip->dma1) { | 1356 | switch (chip->dma1) { |
@@ -1360,7 +1364,7 @@ static int __devinit snd_es18xx_initialize(es18xx_t *chip) | |||
1360 | dma1mask = 3; | 1364 | dma1mask = 3; |
1361 | break; | 1365 | break; |
1362 | default: | 1366 | default: |
1363 | snd_printk("invalid dma1 %d\n", chip->dma1); | 1367 | snd_printk(KERN_ERR "invalid dma1 %d\n", chip->dma1); |
1364 | return -ENODEV; | 1368 | return -ENODEV; |
1365 | } | 1369 | } |
1366 | switch (chip->dma2) { | 1370 | switch (chip->dma2) { |
@@ -1377,7 +1381,7 @@ static int __devinit snd_es18xx_initialize(es18xx_t *chip) | |||
1377 | dma2mask = 3; | 1381 | dma2mask = 3; |
1378 | break; | 1382 | break; |
1379 | default: | 1383 | default: |
1380 | snd_printk("invalid dma2 %d\n", chip->dma2); | 1384 | snd_printk(KERN_ERR "invalid dma2 %d\n", chip->dma2); |
1381 | return -ENODEV; | 1385 | return -ENODEV; |
1382 | } | 1386 | } |
1383 | 1387 | ||
@@ -1440,7 +1444,7 @@ static int __devinit snd_es18xx_identify(es18xx_t *chip) | |||
1440 | 1444 | ||
1441 | /* reset */ | 1445 | /* reset */ |
1442 | if (snd_es18xx_reset(chip) < 0) { | 1446 | if (snd_es18xx_reset(chip) < 0) { |
1443 | snd_printk("reset at 0x%lx failed!!!\n", chip->port); | 1447 | snd_printk(KERN_ERR "reset at 0x%lx failed!!!\n", chip->port); |
1444 | return -ENODEV; | 1448 | return -ENODEV; |
1445 | } | 1449 | } |
1446 | 1450 | ||
@@ -1527,7 +1531,7 @@ static int __devinit snd_es18xx_probe(es18xx_t *chip) | |||
1527 | chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; | 1531 | chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; |
1528 | break; | 1532 | break; |
1529 | default: | 1533 | default: |
1530 | snd_printk("[0x%lx] unsupported chip ES%x\n", | 1534 | snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n", |
1531 | chip->port, chip->version); | 1535 | chip->port, chip->version); |
1532 | return -ENODEV; | 1536 | return -ENODEV; |
1533 | } | 1537 | } |
@@ -1640,18 +1644,9 @@ static int snd_es18xx_resume(snd_card_t *card) | |||
1640 | 1644 | ||
1641 | static int snd_es18xx_free(es18xx_t *chip) | 1645 | static int snd_es18xx_free(es18xx_t *chip) |
1642 | { | 1646 | { |
1643 | if (chip->res_port) { | 1647 | release_and_free_resource(chip->res_port); |
1644 | release_resource(chip->res_port); | 1648 | release_and_free_resource(chip->res_ctrl_port); |
1645 | kfree_nocheck(chip->res_port); | 1649 | release_and_free_resource(chip->res_mpu_port); |
1646 | } | ||
1647 | if (chip->res_ctrl_port) { | ||
1648 | release_resource(chip->res_ctrl_port); | ||
1649 | kfree_nocheck(chip->res_ctrl_port); | ||
1650 | } | ||
1651 | if (chip->res_mpu_port) { | ||
1652 | release_resource(chip->res_mpu_port); | ||
1653 | kfree_nocheck(chip->res_mpu_port); | ||
1654 | } | ||
1655 | if (chip->irq >= 0) | 1650 | if (chip->irq >= 0) |
1656 | free_irq(chip->irq, (void *) chip); | 1651 | free_irq(chip->irq, (void *) chip); |
1657 | if (chip->dma1 >= 0) { | 1652 | if (chip->dma1 >= 0) { |
diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index de4b56d80b35..ef1b2e9832e4 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c | |||
@@ -199,7 +199,7 @@ int snd_gf1_dma_transfer_block(snd_gus_card_t * gus, | |||
199 | 199 | ||
200 | block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL); | 200 | block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL); |
201 | if (block == NULL) { | 201 | if (block == NULL) { |
202 | snd_printk("gf1: DMA transfer failure; not enough memory\n"); | 202 | snd_printk(KERN_ERR "gf1: DMA transfer failure; not enough memory\n"); |
203 | return -ENOMEM; | 203 | return -ENOMEM; |
204 | } | 204 | } |
205 | *block = *__block; | 205 | *block = *__block; |
diff --git a/sound/isa/gus/gus_io.c b/sound/isa/gus/gus_io.c index 23e1b5f19e1a..8d5752b23787 100644 --- a/sound/isa/gus/gus_io.c +++ b/sound/isa/gus/gus_io.c | |||
@@ -343,7 +343,7 @@ void snd_gf1_pokew(snd_gus_card_t * gus, unsigned int addr, unsigned short data) | |||
343 | 343 | ||
344 | #ifdef CONFIG_SND_DEBUG | 344 | #ifdef CONFIG_SND_DEBUG |
345 | if (!gus->interwave) | 345 | if (!gus->interwave) |
346 | snd_printk("snd_gf1_pokew - GF1!!!\n"); | 346 | snd_printk(KERN_DEBUG "snd_gf1_pokew - GF1!!!\n"); |
347 | #endif | 347 | #endif |
348 | spin_lock_irqsave(&gus->reg_lock, flags); | 348 | spin_lock_irqsave(&gus->reg_lock, flags); |
349 | outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel); | 349 | outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel); |
@@ -367,7 +367,7 @@ unsigned short snd_gf1_peekw(snd_gus_card_t * gus, unsigned int addr) | |||
367 | 367 | ||
368 | #ifdef CONFIG_SND_DEBUG | 368 | #ifdef CONFIG_SND_DEBUG |
369 | if (!gus->interwave) | 369 | if (!gus->interwave) |
370 | snd_printk("snd_gf1_peekw - GF1!!!\n"); | 370 | snd_printk(KERN_DEBUG "snd_gf1_peekw - GF1!!!\n"); |
371 | #endif | 371 | #endif |
372 | spin_lock_irqsave(&gus->reg_lock, flags); | 372 | spin_lock_irqsave(&gus->reg_lock, flags); |
373 | outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel); | 373 | outb(SNDRV_GF1_GW_DRAM_IO_LOW, gus->gf1.reg_regsel); |
@@ -393,7 +393,7 @@ void snd_gf1_dram_setmem(snd_gus_card_t * gus, unsigned int addr, | |||
393 | 393 | ||
394 | #ifdef CONFIG_SND_DEBUG | 394 | #ifdef CONFIG_SND_DEBUG |
395 | if (!gus->interwave) | 395 | if (!gus->interwave) |
396 | snd_printk("snd_gf1_dram_setmem - GF1!!!\n"); | 396 | snd_printk(KERN_DEBUG "snd_gf1_dram_setmem - GF1!!!\n"); |
397 | #endif | 397 | #endif |
398 | addr &= ~1; | 398 | addr &= ~1; |
399 | count >>= 1; | 399 | count >>= 1; |
@@ -449,30 +449,30 @@ void snd_gf1_print_voice_registers(snd_gus_card_t * gus) | |||
449 | int voice, ctrl; | 449 | int voice, ctrl; |
450 | 450 | ||
451 | voice = gus->gf1.active_voice; | 451 | voice = gus->gf1.active_voice; |
452 | printk(" -%i- GF1 voice ctrl, ramp ctrl = 0x%x, 0x%x\n", voice, ctrl = snd_gf1_i_read8(gus, 0), snd_gf1_i_read8(gus, 0x0d)); | 452 | printk(KERN_INFO " -%i- GF1 voice ctrl, ramp ctrl = 0x%x, 0x%x\n", voice, ctrl = snd_gf1_i_read8(gus, 0), snd_gf1_i_read8(gus, 0x0d)); |
453 | printk(" -%i- GF1 frequency = 0x%x\n", voice, snd_gf1_i_read16(gus, 1)); | 453 | printk(KERN_INFO " -%i- GF1 frequency = 0x%x\n", voice, snd_gf1_i_read16(gus, 1)); |
454 | printk(" -%i- GF1 loop start, end = 0x%x (0x%x), 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 2, ctrl & 4), snd_gf1_i_read_addr(gus, 2, (ctrl & 4) ^ 4), snd_gf1_i_read_addr(gus, 4, ctrl & 4), snd_gf1_i_read_addr(gus, 4, (ctrl & 4) ^ 4)); | 454 | printk(KERN_INFO " -%i- GF1 loop start, end = 0x%x (0x%x), 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 2, ctrl & 4), snd_gf1_i_read_addr(gus, 2, (ctrl & 4) ^ 4), snd_gf1_i_read_addr(gus, 4, ctrl & 4), snd_gf1_i_read_addr(gus, 4, (ctrl & 4) ^ 4)); |
455 | printk(" -%i- GF1 ramp start, end, rate = 0x%x, 0x%x, 0x%x\n", voice, snd_gf1_i_read8(gus, 7), snd_gf1_i_read8(gus, 8), snd_gf1_i_read8(gus, 6)); | 455 | printk(KERN_INFO " -%i- GF1 ramp start, end, rate = 0x%x, 0x%x, 0x%x\n", voice, snd_gf1_i_read8(gus, 7), snd_gf1_i_read8(gus, 8), snd_gf1_i_read8(gus, 6)); |
456 | printk(" -%i- GF1 volume = 0x%x\n", voice, snd_gf1_i_read16(gus, 9)); | 456 | printk(KERN_INFO" -%i- GF1 volume = 0x%x\n", voice, snd_gf1_i_read16(gus, 9)); |
457 | printk(" -%i- GF1 position = 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 0x0a, ctrl & 4), snd_gf1_i_read_addr(gus, 0x0a, (ctrl & 4) ^ 4)); | 457 | printk(KERN_INFO " -%i- GF1 position = 0x%x (0x%x)\n", voice, snd_gf1_i_read_addr(gus, 0x0a, ctrl & 4), snd_gf1_i_read_addr(gus, 0x0a, (ctrl & 4) ^ 4)); |
458 | if (gus->interwave && snd_gf1_i_read8(gus, 0x19) & 0x01) { /* enhanced mode */ | 458 | if (gus->interwave && snd_gf1_i_read8(gus, 0x19) & 0x01) { /* enhanced mode */ |
459 | mode = snd_gf1_i_read8(gus, 0x15); | 459 | mode = snd_gf1_i_read8(gus, 0x15); |
460 | printk(" -%i- GFA1 mode = 0x%x\n", voice, mode); | 460 | printk(KERN_INFO " -%i- GFA1 mode = 0x%x\n", voice, mode); |
461 | if (mode & 0x01) { /* Effect processor */ | 461 | if (mode & 0x01) { /* Effect processor */ |
462 | printk(" -%i- GFA1 effect address = 0x%x\n", voice, snd_gf1_i_read_addr(gus, 0x11, ctrl & 4)); | 462 | printk(KERN_INFO " -%i- GFA1 effect address = 0x%x\n", voice, snd_gf1_i_read_addr(gus, 0x11, ctrl & 4)); |
463 | printk(" -%i- GFA1 effect volume = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x16)); | 463 | printk(KERN_INFO " -%i- GFA1 effect volume = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x16)); |
464 | printk(" -%i- GFA1 effect volume final = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x1d)); | 464 | printk(KERN_INFO " -%i- GFA1 effect volume final = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x1d)); |
465 | printk(" -%i- GFA1 effect acumulator = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x14)); | 465 | printk(KERN_INFO " -%i- GFA1 effect acumulator = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x14)); |
466 | } | 466 | } |
467 | if (mode & 0x20) { | 467 | if (mode & 0x20) { |
468 | printk(" -%i- GFA1 left offset = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x13), snd_gf1_i_read16(gus, 0x13) >> 4); | 468 | printk(KERN_INFO " -%i- GFA1 left offset = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x13), snd_gf1_i_read16(gus, 0x13) >> 4); |
469 | printk(" -%i- GFA1 left offset final = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1c), snd_gf1_i_read16(gus, 0x1c) >> 4); | 469 | printk(KERN_INFO " -%i- GFA1 left offset final = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1c), snd_gf1_i_read16(gus, 0x1c) >> 4); |
470 | printk(" -%i- GFA1 right offset = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x0c), snd_gf1_i_read16(gus, 0x0c) >> 4); | 470 | printk(KERN_INFO " -%i- GFA1 right offset = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x0c), snd_gf1_i_read16(gus, 0x0c) >> 4); |
471 | printk(" -%i- GFA1 right offset final = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1b), snd_gf1_i_read16(gus, 0x1b) >> 4); | 471 | printk(KERN_INFO " -%i- GFA1 right offset final = 0x%x (%i)\n", voice, snd_gf1_i_read16(gus, 0x1b), snd_gf1_i_read16(gus, 0x1b) >> 4); |
472 | } else | 472 | } else |
473 | printk(" -%i- GF1 pan = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c)); | 473 | printk(KERN_INFO " -%i- GF1 pan = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c)); |
474 | } else | 474 | } else |
475 | printk(" -%i- GF1 pan = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c)); | 475 | printk(KERN_INFO " -%i- GF1 pan = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x0c)); |
476 | } | 476 | } |
477 | 477 | ||
478 | #if 0 | 478 | #if 0 |
@@ -481,45 +481,45 @@ void snd_gf1_print_global_registers(snd_gus_card_t * gus) | |||
481 | { | 481 | { |
482 | unsigned char global_mode = 0x00; | 482 | unsigned char global_mode = 0x00; |
483 | 483 | ||
484 | printk(" -G- GF1 active voices = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ACTIVE_VOICES)); | 484 | printk(KERN_INFO " -G- GF1 active voices = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ACTIVE_VOICES)); |
485 | if (gus->interwave) { | 485 | if (gus->interwave) { |
486 | global_mode = snd_gf1_i_read8(gus, SNDRV_GF1_GB_GLOBAL_MODE); | 486 | global_mode = snd_gf1_i_read8(gus, SNDRV_GF1_GB_GLOBAL_MODE); |
487 | printk(" -G- GF1 global mode = 0x%x\n", global_mode); | 487 | printk(KERN_INFO " -G- GF1 global mode = 0x%x\n", global_mode); |
488 | } | 488 | } |
489 | if (global_mode & 0x02) /* LFO enabled? */ | 489 | if (global_mode & 0x02) /* LFO enabled? */ |
490 | printk(" -G- GF1 LFO base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_LFO_BASE)); | 490 | printk(KERN_INFO " -G- GF1 LFO base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_LFO_BASE)); |
491 | printk(" -G- GF1 voices IRQ read = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VOICES_IRQ_READ)); | 491 | printk(KERN_INFO " -G- GF1 voices IRQ read = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VOICES_IRQ_READ)); |
492 | printk(" -G- GF1 DRAM DMA control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL)); | 492 | printk(KERN_INFO " -G- GF1 DRAM DMA control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL)); |
493 | printk(" -G- GF1 DRAM DMA high/low = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_DMA_LOW)); | 493 | printk(KERN_INFO " -G- GF1 DRAM DMA high/low = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_DMA_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_DMA_LOW)); |
494 | printk(" -G- GF1 DRAM IO high/low = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_IO_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_IO_LOW)); | 494 | printk(KERN_INFO " -G- GF1 DRAM IO high/low = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DRAM_IO_HIGH), snd_gf1_i_read16(gus, SNDRV_GF1_GW_DRAM_IO_LOW)); |
495 | if (!gus->interwave) | 495 | if (!gus->interwave) |
496 | printk(" -G- GF1 record DMA control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL)); | 496 | printk(KERN_INFO " -G- GF1 record DMA control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL)); |
497 | printk(" -G- GF1 DRAM IO 16 = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_DRAM_IO16)); | 497 | printk(KERN_INFO " -G- GF1 DRAM IO 16 = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_DRAM_IO16)); |
498 | if (gus->gf1.enh_mode) { | 498 | if (gus->gf1.enh_mode) { |
499 | printk(" -G- GFA1 memory config = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG)); | 499 | printk(KERN_INFO " -G- GFA1 memory config = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG)); |
500 | printk(" -G- GFA1 memory control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MEMORY_CONTROL)); | 500 | printk(KERN_INFO " -G- GFA1 memory control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MEMORY_CONTROL)); |
501 | printk(" -G- GFA1 FIFO record base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR)); | 501 | printk(KERN_INFO " -G- GFA1 FIFO record base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_RECORD_BASE_ADDR)); |
502 | printk(" -G- GFA1 FIFO playback base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR)); | 502 | printk(KERN_INFO " -G- GFA1 FIFO playback base = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_FIFO_PLAY_BASE_ADDR)); |
503 | printk(" -G- GFA1 interleave control = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_INTERLEAVE)); | 503 | printk(KERN_INFO " -G- GFA1 interleave control = 0x%x\n", snd_gf1_i_look16(gus, SNDRV_GF1_GW_INTERLEAVE)); |
504 | } | 504 | } |
505 | } | 505 | } |
506 | 506 | ||
507 | void snd_gf1_print_setup_registers(snd_gus_card_t * gus) | 507 | void snd_gf1_print_setup_registers(snd_gus_card_t * gus) |
508 | { | 508 | { |
509 | printk(" -S- mix control = 0x%x\n", inb(GUSP(gus, MIXCNTRLREG))); | 509 | printk(KERN_INFO " -S- mix control = 0x%x\n", inb(GUSP(gus, MIXCNTRLREG))); |
510 | printk(" -S- IRQ status = 0x%x\n", inb(GUSP(gus, IRQSTAT))); | 510 | printk(KERN_INFO " -S- IRQ status = 0x%x\n", inb(GUSP(gus, IRQSTAT))); |
511 | printk(" -S- timer control = 0x%x\n", inb(GUSP(gus, TIMERCNTRL))); | 511 | printk(KERN_INFO " -S- timer control = 0x%x\n", inb(GUSP(gus, TIMERCNTRL))); |
512 | printk(" -S- timer data = 0x%x\n", inb(GUSP(gus, TIMERDATA))); | 512 | printk(KERN_INFO " -S- timer data = 0x%x\n", inb(GUSP(gus, TIMERDATA))); |
513 | printk(" -S- status read = 0x%x\n", inb(GUSP(gus, REGCNTRLS))); | 513 | printk(KERN_INFO " -S- status read = 0x%x\n", inb(GUSP(gus, REGCNTRLS))); |
514 | printk(" -S- Sound Blaster control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL)); | 514 | printk(KERN_INFO " -S- Sound Blaster control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_SOUND_BLASTER_CONTROL)); |
515 | printk(" -S- AdLib timer 1/2 = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_1), snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_2)); | 515 | printk(KERN_INFO " -S- AdLib timer 1/2 = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_1), snd_gf1_i_look8(gus, SNDRV_GF1_GB_ADLIB_TIMER_2)); |
516 | printk(" -S- reset = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)); | 516 | printk(KERN_INFO " -S- reset = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)); |
517 | if (gus->interwave) { | 517 | if (gus->interwave) { |
518 | printk(" -S- compatibility = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_COMPATIBILITY)); | 518 | printk(KERN_INFO " -S- compatibility = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_COMPATIBILITY)); |
519 | printk(" -S- decode control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DECODE_CONTROL)); | 519 | printk(KERN_INFO " -S- decode control = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_DECODE_CONTROL)); |
520 | printk(" -S- version number = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER)); | 520 | printk(KERN_INFO " -S- version number = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER)); |
521 | printk(" -S- MPU-401 emul. control A/B = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_A), snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_B)); | 521 | printk(KERN_INFO " -S- MPU-401 emul. control A/B = 0x%x/0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_A), snd_gf1_i_look8(gus, SNDRV_GF1_GB_MPU401_CONTROL_B)); |
522 | printk(" -S- emulation IRQ = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_EMULATION_IRQ)); | 522 | printk(KERN_INFO " -S- emulation IRQ = 0x%x\n", snd_gf1_i_look8(gus, SNDRV_GF1_GB_EMULATION_IRQ)); |
523 | } | 523 | } |
524 | } | 524 | } |
525 | 525 | ||
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 8f2872f8e8f6..4f57ff4ab351 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c | |||
@@ -113,14 +113,8 @@ static int snd_gus_free(snd_gus_card_t *gus) | |||
113 | snd_gf1_stop(gus); | 113 | snd_gf1_stop(gus); |
114 | snd_gus_init_dma_irq(gus, 0); | 114 | snd_gus_init_dma_irq(gus, 0); |
115 | __hw_end: | 115 | __hw_end: |
116 | if (gus->gf1.res_port1) { | 116 | release_and_free_resource(gus->gf1.res_port1); |
117 | release_resource(gus->gf1.res_port1); | 117 | release_and_free_resource(gus->gf1.res_port2); |
118 | kfree_nocheck(gus->gf1.res_port1); | ||
119 | } | ||
120 | if (gus->gf1.res_port2) { | ||
121 | release_resource(gus->gf1.res_port2); | ||
122 | kfree_nocheck(gus->gf1.res_port2); | ||
123 | } | ||
124 | if (gus->gf1.irq >= 0) | 118 | if (gus->gf1.irq >= 0) |
125 | free_irq(gus->gf1.irq, (void *) gus); | 119 | free_irq(gus->gf1.irq, (void *) gus); |
126 | if (gus->gf1.dma1 >= 0) { | 120 | if (gus->gf1.dma1 >= 0) { |
@@ -252,7 +246,7 @@ static int snd_gus_detect_memory(snd_gus_card_t * gus) | |||
252 | snd_gf1_poke(gus, 0L, 0xaa); | 246 | snd_gf1_poke(gus, 0L, 0xaa); |
253 | snd_gf1_poke(gus, 1L, 0x55); | 247 | snd_gf1_poke(gus, 1L, 0x55); |
254 | if (snd_gf1_peek(gus, 0L) != 0xaa || snd_gf1_peek(gus, 1L) != 0x55) { | 248 | if (snd_gf1_peek(gus, 0L) != 0xaa || snd_gf1_peek(gus, 1L) != 0x55) { |
255 | snd_printk("plain GF1 card at 0x%lx without onboard DRAM?\n", gus->gf1.port); | 249 | snd_printk(KERN_ERR "plain GF1 card at 0x%lx without onboard DRAM?\n", gus->gf1.port); |
256 | return -ENOMEM; | 250 | return -ENOMEM; |
257 | } | 251 | } |
258 | for (idx = 1, d = 0xab; idx < 4; idx++, d++) { | 252 | for (idx = 1, d = 0xab; idx < 4; idx++, d++) { |
@@ -305,20 +299,17 @@ static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches) | |||
305 | dma2 = gus->gf1.dma2; | 299 | dma2 = gus->gf1.dma2; |
306 | dma2 = dma2 < 0 ? -dma2 : dma2; | 300 | dma2 = dma2 < 0 ? -dma2 : dma2; |
307 | dma2 = dmas[dma2 & 7]; | 301 | dma2 = dmas[dma2 & 7]; |
308 | #if 0 | ||
309 | printk("dma1 = %i, dma2 = %i\n", gus->gf1.dma1, gus->gf1.dma2); | ||
310 | #endif | ||
311 | dma1 |= gus->equal_dma ? 0x40 : (dma2 << 3); | 302 | dma1 |= gus->equal_dma ? 0x40 : (dma2 << 3); |
312 | 303 | ||
313 | if ((dma1 & 7) == 0 || (dma2 & 7) == 0) { | 304 | if ((dma1 & 7) == 0 || (dma2 & 7) == 0) { |
314 | snd_printk("Error! DMA isn't defined.\n"); | 305 | snd_printk(KERN_ERR "Error! DMA isn't defined.\n"); |
315 | return -EINVAL; | 306 | return -EINVAL; |
316 | } | 307 | } |
317 | irq = gus->gf1.irq; | 308 | irq = gus->gf1.irq; |
318 | irq = irq < 0 ? -irq : irq; | 309 | irq = irq < 0 ? -irq : irq; |
319 | irq = irqs[irq & 0x0f]; | 310 | irq = irqs[irq & 0x0f]; |
320 | if (irq == 0) { | 311 | if (irq == 0) { |
321 | snd_printk("Error! IRQ isn't defined.\n"); | 312 | snd_printk(KERN_ERR "Error! IRQ isn't defined.\n"); |
322 | return -EINVAL; | 313 | return -EINVAL; |
323 | } | 314 | } |
324 | irq |= 0x40; | 315 | irq |= 0x40; |
@@ -406,8 +397,8 @@ static int snd_gus_check_version(snd_gus_card_t * gus) | |||
406 | strcpy(card->longname, "Gravis UltraSound Extreme"); | 397 | strcpy(card->longname, "Gravis UltraSound Extreme"); |
407 | gus->ess_flag = 1; | 398 | gus->ess_flag = 1; |
408 | } else { | 399 | } else { |
409 | snd_printk("unknown GF1 revision number at 0x%lx - 0x%x (0x%x)\n", gus->gf1.port, rev, val); | 400 | snd_printk(KERN_ERR "unknown GF1 revision number at 0x%lx - 0x%x (0x%x)\n", gus->gf1.port, rev, val); |
410 | snd_printk(" please - report to <perex@suse.cz>\n"); | 401 | snd_printk(KERN_ERR " please - report to <perex@suse.cz>\n"); |
411 | } | 402 | } |
412 | } | 403 | } |
413 | } | 404 | } |
@@ -431,7 +422,7 @@ int snd_gus_initialize(snd_gus_card_t *gus) | |||
431 | 422 | ||
432 | if (!gus->interwave) { | 423 | if (!gus->interwave) { |
433 | if ((err = snd_gus_check_version(gus)) < 0) { | 424 | if ((err = snd_gus_check_version(gus)) < 0) { |
434 | snd_printk("version check failed\n"); | 425 | snd_printk(KERN_ERR "version check failed\n"); |
435 | return err; | 426 | return err; |
436 | } | 427 | } |
437 | if ((err = snd_gus_detect_memory(gus)) < 0) | 428 | if ((err = snd_gus_detect_memory(gus)) < 0) |
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index 5eb766dd564b..2e23f2a8c627 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c | |||
@@ -198,7 +198,7 @@ snd_gf1_mem_block_t *snd_gf1_mem_alloc(snd_gf1_mem_t * alloc, int owner, | |||
198 | if (nblock != NULL) { | 198 | if (nblock != NULL) { |
199 | if (size != (int)nblock->size) { | 199 | if (size != (int)nblock->size) { |
200 | /* TODO: remove in the future */ | 200 | /* TODO: remove in the future */ |
201 | snd_printk("snd_gf1_mem_alloc - share: sizes differ\n"); | 201 | snd_printk(KERN_ERR "snd_gf1_mem_alloc - share: sizes differ\n"); |
202 | goto __std; | 202 | goto __std; |
203 | } | 203 | } |
204 | nblock->share++; | 204 | nblock->share++; |
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index beb01365dc46..1cc89fb67bf2 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c | |||
@@ -333,8 +333,7 @@ static int snd_gf1_pcm_poke_block(snd_gus_card_t *gus, unsigned char *buf, | |||
333 | } | 333 | } |
334 | } | 334 | } |
335 | if (count > 0 && !in_interrupt()) { | 335 | if (count > 0 && !in_interrupt()) { |
336 | set_current_state(TASK_INTERRUPTIBLE); | 336 | schedule_timeout_interruptible(1); |
337 | schedule_timeout(1); | ||
338 | if (signal_pending(current)) | 337 | if (signal_pending(current)) |
339 | return -EAGAIN; | 338 | return -EAGAIN; |
340 | } | 339 | } |
@@ -698,7 +697,7 @@ static int snd_gf1_pcm_playback_close(snd_pcm_substream_t * substream) | |||
698 | gus_pcm_private_t *pcmp = runtime->private_data; | 697 | gus_pcm_private_t *pcmp = runtime->private_data; |
699 | 698 | ||
700 | if (!wait_event_timeout(pcmp->sleep, (atomic_read(&pcmp->dma_count) <= 0), 2*HZ)) | 699 | if (!wait_event_timeout(pcmp->sleep, (atomic_read(&pcmp->dma_count) <= 0), 2*HZ)) |
701 | snd_printk("gf1 pcm - serious DMA problem\n"); | 700 | snd_printk(KERN_ERR "gf1 pcm - serious DMA problem\n"); |
702 | 701 | ||
703 | snd_gf1_dma_done(gus); | 702 | snd_gf1_dma_done(gus); |
704 | return 0; | 703 | return 0; |
diff --git a/sound/isa/gus/gus_reset.c b/sound/isa/gus/gus_reset.c index ef687abc7070..90710969ef7f 100644 --- a/sound/isa/gus/gus_reset.c +++ b/sound/isa/gus/gus_reset.c | |||
@@ -134,7 +134,7 @@ void snd_gf1_smart_stop_voice(snd_gus_card_t * gus, unsigned short voice) | |||
134 | spin_lock_irqsave(&gus->reg_lock, flags); | 134 | spin_lock_irqsave(&gus->reg_lock, flags); |
135 | snd_gf1_select_voice(gus, voice); | 135 | snd_gf1_select_voice(gus, voice); |
136 | #if 0 | 136 | #if 0 |
137 | printk(" -%i- smart stop voice - volume = 0x%x\n", voice, snd_gf1_i_read16(gus, SNDRV_GF1_VW_VOLUME)); | 137 | printk(KERN_DEBUG " -%i- smart stop voice - volume = 0x%x\n", voice, snd_gf1_i_read16(gus, SNDRV_GF1_VW_VOLUME)); |
138 | #endif | 138 | #endif |
139 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); | 139 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); |
140 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); | 140 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); |
@@ -148,7 +148,7 @@ void snd_gf1_stop_voice(snd_gus_card_t * gus, unsigned short voice) | |||
148 | spin_lock_irqsave(&gus->reg_lock, flags); | 148 | spin_lock_irqsave(&gus->reg_lock, flags); |
149 | snd_gf1_select_voice(gus, voice); | 149 | snd_gf1_select_voice(gus, voice); |
150 | #if 0 | 150 | #if 0 |
151 | printk(" -%i- stop voice - volume = 0x%x\n", voice, snd_gf1_i_read16(gus, SNDRV_GF1_VW_VOLUME)); | 151 | printk(KERN_DEBUG " -%i- stop voice - volume = 0x%x\n", voice, snd_gf1_i_read16(gus, SNDRV_GF1_VW_VOLUME)); |
152 | #endif | 152 | #endif |
153 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); | 153 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_ADDRESS_CONTROL); |
154 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); | 154 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); |
diff --git a/sound/isa/gus/gus_simple.c b/sound/isa/gus/gus_simple.c index c122e7be6ceb..dfed85b58b3a 100644 --- a/sound/isa/gus/gus_simple.c +++ b/sound/isa/gus/gus_simple.c | |||
@@ -136,7 +136,7 @@ static void do_volume_envelope(snd_gus_card_t *gus, snd_gus_voice_t *voice) | |||
136 | snd_gf1_select_voice(gus, voice->number); | 136 | snd_gf1_select_voice(gus, voice->number); |
137 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); | 137 | snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL); |
138 | snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, voice->gf1_volume); | 138 | snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, voice->gf1_volume); |
139 | printk("gf1_volume = 0x%x\n", voice->gf1_volume); | 139 | /* printk("gf1_volume = 0x%x\n", voice->gf1_volume); */ |
140 | spin_unlock_irqrestore(&gus->reg_lock, flags); | 140 | spin_unlock_irqrestore(&gus->reg_lock, flags); |
141 | return; | 141 | return; |
142 | } | 142 | } |
diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c index 1bc2da8784e0..fbc95e99105c 100644 --- a/sound/isa/gus/gus_uart.c +++ b/sound/isa/gus/gus_uart.c | |||
@@ -104,7 +104,7 @@ static int snd_gf1_uart_output_open(snd_rawmidi_substream_t * substream) | |||
104 | gus->midi_substream_output = substream; | 104 | gus->midi_substream_output = substream; |
105 | spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); | 105 | spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); |
106 | #if 0 | 106 | #if 0 |
107 | snd_printk("write init - cmd = 0x%x, stat = 0x%x\n", gus->gf1.uart_cmd, snd_gf1_uart_stat(gus)); | 107 | snd_printk(KERN_DEBUG "write init - cmd = 0x%x, stat = 0x%x\n", gus->gf1.uart_cmd, snd_gf1_uart_stat(gus)); |
108 | #endif | 108 | #endif |
109 | return 0; | 109 | return 0; |
110 | } | 110 | } |
@@ -126,7 +126,7 @@ static int snd_gf1_uart_input_open(snd_rawmidi_substream_t * substream) | |||
126 | for (i = 0; i < 1000 && (snd_gf1_uart_stat(gus) & 0x01); i++) | 126 | for (i = 0; i < 1000 && (snd_gf1_uart_stat(gus) & 0x01); i++) |
127 | snd_gf1_uart_get(gus); /* clean Rx */ | 127 | snd_gf1_uart_get(gus); /* clean Rx */ |
128 | if (i >= 1000) | 128 | if (i >= 1000) |
129 | snd_printk("gus midi uart init read - cleanup error\n"); | 129 | snd_printk(KERN_ERR "gus midi uart init read - cleanup error\n"); |
130 | } | 130 | } |
131 | spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); | 131 | spin_unlock_irqrestore(&gus->uart_cmd_lock, flags); |
132 | #if 0 | 132 | #if 0 |
diff --git a/sound/isa/gus/gus_volume.c b/sound/isa/gus/gus_volume.c index 3d36f6c8ee6a..b3382fec5298 100644 --- a/sound/isa/gus/gus_volume.c +++ b/sound/isa/gus/gus_volume.c | |||
@@ -119,7 +119,7 @@ unsigned short snd_gf1_translate_freq(snd_gus_card_t * gus, unsigned int freq16) | |||
119 | freq16 = 50; | 119 | freq16 = 50; |
120 | if (freq16 & 0xf8000000) { | 120 | if (freq16 & 0xf8000000) { |
121 | freq16 = ~0xf8000000; | 121 | freq16 = ~0xf8000000; |
122 | snd_printk("snd_gf1_translate_freq: overflow - freq = 0x%x\n", freq16); | 122 | snd_printk(KERN_ERR "snd_gf1_translate_freq: overflow - freq = 0x%x\n", freq16); |
123 | } | 123 | } |
124 | return ((freq16 << 9) + (gus->gf1.playback_freq >> 1)) / gus->gf1.playback_freq; | 124 | return ((freq16 << 9) + (gus->gf1.playback_freq >> 1)) / gus->gf1.playback_freq; |
125 | } | 125 | } |
@@ -203,14 +203,14 @@ unsigned short snd_gf1_compute_freq(unsigned int freq, | |||
203 | fc = (freq << 10) / rate; | 203 | fc = (freq << 10) / rate; |
204 | if (fc > 97391L) { | 204 | if (fc > 97391L) { |
205 | fc = 97391; | 205 | fc = 97391; |
206 | snd_printk("patch: (1) fc frequency overflow - %u\n", fc); | 206 | snd_printk(KERN_ERR "patch: (1) fc frequency overflow - %u\n", fc); |
207 | } | 207 | } |
208 | fc = (fc * 44100UL) / mix_rate; | 208 | fc = (fc * 44100UL) / mix_rate; |
209 | while (scale--) | 209 | while (scale--) |
210 | fc <<= 1; | 210 | fc <<= 1; |
211 | if (fc > 65535L) { | 211 | if (fc > 65535L) { |
212 | fc = 65535; | 212 | fc = 65535; |
213 | snd_printk("patch: (2) fc frequency overflow - %u\n", fc); | 213 | snd_printk(KERN_ERR "patch: (2) fc frequency overflow - %u\n", fc); |
214 | } | 214 | } |
215 | return (unsigned short) fc; | 215 | return (unsigned short) fc; |
216 | } | 216 | } |
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 358cba9d738f..f703a9f4257c 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c | |||
@@ -437,7 +437,7 @@ static void __devinit snd_interwave_detect_memory(snd_gus_card_t * gus) | |||
437 | for (i = 0; i < 8; ++i) | 437 | for (i = 0; i < 8; ++i) |
438 | iwave[i] = snd_gf1_peek(gus, bank_pos + i); | 438 | iwave[i] = snd_gf1_peek(gus, bank_pos + i); |
439 | #ifdef CONFIG_SND_DEBUG_ROM | 439 | #ifdef CONFIG_SND_DEBUG_ROM |
440 | printk("ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos, | 440 | printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos, |
441 | iwave[0], iwave[1], iwave[2], iwave[3], | 441 | iwave[0], iwave[1], iwave[2], iwave[3], |
442 | iwave[4], iwave[5], iwave[6], iwave[7]); | 442 | iwave[4], iwave[5], iwave[6], iwave[7]); |
443 | #endif | 443 | #endif |
@@ -447,7 +447,7 @@ static void __devinit snd_interwave_detect_memory(snd_gus_card_t * gus) | |||
447 | for (i = 0; i < sizeof(struct rom_hdr); i++) | 447 | for (i = 0; i < sizeof(struct rom_hdr); i++) |
448 | csum += snd_gf1_peek(gus, bank_pos + i); | 448 | csum += snd_gf1_peek(gus, bank_pos + i); |
449 | #ifdef CONFIG_SND_DEBUG_ROM | 449 | #ifdef CONFIG_SND_DEBUG_ROM |
450 | printk("ROM checksum = 0x%x (computed)\n", csum); | 450 | printk(KERN_DEBUG "ROM checksum = 0x%x (computed)\n", csum); |
451 | #endif | 451 | #endif |
452 | if (csum != 0) | 452 | if (csum != 0) |
453 | continue; /* not valid rom */ | 453 | continue; /* not valid rom */ |
@@ -638,10 +638,7 @@ static void snd_interwave_free(snd_card_t *card) | |||
638 | if (iwcard == NULL) | 638 | if (iwcard == NULL) |
639 | return; | 639 | return; |
640 | #ifdef SNDRV_STB | 640 | #ifdef SNDRV_STB |
641 | if (iwcard->i2c_res) { | 641 | release_and_free_resource(iwcard->i2c_res); |
642 | release_resource(iwcard->i2c_res); | ||
643 | kfree_nocheck(iwcard->i2c_res); | ||
644 | } | ||
645 | #endif | 642 | #endif |
646 | if (iwcard->irq >= 0) | 643 | if (iwcard->irq >= 0) |
647 | free_irq(iwcard->irq, (void *)iwcard); | 644 | free_irq(iwcard->irq, (void *)iwcard); |
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 4ba268f251e3..47cabda792b6 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c | |||
@@ -656,10 +656,7 @@ static int snd_opl3sa2_free(opl3sa2_t *chip) | |||
656 | { | 656 | { |
657 | if (chip->irq >= 0) | 657 | if (chip->irq >= 0) |
658 | free_irq(chip->irq, (void *)chip); | 658 | free_irq(chip->irq, (void *)chip); |
659 | if (chip->res_port) { | 659 | release_and_free_resource(chip->res_port); |
660 | release_resource(chip->res_port); | ||
661 | kfree_nocheck(chip->res_port); | ||
662 | } | ||
663 | kfree(chip); | 660 | kfree(chip); |
664 | return 0; | 661 | return 0; |
665 | } | 662 | } |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 73573cb1db6a..b94339f8306f 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -299,10 +299,8 @@ static char * snd_opti9xx_names[] = { | |||
299 | static long snd_legacy_find_free_ioport(long *port_table, long size) | 299 | static long snd_legacy_find_free_ioport(long *port_table, long size) |
300 | { | 300 | { |
301 | while (*port_table != -1) { | 301 | while (*port_table != -1) { |
302 | struct resource *res; | 302 | if (request_region(*port_table, size, "ALSA test")) { |
303 | if ((res = request_region(*port_table, size, "ALSA test")) != NULL) { | 303 | release_region(*port_table, size); |
304 | release_resource(res); | ||
305 | kfree_nocheck(res); | ||
306 | return *port_table; | 304 | return *port_table; |
307 | } | 305 | } |
308 | port_table++; | 306 | port_table++; |
@@ -1227,10 +1225,7 @@ static int snd_opti93x_probe(opti93x_t *chip) | |||
1227 | 1225 | ||
1228 | static int snd_opti93x_free(opti93x_t *chip) | 1226 | static int snd_opti93x_free(opti93x_t *chip) |
1229 | { | 1227 | { |
1230 | if (chip->res_port) { | 1228 | release_and_free_resource(chip->res_port); |
1231 | release_resource(chip->res_port); | ||
1232 | kfree_nocheck(chip->res_port); | ||
1233 | } | ||
1234 | if (chip->dma1 >= 0) { | 1229 | if (chip->dma1 >= 0) { |
1235 | disable_dma(chip->dma1); | 1230 | disable_dma(chip->dma1); |
1236 | free_dma(chip->dma1); | 1231 | free_dma(chip->dma1); |
@@ -1656,8 +1651,7 @@ static int __devinit snd_card_opti9xx_detect(snd_card_t *card, opti9xx_t *chip) | |||
1656 | if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) | 1651 | if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) |
1657 | return 1; | 1652 | return 1; |
1658 | 1653 | ||
1659 | release_resource(chip->res_mc_base); | 1654 | release_and_free_resource(chip->res_mc_base); |
1660 | kfree_nocheck(chip->res_mc_base); | ||
1661 | chip->res_mc_base = NULL; | 1655 | chip->res_mc_base = NULL; |
1662 | 1656 | ||
1663 | } | 1657 | } |
@@ -1683,8 +1677,7 @@ static int __devinit snd_card_opti9xx_detect(snd_card_t *card, opti9xx_t *chip) | |||
1683 | if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) | 1677 | if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) |
1684 | return 1; | 1678 | return 1; |
1685 | 1679 | ||
1686 | release_resource(chip->res_mc_base); | 1680 | release_and_free_resource(chip->res_mc_base); |
1687 | kfree_nocheck(chip->res_mc_base); | ||
1688 | chip->res_mc_base = NULL; | 1681 | chip->res_mc_base = NULL; |
1689 | } | 1682 | } |
1690 | #endif /* OPTi93X */ | 1683 | #endif /* OPTi93X */ |
@@ -1886,12 +1879,8 @@ static void snd_card_opti9xx_free(snd_card_t *card) | |||
1886 | { | 1879 | { |
1887 | opti9xx_t *chip = (opti9xx_t *)card->private_data; | 1880 | opti9xx_t *chip = (opti9xx_t *)card->private_data; |
1888 | 1881 | ||
1889 | if (chip) { | 1882 | if (chip) |
1890 | if (chip->res_mc_base) { | 1883 | release_and_free_resource(chip->res_mc_base); |
1891 | release_resource(chip->res_mc_base); | ||
1892 | kfree_nocheck(chip->res_mc_base); | ||
1893 | } | ||
1894 | } | ||
1895 | } | 1884 | } |
1896 | 1885 | ||
1897 | static int snd_card_opti9xx_probe(struct pnp_card_link *pcard, | 1886 | static int snd_card_opti9xx_probe(struct pnp_card_link *pcard, |
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c index 5375705c054b..b09c6575e01a 100644 --- a/sound/isa/sb/emu8000.c +++ b/sound/isa/sb/emu8000.c | |||
@@ -135,8 +135,7 @@ static void __init | |||
135 | snd_emu8000_read_wait(emu8000_t *emu) | 135 | snd_emu8000_read_wait(emu8000_t *emu) |
136 | { | 136 | { |
137 | while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) { | 137 | while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) { |
138 | set_current_state(TASK_INTERRUPTIBLE); | 138 | schedule_timeout_interruptible(1); |
139 | schedule_timeout(1); | ||
140 | if (signal_pending(current)) | 139 | if (signal_pending(current)) |
141 | break; | 140 | break; |
142 | } | 141 | } |
@@ -148,8 +147,7 @@ static void __init | |||
148 | snd_emu8000_write_wait(emu8000_t *emu) | 147 | snd_emu8000_write_wait(emu8000_t *emu) |
149 | { | 148 | { |
150 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { | 149 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { |
151 | set_current_state(TASK_INTERRUPTIBLE); | 150 | schedule_timeout_interruptible(1); |
152 | schedule_timeout(1); | ||
153 | if (signal_pending(current)) | 151 | if (signal_pending(current)) |
154 | break; | 152 | break; |
155 | } | 153 | } |
@@ -437,8 +435,7 @@ size_dram(emu8000_t *emu) | |||
437 | for (i = 0; i < 10000; i++) { | 435 | for (i = 0; i < 10000; i++) { |
438 | if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0) | 436 | if ((EMU8000_SMALW_READ(emu) & 0x80000000) == 0) |
439 | break; | 437 | break; |
440 | set_current_state(TASK_INTERRUPTIBLE); | 438 | schedule_timeout_interruptible(1); |
441 | schedule_timeout(1); | ||
442 | if (signal_pending(current)) | 439 | if (signal_pending(current)) |
443 | break; | 440 | break; |
444 | } | 441 | } |
@@ -1054,18 +1051,9 @@ __error: | |||
1054 | */ | 1051 | */ |
1055 | static int snd_emu8000_free(emu8000_t *hw) | 1052 | static int snd_emu8000_free(emu8000_t *hw) |
1056 | { | 1053 | { |
1057 | if (hw->res_port1) { | 1054 | release_and_free_resource(hw->res_port1); |
1058 | release_resource(hw->res_port1); | 1055 | release_and_free_resource(hw->res_port2); |
1059 | kfree_nocheck(hw->res_port1); | 1056 | release_and_free_resource(hw->res_port3); |
1060 | } | ||
1061 | if (hw->res_port2) { | ||
1062 | release_resource(hw->res_port2); | ||
1063 | kfree_nocheck(hw->res_port2); | ||
1064 | } | ||
1065 | if (hw->res_port3) { | ||
1066 | release_resource(hw->res_port3); | ||
1067 | kfree_nocheck(hw->res_port3); | ||
1068 | } | ||
1069 | kfree(hw); | 1057 | kfree(hw); |
1070 | return 0; | 1058 | return 0; |
1071 | } | 1059 | } |
diff --git a/sound/isa/sb/emu8000_patch.c b/sound/isa/sb/emu8000_patch.c index 26e693078cb3..2fea67e71c78 100644 --- a/sound/isa/sb/emu8000_patch.c +++ b/sound/isa/sb/emu8000_patch.c | |||
@@ -109,8 +109,7 @@ static void | |||
109 | snd_emu8000_write_wait(emu8000_t *emu) | 109 | snd_emu8000_write_wait(emu8000_t *emu) |
110 | { | 110 | { |
111 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { | 111 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { |
112 | set_current_state(TASK_INTERRUPTIBLE); | 112 | schedule_timeout_interruptible(1); |
113 | schedule_timeout(1); | ||
114 | if (signal_pending(current)) | 113 | if (signal_pending(current)) |
115 | break; | 114 | break; |
116 | } | 115 | } |
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index 0209790dc4b5..b323beeeda15 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c | |||
@@ -117,8 +117,7 @@ snd_emu8000_write_wait(emu8000_t *emu, int can_schedule) | |||
117 | { | 117 | { |
118 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { | 118 | while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { |
119 | if (can_schedule) { | 119 | if (can_schedule) { |
120 | set_current_state(TASK_INTERRUPTIBLE); | 120 | schedule_timeout_interruptible(1); |
121 | schedule_timeout(1); | ||
122 | if (signal_pending(current)) | 121 | if (signal_pending(current)) |
123 | break; | 122 | break; |
124 | } | 123 | } |
diff --git a/sound/isa/sb/emu8000_synth.c b/sound/isa/sb/emu8000_synth.c index 1f63aa52d596..f68e217416a6 100644 --- a/sound/isa/sb/emu8000_synth.c +++ b/sound/isa/sb/emu8000_synth.c | |||
@@ -56,7 +56,7 @@ static int snd_emu8000_new_device(snd_seq_device_t *dev) | |||
56 | emu->num_ports = hw->seq_ports; | 56 | emu->num_ports = hw->seq_ports; |
57 | 57 | ||
58 | if (hw->memhdr) { | 58 | if (hw->memhdr) { |
59 | snd_printk("memhdr is already initialized!?\n"); | 59 | snd_printk(KERN_ERR "memhdr is already initialized!?\n"); |
60 | snd_util_memhdr_free(hw->memhdr); | 60 | snd_util_memhdr_free(hw->memhdr); |
61 | } | 61 | } |
62 | hw->memhdr = snd_util_memhdr_new(hw->mem_size); | 62 | hw->memhdr = snd_util_memhdr_new(hw->mem_size); |
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 7888783d68f5..c2fa451bc8f0 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c | |||
@@ -345,10 +345,7 @@ static void snd_sb16_free(snd_card_t *card) | |||
345 | 345 | ||
346 | if (acard == NULL) | 346 | if (acard == NULL) |
347 | return; | 347 | return; |
348 | if (acard->fm_res) { | 348 | release_and_free_resource(acard->fm_res); |
349 | release_resource(acard->fm_res); | ||
350 | kfree_nocheck(acard->fm_res); | ||
351 | } | ||
352 | } | 349 | } |
353 | 350 | ||
354 | #ifdef CONFIG_PNP | 351 | #ifdef CONFIG_PNP |
diff --git a/sound/isa/sb/sb16_main.c b/sound/isa/sb/sb16_main.c index a99e642a68b5..556b95e3e22f 100644 --- a/sound/isa/sb/sb16_main.c +++ b/sound/isa/sb/sb16_main.c | |||
@@ -747,7 +747,7 @@ int snd_sb16dsp_configure(sb_t * chip) | |||
747 | unsigned char realirq, realdma, realmpureg; | 747 | unsigned char realirq, realdma, realmpureg; |
748 | /* note: mpu register should be present only on SB16 Vibra soundcards */ | 748 | /* note: mpu register should be present only on SB16 Vibra soundcards */ |
749 | 749 | ||
750 | // printk("codec->irq=%i, codec->dma8=%i, codec->dma16=%i\n", chip->irq, chip->dma8, chip->dma16); | 750 | // printk(KERN_DEBUG "codec->irq=%i, codec->dma8=%i, codec->dma16=%i\n", chip->irq, chip->dma8, chip->dma16); |
751 | spin_lock_irqsave(&chip->mixer_lock, flags); | 751 | spin_lock_irqsave(&chip->mixer_lock, flags); |
752 | mpureg = snd_sbmixer_read(chip, SB_DSP4_MPUSETUP) & ~0x06; | 752 | mpureg = snd_sbmixer_read(chip, SB_DSP4_MPUSETUP) & ~0x06; |
753 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 753 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
@@ -821,9 +821,9 @@ int snd_sb16dsp_configure(sb_t * chip) | |||
821 | 821 | ||
822 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 822 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
823 | if ((~realirq) & irqreg || (~realdma) & dmareg) { | 823 | if ((~realirq) & irqreg || (~realdma) & dmareg) { |
824 | snd_printk("SB16 [0x%lx]: unable to set DMA & IRQ (PnP device?)\n", chip->port); | 824 | snd_printk(KERN_ERR "SB16 [0x%lx]: unable to set DMA & IRQ (PnP device?)\n", chip->port); |
825 | snd_printk("SB16 [0x%lx]: wanted: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, realirq, realdma, realmpureg); | 825 | snd_printk(KERN_ERR "SB16 [0x%lx]: wanted: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, realirq, realdma, realmpureg); |
826 | snd_printk("SB16 [0x%lx]: got: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, irqreg, dmareg, mpureg); | 826 | snd_printk(KERN_ERR "SB16 [0x%lx]: got: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, irqreg, dmareg, mpureg); |
827 | return -ENODEV; | 827 | return -ENODEV; |
828 | } | 828 | } |
829 | return 0; | 829 | return 0; |
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index c41ac25e85ca..0bc0a3afdabc 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c | |||
@@ -78,10 +78,7 @@ static void snd_sb8_free(snd_card_t *card) | |||
78 | 78 | ||
79 | if (acard == NULL) | 79 | if (acard == NULL) |
80 | return; | 80 | return; |
81 | if (acard->fm_res) { | 81 | release_and_free_resource(acard->fm_res); |
82 | release_resource(acard->fm_res); | ||
83 | kfree_nocheck(acard->fm_res); | ||
84 | } | ||
85 | } | 82 | } |
86 | 83 | ||
87 | static int __init snd_sb8_probe(int dev) | 84 | static int __init snd_sb8_probe(int dev) |
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index 87c9b1ba06cf..5ddc6e41d909 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c | |||
@@ -334,9 +334,6 @@ irqreturn_t snd_sb8dsp_interrupt(sb_t *chip) | |||
334 | snd_pcm_substream_t *substream; | 334 | snd_pcm_substream_t *substream; |
335 | snd_pcm_runtime_t *runtime; | 335 | snd_pcm_runtime_t *runtime; |
336 | 336 | ||
337 | #if 0 | ||
338 | snd_printk("sb8: interrupt\n"); | ||
339 | #endif | ||
340 | snd_sb_ack_8bit(chip); | 337 | snd_sb_ack_8bit(chip); |
341 | switch (chip->mode) { | 338 | switch (chip->mode) { |
342 | case SB_MODE_PLAYBACK_8: /* ok.. playback is active */ | 339 | case SB_MODE_PLAYBACK_8: /* ok.. playback is active */ |
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c index f0f205ae425f..603e923b5d2f 100644 --- a/sound/isa/sb/sb_common.c +++ b/sound/isa/sb/sb_common.c | |||
@@ -45,7 +45,7 @@ int snd_sbdsp_command(sb_t *chip, unsigned char val) | |||
45 | { | 45 | { |
46 | int i; | 46 | int i; |
47 | #ifdef IO_DEBUG | 47 | #ifdef IO_DEBUG |
48 | snd_printk("command 0x%x\n", val); | 48 | snd_printk(KERN_DEBUG "command 0x%x\n", val); |
49 | #endif | 49 | #endif |
50 | for (i = BUSY_LOOPS; i; i--) | 50 | for (i = BUSY_LOOPS; i; i--) |
51 | if ((inb(SBP(chip, STATUS)) & 0x80) == 0) { | 51 | if ((inb(SBP(chip, STATUS)) & 0x80) == 0) { |
@@ -64,7 +64,7 @@ int snd_sbdsp_get_byte(sb_t *chip) | |||
64 | if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { | 64 | if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { |
65 | val = inb(SBP(chip, READ)); | 65 | val = inb(SBP(chip, READ)); |
66 | #ifdef IO_DEBUG | 66 | #ifdef IO_DEBUG |
67 | snd_printk("get_byte 0x%x\n", val); | 67 | snd_printk(KERN_DEBUG "get_byte 0x%x\n", val); |
68 | #endif | 68 | #endif |
69 | return val; | 69 | return val; |
70 | } | 70 | } |
@@ -154,7 +154,7 @@ static int snd_sbdsp_probe(sb_t * chip) | |||
154 | str = "16"; | 154 | str = "16"; |
155 | break; | 155 | break; |
156 | default: | 156 | default: |
157 | snd_printk("SB [0x%lx]: unknown DSP chip version %i.%i\n", | 157 | snd_printk(KERN_INFO "SB [0x%lx]: unknown DSP chip version %i.%i\n", |
158 | chip->port, major, minor); | 158 | chip->port, major, minor); |
159 | return -ENODEV; | 159 | return -ENODEV; |
160 | } | 160 | } |
@@ -178,10 +178,8 @@ static int snd_sbdsp_probe(sb_t * chip) | |||
178 | 178 | ||
179 | static int snd_sbdsp_free(sb_t *chip) | 179 | static int snd_sbdsp_free(sb_t *chip) |
180 | { | 180 | { |
181 | if (chip->res_port) { | 181 | if (chip->res_port) |
182 | release_resource(chip->res_port); | 182 | release_and_free_resource(chip->res_port); |
183 | kfree_nocheck(chip->res_port); | ||
184 | } | ||
185 | if (chip->irq >= 0) | 183 | if (chip->irq >= 0) |
186 | free_irq(chip->irq, (void *) chip); | 184 | free_irq(chip->irq, (void *) chip); |
187 | #ifdef CONFIG_ISA | 185 | #ifdef CONFIG_ISA |
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index ff4b59968027..5a926a452d38 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c | |||
@@ -36,7 +36,7 @@ void snd_sbmixer_write(sb_t *chip, unsigned char reg, unsigned char data) | |||
36 | outb(data, SBP(chip, MIXER_DATA)); | 36 | outb(data, SBP(chip, MIXER_DATA)); |
37 | udelay(10); | 37 | udelay(10); |
38 | #ifdef IO_DEBUG | 38 | #ifdef IO_DEBUG |
39 | snd_printk("mixer_write 0x%x 0x%x\n", reg, data); | 39 | snd_printk(KERN_DEBUG "mixer_write 0x%x 0x%x\n", reg, data); |
40 | #endif | 40 | #endif |
41 | } | 41 | } |
42 | 42 | ||
@@ -49,7 +49,7 @@ unsigned char snd_sbmixer_read(sb_t *chip, unsigned char reg) | |||
49 | result = inb(SBP(chip, MIXER_DATA)); | 49 | result = inb(SBP(chip, MIXER_DATA)); |
50 | udelay(10); | 50 | udelay(10); |
51 | #ifdef IO_DEBUG | 51 | #ifdef IO_DEBUG |
52 | snd_printk("mixer_read 0x%x 0x%x\n", reg, result); | 52 | snd_printk(KERN_DEBUG "mixer_read 0x%x 0x%x\n", reg, result); |
53 | #endif | 53 | #endif |
54 | return result; | 54 | return result; |
55 | } | 55 | } |
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 9f6b58c79209..11588067fa4f 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c | |||
@@ -338,25 +338,11 @@ static inline void activate_ad1845_unsafe(unsigned io_base) | |||
338 | static void soundscape_free(snd_card_t * c) | 338 | static void soundscape_free(snd_card_t * c) |
339 | { | 339 | { |
340 | register struct soundscape *sscape = get_card_soundscape(c); | 340 | register struct soundscape *sscape = get_card_soundscape(c); |
341 | release_resource(sscape->io_res); | 341 | release_and_free_resource(sscape->io_res); |
342 | kfree_nocheck(sscape->io_res); | ||
343 | free_dma(sscape->chip->dma1); | 342 | free_dma(sscape->chip->dma1); |
344 | } | 343 | } |
345 | 344 | ||
346 | /* | 345 | /* |
347 | * Put this process into an idle wait-state for a certain number | ||
348 | * of "jiffies". The process can almost certainly be rescheduled | ||
349 | * while we're waiting, and so we must NOT be holding any spinlocks | ||
350 | * when we call this function. If we are then we risk DEADLOCK in | ||
351 | * SMP (Ha!) or pre-emptible kernels. | ||
352 | */ | ||
353 | static inline void sleep(long jiffs, int state) | ||
354 | { | ||
355 | set_current_state(state); | ||
356 | schedule_timeout(jiffs); | ||
357 | } | ||
358 | |||
359 | /* | ||
360 | * Tell the SoundScape to begin a DMA tranfer using the given channel. | 346 | * Tell the SoundScape to begin a DMA tranfer using the given channel. |
361 | * All locking issues are left to the caller. | 347 | * All locking issues are left to the caller. |
362 | */ | 348 | */ |
@@ -393,7 +379,7 @@ static int obp_startup_ack(struct soundscape *s, unsigned timeout) | |||
393 | unsigned long flags; | 379 | unsigned long flags; |
394 | unsigned char x; | 380 | unsigned char x; |
395 | 381 | ||
396 | sleep(1, TASK_INTERRUPTIBLE); | 382 | schedule_timeout_interruptible(1); |
397 | 383 | ||
398 | spin_lock_irqsave(&s->lock, flags); | 384 | spin_lock_irqsave(&s->lock, flags); |
399 | x = inb(HOST_DATA_IO(s->io_base)); | 385 | x = inb(HOST_DATA_IO(s->io_base)); |
@@ -420,7 +406,7 @@ static int host_startup_ack(struct soundscape *s, unsigned timeout) | |||
420 | unsigned long flags; | 406 | unsigned long flags; |
421 | unsigned char x; | 407 | unsigned char x; |
422 | 408 | ||
423 | sleep(1, TASK_INTERRUPTIBLE); | 409 | schedule_timeout_interruptible(1); |
424 | 410 | ||
425 | spin_lock_irqsave(&s->lock, flags); | 411 | spin_lock_irqsave(&s->lock, flags); |
426 | x = inb(HOST_DATA_IO(s->io_base)); | 412 | x = inb(HOST_DATA_IO(s->io_base)); |
@@ -1288,8 +1274,7 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca | |||
1288 | free_dma(params->dma1); | 1274 | free_dma(params->dma1); |
1289 | 1275 | ||
1290 | _release_region: | 1276 | _release_region: |
1291 | release_resource(io_res); | 1277 | release_and_free_resource(io_res); |
1292 | kfree_nocheck(io_res); | ||
1293 | 1278 | ||
1294 | return err; | 1279 | return err; |
1295 | } | 1280 | } |
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 0a572e0a47e6..1818f1013c3f 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c | |||
@@ -379,10 +379,7 @@ snd_wavefront_free(snd_card_t *card) | |||
379 | snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data; | 379 | snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data; |
380 | 380 | ||
381 | if (acard) { | 381 | if (acard) { |
382 | if (acard->wavefront.res_base != NULL) { | 382 | release_and_free_resource(acard->wavefront.res_base); |
383 | release_resource(acard->wavefront.res_base); | ||
384 | kfree_nocheck(acard->wavefront.res_base); | ||
385 | } | ||
386 | if (acard->wavefront.irq > 0) | 383 | if (acard->wavefront.irq > 0) |
387 | free_irq(acard->wavefront.irq, (void *)acard); | 384 | free_irq(acard->wavefront.irq, (void *)acard); |
388 | } | 385 | } |
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 0c3c951009d8..abd79b781412 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c | |||
@@ -275,8 +275,7 @@ static int | |||
275 | wavefront_sleep (int limit) | 275 | wavefront_sleep (int limit) |
276 | 276 | ||
277 | { | 277 | { |
278 | set_current_state(TASK_INTERRUPTIBLE); | 278 | schedule_timeout_interruptible(limit); |
279 | schedule_timeout(limit); | ||
280 | 279 | ||
281 | return signal_pending(current); | 280 | return signal_pending(current); |
282 | } | 281 | } |
@@ -1788,8 +1787,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev, | |||
1788 | outb (val,port); | 1787 | outb (val,port); |
1789 | spin_unlock_irq(&dev->irq_lock); | 1788 | spin_unlock_irq(&dev->irq_lock); |
1790 | while (1) { | 1789 | while (1) { |
1791 | set_current_state(TASK_INTERRUPTIBLE); | 1790 | if ((timeout = schedule_timeout_interruptible(timeout)) == 0) |
1792 | if ((timeout = schedule_timeout(timeout)) == 0) | ||
1793 | return; | 1791 | return; |
1794 | if (dev->irq_ok) | 1792 | if (dev->irq_ok) |
1795 | return; | 1793 | return; |
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index 3f9684f1d1d2..d08a42b24b1f 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c | |||
@@ -57,8 +57,6 @@ MODULE_CLASSES("{sound}"); | |||
57 | MODULE_DEVICES("{{AMD,Au1000 AC'97}}"); | 57 | MODULE_DEVICES("{{AMD,Au1000 AC'97}}"); |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #define chip_t au1000_t | ||
61 | |||
62 | #define PLAYBACK 0 | 60 | #define PLAYBACK 0 |
63 | #define CAPTURE 1 | 61 | #define CAPTURE 1 |
64 | #define AC97_SLOT_3 0x01 | 62 | #define AC97_SLOT_3 0x01 |
@@ -474,7 +472,7 @@ snd_au1000_ac97_read(ac97_t *ac97, unsigned short reg) | |||
474 | u32 volatile cmd; | 472 | u32 volatile cmd; |
475 | u16 volatile data; | 473 | u16 volatile data; |
476 | int i; | 474 | int i; |
477 | spin_lock(au1000->ac97_lock); | 475 | spin_lock(&au1000->ac97_lock); |
478 | /* would rather use the interupt than this polling but it works and I can't | 476 | /* would rather use the interupt than this polling but it works and I can't |
479 | get the interupt driven case to work efficiently */ | 477 | get the interupt driven case to work efficiently */ |
480 | for (i = 0; i < 0x5000; i++) | 478 | for (i = 0; i < 0x5000; i++) |
@@ -497,7 +495,7 @@ get the interupt driven case to work efficiently */ | |||
497 | } | 495 | } |
498 | 496 | ||
499 | data = au1000->ac97_ioport->cmd & 0xffff; | 497 | data = au1000->ac97_ioport->cmd & 0xffff; |
500 | spin_unlock(au1000->ac97_lock); | 498 | spin_unlock(&au1000->ac97_lock); |
501 | 499 | ||
502 | return data; | 500 | return data; |
503 | 501 | ||
@@ -509,7 +507,7 @@ snd_au1000_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val) | |||
509 | { | 507 | { |
510 | u32 cmd; | 508 | u32 cmd; |
511 | int i; | 509 | int i; |
512 | spin_lock(au1000->ac97_lock); | 510 | spin_lock(&au1000->ac97_lock); |
513 | /* would rather use the interupt than this polling but it works and I can't | 511 | /* would rather use the interupt than this polling but it works and I can't |
514 | get the interupt driven case to work efficiently */ | 512 | get the interupt driven case to work efficiently */ |
515 | for (i = 0; i < 0x5000; i++) | 513 | for (i = 0; i < 0x5000; i++) |
@@ -522,7 +520,7 @@ get the interupt driven case to work efficiently */ | |||
522 | cmd &= ~AC97C_READ; | 520 | cmd &= ~AC97C_READ; |
523 | cmd |= ((u32) val << AC97C_WD_BIT); | 521 | cmd |= ((u32) val << AC97C_WD_BIT); |
524 | au1000->ac97_ioport->cmd = cmd; | 522 | au1000->ac97_ioport->cmd = cmd; |
525 | spin_unlock(au1000->ac97_lock); | 523 | spin_unlock(&au1000->ac97_lock); |
526 | } | 524 | } |
527 | static void | 525 | static void |
528 | snd_au1000_ac97_free(ac97_t *ac97) | 526 | snd_au1000_ac97_free(ac97_t *ac97) |
@@ -606,8 +604,7 @@ snd_au1000_free(snd_card_t *card) | |||
606 | /* put internal AC97 block into reset */ | 604 | /* put internal AC97 block into reset */ |
607 | au1000->ac97_ioport->cntrl = AC97C_RS; | 605 | au1000->ac97_ioport->cntrl = AC97C_RS; |
608 | au1000->ac97_ioport = NULL; | 606 | au1000->ac97_ioport = NULL; |
609 | release_resource(au1000->ac97_res_port); | 607 | release_and_free_resource(au1000->ac97_res_port); |
610 | kfree_nocheck(au1000->ac97_res_port); | ||
611 | } | 608 | } |
612 | 609 | ||
613 | if (au1000->stream[PLAYBACK]->dma >= 0) | 610 | if (au1000->stream[PLAYBACK]->dma >= 0) |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index a5d593c66f9f..0fb16cf335ea 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -1,13 +1,5 @@ | |||
1 | # ALSA PCI drivers | 1 | # ALSA PCI drivers |
2 | 2 | ||
3 | config SND_AC97_CODEC | ||
4 | tristate | ||
5 | select SND_PCM | ||
6 | select SND_AC97_BUS | ||
7 | |||
8 | config SND_AC97_BUS | ||
9 | tristate | ||
10 | |||
11 | menu "PCI devices" | 3 | menu "PCI devices" |
12 | depends on SND!=n && PCI | 4 | depends on SND!=n && PCI |
13 | 5 | ||
@@ -192,6 +184,7 @@ config SND_CA0106 | |||
192 | tristate "SB Audigy LS / Live 24bit" | 184 | tristate "SB Audigy LS / Live 24bit" |
193 | depends on SND | 185 | depends on SND |
194 | select SND_AC97_CODEC | 186 | select SND_AC97_CODEC |
187 | select SND_RAWMIDI | ||
195 | help | 188 | help |
196 | Say Y here to include support for the Sound Blaster Audigy LS | 189 | Say Y here to include support for the Sound Blaster Audigy LS |
197 | and Live 24bit. | 190 | and Live 24bit. |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 41fc290149ed..9bde76c4c6a2 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -220,12 +220,6 @@ const char *snd_ac97_stereo_enhancements[] = | |||
220 | /* 31 */ "Reserved 31" | 220 | /* 31 */ "Reserved 31" |
221 | }; | 221 | }; |
222 | 222 | ||
223 | /* | ||
224 | * Shared AC97 controllers (ICH, ATIIXP...) | ||
225 | */ | ||
226 | static DECLARE_MUTEX(shared_codec_mutex); | ||
227 | static ac97_t *shared_codec[AC97_SHARED_TYPES][4]; | ||
228 | |||
229 | 223 | ||
230 | /* | 224 | /* |
231 | * I/O routines | 225 | * I/O routines |
@@ -996,14 +990,8 @@ static int snd_ac97_free(ac97_t *ac97) | |||
996 | { | 990 | { |
997 | if (ac97) { | 991 | if (ac97) { |
998 | snd_ac97_proc_done(ac97); | 992 | snd_ac97_proc_done(ac97); |
999 | if (ac97->bus) { | 993 | if (ac97->bus) |
1000 | ac97->bus->codec[ac97->num] = NULL; | 994 | ac97->bus->codec[ac97->num] = NULL; |
1001 | if (ac97->bus->shared_type) { | ||
1002 | down(&shared_codec_mutex); | ||
1003 | shared_codec[ac97->bus->shared_type-1][ac97->num] = NULL; | ||
1004 | up(&shared_codec_mutex); | ||
1005 | } | ||
1006 | } | ||
1007 | if (ac97->private_free) | 995 | if (ac97->private_free) |
1008 | ac97->private_free(ac97); | 996 | ac97->private_free(ac97); |
1009 | kfree(ac97); | 997 | kfree(ac97); |
@@ -1139,7 +1127,6 @@ snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97 | |||
1139 | { | 1127 | { |
1140 | snd_kcontrol_new_t template; | 1128 | snd_kcontrol_new_t template; |
1141 | memcpy(&template, _template, sizeof(template)); | 1129 | memcpy(&template, _template, sizeof(template)); |
1142 | snd_runtime_check(!template.index, return NULL); | ||
1143 | template.index = ac97->num; | 1130 | template.index = ac97->num; |
1144 | return snd_ctl_new1(&template, ac97); | 1131 | return snd_ctl_new1(&template, ac97); |
1145 | } | 1132 | } |
@@ -1758,8 +1745,7 @@ static int ac97_reset_wait(ac97_t *ac97, int timeout, int with_modem) | |||
1758 | if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05) | 1745 | if ((snd_ac97_read(ac97, AC97_REC_GAIN) & 0x7fff) == 0x0a05) |
1759 | return 0; | 1746 | return 0; |
1760 | } | 1747 | } |
1761 | set_current_state(TASK_UNINTERRUPTIBLE); | 1748 | schedule_timeout_uninterruptible(1); |
1762 | schedule_timeout(1); | ||
1763 | } while (time_after_eq(end_time, jiffies)); | 1749 | } while (time_after_eq(end_time, jiffies)); |
1764 | return -ENODEV; | 1750 | return -ENODEV; |
1765 | } | 1751 | } |
@@ -1889,21 +1875,6 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
1889 | snd_assert(bus != NULL && template != NULL, return -EINVAL); | 1875 | snd_assert(bus != NULL && template != NULL, return -EINVAL); |
1890 | snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL); | 1876 | snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL); |
1891 | 1877 | ||
1892 | snd_assert(bus->shared_type <= AC97_SHARED_TYPES, return -EINVAL); | ||
1893 | if (bus->shared_type) { | ||
1894 | /* already shared? */ | ||
1895 | down(&shared_codec_mutex); | ||
1896 | ac97 = shared_codec[bus->shared_type-1][template->num]; | ||
1897 | if (ac97) { | ||
1898 | if ((ac97_is_audio(ac97) && (template->scaps & AC97_SCAP_SKIP_AUDIO)) || | ||
1899 | (ac97_is_modem(ac97) && (template->scaps & AC97_SCAP_SKIP_MODEM))) { | ||
1900 | up(&shared_codec_mutex); | ||
1901 | return -EACCES; /* skip this */ | ||
1902 | } | ||
1903 | } | ||
1904 | up(&shared_codec_mutex); | ||
1905 | } | ||
1906 | |||
1907 | card = bus->card; | 1878 | card = bus->card; |
1908 | ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL); | 1879 | ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL); |
1909 | if (ac97 == NULL) | 1880 | if (ac97 == NULL) |
@@ -2020,8 +1991,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2020 | do { | 1991 | do { |
2021 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) | 1992 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) |
2022 | goto __ready_ok; | 1993 | goto __ready_ok; |
2023 | set_current_state(TASK_UNINTERRUPTIBLE); | 1994 | schedule_timeout_uninterruptible(1); |
2024 | schedule_timeout(1); | ||
2025 | } while (time_after_eq(end_time, jiffies)); | 1995 | } while (time_after_eq(end_time, jiffies)); |
2026 | snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); | 1996 | snd_printk(KERN_WARNING "AC'97 %d analog subsections not ready\n", ac97->num); |
2027 | } | 1997 | } |
@@ -2053,8 +2023,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2053 | do { | 2023 | do { |
2054 | if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) | 2024 | if ((snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS) & tmp) == tmp) |
2055 | goto __ready_ok; | 2025 | goto __ready_ok; |
2056 | set_current_state(TASK_UNINTERRUPTIBLE); | 2026 | schedule_timeout_uninterruptible(1); |
2057 | schedule_timeout(1); | ||
2058 | } while (time_after_eq(end_time, jiffies)); | 2027 | } while (time_after_eq(end_time, jiffies)); |
2059 | snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); | 2028 | snd_printk(KERN_WARNING "MC'97 %d converters and GPIO not ready (0x%x)\n", ac97->num, snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS)); |
2060 | } | 2029 | } |
@@ -2077,6 +2046,8 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2077 | snd_ac97_update_bits(ac97, AC97_GENERAL_PURPOSE, AC97_GP_DRSS_MASK, AC97_GP_DRSS_78); | 2046 | snd_ac97_update_bits(ac97, AC97_GENERAL_PURPOSE, AC97_GP_DRSS_MASK, AC97_GP_DRSS_78); |
2078 | if ((snd_ac97_read(ac97, AC97_GENERAL_PURPOSE) & AC97_GP_DRSS_MASK) == AC97_GP_DRSS_78) | 2047 | if ((snd_ac97_read(ac97, AC97_GENERAL_PURPOSE) & AC97_GP_DRSS_MASK) == AC97_GP_DRSS_78) |
2079 | ac97->flags |= AC97_DOUBLE_RATE; | 2048 | ac97->flags |= AC97_DOUBLE_RATE; |
2049 | /* restore to slots 10/11 to avoid the confliction with surrounds */ | ||
2050 | snd_ac97_update_bits(ac97, AC97_GENERAL_PURPOSE, AC97_GP_DRSS_MASK, 0); | ||
2080 | } | 2051 | } |
2081 | if (ac97->ext_id & AC97_EI_VRA) { /* VRA support */ | 2052 | if (ac97->ext_id & AC97_EI_VRA) { /* VRA support */ |
2082 | snd_ac97_determine_rates(ac97, AC97_PCM_FRONT_DAC_RATE, 0, &ac97->rates[AC97_RATES_FRONT_DAC]); | 2053 | snd_ac97_determine_rates(ac97, AC97_PCM_FRONT_DAC_RATE, 0, &ac97->rates[AC97_RATES_FRONT_DAC]); |
@@ -2153,7 +2124,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2153 | } | 2124 | } |
2154 | } | 2125 | } |
2155 | /* make sure the proper powerdown bits are cleared */ | 2126 | /* make sure the proper powerdown bits are cleared */ |
2156 | if (ac97->scaps) { | 2127 | if (ac97->scaps && ac97_is_audio(ac97)) { |
2157 | reg = snd_ac97_read(ac97, AC97_EXTENDED_STATUS); | 2128 | reg = snd_ac97_read(ac97, AC97_EXTENDED_STATUS); |
2158 | if (ac97->scaps & AC97_SCAP_SURROUND_DAC) | 2129 | if (ac97->scaps & AC97_SCAP_SURROUND_DAC) |
2159 | reg &= ~AC97_EA_PRJ; | 2130 | reg &= ~AC97_EA_PRJ; |
@@ -2167,13 +2138,6 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97) | |||
2167 | return err; | 2138 | return err; |
2168 | } | 2139 | } |
2169 | *rac97 = ac97; | 2140 | *rac97 = ac97; |
2170 | |||
2171 | if (bus->shared_type) { | ||
2172 | down(&shared_codec_mutex); | ||
2173 | shared_codec[bus->shared_type-1][ac97->num] = ac97; | ||
2174 | up(&shared_codec_mutex); | ||
2175 | } | ||
2176 | |||
2177 | return 0; | 2141 | return 0; |
2178 | } | 2142 | } |
2179 | 2143 | ||
@@ -2295,8 +2259,7 @@ void snd_ac97_resume(ac97_t *ac97) | |||
2295 | do { | 2259 | do { |
2296 | if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) | 2260 | if (snd_ac97_read(ac97, AC97_MASTER) == 0x8101) |
2297 | break; | 2261 | break; |
2298 | set_current_state(TASK_UNINTERRUPTIBLE); | 2262 | schedule_timeout_uninterruptible(1); |
2299 | schedule_timeout(1); | ||
2300 | } while (time_after_eq(end_time, jiffies)); | 2263 | } while (time_after_eq(end_time, jiffies)); |
2301 | /* FIXME: extra delay */ | 2264 | /* FIXME: extra delay */ |
2302 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); | 2265 | ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); |
@@ -2308,8 +2271,7 @@ void snd_ac97_resume(ac97_t *ac97) | |||
2308 | unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); | 2271 | unsigned short val = snd_ac97_read(ac97, AC97_EXTENDED_MID); |
2309 | if (val != 0xffff && (val & 1) != 0) | 2272 | if (val != 0xffff && (val & 1) != 0) |
2310 | break; | 2273 | break; |
2311 | set_current_state(TASK_UNINTERRUPTIBLE); | 2274 | schedule_timeout_uninterruptible(1); |
2312 | schedule_timeout(1); | ||
2313 | } while (time_after_eq(end_time, jiffies)); | 2275 | } while (time_after_eq(end_time, jiffies)); |
2314 | } | 2276 | } |
2315 | __reset_ready: | 2277 | __reset_ready: |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 0238cc65d32a..de1c72ad2c6b 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -163,14 +163,24 @@ static int ac97_channel_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
163 | .private_value = 1, \ | 163 | .private_value = 1, \ |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline int is_surround_on(ac97_t *ac97) | ||
167 | { | ||
168 | return ac97->channel_mode >= 1; | ||
169 | } | ||
170 | |||
171 | static inline int is_clfe_on(ac97_t *ac97) | ||
172 | { | ||
173 | return ac97->channel_mode >= 2; | ||
174 | } | ||
175 | |||
166 | static inline int is_shared_linein(ac97_t *ac97) | 176 | static inline int is_shared_linein(ac97_t *ac97) |
167 | { | 177 | { |
168 | return ! ac97->indep_surround && ac97->channel_mode >= 1; | 178 | return ! ac97->indep_surround && is_surround_on(ac97); |
169 | } | 179 | } |
170 | 180 | ||
171 | static inline int is_shared_micin(ac97_t *ac97) | 181 | static inline int is_shared_micin(ac97_t *ac97) |
172 | { | 182 | { |
173 | return ! ac97->indep_surround && ac97->channel_mode >= 2; | 183 | return ! ac97->indep_surround && is_clfe_on(ac97); |
174 | } | 184 | } |
175 | 185 | ||
176 | 186 | ||
@@ -1450,7 +1460,8 @@ int patch_ad1881(ac97_t * ac97) | |||
1450 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); | 1460 | codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); |
1451 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); | 1461 | codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); |
1452 | 1462 | ||
1453 | snd_runtime_check(codecs[0] | codecs[1] | codecs[2], goto __end); | 1463 | if (! (codecs[0] || codecs[1] || codecs[2])) |
1464 | goto __end; | ||
1454 | 1465 | ||
1455 | for (idx = 0; idx < 3; idx++) | 1466 | for (idx = 0; idx < 3; idx++) |
1456 | if (ac97->spec.ad18xx.unchained[idx]) | 1467 | if (ac97->spec.ad18xx.unchained[idx]) |
@@ -1753,12 +1764,13 @@ static int snd_ac97_ad1888_downmix_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_va | |||
1753 | 1764 | ||
1754 | static void ad1888_update_jacks(ac97_t *ac97) | 1765 | static void ad1888_update_jacks(ac97_t *ac97) |
1755 | { | 1766 | { |
1767 | unsigned short val = 0; | ||
1768 | if (! is_shared_linein(ac97)) | ||
1769 | val |= (1 << 12); | ||
1770 | if (! is_shared_micin(ac97)) | ||
1771 | val |= (1 << 11); | ||
1756 | /* shared Line-In */ | 1772 | /* shared Line-In */ |
1757 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 12, | 1773 | snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); |
1758 | is_shared_linein(ac97) ? 0 : 1 << 12); | ||
1759 | /* shared Mic */ | ||
1760 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 11, | ||
1761 | is_shared_micin(ac97) ? 0 : 1 << 11); | ||
1762 | } | 1774 | } |
1763 | 1775 | ||
1764 | static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = { | 1776 | static const snd_kcontrol_new_t snd_ac97_ad1888_controls[] = { |
@@ -1852,12 +1864,7 @@ static const snd_kcontrol_new_t snd_ac97_ad1985_controls[] = { | |||
1852 | 1864 | ||
1853 | static void ad1985_update_jacks(ac97_t *ac97) | 1865 | static void ad1985_update_jacks(ac97_t *ac97) |
1854 | { | 1866 | { |
1855 | /* shared Line-In */ | 1867 | ad1888_update_jacks(ac97); |
1856 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 12, | ||
1857 | is_shared_linein(ac97) ? 0 : 1 << 12); | ||
1858 | /* shared Mic */ | ||
1859 | snd_ac97_update_bits(ac97, AC97_AD_MISC, 1 << 11, | ||
1860 | is_shared_micin(ac97) ? 0 : 1 << 11); | ||
1861 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, | 1868 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, |
1862 | is_shared_micin(ac97) ? 0 : 1 << 9); | 1869 | is_shared_micin(ac97) ? 0 : 1 << 9); |
1863 | } | 1870 | } |
@@ -2442,21 +2449,37 @@ int patch_cm9739(ac97_t * ac97) | |||
2442 | 2449 | ||
2443 | static void cm9761_update_jacks(ac97_t *ac97) | 2450 | static void cm9761_update_jacks(ac97_t *ac97) |
2444 | { | 2451 | { |
2445 | unsigned short surr_vals[2][2] = { | 2452 | /* FIXME: check the bits for each model |
2446 | { 0x0008, 0x0400 }, /* off, on */ | 2453 | * model 83 is confirmed to work |
2447 | { 0x0000, 0x0408 }, /* off, on (9761-82 rev.B) */ | 2454 | */ |
2455 | static unsigned short surr_on[3][2] = { | ||
2456 | { 0x0008, 0x0000 }, /* 9761-78 & 82 */ | ||
2457 | { 0x0000, 0x0008 }, /* 9761-82 rev.B */ | ||
2458 | { 0x0000, 0x0008 }, /* 9761-83 */ | ||
2459 | }; | ||
2460 | static unsigned short clfe_on[3][2] = { | ||
2461 | { 0x0000, 0x1000 }, /* 9761-78 & 82 */ | ||
2462 | { 0x1000, 0x0000 }, /* 9761-82 rev.B */ | ||
2463 | { 0x0000, 0x1000 }, /* 9761-83 */ | ||
2464 | }; | ||
2465 | static unsigned short surr_shared[3][2] = { | ||
2466 | { 0x0000, 0x0400 }, /* 9761-78 & 82 */ | ||
2467 | { 0x0000, 0x0400 }, /* 9761-82 rev.B */ | ||
2468 | { 0x0000, 0x0400 }, /* 9761-83 */ | ||
2448 | }; | 2469 | }; |
2449 | unsigned short clfe_vals[2][2] = { | 2470 | static unsigned short clfe_shared[3][2] = { |
2450 | { 0x2000, 0x1880 }, /* off, on */ | 2471 | { 0x2000, 0x0880 }, /* 9761-78 & 82 */ |
2451 | { 0x1000, 0x2880 }, /* off, on (9761-82 rev.B) */ | 2472 | { 0x0000, 0x2880 }, /* 9761-82 rev.B */ |
2473 | { 0x2000, 0x0800 }, /* 9761-83 */ | ||
2452 | }; | 2474 | }; |
2475 | unsigned short val = 0; | ||
2453 | 2476 | ||
2454 | /* shared Line-In */ | 2477 | val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)]; |
2455 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x0408, | 2478 | val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)]; |
2456 | surr_vals[ac97->spec.dev_flags][is_shared_linein(ac97)]); | 2479 | val |= surr_shared[ac97->spec.dev_flags][is_shared_linein(ac97)]; |
2457 | /* shared Mic */ | 2480 | val |= clfe_shared[ac97->spec.dev_flags][is_shared_micin(ac97)]; |
2458 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3880, | 2481 | |
2459 | clfe_vals[ac97->spec.dev_flags][is_shared_micin(ac97)]); | 2482 | snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val); |
2460 | } | 2483 | } |
2461 | 2484 | ||
2462 | static const snd_kcontrol_new_t snd_ac97_cm9761_controls[] = { | 2485 | static const snd_kcontrol_new_t snd_ac97_cm9761_controls[] = { |
@@ -2551,7 +2574,7 @@ int patch_cm9761(ac97_t *ac97) | |||
2551 | snd_ac97_write_cache(ac97, AC97_MASTER, 0x8808); | 2574 | snd_ac97_write_cache(ac97, AC97_MASTER, 0x8808); |
2552 | snd_ac97_write_cache(ac97, AC97_PCM, 0x8808); | 2575 | snd_ac97_write_cache(ac97, AC97_PCM, 0x8808); |
2553 | 2576 | ||
2554 | ac97->spec.dev_flags = 0; /* 1 = model 82 revision B */ | 2577 | ac97->spec.dev_flags = 0; /* 1 = model 82 revision B, 2 = model 83 */ |
2555 | if (ac97->id == AC97_ID_CM9761_82) { | 2578 | if (ac97->id == AC97_ID_CM9761_82) { |
2556 | unsigned short tmp; | 2579 | unsigned short tmp; |
2557 | /* check page 1, reg 0x60 */ | 2580 | /* check page 1, reg 0x60 */ |
@@ -2560,7 +2583,8 @@ int patch_cm9761(ac97_t *ac97) | |||
2560 | tmp = snd_ac97_read(ac97, 0x60); | 2583 | tmp = snd_ac97_read(ac97, 0x60); |
2561 | ac97->spec.dev_flags = tmp & 1; /* revision B? */ | 2584 | ac97->spec.dev_flags = tmp & 1; /* revision B? */ |
2562 | snd_ac97_write_cache(ac97, AC97_INT_PAGING, val); | 2585 | snd_ac97_write_cache(ac97, AC97_INT_PAGING, val); |
2563 | } | 2586 | } else if (ac97->id == AC97_ID_CM9761_83) |
2587 | ac97->spec.dev_flags = 2; | ||
2564 | 2588 | ||
2565 | ac97->build_ops = &patch_cm9761_ops; | 2589 | ac97->build_ops = &patch_cm9761_ops; |
2566 | 2590 | ||
diff --git a/sound/pci/ac97/ac97_pcm.c b/sound/pci/ac97/ac97_pcm.c index dd289b9512e1..ded13165d635 100644 --- a/sound/pci/ac97/ac97_pcm.c +++ b/sound/pci/ac97/ac97_pcm.c | |||
@@ -303,6 +303,15 @@ int snd_ac97_set_rate(ac97_t *ac97, int reg, unsigned int rate) | |||
303 | AC97_EA_DRA, dbl ? AC97_EA_DRA : 0); | 303 | AC97_EA_DRA, dbl ? AC97_EA_DRA : 0); |
304 | snd_ac97_update(ac97, reg, tmp & 0xffff); | 304 | snd_ac97_update(ac97, reg, tmp & 0xffff); |
305 | snd_ac97_read(ac97, reg); | 305 | snd_ac97_read(ac97, reg); |
306 | if ((ac97->ext_id & AC97_EI_DRA) && reg == AC97_PCM_FRONT_DAC_RATE) { | ||
307 | /* Intel controllers require double rate data to be put in | ||
308 | * slots 7+8 | ||
309 | */ | ||
310 | snd_ac97_update_bits(ac97, AC97_GENERAL_PURPOSE, | ||
311 | AC97_GP_DRSS_MASK, | ||
312 | dbl ? AC97_GP_DRSS_78 : 0); | ||
313 | snd_ac97_read(ac97, AC97_GENERAL_PURPOSE); | ||
314 | } | ||
306 | return 0; | 315 | return 0; |
307 | } | 316 | } |
308 | 317 | ||
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d7d99a25c5e5..e72ccd1a004f 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include "ad1889.h" | 50 | #include "ad1889.h" |
51 | #include "ac97/ac97_id.h" | 51 | #include "ac97/ac97_id.h" |
52 | 52 | ||
53 | #define AD1889_DRVVER "$Revision: 1.3 $" | 53 | #define AD1889_DRVVER "$Revision: 1.4 $" |
54 | 54 | ||
55 | MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>"); | 55 | MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>"); |
56 | MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver"); | 56 | MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver"); |
@@ -982,8 +982,7 @@ snd_ad1889_create(snd_card_t *card, | |||
982 | return 0; | 982 | return 0; |
983 | 983 | ||
984 | free_and_ret: | 984 | free_and_ret: |
985 | if (chip) | 985 | kfree(chip); |
986 | kfree(chip); | ||
987 | pci_disable_device(pci); | 986 | pci_disable_device(pci); |
988 | 987 | ||
989 | return err; | 988 | return err; |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index f35b558c29b2..4e76c4a636d9 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -45,23 +45,25 @@ MODULE_DESCRIPTION("ALI M5451"); | |||
45 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
46 | MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}"); | 46 | MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}"); |
47 | 47 | ||
48 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 48 | static int index = SNDRV_DEFAULT_IDX1; /* Index */ |
49 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 49 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
50 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 50 | static int pcm_channels = 32; |
51 | static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32}; | 51 | static int spdif = 0; |
52 | static int spdif[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | ||
53 | 52 | ||
54 | module_param_array(index, int, NULL, 0444); | 53 | module_param(index, int, 0444); |
55 | MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); | 54 | MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); |
56 | module_param_array(id, charp, NULL, 0444); | 55 | module_param(id, charp, 0444); |
57 | MODULE_PARM_DESC(id, "ID string for ALI M5451 PCI Audio."); | 56 | MODULE_PARM_DESC(id, "ID string for ALI M5451 PCI Audio."); |
58 | module_param_array(enable, bool, NULL, 0444); | 57 | module_param(pcm_channels, int, 0444); |
59 | MODULE_PARM_DESC(enable, "Enable ALI 5451 PCI Audio."); | ||
60 | module_param_array(pcm_channels, int, NULL, 0444); | ||
61 | MODULE_PARM_DESC(pcm_channels, "PCM Channels"); | 58 | MODULE_PARM_DESC(pcm_channels, "PCM Channels"); |
62 | module_param_array(spdif, bool, NULL, 0444); | 59 | module_param(spdif, bool, 0444); |
63 | MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); | 60 | MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); |
64 | 61 | ||
62 | /* just for backward compatibility */ | ||
63 | static int enable; | ||
64 | module_param(enable, bool, 0444); | ||
65 | |||
66 | |||
65 | /* | 67 | /* |
66 | * Debug part definitions | 68 | * Debug part definitions |
67 | */ | 69 | */ |
@@ -396,10 +398,8 @@ static int snd_ali_codec_ready( ali_t *codec, | |||
396 | res = snd_ali_5451_peek(codec,port); | 398 | res = snd_ali_5451_peek(codec,port); |
397 | if (! (res & 0x8000)) | 399 | if (! (res & 0x8000)) |
398 | return 0; | 400 | return 0; |
399 | if (sched) { | 401 | if (sched) |
400 | set_current_state(TASK_UNINTERRUPTIBLE); | 402 | schedule_timeout_uninterruptible(1); |
401 | schedule_timeout(1); | ||
402 | } | ||
403 | } while (time_after_eq(end_time, jiffies)); | 403 | } while (time_after_eq(end_time, jiffies)); |
404 | snd_ali_5451_poke(codec, port, res & ~0x8000); | 404 | snd_ali_5451_poke(codec, port, res & ~0x8000); |
405 | snd_printdd("ali_codec_ready: codec is not ready.\n "); | 405 | snd_printdd("ali_codec_ready: codec is not ready.\n "); |
@@ -419,12 +419,10 @@ static int snd_ali_stimer_ready(ali_t *codec, int sched) | |||
419 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); | 419 | dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER); |
420 | if (dwChk2 != dwChk1) | 420 | if (dwChk2 != dwChk1) |
421 | return 0; | 421 | return 0; |
422 | if (sched) { | 422 | if (sched) |
423 | set_current_state(TASK_UNINTERRUPTIBLE); | 423 | schedule_timeout_uninterruptible(1); |
424 | schedule_timeout(1); | ||
425 | } | ||
426 | } while (time_after_eq(end_time, jiffies)); | 424 | } while (time_after_eq(end_time, jiffies)); |
427 | snd_printk("ali_stimer_read: stimer is not ready.\n"); | 425 | snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); |
428 | return -EIO; | 426 | return -EIO; |
429 | } | 427 | } |
430 | 428 | ||
@@ -436,7 +434,7 @@ static void snd_ali_codec_poke(ali_t *codec,int secondary, | |||
436 | unsigned int port = 0; | 434 | unsigned int port = 0; |
437 | 435 | ||
438 | if (reg >= 0x80) { | 436 | if (reg >= 0x80) { |
439 | snd_printk("ali_codec_poke: reg(%xh) invalid.\n", reg); | 437 | snd_printk(KERN_ERR "ali_codec_poke: reg(%xh) invalid.\n", reg); |
440 | return; | 438 | return; |
441 | } | 439 | } |
442 | 440 | ||
@@ -465,7 +463,7 @@ static unsigned short snd_ali_codec_peek( ali_t *codec, | |||
465 | unsigned int port = 0; | 463 | unsigned int port = 0; |
466 | 464 | ||
467 | if (reg >= 0x80) { | 465 | if (reg >= 0x80) { |
468 | snd_printk("ali_codec_peek: reg(%xh) invalid.\n", reg); | 466 | snd_printk(KERN_ERR "ali_codec_peek: reg(%xh) invalid.\n", reg); |
469 | return ~0; | 467 | return ~0; |
470 | } | 468 | } |
471 | 469 | ||
@@ -669,7 +667,7 @@ static int snd_ali_alloc_pcm_channel(ali_t *codec, int channel) | |||
669 | unsigned int idx = channel & 0x1f; | 667 | unsigned int idx = channel & 0x1f; |
670 | 668 | ||
671 | if (codec->synth.chcnt >= ALI_CHANNELS){ | 669 | if (codec->synth.chcnt >= ALI_CHANNELS){ |
672 | snd_printk("ali_alloc_pcm_channel: no free channels.\n"); | 670 | snd_printk(KERN_ERR "ali_alloc_pcm_channel: no free channels.\n"); |
673 | return -1; | 671 | return -1; |
674 | } | 672 | } |
675 | 673 | ||
@@ -700,7 +698,7 @@ static int snd_ali_find_free_channel(ali_t * codec, int rec) | |||
700 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) { | 698 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) { |
701 | return result; | 699 | return result; |
702 | } else { | 700 | } else { |
703 | snd_printk("ali_find_free_channel: record channel is busy now.\n"); | 701 | snd_printk(KERN_ERR "ali_find_free_channel: record channel is busy now.\n"); |
704 | return -1; | 702 | return -1; |
705 | } | 703 | } |
706 | } | 704 | } |
@@ -712,7 +710,7 @@ static int snd_ali_find_free_channel(ali_t * codec, int rec) | |||
712 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) { | 710 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) { |
713 | return result; | 711 | return result; |
714 | } else { | 712 | } else { |
715 | snd_printk("ali_find_free_channel: S/PDIF out channel is in busy now.\n"); | 713 | snd_printk(KERN_ERR "ali_find_free_channel: S/PDIF out channel is in busy now.\n"); |
716 | } | 714 | } |
717 | } | 715 | } |
718 | 716 | ||
@@ -720,7 +718,7 @@ static int snd_ali_find_free_channel(ali_t * codec, int rec) | |||
720 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) | 718 | if ((result = snd_ali_alloc_pcm_channel(codec,idx)) >= 0) |
721 | return result; | 719 | return result; |
722 | } | 720 | } |
723 | snd_printk("ali_find_free_channel: no free channels.\n"); | 721 | snd_printk(KERN_ERR "ali_find_free_channel: no free channels.\n"); |
724 | return -1; | 722 | return -1; |
725 | } | 723 | } |
726 | 724 | ||
@@ -734,7 +732,7 @@ static void snd_ali_free_channel_pcm(ali_t *codec, int channel) | |||
734 | return; | 732 | return; |
735 | 733 | ||
736 | if (!(codec->synth.chmap & (1 << idx))) { | 734 | if (!(codec->synth.chmap & (1 << idx))) { |
737 | snd_printk("ali_free_channel_pcm: channel %d is not in use.\n",channel); | 735 | snd_printk(KERN_ERR "ali_free_channel_pcm: channel %d is not in use.\n",channel); |
738 | return; | 736 | return; |
739 | } else { | 737 | } else { |
740 | codec->synth.chmap &= ~(1 << idx); | 738 | codec->synth.chmap &= ~(1 << idx); |
@@ -796,7 +794,7 @@ static void snd_ali_detect_spdif_rate(ali_t *codec) | |||
796 | } | 794 | } |
797 | 795 | ||
798 | if (count > 50000) { | 796 | if (count > 50000) { |
799 | snd_printk("ali_detect_spdif_rate: timeout!\n"); | 797 | snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); |
800 | return; | 798 | return; |
801 | } | 799 | } |
802 | 800 | ||
@@ -809,7 +807,7 @@ static void snd_ali_detect_spdif_rate(ali_t *codec) | |||
809 | } | 807 | } |
810 | 808 | ||
811 | if (count > 50000) { | 809 | if (count > 50000) { |
812 | snd_printk("ali_detect_spdif_rate: timeout!\n"); | 810 | snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); |
813 | return; | 811 | return; |
814 | } | 812 | } |
815 | 813 | ||
@@ -1077,7 +1075,7 @@ static snd_ali_voice_t *snd_ali_alloc_voice(ali_t * codec, int type, int rec, in | |||
1077 | idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) : | 1075 | idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) : |
1078 | snd_ali_find_free_channel(codec,rec); | 1076 | snd_ali_find_free_channel(codec,rec); |
1079 | if(idx < 0) { | 1077 | if(idx < 0) { |
1080 | snd_printk("ali_alloc_voice: err.\n"); | 1078 | snd_printk(KERN_ERR "ali_alloc_voice: err.\n"); |
1081 | spin_unlock_irqrestore(&codec->voice_alloc, flags); | 1079 | spin_unlock_irqrestore(&codec->voice_alloc, flags); |
1082 | return NULL; | 1080 | return NULL; |
1083 | } | 1081 | } |
@@ -1479,13 +1477,13 @@ static int snd_ali_prepare(snd_pcm_substream_t * substream) | |||
1479 | } | 1477 | } |
1480 | rate = snd_ali_get_spdif_in_rate(codec); | 1478 | rate = snd_ali_get_spdif_in_rate(codec); |
1481 | if (rate == 0) { | 1479 | if (rate == 0) { |
1482 | snd_printk("ali_capture_preapre: spdif rate detect err!\n"); | 1480 | snd_printk(KERN_WARNING "ali_capture_preapre: spdif rate detect err!\n"); |
1483 | rate = 48000; | 1481 | rate = 48000; |
1484 | } | 1482 | } |
1485 | bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL)); | 1483 | bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL)); |
1486 | if (bValue & 0x10) { | 1484 | if (bValue & 0x10) { |
1487 | outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL)); | 1485 | outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL)); |
1488 | printk("clear SPDIF parity error flag.\n"); | 1486 | printk(KERN_WARNING "clear SPDIF parity error flag.\n"); |
1489 | } | 1487 | } |
1490 | 1488 | ||
1491 | if (rate != 48000) | 1489 | if (rate != 48000) |
@@ -1795,6 +1793,7 @@ struct ali_pcm_description { | |||
1795 | unsigned int capture_num; | 1793 | unsigned int capture_num; |
1796 | snd_pcm_ops_t *playback_ops; | 1794 | snd_pcm_ops_t *playback_ops; |
1797 | snd_pcm_ops_t *capture_ops; | 1795 | snd_pcm_ops_t *capture_ops; |
1796 | unsigned short class; | ||
1798 | }; | 1797 | }; |
1799 | 1798 | ||
1800 | 1799 | ||
@@ -1813,12 +1812,11 @@ static int __devinit snd_ali_pcm(ali_t * codec, int device, struct ali_pcm_descr | |||
1813 | err = snd_pcm_new(codec->card, desc->name, device, | 1812 | err = snd_pcm_new(codec->card, desc->name, device, |
1814 | desc->playback_num, desc->capture_num, &pcm); | 1813 | desc->playback_num, desc->capture_num, &pcm); |
1815 | if (err < 0) { | 1814 | if (err < 0) { |
1816 | snd_printk("snd_ali_pcm: err called snd_pcm_new.\n"); | 1815 | snd_printk(KERN_ERR "snd_ali_pcm: err called snd_pcm_new.\n"); |
1817 | return err; | 1816 | return err; |
1818 | } | 1817 | } |
1819 | pcm->private_data = codec; | 1818 | pcm->private_data = codec; |
1820 | pcm->private_free = snd_ali_pcm_free; | 1819 | pcm->private_free = snd_ali_pcm_free; |
1821 | pcm->info_flags = 0; | ||
1822 | if (desc->playback_ops) | 1820 | if (desc->playback_ops) |
1823 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, desc->playback_ops); | 1821 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, desc->playback_ops); |
1824 | if (desc->capture_ops) | 1822 | if (desc->capture_ops) |
@@ -1828,6 +1826,7 @@ static int __devinit snd_ali_pcm(ali_t * codec, int device, struct ali_pcm_descr | |||
1828 | snd_dma_pci_data(codec->pci), 64*1024, 128*1024); | 1826 | snd_dma_pci_data(codec->pci), 64*1024, 128*1024); |
1829 | 1827 | ||
1830 | pcm->info_flags = 0; | 1828 | pcm->info_flags = 0; |
1829 | pcm->dev_class = desc->class; | ||
1831 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; | 1830 | pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; |
1832 | strcpy(pcm->name, desc->name); | 1831 | strcpy(pcm->name, desc->name); |
1833 | codec->pcm[0] = pcm; | 1832 | codec->pcm[0] = pcm; |
@@ -1836,7 +1835,7 @@ static int __devinit snd_ali_pcm(ali_t * codec, int device, struct ali_pcm_descr | |||
1836 | 1835 | ||
1837 | static struct ali_pcm_description ali_pcms[] = { | 1836 | static struct ali_pcm_description ali_pcms[] = { |
1838 | { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops }, | 1837 | { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops }, |
1839 | { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops } | 1838 | { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops, SNDRV_PCM_CLASS_MODEM } |
1840 | }; | 1839 | }; |
1841 | 1840 | ||
1842 | static int __devinit snd_ali_build_pcms(ali_t *codec) | 1841 | static int __devinit snd_ali_build_pcms(ali_t *codec) |
@@ -1991,7 +1990,7 @@ static int __devinit snd_ali_mixer(ali_t * codec) | |||
1991 | for ( i = 0 ; i < codec->num_of_codecs ; i++) { | 1990 | for ( i = 0 ; i < codec->num_of_codecs ; i++) { |
1992 | ac97.num = i; | 1991 | ac97.num = i; |
1993 | if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { | 1992 | if ((err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i])) < 0) { |
1994 | snd_printk("ali mixer %d creating error.\n", i); | 1993 | snd_printk(KERN_ERR "ali mixer %d creating error.\n", i); |
1995 | if(i == 0) | 1994 | if(i == 0) |
1996 | return err; | 1995 | return err; |
1997 | codec->num_of_codecs = 1; | 1996 | codec->num_of_codecs = 1; |
@@ -2125,7 +2124,7 @@ static int snd_ali_chip_init(ali_t *codec) | |||
2125 | snd_ali_printk("chip initializing ... \n"); | 2124 | snd_ali_printk("chip initializing ... \n"); |
2126 | 2125 | ||
2127 | if (snd_ali_reset_5451(codec)) { | 2126 | if (snd_ali_reset_5451(codec)) { |
2128 | snd_printk("ali_chip_init: reset 5451 error.\n"); | 2127 | snd_printk(KERN_ERR "ali_chip_init: reset 5451 error.\n"); |
2129 | return -1; | 2128 | return -1; |
2130 | } | 2129 | } |
2131 | 2130 | ||
@@ -2200,7 +2199,7 @@ static int __devinit snd_ali_resources(ali_t *codec) | |||
2200 | codec->port = pci_resource_start(codec->pci, 0); | 2199 | codec->port = pci_resource_start(codec->pci, 0); |
2201 | 2200 | ||
2202 | if (request_irq(codec->pci->irq, snd_ali_card_interrupt, SA_INTERRUPT|SA_SHIRQ, "ALI 5451", (void *)codec)) { | 2201 | if (request_irq(codec->pci->irq, snd_ali_card_interrupt, SA_INTERRUPT|SA_SHIRQ, "ALI 5451", (void *)codec)) { |
2203 | snd_printk("Unable to request irq.\n"); | 2202 | snd_printk(KERN_ERR "Unable to request irq.\n"); |
2204 | return -EBUSY; | 2203 | return -EBUSY; |
2205 | } | 2204 | } |
2206 | codec->irq = codec->pci->irq; | 2205 | codec->irq = codec->pci->irq; |
@@ -2240,7 +2239,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2240 | /* check, if we can restrict PCI DMA transfers to 31 bits */ | 2239 | /* check, if we can restrict PCI DMA transfers to 31 bits */ |
2241 | if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || | 2240 | if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || |
2242 | pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { | 2241 | pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { |
2243 | snd_printk("architecture does not support 31bit PCI busmaster DMA\n"); | 2242 | snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n"); |
2244 | pci_disable_device(pci); | 2243 | pci_disable_device(pci); |
2245 | return -ENXIO; | 2244 | return -ENXIO; |
2246 | } | 2245 | } |
@@ -2329,7 +2328,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2329 | } | 2328 | } |
2330 | 2329 | ||
2331 | if ((err = snd_ali_chip_init(codec)) < 0) { | 2330 | if ((err = snd_ali_chip_init(codec)) < 0) { |
2332 | snd_printk("ali create: chip init error.\n"); | 2331 | snd_printk(KERN_ERR "ali create: chip init error.\n"); |
2333 | return err; | 2332 | return err; |
2334 | } | 2333 | } |
2335 | 2334 | ||
@@ -2352,25 +2351,17 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2352 | static int __devinit snd_ali_probe(struct pci_dev *pci, | 2351 | static int __devinit snd_ali_probe(struct pci_dev *pci, |
2353 | const struct pci_device_id *pci_id) | 2352 | const struct pci_device_id *pci_id) |
2354 | { | 2353 | { |
2355 | static int dev; | ||
2356 | snd_card_t *card; | 2354 | snd_card_t *card; |
2357 | ali_t *codec; | 2355 | ali_t *codec; |
2358 | int err; | 2356 | int err; |
2359 | 2357 | ||
2360 | snd_ali_printk("probe ...\n"); | 2358 | snd_ali_printk("probe ...\n"); |
2361 | 2359 | ||
2362 | if (dev >= SNDRV_CARDS) | 2360 | card = snd_card_new(index, id, THIS_MODULE, 0); |
2363 | return -ENODEV; | ||
2364 | if (!enable[dev]) { | ||
2365 | dev++; | ||
2366 | return -ENOENT; | ||
2367 | } | ||
2368 | |||
2369 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
2370 | if (card == NULL) | 2361 | if (card == NULL) |
2371 | return -ENOMEM; | 2362 | return -ENOMEM; |
2372 | 2363 | ||
2373 | if ((err = snd_ali_create(card, pci, pcm_channels[dev], spdif[dev], &codec)) < 0) { | 2364 | if ((err = snd_ali_create(card, pci, pcm_channels, spdif, &codec)) < 0) { |
2374 | snd_card_free(card); | 2365 | snd_card_free(card); |
2375 | return err; | 2366 | return err; |
2376 | } | 2367 | } |
@@ -2401,7 +2392,6 @@ static int __devinit snd_ali_probe(struct pci_dev *pci, | |||
2401 | return err; | 2392 | return err; |
2402 | } | 2393 | } |
2403 | pci_set_drvdata(pci, card); | 2394 | pci_set_drvdata(pci, card); |
2404 | dev++; | ||
2405 | return 0; | 2395 | return 0; |
2406 | } | 2396 | } |
2407 | 2397 | ||
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 196ec1c61bb4..7c61561f297f 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -594,8 +594,7 @@ static int __devinit snd_als4000_create_gameport(snd_card_als4000_t *acard, int | |||
594 | acard->gameport = gp = gameport_allocate_port(); | 594 | acard->gameport = gp = gameport_allocate_port(); |
595 | if (!gp) { | 595 | if (!gp) { |
596 | printk(KERN_ERR "als4000: cannot allocate memory for gameport\n"); | 596 | printk(KERN_ERR "als4000: cannot allocate memory for gameport\n"); |
597 | release_resource(r); | 597 | release_and_free_resource(r); |
598 | kfree_nocheck(r); | ||
599 | return -ENOMEM; | 598 | return -ENOMEM; |
600 | } | 599 | } |
601 | 600 | ||
@@ -622,8 +621,7 @@ static void snd_als4000_free_gameport(snd_card_als4000_t *acard) | |||
622 | acard->gameport = NULL; | 621 | acard->gameport = NULL; |
623 | 622 | ||
624 | snd_als4000_set_addr(acard->gcr, 0, 0, 0, 0); /* disable joystick */ | 623 | snd_als4000_set_addr(acard->gcr, 0, 0, 0, 0); /* disable joystick */ |
625 | release_resource(r); | 624 | release_and_free_resource(r); |
626 | kfree_nocheck(r); | ||
627 | } | 625 | } |
628 | } | 626 | } |
629 | #else | 627 | #else |
@@ -669,7 +667,7 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, | |||
669 | /* check, if we can restrict PCI DMA transfers to 24 bits */ | 667 | /* check, if we can restrict PCI DMA transfers to 24 bits */ |
670 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || | 668 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || |
671 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { | 669 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { |
672 | snd_printk("architecture does not support 24bit PCI busmaster DMA\n"); | 670 | snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); |
673 | pci_disable_device(pci); | 671 | pci_disable_device(pci); |
674 | return -ENXIO; | 672 | return -ENXIO; |
675 | } | 673 | } |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 241eacf1e652..f5dad9248e39 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -39,26 +39,27 @@ MODULE_DESCRIPTION("ATI IXP AC97 controller"); | |||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250/300/400}}"); | 40 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250/300/400}}"); |
41 | 41 | ||
42 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 42 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
43 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 43 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
44 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 44 | static int ac97_clock = 48000; |
45 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000}; | 45 | static char *ac97_quirk; |
46 | static char *ac97_quirk[SNDRV_CARDS]; | 46 | static int spdif_aclink = 1; |
47 | static int spdif_aclink[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; | 47 | |
48 | 48 | module_param(index, int, 0444); | |
49 | module_param_array(index, int, NULL, 0444); | ||
50 | MODULE_PARM_DESC(index, "Index value for ATI IXP controller."); | 49 | MODULE_PARM_DESC(index, "Index value for ATI IXP controller."); |
51 | module_param_array(id, charp, NULL, 0444); | 50 | module_param(id, charp, 0444); |
52 | MODULE_PARM_DESC(id, "ID string for ATI IXP controller."); | 51 | MODULE_PARM_DESC(id, "ID string for ATI IXP controller."); |
53 | module_param_array(enable, bool, NULL, 0444); | 52 | module_param(ac97_clock, int, 0444); |
54 | MODULE_PARM_DESC(enable, "Enable audio part of ATI IXP controller."); | ||
55 | module_param_array(ac97_clock, int, NULL, 0444); | ||
56 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); | 53 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); |
57 | module_param_array(ac97_quirk, charp, NULL, 0444); | 54 | module_param(ac97_quirk, charp, 0444); |
58 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | 55 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); |
59 | module_param_array(spdif_aclink, bool, NULL, 0444); | 56 | module_param(spdif_aclink, bool, 0444); |
60 | MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); | 57 | MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); |
61 | 58 | ||
59 | /* just for backward compatibility */ | ||
60 | static int enable; | ||
61 | module_param(enable, bool, 0444); | ||
62 | |||
62 | 63 | ||
63 | /* | 64 | /* |
64 | */ | 65 | */ |
@@ -329,8 +330,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, | |||
329 | 330 | ||
330 | /* delay for one tick */ | 331 | /* delay for one tick */ |
331 | #define do_delay() do { \ | 332 | #define do_delay() do { \ |
332 | set_current_state(TASK_UNINTERRUPTIBLE); \ | 333 | schedule_timeout_uninterruptible(1); \ |
333 | schedule_timeout(1); \ | ||
334 | } while (0) | 334 | } while (0) |
335 | 335 | ||
336 | 336 | ||
@@ -1372,7 +1372,6 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock, const char | |||
1372 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) | 1372 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) |
1373 | return err; | 1373 | return err; |
1374 | pbus->clock = clock; | 1374 | pbus->clock = clock; |
1375 | pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with modem driver */ | ||
1376 | chip->ac97_bus = pbus; | 1375 | chip->ac97_bus = pbus; |
1377 | 1376 | ||
1378 | codec_count = 0; | 1377 | codec_count = 0; |
@@ -1579,26 +1578,18 @@ static int __devinit snd_atiixp_create(snd_card_t *card, | |||
1579 | static int __devinit snd_atiixp_probe(struct pci_dev *pci, | 1578 | static int __devinit snd_atiixp_probe(struct pci_dev *pci, |
1580 | const struct pci_device_id *pci_id) | 1579 | const struct pci_device_id *pci_id) |
1581 | { | 1580 | { |
1582 | static int dev; | ||
1583 | snd_card_t *card; | 1581 | snd_card_t *card; |
1584 | atiixp_t *chip; | 1582 | atiixp_t *chip; |
1585 | unsigned char revision; | 1583 | unsigned char revision; |
1586 | int err; | 1584 | int err; |
1587 | 1585 | ||
1588 | if (dev >= SNDRV_CARDS) | 1586 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1589 | return -ENODEV; | ||
1590 | if (!enable[dev]) { | ||
1591 | dev++; | ||
1592 | return -ENOENT; | ||
1593 | } | ||
1594 | |||
1595 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1596 | if (card == NULL) | 1587 | if (card == NULL) |
1597 | return -ENOMEM; | 1588 | return -ENOMEM; |
1598 | 1589 | ||
1599 | pci_read_config_byte(pci, PCI_REVISION_ID, &revision); | 1590 | pci_read_config_byte(pci, PCI_REVISION_ID, &revision); |
1600 | 1591 | ||
1601 | strcpy(card->driver, spdif_aclink[dev] ? "ATIIXP" : "ATIIXP-SPDMA"); | 1592 | strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); |
1602 | strcpy(card->shortname, "ATI IXP"); | 1593 | strcpy(card->shortname, "ATI IXP"); |
1603 | if ((err = snd_atiixp_create(card, pci, &chip)) < 0) | 1594 | if ((err = snd_atiixp_create(card, pci, &chip)) < 0) |
1604 | goto __error; | 1595 | goto __error; |
@@ -1606,9 +1597,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1606 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) | 1597 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) |
1607 | goto __error; | 1598 | goto __error; |
1608 | 1599 | ||
1609 | chip->spdif_over_aclink = spdif_aclink[dev]; | 1600 | chip->spdif_over_aclink = spdif_aclink; |
1610 | 1601 | ||
1611 | if ((err = snd_atiixp_mixer_new(chip, ac97_clock[dev], ac97_quirk[dev])) < 0) | 1602 | if ((err = snd_atiixp_mixer_new(chip, ac97_clock, ac97_quirk)) < 0) |
1612 | goto __error; | 1603 | goto __error; |
1613 | 1604 | ||
1614 | if ((err = snd_atiixp_pcm_new(chip)) < 0) | 1605 | if ((err = snd_atiixp_pcm_new(chip)) < 0) |
@@ -1629,7 +1620,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1629 | goto __error; | 1620 | goto __error; |
1630 | 1621 | ||
1631 | pci_set_drvdata(pci, card); | 1622 | pci_set_drvdata(pci, card); |
1632 | dev++; | ||
1633 | return 0; | 1623 | return 0; |
1634 | 1624 | ||
1635 | __error: | 1625 | __error: |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index c1a239a4dac6..0cf202079571 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -39,20 +39,21 @@ MODULE_DESCRIPTION("ATI IXP MC97 controller"); | |||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250}}"); | 40 | MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250}}"); |
41 | 41 | ||
42 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | 42 | static int index = -2; /* Exclude the first card */ |
43 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 43 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
44 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 44 | static int ac97_clock = 48000; |
45 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000}; | ||
46 | 45 | ||
47 | module_param_array(index, int, NULL, 0444); | 46 | module_param(index, int, 0444); |
48 | MODULE_PARM_DESC(index, "Index value for ATI IXP controller."); | 47 | MODULE_PARM_DESC(index, "Index value for ATI IXP controller."); |
49 | module_param_array(id, charp, NULL, 0444); | 48 | module_param(id, charp, 0444); |
50 | MODULE_PARM_DESC(id, "ID string for ATI IXP controller."); | 49 | MODULE_PARM_DESC(id, "ID string for ATI IXP controller."); |
51 | module_param_array(enable, bool, NULL, 0444); | 50 | module_param(ac97_clock, int, 0444); |
52 | MODULE_PARM_DESC(enable, "Enable audio part of ATI IXP controller."); | ||
53 | module_param_array(ac97_clock, int, NULL, 0444); | ||
54 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); | 51 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); |
55 | 52 | ||
53 | /* just for backward compatibility */ | ||
54 | static int enable; | ||
55 | module_param(enable, bool, 0444); | ||
56 | |||
56 | 57 | ||
57 | /* | 58 | /* |
58 | */ | 59 | */ |
@@ -306,8 +307,7 @@ static int snd_atiixp_update_bits(atiixp_t *chip, unsigned int reg, | |||
306 | 307 | ||
307 | /* delay for one tick */ | 308 | /* delay for one tick */ |
308 | #define do_delay() do { \ | 309 | #define do_delay() do { \ |
309 | set_current_state(TASK_UNINTERRUPTIBLE); \ | 310 | schedule_timeout_uninterruptible(1); \ |
310 | schedule_timeout(1); \ | ||
311 | } while (0) | 311 | } while (0) |
312 | 312 | ||
313 | 313 | ||
@@ -989,6 +989,7 @@ static int __devinit snd_atiixp_pcm_new(atiixp_t *chip) | |||
989 | return err; | 989 | return err; |
990 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops); | 990 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_atiixp_playback_ops); |
991 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_atiixp_capture_ops); | 991 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_atiixp_capture_ops); |
992 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
992 | pcm->private_data = chip; | 993 | pcm->private_data = chip; |
993 | strcpy(pcm->name, "ATI IXP MC97"); | 994 | strcpy(pcm->name, "ATI IXP MC97"); |
994 | chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; | 995 | chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; |
@@ -1067,7 +1068,6 @@ static int __devinit snd_atiixp_mixer_new(atiixp_t *chip, int clock) | |||
1067 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) | 1068 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) |
1068 | return err; | 1069 | return err; |
1069 | pbus->clock = clock; | 1070 | pbus->clock = clock; |
1070 | pbus->shared_type = AC97_SHARED_TYPE_ATIIXP; /* shared with audio driver */ | ||
1071 | chip->ac97_bus = pbus; | 1071 | chip->ac97_bus = pbus; |
1072 | 1072 | ||
1073 | codec_count = 0; | 1073 | codec_count = 0; |
@@ -1256,20 +1256,12 @@ static int __devinit snd_atiixp_create(snd_card_t *card, | |||
1256 | static int __devinit snd_atiixp_probe(struct pci_dev *pci, | 1256 | static int __devinit snd_atiixp_probe(struct pci_dev *pci, |
1257 | const struct pci_device_id *pci_id) | 1257 | const struct pci_device_id *pci_id) |
1258 | { | 1258 | { |
1259 | static int dev; | ||
1260 | snd_card_t *card; | 1259 | snd_card_t *card; |
1261 | atiixp_t *chip; | 1260 | atiixp_t *chip; |
1262 | unsigned char revision; | 1261 | unsigned char revision; |
1263 | int err; | 1262 | int err; |
1264 | 1263 | ||
1265 | if (dev >= SNDRV_CARDS) | 1264 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1266 | return -ENODEV; | ||
1267 | if (!enable[dev]) { | ||
1268 | dev++; | ||
1269 | return -ENOENT; | ||
1270 | } | ||
1271 | |||
1272 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1273 | if (card == NULL) | 1265 | if (card == NULL) |
1274 | return -ENOMEM; | 1266 | return -ENOMEM; |
1275 | 1267 | ||
@@ -1283,7 +1275,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1283 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) | 1275 | if ((err = snd_atiixp_aclink_reset(chip)) < 0) |
1284 | goto __error; | 1276 | goto __error; |
1285 | 1277 | ||
1286 | if ((err = snd_atiixp_mixer_new(chip, ac97_clock[dev])) < 0) | 1278 | if ((err = snd_atiixp_mixer_new(chip, ac97_clock)) < 0) |
1287 | goto __error; | 1279 | goto __error; |
1288 | 1280 | ||
1289 | if ((err = snd_atiixp_pcm_new(chip)) < 0) | 1281 | if ((err = snd_atiixp_pcm_new(chip)) < 0) |
@@ -1302,7 +1294,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1302 | goto __error; | 1294 | goto __error; |
1303 | 1295 | ||
1304 | pci_set_drvdata(pci, card); | 1296 | pci_set_drvdata(pci, card); |
1305 | dev++; | ||
1306 | return 0; | 1297 | return 0; |
1307 | 1298 | ||
1308 | __error: | 1299 | __error: |
diff --git a/sound/pci/au88x0/au8810.h b/sound/pci/au88x0/au8810.h index 3837d2ba5e67..5d69c31fe3f4 100644 --- a/sound/pci/au88x0/au8810.h +++ b/sound/pci/au88x0/au8810.h | |||
@@ -178,11 +178,6 @@ | |||
178 | #define EN_SPDIF 0x000c0000 | 178 | #define EN_SPDIF 0x000c0000 |
179 | 179 | ||
180 | #define VORTEX_CODEC_CHN 0x29080 | 180 | #define VORTEX_CODEC_CHN 0x29080 |
181 | #define VORTEX_CODEC_WRITE 0x00800000 | ||
182 | #define VORTEX_CODEC_ADDSHIFT 16 | ||
183 | #define VORTEX_CODEC_ADDMASK 0x7f0000 /* 0x000f0000 */ | ||
184 | #define VORTEX_CODEC_DATSHIFT 0 | ||
185 | #define VORTEX_CODEC_DATMASK 0xffff | ||
186 | #define VORTEX_CODEC_IO 0x29188 | 181 | #define VORTEX_CODEC_IO 0x29188 |
187 | 182 | ||
188 | /* SPDIF */ | 183 | /* SPDIF */ |
diff --git a/sound/pci/au88x0/au8820.h b/sound/pci/au88x0/au8820.h index be8022e78714..abbe85e4f7a9 100644 --- a/sound/pci/au88x0/au8820.h +++ b/sound/pci/au88x0/au8820.h | |||
@@ -162,11 +162,6 @@ | |||
162 | #define EN_SPORT 0x00030000 | 162 | #define EN_SPORT 0x00030000 |
163 | #define EN_SPDIF 0x000c0000 | 163 | #define EN_SPDIF 0x000c0000 |
164 | #define VORTEX_CODEC_CHN 0x11880 | 164 | #define VORTEX_CODEC_CHN 0x11880 |
165 | #define VORTEX_CODEC_WRITE 0x00800000 | ||
166 | #define VORTEX_CODEC_ADDSHIFT 16 | ||
167 | #define VORTEX_CODEC_ADDMASK 0x7f0000 /* 0x000f0000 */ | ||
168 | #define VORTEX_CODEC_DATSHIFT 0 | ||
169 | #define VORTEX_CODEC_DATMASK 0xffff | ||
170 | #define VORTEX_CODEC_IO 0x11988 | 165 | #define VORTEX_CODEC_IO 0x11988 |
171 | 166 | ||
172 | #define VORTEX_SPDIF_FLAGS 0x1005c /* FIXME */ | 167 | #define VORTEX_SPDIF_FLAGS 0x1005c /* FIXME */ |
diff --git a/sound/pci/au88x0/au8830.h b/sound/pci/au88x0/au8830.h index aa77826b5e59..04ece1b1c218 100644 --- a/sound/pci/au88x0/au8830.h +++ b/sound/pci/au88x0/au8830.h | |||
@@ -194,11 +194,6 @@ | |||
194 | 194 | ||
195 | #define VORTEX_CODEC_CTRL 0x29184 | 195 | #define VORTEX_CODEC_CTRL 0x29184 |
196 | #define VORTEX_CODEC_IO 0x29188 | 196 | #define VORTEX_CODEC_IO 0x29188 |
197 | #define VORTEX_CODEC_WRITE 0x00800000 | ||
198 | #define VORTEX_CODEC_ADDSHIFT 16 | ||
199 | #define VORTEX_CODEC_ADDMASK 0x7f0000 /* 0x000f0000 */ | ||
200 | #define VORTEX_CODEC_DATSHIFT 0 | ||
201 | #define VORTEX_CODEC_DATMASK 0xffff | ||
202 | 197 | ||
203 | #define VORTEX_CODEC_SPORTCTRL 0x2918c | 198 | #define VORTEX_CODEC_SPORTCTRL 0x2918c |
204 | 199 | ||
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index 04b695d6fd48..6af3b13f2fd1 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -303,7 +303,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
303 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_VORTEX_SYNTH, | 303 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_VORTEX_SYNTH, |
304 | sizeof(snd_vortex_synth_arg_t), &wave) < 0 | 304 | sizeof(snd_vortex_synth_arg_t), &wave) < 0 |
305 | || wave == NULL) { | 305 | || wave == NULL) { |
306 | snd_printk("Can't initialize Aureal wavetable synth\n"); | 306 | snd_printk(KERN_ERR "Can't initialize Aureal wavetable synth\n"); |
307 | } else { | 307 | } else { |
308 | snd_vortex_synth_arg_t *arg; | 308 | snd_vortex_synth_arg_t *arg; |
309 | 309 | ||
diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h index ee1ede1979f6..b1197cfab3fb 100644 --- a/sound/pci/au88x0/au88x0.h +++ b/sound/pci/au88x0/au88x0.h | |||
@@ -79,6 +79,14 @@ | |||
79 | #define VORTEX_RESOURCE_A3D 0x00000004 | 79 | #define VORTEX_RESOURCE_A3D 0x00000004 |
80 | #define VORTEX_RESOURCE_LAST 0x00000005 | 80 | #define VORTEX_RESOURCE_LAST 0x00000005 |
81 | 81 | ||
82 | /* codec io: VORTEX_CODEC_IO bits */ | ||
83 | #define VORTEX_CODEC_ID_SHIFT 24 | ||
84 | #define VORTEX_CODEC_WRITE 0x00800000 | ||
85 | #define VORTEX_CODEC_ADDSHIFT 16 | ||
86 | #define VORTEX_CODEC_ADDMASK 0x7f0000 | ||
87 | #define VORTEX_CODEC_DATSHIFT 0 | ||
88 | #define VORTEX_CODEC_DATMASK 0xffff | ||
89 | |||
82 | /* Check for SDAC bit in "Extended audio ID" AC97 register */ | 90 | /* Check for SDAC bit in "Extended audio ID" AC97 register */ |
83 | //#define VORTEX_IS_QUAD(x) (((x)->codec == NULL) ? 0 : ((x)->codec->ext_id&0x80)) | 91 | //#define VORTEX_IS_QUAD(x) (((x)->codec == NULL) ? 0 : ((x)->codec->ext_id&0x80)) |
84 | #define VORTEX_IS_QUAD(x) ((x)->isquad) | 92 | #define VORTEX_IS_QUAD(x) ((x)->isquad) |
diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c index 9ea2ba7bc3c8..d5755db5141f 100644 --- a/sound/pci/au88x0/au88x0_a3d.c +++ b/sound/pci/au88x0/au88x0_a3d.c | |||
@@ -488,7 +488,7 @@ static void a3dsrc_ZeroStateA3D(a3dsrc_t * a) | |||
488 | int i, var, var2; | 488 | int i, var, var2; |
489 | 489 | ||
490 | if ((a->vortex) == NULL) { | 490 | if ((a->vortex) == NULL) { |
491 | printk("vortex: ZeroStateA3D: ERROR: a->vortex is NULL\n"); | 491 | printk(KERN_ERR "vortex: ZeroStateA3D: ERROR: a->vortex is NULL\n"); |
492 | return; | 492 | return; |
493 | } | 493 | } |
494 | 494 | ||
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index f0eda4bbbb39..5905188d06b5 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c | |||
@@ -2033,7 +2033,7 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) | |||
2033 | } | 2033 | } |
2034 | } | 2034 | } |
2035 | } | 2035 | } |
2036 | printk("vortex: FATAL: ResManager: resource type %d exhausted.\n", restype); | 2036 | printk(KERN_ERR "vortex: FATAL: ResManager: resource type %d exhausted.\n", restype); |
2037 | return -ENOMEM; | 2037 | return -ENOMEM; |
2038 | } | 2038 | } |
2039 | 2039 | ||
@@ -2165,7 +2165,7 @@ vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch, int dir, int type) | |||
2165 | memset(stream->resources, 0, | 2165 | memset(stream->resources, 0, |
2166 | sizeof(unsigned char) * | 2166 | sizeof(unsigned char) * |
2167 | VORTEX_RESOURCE_LAST); | 2167 | VORTEX_RESOURCE_LAST); |
2168 | printk("vortex: out of A3D sources. Sorry\n"); | 2168 | printk(KERN_ERR "vortex: out of A3D sources. Sorry\n"); |
2169 | return -EBUSY; | 2169 | return -EBUSY; |
2170 | } | 2170 | } |
2171 | /* (De)Initialize A3D hardware source. */ | 2171 | /* (De)Initialize A3D hardware source. */ |
@@ -2532,7 +2532,8 @@ vortex_codec_write(ac97_t * codec, unsigned short addr, unsigned short data) | |||
2532 | hwwrite(card->mmio, VORTEX_CODEC_IO, | 2532 | hwwrite(card->mmio, VORTEX_CODEC_IO, |
2533 | ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK) | | 2533 | ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK) | |
2534 | ((data << VORTEX_CODEC_DATSHIFT) & VORTEX_CODEC_DATMASK) | | 2534 | ((data << VORTEX_CODEC_DATSHIFT) & VORTEX_CODEC_DATMASK) | |
2535 | VORTEX_CODEC_WRITE); | 2535 | VORTEX_CODEC_WRITE | |
2536 | (codec->num << VORTEX_CODEC_ID_SHIFT) ); | ||
2536 | 2537 | ||
2537 | /* Flush Caches. */ | 2538 | /* Flush Caches. */ |
2538 | hwread(card->mmio, VORTEX_CODEC_IO); | 2539 | hwread(card->mmio, VORTEX_CODEC_IO); |
@@ -2554,7 +2555,8 @@ static unsigned short vortex_codec_read(ac97_t * codec, unsigned short addr) | |||
2554 | } | 2555 | } |
2555 | } | 2556 | } |
2556 | /* set up read address */ | 2557 | /* set up read address */ |
2557 | read_addr = ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK); | 2558 | read_addr = ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK) | |
2559 | (codec->num << VORTEX_CODEC_ID_SHIFT) ; | ||
2558 | hwwrite(card->mmio, VORTEX_CODEC_IO, read_addr); | 2560 | hwwrite(card->mmio, VORTEX_CODEC_IO, read_addr); |
2559 | 2561 | ||
2560 | /* wait for address */ | 2562 | /* wait for address */ |
diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c index 53b47a42c7d8..9d933cc0ea0b 100644 --- a/sound/pci/au88x0/au88x0_eq.c +++ b/sound/pci/au88x0/au88x0_eq.c | |||
@@ -854,7 +854,7 @@ snd_vortex_peaks_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | |||
854 | 854 | ||
855 | vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count); | 855 | vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count); |
856 | if (count != 20) { | 856 | if (count != 20) { |
857 | printk("vortex: peak count error 20 != %d \n", count); | 857 | printk(KERN_ERR "vortex: peak count error 20 != %d \n", count); |
858 | return -1; | 858 | return -1; |
859 | } | 859 | } |
860 | for (i = 0; i < 20; i++) | 860 | for (i = 0; i < 20; i++) |
diff --git a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c index 400417d34609..65f375bad43a 100644 --- a/sound/pci/au88x0/au88x0_synth.c +++ b/sound/pci/au88x0/au88x0_synth.c | |||
@@ -90,7 +90,7 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch) | |||
90 | hwwrite(vortex->mmio, WT_PARM(wt, 2), 0); | 90 | hwwrite(vortex->mmio, WT_PARM(wt, 2), 0); |
91 | 91 | ||
92 | temp = hwread(vortex->mmio, WT_PARM(wt, 3)); | 92 | temp = hwread(vortex->mmio, WT_PARM(wt, 3)); |
93 | printk("vortex: WT PARM3: %x\n", temp); | 93 | printk(KERN_DEBUG "vortex: WT PARM3: %x\n", temp); |
94 | //hwwrite(vortex->mmio, WT_PARM(wt, 3), temp); | 94 | //hwwrite(vortex->mmio, WT_PARM(wt, 3), temp); |
95 | 95 | ||
96 | hwwrite(vortex->mmio, WT_DELAY(wt, 0), 0); | 96 | hwwrite(vortex->mmio, WT_DELAY(wt, 0), 0); |
@@ -98,7 +98,7 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch) | |||
98 | hwwrite(vortex->mmio, WT_DELAY(wt, 2), 0); | 98 | hwwrite(vortex->mmio, WT_DELAY(wt, 2), 0); |
99 | hwwrite(vortex->mmio, WT_DELAY(wt, 3), 0); | 99 | hwwrite(vortex->mmio, WT_DELAY(wt, 3), 0); |
100 | 100 | ||
101 | printk("vortex: WT GMODE: %x\n", hwread(vortex->mmio, WT_GMODE(wt))); | 101 | printk(KERN_DEBUG "vortex: WT GMODE: %x\n", hwread(vortex->mmio, WT_GMODE(wt))); |
102 | 102 | ||
103 | hwwrite(vortex->mmio, WT_PARM(wt, 2), 0xffffffff); | 103 | hwwrite(vortex->mmio, WT_PARM(wt, 2), 0xffffffff); |
104 | hwwrite(vortex->mmio, WT_PARM(wt, 3), 0xcff1c810); | 104 | hwwrite(vortex->mmio, WT_PARM(wt, 3), 0xcff1c810); |
@@ -106,7 +106,7 @@ static int vortex_wt_allocroute(vortex_t * vortex, int wt, int nr_ch) | |||
106 | voice->parm0 = voice->parm1 = 0xcfb23e2f; | 106 | voice->parm0 = voice->parm1 = 0xcfb23e2f; |
107 | hwwrite(vortex->mmio, WT_PARM(wt, 0), voice->parm0); | 107 | hwwrite(vortex->mmio, WT_PARM(wt, 0), voice->parm0); |
108 | hwwrite(vortex->mmio, WT_PARM(wt, 1), voice->parm1); | 108 | hwwrite(vortex->mmio, WT_PARM(wt, 1), voice->parm1); |
109 | printk("vortex: WT GMODE 2 : %x\n", hwread(vortex->mmio, WT_GMODE(wt))); | 109 | printk(KERN_DEBUG "vortex: WT GMODE 2 : %x\n", hwread(vortex->mmio, WT_GMODE(wt))); |
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
@@ -203,7 +203,7 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt, | |||
203 | } | 203 | } |
204 | } else { | 204 | } else { |
205 | if (wt >= NR_WT) { | 205 | if (wt >= NR_WT) { |
206 | printk("vortex: WT SetReg: voice out of range\n"); | 206 | printk(KERN_ERR "vortex: WT SetReg: voice out of range\n"); |
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | } | 209 | } |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index d5261bdec583..da99b1be2e8f 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). | 2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). |
3 | * Copyright (C) 2002 by Andreas Mohr <hw7oshyuv3001@sneakemail.com> | 3 | * Copyright (C) 2002, 2005 by Andreas Mohr <andi AT lisas.de> |
4 | * | 4 | * |
5 | * Framework borrowed from Bart Hartgers's als4000.c. | 5 | * Framework borrowed from Bart Hartgers's als4000.c. |
6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), | 6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), |
@@ -46,7 +46,7 @@ | |||
46 | * - MPU401 (+ legacy address support) FIXME: how to enable legacy addr?? | 46 | * - MPU401 (+ legacy address support) FIXME: how to enable legacy addr?? |
47 | * - game port (legacy address support) | 47 | * - game port (legacy address support) |
48 | * - built-in General DirectX timer having a 20 bits counter | 48 | * - built-in General DirectX timer having a 20 bits counter |
49 | * with 1us resolution (FIXME: where is it?) | 49 | * with 1us resolution (see below!) |
50 | * - I2S serial port for external DAC | 50 | * - I2S serial port for external DAC |
51 | * - supports 33MHz PCI spec 2.1, PCI power management 1.0, compliant with ACPI | 51 | * - supports 33MHz PCI spec 2.1, PCI power management 1.0, compliant with ACPI |
52 | * - supports hardware volume control | 52 | * - supports hardware volume control |
@@ -55,13 +55,23 @@ | |||
55 | * required for Microsoft's logo compliance (FIXME: where?) | 55 | * required for Microsoft's logo compliance (FIXME: where?) |
56 | * - PCI168 AP(W) card: power amplifier with 4 Watts/channel at 4 Ohms | 56 | * - PCI168 AP(W) card: power amplifier with 4 Watts/channel at 4 Ohms |
57 | * | 57 | * |
58 | * Note that this driver now is actually *better* than the Windows driver, | ||
59 | * since it additionally supports the card's 1MHz DirectX timer - just try | ||
60 | * the following snd-seq module parameters etc.: | ||
61 | * - options snd-seq seq_default_timer_class=2 seq_default_timer_sclass=0 | ||
62 | * seq_default_timer_card=0 seq_client_load=1 seq_default_timer_device=0 | ||
63 | * seq_default_timer_subdevice=0 seq_default_timer_resolution=1000000 | ||
64 | * - "timidity -iAv -B2,8 -Os -EFreverb=0" | ||
65 | * - "pmidi -p 128:0 jazz.mid" | ||
66 | * | ||
58 | * Certain PCI versions of this card are susceptible to DMA traffic underruns | 67 | * Certain PCI versions of this card are susceptible to DMA traffic underruns |
59 | * in some systems (resulting in sound crackling/clicking/popping), | 68 | * in some systems (resulting in sound crackling/clicking/popping), |
60 | * probably because they don't have a DMA FIFO buffer or so. | 69 | * probably because they don't have a DMA FIFO buffer or so. |
61 | * Overview (PCI ID/PCI subID/PCI rev.): | 70 | * Overview (PCI ID/PCI subID/PCI rev.): |
62 | * - no DMA crackling on SiS735: 0x50DC/0x1801/16 | 71 | * - no DMA crackling on SiS735: 0x50DC/0x1801/16 |
63 | * - unknown performance: 0x50DC/0x1801/10 | 72 | * - unknown performance: 0x50DC/0x1801/10 |
64 | * | 73 | * (well, it's not bad on an Athlon 1800 with now very optimized IRQ handler) |
74 | * | ||
65 | * Crackling happens with VIA chipsets or, in my case, an SiS735, which is | 75 | * Crackling happens with VIA chipsets or, in my case, an SiS735, which is |
66 | * supposed to be very fast and supposed to get rid of crackling much | 76 | * supposed to be very fast and supposed to get rid of crackling much |
67 | * better than a VIA, yet ironically I still get crackling, like many other | 77 | * better than a VIA, yet ironically I still get crackling, like many other |
@@ -76,18 +86,13 @@ | |||
76 | * - Disable ACPI/power management/"Auto Detect RAM/PCI Clk" in BIOS | 86 | * - Disable ACPI/power management/"Auto Detect RAM/PCI Clk" in BIOS |
77 | * | 87 | * |
78 | * BUGS | 88 | * BUGS |
79 | * - when Ctrl-C'ing mpg321, the playback loops a bit | 89 | * - full-duplex might *still* be problematic, not fully tested recently |
80 | * (premature DMA playback reset?) | ||
81 | * - full-duplex sometimes breaks (IRQ management issues?). | ||
82 | * Once even a spontaneous REBOOT happened!!! | ||
83 | * | 90 | * |
84 | * TODO | 91 | * TODO |
85 | * - test MPU401 MIDI playback etc. | 92 | * - test MPU401 MIDI playback etc. |
86 | * - power management (CONFIG_PM). See e.g. intel8x0 or cs4281. | 93 | * - power management. See e.g. intel8x0 or cs4281. |
87 | * This would be nice since the chip runs a bit hot, and it's *required* | 94 | * This would be nice since the chip runs a bit hot, and it's *required* |
88 | * anyway for proper ACPI power management. In other words: rest | 95 | * anyway for proper ACPI power management. |
89 | * assured that I *will* implement this very soon; as soon as Linux 2.5.x | ||
90 | * has power management that's bugfree enough to work properly on my desktop. | ||
91 | * - figure out what all unknown port bits are responsible for | 96 | * - figure out what all unknown port bits are responsible for |
92 | */ | 97 | */ |
93 | 98 | ||
@@ -108,7 +113,7 @@ | |||
108 | #include <sound/initval.h> | 113 | #include <sound/initval.h> |
109 | #include "azt3328.h" | 114 | #include "azt3328.h" |
110 | 115 | ||
111 | MODULE_AUTHOR("Andreas Mohr <hw7oshyuv3001@sneakemail.com>"); | 116 | MODULE_AUTHOR("Andreas Mohr <andi AT lisas.de>"); |
112 | MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)"); | 117 | MODULE_DESCRIPTION("Aztech AZF3328 (PCI168)"); |
113 | MODULE_LICENSE("GPL"); | 118 | MODULE_LICENSE("GPL"); |
114 | MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | 119 | MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); |
@@ -122,6 +127,7 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
122 | #define DEBUG_MIXER 0 | 127 | #define DEBUG_MIXER 0 |
123 | #define DEBUG_PLAY_REC 0 | 128 | #define DEBUG_PLAY_REC 0 |
124 | #define DEBUG_IO 0 | 129 | #define DEBUG_IO 0 |
130 | #define DEBUG_TIMER 0 | ||
125 | #define MIXER_TESTING 0 | 131 | #define MIXER_TESTING 0 |
126 | 132 | ||
127 | #if DEBUG_MISC | 133 | #if DEBUG_MISC |
@@ -132,8 +138,8 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
132 | 138 | ||
133 | #if DEBUG_CALLS | 139 | #if DEBUG_CALLS |
134 | #define snd_azf3328_dbgcalls(format, args...) printk(format, ##args) | 140 | #define snd_azf3328_dbgcalls(format, args...) printk(format, ##args) |
135 | #define snd_azf3328_dbgcallenter() printk(KERN_ERR "entering %s\n", __FUNCTION__) | 141 | #define snd_azf3328_dbgcallenter() printk(KERN_ERR "--> %s\n", __FUNCTION__) |
136 | #define snd_azf3328_dbgcallleave() printk(KERN_ERR "leaving %s\n", __FUNCTION__) | 142 | #define snd_azf3328_dbgcallleave() printk(KERN_ERR "<-- %s\n", __FUNCTION__) |
137 | #else | 143 | #else |
138 | #define snd_azf3328_dbgcalls(format, args...) | 144 | #define snd_azf3328_dbgcalls(format, args...) |
139 | #define snd_azf3328_dbgcallenter() | 145 | #define snd_azf3328_dbgcallenter() |
@@ -152,13 +158,12 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
152 | #define snd_azf3328_dbgplay(format, args...) | 158 | #define snd_azf3328_dbgplay(format, args...) |
153 | #endif | 159 | #endif |
154 | 160 | ||
155 | #if DEBUG_IO | 161 | #if DEBUG_MISC |
156 | #define snd_azf3328_dbgio(chip, where) \ | 162 | #define snd_azf3328_dbgtimer(format, args...) printk(KERN_ERR format, ##args) |
157 | printk(KERN_ERR "%s: IDX_IO_PLAY_FLAGS %04x, IDX_IO_PLAY_IRQMASK %04x, IDX_IO_IRQSTATUS %04x\n", where, inw(chip->codec_port+IDX_IO_PLAY_FLAGS), inw(chip->codec_port+IDX_IO_PLAY_IRQMASK), inw(chip->codec_port+IDX_IO_IRQSTATUS)) | ||
158 | #else | 163 | #else |
159 | #define snd_azf3328_dbgio(chip, where) | 164 | #define snd_azf3328_dbgtimer(format, args...) |
160 | #endif | 165 | #endif |
161 | 166 | ||
162 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 167 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
163 | module_param_array(index, int, NULL, 0444); | 168 | module_param_array(index, int, NULL, 0444); |
164 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); | 169 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); |
@@ -177,35 +182,40 @@ module_param_array(joystick, bool, NULL, 0444); | |||
177 | MODULE_PARM_DESC(joystick, "Enable joystick for AZF3328 soundcard."); | 182 | MODULE_PARM_DESC(joystick, "Enable joystick for AZF3328 soundcard."); |
178 | #endif | 183 | #endif |
179 | 184 | ||
180 | typedef struct _snd_azf3328 azf3328_t; | 185 | static int seqtimer_scaling = 128; |
181 | 186 | module_param(seqtimer_scaling, int, 0444); | |
182 | struct _snd_azf3328 { | 187 | MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (lockup danger!). Default 128."); |
183 | int irq; | ||
184 | 188 | ||
189 | typedef struct _snd_azf3328 { | ||
190 | /* often-used fields towards beginning, then grouped */ | ||
185 | unsigned long codec_port; | 191 | unsigned long codec_port; |
186 | unsigned long io2_port; | 192 | unsigned long io2_port; |
187 | unsigned long mpu_port; | 193 | unsigned long mpu_port; |
188 | unsigned long synth_port; | 194 | unsigned long synth_port; |
189 | unsigned long mixer_port; | 195 | unsigned long mixer_port; |
190 | 196 | ||
191 | #ifdef SUPPORT_JOYSTICK | 197 | spinlock_t reg_lock; |
192 | struct gameport *gameport; | ||
193 | #endif | ||
194 | |||
195 | struct pci_dev *pci; | ||
196 | snd_card_t *card; | ||
197 | 198 | ||
199 | snd_timer_t *timer; | ||
200 | |||
198 | snd_pcm_t *pcm; | 201 | snd_pcm_t *pcm; |
199 | snd_rawmidi_t *rmidi; | ||
200 | snd_pcm_substream_t *playback_substream; | 202 | snd_pcm_substream_t *playback_substream; |
201 | snd_pcm_substream_t *capture_substream; | 203 | snd_pcm_substream_t *capture_substream; |
202 | unsigned int is_playing; | 204 | unsigned int is_playing; |
203 | unsigned int is_recording; | 205 | unsigned int is_recording; |
204 | 206 | ||
205 | spinlock_t reg_lock; | 207 | snd_card_t *card; |
206 | }; | 208 | snd_rawmidi_t *rmidi; |
209 | |||
210 | #ifdef SUPPORT_JOYSTICK | ||
211 | struct gameport *gameport; | ||
212 | #endif | ||
207 | 213 | ||
208 | static struct pci_device_id snd_azf3328_ids[] = { | 214 | struct pci_dev *pci; |
215 | int irq; | ||
216 | } azf3328_t; | ||
217 | |||
218 | static const struct pci_device_id snd_azf3328_ids[] = { | ||
209 | { 0x122D, 0x50DC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* PCI168/3328 */ | 219 | { 0x122D, 0x50DC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* PCI168/3328 */ |
210 | { 0x122D, 0x80DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 3328 */ | 220 | { 0x122D, 0x80DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* 3328 */ |
211 | { 0, } | 221 | { 0, } |
@@ -213,57 +223,90 @@ static struct pci_device_id snd_azf3328_ids[] = { | |||
213 | 223 | ||
214 | MODULE_DEVICE_TABLE(pci, snd_azf3328_ids); | 224 | MODULE_DEVICE_TABLE(pci, snd_azf3328_ids); |
215 | 225 | ||
216 | static inline void snd_azf3328_io2_write(azf3328_t *chip, int reg, unsigned char value) | 226 | static inline void |
227 | snd_azf3328_codec_outb(const azf3328_t *chip, int reg, u8 value) | ||
228 | { | ||
229 | outb(value, chip->codec_port + reg); | ||
230 | } | ||
231 | |||
232 | static inline u8 | ||
233 | snd_azf3328_codec_inb(const azf3328_t *chip, int reg) | ||
234 | { | ||
235 | return inb(chip->codec_port + reg); | ||
236 | } | ||
237 | |||
238 | static inline void | ||
239 | snd_azf3328_codec_outw(const azf3328_t *chip, int reg, u16 value) | ||
240 | { | ||
241 | outw(value, chip->codec_port + reg); | ||
242 | } | ||
243 | |||
244 | static inline u16 | ||
245 | snd_azf3328_codec_inw(const azf3328_t *chip, int reg) | ||
246 | { | ||
247 | return inw(chip->codec_port + reg); | ||
248 | } | ||
249 | |||
250 | static inline void | ||
251 | snd_azf3328_codec_outl(const azf3328_t *chip, int reg, u32 value) | ||
252 | { | ||
253 | outl(value, chip->codec_port + reg); | ||
254 | } | ||
255 | |||
256 | static inline void | ||
257 | snd_azf3328_io2_outb(const azf3328_t *chip, int reg, u8 value) | ||
217 | { | 258 | { |
218 | outb(value, chip->io2_port + reg); | 259 | outb(value, chip->io2_port + reg); |
219 | } | 260 | } |
220 | 261 | ||
221 | static inline unsigned char snd_azf3328_io2_read(azf3328_t *chip, int reg) | 262 | static inline u8 |
263 | snd_azf3328_io2_inb(const azf3328_t *chip, int reg) | ||
222 | { | 264 | { |
223 | return inb(chip->io2_port + reg); | 265 | return inb(chip->io2_port + reg); |
224 | } | 266 | } |
225 | 267 | ||
226 | static void snd_azf3328_mixer_write(azf3328_t *chip, int reg, unsigned long value, int type) | 268 | static inline void |
269 | snd_azf3328_mixer_outw(const azf3328_t *chip, int reg, u16 value) | ||
227 | { | 270 | { |
228 | switch(type) { | 271 | outw(value, chip->mixer_port + reg); |
229 | case WORD_VALUE: | 272 | } |
230 | outw(value, chip->mixer_port + reg); | 273 | |
231 | break; | 274 | static inline u16 |
232 | case DWORD_VALUE: | 275 | snd_azf3328_mixer_inw(const azf3328_t *chip, int reg) |
233 | outl(value, chip->mixer_port + reg); | 276 | { |
234 | break; | 277 | return inw(chip->mixer_port + reg); |
235 | case BYTE_VALUE: | ||
236 | outb(value, chip->mixer_port + reg); | ||
237 | break; | ||
238 | } | ||
239 | } | 278 | } |
240 | 279 | ||
241 | static void snd_azf3328_mixer_set_mute(azf3328_t *chip, int reg, int do_mute) | 280 | static void |
281 | snd_azf3328_mixer_set_mute(const azf3328_t *chip, int reg, int do_mute) | ||
242 | { | 282 | { |
283 | unsigned long portbase = chip->mixer_port + reg + 1; | ||
243 | unsigned char oldval; | 284 | unsigned char oldval; |
244 | 285 | ||
245 | /* the mute bit is on the *second* (i.e. right) register of a | 286 | /* the mute bit is on the *second* (i.e. right) register of a |
246 | * left/right channel setting */ | 287 | * left/right channel setting */ |
247 | oldval = inb(chip->mixer_port + reg + 1); | 288 | oldval = inb(portbase); |
248 | if (do_mute) | 289 | if (do_mute) |
249 | oldval |= 0x80; | 290 | oldval |= 0x80; |
250 | else | 291 | else |
251 | oldval &= ~0x80; | 292 | oldval &= ~0x80; |
252 | outb(oldval, chip->mixer_port + reg + 1); | 293 | outb(oldval, portbase); |
253 | } | 294 | } |
254 | 295 | ||
255 | static void snd_azf3328_mixer_write_volume_gradually(azf3328_t *chip, int reg, unsigned char dst_vol_left, unsigned char dst_vol_right, int chan_sel, int delay) | 296 | static void |
297 | snd_azf3328_mixer_write_volume_gradually(const azf3328_t *chip, int reg, unsigned char dst_vol_left, unsigned char dst_vol_right, int chan_sel, int delay) | ||
256 | { | 298 | { |
299 | unsigned long portbase = chip->mixer_port + reg; | ||
257 | unsigned char curr_vol_left = 0, curr_vol_right = 0; | 300 | unsigned char curr_vol_left = 0, curr_vol_right = 0; |
258 | int left_done = 0, right_done = 0; | 301 | int left_done = 0, right_done = 0; |
259 | 302 | ||
260 | snd_azf3328_dbgcallenter(); | 303 | snd_azf3328_dbgcallenter(); |
261 | if (chan_sel & SET_CHAN_LEFT) | 304 | if (chan_sel & SET_CHAN_LEFT) |
262 | curr_vol_left = inb(chip->mixer_port + reg + 1); | 305 | curr_vol_left = inb(portbase + 1); |
263 | else | 306 | else |
264 | left_done = 1; | 307 | left_done = 1; |
265 | if (chan_sel & SET_CHAN_RIGHT) | 308 | if (chan_sel & SET_CHAN_RIGHT) |
266 | curr_vol_right = inb(chip->mixer_port + reg + 0); | 309 | curr_vol_right = inb(portbase + 0); |
267 | else | 310 | else |
268 | right_done = 1; | 311 | right_done = 1; |
269 | 312 | ||
@@ -284,7 +327,7 @@ static void snd_azf3328_mixer_write_volume_gradually(azf3328_t *chip, int reg, u | |||
284 | curr_vol_left++; | 327 | curr_vol_left++; |
285 | else | 328 | else |
286 | left_done = 1; | 329 | left_done = 1; |
287 | outb(curr_vol_left, chip->mixer_port + reg + 1); | 330 | outb(curr_vol_left, portbase + 1); |
288 | } | 331 | } |
289 | if (!right_done) | 332 | if (!right_done) |
290 | { | 333 | { |
@@ -298,7 +341,7 @@ static void snd_azf3328_mixer_write_volume_gradually(azf3328_t *chip, int reg, u | |||
298 | /* during volume change, the right channel is crackling | 341 | /* during volume change, the right channel is crackling |
299 | * somewhat more than the left channel, unfortunately. | 342 | * somewhat more than the left channel, unfortunately. |
300 | * This seems to be a hardware issue. */ | 343 | * This seems to be a hardware issue. */ |
301 | outb(curr_vol_right, chip->mixer_port + reg + 0); | 344 | outb(curr_vol_right, portbase + 0); |
302 | } | 345 | } |
303 | if (delay) | 346 | if (delay) |
304 | mdelay(delay); | 347 | mdelay(delay); |
@@ -320,7 +363,11 @@ typedef struct azf3328_mixer_reg { | |||
320 | } azf3328_mixer_reg_t; | 363 | } azf3328_mixer_reg_t; |
321 | 364 | ||
322 | #define COMPOSE_MIXER_REG(reg,lchan_shift,rchan_shift,mask,invert,stereo,enum_c) \ | 365 | #define COMPOSE_MIXER_REG(reg,lchan_shift,rchan_shift,mask,invert,stereo,enum_c) \ |
323 | ((reg) | (lchan_shift << 8) | (rchan_shift << 12) | (mask << 16) | (invert << 24) | (stereo << 25) | (enum_c << 26)) | 366 | ((reg) | (lchan_shift << 8) | (rchan_shift << 12) | \ |
367 | (mask << 16) | \ | ||
368 | (invert << 24) | \ | ||
369 | (stereo << 25) | \ | ||
370 | (enum_c << 26)) | ||
324 | 371 | ||
325 | static void snd_azf3328_mixer_reg_decode(azf3328_mixer_reg_t *r, unsigned long val) | 372 | static void snd_azf3328_mixer_reg_decode(azf3328_mixer_reg_t *r, unsigned long val) |
326 | { | 373 | { |
@@ -372,13 +419,15 @@ static void snd_azf3328_mixer_reg_decode(azf3328_mixer_reg_t *r, unsigned long v | |||
372 | .private_value = COMPOSE_MIXER_REG(reg, shift, 0, 0, 0, 0, enum_c), \ | 419 | .private_value = COMPOSE_MIXER_REG(reg, shift, 0, 0, 0, 0, enum_c), \ |
373 | } | 420 | } |
374 | 421 | ||
375 | static int snd_azf3328_info_mixer(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 422 | static int |
423 | snd_azf3328_info_mixer(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | ||
376 | { | 424 | { |
377 | azf3328_mixer_reg_t reg; | 425 | azf3328_mixer_reg_t reg; |
378 | 426 | ||
379 | snd_azf3328_dbgcallenter(); | 427 | snd_azf3328_dbgcallenter(); |
380 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 428 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
381 | uinfo->type = reg.mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | 429 | uinfo->type = reg.mask == 1 ? |
430 | SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
382 | uinfo->count = reg.stereo + 1; | 431 | uinfo->count = reg.stereo + 1; |
383 | uinfo->value.integer.min = 0; | 432 | uinfo->value.integer.min = 0; |
384 | uinfo->value.integer.max = reg.mask; | 433 | uinfo->value.integer.max = reg.mask; |
@@ -386,7 +435,8 @@ static int snd_azf3328_info_mixer(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
386 | return 0; | 435 | return 0; |
387 | } | 436 | } |
388 | 437 | ||
389 | static int snd_azf3328_get_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 438 | static int |
439 | snd_azf3328_get_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
390 | { | 440 | { |
391 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); | 441 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); |
392 | azf3328_mixer_reg_t reg; | 442 | azf3328_mixer_reg_t reg; |
@@ -395,7 +445,7 @@ static int snd_azf3328_get_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
395 | snd_azf3328_dbgcallenter(); | 445 | snd_azf3328_dbgcallenter(); |
396 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 446 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
397 | 447 | ||
398 | oreg = inw(chip->mixer_port + reg.reg); | 448 | oreg = snd_azf3328_mixer_inw(chip, reg.reg); |
399 | val = (oreg >> reg.lchan_shift) & reg.mask; | 449 | val = (oreg >> reg.lchan_shift) & reg.mask; |
400 | if (reg.invert) | 450 | if (reg.invert) |
401 | val = reg.mask - val; | 451 | val = reg.mask - val; |
@@ -406,12 +456,17 @@ static int snd_azf3328_get_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
406 | val = reg.mask - val; | 456 | val = reg.mask - val; |
407 | ucontrol->value.integer.value[1] = val; | 457 | ucontrol->value.integer.value[1] = val; |
408 | } | 458 | } |
409 | snd_azf3328_dbgmixer("get: %02x is %04x -> vol %02lx|%02lx (shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", reg.reg, oreg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo); | 459 | snd_azf3328_dbgmixer("get: %02x is %04x -> vol %02lx|%02lx " |
460 | "(shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", | ||
461 | reg.reg, oreg, | ||
462 | ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], | ||
463 | reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo); | ||
410 | snd_azf3328_dbgcallleave(); | 464 | snd_azf3328_dbgcallleave(); |
411 | return 0; | 465 | return 0; |
412 | } | 466 | } |
413 | 467 | ||
414 | static int snd_azf3328_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 468 | static int |
469 | snd_azf3328_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
415 | { | 470 | { |
416 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); | 471 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); |
417 | azf3328_mixer_reg_t reg; | 472 | azf3328_mixer_reg_t reg; |
@@ -419,7 +474,7 @@ static int snd_azf3328_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
419 | 474 | ||
420 | snd_azf3328_dbgcallenter(); | 475 | snd_azf3328_dbgcallenter(); |
421 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 476 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
422 | oreg = inw(chip->mixer_port + reg.reg); | 477 | oreg = snd_azf3328_mixer_inw(chip, reg.reg); |
423 | val = ucontrol->value.integer.value[0] & reg.mask; | 478 | val = ucontrol->value.integer.value[0] & reg.mask; |
424 | if (reg.invert) | 479 | if (reg.invert) |
425 | val = reg.mask - val; | 480 | val = reg.mask - val; |
@@ -433,24 +488,37 @@ static int snd_azf3328_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
433 | nreg |= (val << reg.rchan_shift); | 488 | nreg |= (val << reg.rchan_shift); |
434 | } | 489 | } |
435 | if (reg.mask >= 0x07) /* it's a volume control, so better take care */ | 490 | if (reg.mask >= 0x07) /* it's a volume control, so better take care */ |
436 | snd_azf3328_mixer_write_volume_gradually(chip, reg.reg, nreg >> 8, nreg & 0xff, SET_CHAN_LEFT|SET_CHAN_RIGHT, 0); /* just set both channels, doesn't matter */ | 491 | snd_azf3328_mixer_write_volume_gradually( |
492 | chip, reg.reg, nreg >> 8, nreg & 0xff, | ||
493 | /* just set both channels, doesn't matter */ | ||
494 | SET_CHAN_LEFT|SET_CHAN_RIGHT, | ||
495 | 0); | ||
437 | else | 496 | else |
438 | outw(nreg, chip->mixer_port + reg.reg); | 497 | snd_azf3328_mixer_outw(chip, reg.reg, nreg); |
439 | 498 | ||
440 | snd_azf3328_dbgmixer("put: %02x to %02lx|%02lx, oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n", reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], oreg, reg.lchan_shift, reg.rchan_shift, nreg, inw(chip->mixer_port + reg.reg)); | 499 | snd_azf3328_dbgmixer("put: %02x to %02lx|%02lx, " |
500 | "oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n", | ||
501 | reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], | ||
502 | oreg, reg.lchan_shift, reg.rchan_shift, | ||
503 | nreg, snd_azf3328_mixer_inw(chip, reg.reg)); | ||
441 | snd_azf3328_dbgcallleave(); | 504 | snd_azf3328_dbgcallleave(); |
442 | return (nreg != oreg); | 505 | return (nreg != oreg); |
443 | } | 506 | } |
444 | 507 | ||
445 | static int snd_azf3328_info_mixer_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 508 | static int |
509 | snd_azf3328_info_mixer_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | ||
446 | { | 510 | { |
447 | azf3328_mixer_reg_t reg; | 511 | static const char * const texts1[] = { |
448 | static char *texts1[2] = { "ModemOut1", "ModemOut2" }; | 512 | "ModemOut1", "ModemOut2" |
449 | static char *texts2[2] = { "MonoSelectSource1", "MonoSelectSource2" }; | 513 | }; |
450 | static char *texts3[8] = { | 514 | static const char * const texts2[] = { |
451 | "Mic", "CD", "Video", "Aux", "Line", | 515 | "MonoSelectSource1", "MonoSelectSource2" |
452 | "Mix", "Mix Mono", "Phone" | 516 | }; |
517 | static const char * const texts3[] = { | ||
518 | "Mic", "CD", "Video", "Aux", | ||
519 | "Line", "Mix", "Mix Mono", "Phone" | ||
453 | }; | 520 | }; |
521 | azf3328_mixer_reg_t reg; | ||
454 | 522 | ||
455 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 523 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
456 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 524 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
@@ -471,14 +539,15 @@ static int snd_azf3328_info_mixer_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_in | |||
471 | return 0; | 539 | return 0; |
472 | } | 540 | } |
473 | 541 | ||
474 | static int snd_azf3328_get_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 542 | static int |
543 | snd_azf3328_get_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
475 | { | 544 | { |
476 | azf3328_mixer_reg_t reg; | ||
477 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); | 545 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); |
546 | azf3328_mixer_reg_t reg; | ||
478 | unsigned short val; | 547 | unsigned short val; |
479 | 548 | ||
480 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 549 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
481 | val = inw(chip->mixer_port + reg.reg); | 550 | val = snd_azf3328_mixer_inw(chip, reg.reg); |
482 | if (reg.reg == IDX_MIXER_REC_SELECT) | 551 | if (reg.reg == IDX_MIXER_REC_SELECT) |
483 | { | 552 | { |
484 | ucontrol->value.enumerated.item[0] = (val >> 8) & (reg.enum_c - 1); | 553 | ucontrol->value.enumerated.item[0] = (val >> 8) & (reg.enum_c - 1); |
@@ -486,18 +555,22 @@ static int snd_azf3328_get_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
486 | } | 555 | } |
487 | else | 556 | else |
488 | ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); | 557 | ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); |
489 | snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1], reg.lchan_shift, reg.enum_c); | 558 | |
559 | snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", | ||
560 | reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1], | ||
561 | reg.lchan_shift, reg.enum_c); | ||
490 | return 0; | 562 | return 0; |
491 | } | 563 | } |
492 | 564 | ||
493 | static int snd_azf3328_put_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 565 | static int |
566 | snd_azf3328_put_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | ||
494 | { | 567 | { |
495 | azf3328_mixer_reg_t reg; | ||
496 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); | 568 | azf3328_t *chip = snd_kcontrol_chip(kcontrol); |
569 | azf3328_mixer_reg_t reg; | ||
497 | unsigned int oreg, nreg, val; | 570 | unsigned int oreg, nreg, val; |
498 | 571 | ||
499 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 572 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
500 | oreg = inw(chip->mixer_port + reg.reg); | 573 | oreg = snd_azf3328_mixer_inw(chip, reg.reg); |
501 | val = oreg; | 574 | val = oreg; |
502 | if (reg.reg == IDX_MIXER_REC_SELECT) | 575 | if (reg.reg == IDX_MIXER_REC_SELECT) |
503 | { | 576 | { |
@@ -514,19 +587,19 @@ static int snd_azf3328_put_mixer_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
514 | val &= ~((reg.enum_c - 1) << reg.lchan_shift); | 587 | val &= ~((reg.enum_c - 1) << reg.lchan_shift); |
515 | val |= (ucontrol->value.enumerated.item[0] << reg.lchan_shift); | 588 | val |= (ucontrol->value.enumerated.item[0] << reg.lchan_shift); |
516 | } | 589 | } |
517 | outw(val, chip->mixer_port + reg.reg); | 590 | snd_azf3328_mixer_outw(chip, reg.reg, val); |
518 | nreg = val; | 591 | nreg = val; |
519 | 592 | ||
520 | snd_azf3328_dbgmixer("put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg); | 593 | snd_azf3328_dbgmixer("put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg); |
521 | return (nreg != oreg); | 594 | return (nreg != oreg); |
522 | } | 595 | } |
523 | 596 | ||
524 | static snd_kcontrol_new_t snd_azf3328_mixer_controls[] __devinitdata = { | 597 | static const snd_kcontrol_new_t snd_azf3328_mixer_controls[] __devinitdata = { |
525 | AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1), | 598 | AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1), |
526 | AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1), | 599 | AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1), |
527 | AZF3328_MIXER_SWITCH("Wave Playback Switch", IDX_MIXER_WAVEOUT, 15, 1), | 600 | AZF3328_MIXER_SWITCH("Wave Playback Switch", IDX_MIXER_WAVEOUT, 15, 1), |
528 | AZF3328_MIXER_VOL_STEREO("Wave Playback Volume", IDX_MIXER_WAVEOUT, 0x1f, 1), | 601 | AZF3328_MIXER_VOL_STEREO("Wave Playback Volume", IDX_MIXER_WAVEOUT, 0x1f, 1), |
529 | AZF3328_MIXER_SWITCH("Wave Playback 3D Bypass", IDX_MIXER_ADVCTL2, 7, 1), | 602 | AZF3328_MIXER_SWITCH("Wave 3D Bypass Playback Switch", IDX_MIXER_ADVCTL2, 7, 1), |
530 | AZF3328_MIXER_SWITCH("FM Playback Switch", IDX_MIXER_FMSYNTH, 15, 1), | 603 | AZF3328_MIXER_SWITCH("FM Playback Switch", IDX_MIXER_FMSYNTH, 15, 1), |
531 | AZF3328_MIXER_VOL_STEREO("FM Playback Volume", IDX_MIXER_FMSYNTH, 0x1f, 1), | 604 | AZF3328_MIXER_VOL_STEREO("FM Playback Volume", IDX_MIXER_FMSYNTH, 0x1f, 1), |
532 | AZF3328_MIXER_SWITCH("CD Playback Switch", IDX_MIXER_CDAUDIO, 15, 1), | 605 | AZF3328_MIXER_SWITCH("CD Playback Switch", IDX_MIXER_CDAUDIO, 15, 1), |
@@ -539,8 +612,8 @@ static snd_kcontrol_new_t snd_azf3328_mixer_controls[] __devinitdata = { | |||
539 | AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0), | 612 | AZF3328_MIXER_SWITCH("Mic Boost (+20dB)", IDX_MIXER_MIC, 6, 0), |
540 | AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1), | 613 | AZF3328_MIXER_SWITCH("Line Playback Switch", IDX_MIXER_LINEIN, 15, 1), |
541 | AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1), | 614 | AZF3328_MIXER_VOL_STEREO("Line Playback Volume", IDX_MIXER_LINEIN, 0x1f, 1), |
542 | AZF3328_MIXER_SWITCH("PCBeep Playback Switch", IDX_MIXER_PCBEEP, 15, 1), | 615 | AZF3328_MIXER_SWITCH("PC Speaker Playback Switch", IDX_MIXER_PCBEEP, 15, 1), |
543 | AZF3328_MIXER_VOL_SPECIAL("PCBeep Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), | 616 | AZF3328_MIXER_VOL_SPECIAL("PC Speaker Playback Volume", IDX_MIXER_PCBEEP, 0x0f, 1, 1), |
544 | AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1), | 617 | AZF3328_MIXER_SWITCH("Video Playback Switch", IDX_MIXER_VIDEO, 15, 1), |
545 | AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1), | 618 | AZF3328_MIXER_VOL_STEREO("Video Playback Volume", IDX_MIXER_VIDEO, 0x1f, 1), |
546 | AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1), | 619 | AZF3328_MIXER_SWITCH("Aux Playback Switch", IDX_MIXER_AUX, 15, 1), |
@@ -553,8 +626,8 @@ static snd_kcontrol_new_t snd_azf3328_mixer_controls[] __devinitdata = { | |||
553 | AZF3328_MIXER_ENUM("Mono Select Source", IDX_MIXER_ADVCTL2, 2, 9), | 626 | AZF3328_MIXER_ENUM("Mono Select Source", IDX_MIXER_ADVCTL2, 2, 9), |
554 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Treble", IDX_MIXER_BASSTREBLE, 0x07, 1, 0), | 627 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Treble", IDX_MIXER_BASSTREBLE, 0x07, 1, 0), |
555 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Bass", IDX_MIXER_BASSTREBLE, 0x07, 9, 0), | 628 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Bass", IDX_MIXER_BASSTREBLE, 0x07, 9, 0), |
556 | AZF3328_MIXER_SWITCH("3D Control - Toggle", IDX_MIXER_ADVCTL2, 13, 0), | 629 | AZF3328_MIXER_SWITCH("3D Control - Switch", IDX_MIXER_ADVCTL2, 13, 0), |
557 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Volume", IDX_MIXER_ADVCTL1, 0x07, 1, 0), /* "3D Width" */ | 630 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Wide", IDX_MIXER_ADVCTL1, 0x07, 1, 0), /* "3D Width" */ |
558 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Space", IDX_MIXER_ADVCTL1, 0x03, 8, 0), /* "Hifi 3D" */ | 631 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Space", IDX_MIXER_ADVCTL1, 0x03, 8, 0), /* "Hifi 3D" */ |
559 | #if MIXER_TESTING | 632 | #if MIXER_TESTING |
560 | AZF3328_MIXER_SWITCH("0", IDX_MIXER_ADVCTL2, 0, 0), | 633 | AZF3328_MIXER_SWITCH("0", IDX_MIXER_ADVCTL2, 0, 0), |
@@ -576,9 +649,7 @@ static snd_kcontrol_new_t snd_azf3328_mixer_controls[] __devinitdata = { | |||
576 | #endif | 649 | #endif |
577 | }; | 650 | }; |
578 | 651 | ||
579 | #define AZF3328_INIT_VALUES (sizeof(snd_azf3328_init_values)/sizeof(unsigned int)/2) | 652 | static const u16 __devinitdata snd_azf3328_init_values[][2] = { |
580 | |||
581 | static unsigned int snd_azf3328_init_values[][2] = { | ||
582 | { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f }, | 653 | { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f }, |
583 | { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f }, | 654 | { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f }, |
584 | { IDX_MIXER_BASSTREBLE, 0x0000 }, | 655 | { IDX_MIXER_BASSTREBLE, 0x0000 }, |
@@ -594,10 +665,11 @@ static unsigned int snd_azf3328_init_values[][2] = { | |||
594 | { IDX_MIXER_REC_VOLUME, MIXER_MUTE_MASK|0x0707 }, | 665 | { IDX_MIXER_REC_VOLUME, MIXER_MUTE_MASK|0x0707 }, |
595 | }; | 666 | }; |
596 | 667 | ||
597 | static int __devinit snd_azf3328_mixer_new(azf3328_t *chip) | 668 | static int __devinit |
669 | snd_azf3328_mixer_new(azf3328_t *chip) | ||
598 | { | 670 | { |
599 | snd_card_t *card; | 671 | snd_card_t *card; |
600 | snd_kcontrol_new_t *sw; | 672 | const snd_kcontrol_new_t *sw; |
601 | unsigned int idx; | 673 | unsigned int idx; |
602 | int err; | 674 | int err; |
603 | 675 | ||
@@ -607,11 +679,13 @@ static int __devinit snd_azf3328_mixer_new(azf3328_t *chip) | |||
607 | card = chip->card; | 679 | card = chip->card; |
608 | 680 | ||
609 | /* mixer reset */ | 681 | /* mixer reset */ |
610 | snd_azf3328_mixer_write(chip, IDX_MIXER_RESET, 0x0, WORD_VALUE); | 682 | snd_azf3328_mixer_outw(chip, IDX_MIXER_RESET, 0x0000); |
611 | 683 | ||
612 | /* mute and zero volume channels */ | 684 | /* mute and zero volume channels */ |
613 | for (idx = 0; idx < AZF3328_INIT_VALUES; idx++) { | 685 | for (idx = 0; idx < ARRAY_SIZE(snd_azf3328_init_values); idx++) { |
614 | snd_azf3328_mixer_write(chip, snd_azf3328_init_values[idx][0], snd_azf3328_init_values[idx][1], WORD_VALUE); | 686 | snd_azf3328_mixer_outw(chip, |
687 | snd_azf3328_init_values[idx][0], | ||
688 | snd_azf3328_init_values[idx][1]); | ||
615 | } | 689 | } |
616 | 690 | ||
617 | /* add mixer controls */ | 691 | /* add mixer controls */ |
@@ -627,7 +701,8 @@ static int __devinit snd_azf3328_mixer_new(azf3328_t *chip) | |||
627 | return 0; | 701 | return 0; |
628 | } | 702 | } |
629 | 703 | ||
630 | static int snd_azf3328_hw_params(snd_pcm_substream_t * substream, | 704 | static int |
705 | snd_azf3328_hw_params(snd_pcm_substream_t * substream, | ||
631 | snd_pcm_hw_params_t * hw_params) | 706 | snd_pcm_hw_params_t * hw_params) |
632 | { | 707 | { |
633 | int res; | 708 | int res; |
@@ -637,7 +712,8 @@ static int snd_azf3328_hw_params(snd_pcm_substream_t * substream, | |||
637 | return res; | 712 | return res; |
638 | } | 713 | } |
639 | 714 | ||
640 | static int snd_azf3328_hw_free(snd_pcm_substream_t * substream) | 715 | static int |
716 | snd_azf3328_hw_free(snd_pcm_substream_t * substream) | ||
641 | { | 717 | { |
642 | snd_azf3328_dbgcallenter(); | 718 | snd_azf3328_dbgcallenter(); |
643 | snd_pcm_lib_free_pages(substream); | 719 | snd_pcm_lib_free_pages(substream); |
@@ -645,43 +721,48 @@ static int snd_azf3328_hw_free(snd_pcm_substream_t * substream) | |||
645 | return 0; | 721 | return 0; |
646 | } | 722 | } |
647 | 723 | ||
648 | static void snd_azf3328_setfmt(azf3328_t *chip, | 724 | static void |
725 | snd_azf3328_setfmt(azf3328_t *chip, | ||
649 | unsigned int reg, | 726 | unsigned int reg, |
650 | unsigned int bitrate, | 727 | unsigned int bitrate, |
651 | unsigned int format_width, | 728 | unsigned int format_width, |
652 | unsigned int channels | 729 | unsigned int channels |
653 | ) | 730 | ) |
654 | { | 731 | { |
655 | unsigned int val = 0xff00; | 732 | u16 val = 0xff00; |
656 | unsigned long flags; | 733 | unsigned long flags; |
657 | 734 | ||
658 | snd_azf3328_dbgcallenter(); | 735 | snd_azf3328_dbgcallenter(); |
659 | switch (bitrate) { | 736 | switch (bitrate) { |
660 | case 5512: val |= 0x0d; break; /* the AZF3328 names it "5510" for some strange reason */ | 737 | case 4000: val |= SOUNDFORMAT_FREQ_SUSPECTED_4000; break; |
661 | case 6620: val |= 0x0b; break; | 738 | case 4800: val |= SOUNDFORMAT_FREQ_SUSPECTED_4800; break; |
662 | case 8000: val |= 0x00; break; | 739 | case 5512: val |= SOUNDFORMAT_FREQ_5510; break; /* the AZF3328 names it "5510" for some strange reason */ |
663 | case 9600: val |= 0x08; break; | 740 | case 6620: val |= SOUNDFORMAT_FREQ_6620; break; |
664 | case 11025: val |= 0x01; break; | 741 | case 8000: val |= SOUNDFORMAT_FREQ_8000; break; |
665 | case 16000: val |= 0x02; break; | 742 | case 9600: val |= SOUNDFORMAT_FREQ_9600; break; |
666 | case 22050: val |= 0x03; break; | 743 | case 11025: val |= SOUNDFORMAT_FREQ_11025; break; |
667 | case 32000: val |= 0x04; break; | 744 | case 13240: val |= SOUNDFORMAT_FREQ_SUSPECTED_13240; break; |
668 | case 44100: val |= 0x05; break; | 745 | case 16000: val |= SOUNDFORMAT_FREQ_16000; break; |
669 | case 48000: val |= 0x06; break; | 746 | case 22050: val |= SOUNDFORMAT_FREQ_22050; break; |
670 | case 64000: val |= 0x07; break; | 747 | case 32000: val |= SOUNDFORMAT_FREQ_32000; break; |
748 | case 44100: val |= SOUNDFORMAT_FREQ_44100; break; | ||
749 | case 48000: val |= SOUNDFORMAT_FREQ_48000; break; | ||
750 | case 66200: val |= SOUNDFORMAT_FREQ_SUSPECTED_66200; break; | ||
671 | default: | 751 | default: |
672 | snd_printk("unknown bitrate %d, assuming 44.1kHz!\n", bitrate); | 752 | snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); |
673 | val |= 0x05; /* 44100 */ | 753 | val |= SOUNDFORMAT_FREQ_44100; |
674 | break; | 754 | break; |
675 | } | 755 | } |
676 | /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) */ | 756 | /* val = 0xff07; 3m27.993s (65301Hz; -> 64000Hz???) hmm, 66120, 65967, 66123 */ |
677 | /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) */ | 757 | /* val = 0xff09; 17m15.098s (13123,478Hz; -> 12000Hz???) hmm, 13237.2Hz? */ |
678 | /* val = 0xff0a; 47m30.599s (4764,891Hz; -> 4800Hz???) */ | 758 | /* val = 0xff0a; 47m30.599s (4764,891Hz; -> 4800Hz???) yup, 4803Hz */ |
679 | /* val = 0xff0c; 57m0.510s (4010,263Hz; -> 4000Hz???) */ | 759 | /* val = 0xff0c; 57m0.510s (4010,263Hz; -> 4000Hz???) yup, 4003Hz */ |
680 | /* val = 0xff05; 5m11.556s (... -> 44100Hz) */ | 760 | /* val = 0xff05; 5m11.556s (... -> 44100Hz) */ |
681 | /* val = 0xff03; 10m21.529s (21872,463Hz; -> 22050Hz???) */ | 761 | /* val = 0xff03; 10m21.529s (21872,463Hz; -> 22050Hz???) */ |
682 | /* val = 0xff0f; 20m41.883s (10937,993Hz; -> 11025Hz???) */ | 762 | /* val = 0xff0f; 20m41.883s (10937,993Hz; -> 11025Hz???) */ |
683 | /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */ | 763 | /* val = 0xff0d; 41m23.135s (5523,600Hz; -> 5512Hz???) */ |
684 | /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */ | 764 | /* val = 0xff0e; 28m30.777s (8017Hz; -> 8000Hz???) */ |
765 | |||
685 | if (channels == 2) | 766 | if (channels == 2) |
686 | val |= SOUNDFORMAT_FLAG_2CHANNELS; | 767 | val |= SOUNDFORMAT_FLAG_2CHANNELS; |
687 | 768 | ||
@@ -691,7 +772,7 @@ static void snd_azf3328_setfmt(azf3328_t *chip, | |||
691 | spin_lock_irqsave(&chip->reg_lock, flags); | 772 | spin_lock_irqsave(&chip->reg_lock, flags); |
692 | 773 | ||
693 | /* set bitrate/format */ | 774 | /* set bitrate/format */ |
694 | outw(val, chip->codec_port+reg); | 775 | snd_azf3328_codec_outw(chip, reg, val); |
695 | 776 | ||
696 | /* changing the bitrate/format settings switches off the | 777 | /* changing the bitrate/format settings switches off the |
697 | * audio output with an annoying click in case of 8/16bit format change | 778 | * audio output with an annoying click in case of 8/16bit format change |
@@ -701,47 +782,67 @@ static void snd_azf3328_setfmt(azf3328_t *chip, | |||
701 | * FIXME: does this have some side effects for full-duplex | 782 | * FIXME: does this have some side effects for full-duplex |
702 | * or other dramatic side effects? */ | 783 | * or other dramatic side effects? */ |
703 | if (reg == IDX_IO_PLAY_SOUNDFORMAT) /* only do it for playback */ | 784 | if (reg == IDX_IO_PLAY_SOUNDFORMAT) /* only do it for playback */ |
704 | outw(inw(chip->codec_port + IDX_IO_PLAY_FLAGS)|DMA_PLAY_SOMETHING1|DMA_PLAY_SOMETHING2|SOMETHING_ALMOST_ALWAYS_SET|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port + IDX_IO_PLAY_FLAGS); | 785 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, |
786 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS) | | ||
787 | DMA_PLAY_SOMETHING1 | | ||
788 | DMA_PLAY_SOMETHING2 | | ||
789 | SOMETHING_ALMOST_ALWAYS_SET | | ||
790 | DMA_EPILOGUE_SOMETHING | | ||
791 | DMA_SOMETHING_ELSE | ||
792 | ); | ||
705 | 793 | ||
706 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 794 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
707 | snd_azf3328_dbgcallleave(); | 795 | snd_azf3328_dbgcallleave(); |
708 | } | 796 | } |
709 | 797 | ||
710 | static void snd_azf3328_setdmaa(azf3328_t *chip, | 798 | static void |
799 | snd_azf3328_setdmaa(azf3328_t *chip, | ||
711 | long unsigned int addr, | 800 | long unsigned int addr, |
712 | unsigned int count, | 801 | unsigned int count, |
713 | unsigned int size, | 802 | unsigned int size, |
714 | int do_recording) | 803 | int do_recording) |
715 | { | 804 | { |
716 | long unsigned int addr1; | 805 | unsigned long flags, portbase; |
717 | long unsigned int addr2; | 806 | unsigned int is_running; |
718 | unsigned int count1; | ||
719 | unsigned int count2; | ||
720 | unsigned long flags; | ||
721 | int reg_offs = do_recording ? 0x20 : 0x00; | ||
722 | 807 | ||
723 | snd_azf3328_dbgcallenter(); | 808 | snd_azf3328_dbgcallenter(); |
809 | if (do_recording) | ||
810 | { | ||
811 | /* access capture registers, i.e. skip playback reg section */ | ||
812 | portbase = chip->codec_port + 0x20; | ||
813 | is_running = chip->is_recording; | ||
814 | } | ||
815 | else | ||
816 | { | ||
817 | /* access the playback register section */ | ||
818 | portbase = chip->codec_port + 0x00; | ||
819 | is_running = chip->is_playing; | ||
820 | } | ||
821 | |||
724 | /* AZF3328 uses a two buffer pointer DMA playback approach */ | 822 | /* AZF3328 uses a two buffer pointer DMA playback approach */ |
725 | if (!chip->is_playing) | 823 | if (!is_running) |
726 | { | 824 | { |
727 | addr1 = addr; | 825 | unsigned long addr_area2; |
728 | addr2 = addr+(size/2); | 826 | unsigned long count_areas, count_tmp; /* width 32bit -- overflow!! */ |
729 | count1 = (size/2)-1; | 827 | count_areas = size/2; |
730 | count2 = (size/2)-1; | 828 | addr_area2 = addr+count_areas; |
731 | #if DEBUG_PLAY_REC | 829 | count_areas--; /* max. index */ |
732 | snd_azf3328_dbgplay("setting dma: buf1 %08lx[%d], buf2 %08lx[%d]\n", addr1, count1, addr2, count2); | 830 | snd_azf3328_dbgplay("set DMA: buf1 %08lx[%lu], buf2 %08lx[%lu]\n", addr, count_areas, addr_area2, count_areas); |
733 | #endif | 831 | |
832 | /* build combined I/O buffer length word */ | ||
833 | count_tmp = count_areas; | ||
834 | count_areas |= (count_tmp << 16); | ||
734 | spin_lock_irqsave(&chip->reg_lock, flags); | 835 | spin_lock_irqsave(&chip->reg_lock, flags); |
735 | outl(addr1, chip->codec_port+reg_offs+IDX_IO_PLAY_DMA_START_1); | 836 | outl(addr, portbase + IDX_IO_PLAY_DMA_START_1); |
736 | outl(addr2, chip->codec_port+reg_offs+IDX_IO_PLAY_DMA_START_2); | 837 | outl(addr_area2, portbase + IDX_IO_PLAY_DMA_START_2); |
737 | outw(count1, chip->codec_port+reg_offs+IDX_IO_PLAY_DMA_LEN_1); | 838 | outl(count_areas, portbase + IDX_IO_PLAY_DMA_LEN_1); |
738 | outw(count2, chip->codec_port+reg_offs+IDX_IO_PLAY_DMA_LEN_2); | ||
739 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 839 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
740 | } | 840 | } |
741 | snd_azf3328_dbgcallleave(); | 841 | snd_azf3328_dbgcallleave(); |
742 | } | 842 | } |
743 | 843 | ||
744 | static int snd_azf3328_playback_prepare(snd_pcm_substream_t *substream) | 844 | static int |
845 | snd_azf3328_playback_prepare(snd_pcm_substream_t *substream) | ||
745 | { | 846 | { |
746 | #if 0 | 847 | #if 0 |
747 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 848 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
@@ -752,14 +853,18 @@ static int snd_azf3328_playback_prepare(snd_pcm_substream_t *substream) | |||
752 | 853 | ||
753 | snd_azf3328_dbgcallenter(); | 854 | snd_azf3328_dbgcallenter(); |
754 | #if 0 | 855 | #if 0 |
755 | snd_azf3328_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, runtime->rate, snd_pcm_format_width(runtime->format), runtime->channels); | 856 | snd_azf3328_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, |
857 | runtime->rate, | ||
858 | snd_pcm_format_width(runtime->format), | ||
859 | runtime->channels); | ||
756 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, 0); | 860 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, 0); |
757 | #endif | 861 | #endif |
758 | snd_azf3328_dbgcallleave(); | 862 | snd_azf3328_dbgcallleave(); |
759 | return 0; | 863 | return 0; |
760 | } | 864 | } |
761 | 865 | ||
762 | static int snd_azf3328_capture_prepare(snd_pcm_substream_t * substream) | 866 | static int |
867 | snd_azf3328_capture_prepare(snd_pcm_substream_t * substream) | ||
763 | { | 868 | { |
764 | #if 0 | 869 | #if 0 |
765 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 870 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
@@ -770,14 +875,18 @@ static int snd_azf3328_capture_prepare(snd_pcm_substream_t * substream) | |||
770 | 875 | ||
771 | snd_azf3328_dbgcallenter(); | 876 | snd_azf3328_dbgcallenter(); |
772 | #if 0 | 877 | #if 0 |
773 | snd_azf3328_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, runtime->rate, snd_pcm_format_width(runtime->format), runtime->channels); | 878 | snd_azf3328_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, |
879 | runtime->rate, | ||
880 | snd_pcm_format_width(runtime->format), | ||
881 | runtime->channels); | ||
774 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, 1); | 882 | snd_azf3328_setdmaa(chip, runtime->dma_addr, count, size, 1); |
775 | #endif | 883 | #endif |
776 | snd_azf3328_dbgcallleave(); | 884 | snd_azf3328_dbgcallleave(); |
777 | return 0; | 885 | return 0; |
778 | } | 886 | } |
779 | 887 | ||
780 | static int snd_azf3328_playback_trigger(snd_pcm_substream_t * substream, int cmd) | 888 | static int |
889 | snd_azf3328_playback_trigger(snd_pcm_substream_t * substream, int cmd) | ||
781 | { | 890 | { |
782 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 891 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
783 | snd_pcm_runtime_t *runtime = substream->runtime; | 892 | snd_pcm_runtime_t *runtime = substream->runtime; |
@@ -785,79 +894,98 @@ static int snd_azf3328_playback_trigger(snd_pcm_substream_t * substream, int cmd | |||
785 | unsigned int status1; | 894 | unsigned int status1; |
786 | 895 | ||
787 | snd_azf3328_dbgcalls("snd_azf3328_playback_trigger cmd %d\n", cmd); | 896 | snd_azf3328_dbgcalls("snd_azf3328_playback_trigger cmd %d\n", cmd); |
897 | |||
788 | switch (cmd) { | 898 | switch (cmd) { |
789 | case SNDRV_PCM_TRIGGER_START: | 899 | case SNDRV_PCM_TRIGGER_START: |
790 | 900 | snd_azf3328_dbgplay("START PLAYBACK\n"); | |
791 | snd_azf3328_dbgio(chip, "trigger1"); | ||
792 | 901 | ||
793 | /* mute WaveOut */ | 902 | /* mute WaveOut */ |
794 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); | 903 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); |
795 | 904 | ||
796 | snd_azf3328_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, runtime->rate, snd_pcm_format_width(runtime->format), runtime->channels); | 905 | snd_azf3328_setfmt(chip, IDX_IO_PLAY_SOUNDFORMAT, |
906 | runtime->rate, | ||
907 | snd_pcm_format_width(runtime->format), | ||
908 | runtime->channels); | ||
797 | 909 | ||
798 | spin_lock(&chip->reg_lock); | 910 | spin_lock(&chip->reg_lock); |
799 | /* stop playback */ | 911 | /* stop playback */ |
800 | status1 = inw(chip->codec_port+IDX_IO_PLAY_FLAGS); | 912 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS); |
801 | status1 &= ~DMA_RESUME; | 913 | status1 &= ~DMA_RESUME; |
802 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 914 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
803 | 915 | ||
804 | /* FIXME: clear interrupts or what??? */ | 916 | /* FIXME: clear interrupts or what??? */ |
805 | outw(0xffff, chip->codec_port+IDX_IO_PLAY_IRQMASK); | 917 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_IRQTYPE, 0xffff); |
806 | spin_unlock(&chip->reg_lock); | 918 | spin_unlock(&chip->reg_lock); |
807 | 919 | ||
808 | snd_azf3328_setdmaa(chip, runtime->dma_addr, snd_pcm_lib_period_bytes(substream), snd_pcm_lib_buffer_bytes(substream), 0); | 920 | snd_azf3328_setdmaa(chip, runtime->dma_addr, |
921 | snd_pcm_lib_period_bytes(substream), | ||
922 | snd_pcm_lib_buffer_bytes(substream), | ||
923 | 0); | ||
809 | 924 | ||
810 | spin_lock(&chip->reg_lock); | 925 | spin_lock(&chip->reg_lock); |
811 | #ifdef WIN9X | 926 | #ifdef WIN9X |
812 | /* FIXME: enable playback/recording??? */ | 927 | /* FIXME: enable playback/recording??? */ |
813 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; | 928 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; |
814 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 929 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
815 | 930 | ||
816 | /* start playback again */ | 931 | /* start playback again */ |
817 | /* FIXME: what is this value (0x0010)??? */ | 932 | /* FIXME: what is this value (0x0010)??? */ |
818 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; | 933 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; |
819 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 934 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
820 | #else /* NT4 */ | 935 | #else /* NT4 */ |
821 | outw(0x00, chip->codec_port+IDX_IO_PLAY_FLAGS); | 936 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, |
822 | outw(DMA_PLAY_SOMETHING1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 937 | 0x0000); |
823 | outw(DMA_PLAY_SOMETHING1|DMA_PLAY_SOMETHING2, chip->codec_port+IDX_IO_PLAY_FLAGS); | 938 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, |
824 | outw(DMA_RESUME|SOMETHING_ALMOST_ALWAYS_SET|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port+IDX_IO_PLAY_FLAGS); | 939 | DMA_PLAY_SOMETHING1); |
940 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | ||
941 | DMA_PLAY_SOMETHING1 | | ||
942 | DMA_PLAY_SOMETHING2); | ||
943 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, | ||
944 | DMA_RESUME | | ||
945 | SOMETHING_ALMOST_ALWAYS_SET | | ||
946 | DMA_EPILOGUE_SOMETHING | | ||
947 | DMA_SOMETHING_ELSE); | ||
825 | #endif | 948 | #endif |
826 | spin_unlock(&chip->reg_lock); | 949 | spin_unlock(&chip->reg_lock); |
827 | 950 | ||
828 | /* now unmute WaveOut */ | 951 | /* now unmute WaveOut */ |
829 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); | 952 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); |
830 | 953 | ||
831 | snd_azf3328_dbgio(chip, "trigger2"); | ||
832 | chip->is_playing = 1; | 954 | chip->is_playing = 1; |
955 | snd_azf3328_dbgplay("STARTED PLAYBACK\n"); | ||
833 | break; | 956 | break; |
834 | case SNDRV_PCM_TRIGGER_STOP: | 957 | case SNDRV_PCM_TRIGGER_STOP: |
958 | snd_azf3328_dbgplay("STOP PLAYBACK\n"); | ||
959 | |||
835 | /* mute WaveOut */ | 960 | /* mute WaveOut */ |
836 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); | 961 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 1); |
837 | 962 | ||
838 | spin_lock(&chip->reg_lock); | 963 | spin_lock(&chip->reg_lock); |
839 | /* stop playback */ | 964 | /* stop playback */ |
840 | status1 = inw(chip->codec_port+IDX_IO_PLAY_FLAGS); | 965 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS); |
841 | 966 | ||
842 | status1 &= ~DMA_RESUME; | 967 | status1 &= ~DMA_RESUME; |
843 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 968 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
844 | 969 | ||
970 | /* hmm, is this really required? we're resetting the same bit | ||
971 | * immediately thereafter... */ | ||
845 | status1 |= DMA_PLAY_SOMETHING1; | 972 | status1 |= DMA_PLAY_SOMETHING1; |
846 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 973 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
847 | 974 | ||
848 | status1 &= ~DMA_PLAY_SOMETHING1; | 975 | status1 &= ~DMA_PLAY_SOMETHING1; |
849 | outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS); | 976 | snd_azf3328_codec_outw(chip, IDX_IO_PLAY_FLAGS, status1); |
850 | spin_unlock(&chip->reg_lock); | 977 | spin_unlock(&chip->reg_lock); |
851 | 978 | ||
852 | /* now unmute WaveOut */ | 979 | /* now unmute WaveOut */ |
853 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); | 980 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_WAVEOUT, 0); |
854 | chip->is_playing = 0; | 981 | chip->is_playing = 0; |
982 | snd_azf3328_dbgplay("STOPPED PLAYBACK\n"); | ||
855 | break; | 983 | break; |
856 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 984 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
857 | snd_printk("FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); | 985 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); |
858 | break; | 986 | break; |
859 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 987 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
860 | snd_printk("FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); | 988 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); |
861 | break; | 989 | break; |
862 | default: | 990 | default: |
863 | return -EINVAL; | 991 | return -EINVAL; |
@@ -869,7 +997,8 @@ static int snd_azf3328_playback_trigger(snd_pcm_substream_t * substream, int cmd | |||
869 | 997 | ||
870 | /* this is just analogous to playback; I'm not quite sure whether recording | 998 | /* this is just analogous to playback; I'm not quite sure whether recording |
871 | * should actually be triggered like that */ | 999 | * should actually be triggered like that */ |
872 | static int snd_azf3328_capture_trigger(snd_pcm_substream_t * substream, int cmd) | 1000 | static int |
1001 | snd_azf3328_capture_trigger(snd_pcm_substream_t * substream, int cmd) | ||
873 | { | 1002 | { |
874 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1003 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
875 | snd_pcm_runtime_t *runtime = substream->runtime; | 1004 | snd_pcm_runtime_t *runtime = substream->runtime; |
@@ -877,68 +1006,86 @@ static int snd_azf3328_capture_trigger(snd_pcm_substream_t * substream, int cmd) | |||
877 | unsigned int status1; | 1006 | unsigned int status1; |
878 | 1007 | ||
879 | snd_azf3328_dbgcalls("snd_azf3328_capture_trigger cmd %d\n", cmd); | 1008 | snd_azf3328_dbgcalls("snd_azf3328_capture_trigger cmd %d\n", cmd); |
1009 | |||
880 | switch (cmd) { | 1010 | switch (cmd) { |
881 | case SNDRV_PCM_TRIGGER_START: | 1011 | case SNDRV_PCM_TRIGGER_START: |
882 | 1012 | ||
883 | snd_azf3328_dbgio(chip, "trigger1"); | 1013 | snd_azf3328_dbgplay("START CAPTURE\n"); |
884 | 1014 | ||
885 | snd_azf3328_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, runtime->rate, snd_pcm_format_width(runtime->format), runtime->channels); | 1015 | snd_azf3328_setfmt(chip, IDX_IO_REC_SOUNDFORMAT, |
1016 | runtime->rate, | ||
1017 | snd_pcm_format_width(runtime->format), | ||
1018 | runtime->channels); | ||
886 | 1019 | ||
887 | spin_lock(&chip->reg_lock); | 1020 | spin_lock(&chip->reg_lock); |
888 | /* stop recording */ | 1021 | /* stop recording */ |
889 | status1 = inw(chip->codec_port+IDX_IO_REC_FLAGS); | 1022 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS); |
890 | status1 &= ~DMA_RESUME; | 1023 | status1 &= ~DMA_RESUME; |
891 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1024 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
892 | 1025 | ||
893 | /* FIXME: clear interrupts or what??? */ | 1026 | /* FIXME: clear interrupts or what??? */ |
894 | outw(0xffff, chip->codec_port+IDX_IO_REC_IRQMASK); | 1027 | snd_azf3328_codec_outw(chip, IDX_IO_REC_IRQTYPE, 0xffff); |
895 | spin_unlock(&chip->reg_lock); | 1028 | spin_unlock(&chip->reg_lock); |
896 | 1029 | ||
897 | snd_azf3328_setdmaa(chip, runtime->dma_addr, snd_pcm_lib_period_bytes(substream), snd_pcm_lib_buffer_bytes(substream), 1); | 1030 | snd_azf3328_setdmaa(chip, runtime->dma_addr, |
1031 | snd_pcm_lib_period_bytes(substream), | ||
1032 | snd_pcm_lib_buffer_bytes(substream), | ||
1033 | 1); | ||
898 | 1034 | ||
899 | spin_lock(&chip->reg_lock); | 1035 | spin_lock(&chip->reg_lock); |
900 | #ifdef WIN9X | 1036 | #ifdef WIN9X |
901 | /* FIXME: enable playback/recording??? */ | 1037 | /* FIXME: enable playback/recording??? */ |
902 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; | 1038 | status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2; |
903 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1039 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
904 | 1040 | ||
905 | /* start playback again */ | 1041 | /* start capture again */ |
906 | /* FIXME: what is this value (0x0010)??? */ | 1042 | /* FIXME: what is this value (0x0010)??? */ |
907 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; | 1043 | status1 |= DMA_RESUME | DMA_EPILOGUE_SOMETHING; |
908 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1044 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
909 | #else | 1045 | #else |
910 | outw(0x00, chip->codec_port+IDX_IO_REC_FLAGS); | 1046 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, |
911 | outw(DMA_PLAY_SOMETHING1, chip->codec_port+IDX_IO_REC_FLAGS); | 1047 | 0x0000); |
912 | outw(DMA_PLAY_SOMETHING1|DMA_PLAY_SOMETHING2, chip->codec_port+IDX_IO_REC_FLAGS); | 1048 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, |
913 | outw(DMA_RESUME|SOMETHING_ALMOST_ALWAYS_SET|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port+IDX_IO_REC_FLAGS); | 1049 | DMA_PLAY_SOMETHING1); |
1050 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1051 | DMA_PLAY_SOMETHING1 | | ||
1052 | DMA_PLAY_SOMETHING2); | ||
1053 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, | ||
1054 | DMA_RESUME | | ||
1055 | SOMETHING_ALMOST_ALWAYS_SET | | ||
1056 | DMA_EPILOGUE_SOMETHING | | ||
1057 | DMA_SOMETHING_ELSE); | ||
914 | #endif | 1058 | #endif |
915 | spin_unlock(&chip->reg_lock); | 1059 | spin_unlock(&chip->reg_lock); |
916 | 1060 | ||
917 | snd_azf3328_dbgio(chip, "trigger2"); | 1061 | chip->is_recording = 1; |
918 | chip->is_playing = 1; | 1062 | snd_azf3328_dbgplay("STARTED CAPTURE\n"); |
919 | break; | 1063 | break; |
920 | case SNDRV_PCM_TRIGGER_STOP: | 1064 | case SNDRV_PCM_TRIGGER_STOP: |
1065 | snd_azf3328_dbgplay("STOP CAPTURE\n"); | ||
1066 | |||
921 | spin_lock(&chip->reg_lock); | 1067 | spin_lock(&chip->reg_lock); |
922 | /* stop recording */ | 1068 | /* stop recording */ |
923 | status1 = inw(chip->codec_port+IDX_IO_REC_FLAGS); | 1069 | status1 = snd_azf3328_codec_inw(chip, IDX_IO_REC_FLAGS); |
924 | 1070 | ||
925 | status1 &= ~DMA_RESUME; | 1071 | status1 &= ~DMA_RESUME; |
926 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1072 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
927 | 1073 | ||
928 | status1 |= DMA_PLAY_SOMETHING1; | 1074 | status1 |= DMA_PLAY_SOMETHING1; |
929 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1075 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
930 | 1076 | ||
931 | status1 &= ~DMA_PLAY_SOMETHING1; | 1077 | status1 &= ~DMA_PLAY_SOMETHING1; |
932 | outw(status1, chip->codec_port+IDX_IO_REC_FLAGS); | 1078 | snd_azf3328_codec_outw(chip, IDX_IO_REC_FLAGS, status1); |
933 | spin_unlock(&chip->reg_lock); | 1079 | spin_unlock(&chip->reg_lock); |
934 | 1080 | ||
935 | chip->is_playing = 0; | 1081 | chip->is_recording = 0; |
1082 | snd_azf3328_dbgplay("STOPPED CAPTURE\n"); | ||
936 | break; | 1083 | break; |
937 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1084 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
938 | snd_printk("FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); | 1085 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); |
939 | break; | 1086 | break; |
940 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1087 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
941 | snd_printk("FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); | 1088 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); |
942 | break; | 1089 | break; |
943 | default: | 1090 | default: |
944 | return -EINVAL; | 1091 | return -EINVAL; |
@@ -948,11 +1095,11 @@ static int snd_azf3328_capture_trigger(snd_pcm_substream_t * substream, int cmd) | |||
948 | return result; | 1095 | return result; |
949 | } | 1096 | } |
950 | 1097 | ||
951 | static snd_pcm_uframes_t snd_azf3328_playback_pointer(snd_pcm_substream_t * substream) | 1098 | static snd_pcm_uframes_t |
1099 | snd_azf3328_playback_pointer(snd_pcm_substream_t * substream) | ||
952 | { | 1100 | { |
953 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1101 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
954 | unsigned long bufptr, playptr; | 1102 | unsigned long bufptr, result; |
955 | unsigned long result; | ||
956 | snd_pcm_uframes_t frmres; | 1103 | snd_pcm_uframes_t frmres; |
957 | 1104 | ||
958 | #ifdef QUERY_HARDWARE | 1105 | #ifdef QUERY_HARDWARE |
@@ -960,19 +1107,20 @@ static snd_pcm_uframes_t snd_azf3328_playback_pointer(snd_pcm_substream_t * subs | |||
960 | #else | 1107 | #else |
961 | bufptr = substream->runtime->dma_addr; | 1108 | bufptr = substream->runtime->dma_addr; |
962 | #endif | 1109 | #endif |
963 | playptr = inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS); | 1110 | result = inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS); |
964 | 1111 | ||
965 | result = playptr - bufptr; | 1112 | /* calculate offset */ |
966 | frmres = bytes_to_frames( substream->runtime, result ); | 1113 | result -= bufptr; |
967 | snd_azf3328_dbgplay("result %lx, playptr %lx (base %x), frames %ld\n", result, playptr, substream->runtime->dma_addr, frmres); | 1114 | frmres = bytes_to_frames( substream->runtime, result); |
1115 | snd_azf3328_dbgplay("PLAY @ 0x%8lx, frames %8ld\n", result, frmres); | ||
968 | return frmres; | 1116 | return frmres; |
969 | } | 1117 | } |
970 | 1118 | ||
971 | static snd_pcm_uframes_t snd_azf3328_capture_pointer(snd_pcm_substream_t * substream) | 1119 | static snd_pcm_uframes_t |
1120 | snd_azf3328_capture_pointer(snd_pcm_substream_t * substream) | ||
972 | { | 1121 | { |
973 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1122 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
974 | unsigned long bufptr, recptr; | 1123 | unsigned long bufptr, result; |
975 | unsigned long result; | ||
976 | snd_pcm_uframes_t frmres; | 1124 | snd_pcm_uframes_t frmres; |
977 | 1125 | ||
978 | #ifdef QUERY_HARDWARE | 1126 | #ifdef QUERY_HARDWARE |
@@ -980,96 +1128,116 @@ static snd_pcm_uframes_t snd_azf3328_capture_pointer(snd_pcm_substream_t * subst | |||
980 | #else | 1128 | #else |
981 | bufptr = substream->runtime->dma_addr; | 1129 | bufptr = substream->runtime->dma_addr; |
982 | #endif | 1130 | #endif |
983 | recptr = inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS); | 1131 | result = inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS); |
984 | 1132 | ||
985 | result = recptr - bufptr; | 1133 | /* calculate offset */ |
986 | frmres = bytes_to_frames( substream->runtime, result ); | 1134 | result -= bufptr; |
987 | snd_azf3328_dbgplay("result %lx, rec ptr %lx (base %x), frames %ld\n", result, recptr, substream->runtime->dma_addr, frmres); | 1135 | frmres = bytes_to_frames( substream->runtime, result); |
1136 | snd_azf3328_dbgplay("REC @ 0x%8lx, frames %8ld\n", result, frmres); | ||
988 | return frmres; | 1137 | return frmres; |
989 | } | 1138 | } |
990 | 1139 | ||
991 | static irqreturn_t snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 1140 | static irqreturn_t |
1141 | snd_azf3328_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
992 | { | 1142 | { |
993 | azf3328_t *chip = dev_id; | 1143 | azf3328_t *chip = dev_id; |
994 | unsigned int status, which; | 1144 | u8 status, which; |
995 | static unsigned long count; | 1145 | static unsigned long irq_count; |
996 | 1146 | ||
997 | status = inw(chip->codec_port+IDX_IO_IRQSTATUS); | 1147 | status = snd_azf3328_codec_inb(chip, IDX_IO_IRQSTATUS); |
998 | 1148 | ||
999 | /* fast path out, to ease interrupt sharing */ | 1149 | /* fast path out, to ease interrupt sharing */ |
1000 | if (!(status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_MPU401|IRQ_SOMEIRQ))) | 1150 | if (!(status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_MPU401|IRQ_TIMER))) |
1001 | return IRQ_NONE; /* must be interrupt for another device */ | 1151 | return IRQ_NONE; /* must be interrupt for another device */ |
1002 | 1152 | ||
1003 | snd_azf3328_dbgplay("Interrupt %ld!\nIDX_IO_PLAY_FLAGS %04x, IDX_IO_PLAY_IRQMASK %04x, IDX_IO_IRQSTATUS %04x\n", count, inw(chip->codec_port+IDX_IO_PLAY_FLAGS), inw(chip->codec_port+IDX_IO_PLAY_IRQMASK), inw(chip->codec_port+IDX_IO_IRQSTATUS)); | 1153 | snd_azf3328_dbgplay("Interrupt %ld!\nIDX_IO_PLAY_FLAGS %04x, IDX_IO_PLAY_IRQTYPE %04x, IDX_IO_IRQSTATUS %04x\n", |
1154 | irq_count, | ||
1155 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_FLAGS), | ||
1156 | snd_azf3328_codec_inw(chip, IDX_IO_PLAY_IRQTYPE), | ||
1157 | status); | ||
1004 | 1158 | ||
1159 | if (status & IRQ_TIMER) | ||
1160 | { | ||
1161 | /* snd_azf3328_dbgplay("timer %ld\n", inl(chip->codec_port+IDX_IO_TIMER_VALUE) & TIMER_VALUE_MASK); */ | ||
1162 | if (chip->timer) | ||
1163 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | ||
1164 | /* ACK timer */ | ||
1165 | spin_lock(&chip->reg_lock); | ||
1166 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); | ||
1167 | spin_unlock(&chip->reg_lock); | ||
1168 | snd_azf3328_dbgplay("azt3328: timer IRQ\n"); | ||
1169 | } | ||
1005 | if (status & IRQ_PLAYBACK) | 1170 | if (status & IRQ_PLAYBACK) |
1006 | { | 1171 | { |
1007 | spin_lock(&chip->reg_lock); | 1172 | spin_lock(&chip->reg_lock); |
1008 | which = inw(chip->codec_port+IDX_IO_PLAY_IRQMASK); | 1173 | which = snd_azf3328_codec_inb(chip, IDX_IO_PLAY_IRQTYPE); |
1009 | if (which & IRQ_FINISHED_PLAYBUF_1) | 1174 | /* ack all IRQ types immediately */ |
1010 | /* ack IRQ */ | 1175 | snd_azf3328_codec_outb(chip, IDX_IO_PLAY_IRQTYPE, which); |
1011 | outw(which | IRQ_FINISHED_PLAYBUF_1, chip->codec_port+IDX_IO_PLAY_IRQMASK); | 1176 | spin_unlock(&chip->reg_lock); |
1012 | if (which & IRQ_FINISHED_PLAYBUF_2) | 1177 | |
1013 | /* ack IRQ */ | ||
1014 | outw(which | IRQ_FINISHED_PLAYBUF_2, chip->codec_port+IDX_IO_PLAY_IRQMASK); | ||
1015 | if (which & IRQ_PLAY_SOMETHING) | ||
1016 | { | ||
1017 | snd_azf3328_dbgplay("azt3328: unknown play IRQ type occurred, please report!\n"); | ||
1018 | } | ||
1019 | if (chip->pcm && chip->playback_substream) | 1178 | if (chip->pcm && chip->playback_substream) |
1020 | { | 1179 | { |
1021 | snd_azf3328_dbgplay("which %x, playptr %lx\n", which, inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS)); | ||
1022 | snd_pcm_period_elapsed(chip->playback_substream); | 1180 | snd_pcm_period_elapsed(chip->playback_substream); |
1023 | snd_azf3328_dbgplay("period done, playptr %lx.\n", inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS)); | 1181 | snd_azf3328_dbgplay("PLAY period done (#%x), @ %x\n", |
1182 | which, | ||
1183 | inl(chip->codec_port+IDX_IO_PLAY_DMA_CURRPOS)); | ||
1024 | } | 1184 | } |
1025 | else | 1185 | else |
1026 | snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n"); | 1186 | snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n"); |
1027 | spin_unlock(&chip->reg_lock); | 1187 | if (which & IRQ_PLAY_SOMETHING) |
1188 | snd_azf3328_dbgplay("azt3328: unknown play IRQ type occurred, please report!\n"); | ||
1028 | } | 1189 | } |
1029 | if (status & IRQ_RECORDING) | 1190 | if (status & IRQ_RECORDING) |
1030 | { | 1191 | { |
1031 | spin_lock(&chip->reg_lock); | 1192 | spin_lock(&chip->reg_lock); |
1032 | which = inw(chip->codec_port+IDX_IO_REC_IRQMASK); | 1193 | which = snd_azf3328_codec_inb(chip, IDX_IO_REC_IRQTYPE); |
1033 | if (which & IRQ_FINISHED_RECBUF_1) | 1194 | /* ack all IRQ types immediately */ |
1034 | /* ack interrupt */ | 1195 | snd_azf3328_codec_outb(chip, IDX_IO_REC_IRQTYPE, which); |
1035 | outw(which | IRQ_FINISHED_RECBUF_1, chip->codec_port+IDX_IO_REC_IRQMASK); | 1196 | spin_unlock(&chip->reg_lock); |
1036 | if (which & IRQ_FINISHED_RECBUF_2) | 1197 | |
1037 | /* ack interrupt */ | ||
1038 | outw(which | IRQ_FINISHED_RECBUF_2, chip->codec_port+IDX_IO_REC_IRQMASK); | ||
1039 | if (which & IRQ_REC_SOMETHING) | ||
1040 | { | ||
1041 | snd_azf3328_dbgplay("azt3328: unknown rec IRQ type occurred, please report!\n"); | ||
1042 | } | ||
1043 | if (chip->pcm && chip->capture_substream) | 1198 | if (chip->pcm && chip->capture_substream) |
1044 | { | 1199 | { |
1045 | snd_azf3328_dbgplay("which %x, recptr %lx\n", which, inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS)); | ||
1046 | spin_unlock(&chip->reg_lock); | ||
1047 | snd_pcm_period_elapsed(chip->capture_substream); | 1200 | snd_pcm_period_elapsed(chip->capture_substream); |
1048 | spin_lock(&chip->reg_lock); | 1201 | snd_azf3328_dbgplay("REC period done (#%x), @ %x\n", |
1049 | snd_azf3328_dbgplay("period done, recptr %lx.\n", inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS)); | 1202 | which, |
1203 | inl(chip->codec_port+IDX_IO_REC_DMA_CURRPOS)); | ||
1050 | } | 1204 | } |
1051 | spin_unlock(&chip->reg_lock); | 1205 | else |
1206 | snd_azf3328_dbgplay("azt3328: ouch, irq handler problem!\n"); | ||
1207 | if (which & IRQ_REC_SOMETHING) | ||
1208 | snd_azf3328_dbgplay("azt3328: unknown rec IRQ type occurred, please report!\n"); | ||
1052 | } | 1209 | } |
1210 | /* MPU401 has less critical IRQ requirements | ||
1211 | * than timer and playback/recording, right? */ | ||
1053 | if (status & IRQ_MPU401) | 1212 | if (status & IRQ_MPU401) |
1213 | { | ||
1054 | snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs); | 1214 | snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs); |
1055 | if (status & IRQ_SOMEIRQ) | 1215 | |
1056 | snd_azf3328_dbgplay("azt3328: unknown IRQ type occurred, please report!\n"); | 1216 | /* hmm, do we have to ack the IRQ here somehow? |
1057 | count++; | 1217 | * If so, then I don't know how... */ |
1218 | snd_azf3328_dbgplay("azt3328: MPU401 IRQ\n"); | ||
1219 | } | ||
1220 | irq_count++; | ||
1058 | return IRQ_HANDLED; | 1221 | return IRQ_HANDLED; |
1059 | } | 1222 | } |
1060 | 1223 | ||
1061 | /*****************************************************************/ | 1224 | /*****************************************************************/ |
1062 | 1225 | ||
1063 | static snd_pcm_hardware_t snd_azf3328_playback = | 1226 | static const snd_pcm_hardware_t snd_azf3328_playback = |
1064 | { | 1227 | { |
1065 | /* FIXME!! Correct? */ | 1228 | /* FIXME!! Correct? */ |
1066 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1229 | .info = SNDRV_PCM_INFO_MMAP | |
1067 | SNDRV_PCM_INFO_MMAP_VALID), | 1230 | SNDRV_PCM_INFO_INTERLEAVED | |
1068 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | | 1231 | SNDRV_PCM_INFO_MMAP_VALID, |
1069 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE, | 1232 | .formats = SNDRV_PCM_FMTBIT_S8 | |
1070 | .rates = SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_64000 | SNDRV_PCM_RATE_KNOT, | 1233 | SNDRV_PCM_FMTBIT_U8 | |
1071 | .rate_min = 5512, | 1234 | SNDRV_PCM_FMTBIT_S16_LE | |
1072 | .rate_max = 64000, | 1235 | SNDRV_PCM_FMTBIT_U16_LE, |
1236 | .rates = SNDRV_PCM_RATE_5512 | | ||
1237 | SNDRV_PCM_RATE_8000_48000 | | ||
1238 | SNDRV_PCM_RATE_KNOT, | ||
1239 | .rate_min = 4000, | ||
1240 | .rate_max = 66200, | ||
1073 | .channels_min = 1, | 1241 | .channels_min = 1, |
1074 | .channels_max = 2, | 1242 | .channels_max = 2, |
1075 | .buffer_bytes_max = 65536, | 1243 | .buffer_bytes_max = 65536, |
@@ -1083,16 +1251,21 @@ static snd_pcm_hardware_t snd_azf3328_playback = | |||
1083 | .fifo_size = 0, | 1251 | .fifo_size = 0, |
1084 | }; | 1252 | }; |
1085 | 1253 | ||
1086 | static snd_pcm_hardware_t snd_azf3328_capture = | 1254 | static const snd_pcm_hardware_t snd_azf3328_capture = |
1087 | { | 1255 | { |
1088 | /* FIXME */ | 1256 | /* FIXME */ |
1089 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1257 | .info = SNDRV_PCM_INFO_MMAP | |
1090 | SNDRV_PCM_INFO_MMAP_VALID), | 1258 | SNDRV_PCM_INFO_INTERLEAVED | |
1091 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | | 1259 | SNDRV_PCM_INFO_MMAP_VALID, |
1092 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE, | 1260 | .formats = SNDRV_PCM_FMTBIT_S8 | |
1093 | .rates = SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_64000 | SNDRV_PCM_RATE_KNOT, | 1261 | SNDRV_PCM_FMTBIT_U8 | |
1094 | .rate_min = 5512, | 1262 | SNDRV_PCM_FMTBIT_S16_LE | |
1095 | .rate_max = 64000, | 1263 | SNDRV_PCM_FMTBIT_U16_LE, |
1264 | .rates = SNDRV_PCM_RATE_5512 | | ||
1265 | SNDRV_PCM_RATE_8000_48000 | | ||
1266 | SNDRV_PCM_RATE_KNOT, | ||
1267 | .rate_min = 4000, | ||
1268 | .rate_max = 66200, | ||
1096 | .channels_min = 1, | 1269 | .channels_min = 1, |
1097 | .channels_max = 2, | 1270 | .channels_max = 2, |
1098 | .buffer_bytes_max = 65536, | 1271 | .buffer_bytes_max = 65536, |
@@ -1105,8 +1278,8 @@ static snd_pcm_hardware_t snd_azf3328_capture = | |||
1105 | 1278 | ||
1106 | 1279 | ||
1107 | static unsigned int snd_azf3328_fixed_rates[] = { | 1280 | static unsigned int snd_azf3328_fixed_rates[] = { |
1108 | 5512, 6620, 8000, 9600, 11025, 16000, 22050, 32000, 44100, 48000, 64000 | 1281 | 4000, 4800, 5512, 6620, 8000, 9600, 11025, 13240, 16000, 22050, 32000, |
1109 | }; | 1282 | 44100, 48000, 66200 }; |
1110 | static snd_pcm_hw_constraint_list_t snd_azf3328_hw_constraints_rates = { | 1283 | static snd_pcm_hw_constraint_list_t snd_azf3328_hw_constraints_rates = { |
1111 | .count = ARRAY_SIZE(snd_azf3328_fixed_rates), | 1284 | .count = ARRAY_SIZE(snd_azf3328_fixed_rates), |
1112 | .list = snd_azf3328_fixed_rates, | 1285 | .list = snd_azf3328_fixed_rates, |
@@ -1115,7 +1288,8 @@ static snd_pcm_hw_constraint_list_t snd_azf3328_hw_constraints_rates = { | |||
1115 | 1288 | ||
1116 | /*****************************************************************/ | 1289 | /*****************************************************************/ |
1117 | 1290 | ||
1118 | static int snd_azf3328_playback_open(snd_pcm_substream_t * substream) | 1291 | static int |
1292 | snd_azf3328_playback_open(snd_pcm_substream_t * substream) | ||
1119 | { | 1293 | { |
1120 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1294 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
1121 | snd_pcm_runtime_t *runtime = substream->runtime; | 1295 | snd_pcm_runtime_t *runtime = substream->runtime; |
@@ -1129,7 +1303,8 @@ static int snd_azf3328_playback_open(snd_pcm_substream_t * substream) | |||
1129 | return 0; | 1303 | return 0; |
1130 | } | 1304 | } |
1131 | 1305 | ||
1132 | static int snd_azf3328_capture_open(snd_pcm_substream_t * substream) | 1306 | static int |
1307 | snd_azf3328_capture_open(snd_pcm_substream_t * substream) | ||
1133 | { | 1308 | { |
1134 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1309 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
1135 | snd_pcm_runtime_t *runtime = substream->runtime; | 1310 | snd_pcm_runtime_t *runtime = substream->runtime; |
@@ -1143,7 +1318,8 @@ static int snd_azf3328_capture_open(snd_pcm_substream_t * substream) | |||
1143 | return 0; | 1318 | return 0; |
1144 | } | 1319 | } |
1145 | 1320 | ||
1146 | static int snd_azf3328_playback_close(snd_pcm_substream_t * substream) | 1321 | static int |
1322 | snd_azf3328_playback_close(snd_pcm_substream_t * substream) | ||
1147 | { | 1323 | { |
1148 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1324 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
1149 | 1325 | ||
@@ -1154,7 +1330,8 @@ static int snd_azf3328_playback_close(snd_pcm_substream_t * substream) | |||
1154 | return 0; | 1330 | return 0; |
1155 | } | 1331 | } |
1156 | 1332 | ||
1157 | static int snd_azf3328_capture_close(snd_pcm_substream_t * substream) | 1333 | static int |
1334 | snd_azf3328_capture_close(snd_pcm_substream_t * substream) | ||
1158 | { | 1335 | { |
1159 | azf3328_t *chip = snd_pcm_substream_chip(substream); | 1336 | azf3328_t *chip = snd_pcm_substream_chip(substream); |
1160 | 1337 | ||
@@ -1188,14 +1365,16 @@ static snd_pcm_ops_t snd_azf3328_capture_ops = { | |||
1188 | .pointer = snd_azf3328_capture_pointer | 1365 | .pointer = snd_azf3328_capture_pointer |
1189 | }; | 1366 | }; |
1190 | 1367 | ||
1191 | static void snd_azf3328_pcm_free(snd_pcm_t *pcm) | 1368 | static void |
1369 | snd_azf3328_pcm_free(snd_pcm_t *pcm) | ||
1192 | { | 1370 | { |
1193 | azf3328_t *chip = pcm->private_data; | 1371 | azf3328_t *chip = pcm->private_data; |
1194 | chip->pcm = NULL; | 1372 | chip->pcm = NULL; |
1195 | snd_pcm_lib_preallocate_free_for_all(pcm); | 1373 | snd_pcm_lib_preallocate_free_for_all(pcm); |
1196 | } | 1374 | } |
1197 | 1375 | ||
1198 | static int __devinit snd_azf3328_pcm(azf3328_t *chip, int device) | 1376 | static int __devinit |
1377 | snd_azf3328_pcm(azf3328_t *chip, int device) | ||
1199 | { | 1378 | { |
1200 | snd_pcm_t *pcm; | 1379 | snd_pcm_t *pcm; |
1201 | int err; | 1380 | int err; |
@@ -1222,7 +1401,8 @@ static int __devinit snd_azf3328_pcm(azf3328_t *chip, int device) | |||
1222 | /******************************************************************/ | 1401 | /******************************************************************/ |
1223 | 1402 | ||
1224 | #ifdef SUPPORT_JOYSTICK | 1403 | #ifdef SUPPORT_JOYSTICK |
1225 | static int __devinit snd_azf3328_config_joystick(azf3328_t *chip, int dev) | 1404 | static int __devinit |
1405 | snd_azf3328_config_joystick(azf3328_t *chip, int dev) | ||
1226 | { | 1406 | { |
1227 | struct gameport *gp; | 1407 | struct gameport *gp; |
1228 | struct resource *r; | 1408 | struct resource *r; |
@@ -1238,8 +1418,7 @@ static int __devinit snd_azf3328_config_joystick(azf3328_t *chip, int dev) | |||
1238 | chip->gameport = gp = gameport_allocate_port(); | 1418 | chip->gameport = gp = gameport_allocate_port(); |
1239 | if (!gp) { | 1419 | if (!gp) { |
1240 | printk(KERN_ERR "azt3328: cannot allocate memory for gameport\n"); | 1420 | printk(KERN_ERR "azt3328: cannot allocate memory for gameport\n"); |
1241 | release_resource(r); | 1421 | release_and_free_resource(r); |
1242 | kfree_nocheck(r); | ||
1243 | return -ENOMEM; | 1422 | return -ENOMEM; |
1244 | } | 1423 | } |
1245 | 1424 | ||
@@ -1249,15 +1428,16 @@ static int __devinit snd_azf3328_config_joystick(azf3328_t *chip, int dev) | |||
1249 | gp->io = 0x200; | 1428 | gp->io = 0x200; |
1250 | gameport_set_port_data(gp, r); | 1429 | gameport_set_port_data(gp, r); |
1251 | 1430 | ||
1252 | snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR, | 1431 | snd_azf3328_io2_outb(chip, IDX_IO2_LEGACY_ADDR, |
1253 | snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) | LEGACY_JOY); | 1432 | snd_azf3328_io2_inb(chip, IDX_IO2_LEGACY_ADDR) | LEGACY_JOY); |
1254 | 1433 | ||
1255 | gameport_register_port(chip->gameport); | 1434 | gameport_register_port(chip->gameport); |
1256 | 1435 | ||
1257 | return 0; | 1436 | return 0; |
1258 | } | 1437 | } |
1259 | 1438 | ||
1260 | static void snd_azf3328_free_joystick(azf3328_t *chip) | 1439 | static void |
1440 | snd_azf3328_free_joystick(azf3328_t *chip) | ||
1261 | { | 1441 | { |
1262 | if (chip->gameport) { | 1442 | if (chip->gameport) { |
1263 | struct resource *r = gameport_get_port_data(chip->gameport); | 1443 | struct resource *r = gameport_get_port_data(chip->gameport); |
@@ -1265,33 +1445,36 @@ static void snd_azf3328_free_joystick(azf3328_t *chip) | |||
1265 | gameport_unregister_port(chip->gameport); | 1445 | gameport_unregister_port(chip->gameport); |
1266 | chip->gameport = NULL; | 1446 | chip->gameport = NULL; |
1267 | /* disable gameport */ | 1447 | /* disable gameport */ |
1268 | snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR, | 1448 | snd_azf3328_io2_outb(chip, IDX_IO2_LEGACY_ADDR, |
1269 | snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY); | 1449 | snd_azf3328_io2_inb(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY); |
1270 | release_resource(r); | 1450 | release_and_free_resource(r); |
1271 | kfree_nocheck(r); | ||
1272 | } | 1451 | } |
1273 | } | 1452 | } |
1274 | #else | 1453 | #else |
1275 | static inline int snd_azf3328_config_joystick(azf3328_t *chip, int dev) { return -ENOSYS; } | 1454 | static inline int |
1276 | static inline void snd_azf3328_free_joystick(azf3328_t *chip) { } | 1455 | snd_azf3328_config_joystick(azf3328_t *chip, int dev) { return -ENOSYS; } |
1456 | static inline void | ||
1457 | snd_azf3328_free_joystick(azf3328_t *chip) { } | ||
1277 | #endif | 1458 | #endif |
1278 | 1459 | ||
1279 | /******************************************************************/ | 1460 | /******************************************************************/ |
1280 | 1461 | ||
1281 | static int snd_azf3328_free(azf3328_t *chip) | 1462 | static int |
1463 | snd_azf3328_free(azf3328_t *chip) | ||
1282 | { | 1464 | { |
1283 | if (chip->irq < 0) | 1465 | if (chip->irq < 0) |
1284 | goto __end_hw; | 1466 | goto __end_hw; |
1285 | 1467 | ||
1286 | /* reset (close) mixer */ | 1468 | /* reset (close) mixer */ |
1287 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); /* first mute master volume */ | 1469 | snd_azf3328_mixer_set_mute(chip, IDX_MIXER_PLAY_MASTER, 1); /* first mute master volume */ |
1288 | snd_azf3328_mixer_write(chip, IDX_MIXER_RESET, 0x0, WORD_VALUE); | 1470 | snd_azf3328_mixer_outw(chip, IDX_MIXER_RESET, 0x0000); |
1289 | 1471 | ||
1290 | /* interrupt setup - mask everything */ | 1472 | /* interrupt setup - mask everything (FIXME!) */ |
1291 | /* FIXME */ | 1473 | /* well, at least we know how to disable the timer IRQ */ |
1474 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x00); | ||
1292 | 1475 | ||
1293 | synchronize_irq(chip->irq); | 1476 | synchronize_irq(chip->irq); |
1294 | __end_hw: | 1477 | __end_hw: |
1295 | snd_azf3328_free_joystick(chip); | 1478 | snd_azf3328_free_joystick(chip); |
1296 | if (chip->irq >= 0) | 1479 | if (chip->irq >= 0) |
1297 | free_irq(chip->irq, (void *)chip); | 1480 | free_irq(chip->irq, (void *)chip); |
@@ -1302,15 +1485,129 @@ static int snd_azf3328_free(azf3328_t *chip) | |||
1302 | return 0; | 1485 | return 0; |
1303 | } | 1486 | } |
1304 | 1487 | ||
1305 | static int snd_azf3328_dev_free(snd_device_t *device) | 1488 | static int |
1489 | snd_azf3328_dev_free(snd_device_t *device) | ||
1306 | { | 1490 | { |
1307 | azf3328_t *chip = device->device_data; | 1491 | azf3328_t *chip = device->device_data; |
1308 | return snd_azf3328_free(chip); | 1492 | return snd_azf3328_free(chip); |
1309 | } | 1493 | } |
1310 | 1494 | ||
1495 | /******************************************************************/ | ||
1496 | |||
1497 | /*** NOTE: the physical timer resolution actually is 1024000 ticks per second, | ||
1498 | *** but announcing those attributes to user-space would make programs | ||
1499 | *** configure the timer to a 1 tick value, resulting in an absolutely fatal | ||
1500 | *** timer IRQ storm. | ||
1501 | *** Thus I chose to announce a down-scaled virtual timer to the outside and | ||
1502 | *** calculate real timer countdown values internally. | ||
1503 | *** (the scale factor can be set via module parameter "seqtimer_scaling"). | ||
1504 | ***/ | ||
1505 | |||
1506 | static int | ||
1507 | snd_azf3328_timer_start(snd_timer_t *timer) | ||
1508 | { | ||
1509 | azf3328_t *chip; | ||
1510 | unsigned long flags; | ||
1511 | unsigned int delay; | ||
1512 | |||
1513 | snd_azf3328_dbgcallenter(); | ||
1514 | chip = snd_timer_chip(timer); | ||
1515 | delay = ((timer->sticks * seqtimer_scaling) - 1) & TIMER_VALUE_MASK; | ||
1516 | if (delay < 49) | ||
1517 | { | ||
1518 | /* uhoh, that's not good, since user-space won't know about | ||
1519 | * this timing tweak | ||
1520 | * (we need to do it to avoid a lockup, though) */ | ||
1521 | |||
1522 | snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay); | ||
1523 | delay = 49; /* minimum time is 49 ticks */ | ||
1524 | } | ||
1525 | snd_azf3328_dbgtimer("setting timer countdown value %d, add COUNTDOWN|IRQ\n", delay); | ||
1526 | delay |= TIMER_ENABLE_COUNTDOWN | TIMER_ENABLE_IRQ; | ||
1527 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
1528 | snd_azf3328_codec_outl(chip, IDX_IO_TIMER_VALUE, delay); | ||
1529 | spin_unlock_irqrestore(&chip->reg_lock, flags); | ||
1530 | snd_azf3328_dbgcallleave(); | ||
1531 | return 0; | ||
1532 | } | ||
1533 | |||
1534 | static int | ||
1535 | snd_azf3328_timer_stop(snd_timer_t *timer) | ||
1536 | { | ||
1537 | azf3328_t *chip; | ||
1538 | unsigned long flags; | ||
1539 | |||
1540 | snd_azf3328_dbgcallenter(); | ||
1541 | chip = snd_timer_chip(timer); | ||
1542 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
1543 | /* disable timer countdown and interrupt */ | ||
1544 | /* FIXME: should we write TIMER_ACK_IRQ here? */ | ||
1545 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0); | ||
1546 | spin_unlock_irqrestore(&chip->reg_lock, flags); | ||
1547 | snd_azf3328_dbgcallleave(); | ||
1548 | return 0; | ||
1549 | } | ||
1550 | |||
1551 | |||
1552 | static int | ||
1553 | snd_azf3328_timer_precise_resolution(snd_timer_t *timer, | ||
1554 | unsigned long *num, unsigned long *den) | ||
1555 | { | ||
1556 | snd_azf3328_dbgcallenter(); | ||
1557 | *num = 1; | ||
1558 | *den = 1024000 / seqtimer_scaling; | ||
1559 | snd_azf3328_dbgcallleave(); | ||
1560 | return 0; | ||
1561 | } | ||
1562 | |||
1563 | static struct _snd_timer_hardware snd_azf3328_timer_hw = { | ||
1564 | .flags = SNDRV_TIMER_HW_AUTO, | ||
1565 | .resolution = 977, /* 1000000/1024000 = 0.9765625us */ | ||
1566 | .ticks = 1024000, /* max tick count, defined by the value register; actually it's not 1024000, but 1048576, but we don't care */ | ||
1567 | .start = snd_azf3328_timer_start, | ||
1568 | .stop = snd_azf3328_timer_stop, | ||
1569 | .precise_resolution = snd_azf3328_timer_precise_resolution, | ||
1570 | }; | ||
1571 | |||
1572 | static int __devinit | ||
1573 | snd_azf3328_timer(azf3328_t *chip, int device) | ||
1574 | { | ||
1575 | snd_timer_t *timer = NULL; | ||
1576 | snd_timer_id_t tid; | ||
1577 | int err; | ||
1578 | |||
1579 | snd_azf3328_dbgcallenter(); | ||
1580 | tid.dev_class = SNDRV_TIMER_CLASS_CARD; | ||
1581 | tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; | ||
1582 | tid.card = chip->card->number; | ||
1583 | tid.device = device; | ||
1584 | tid.subdevice = 0; | ||
1585 | |||
1586 | snd_azf3328_timer_hw.resolution *= seqtimer_scaling; | ||
1587 | snd_azf3328_timer_hw.ticks /= seqtimer_scaling; | ||
1588 | if ((err = snd_timer_new(chip->card, "AZF3328", &tid, &timer)) < 0) { | ||
1589 | goto out; | ||
1590 | } | ||
1591 | |||
1592 | strcpy(timer->name, "AZF3328 timer"); | ||
1593 | timer->private_data = chip; | ||
1594 | timer->hw = snd_azf3328_timer_hw; | ||
1595 | |||
1596 | chip->timer = timer; | ||
1597 | |||
1598 | err = 0; | ||
1599 | |||
1600 | out: | ||
1601 | snd_azf3328_dbgcallleave(); | ||
1602 | return err; | ||
1603 | } | ||
1604 | |||
1605 | /******************************************************************/ | ||
1606 | |||
1311 | #if 0 | 1607 | #if 0 |
1312 | /* check whether a bit can be modified */ | 1608 | /* check whether a bit can be modified */ |
1313 | static void snd_azf3328_test_bit(unsigned int reg, int bit) | 1609 | static void |
1610 | snd_azf3328_test_bit(unsigned int reg, int bit) | ||
1314 | { | 1611 | { |
1315 | unsigned char val, valoff, valon; | 1612 | unsigned char val, valoff, valon; |
1316 | 1613 | ||
@@ -1328,7 +1625,26 @@ static void snd_azf3328_test_bit(unsigned int reg, int bit) | |||
1328 | } | 1625 | } |
1329 | #endif | 1626 | #endif |
1330 | 1627 | ||
1331 | static int __devinit snd_azf3328_create(snd_card_t * card, | 1628 | static void |
1629 | snd_azf3328_debug_show_ports(const azf3328_t *chip) | ||
1630 | { | ||
1631 | #if DEBUG_MISC | ||
1632 | u16 tmp; | ||
1633 | |||
1634 | snd_azf3328_dbgmisc("codec_port 0x%lx, io2_port 0x%lx, mpu_port 0x%lx, synth_port 0x%lx, mixer_port 0x%lx, irq %d\n", chip->codec_port, chip->io2_port, chip->mpu_port, chip->synth_port, chip->mixer_port, chip->irq); | ||
1635 | |||
1636 | snd_azf3328_dbgmisc("io2 %02x %02x %02x %02x %02x %02x\n", snd_azf3328_io2_inb(chip, 0), snd_azf3328_io2_inb(chip, 1), snd_azf3328_io2_inb(chip, 2), snd_azf3328_io2_inb(chip, 3), snd_azf3328_io2_inb(chip, 4), snd_azf3328_io2_inb(chip, 5)); | ||
1637 | |||
1638 | for (tmp=0; tmp <= 0x01; tmp += 1) | ||
1639 | snd_azf3328_dbgmisc("0x%02x: opl 0x%04x, mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, mpu330 0x%04x\n", tmp, inb(0x388 + tmp), inb(0x300 + tmp), inb(0x310 + tmp), inb(0x320 + tmp), inb(0x330 + tmp)); | ||
1640 | |||
1641 | for (tmp = 0; tmp <= 0x6E; tmp += 2) | ||
1642 | snd_azf3328_dbgmisc("0x%02x: 0x%04x\n", tmp, snd_azf3328_codec_inb(chip, tmp)); | ||
1643 | #endif | ||
1644 | } | ||
1645 | |||
1646 | static int __devinit | ||
1647 | snd_azf3328_create(snd_card_t * card, | ||
1332 | struct pci_dev *pci, | 1648 | struct pci_dev *pci, |
1333 | unsigned long device_type, | 1649 | unsigned long device_type, |
1334 | azf3328_t ** rchip) | 1650 | azf3328_t ** rchip) |
@@ -1347,8 +1663,8 @@ static int __devinit snd_azf3328_create(snd_card_t * card, | |||
1347 | 1663 | ||
1348 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1664 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
1349 | if (chip == NULL) { | 1665 | if (chip == NULL) { |
1350 | pci_disable_device(pci); | 1666 | err = -ENOMEM; |
1351 | return -ENOMEM; | 1667 | goto out_err; |
1352 | } | 1668 | } |
1353 | spin_lock_init(&chip->reg_lock); | 1669 | spin_lock_init(&chip->reg_lock); |
1354 | chip->card = card; | 1670 | chip->card = card; |
@@ -1358,47 +1674,39 @@ static int __devinit snd_azf3328_create(snd_card_t * card, | |||
1358 | /* check if we can restrict PCI DMA transfers to 24 bits */ | 1674 | /* check if we can restrict PCI DMA transfers to 24 bits */ |
1359 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || | 1675 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || |
1360 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { | 1676 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { |
1361 | snd_printk("architecture does not support 24bit PCI busmaster DMA\n"); | 1677 | snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); |
1362 | pci_disable_device(pci); | 1678 | err = -ENXIO; |
1363 | return -ENXIO; | 1679 | goto out_err; |
1364 | } | 1680 | } |
1365 | 1681 | ||
1366 | if ((err = pci_request_regions(pci, "Aztech AZF3328")) < 0) { | 1682 | if ((err = pci_request_regions(pci, "Aztech AZF3328")) < 0) { |
1367 | kfree(chip); | 1683 | goto out_err; |
1368 | pci_disable_device(pci); | ||
1369 | return err; | ||
1370 | } | 1684 | } |
1371 | 1685 | ||
1372 | chip->codec_port = pci_resource_start(pci, 0); | 1686 | chip->codec_port = pci_resource_start(pci, 0); |
1373 | chip->io2_port = pci_resource_start(pci, 1); | 1687 | chip->io2_port = pci_resource_start(pci, 1); |
1374 | chip->mpu_port = pci_resource_start(pci, 2); | 1688 | chip->mpu_port = pci_resource_start(pci, 2); |
1375 | chip->synth_port = pci_resource_start(pci, 3); | 1689 | chip->synth_port = pci_resource_start(pci, 3); |
1376 | chip->mixer_port = pci_resource_start(pci, 4); | 1690 | chip->mixer_port = pci_resource_start(pci, 4); |
1377 | 1691 | ||
1378 | if (request_irq(pci->irq, snd_azf3328_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | 1692 | if (request_irq(pci->irq, snd_azf3328_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { |
1379 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1693 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1380 | snd_azf3328_free(chip); | 1694 | err = -EBUSY; |
1381 | return -EBUSY; | 1695 | goto out_err; |
1382 | } | 1696 | } |
1383 | chip->irq = pci->irq; | 1697 | chip->irq = pci->irq; |
1384 | pci_set_master(pci); | 1698 | pci_set_master(pci); |
1385 | synchronize_irq(chip->irq); | 1699 | synchronize_irq(chip->irq); |
1386 | 1700 | ||
1387 | snd_azf3328_dbgmisc("codec_port 0x%lx, io2_port 0x%lx, mpu_port 0x%lx, synth_port 0x%lx, mixer_port 0x%lx, irq %d\n", chip->codec_port, chip->io2_port, chip->mpu_port, chip->synth_port, chip->mixer_port, chip->irq); | 1701 | snd_azf3328_debug_show_ports(chip); |
1388 | 1702 | ||
1389 | snd_azf3328_dbgmisc("io2 %02x %02x %02x %02x %02x %02x\n", snd_azf3328_io2_read(chip, 0), snd_azf3328_io2_read(chip, 1), snd_azf3328_io2_read(chip, 2), snd_azf3328_io2_read(chip, 3), snd_azf3328_io2_read(chip, 4), snd_azf3328_io2_read(chip, 5)); | ||
1390 | |||
1391 | for (tmp=0; tmp <= 0x01; tmp += 1) | ||
1392 | snd_azf3328_dbgmisc("0x%02x: opl 0x%04x, mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, mpu330 0x%04x\n", tmp, inb(0x388 + tmp), inb(0x300 + tmp), inb(0x310 + tmp), inb(0x320 + tmp), inb(0x330 + tmp)); | ||
1393 | |||
1394 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1703 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
1395 | snd_azf3328_free(chip); | 1704 | goto out_err; |
1396 | return err; | ||
1397 | } | 1705 | } |
1398 | 1706 | ||
1399 | /* create mixer interface & switches */ | 1707 | /* create mixer interface & switches */ |
1400 | if ((err = snd_azf3328_mixer_new(chip)) < 0) | 1708 | if ((err = snd_azf3328_mixer_new(chip)) < 0) |
1401 | return err; | 1709 | goto out_err; |
1402 | 1710 | ||
1403 | #if 0 | 1711 | #if 0 |
1404 | /* set very low bitrate to reduce noise and power consumption? */ | 1712 | /* set very low bitrate to reduce noise and power consumption? */ |
@@ -1406,22 +1714,34 @@ static int __devinit snd_azf3328_create(snd_card_t * card, | |||
1406 | #endif | 1714 | #endif |
1407 | 1715 | ||
1408 | /* standard chip init stuff */ | 1716 | /* standard chip init stuff */ |
1409 | spin_lock_irq(&chip->reg_lock); | 1717 | /* default IRQ init value */ |
1410 | outb(DMA_PLAY_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port + IDX_IO_PLAY_FLAGS); | 1718 | tmp = DMA_PLAY_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE; |
1411 | outb(DMA_PLAY_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port + IDX_IO_SOMETHING_FLAGS); | ||
1412 | outb(DMA_PLAY_SOMETHING2|DMA_EPILOGUE_SOMETHING|DMA_SOMETHING_ELSE, chip->codec_port + IDX_IO_REC_FLAGS); | ||
1413 | outb(0x0, chip->codec_port + IDX_IO_IRQ63H); | ||
1414 | 1719 | ||
1720 | spin_lock_irq(&chip->reg_lock); | ||
1721 | snd_azf3328_codec_outb(chip, IDX_IO_PLAY_FLAGS, tmp); | ||
1722 | snd_azf3328_codec_outb(chip, IDX_IO_REC_FLAGS, tmp); | ||
1723 | snd_azf3328_codec_outb(chip, IDX_IO_SOMETHING_FLAGS, tmp); | ||
1724 | snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x00); /* disable timer */ | ||
1415 | spin_unlock_irq(&chip->reg_lock); | 1725 | spin_unlock_irq(&chip->reg_lock); |
1416 | 1726 | ||
1417 | snd_card_set_dev(card, &pci->dev); | 1727 | snd_card_set_dev(card, &pci->dev); |
1418 | 1728 | ||
1419 | *rchip = chip; | 1729 | *rchip = chip; |
1420 | return 0; | 1730 | |
1731 | err = 0; | ||
1732 | goto out; | ||
1733 | |||
1734 | out_err: | ||
1735 | if (chip) | ||
1736 | snd_azf3328_free(chip); | ||
1737 | pci_disable_device(pci); | ||
1738 | |||
1739 | out: | ||
1740 | return err; | ||
1421 | } | 1741 | } |
1422 | 1742 | ||
1423 | static int __devinit snd_azf3328_probe(struct pci_dev *pci, | 1743 | static int __devinit |
1424 | const struct pci_device_id *pci_id) | 1744 | snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) |
1425 | { | 1745 | { |
1426 | static int dev; | 1746 | static int dev; |
1427 | snd_card_t *card; | 1747 | snd_card_t *card; |
@@ -1445,63 +1765,70 @@ static int __devinit snd_azf3328_probe(struct pci_dev *pci, | |||
1445 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); | 1765 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); |
1446 | 1766 | ||
1447 | if ((err = snd_azf3328_create(card, pci, pci_id->driver_data, &chip)) < 0) { | 1767 | if ((err = snd_azf3328_create(card, pci, pci_id->driver_data, &chip)) < 0) { |
1448 | snd_card_free(card); | 1768 | goto out_err; |
1449 | return err; | ||
1450 | } | 1769 | } |
1451 | 1770 | ||
1452 | if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_MPU401, | 1771 | if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_MPU401, |
1453 | chip->mpu_port, 1, pci->irq, 0, | 1772 | chip->mpu_port, 1, pci->irq, 0, |
1454 | &chip->rmidi)) < 0) { | 1773 | &chip->rmidi)) < 0) { |
1455 | snd_printk("azf3328: no MPU-401 device at 0x%lx?\n", chip->mpu_port); | 1774 | snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n", chip->mpu_port); |
1456 | snd_card_free(card); | 1775 | goto out_err; |
1457 | return err; | 1776 | } |
1777 | |||
1778 | if ((err = snd_azf3328_timer(chip, 0)) < 0) { | ||
1779 | goto out_err; | ||
1458 | } | 1780 | } |
1459 | 1781 | ||
1460 | if ((err = snd_azf3328_pcm(chip, 0)) < 0) { | 1782 | if ((err = snd_azf3328_pcm(chip, 0)) < 0) { |
1461 | snd_card_free(card); | 1783 | goto out_err; |
1462 | return err; | ||
1463 | } | 1784 | } |
1464 | 1785 | ||
1465 | if (snd_opl3_create(card, chip->synth_port, chip->synth_port+2, | 1786 | if (snd_opl3_create(card, chip->synth_port, chip->synth_port+2, |
1466 | OPL3_HW_AUTO, 1, &opl3) < 0) { | 1787 | OPL3_HW_AUTO, 1, &opl3) < 0) { |
1467 | snd_printk("azf3328: no OPL3 device at 0x%lx-0x%lx?\n", | 1788 | snd_printk(KERN_ERR "azf3328: no OPL3 device at 0x%lx-0x%lx?\n", |
1468 | chip->synth_port, chip->synth_port+2 ); | 1789 | chip->synth_port, chip->synth_port+2 ); |
1469 | } else { | 1790 | } else { |
1470 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 1791 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { |
1471 | snd_card_free(card); | 1792 | goto out_err; |
1472 | return err; | ||
1473 | } | 1793 | } |
1474 | } | 1794 | } |
1475 | 1795 | ||
1476 | snd_azf3328_dbgio(chip, "create"); | ||
1477 | |||
1478 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 1796 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
1479 | card->shortname, chip->codec_port, chip->irq); | 1797 | card->shortname, chip->codec_port, chip->irq); |
1480 | 1798 | ||
1481 | if ((err = snd_card_register(card)) < 0) { | 1799 | if ((err = snd_card_register(card)) < 0) { |
1482 | snd_card_free(card); | 1800 | goto out_err; |
1483 | return err; | ||
1484 | } | 1801 | } |
1485 | 1802 | ||
1486 | #ifdef MODULE | 1803 | #ifdef MODULE |
1487 | printk( | 1804 | printk( |
1488 | "azt3328: Experimental driver for Aztech AZF3328-based soundcards such as PCI168.\n" | 1805 | "azt3328: Sound driver for Aztech AZF3328-based soundcards such as PCI168\n" |
1489 | "azt3328: ZERO support from Aztech: you might think hard about future purchase.\n" | 1806 | "azt3328: (hardware was completely undocumented - ZERO support from Aztech).\n" |
1490 | "azt3328: Feel free to contact hw7oshyuv3001@sneakemail.com for bug reports etc.!\n"); | 1807 | "azt3328: Feel free to contact andi AT lisas.de for bug reports etc.!\n" |
1808 | "azt3328: User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n", | ||
1809 | 1024000 / seqtimer_scaling, seqtimer_scaling); | ||
1491 | #endif | 1810 | #endif |
1492 | 1811 | ||
1493 | if (snd_azf3328_config_joystick(chip, dev) < 0) | 1812 | if (snd_azf3328_config_joystick(chip, dev) < 0) |
1494 | snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR, | 1813 | snd_azf3328_io2_outb(chip, IDX_IO2_LEGACY_ADDR, |
1495 | snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY); | 1814 | snd_azf3328_io2_inb(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY); |
1496 | 1815 | ||
1497 | pci_set_drvdata(pci, card); | 1816 | pci_set_drvdata(pci, card); |
1498 | dev++; | 1817 | dev++; |
1499 | 1818 | ||
1819 | err = 0; | ||
1820 | goto out; | ||
1821 | |||
1822 | out_err: | ||
1823 | snd_card_free(card); | ||
1824 | |||
1825 | out: | ||
1500 | snd_azf3328_dbgcallleave(); | 1826 | snd_azf3328_dbgcallleave(); |
1501 | return 0; | 1827 | return err; |
1502 | } | 1828 | } |
1503 | 1829 | ||
1504 | static void __devexit snd_azf3328_remove(struct pci_dev *pci) | 1830 | static void __devexit |
1831 | snd_azf3328_remove(struct pci_dev *pci) | ||
1505 | { | 1832 | { |
1506 | snd_azf3328_dbgcallenter(); | 1833 | snd_azf3328_dbgcallenter(); |
1507 | snd_card_free(pci_get_drvdata(pci)); | 1834 | snd_card_free(pci_get_drvdata(pci)); |
@@ -1517,7 +1844,8 @@ static struct pci_driver driver = { | |||
1517 | .remove = __devexit_p(snd_azf3328_remove), | 1844 | .remove = __devexit_p(snd_azf3328_remove), |
1518 | }; | 1845 | }; |
1519 | 1846 | ||
1520 | static int __init alsa_card_azf3328_init(void) | 1847 | static int __init |
1848 | alsa_card_azf3328_init(void) | ||
1521 | { | 1849 | { |
1522 | int err; | 1850 | int err; |
1523 | snd_azf3328_dbgcallenter(); | 1851 | snd_azf3328_dbgcallenter(); |
@@ -1526,7 +1854,8 @@ static int __init alsa_card_azf3328_init(void) | |||
1526 | return err; | 1854 | return err; |
1527 | } | 1855 | } |
1528 | 1856 | ||
1529 | static void __exit alsa_card_azf3328_exit(void) | 1857 | static void __exit |
1858 | alsa_card_azf3328_exit(void) | ||
1530 | { | 1859 | { |
1531 | snd_azf3328_dbgcallenter(); | 1860 | snd_azf3328_dbgcallenter(); |
1532 | pci_unregister_driver(&driver); | 1861 | pci_unregister_driver(&driver); |
diff --git a/sound/pci/azt3328.h b/sound/pci/azt3328.h index 7e0e79180977..f489bdaf6d40 100644 --- a/sound/pci/azt3328.h +++ b/sound/pci/azt3328.h | |||
@@ -1,19 +1,17 @@ | |||
1 | #ifndef __SOUND_AZF3328_H | 1 | #ifndef __SOUND_AZT3328_H |
2 | #define __SOUND_AZF3328_H | 2 | #define __SOUND_AZT3328_H |
3 | 3 | ||
4 | /* type argument to use for the I/O functions */ | 4 | /* "PU" == "power-up value", as tested on PCI168 PCI rev. 10 */ |
5 | #define WORD_VALUE 0x1000 | ||
6 | #define DWORD_VALUE 0x2000 | ||
7 | #define BYTE_VALUE 0x4000 | ||
8 | 5 | ||
9 | /*** main I/O area port indices ***/ | 6 | /*** main I/O area port indices ***/ |
10 | /* (only 0x70 of 0x80 bytes saved/restored by Windows driver) */ | 7 | /* (only 0x70 of 0x80 bytes saved/restored by Windows driver) */ |
11 | /* the driver initialisation suggests a layout of 3 main areas: | 8 | /* the driver initialisation suggests a layout of 4 main areas: |
12 | * from 0x00 (playback), from 0x20 (recording) and from 0x40 (maybe DirectX | 9 | * from 0x00 (playback), from 0x20 (recording) and from 0x40 (maybe MPU401??). |
13 | * timer ???). and probably another area from 0x60 to 0x6f | 10 | * And another area from 0x60 to 0x6f (DirectX timer, IRQ management, |
14 | * (IRQ management, power management etc. ???). */ | 11 | * power management etc.???). */ |
15 | /* playback area */ | 12 | |
16 | #define IDX_IO_PLAY_FLAGS 0x00 | 13 | /** playback area **/ |
14 | #define IDX_IO_PLAY_FLAGS 0x00 /* PU:0x0000 */ | ||
17 | /* able to reactivate output after output muting due to 8/16bit | 15 | /* able to reactivate output after output muting due to 8/16bit |
18 | * output change, just like 0x0002. | 16 | * output change, just like 0x0002. |
19 | * 0x0001 is the only bit that's able to start the DMA counter */ | 17 | * 0x0001 is the only bit that's able to start the DMA counter */ |
@@ -29,7 +27,7 @@ | |||
29 | #define DMA_EPILOGUE_SOMETHING 0x0010 | 27 | #define DMA_EPILOGUE_SOMETHING 0x0010 |
30 | #define DMA_SOMETHING_ELSE 0x0020 /* ??? */ | 28 | #define DMA_SOMETHING_ELSE 0x0020 /* ??? */ |
31 | #define SOMETHING_UNMODIFIABLE 0xffc0 /* unused ? not modifiable */ | 29 | #define SOMETHING_UNMODIFIABLE 0xffc0 /* unused ? not modifiable */ |
32 | #define IDX_IO_PLAY_IRQMASK 0x02 | 30 | #define IDX_IO_PLAY_IRQTYPE 0x02 /* PU:0x0001 */ |
33 | /* write back to flags in case flags are set, in order to ACK IRQ in handler | 31 | /* write back to flags in case flags are set, in order to ACK IRQ in handler |
34 | * (bit 1 of port 0x64 indicates interrupt for one of these three types) | 32 | * (bit 1 of port 0x64 indicates interrupt for one of these three types) |
35 | * sometimes in this case it just writes 0xffff to globally ACK all IRQs | 33 | * sometimes in this case it just writes 0xffff to globally ACK all IRQs |
@@ -41,36 +39,39 @@ | |||
41 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ | 39 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ |
42 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ | 40 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ |
43 | #define IRQMASK_UNMODIFIABLE 0xffe0 /* unused ? not modifiable */ | 41 | #define IRQMASK_UNMODIFIABLE 0xffe0 /* unused ? not modifiable */ |
44 | #define IDX_IO_PLAY_DMA_START_1 0x04 /* start address of 1st DMA play area */ | 42 | #define IDX_IO_PLAY_DMA_START_1 0x04 /* start address of 1st DMA play area, PU:0x00000000 */ |
45 | #define IDX_IO_PLAY_DMA_START_2 0x08 /* start address of 2nd DMA play area */ | 43 | #define IDX_IO_PLAY_DMA_START_2 0x08 /* start address of 2nd DMA play area, PU:0x00000000 */ |
46 | #define IDX_IO_PLAY_DMA_LEN_1 0x0c /* length of 1st DMA play area */ | 44 | #define IDX_IO_PLAY_DMA_LEN_1 0x0c /* length of 1st DMA play area, PU:0x0000 */ |
47 | #define IDX_IO_PLAY_DMA_LEN_2 0x0e /* length of 2nd DMA play area */ | 45 | #define IDX_IO_PLAY_DMA_LEN_2 0x0e /* length of 2nd DMA play area, PU:0x0000 */ |
48 | #define IDX_IO_PLAY_DMA_CURRPOS 0x10 /* current DMA position */ | 46 | #define IDX_IO_PLAY_DMA_CURRPOS 0x10 /* current DMA position, PU:0x00000000 */ |
49 | #define IDX_IO_PLAY_DMA_CURROFS 0x14 /* offset within current DMA play area */ | 47 | #define IDX_IO_PLAY_DMA_CURROFS 0x14 /* offset within current DMA play area, PU:0x0000 */ |
50 | #define IDX_IO_PLAY_SOUNDFORMAT 0x16 | 48 | #define IDX_IO_PLAY_SOUNDFORMAT 0x16 /* PU:0x0010 */ |
51 | /* all unspecified bits can't be modified */ | 49 | /* all unspecified bits can't be modified */ |
52 | #define SOUNDFORMAT_FREQUENCY_MASK 0x000f | 50 | #define SOUNDFORMAT_FREQUENCY_MASK 0x000f |
51 | #define SOUNDFORMAT_XTAL1 0x00 | ||
52 | #define SOUNDFORMAT_XTAL2 0x01 | ||
53 | /* all _SUSPECTED_ values are not used by Windows drivers, so we don't | 53 | /* all _SUSPECTED_ values are not used by Windows drivers, so we don't |
54 | * have any hard facts, only rough measurements */ | 54 | * have any hard facts, only rough measurements */ |
55 | #define SOUNDFORMAT_FREQ_SUSPECTED_4000 0x0c | 55 | #define SOUNDFORMAT_FREQ_SUSPECTED_4000 0x0c | SOUNDFORMAT_XTAL1 |
56 | #define SOUNDFORMAT_FREQ_SUSPECTED_4800 0x0a | 56 | #define SOUNDFORMAT_FREQ_SUSPECTED_4800 0x0a | SOUNDFORMAT_XTAL1 |
57 | #define SOUNDFORMAT_FREQ_5510 0x0d | 57 | #define SOUNDFORMAT_FREQ_5510 0x0c | SOUNDFORMAT_XTAL2 |
58 | #define SOUNDFORMAT_FREQ_6620 0x0b | 58 | #define SOUNDFORMAT_FREQ_6620 0x0a | SOUNDFORMAT_XTAL2 |
59 | #define SOUNDFORMAT_FREQ_8000 0x00 /* also 0x0e ? */ | 59 | #define SOUNDFORMAT_FREQ_8000 0x00 | SOUNDFORMAT_XTAL1 /* also 0x0e | SOUNDFORMAT_XTAL1? */ |
60 | #define SOUNDFORMAT_FREQ_9600 0x08 | 60 | #define SOUNDFORMAT_FREQ_9600 0x08 | SOUNDFORMAT_XTAL1 |
61 | #define SOUNDFORMAT_FREQ_SUSPECTED_12000 0x09 | 61 | #define SOUNDFORMAT_FREQ_11025 0x00 | SOUNDFORMAT_XTAL2 /* also 0x0e | SOUNDFORMAT_XTAL2? */ |
62 | #define SOUNDFORMAT_FREQ_11025 0x01 /* also 0x0f ? */ | 62 | #define SOUNDFORMAT_FREQ_SUSPECTED_13240 0x08 | SOUNDFORMAT_XTAL2 /* seems to be 6620 *2 */ |
63 | #define SOUNDFORMAT_FREQ_16000 0x02 | 63 | #define SOUNDFORMAT_FREQ_16000 0x02 | SOUNDFORMAT_XTAL1 |
64 | #define SOUNDFORMAT_FREQ_22050 0x03 | 64 | #define SOUNDFORMAT_FREQ_22050 0x02 | SOUNDFORMAT_XTAL2 |
65 | #define SOUNDFORMAT_FREQ_32000 0x04 | 65 | #define SOUNDFORMAT_FREQ_32000 0x04 | SOUNDFORMAT_XTAL1 |
66 | #define SOUNDFORMAT_FREQ_44100 0x05 | 66 | #define SOUNDFORMAT_FREQ_44100 0x04 | SOUNDFORMAT_XTAL2 |
67 | #define SOUNDFORMAT_FREQ_48000 0x06 | 67 | #define SOUNDFORMAT_FREQ_48000 0x06 | SOUNDFORMAT_XTAL1 |
68 | #define SOUNDFORMAT_FREQ_SUSPECTED_64000 0x07 | 68 | #define SOUNDFORMAT_FREQ_SUSPECTED_66200 0x06 | SOUNDFORMAT_XTAL2 /* 66200 (13240 * 5); 64000 may have been nicer :-\ */ |
69 | #define SOUNDFORMAT_FLAG_16BIT 0x0010 | 69 | #define SOUNDFORMAT_FLAG_16BIT 0x0010 |
70 | #define SOUNDFORMAT_FLAG_2CHANNELS 0x0020 | 70 | #define SOUNDFORMAT_FLAG_2CHANNELS 0x0020 |
71 | /* recording area (see also: playback bit flag definitions) */ | 71 | |
72 | #define IDX_IO_REC_FLAGS 0x20 /* ?? */ | 72 | /** recording area (see also: playback bit flag definitions) **/ |
73 | #define IDX_IO_REC_IRQMASK 0x22 /* ?? */ | 73 | #define IDX_IO_REC_FLAGS 0x20 /* ??, PU:0x0000 */ |
74 | #define IDX_IO_REC_IRQTYPE 0x22 /* ??, PU:0x0000 */ | ||
74 | #define IRQ_REC_SOMETHING 0x0001 /* something & ACK */ | 75 | #define IRQ_REC_SOMETHING 0x0001 /* something & ACK */ |
75 | #define IRQ_FINISHED_RECBUF_1 0x0002 /* 1st dmabuf finished & ACK */ | 76 | #define IRQ_FINISHED_RECBUF_1 0x0002 /* 1st dmabuf finished & ACK */ |
76 | #define IRQ_FINISHED_RECBUF_2 0x0004 /* 2nd dmabuf finished & ACK */ | 77 | #define IRQ_FINISHED_RECBUF_2 0x0004 /* 2nd dmabuf finished & ACK */ |
@@ -78,39 +79,47 @@ | |||
78 | * but OTOH they are most likely at port 0x22 instead */ | 79 | * but OTOH they are most likely at port 0x22 instead */ |
79 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ | 80 | #define IRQMASK_SOME_STATUS_1 0x0008 /* \ related bits */ |
80 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ | 81 | #define IRQMASK_SOME_STATUS_2 0x0010 /* / (checked together in loop) */ |
81 | #define IDX_IO_REC_DMA_START_1 0x24 | 82 | #define IDX_IO_REC_DMA_START_1 0x24 /* PU:0x00000000 */ |
82 | #define IDX_IO_REC_DMA_START_2 0x28 | 83 | #define IDX_IO_REC_DMA_START_2 0x28 /* PU:0x00000000 */ |
83 | #define IDX_IO_REC_DMA_LEN_1 0x2c | 84 | #define IDX_IO_REC_DMA_LEN_1 0x2c /* PU:0x0000 */ |
84 | #define IDX_IO_REC_DMA_LEN_2 0x2e | 85 | #define IDX_IO_REC_DMA_LEN_2 0x2e /* PU:0x0000 */ |
85 | #define IDX_IO_REC_DMA_CURRPOS 0x30 | 86 | #define IDX_IO_REC_DMA_CURRPOS 0x30 /* PU:0x00000000 */ |
86 | #define IDX_IO_REC_DMA_CURROFS 0x34 | 87 | #define IDX_IO_REC_DMA_CURROFS 0x34 /* PU:0x00000000 */ |
87 | #define IDX_IO_REC_SOUNDFORMAT 0x36 | 88 | #define IDX_IO_REC_SOUNDFORMAT 0x36 /* PU:0x0000 */ |
88 | /* some third area ? (after playback and recording) */ | 89 | |
89 | #define IDX_IO_SOMETHING_FLAGS 0x40 /* gets set to 0x34 just like port 0x0 and 0x20 on card init */ | 90 | /** hmm, what is this I/O area for? MPU401?? (after playback, recording, ???, timer) **/ |
91 | #define IDX_IO_SOMETHING_FLAGS 0x40 /* gets set to 0x34 just like port 0x0 and 0x20 on card init, PU:0x0000 */ | ||
90 | /* general */ | 92 | /* general */ |
91 | #define IDX_IO_60H 0x60 /* writing 0xffff returns 0xffff */ | 93 | #define IDX_IO_42H 0x42 /* PU:0x0001 */ |
92 | #define IDX_IO_62H 0x62 /* writing to WORD 0x0062 can hang the box ! --> responsible for IRQ management as a whole ?? */ | 94 | |
93 | #define IDX_IO_IRQ63H 0x63 /* FIXME !! */ | 95 | /** DirectX timer, main interrupt area (FIXME: and something else?) **/ |
94 | #define IO_IRQ63H_SOMETHING 0x04 /* being set in IRQ handler in case port 0x00 had 0x0020 set upon IRQ handler */ | 96 | #define IDX_IO_TIMER_VALUE 0x60 /* found this timer area by pure luck :-) */ |
97 | #define TIMER_VALUE_MASK 0x000fffffUL /* timer countdown value; triggers IRQ when timer is finished */ | ||
98 | #define TIMER_ENABLE_COUNTDOWN 0x01000000UL /* activate the timer countdown */ | ||
99 | #define TIMER_ENABLE_IRQ 0x02000000UL /* trigger timer IRQ on zero transition */ | ||
100 | #define TIMER_ACK_IRQ 0x04000000UL /* being set in IRQ handler in case port 0x00 (hmm, not port 0x64!?!?) had 0x0020 set upon IRQ handler */ | ||
95 | #define IDX_IO_IRQSTATUS 0x64 | 101 | #define IDX_IO_IRQSTATUS 0x64 |
96 | #define IRQ_PLAYBACK 0x0001 | 102 | #define IRQ_PLAYBACK 0x0001 |
97 | #define IRQ_RECORDING 0x0002 | 103 | #define IRQ_RECORDING 0x0002 |
98 | #define IRQ_MPU401 0x0010 | 104 | #define IRQ_MPU401 0x0010 |
99 | #define IRQ_SOMEIRQ 0x0020 /* ???? */ | 105 | #define IRQ_TIMER 0x0020 /* DirectX timer */ |
100 | #define IRQ_WHO_KNOWS_UNUSED 0x00e0 /* probably unused */ | 106 | #define IRQ_UNKNOWN1 0x0040 /* probably unused */ |
107 | #define IRQ_UNKNOWN2 0x0080 /* probably unused */ | ||
101 | #define IDX_IO_66H 0x66 /* writing 0xffff returns 0x0000 */ | 108 | #define IDX_IO_66H 0x66 /* writing 0xffff returns 0x0000 */ |
102 | #define IDX_IO_SOME_VALUE 0x68 /* this is always set to 0x3ff, and writable; maybe some buffer limit, but I couldn't find out more */ | 109 | #define IDX_IO_SOME_VALUE 0x68 /* this is set to e.g. 0x3ff or 0x300, and writable; maybe some buffer limit, but I couldn't find out more, PU:0x00ff */ |
103 | #define IDX_IO_6AH 0x6A /* this WORD can be set to have bits 0x0028 activated; actually inhibits PCM playback !!! maybe power management ?? */ | 110 | #define IDX_IO_6AH 0x6A /* this WORD can be set to have bits 0x0028 activated; actually inhibits PCM playback!!! maybe power management?? */ |
104 | #define IDX_IO_6CH 0x6C /* this WORD can have all its bits activated ? */ | 111 | #define IDX_IO_6CH 0x6C |
105 | #define IDX_IO_6EH 0x6E /* writing 0xffff returns 0x83fe */ | 112 | #define IDX_IO_6EH 0x6E /* writing 0xffff returns 0x83fe */ |
106 | /* further I/O indices not saved/restored, so probably not used */ | 113 | /* further I/O indices not saved/restored, so probably not used */ |
107 | 114 | ||
115 | |||
108 | /*** I/O 2 area port indices ***/ | 116 | /*** I/O 2 area port indices ***/ |
109 | /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ | 117 | /* (only 0x06 of 0x08 bytes saved/restored by Windows driver) */ |
110 | #define IDX_IO2_LEGACY_ADDR 0x04 | 118 | #define IDX_IO2_LEGACY_ADDR 0x04 |
111 | #define LEGACY_SOMETHING 0x01 /* OPL3 ?? */ | 119 | #define LEGACY_SOMETHING 0x01 /* OPL3?? */ |
112 | #define LEGACY_JOY 0x08 | 120 | #define LEGACY_JOY 0x08 |
113 | 121 | ||
122 | |||
114 | /*** mixer I/O area port indices ***/ | 123 | /*** mixer I/O area port indices ***/ |
115 | /* (only 0x22 of 0x40 bytes saved/restored by Windows driver) | 124 | /* (only 0x22 of 0x40 bytes saved/restored by Windows driver) |
116 | * generally spoken: AC97 register index = AZF3328 mixer reg index + 2 | 125 | * generally spoken: AC97 register index = AZF3328 mixer reg index + 2 |
@@ -148,18 +157,18 @@ | |||
148 | /* unlisted bits are unmodifiable */ | 157 | /* unlisted bits are unmodifiable */ |
149 | #define MIXER_ADVCTL1_3DWIDTH_MASK 0x000e | 158 | #define MIXER_ADVCTL1_3DWIDTH_MASK 0x000e |
150 | #define MIXER_ADVCTL1_HIFI3D_MASK 0x0300 | 159 | #define MIXER_ADVCTL1_HIFI3D_MASK 0x0300 |
151 | #define IDX_MIXER_ADVCTL2 0x20 /* resembles AC97_GENERAL_PURPOSE reg ! */ | 160 | #define IDX_MIXER_ADVCTL2 0x20 /* resembles AC97_GENERAL_PURPOSE reg! */ |
152 | /* unlisted bits are unmodifiable */ | 161 | /* unlisted bits are unmodifiable */ |
153 | #define MIXER_ADVCTL2_BIT7 0x0080 /* WaveOut 3D Bypass ? mutes WaveOut at LineOut */ | 162 | #define MIXER_ADVCTL2_BIT7 0x0080 /* WaveOut 3D Bypass? mutes WaveOut at LineOut */ |
154 | #define MIXER_ADVCTL2_BIT8 0x0100 /* is this Modem Out Select ? */ | 163 | #define MIXER_ADVCTL2_BIT8 0x0100 /* is this Modem Out Select? */ |
155 | #define MIXER_ADVCTL2_BIT9 0x0200 /* Mono Select Source ? */ | 164 | #define MIXER_ADVCTL2_BIT9 0x0200 /* Mono Select Source? */ |
156 | #define MIXER_ADVCTL2_BIT13 0x2000 /* 3D enable ? */ | 165 | #define MIXER_ADVCTL2_BIT13 0x2000 /* 3D enable? */ |
157 | #define MIXER_ADVCTL2_BIT15 0x8000 /* unknown */ | 166 | #define MIXER_ADVCTL2_BIT15 0x8000 /* unknown */ |
158 | 167 | ||
159 | #define IDX_MIXER_SOMETHING30H 0x30 /* used, but unknown ??? */ | 168 | #define IDX_MIXER_SOMETHING30H 0x30 /* used, but unknown??? */ |
160 | 169 | ||
161 | /* driver internal flags */ | 170 | /* driver internal flags */ |
162 | #define SET_CHAN_LEFT 1 | 171 | #define SET_CHAN_LEFT 1 |
163 | #define SET_CHAN_RIGHT 2 | 172 | #define SET_CHAN_RIGHT 2 |
164 | 173 | ||
165 | #endif /* __SOUND_AZF3328_H */ | 174 | #endif /* __SOUND_AZT3328_H */ |
diff --git a/sound/pci/ca0106/Makefile b/sound/pci/ca0106/Makefile index 89c6ceee21f3..dcbae7b31546 100644 --- a/sound/pci/ca0106/Makefile +++ b/sound/pci/ca0106/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | snd-ca0106-objs := ca0106_main.o ca0106_proc.o ca0106_mixer.o | 1 | snd-ca0106-objs := ca0106_main.o ca0106_proc.o ca0106_mixer.o ca_midi.o |
2 | 2 | ||
3 | obj-$(CONFIG_SND_CA0106) += snd-ca0106.o | 3 | obj-$(CONFIG_SND_CA0106) += snd-ca0106.o |
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h index da09cab405a9..9a4b6406f7a5 100644 --- a/sound/pci/ca0106/ca0106.h +++ b/sound/pci/ca0106/ca0106.h | |||
@@ -399,10 +399,24 @@ | |||
399 | #define PLAYBACK_VOLUME2 0x6a /* Playback Analog volume per channel. Does not effect AC3 output */ | 399 | #define PLAYBACK_VOLUME2 0x6a /* Playback Analog volume per channel. Does not effect AC3 output */ |
400 | /* Similar to register 0x66, except that the destination is the I2S mixer instead of the SPDIF mixer. I.E. Outputs to the Analog outputs instead of SPDIF. */ | 400 | /* Similar to register 0x66, except that the destination is the I2S mixer instead of the SPDIF mixer. I.E. Outputs to the Analog outputs instead of SPDIF. */ |
401 | #define UNKNOWN6b 0x6b /* Unknown. Readonly. Default 00400000 00400000 00400000 00400000 */ | 401 | #define UNKNOWN6b 0x6b /* Unknown. Readonly. Default 00400000 00400000 00400000 00400000 */ |
402 | #define UART_A_DATA 0x6c /* Uart, used in setting sample rates, bits per sample etc. */ | 402 | #define MIDI_UART_A_DATA 0x6c /* Midi Uart A Data */ |
403 | #define UART_A_CMD 0x6d /* Uart, used in setting sample rates, bits per sample etc. */ | 403 | #define MIDI_UART_A_CMD 0x6d /* Midi Uart A Command/Status */ |
404 | #define UART_B_DATA 0x6e /* Uart, Unknown. */ | 404 | #define MIDI_UART_B_DATA 0x6e /* Midi Uart B Data (currently unused) */ |
405 | #define UART_B_CMD 0x6f /* Uart, Unknown. */ | 405 | #define MIDI_UART_B_CMD 0x6f /* Midi Uart B Command/Status (currently unused) */ |
406 | |||
407 | /* unique channel identifier for midi->channel */ | ||
408 | |||
409 | #define CA0106_MIDI_CHAN_A 0x1 | ||
410 | #define CA0106_MIDI_CHAN_B 0x2 | ||
411 | |||
412 | /* from mpu401 */ | ||
413 | |||
414 | #define CA0106_MIDI_INPUT_AVAIL 0x80 | ||
415 | #define CA0106_MIDI_OUTPUT_READY 0x40 | ||
416 | #define CA0106_MPU401_RESET 0xff | ||
417 | #define CA0106_MPU401_ENTER_UART 0x3f | ||
418 | #define CA0106_MPU401_ACK 0xfe | ||
419 | |||
406 | #define SAMPLE_RATE_TRACKER_STATUS 0x70 /* Readonly. Default 00108000 00108000 00500000 00500000 */ | 420 | #define SAMPLE_RATE_TRACKER_STATUS 0x70 /* Readonly. Default 00108000 00108000 00500000 00500000 */ |
407 | /* Estimated sample rate [19:0] Relative to 48kHz. 0x8000 = 1.0 | 421 | /* Estimated sample rate [19:0] Relative to 48kHz. 0x8000 = 1.0 |
408 | * Rate Locked [20] | 422 | * Rate Locked [20] |
@@ -538,6 +552,8 @@ | |||
538 | #define CONTROL_CENTER_LFE_CHANNEL 1 | 552 | #define CONTROL_CENTER_LFE_CHANNEL 1 |
539 | #define CONTROL_UNKNOWN_CHANNEL 2 | 553 | #define CONTROL_UNKNOWN_CHANNEL 2 |
540 | 554 | ||
555 | #include "ca_midi.h" | ||
556 | |||
541 | typedef struct snd_ca0106_channel ca0106_channel_t; | 557 | typedef struct snd_ca0106_channel ca0106_channel_t; |
542 | typedef struct snd_ca0106 ca0106_t; | 558 | typedef struct snd_ca0106 ca0106_t; |
543 | typedef struct snd_ca0106_pcm ca0106_pcm_t; | 559 | typedef struct snd_ca0106_pcm ca0106_pcm_t; |
@@ -592,6 +608,9 @@ struct snd_ca0106 { | |||
592 | int capture_mic_line_in; | 608 | int capture_mic_line_in; |
593 | 609 | ||
594 | struct snd_dma_buffer buffer; | 610 | struct snd_dma_buffer buffer; |
611 | |||
612 | ca_midi_t midi; | ||
613 | ca_midi_t midi2; | ||
595 | }; | 614 | }; |
596 | 615 | ||
597 | int __devinit snd_ca0106_mixer(ca0106_t *emu); | 616 | int __devinit snd_ca0106_mixer(ca0106_t *emu); |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index ba07960921d8..ee58d16002e5 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -281,7 +281,7 @@ int snd_ca0106_i2c_write(ca0106_t *emu, | |||
281 | int retry; | 281 | int retry; |
282 | if ((reg > 0x7f) || (value > 0x1ff)) | 282 | if ((reg > 0x7f) || (value > 0x1ff)) |
283 | { | 283 | { |
284 | snd_printk("i2c_write: invalid values.\n"); | 284 | snd_printk(KERN_ERR "i2c_write: invalid values.\n"); |
285 | return -EINVAL; | 285 | return -EINVAL; |
286 | } | 286 | } |
287 | 287 | ||
@@ -319,7 +319,7 @@ int snd_ca0106_i2c_write(ca0106_t *emu, | |||
319 | 319 | ||
320 | if(retry==10) | 320 | if(retry==10) |
321 | { | 321 | { |
322 | snd_printk("Writing to ADC failed!\n"); | 322 | snd_printk(KERN_ERR "Writing to ADC failed!\n"); |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | } | 324 | } |
325 | 325 | ||
@@ -338,6 +338,18 @@ static void snd_ca0106_intr_enable(ca0106_t *emu, unsigned int intrenb) | |||
338 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 338 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
339 | } | 339 | } |
340 | 340 | ||
341 | static void snd_ca0106_intr_disable(ca0106_t *emu, unsigned int intrenb) | ||
342 | { | ||
343 | unsigned long flags; | ||
344 | unsigned int enable; | ||
345 | |||
346 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
347 | enable = inl(emu->port + INTE) & ~intrenb; | ||
348 | outl(enable, emu->port + INTE); | ||
349 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
350 | } | ||
351 | |||
352 | |||
341 | static void snd_ca0106_pcm_free_substream(snd_pcm_runtime_t *runtime) | 353 | static void snd_ca0106_pcm_free_substream(snd_pcm_runtime_t *runtime) |
342 | { | 354 | { |
343 | kfree(runtime->private_data); | 355 | kfree(runtime->private_data); |
@@ -421,7 +433,7 @@ static int snd_ca0106_pcm_open_capture_channel(snd_pcm_substream_t *substream, i | |||
421 | 433 | ||
422 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); | 434 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
423 | if (epcm == NULL) { | 435 | if (epcm == NULL) { |
424 | snd_printk("open_capture_channel: failed epcm alloc\n"); | 436 | snd_printk(KERN_ERR "open_capture_channel: failed epcm alloc\n"); |
425 | return -ENOMEM; | 437 | return -ENOMEM; |
426 | } | 438 | } |
427 | epcm->emu = chip; | 439 | epcm->emu = chip; |
@@ -969,10 +981,8 @@ static int snd_ca0106_free(ca0106_t *chip) | |||
969 | #endif | 981 | #endif |
970 | 982 | ||
971 | // release the i/o port | 983 | // release the i/o port |
972 | if (chip->res_port) { | 984 | release_and_free_resource(chip->res_port); |
973 | release_resource(chip->res_port); | 985 | |
974 | kfree_nocheck(chip->res_port); | ||
975 | } | ||
976 | // release the irq | 986 | // release the irq |
977 | if (chip->irq >= 0) | 987 | if (chip->irq >= 0) |
978 | free_irq(chip->irq, (void *)chip); | 988 | free_irq(chip->irq, (void *)chip); |
@@ -1042,6 +1052,15 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id, | |||
1042 | 1052 | ||
1043 | snd_ca0106_ptr_write(chip, EXTENDED_INT, 0, stat76); | 1053 | snd_ca0106_ptr_write(chip, EXTENDED_INT, 0, stat76); |
1044 | spin_lock(&chip->emu_lock); | 1054 | spin_lock(&chip->emu_lock); |
1055 | |||
1056 | if (chip->midi.dev_id && | ||
1057 | (status & (chip->midi.ipr_tx|chip->midi.ipr_rx))) { | ||
1058 | if (chip->midi.interrupt) | ||
1059 | chip->midi.interrupt(&chip->midi, status); | ||
1060 | else | ||
1061 | chip->midi.interrupt_disable(&chip->midi, chip->midi.tx_enable | chip->midi.rx_enable); | ||
1062 | } | ||
1063 | |||
1045 | // acknowledge the interrupt if necessary | 1064 | // acknowledge the interrupt if necessary |
1046 | outl(status, chip->port+IPR); | 1065 | outl(status, chip->port+IPR); |
1047 | 1066 | ||
@@ -1311,6 +1330,88 @@ static int __devinit snd_ca0106_create(snd_card_t *card, | |||
1311 | return 0; | 1330 | return 0; |
1312 | } | 1331 | } |
1313 | 1332 | ||
1333 | |||
1334 | static void ca0106_midi_interrupt_enable(ca_midi_t *midi, int intr) | ||
1335 | { | ||
1336 | snd_ca0106_intr_enable((ca0106_t *)(midi->dev_id), intr); | ||
1337 | } | ||
1338 | |||
1339 | static void ca0106_midi_interrupt_disable(ca_midi_t *midi, int intr) | ||
1340 | { | ||
1341 | snd_ca0106_intr_disable((ca0106_t *)(midi->dev_id), intr); | ||
1342 | } | ||
1343 | |||
1344 | static unsigned char ca0106_midi_read(ca_midi_t *midi, int idx) | ||
1345 | { | ||
1346 | return (unsigned char)snd_ca0106_ptr_read((ca0106_t *)(midi->dev_id), midi->port + idx, 0); | ||
1347 | } | ||
1348 | |||
1349 | static void ca0106_midi_write(ca_midi_t *midi, int data, int idx) | ||
1350 | { | ||
1351 | snd_ca0106_ptr_write((ca0106_t *)(midi->dev_id), midi->port + idx, 0, data); | ||
1352 | } | ||
1353 | |||
1354 | static snd_card_t *ca0106_dev_id_card(void *dev_id) | ||
1355 | { | ||
1356 | return ((ca0106_t *)dev_id)->card; | ||
1357 | } | ||
1358 | |||
1359 | static int ca0106_dev_id_port(void *dev_id) | ||
1360 | { | ||
1361 | return ((ca0106_t *)dev_id)->port; | ||
1362 | } | ||
1363 | |||
1364 | static int __devinit snd_ca0106_midi(ca0106_t *chip, unsigned int channel) | ||
1365 | { | ||
1366 | ca_midi_t *midi; | ||
1367 | char *name; | ||
1368 | int err; | ||
1369 | |||
1370 | if(channel==CA0106_MIDI_CHAN_B) { | ||
1371 | name = "CA0106 MPU-401 (UART) B"; | ||
1372 | midi = &chip->midi2; | ||
1373 | midi->tx_enable = INTE_MIDI_TX_B; | ||
1374 | midi->rx_enable = INTE_MIDI_RX_B; | ||
1375 | midi->ipr_tx = IPR_MIDI_TX_B; | ||
1376 | midi->ipr_rx = IPR_MIDI_RX_B; | ||
1377 | midi->port = MIDI_UART_B_DATA; | ||
1378 | } else { | ||
1379 | name = "CA0106 MPU-401 (UART)"; | ||
1380 | midi = &chip->midi; | ||
1381 | midi->tx_enable = INTE_MIDI_TX_A; | ||
1382 | midi->rx_enable = INTE_MIDI_TX_B; | ||
1383 | midi->ipr_tx = IPR_MIDI_TX_A; | ||
1384 | midi->ipr_rx = IPR_MIDI_RX_A; | ||
1385 | midi->port = MIDI_UART_A_DATA; | ||
1386 | } | ||
1387 | |||
1388 | midi->reset = CA0106_MPU401_RESET; | ||
1389 | midi->enter_uart = CA0106_MPU401_ENTER_UART; | ||
1390 | midi->ack = CA0106_MPU401_ACK; | ||
1391 | |||
1392 | midi->input_avail = CA0106_MIDI_INPUT_AVAIL; | ||
1393 | midi->output_ready = CA0106_MIDI_OUTPUT_READY; | ||
1394 | |||
1395 | midi->channel = channel; | ||
1396 | |||
1397 | midi->interrupt_enable = ca0106_midi_interrupt_enable; | ||
1398 | midi->interrupt_disable = ca0106_midi_interrupt_disable; | ||
1399 | |||
1400 | midi->read = ca0106_midi_read; | ||
1401 | midi->write = ca0106_midi_write; | ||
1402 | |||
1403 | midi->get_dev_id_card = ca0106_dev_id_card; | ||
1404 | midi->get_dev_id_port = ca0106_dev_id_port; | ||
1405 | |||
1406 | midi->dev_id = chip; | ||
1407 | |||
1408 | if ((err = ca_midi_init(chip, midi, 0, name)) < 0) | ||
1409 | return err; | ||
1410 | |||
1411 | return 0; | ||
1412 | } | ||
1413 | |||
1414 | |||
1314 | static int __devinit snd_ca0106_probe(struct pci_dev *pci, | 1415 | static int __devinit snd_ca0106_probe(struct pci_dev *pci, |
1315 | const struct pci_device_id *pci_id) | 1416 | const struct pci_device_id *pci_id) |
1316 | { | 1417 | { |
@@ -1362,6 +1463,14 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1362 | return err; | 1463 | return err; |
1363 | } | 1464 | } |
1364 | 1465 | ||
1466 | snd_printdd("ca0106: probe for MIDI channel A ..."); | ||
1467 | if ((err = snd_ca0106_midi(chip,CA0106_MIDI_CHAN_A)) < 0) { | ||
1468 | snd_card_free(card); | ||
1469 | snd_printdd(" failed, err=0x%x\n",err); | ||
1470 | return err; | ||
1471 | } | ||
1472 | snd_printdd(" done.\n"); | ||
1473 | |||
1365 | snd_ca0106_proc_init(chip); | 1474 | snd_ca0106_proc_init(chip); |
1366 | 1475 | ||
1367 | if ((err = snd_card_register(card)) < 0) { | 1476 | if ((err = snd_card_register(card)) < 0) { |
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c new file mode 100644 index 000000000000..2e08b27b8349 --- /dev/null +++ b/sound/pci/ca0106/ca_midi.c | |||
@@ -0,0 +1,306 @@ | |||
1 | /* | ||
2 | * Copyright 10/16/2005 Tilman Kranz <tilde@tk-sls.de> | ||
3 | * Creative Audio MIDI, for the CA0106 Driver | ||
4 | * Version: 0.0.1 | ||
5 | * | ||
6 | * Changelog: | ||
7 | * Implementation is based on mpu401 and emu10k1x and | ||
8 | * tested with ca0106. | ||
9 | * mpu401: Copyright (c) by Jaroslav Kysela <perex@suse.cz> | ||
10 | * emu10k1x: Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
25 | * | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/spinlock.h> | ||
30 | #include <sound/driver.h> | ||
31 | #include <sound/core.h> | ||
32 | #include <sound/rawmidi.h> | ||
33 | |||
34 | #include "ca_midi.h" | ||
35 | |||
36 | #define ca_midi_write_data(midi, data) midi->write(midi, data, 0) | ||
37 | #define ca_midi_write_cmd(midi, data) midi->write(midi, data, 1) | ||
38 | #define ca_midi_read_data(midi) midi->read(midi, 0) | ||
39 | #define ca_midi_read_stat(midi) midi->read(midi, 1) | ||
40 | #define ca_midi_input_avail(midi) (!(ca_midi_read_stat(midi) & midi->input_avail)) | ||
41 | #define ca_midi_output_ready(midi) (!(ca_midi_read_stat(midi) & midi->output_ready)) | ||
42 | |||
43 | static void ca_midi_clear_rx(ca_midi_t *midi) | ||
44 | { | ||
45 | int timeout = 100000; | ||
46 | for (; timeout > 0 && ca_midi_input_avail(midi); timeout--) | ||
47 | ca_midi_read_data(midi); | ||
48 | #ifdef CONFIG_SND_DEBUG | ||
49 | if (timeout <= 0) | ||
50 | snd_printk(KERN_ERR "ca_midi_clear_rx: timeout (status = 0x%x)\n", ca_midi_read_stat(midi)); | ||
51 | #endif | ||
52 | } | ||
53 | |||
54 | static void ca_midi_interrupt(ca_midi_t *midi, unsigned int status) { | ||
55 | unsigned char byte; | ||
56 | |||
57 | if (midi->rmidi == NULL) { | ||
58 | midi->interrupt_disable(midi,midi->tx_enable | midi->rx_enable); | ||
59 | return; | ||
60 | } | ||
61 | |||
62 | spin_lock(&midi->input_lock); | ||
63 | if ((status & midi->ipr_rx) && ca_midi_input_avail(midi)) { | ||
64 | if (!(midi->midi_mode & CA_MIDI_MODE_INPUT)) { | ||
65 | ca_midi_clear_rx(midi); | ||
66 | } else { | ||
67 | byte = ca_midi_read_data(midi); | ||
68 | if(midi->substream_input) | ||
69 | snd_rawmidi_receive(midi->substream_input, &byte, 1); | ||
70 | |||
71 | |||
72 | } | ||
73 | } | ||
74 | spin_unlock(&midi->input_lock); | ||
75 | |||
76 | spin_lock(&midi->output_lock); | ||
77 | if ((status & midi->ipr_tx) && ca_midi_output_ready(midi)) { | ||
78 | if (midi->substream_output && | ||
79 | snd_rawmidi_transmit(midi->substream_output, &byte, 1) == 1) { | ||
80 | ca_midi_write_data(midi, byte); | ||
81 | } else { | ||
82 | midi->interrupt_disable(midi,midi->tx_enable); | ||
83 | } | ||
84 | } | ||
85 | spin_unlock(&midi->output_lock); | ||
86 | |||
87 | } | ||
88 | |||
89 | static void ca_midi_cmd(ca_midi_t *midi, unsigned char cmd, int ack) | ||
90 | { | ||
91 | unsigned long flags; | ||
92 | int timeout, ok; | ||
93 | |||
94 | spin_lock_irqsave(&midi->input_lock, flags); | ||
95 | ca_midi_write_data(midi, 0x00); | ||
96 | /* ca_midi_clear_rx(midi); */ | ||
97 | |||
98 | ca_midi_write_cmd(midi, cmd); | ||
99 | if (ack) { | ||
100 | ok = 0; | ||
101 | timeout = 10000; | ||
102 | while (!ok && timeout-- > 0) { | ||
103 | if (ca_midi_input_avail(midi)) { | ||
104 | if (ca_midi_read_data(midi) == midi->ack) | ||
105 | ok = 1; | ||
106 | } | ||
107 | } | ||
108 | if (!ok && ca_midi_read_data(midi) == midi->ack) | ||
109 | ok = 1; | ||
110 | } else { | ||
111 | ok = 1; | ||
112 | } | ||
113 | spin_unlock_irqrestore(&midi->input_lock, flags); | ||
114 | if (!ok) | ||
115 | snd_printk(KERN_ERR "ca_midi_cmd: 0x%x failed at 0x%x (status = 0x%x, data = 0x%x)!!!\n", | ||
116 | cmd, | ||
117 | midi->get_dev_id_port(midi->dev_id), | ||
118 | ca_midi_read_stat(midi), | ||
119 | ca_midi_read_data(midi)); | ||
120 | } | ||
121 | |||
122 | static int ca_midi_input_open(snd_rawmidi_substream_t * substream) | ||
123 | { | ||
124 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
125 | unsigned long flags; | ||
126 | |||
127 | snd_assert(midi->dev_id, return -ENXIO); | ||
128 | spin_lock_irqsave(&midi->open_lock, flags); | ||
129 | midi->midi_mode |= CA_MIDI_MODE_INPUT; | ||
130 | midi->substream_input = substream; | ||
131 | if (!(midi->midi_mode & CA_MIDI_MODE_OUTPUT)) { | ||
132 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
133 | ca_midi_cmd(midi, midi->reset, 1); | ||
134 | ca_midi_cmd(midi, midi->enter_uart, 1); | ||
135 | } else { | ||
136 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
137 | } | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | static int ca_midi_output_open(snd_rawmidi_substream_t * substream) | ||
142 | { | ||
143 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
144 | unsigned long flags; | ||
145 | |||
146 | snd_assert(midi->dev_id, return -ENXIO); | ||
147 | spin_lock_irqsave(&midi->open_lock, flags); | ||
148 | midi->midi_mode |= CA_MIDI_MODE_OUTPUT; | ||
149 | midi->substream_output = substream; | ||
150 | if (!(midi->midi_mode & CA_MIDI_MODE_INPUT)) { | ||
151 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
152 | ca_midi_cmd(midi, midi->reset, 1); | ||
153 | ca_midi_cmd(midi, midi->enter_uart, 1); | ||
154 | } else { | ||
155 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
156 | } | ||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static int ca_midi_input_close(snd_rawmidi_substream_t * substream) | ||
161 | { | ||
162 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
163 | unsigned long flags; | ||
164 | |||
165 | snd_assert(midi->dev_id, return -ENXIO); | ||
166 | spin_lock_irqsave(&midi->open_lock, flags); | ||
167 | midi->interrupt_disable(midi,midi->rx_enable); | ||
168 | midi->midi_mode &= ~CA_MIDI_MODE_INPUT; | ||
169 | midi->substream_input = NULL; | ||
170 | if (!(midi->midi_mode & CA_MIDI_MODE_OUTPUT)) { | ||
171 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
172 | ca_midi_cmd(midi, midi->reset, 0); | ||
173 | } else { | ||
174 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
175 | } | ||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static int ca_midi_output_close(snd_rawmidi_substream_t * substream) | ||
180 | { | ||
181 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
182 | unsigned long flags; | ||
183 | snd_assert(midi->dev_id, return -ENXIO); | ||
184 | |||
185 | spin_lock_irqsave(&midi->open_lock, flags); | ||
186 | |||
187 | midi->interrupt_disable(midi,midi->tx_enable); | ||
188 | midi->midi_mode &= ~CA_MIDI_MODE_OUTPUT; | ||
189 | midi->substream_output = NULL; | ||
190 | |||
191 | if (!(midi->midi_mode & CA_MIDI_MODE_INPUT)) { | ||
192 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
193 | ca_midi_cmd(midi, midi->reset, 0); | ||
194 | } else { | ||
195 | spin_unlock_irqrestore(&midi->open_lock, flags); | ||
196 | } | ||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void ca_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) | ||
201 | { | ||
202 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
203 | snd_assert(midi->dev_id, return); | ||
204 | |||
205 | if (up) { | ||
206 | midi->interrupt_enable(midi,midi->rx_enable); | ||
207 | } else { | ||
208 | midi->interrupt_disable(midi, midi->rx_enable); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | static void ca_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) | ||
213 | { | ||
214 | ca_midi_t *midi = (ca_midi_t *)substream->rmidi->private_data; | ||
215 | unsigned long flags; | ||
216 | |||
217 | snd_assert(midi->dev_id, return); | ||
218 | |||
219 | if (up) { | ||
220 | int max = 4; | ||
221 | unsigned char byte; | ||
222 | |||
223 | spin_lock_irqsave(&midi->output_lock, flags); | ||
224 | |||
225 | /* try to send some amount of bytes here before interrupts */ | ||
226 | while (max > 0) { | ||
227 | if (ca_midi_output_ready(midi)) { | ||
228 | if (!(midi->midi_mode & CA_MIDI_MODE_OUTPUT) || | ||
229 | snd_rawmidi_transmit(substream, &byte, 1) != 1) { | ||
230 | /* no more data */ | ||
231 | spin_unlock_irqrestore(&midi->output_lock, flags); | ||
232 | return; | ||
233 | } | ||
234 | ca_midi_write_data(midi, byte); | ||
235 | max--; | ||
236 | } else { | ||
237 | break; | ||
238 | } | ||
239 | } | ||
240 | |||
241 | spin_unlock_irqrestore(&midi->output_lock, flags); | ||
242 | midi->interrupt_enable(midi,midi->tx_enable); | ||
243 | |||
244 | } else { | ||
245 | midi->interrupt_disable(midi,midi->tx_enable); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | static snd_rawmidi_ops_t ca_midi_output = | ||
250 | { | ||
251 | .open = ca_midi_output_open, | ||
252 | .close = ca_midi_output_close, | ||
253 | .trigger = ca_midi_output_trigger, | ||
254 | }; | ||
255 | |||
256 | static snd_rawmidi_ops_t ca_midi_input = | ||
257 | { | ||
258 | .open = ca_midi_input_open, | ||
259 | .close = ca_midi_input_close, | ||
260 | .trigger = ca_midi_input_trigger, | ||
261 | }; | ||
262 | |||
263 | static void ca_midi_free(ca_midi_t *midi) { | ||
264 | midi->interrupt = NULL; | ||
265 | midi->interrupt_enable = NULL; | ||
266 | midi->interrupt_disable = NULL; | ||
267 | midi->read = NULL; | ||
268 | midi->write = NULL; | ||
269 | midi->get_dev_id_card = NULL; | ||
270 | midi->get_dev_id_port = NULL; | ||
271 | midi->rmidi = NULL; | ||
272 | } | ||
273 | |||
274 | static void ca_rmidi_free(snd_rawmidi_t *rmidi) | ||
275 | { | ||
276 | ca_midi_free((ca_midi_t *)rmidi->private_data); | ||
277 | } | ||
278 | |||
279 | int __devinit ca_midi_init(void *dev_id, ca_midi_t *midi, int device, char *name) | ||
280 | { | ||
281 | snd_rawmidi_t *rmidi; | ||
282 | int err; | ||
283 | |||
284 | if ((err = snd_rawmidi_new(midi->get_dev_id_card(midi->dev_id), name, device, 1, 1, &rmidi)) < 0) | ||
285 | return err; | ||
286 | |||
287 | midi->dev_id = dev_id; | ||
288 | midi->interrupt = ca_midi_interrupt; | ||
289 | |||
290 | spin_lock_init(&midi->open_lock); | ||
291 | spin_lock_init(&midi->input_lock); | ||
292 | spin_lock_init(&midi->output_lock); | ||
293 | |||
294 | strcpy(rmidi->name, name); | ||
295 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &ca_midi_output); | ||
296 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &ca_midi_input); | ||
297 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | | ||
298 | SNDRV_RAWMIDI_INFO_INPUT | | ||
299 | SNDRV_RAWMIDI_INFO_DUPLEX; | ||
300 | rmidi->private_data = midi; | ||
301 | rmidi->private_free = ca_rmidi_free; | ||
302 | |||
303 | midi->rmidi = rmidi; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
diff --git a/sound/pci/ca0106/ca_midi.h b/sound/pci/ca0106/ca_midi.h new file mode 100644 index 000000000000..b452cec2bf57 --- /dev/null +++ b/sound/pci/ca0106/ca_midi.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright 10/16/2005 Tilman Kranz <tilde@tk-sls.de> | ||
3 | * Creative Audio MIDI, for the CA0106 Driver | ||
4 | * Version: 0.0.1 | ||
5 | * | ||
6 | * Changelog: | ||
7 | * See ca_midi.c | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include<linux/spinlock.h> | ||
26 | #include<sound/rawmidi.h> | ||
27 | #include<sound/mpu401.h> | ||
28 | |||
29 | #define CA_MIDI_MODE_INPUT MPU401_MODE_INPUT | ||
30 | #define CA_MIDI_MODE_OUTPUT MPU401_MODE_OUTPUT | ||
31 | |||
32 | typedef struct ca_midi ca_midi_t; | ||
33 | struct ca_midi { | ||
34 | |||
35 | snd_rawmidi_t *rmidi; | ||
36 | snd_rawmidi_substream_t *substream_input; | ||
37 | snd_rawmidi_substream_t *substream_output; | ||
38 | |||
39 | void *dev_id; | ||
40 | |||
41 | spinlock_t input_lock; | ||
42 | spinlock_t output_lock; | ||
43 | spinlock_t open_lock; | ||
44 | |||
45 | unsigned int channel; | ||
46 | |||
47 | unsigned int midi_mode; | ||
48 | int port; | ||
49 | int tx_enable, rx_enable; | ||
50 | int ipr_tx, ipr_rx; | ||
51 | |||
52 | int input_avail, output_ready; | ||
53 | int ack, reset, enter_uart; | ||
54 | |||
55 | void (*interrupt)(ca_midi_t *midi, unsigned int status); | ||
56 | void (*interrupt_enable)(ca_midi_t *midi, int intr); | ||
57 | void (*interrupt_disable)(ca_midi_t *midi, int intr); | ||
58 | |||
59 | unsigned char (*read)(ca_midi_t *midi, int idx); | ||
60 | void (*write)(ca_midi_t *midi, int data, int idx); | ||
61 | |||
62 | /* get info from dev_id */ | ||
63 | snd_card_t *(*get_dev_id_card)(void *dev_id); | ||
64 | int (*get_dev_id_port)(void *dev_id); | ||
65 | }; | ||
66 | |||
67 | int __devinit ca_midi_init(void *card, ca_midi_t *midi, int device, char *name); | ||
68 | |||
69 | |||
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1eb3315d136d..57e8e433d56f 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -446,9 +446,6 @@ struct snd_stru_cmipci { | |||
446 | snd_kcontrol_t *mixer_res_ctl[CM_SAVED_MIXERS]; | 446 | snd_kcontrol_t *mixer_res_ctl[CM_SAVED_MIXERS]; |
447 | int mixer_res_status[CM_SAVED_MIXERS]; | 447 | int mixer_res_status[CM_SAVED_MIXERS]; |
448 | 448 | ||
449 | opl3_t *opl3; | ||
450 | snd_hwdep_t *opl3hwdep; | ||
451 | |||
452 | cmipci_pcm_t channel[2]; /* ch0 - DAC, ch1 - ADC or 2nd DAC */ | 449 | cmipci_pcm_t channel[2]; /* ch0 - DAC, ch1 - ADC or 2nd DAC */ |
453 | 450 | ||
454 | /* external MIDI */ | 451 | /* external MIDI */ |
@@ -2686,8 +2683,7 @@ static int __devinit snd_cmipci_create_gameport(cmipci_t *cm, int dev) | |||
2686 | cm->gameport = gp = gameport_allocate_port(); | 2683 | cm->gameport = gp = gameport_allocate_port(); |
2687 | if (!gp) { | 2684 | if (!gp) { |
2688 | printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n"); | 2685 | printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n"); |
2689 | release_resource(r); | 2686 | release_and_free_resource(r); |
2690 | kfree_nocheck(r); | ||
2691 | return -ENOMEM; | 2687 | return -ENOMEM; |
2692 | } | 2688 | } |
2693 | gameport_set_name(gp, "C-Media Gameport"); | 2689 | gameport_set_name(gp, "C-Media Gameport"); |
@@ -2712,8 +2708,7 @@ static void snd_cmipci_free_gameport(cmipci_t *cm) | |||
2712 | cm->gameport = NULL; | 2708 | cm->gameport = NULL; |
2713 | 2709 | ||
2714 | snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN); | 2710 | snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN); |
2715 | release_resource(r); | 2711 | release_and_free_resource(r); |
2716 | kfree_nocheck(r); | ||
2717 | } | 2712 | } |
2718 | } | 2713 | } |
2719 | #else | 2714 | #else |
@@ -2753,6 +2748,51 @@ static int snd_cmipci_dev_free(snd_device_t *device) | |||
2753 | return snd_cmipci_free(cm); | 2748 | return snd_cmipci_free(cm); |
2754 | } | 2749 | } |
2755 | 2750 | ||
2751 | static int __devinit snd_cmipci_create_fm(cmipci_t *cm, long fm_port) | ||
2752 | { | ||
2753 | long iosynth; | ||
2754 | unsigned int val; | ||
2755 | opl3_t *opl3; | ||
2756 | int err; | ||
2757 | |||
2758 | /* first try FM regs in PCI port range */ | ||
2759 | iosynth = cm->iobase + CM_REG_FM_PCI; | ||
2760 | err = snd_opl3_create(cm->card, iosynth, iosynth + 2, | ||
2761 | OPL3_HW_OPL3, 1, &opl3); | ||
2762 | if (err < 0) { | ||
2763 | /* then try legacy ports */ | ||
2764 | val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK; | ||
2765 | iosynth = fm_port; | ||
2766 | switch (iosynth) { | ||
2767 | case 0x3E8: val |= CM_FMSEL_3E8; break; | ||
2768 | case 0x3E0: val |= CM_FMSEL_3E0; break; | ||
2769 | case 0x3C8: val |= CM_FMSEL_3C8; break; | ||
2770 | case 0x388: val |= CM_FMSEL_388; break; | ||
2771 | default: | ||
2772 | return 0; | ||
2773 | } | ||
2774 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); | ||
2775 | /* enable FM */ | ||
2776 | snd_cmipci_set_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2777 | |||
2778 | if (snd_opl3_create(cm->card, iosynth, iosynth + 2, | ||
2779 | OPL3_HW_OPL3, 0, &opl3) < 0) { | ||
2780 | printk(KERN_ERR "cmipci: no OPL device at %#lx, " | ||
2781 | "skipping...\n", iosynth); | ||
2782 | /* disable FM */ | ||
2783 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, | ||
2784 | val & ~CM_FMSEL_MASK); | ||
2785 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2786 | return 0; | ||
2787 | } | ||
2788 | } | ||
2789 | if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | ||
2790 | printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n"); | ||
2791 | return err; | ||
2792 | } | ||
2793 | return 0; | ||
2794 | } | ||
2795 | |||
2756 | static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | 2796 | static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, |
2757 | int dev, cmipci_t **rcmipci) | 2797 | int dev, cmipci_t **rcmipci) |
2758 | { | 2798 | { |
@@ -2762,8 +2802,8 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2762 | .dev_free = snd_cmipci_dev_free, | 2802 | .dev_free = snd_cmipci_dev_free, |
2763 | }; | 2803 | }; |
2764 | unsigned int val = 0; | 2804 | unsigned int val = 0; |
2765 | long iomidi = mpu_port[dev]; | 2805 | long iomidi; |
2766 | long iosynth = fm_port[dev]; | 2806 | int integrated_midi; |
2767 | int pcm_index, pcm_spdif_index; | 2807 | int pcm_index, pcm_spdif_index; |
2768 | static struct pci_device_id intel_82437vx[] = { | 2808 | static struct pci_device_id intel_82437vx[] = { |
2769 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) }, | 2809 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) }, |
@@ -2799,7 +2839,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2799 | cm->iobase = pci_resource_start(pci, 0); | 2839 | cm->iobase = pci_resource_start(pci, 0); |
2800 | 2840 | ||
2801 | if (request_irq(pci->irq, snd_cmipci_interrupt, SA_INTERRUPT|SA_SHIRQ, card->driver, (void *)cm)) { | 2841 | if (request_irq(pci->irq, snd_cmipci_interrupt, SA_INTERRUPT|SA_SHIRQ, card->driver, (void *)cm)) { |
2802 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2842 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2803 | snd_cmipci_free(cm); | 2843 | snd_cmipci_free(cm); |
2804 | return -EBUSY; | 2844 | return -EBUSY; |
2805 | } | 2845 | } |
@@ -2867,52 +2907,28 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2867 | return err; | 2907 | return err; |
2868 | } | 2908 | } |
2869 | 2909 | ||
2870 | /* set MPU address */ | 2910 | integrated_midi = snd_cmipci_read_b(cm, CM_REG_MPU_PCI) != 0xff; |
2871 | switch (iomidi) { | 2911 | if (integrated_midi) |
2872 | case 0x320: val = CM_VMPU_320; break; | 2912 | iomidi = cm->iobase + CM_REG_MPU_PCI; |
2873 | case 0x310: val = CM_VMPU_310; break; | 2913 | else { |
2874 | case 0x300: val = CM_VMPU_300; break; | 2914 | iomidi = mpu_port[dev]; |
2875 | case 0x330: val = CM_VMPU_330; break; | 2915 | switch (iomidi) { |
2876 | default: | 2916 | case 0x320: val = CM_VMPU_320; break; |
2877 | iomidi = 0; break; | 2917 | case 0x310: val = CM_VMPU_310; break; |
2878 | } | 2918 | case 0x300: val = CM_VMPU_300; break; |
2879 | if (iomidi > 0) { | 2919 | case 0x330: val = CM_VMPU_330; break; |
2880 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); | 2920 | default: |
2881 | /* enable UART */ | 2921 | iomidi = 0; break; |
2882 | snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN); | 2922 | } |
2883 | } | 2923 | if (iomidi > 0) { |
2884 | 2924 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); | |
2885 | /* set FM address */ | 2925 | /* enable UART */ |
2886 | val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK; | 2926 | snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN); |
2887 | switch (iosynth) { | ||
2888 | case 0x3E8: val |= CM_FMSEL_3E8; break; | ||
2889 | case 0x3E0: val |= CM_FMSEL_3E0; break; | ||
2890 | case 0x3C8: val |= CM_FMSEL_3C8; break; | ||
2891 | case 0x388: val |= CM_FMSEL_388; break; | ||
2892 | default: | ||
2893 | iosynth = 0; break; | ||
2894 | } | ||
2895 | if (iosynth > 0) { | ||
2896 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); | ||
2897 | /* enable FM */ | ||
2898 | snd_cmipci_set_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2899 | |||
2900 | if (snd_opl3_create(card, iosynth, iosynth + 2, | ||
2901 | OPL3_HW_OPL3, 0, &cm->opl3) < 0) { | ||
2902 | printk(KERN_ERR "cmipci: no OPL device at 0x%lx, skipping...\n", iosynth); | ||
2903 | iosynth = 0; | ||
2904 | } else { | ||
2905 | if ((err = snd_opl3_hwdep_new(cm->opl3, 0, 1, &cm->opl3hwdep)) < 0) { | ||
2906 | printk(KERN_ERR "cmipci: cannot create OPL3 hwdep\n"); | ||
2907 | return err; | ||
2908 | } | ||
2909 | } | 2927 | } |
2910 | } | 2928 | } |
2911 | if (! iosynth) { | 2929 | |
2912 | /* disable FM */ | 2930 | if ((err = snd_cmipci_create_fm(cm, fm_port[dev])) < 0) |
2913 | snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val & ~CM_FMSEL_MASK); | 2931 | return err; |
2914 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | ||
2915 | } | ||
2916 | 2932 | ||
2917 | /* reset mixer */ | 2933 | /* reset mixer */ |
2918 | snd_cmipci_mixer_write(cm, 0, 0); | 2934 | snd_cmipci_mixer_write(cm, 0, 0); |
@@ -2941,7 +2957,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2941 | 2957 | ||
2942 | if (iomidi > 0) { | 2958 | if (iomidi > 0) { |
2943 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, | 2959 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, |
2944 | iomidi, 0, | 2960 | iomidi, integrated_midi, |
2945 | cm->irq, 0, &cm->rmidi)) < 0) { | 2961 | cm->irq, 0, &cm->rmidi)) < 0) { |
2946 | printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi); | 2962 | printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi); |
2947 | } | 2963 | } |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index dc87e0144b5a..aea2c47712f9 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -523,8 +523,7 @@ static void snd_cs4281_delay(unsigned int delay) | |||
523 | delay = 1; | 523 | delay = 1; |
524 | end_time = jiffies + delay; | 524 | end_time = jiffies + delay; |
525 | do { | 525 | do { |
526 | set_current_state(TASK_UNINTERRUPTIBLE); | 526 | schedule_timeout_uninterruptible(1); |
527 | schedule_timeout(1); | ||
528 | } while (time_after_eq(end_time, jiffies)); | 527 | } while (time_after_eq(end_time, jiffies)); |
529 | } else { | 528 | } else { |
530 | udelay(delay); | 529 | udelay(delay); |
@@ -533,8 +532,7 @@ static void snd_cs4281_delay(unsigned int delay) | |||
533 | 532 | ||
534 | static inline void snd_cs4281_delay_long(void) | 533 | static inline void snd_cs4281_delay_long(void) |
535 | { | 534 | { |
536 | set_current_state(TASK_UNINTERRUPTIBLE); | 535 | schedule_timeout_uninterruptible(1); |
537 | schedule_timeout(1); | ||
538 | } | 536 | } |
539 | 537 | ||
540 | static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val) | 538 | static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val) |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 6e3855b8b33d..9b8af5bcbb04 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -163,7 +163,7 @@ static unsigned short snd_cs46xx_codec_read(cs46xx_t *chip, | |||
163 | goto ok1; | 163 | goto ok1; |
164 | } | 164 | } |
165 | 165 | ||
166 | snd_printk("AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); | 166 | snd_printk(KERN_ERR "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); |
167 | result = 0xffff; | 167 | result = 0xffff; |
168 | goto end; | 168 | goto end; |
169 | 169 | ||
@@ -182,7 +182,7 @@ static unsigned short snd_cs46xx_codec_read(cs46xx_t *chip, | |||
182 | udelay(10); | 182 | udelay(10); |
183 | } | 183 | } |
184 | 184 | ||
185 | snd_printk("AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", codec_index, reg); | 185 | snd_printk(KERN_ERR "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", codec_index, reg); |
186 | result = 0xffff; | 186 | result = 0xffff; |
187 | goto end; | 187 | goto end; |
188 | 188 | ||
@@ -281,7 +281,7 @@ static void snd_cs46xx_codec_write(cs46xx_t *chip, | |||
281 | goto end; | 281 | goto end; |
282 | } | 282 | } |
283 | } | 283 | } |
284 | snd_printk("AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", codec_index, reg, val); | 284 | snd_printk(KERN_ERR "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", codec_index, reg, val); |
285 | end: | 285 | end: |
286 | chip->active_ctrl(chip, -1); | 286 | chip->active_ctrl(chip, -1); |
287 | } | 287 | } |
@@ -510,7 +510,7 @@ static void snd_cs46xx_proc_start(cs46xx_t *chip) | |||
510 | } | 510 | } |
511 | 511 | ||
512 | if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR) | 512 | if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR) |
513 | snd_printk("SPCR_RUNFR never reset\n"); | 513 | snd_printk(KERN_ERR "SPCR_RUNFR never reset\n"); |
514 | } | 514 | } |
515 | 515 | ||
516 | static void snd_cs46xx_proc_stop(cs46xx_t *chip) | 516 | static void snd_cs46xx_proc_stop(cs46xx_t *chip) |
@@ -2403,7 +2403,7 @@ static void snd_cs46xx_codec_reset (ac97_t * ac97) | |||
2403 | msleep(10); | 2403 | msleep(10); |
2404 | } while (time_after_eq(end_time, jiffies)); | 2404 | } while (time_after_eq(end_time, jiffies)); |
2405 | 2405 | ||
2406 | snd_printk("CS46xx secondary codec dont respond!\n"); | 2406 | snd_printk(KERN_ERR "CS46xx secondary codec doesn't respond!\n"); |
2407 | } | 2407 | } |
2408 | #endif | 2408 | #endif |
2409 | 2409 | ||
@@ -2906,10 +2906,7 @@ static int snd_cs46xx_free(cs46xx_t *chip) | |||
2906 | snd_cs46xx_region_t *region = &chip->region.idx[idx]; | 2906 | snd_cs46xx_region_t *region = &chip->region.idx[idx]; |
2907 | if (region->remap_addr) | 2907 | if (region->remap_addr) |
2908 | iounmap(region->remap_addr); | 2908 | iounmap(region->remap_addr); |
2909 | if (region->resource) { | 2909 | release_and_free_resource(region->resource); |
2910 | release_resource(region->resource); | ||
2911 | kfree_nocheck(region->resource); | ||
2912 | } | ||
2913 | } | 2910 | } |
2914 | if (chip->irq >= 0) | 2911 | if (chip->irq >= 0) |
2915 | free_irq(chip->irq, (void *)chip); | 2912 | free_irq(chip->irq, (void *)chip); |
@@ -3075,8 +3072,8 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip) | |||
3075 | } | 3072 | } |
3076 | 3073 | ||
3077 | 3074 | ||
3078 | snd_printk("create - never read codec ready from AC'97\n"); | 3075 | snd_printk(KERN_ERR "create - never read codec ready from AC'97\n"); |
3079 | snd_printk("it is not probably bug, try to use CS4236 driver\n"); | 3076 | snd_printk(KERN_ERR "it is not probably bug, try to use CS4236 driver\n"); |
3080 | return -EIO; | 3077 | return -EIO; |
3081 | ok1: | 3078 | ok1: |
3082 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 3079 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
@@ -3124,17 +3121,17 @@ static int snd_cs46xx_chip_init(cs46xx_t *chip) | |||
3124 | } | 3121 | } |
3125 | 3122 | ||
3126 | #ifndef CONFIG_SND_CS46XX_NEW_DSP | 3123 | #ifndef CONFIG_SND_CS46XX_NEW_DSP |
3127 | snd_printk("create - never read ISV3 & ISV4 from AC'97\n"); | 3124 | snd_printk(KERN_ERR "create - never read ISV3 & ISV4 from AC'97\n"); |
3128 | return -EIO; | 3125 | return -EIO; |
3129 | #else | 3126 | #else |
3130 | /* This may happen on a cold boot with a Terratec SiXPack 5.1. | 3127 | /* This may happen on a cold boot with a Terratec SiXPack 5.1. |
3131 | Reloading the driver may help, if there's other soundcards | 3128 | Reloading the driver may help, if there's other soundcards |
3132 | with the same problem I would like to know. (Benny) */ | 3129 | with the same problem I would like to know. (Benny) */ |
3133 | 3130 | ||
3134 | snd_printk("ERROR: snd-cs46xx: never read ISV3 & ISV4 from AC'97\n"); | 3131 | snd_printk(KERN_ERR "ERROR: snd-cs46xx: never read ISV3 & ISV4 from AC'97\n"); |
3135 | snd_printk(" Try reloading the ALSA driver, if you find something\n"); | 3132 | snd_printk(KERN_ERR " Try reloading the ALSA driver, if you find something\n"); |
3136 | snd_printk(" broken or not working on your soundcard upon\n"); | 3133 | snd_printk(KERN_ERR " broken or not working on your soundcard upon\n"); |
3137 | snd_printk(" this message please report to alsa-devel@lists.sourceforge.net\n"); | 3134 | snd_printk(KERN_ERR " this message please report to alsa-devel@lists.sourceforge.net\n"); |
3138 | 3135 | ||
3139 | return -EIO; | 3136 | return -EIO; |
3140 | #endif | 3137 | #endif |
@@ -3215,7 +3212,7 @@ int __devinit snd_cs46xx_start_dsp(cs46xx_t *chip) | |||
3215 | #else | 3212 | #else |
3216 | /* old image */ | 3213 | /* old image */ |
3217 | if (snd_cs46xx_download_image(chip) < 0) { | 3214 | if (snd_cs46xx_download_image(chip) < 0) { |
3218 | snd_printk("image download error\n"); | 3215 | snd_printk(KERN_ERR "image download error\n"); |
3219 | return -EIO; | 3216 | return -EIO; |
3220 | } | 3217 | } |
3221 | 3218 | ||
@@ -3790,7 +3787,7 @@ int __devinit snd_cs46xx_create(snd_card_t * card, | |||
3790 | chip->ba1_addr = pci_resource_start(pci, 1); | 3787 | chip->ba1_addr = pci_resource_start(pci, 1); |
3791 | if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || | 3788 | if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || |
3792 | chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { | 3789 | chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { |
3793 | snd_printk("wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", chip->ba0_addr, chip->ba1_addr); | 3790 | snd_printk(KERN_ERR "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", chip->ba0_addr, chip->ba1_addr); |
3794 | snd_cs46xx_free(chip); | 3791 | snd_cs46xx_free(chip); |
3795 | return -ENOMEM; | 3792 | return -ENOMEM; |
3796 | } | 3793 | } |
@@ -3839,12 +3836,12 @@ int __devinit snd_cs46xx_create(snd_card_t * card, | |||
3839 | } | 3836 | } |
3840 | 3837 | ||
3841 | if (external_amp) { | 3838 | if (external_amp) { |
3842 | snd_printk("Crystal EAPD support forced on.\n"); | 3839 | snd_printk(KERN_INFO "Crystal EAPD support forced on.\n"); |
3843 | chip->amplifier_ctrl = amp_voyetra; | 3840 | chip->amplifier_ctrl = amp_voyetra; |
3844 | } | 3841 | } |
3845 | 3842 | ||
3846 | if (thinkpad) { | 3843 | if (thinkpad) { |
3847 | snd_printk("Activating CLKRUN hack for Thinkpad.\n"); | 3844 | snd_printk(KERN_INFO "Activating CLKRUN hack for Thinkpad.\n"); |
3848 | chip->active_ctrl = clkrun_hack; | 3845 | chip->active_ctrl = clkrun_hack; |
3849 | clkrun_init(chip); | 3846 | clkrun_init(chip); |
3850 | } | 3847 | } |
@@ -3861,20 +3858,20 @@ int __devinit snd_cs46xx_create(snd_card_t * card, | |||
3861 | for (idx = 0; idx < 5; idx++) { | 3858 | for (idx = 0; idx < 5; idx++) { |
3862 | region = &chip->region.idx[idx]; | 3859 | region = &chip->region.idx[idx]; |
3863 | if ((region->resource = request_mem_region(region->base, region->size, region->name)) == NULL) { | 3860 | if ((region->resource = request_mem_region(region->base, region->size, region->name)) == NULL) { |
3864 | snd_printk("unable to request memory region 0x%lx-0x%lx\n", region->base, region->base + region->size - 1); | 3861 | snd_printk(KERN_ERR "unable to request memory region 0x%lx-0x%lx\n", region->base, region->base + region->size - 1); |
3865 | snd_cs46xx_free(chip); | 3862 | snd_cs46xx_free(chip); |
3866 | return -EBUSY; | 3863 | return -EBUSY; |
3867 | } | 3864 | } |
3868 | region->remap_addr = ioremap_nocache(region->base, region->size); | 3865 | region->remap_addr = ioremap_nocache(region->base, region->size); |
3869 | if (region->remap_addr == NULL) { | 3866 | if (region->remap_addr == NULL) { |
3870 | snd_printk("%s ioremap problem\n", region->name); | 3867 | snd_printk(KERN_ERR "%s ioremap problem\n", region->name); |
3871 | snd_cs46xx_free(chip); | 3868 | snd_cs46xx_free(chip); |
3872 | return -ENOMEM; | 3869 | return -ENOMEM; |
3873 | } | 3870 | } |
3874 | } | 3871 | } |
3875 | 3872 | ||
3876 | if (request_irq(pci->irq, snd_cs46xx_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS46XX", (void *) chip)) { | 3873 | if (request_irq(pci->irq, snd_cs46xx_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS46XX", (void *) chip)) { |
3877 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 3874 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3878 | snd_cs46xx_free(chip); | 3875 | snd_cs46xx_free(chip); |
3879 | return -EBUSY; | 3876 | return -EBUSY; |
3880 | } | 3877 | } |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index b0e00f0a7c2f..dd1ea9d3b81a 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -188,7 +188,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
188 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, | 188 | if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, |
189 | sizeof(snd_emu10k1_synth_arg_t), &wave) < 0 || | 189 | sizeof(snd_emu10k1_synth_arg_t), &wave) < 0 || |
190 | wave == NULL) { | 190 | wave == NULL) { |
191 | snd_printk("can't initialize Emu10k1 wavetable synth\n"); | 191 | snd_printk(KERN_WARNING "can't initialize Emu10k1 wavetable synth\n"); |
192 | } else { | 192 | } else { |
193 | snd_emu10k1_synth_arg_t *arg; | 193 | snd_emu10k1_synth_arg_t *arg; |
194 | arg = SNDRV_SEQ_DEVICE_ARGPTR(wave); | 194 | arg = SNDRV_SEQ_DEVICE_ARGPTR(wave); |
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 7cf2f908eed9..6589bf24abcd 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c | |||
@@ -241,7 +241,7 @@ lookup_voices(snd_emux_t *emu, emu10k1_t *hw, best_voice_t *best, int active_onl | |||
241 | else if (state == SNDRV_EMUX_ST_RELEASED || | 241 | else if (state == SNDRV_EMUX_ST_RELEASED || |
242 | state == SNDRV_EMUX_ST_PENDING) { | 242 | state == SNDRV_EMUX_ST_PENDING) { |
243 | bp = best + V_RELEASED; | 243 | bp = best + V_RELEASED; |
244 | #if 0 | 244 | #if 1 |
245 | val = snd_emu10k1_ptr_read(hw, CVCF_CURRENTVOL, vp->ch); | 245 | val = snd_emu10k1_ptr_read(hw, CVCF_CURRENTVOL, vp->ch); |
246 | if (! val) | 246 | if (! val) |
247 | bp = best + V_OFF; | 247 | bp = best + V_OFF; |
@@ -349,7 +349,7 @@ start_voice(snd_emux_voice_t *vp) | |||
349 | } | 349 | } |
350 | 350 | ||
351 | /* channel to be silent and idle */ | 351 | /* channel to be silent and idle */ |
352 | snd_emu10k1_ptr_write(hw, DCYSUSV, ch, 0x0080); | 352 | snd_emu10k1_ptr_write(hw, DCYSUSV, ch, 0x0000); |
353 | snd_emu10k1_ptr_write(hw, VTFT, ch, 0x0000FFFF); | 353 | snd_emu10k1_ptr_write(hw, VTFT, ch, 0x0000FFFF); |
354 | snd_emu10k1_ptr_write(hw, CVCF, ch, 0x0000FFFF); | 354 | snd_emu10k1_ptr_write(hw, CVCF, ch, 0x0000FFFF); |
355 | snd_emu10k1_ptr_write(hw, PTRX, ch, 0); | 355 | snd_emu10k1_ptr_write(hw, PTRX, ch, 0); |
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index ad15755a63c3..cbb689474e7d 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -759,10 +759,8 @@ static int snd_emu10k1x_free(emu10k1x_t *chip) | |||
759 | outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); | 759 | outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); |
760 | 760 | ||
761 | // release the i/o port | 761 | // release the i/o port |
762 | if (chip->res_port) { | 762 | release_and_free_resource(chip->res_port); |
763 | release_resource(chip->res_port); | 763 | |
764 | kfree_nocheck(chip->res_port); | ||
765 | } | ||
766 | // release the irq | 764 | // release the irq |
767 | if (chip->irq >= 0) | 765 | if (chip->irq >= 0) |
768 | free_irq(chip->irq, (void *)chip); | 766 | free_irq(chip->irq, (void *)chip); |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 646b5d972e6f..03e8c1678952 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -364,12 +364,18 @@ static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
364 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); | 364 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); |
365 | break; | 365 | break; |
366 | case EMU10K1_GPR_TRANSLATION_BASS: | 366 | case EMU10K1_GPR_TRANSLATION_BASS: |
367 | snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); | 367 | if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { |
368 | change = -EIO; | ||
369 | goto __error; | ||
370 | } | ||
368 | for (j = 0; j < 5; j++) | 371 | for (j = 0; j < 5; j++) |
369 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); | 372 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); |
370 | break; | 373 | break; |
371 | case EMU10K1_GPR_TRANSLATION_TREBLE: | 374 | case EMU10K1_GPR_TRANSLATION_TREBLE: |
372 | snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); | 375 | if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { |
376 | change = -EIO; | ||
377 | goto __error; | ||
378 | } | ||
373 | for (j = 0; j < 5; j++) | 379 | for (j = 0; j < 5; j++) |
374 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); | 380 | snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); |
375 | break; | 381 | break; |
@@ -412,8 +418,6 @@ int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu, | |||
412 | snd_emu10k1_fx8010_irq_t *irq; | 418 | snd_emu10k1_fx8010_irq_t *irq; |
413 | unsigned long flags; | 419 | unsigned long flags; |
414 | 420 | ||
415 | snd_runtime_check(emu, return -EINVAL); | ||
416 | snd_runtime_check(handler, return -EINVAL); | ||
417 | irq = kmalloc(sizeof(*irq), GFP_ATOMIC); | 421 | irq = kmalloc(sizeof(*irq), GFP_ATOMIC); |
418 | if (irq == NULL) | 422 | if (irq == NULL) |
419 | return -ENOMEM; | 423 | return -ENOMEM; |
@@ -442,7 +446,6 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu, | |||
442 | snd_emu10k1_fx8010_irq_t *tmp; | 446 | snd_emu10k1_fx8010_irq_t *tmp; |
443 | unsigned long flags; | 447 | unsigned long flags; |
444 | 448 | ||
445 | snd_runtime_check(irq, return -EINVAL); | ||
446 | spin_lock_irqsave(&emu->fx8010.irq_lock, flags); | 449 | spin_lock_irqsave(&emu->fx8010.irq_lock, flags); |
447 | if ((tmp = emu->fx8010.irq_handlers) == irq) { | 450 | if ((tmp = emu->fx8010.irq_handlers) == irq) { |
448 | emu->fx8010.irq_handlers = tmp->next; | 451 | emu->fx8010.irq_handlers = tmp->next; |
@@ -717,9 +720,15 @@ static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode | |||
717 | err = -EFAULT; | 720 | err = -EFAULT; |
718 | goto __error; | 721 | goto __error; |
719 | } | 722 | } |
720 | snd_runtime_check(gctl->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER || | 723 | if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && |
721 | gctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM, err = -EINVAL; goto __error); | 724 | gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { |
722 | snd_runtime_check(gctl->id.name[0] != '\0', err = -EINVAL; goto __error); | 725 | err = -EINVAL; |
726 | goto __error; | ||
727 | } | ||
728 | if (! gctl->id.name[0]) { | ||
729 | err = -EINVAL; | ||
730 | goto __error; | ||
731 | } | ||
723 | ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); | 732 | ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); |
724 | memset(&knew, 0, sizeof(knew)); | 733 | memset(&knew, 0, sizeof(knew)); |
725 | knew.iface = gctl->id.iface; | 734 | knew.iface = gctl->id.iface; |
@@ -783,7 +792,8 @@ static int snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode | |||
783 | 792 | ||
784 | for (i = 0, _id = icode->gpr_del_controls; | 793 | for (i = 0, _id = icode->gpr_del_controls; |
785 | i < icode->gpr_del_control_count; i++, _id++) { | 794 | i < icode->gpr_del_control_count; i++, _id++) { |
786 | snd_runtime_check(copy_from_user(&id, _id, sizeof(id)) == 0, return -EFAULT); | 795 | if (copy_from_user(&id, _id, sizeof(id))) |
796 | return -EFAULT; | ||
787 | down_write(&card->controls_rwsem); | 797 | down_write(&card->controls_rwsem); |
788 | ctl = snd_emu10k1_look_for_ctl(emu, &id); | 798 | ctl = snd_emu10k1_look_for_ctl(emu, &id); |
789 | if (ctl) | 799 | if (ctl) |
@@ -964,8 +974,8 @@ static int snd_emu10k1_ipcm_peek(emu10k1_t *emu, emu10k1_fx8010_pcm_t *ipcm) | |||
964 | return err; | 974 | return err; |
965 | } | 975 | } |
966 | 976 | ||
967 | #define SND_EMU10K1_GPR_CONTROLS 41 | 977 | #define SND_EMU10K1_GPR_CONTROLS 44 |
968 | #define SND_EMU10K1_INPUTS 10 | 978 | #define SND_EMU10K1_INPUTS 12 |
969 | #define SND_EMU10K1_PLAYBACK_CHANNELS 8 | 979 | #define SND_EMU10K1_PLAYBACK_CHANNELS 8 |
970 | #define SND_EMU10K1_CAPTURE_CHANNELS 4 | 980 | #define SND_EMU10K1_CAPTURE_CHANNELS 4 |
971 | 981 | ||
@@ -1382,7 +1392,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1382 | A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1); | 1392 | A_SWITCH(icode, &ptr, tmp + 1, playback + SND_EMU10K1_PLAYBACK_CHANNELS + z, tmp + 1); |
1383 | if ((z==1) && (emu->card_capabilities->spdif_bug)) { | 1393 | if ((z==1) && (emu->card_capabilities->spdif_bug)) { |
1384 | /* Due to a SPDIF output bug on some Audigy cards, this code delays the Right channel by 1 sample */ | 1394 | /* Due to a SPDIF output bug on some Audigy cards, this code delays the Right channel by 1 sample */ |
1385 | snd_printk("Installing spdif_bug patch: %s\n", emu->card_capabilities->name); | 1395 | snd_printk(KERN_INFO "Installing spdif_bug patch: %s\n", emu->card_capabilities->name); |
1386 | A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_00000000); | 1396 | A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_00000000); |
1387 | A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); | 1397 | A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); |
1388 | } else { | 1398 | } else { |
@@ -1527,7 +1537,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1527 | 1537 | ||
1528 | strcpy(icode->name, "SB Live! FX8010 code for ALSA v1.2 by Jaroslav Kysela"); | 1538 | strcpy(icode->name, "SB Live! FX8010 code for ALSA v1.2 by Jaroslav Kysela"); |
1529 | ptr = 0; i = 0; | 1539 | ptr = 0; i = 0; |
1530 | /* we have 10 inputs */ | 1540 | /* we have 12 inputs */ |
1531 | playback = SND_EMU10K1_INPUTS; | 1541 | playback = SND_EMU10K1_INPUTS; |
1532 | /* we have 6 playback channels and tone control doubles */ | 1542 | /* we have 6 playback channels and tone control doubles */ |
1533 | capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); | 1543 | capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); |
@@ -1551,6 +1561,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1551 | OP(icode, &ptr, iMACINT0, GPR(7), C_00000000, FXBUS(FXBUS_PCM_LFE), C_00000004); | 1561 | OP(icode, &ptr, iMACINT0, GPR(7), C_00000000, FXBUS(FXBUS_PCM_LFE), C_00000004); |
1552 | OP(icode, &ptr, iMACINT0, GPR(8), C_00000000, C_00000000, C_00000000); /* S/PDIF left */ | 1562 | OP(icode, &ptr, iMACINT0, GPR(8), C_00000000, C_00000000, C_00000000); /* S/PDIF left */ |
1553 | OP(icode, &ptr, iMACINT0, GPR(9), C_00000000, C_00000000, C_00000000); /* S/PDIF right */ | 1563 | OP(icode, &ptr, iMACINT0, GPR(9), C_00000000, C_00000000, C_00000000); /* S/PDIF right */ |
1564 | OP(icode, &ptr, iMACINT0, GPR(10), C_00000000, FXBUS(FXBUS_PCM_LEFT_FRONT), C_00000004); | ||
1565 | OP(icode, &ptr, iMACINT0, GPR(11), C_00000000, FXBUS(FXBUS_PCM_RIGHT_FRONT), C_00000004); | ||
1554 | 1566 | ||
1555 | /* Raw S/PDIF PCM */ | 1567 | /* Raw S/PDIF PCM */ |
1556 | ipcm->substream = 0; | 1568 | ipcm->substream = 0; |
@@ -1697,6 +1709,21 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu) | |||
1697 | VOLUME_ADD(icode, &ptr, playback + 5, 7, gpr); | 1709 | VOLUME_ADD(icode, &ptr, playback + 5, 7, gpr); |
1698 | snd_emu10k1_init_mono_control(controls + i++, "LFE Digital Playback Volume", gpr++, 100); | 1710 | snd_emu10k1_init_mono_control(controls + i++, "LFE Digital Playback Volume", gpr++, 100); |
1699 | 1711 | ||
1712 | /* Front Playback Volume */ | ||
1713 | for (z = 0; z < 2; z++) | ||
1714 | VOLUME_ADD(icode, &ptr, playback + z, 10 + z, gpr + z); | ||
1715 | snd_emu10k1_init_stereo_control(controls + i++, "Front Playback Volume", gpr, 100); | ||
1716 | gpr += 2; | ||
1717 | |||
1718 | /* Front Capture Volume + Switch */ | ||
1719 | for (z = 0; z < 2; z++) { | ||
1720 | SWITCH(icode, &ptr, tmp + 0, 10 + z, gpr + 2); | ||
1721 | VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); | ||
1722 | } | ||
1723 | snd_emu10k1_init_stereo_control(controls + i++, "Front Capture Volume", gpr, 0); | ||
1724 | snd_emu10k1_init_mono_onoff_control(controls + i++, "Front Capture Switch", gpr + 2, 0); | ||
1725 | gpr += 3; | ||
1726 | |||
1700 | /* | 1727 | /* |
1701 | * Process inputs | 1728 | * Process inputs |
1702 | */ | 1729 | */ |
@@ -2058,14 +2085,16 @@ void snd_emu10k1_free_efx(emu10k1_t *emu) | |||
2058 | #if 0 // FIXME: who use them? | 2085 | #if 0 // FIXME: who use them? |
2059 | int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) | 2086 | int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) |
2060 | { | 2087 | { |
2061 | snd_runtime_check(output >= 0 && output < 6, return -EINVAL); | 2088 | if (output < 0 || output >= 6) |
2089 | return -EINVAL; | ||
2062 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1); | 2090 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1); |
2063 | return 0; | 2091 | return 0; |
2064 | } | 2092 | } |
2065 | 2093 | ||
2066 | int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) | 2094 | int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) |
2067 | { | 2095 | { |
2068 | snd_runtime_check(output >= 0 && output < 6, return -EINVAL); | 2096 | if (output < 0 || output >= 6) |
2097 | return -EINVAL; | ||
2069 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0); | 2098 | snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0); |
2070 | return 0; | 2099 | return 0; |
2071 | } | 2100 | } |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index 66ba27afe962..bf7490dae09b 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -965,7 +965,8 @@ static void snd_emu10k1_pcm_mixer_notify1(emu10k1_t *emu, snd_kcontrol_t *kctl, | |||
965 | { | 965 | { |
966 | snd_ctl_elem_id_t id; | 966 | snd_ctl_elem_id_t id; |
967 | 967 | ||
968 | snd_runtime_check(kctl != NULL, return); | 968 | if (! kctl) |
969 | return; | ||
969 | if (activate) | 970 | if (activate) |
970 | kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 971 | kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
971 | else | 972 | else |
diff --git a/sound/pci/emu10k1/irq.c b/sound/pci/emu10k1/irq.c index cd8460d56752..594ea063b140 100644 --- a/sound/pci/emu10k1/irq.c +++ b/sound/pci/emu10k1/irq.c | |||
@@ -41,7 +41,7 @@ irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
41 | orig_status = status; | 41 | orig_status = status; |
42 | handled = 1; | 42 | handled = 1; |
43 | if (status & IPR_PCIERROR) { | 43 | if (status & IPR_PCIERROR) { |
44 | snd_printk("interrupt: PCI error\n"); | 44 | snd_printk(KERN_ERR "interrupt: PCI error\n"); |
45 | snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); | 45 | snd_emu10k1_intr_disable(emu, INTE_PCIERRORENABLE); |
46 | status &= ~IPR_PCIERROR; | 46 | status &= ~IPR_PCIERROR; |
47 | } | 47 | } |
diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 6afeaeab3e13..d42e4aeaa73a 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c | |||
@@ -232,11 +232,11 @@ __found_pages: | |||
232 | static int is_valid_page(emu10k1_t *emu, dma_addr_t addr) | 232 | static int is_valid_page(emu10k1_t *emu, dma_addr_t addr) |
233 | { | 233 | { |
234 | if (addr & ~emu->dma_mask) { | 234 | if (addr & ~emu->dma_mask) { |
235 | snd_printk("max memory size is 0x%lx (addr = 0x%lx)!!\n", emu->dma_mask, (unsigned long)addr); | 235 | snd_printk(KERN_ERR "max memory size is 0x%lx (addr = 0x%lx)!!\n", emu->dma_mask, (unsigned long)addr); |
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | if (addr & (EMUPAGESIZE-1)) { | 238 | if (addr & (EMUPAGESIZE-1)) { |
239 | snd_printk("page is not aligned\n"); | 239 | snd_printk(KERN_ERR "page is not aligned\n"); |
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | return 1; | 242 | return 1; |
@@ -501,7 +501,7 @@ static inline void *offset_ptr(emu10k1_t *emu, int page, int offset) | |||
501 | snd_assert(page >= 0 && page < emu->max_cache_pages, return NULL); | 501 | snd_assert(page >= 0 && page < emu->max_cache_pages, return NULL); |
502 | ptr = emu->page_ptr_table[page]; | 502 | ptr = emu->page_ptr_table[page]; |
503 | if (! ptr) { | 503 | if (! ptr) { |
504 | printk("emu10k1: access to NULL ptr: page = %d\n", page); | 504 | printk(KERN_ERR "emu10k1: access to NULL ptr: page = %d\n", page); |
505 | return NULL; | 505 | return NULL; |
506 | } | 506 | } |
507 | ptr += offset & (PAGE_SIZE - 1); | 507 | ptr += offset & (PAGE_SIZE - 1); |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index d59c7f345ad6..e27ebb9bb74a 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -546,7 +546,7 @@ snd_p16v_pcm_pointer_capture(snd_pcm_substream_t *substream) | |||
546 | ptr=ptr2; | 546 | ptr=ptr2; |
547 | if (ptr >= runtime->buffer_size) { | 547 | if (ptr >= runtime->buffer_size) { |
548 | ptr -= runtime->buffer_size; | 548 | ptr -= runtime->buffer_size; |
549 | printk("buffer capture limited!\n"); | 549 | printk(KERN_WARNING "buffer capture limited!\n"); |
550 | } | 550 | } |
551 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 551 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); |
552 | 552 | ||
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index bef9a59f46d7..92ff7c510f2b 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -508,7 +508,7 @@ static unsigned int snd_es1371_wait_src_ready(ensoniq_t * ensoniq) | |||
508 | return r; | 508 | return r; |
509 | cond_resched(); | 509 | cond_resched(); |
510 | } | 510 | } |
511 | snd_printk("wait source ready timeout 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_SMPRATE), r); | 511 | snd_printk(KERN_ERR "wait source ready timeout 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_SMPRATE), r); |
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
@@ -576,10 +576,9 @@ static void snd_es1370_codec_write(ak4531_t *ak4531, | |||
576 | outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); | 576 | outw(ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); |
577 | return; | 577 | return; |
578 | } | 578 | } |
579 | set_current_state(TASK_UNINTERRUPTIBLE); | 579 | schedule_timeout_uninterruptible(1); |
580 | schedule_timeout(1); | ||
581 | } while (time_after(end_time, jiffies)); | 580 | } while (time_after(end_time, jiffies)); |
582 | snd_printk("codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS))); | 581 | snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS))); |
583 | } | 582 | } |
584 | 583 | ||
585 | #endif /* CHIP1370 */ | 584 | #endif /* CHIP1370 */ |
@@ -620,7 +619,7 @@ static void snd_es1371_codec_write(ac97_t *ac97, | |||
620 | } | 619 | } |
621 | } | 620 | } |
622 | up(&ensoniq->src_mutex); | 621 | up(&ensoniq->src_mutex); |
623 | snd_printk("codec write timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 622 | snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); |
624 | } | 623 | } |
625 | 624 | ||
626 | static unsigned short snd_es1371_codec_read(ac97_t *ac97, | 625 | static unsigned short snd_es1371_codec_read(ac97_t *ac97, |
@@ -667,14 +666,14 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97, | |||
667 | } | 666 | } |
668 | up(&ensoniq->src_mutex); | 667 | up(&ensoniq->src_mutex); |
669 | if (++fail > 10) { | 668 | if (++fail > 10) { |
670 | snd_printk("codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC))); | 669 | snd_printk(KERN_ERR "codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC))); |
671 | return 0; | 670 | return 0; |
672 | } | 671 | } |
673 | goto __again; | 672 | goto __again; |
674 | } | 673 | } |
675 | } | 674 | } |
676 | up(&ensoniq->src_mutex); | 675 | up(&ensoniq->src_mutex); |
677 | snd_printk("es1371: codec read timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 676 | snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); |
678 | return 0; | 677 | return 0; |
679 | } | 678 | } |
680 | 679 | ||
@@ -1960,7 +1959,7 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
1960 | } | 1959 | } |
1961 | ensoniq->port = pci_resource_start(pci, 0); | 1960 | ensoniq->port = pci_resource_start(pci, 0); |
1962 | if (request_irq(pci->irq, snd_audiopci_interrupt, SA_INTERRUPT|SA_SHIRQ, "Ensoniq AudioPCI", (void *)ensoniq)) { | 1961 | if (request_irq(pci->irq, snd_audiopci_interrupt, SA_INTERRUPT|SA_SHIRQ, "Ensoniq AudioPCI", (void *)ensoniq)) { |
1963 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1962 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1964 | snd_ensoniq_free(ensoniq); | 1963 | snd_ensoniq_free(ensoniq); |
1965 | return -EBUSY; | 1964 | return -EBUSY; |
1966 | } | 1965 | } |
@@ -1968,7 +1967,7 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
1968 | #ifdef CHIP1370 | 1967 | #ifdef CHIP1370 |
1969 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), | 1968 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
1970 | 16, &ensoniq->dma_bug) < 0) { | 1969 | 16, &ensoniq->dma_bug) < 0) { |
1971 | snd_printk("unable to allocate space for phantom area - dma_bug\n"); | 1970 | snd_printk(KERN_ERR "unable to allocate space for phantom area - dma_bug\n"); |
1972 | snd_ensoniq_free(ensoniq); | 1971 | snd_ensoniq_free(ensoniq); |
1973 | return -EBUSY; | 1972 | return -EBUSY; |
1974 | } | 1973 | } |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 17fa80c23870..78f90defcab1 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -267,7 +267,7 @@ static void snd_es1938_mixer_write(es1938_t *chip, unsigned char reg, unsigned c | |||
267 | outb(val, SLSB_REG(chip, MIXERDATA)); | 267 | outb(val, SLSB_REG(chip, MIXERDATA)); |
268 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 268 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
269 | #ifdef REG_DEBUG | 269 | #ifdef REG_DEBUG |
270 | snd_printk("Mixer reg %02x set to %02x\n", reg, val); | 270 | snd_printk(KERN_DEBUG "Mixer reg %02x set to %02x\n", reg, val); |
271 | #endif | 271 | #endif |
272 | } | 272 | } |
273 | 273 | ||
@@ -283,7 +283,7 @@ static int snd_es1938_mixer_read(es1938_t *chip, unsigned char reg) | |||
283 | data = inb(SLSB_REG(chip, MIXERDATA)); | 283 | data = inb(SLSB_REG(chip, MIXERDATA)); |
284 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 284 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
285 | #ifdef REG_DEBUG | 285 | #ifdef REG_DEBUG |
286 | snd_printk("Mixer reg %02x now is %02x\n", reg, data); | 286 | snd_printk(KERN_DEBUG "Mixer reg %02x now is %02x\n", reg, data); |
287 | #endif | 287 | #endif |
288 | return data; | 288 | return data; |
289 | } | 289 | } |
@@ -303,7 +303,8 @@ static int snd_es1938_mixer_bits(es1938_t *chip, unsigned char reg, unsigned cha | |||
303 | new = (old & ~mask) | (val & mask); | 303 | new = (old & ~mask) | (val & mask); |
304 | outb(new, SLSB_REG(chip, MIXERDATA)); | 304 | outb(new, SLSB_REG(chip, MIXERDATA)); |
305 | #ifdef REG_DEBUG | 305 | #ifdef REG_DEBUG |
306 | snd_printk("Mixer reg %02x was %02x, set to %02x\n", reg, old, new); | 306 | snd_printk(KERN_DEBUG "Mixer reg %02x was %02x, set to %02x\n", |
307 | reg, old, new); | ||
307 | #endif | 308 | #endif |
308 | } | 309 | } |
309 | spin_unlock_irqrestore(&chip->mixer_lock, flags); | 310 | spin_unlock_irqrestore(&chip->mixer_lock, flags); |
@@ -323,7 +324,7 @@ static void snd_es1938_write_cmd(es1938_t *chip, unsigned char cmd) | |||
323 | return; | 324 | return; |
324 | } | 325 | } |
325 | } | 326 | } |
326 | printk("snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); | 327 | printk(KERN_ERR "snd_es1938_write_cmd timeout (0x02%x/0x02%x)\n", cmd, v); |
327 | } | 328 | } |
328 | 329 | ||
329 | /* ----------------------------------------------------------------- | 330 | /* ----------------------------------------------------------------- |
@@ -336,7 +337,7 @@ static int snd_es1938_get_byte(es1938_t *chip) | |||
336 | for (i = GET_LOOP_TIMEOUT; i; i--) | 337 | for (i = GET_LOOP_TIMEOUT; i; i--) |
337 | if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) | 338 | if ((v = inb(SLSB_REG(chip, STATUS))) & 0x80) |
338 | return inb(SLSB_REG(chip, READDATA)); | 339 | return inb(SLSB_REG(chip, READDATA)); |
339 | snd_printk("get_byte timeout: status 0x02%x\n", v); | 340 | snd_printk(KERN_ERR "get_byte timeout: status 0x02%x\n", v); |
340 | return -ENODEV; | 341 | return -ENODEV; |
341 | } | 342 | } |
342 | 343 | ||
@@ -351,7 +352,7 @@ static void snd_es1938_write(es1938_t *chip, unsigned char reg, unsigned char va | |||
351 | snd_es1938_write_cmd(chip, val); | 352 | snd_es1938_write_cmd(chip, val); |
352 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 353 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
353 | #ifdef REG_DEBUG | 354 | #ifdef REG_DEBUG |
354 | snd_printk("Reg %02x set to %02x\n", reg, val); | 355 | snd_printk(KERN_DEBUG "Reg %02x set to %02x\n", reg, val); |
355 | #endif | 356 | #endif |
356 | } | 357 | } |
357 | 358 | ||
@@ -368,7 +369,7 @@ static unsigned char snd_es1938_read(es1938_t *chip, unsigned char reg) | |||
368 | val = snd_es1938_get_byte(chip); | 369 | val = snd_es1938_get_byte(chip); |
369 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 370 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
370 | #ifdef REG_DEBUG | 371 | #ifdef REG_DEBUG |
371 | snd_printk("Reg %02x now is %02x\n", reg, val); | 372 | snd_printk(KERN_DEBUG "Reg %02x now is %02x\n", reg, val); |
372 | #endif | 373 | #endif |
373 | return val; | 374 | return val; |
374 | } | 375 | } |
@@ -390,7 +391,8 @@ static int snd_es1938_bits(es1938_t *chip, unsigned char reg, unsigned char mask | |||
390 | new = (old & ~mask) | (val & mask); | 391 | new = (old & ~mask) | (val & mask); |
391 | snd_es1938_write_cmd(chip, new); | 392 | snd_es1938_write_cmd(chip, new); |
392 | #ifdef REG_DEBUG | 393 | #ifdef REG_DEBUG |
393 | snd_printk("Reg %02x was %02x, set to %02x\n", reg, old, new); | 394 | snd_printk(KERN_DEBUG "Reg %02x was %02x, set to %02x\n", |
395 | reg, old, new); | ||
394 | #endif | 396 | #endif |
395 | } | 397 | } |
396 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 398 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
@@ -413,7 +415,7 @@ static void snd_es1938_reset(es1938_t *chip) | |||
413 | goto __next; | 415 | goto __next; |
414 | } | 416 | } |
415 | } | 417 | } |
416 | snd_printk("ESS Solo-1 reset failed\n"); | 418 | snd_printk(KERN_ERR "ESS Solo-1 reset failed\n"); |
417 | 419 | ||
418 | __next: | 420 | __next: |
419 | snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT); | 421 | snd_es1938_write_cmd(chip, ESS_CMD_ENABLEEXT); |
@@ -543,10 +545,12 @@ static int snd_es1938_capture_trigger(snd_pcm_substream_t * substream, | |||
543 | int val; | 545 | int val; |
544 | switch (cmd) { | 546 | switch (cmd) { |
545 | case SNDRV_PCM_TRIGGER_START: | 547 | case SNDRV_PCM_TRIGGER_START: |
548 | case SNDRV_PCM_TRIGGER_RESUME: | ||
546 | val = 0x0f; | 549 | val = 0x0f; |
547 | chip->active |= ADC1; | 550 | chip->active |= ADC1; |
548 | break; | 551 | break; |
549 | case SNDRV_PCM_TRIGGER_STOP: | 552 | case SNDRV_PCM_TRIGGER_STOP: |
553 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
550 | val = 0x00; | 554 | val = 0x00; |
551 | chip->active &= ~ADC1; | 555 | chip->active &= ~ADC1; |
552 | break; | 556 | break; |
@@ -563,6 +567,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream, | |||
563 | es1938_t *chip = snd_pcm_substream_chip(substream); | 567 | es1938_t *chip = snd_pcm_substream_chip(substream); |
564 | switch (cmd) { | 568 | switch (cmd) { |
565 | case SNDRV_PCM_TRIGGER_START: | 569 | case SNDRV_PCM_TRIGGER_START: |
570 | case SNDRV_PCM_TRIGGER_RESUME: | ||
566 | /* According to the documentation this should be: | 571 | /* According to the documentation this should be: |
567 | 0x13 but that value may randomly swap stereo channels */ | 572 | 0x13 but that value may randomly swap stereo channels */ |
568 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92); | 573 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0x92); |
@@ -575,6 +580,7 @@ static int snd_es1938_playback1_trigger(snd_pcm_substream_t * substream, | |||
575 | chip->active |= DAC2; | 580 | chip->active |= DAC2; |
576 | break; | 581 | break; |
577 | case SNDRV_PCM_TRIGGER_STOP: | 582 | case SNDRV_PCM_TRIGGER_STOP: |
583 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
578 | outb(0, SLIO_REG(chip, AUDIO2MODE)); | 584 | outb(0, SLIO_REG(chip, AUDIO2MODE)); |
579 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0); | 585 | snd_es1938_mixer_write(chip, ESSSB_IREG_AUDIO2CONTROL1, 0); |
580 | chip->active &= ~DAC2; | 586 | chip->active &= ~DAC2; |
@@ -592,10 +598,12 @@ static int snd_es1938_playback2_trigger(snd_pcm_substream_t * substream, | |||
592 | int val; | 598 | int val; |
593 | switch (cmd) { | 599 | switch (cmd) { |
594 | case SNDRV_PCM_TRIGGER_START: | 600 | case SNDRV_PCM_TRIGGER_START: |
601 | case SNDRV_PCM_TRIGGER_RESUME: | ||
595 | val = 5; | 602 | val = 5; |
596 | chip->active |= DAC1; | 603 | chip->active |= DAC1; |
597 | break; | 604 | break; |
598 | case SNDRV_PCM_TRIGGER_STOP: | 605 | case SNDRV_PCM_TRIGGER_STOP: |
606 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
599 | val = 0; | 607 | val = 0; |
600 | chip->active &= ~DAC1; | 608 | chip->active &= ~DAC1; |
601 | break; | 609 | break; |
@@ -1390,7 +1398,8 @@ static int es1938_suspend(snd_card_t *card, pm_message_t state) | |||
1390 | *d = snd_es1938_reg_read(chip, *s); | 1398 | *d = snd_es1938_reg_read(chip, *s); |
1391 | 1399 | ||
1392 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ | 1400 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ |
1393 | 1401 | if (chip->irq >= 0) | |
1402 | free_irq(chip->irq, (void *)chip); | ||
1394 | pci_disable_device(chip->pci); | 1403 | pci_disable_device(chip->pci); |
1395 | return 0; | 1404 | return 0; |
1396 | } | 1405 | } |
@@ -1401,6 +1410,9 @@ static int es1938_resume(snd_card_t *card) | |||
1401 | unsigned char *s, *d; | 1410 | unsigned char *s, *d; |
1402 | 1411 | ||
1403 | pci_enable_device(chip->pci); | 1412 | pci_enable_device(chip->pci); |
1413 | request_irq(chip->pci->irq, snd_es1938_interrupt, | ||
1414 | SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip); | ||
1415 | chip->irq = chip->pci->irq; | ||
1404 | snd_es1938_chip_init(chip); | 1416 | snd_es1938_chip_init(chip); |
1405 | 1417 | ||
1406 | /* restore mixer-related registers */ | 1418 | /* restore mixer-related registers */ |
@@ -1489,7 +1501,7 @@ static int __devinit snd_es1938_create(snd_card_t * card, | |||
1489 | /* check, if we can restrict PCI DMA transfers to 24 bits */ | 1501 | /* check, if we can restrict PCI DMA transfers to 24 bits */ |
1490 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || | 1502 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || |
1491 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { | 1503 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { |
1492 | snd_printk("architecture does not support 24bit PCI busmaster DMA\n"); | 1504 | snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); |
1493 | pci_disable_device(pci); | 1505 | pci_disable_device(pci); |
1494 | return -ENXIO; | 1506 | return -ENXIO; |
1495 | } | 1507 | } |
@@ -1514,13 +1526,13 @@ static int __devinit snd_es1938_create(snd_card_t * card, | |||
1514 | chip->mpu_port = pci_resource_start(pci, 3); | 1526 | chip->mpu_port = pci_resource_start(pci, 3); |
1515 | chip->game_port = pci_resource_start(pci, 4); | 1527 | chip->game_port = pci_resource_start(pci, 4); |
1516 | if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip)) { | 1528 | if (request_irq(pci->irq, snd_es1938_interrupt, SA_INTERRUPT|SA_SHIRQ, "ES1938", (void *)chip)) { |
1517 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1529 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1518 | snd_es1938_free(chip); | 1530 | snd_es1938_free(chip); |
1519 | return -EBUSY; | 1531 | return -EBUSY; |
1520 | } | 1532 | } |
1521 | chip->irq = pci->irq; | 1533 | chip->irq = pci->irq; |
1522 | #ifdef ES1938_DDEBUG | 1534 | #ifdef ES1938_DDEBUG |
1523 | snd_printk("create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", | 1535 | snd_printk(KERN_DEBUG "create: io: 0x%lx, sb: 0x%lx, vc: 0x%lx, mpu: 0x%lx, game: 0x%lx\n", |
1524 | chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); | 1536 | chip->io_port, chip->sb_port, chip->vc_port, chip->mpu_port, chip->game_port); |
1525 | #endif | 1537 | #endif |
1526 | 1538 | ||
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index ecdcada90ca2..ac8294e21cc1 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -1462,13 +1462,13 @@ snd_es1968_init_dmabuf(es1968_t *chip) | |||
1462 | snd_dma_pci_data(chip->pci), | 1462 | snd_dma_pci_data(chip->pci), |
1463 | chip->total_bufsize, &chip->dma); | 1463 | chip->total_bufsize, &chip->dma); |
1464 | if (err < 0 || ! chip->dma.area) { | 1464 | if (err < 0 || ! chip->dma.area) { |
1465 | snd_printk("es1968: can't allocate dma pages for size %d\n", | 1465 | snd_printk(KERN_ERR "es1968: can't allocate dma pages for size %d\n", |
1466 | chip->total_bufsize); | 1466 | chip->total_bufsize); |
1467 | return -ENOMEM; | 1467 | return -ENOMEM; |
1468 | } | 1468 | } |
1469 | if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) { | 1469 | if ((chip->dma.addr + chip->dma.bytes - 1) & ~((1 << 28) - 1)) { |
1470 | snd_dma_free_pages(&chip->dma); | 1470 | snd_dma_free_pages(&chip->dma); |
1471 | snd_printk("es1968: DMA buffer beyond 256MB.\n"); | 1471 | snd_printk(KERN_ERR "es1968: DMA buffer beyond 256MB.\n"); |
1472 | return -ENOMEM; | 1472 | return -ENOMEM; |
1473 | } | 1473 | } |
1474 | } | 1474 | } |
@@ -1741,11 +1741,11 @@ static void __devinit es1968_measure_clock(es1968_t *chip) | |||
1741 | 1741 | ||
1742 | /* search 2 APUs (although one apu is enough) */ | 1742 | /* search 2 APUs (although one apu is enough) */ |
1743 | if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) { | 1743 | if ((apu = snd_es1968_alloc_apu_pair(chip, ESM_APU_PCM_PLAY)) < 0) { |
1744 | snd_printk("Hmm, cannot find empty APU pair!?\n"); | 1744 | snd_printk(KERN_ERR "Hmm, cannot find empty APU pair!?\n"); |
1745 | return; | 1745 | return; |
1746 | } | 1746 | } |
1747 | if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) { | 1747 | if ((memory = snd_es1968_new_memory(chip, CLOCK_MEASURE_BUFSIZE)) == NULL) { |
1748 | snd_printk("cannot allocate dma buffer - using default clock %d\n", chip->clock); | 1748 | snd_printk(KERN_ERR "cannot allocate dma buffer - using default clock %d\n", chip->clock); |
1749 | snd_es1968_free_apu_pair(chip, apu); | 1749 | snd_es1968_free_apu_pair(chip, apu); |
1750 | return; | 1750 | return; |
1751 | } | 1751 | } |
@@ -1806,7 +1806,7 @@ static void __devinit es1968_measure_clock(es1968_t *chip) | |||
1806 | else | 1806 | else |
1807 | t += stop_time.tv_usec - start_time.tv_usec; | 1807 | t += stop_time.tv_usec - start_time.tv_usec; |
1808 | if (t == 0) { | 1808 | if (t == 0) { |
1809 | snd_printk("?? calculation error..\n"); | 1809 | snd_printk(KERN_ERR "?? calculation error..\n"); |
1810 | } else { | 1810 | } else { |
1811 | offset *= 1000; | 1811 | offset *= 1000; |
1812 | offset = (offset / t) * 1000 + ((offset % t) * 1000) / t; | 1812 | offset = (offset / t) * 1000 + ((offset % t) * 1000) / t; |
@@ -2090,7 +2090,7 @@ static void snd_es1968_ac97_reset(es1968_t *chip) | |||
2090 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); | 2090 | outw(inw(ioaddr + 0x3c) & 0xfffc, ioaddr + 0x3c); |
2091 | 2091 | ||
2092 | #if 0 /* the loop here needs to be much better if we want it.. */ | 2092 | #if 0 /* the loop here needs to be much better if we want it.. */ |
2093 | snd_printk("trying software reset\n"); | 2093 | snd_printk(KERN_INFO "trying software reset\n"); |
2094 | /* try and do a software reset */ | 2094 | /* try and do a software reset */ |
2095 | outb(0x80 | 0x7c, ioaddr + 0x30); | 2095 | outb(0x80 | 0x7c, ioaddr + 0x30); |
2096 | for (w = 0;; w++) { | 2096 | for (w = 0;; w++) { |
@@ -2461,8 +2461,7 @@ static int __devinit snd_es1968_create_gameport(es1968_t *chip, int dev) | |||
2461 | chip->gameport = gp = gameport_allocate_port(); | 2461 | chip->gameport = gp = gameport_allocate_port(); |
2462 | if (!gp) { | 2462 | if (!gp) { |
2463 | printk(KERN_ERR "es1968: cannot allocate memory for gameport\n"); | 2463 | printk(KERN_ERR "es1968: cannot allocate memory for gameport\n"); |
2464 | release_resource(r); | 2464 | release_and_free_resource(r); |
2465 | kfree_nocheck(r); | ||
2466 | return -ENOMEM; | 2465 | return -ENOMEM; |
2467 | } | 2466 | } |
2468 | 2467 | ||
@@ -2488,8 +2487,7 @@ static void snd_es1968_free_gameport(es1968_t *chip) | |||
2488 | gameport_unregister_port(chip->gameport); | 2487 | gameport_unregister_port(chip->gameport); |
2489 | chip->gameport = NULL; | 2488 | chip->gameport = NULL; |
2490 | 2489 | ||
2491 | release_resource(r); | 2490 | release_and_free_resource(r); |
2492 | kfree_nocheck(r); | ||
2493 | } | 2491 | } |
2494 | } | 2492 | } |
2495 | #else | 2493 | #else |
@@ -2564,7 +2562,7 @@ static int __devinit snd_es1968_create(snd_card_t * card, | |||
2564 | /* check, if we can restrict PCI DMA transfers to 28 bits */ | 2562 | /* check, if we can restrict PCI DMA transfers to 28 bits */ |
2565 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 2563 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || |
2566 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 2564 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { |
2567 | snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); | 2565 | snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); |
2568 | pci_disable_device(pci); | 2566 | pci_disable_device(pci); |
2569 | return -ENXIO; | 2567 | return -ENXIO; |
2570 | } | 2568 | } |
@@ -2599,7 +2597,7 @@ static int __devinit snd_es1968_create(snd_card_t * card, | |||
2599 | chip->io_port = pci_resource_start(pci, 0); | 2597 | chip->io_port = pci_resource_start(pci, 0); |
2600 | if (request_irq(pci->irq, snd_es1968_interrupt, SA_INTERRUPT|SA_SHIRQ, | 2598 | if (request_irq(pci->irq, snd_es1968_interrupt, SA_INTERRUPT|SA_SHIRQ, |
2601 | "ESS Maestro", (void*)chip)) { | 2599 | "ESS Maestro", (void*)chip)) { |
2602 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2600 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2603 | snd_es1968_free(chip); | 2601 | snd_es1968_free(chip); |
2604 | return -EBUSY; | 2602 | return -EBUSY; |
2605 | } | 2603 | } |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index e5cfa2a0c246..4c7c8d225c7f 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -237,7 +237,7 @@ static void snd_fm801_codec_write(ac97_t *ac97, | |||
237 | goto ok1; | 237 | goto ok1; |
238 | udelay(10); | 238 | udelay(10); |
239 | } | 239 | } |
240 | snd_printk("AC'97 interface is busy (1)\n"); | 240 | snd_printk(KERN_ERR "AC'97 interface is busy (1)\n"); |
241 | return; | 241 | return; |
242 | 242 | ||
243 | ok1: | 243 | ok1: |
@@ -252,7 +252,7 @@ static void snd_fm801_codec_write(ac97_t *ac97, | |||
252 | return; | 252 | return; |
253 | udelay(10); | 253 | udelay(10); |
254 | } | 254 | } |
255 | snd_printk("AC'97 interface #%d is busy (2)\n", ac97->num); | 255 | snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num); |
256 | } | 256 | } |
257 | 257 | ||
258 | static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) | 258 | static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) |
@@ -268,7 +268,7 @@ static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) | |||
268 | goto ok1; | 268 | goto ok1; |
269 | udelay(10); | 269 | udelay(10); |
270 | } | 270 | } |
271 | snd_printk("AC'97 interface is busy (1)\n"); | 271 | snd_printk(KERN_ERR "AC'97 interface is busy (1)\n"); |
272 | return 0; | 272 | return 0; |
273 | 273 | ||
274 | ok1: | 274 | ok1: |
@@ -279,7 +279,7 @@ static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) | |||
279 | goto ok2; | 279 | goto ok2; |
280 | udelay(10); | 280 | udelay(10); |
281 | } | 281 | } |
282 | snd_printk("AC'97 interface #%d is busy (2)\n", ac97->num); | 282 | snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num); |
283 | return 0; | 283 | return 0; |
284 | 284 | ||
285 | ok2: | 285 | ok2: |
@@ -288,7 +288,7 @@ static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) | |||
288 | goto ok3; | 288 | goto ok3; |
289 | udelay(10); | 289 | udelay(10); |
290 | } | 290 | } |
291 | snd_printk("AC'97 interface #%d is not valid (2)\n", ac97->num); | 291 | snd_printk(KERN_ERR "AC'97 interface #%d is not valid (2)\n", ac97->num); |
292 | return 0; | 292 | return 0; |
293 | 293 | ||
294 | ok3: | 294 | ok3: |
@@ -1279,7 +1279,7 @@ static int __devinit snd_fm801_create(snd_card_t * card, | |||
1279 | } | 1279 | } |
1280 | chip->port = pci_resource_start(pci, 0); | 1280 | chip->port = pci_resource_start(pci, 0); |
1281 | if (request_irq(pci->irq, snd_fm801_interrupt, SA_INTERRUPT|SA_SHIRQ, "FM801", (void *)chip)) { | 1281 | if (request_irq(pci->irq, snd_fm801_interrupt, SA_INTERRUPT|SA_SHIRQ, "FM801", (void *)chip)) { |
1282 | snd_printk("unable to grab IRQ %d\n", chip->irq); | 1282 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); |
1283 | snd_fm801_free(chip); | 1283 | snd_fm801_free(chip); |
1284 | return -EBUSY; | 1284 | return -EBUSY; |
1285 | } | 1285 | } |
@@ -1303,10 +1303,9 @@ static int __devinit snd_fm801_create(snd_card_t * card, | |||
1303 | do { | 1303 | do { |
1304 | if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) | 1304 | if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) |
1305 | goto __ac97_secondary; | 1305 | goto __ac97_secondary; |
1306 | set_current_state(TASK_UNINTERRUPTIBLE); | 1306 | schedule_timeout_uninterruptible(1); |
1307 | schedule_timeout(1); | ||
1308 | } while (time_after(timeout, jiffies)); | 1307 | } while (time_after(timeout, jiffies)); |
1309 | snd_printk("Primary AC'97 codec not found\n"); | 1308 | snd_printk(KERN_ERR "Primary AC'97 codec not found\n"); |
1310 | snd_fm801_free(chip); | 1309 | snd_fm801_free(chip); |
1311 | return -EIO; | 1310 | return -EIO; |
1312 | 1311 | ||
@@ -1329,8 +1328,7 @@ static int __devinit snd_fm801_create(snd_card_t * card, | |||
1329 | goto __ac97_ok; | 1328 | goto __ac97_ok; |
1330 | } | 1329 | } |
1331 | } | 1330 | } |
1332 | set_current_state(TASK_UNINTERRUPTIBLE); | 1331 | schedule_timeout_uninterruptible(1); |
1333 | schedule_timeout(1); | ||
1334 | } while (time_after(timeout, jiffies)); | 1332 | } while (time_after(timeout, jiffies)); |
1335 | } | 1333 | } |
1336 | 1334 | ||
@@ -1343,10 +1341,9 @@ static int __devinit snd_fm801_create(snd_card_t * card, | |||
1343 | do { | 1341 | do { |
1344 | if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) | 1342 | if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) |
1345 | goto __ac97_ok; | 1343 | goto __ac97_ok; |
1346 | set_current_state(TASK_UNINTERRUPTIBLE); | 1344 | schedule_timeout_uninterruptible(1); |
1347 | schedule_timeout(1); | ||
1348 | } while (time_after(timeout, jiffies)); | 1345 | } while (time_after(timeout, jiffies)); |
1349 | snd_printk("Primary AC'97 codec not responding\n"); | 1346 | snd_printk(KERN_ERR "Primary AC'97 codec not responding\n"); |
1350 | snd_fm801_free(chip); | 1347 | snd_fm801_free(chip); |
1351 | return -EIO; | 1348 | return -EIO; |
1352 | 1349 | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 3815403ed095..0dbeeaf6113a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -518,6 +518,13 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
518 | return -ENODEV; | 518 | return -ENODEV; |
519 | } | 519 | } |
520 | 520 | ||
521 | if (! codec->subsystem_id) { | ||
522 | hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; | ||
523 | codec->subsystem_id = snd_hda_codec_read(codec, nid, 0, | ||
524 | AC_VERB_GET_SUBSYSTEM_ID, | ||
525 | 0); | ||
526 | } | ||
527 | |||
521 | codec->preset = find_codec_preset(codec); | 528 | codec->preset = find_codec_preset(codec); |
522 | if (! *bus->card->mixername) | 529 | if (! *bus->card->mixername) |
523 | snd_hda_get_codec_name(codec, bus->card->mixername, | 530 | snd_hda_get_codec_name(codec, bus->card->mixername, |
@@ -814,6 +821,51 @@ int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t | |||
814 | } | 821 | } |
815 | 822 | ||
816 | /* | 823 | /* |
824 | * bound volume controls | ||
825 | * | ||
826 | * bind multiple volumes (# indices, from 0) | ||
827 | */ | ||
828 | |||
829 | #define AMP_VAL_IDX_SHIFT 19 | ||
830 | #define AMP_VAL_IDX_MASK (0x0f<<19) | ||
831 | |||
832 | int snd_hda_mixer_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
833 | { | ||
834 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
835 | unsigned long pval; | ||
836 | int err; | ||
837 | |||
838 | down(&codec->spdif_mutex); /* reuse spdif_mutex */ | ||
839 | pval = kcontrol->private_value; | ||
840 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ | ||
841 | err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | ||
842 | kcontrol->private_value = pval; | ||
843 | up(&codec->spdif_mutex); | ||
844 | return err; | ||
845 | } | ||
846 | |||
847 | int snd_hda_mixer_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
848 | { | ||
849 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
850 | unsigned long pval; | ||
851 | int i, indices, err = 0, change = 0; | ||
852 | |||
853 | down(&codec->spdif_mutex); /* reuse spdif_mutex */ | ||
854 | pval = kcontrol->private_value; | ||
855 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; | ||
856 | for (i = 0; i < indices; i++) { | ||
857 | kcontrol->private_value = (pval & ~AMP_VAL_IDX_MASK) | (i << AMP_VAL_IDX_SHIFT); | ||
858 | err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
859 | if (err < 0) | ||
860 | break; | ||
861 | change |= err; | ||
862 | } | ||
863 | kcontrol->private_value = pval; | ||
864 | up(&codec->spdif_mutex); | ||
865 | return err < 0 ? err : change; | ||
866 | } | ||
867 | |||
868 | /* | ||
817 | * SPDIF out controls | 869 | * SPDIF out controls |
818 | */ | 870 | */ |
819 | 871 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index bb53bcf76742..1179d6cfa82a 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -79,6 +79,8 @@ enum { | |||
79 | #define AC_VERB_GET_GPIO_MASK 0x0f16 | 79 | #define AC_VERB_GET_GPIO_MASK 0x0f16 |
80 | #define AC_VERB_GET_GPIO_DIRECTION 0x0f17 | 80 | #define AC_VERB_GET_GPIO_DIRECTION 0x0f17 |
81 | #define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c | 81 | #define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c |
82 | /* f20: AFG/MFG */ | ||
83 | #define AC_VERB_GET_SUBSYSTEM_ID 0x0f20 | ||
82 | 84 | ||
83 | /* | 85 | /* |
84 | * SET verbs | 86 | * SET verbs |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 6fe696e53ea6..9d1412a9f2f8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -47,23 +47,24 @@ | |||
47 | #include "hda_codec.h" | 47 | #include "hda_codec.h" |
48 | 48 | ||
49 | 49 | ||
50 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 50 | static int index = SNDRV_DEFAULT_IDX1; |
51 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 51 | static char *id = SNDRV_DEFAULT_STR1; |
52 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 52 | static char *model; |
53 | static char *model[SNDRV_CARDS]; | 53 | static int position_fix; |
54 | static int position_fix[SNDRV_CARDS]; | ||
55 | 54 | ||
56 | module_param_array(index, int, NULL, 0444); | 55 | module_param(index, int, 0444); |
57 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); | 56 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); |
58 | module_param_array(id, charp, NULL, 0444); | 57 | module_param(id, charp, 0444); |
59 | MODULE_PARM_DESC(id, "ID string for Intel HD audio interface."); | 58 | MODULE_PARM_DESC(id, "ID string for Intel HD audio interface."); |
60 | module_param_array(enable, bool, NULL, 0444); | 59 | module_param(model, charp, 0444); |
61 | MODULE_PARM_DESC(enable, "Enable Intel HD audio interface."); | ||
62 | module_param_array(model, charp, NULL, 0444); | ||
63 | MODULE_PARM_DESC(model, "Use the given board model."); | 60 | MODULE_PARM_DESC(model, "Use the given board model."); |
64 | module_param_array(position_fix, int, NULL, 0444); | 61 | module_param(position_fix, int, 0444); |
65 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); | 62 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); |
66 | 63 | ||
64 | /* just for backward compatibility */ | ||
65 | static int enable; | ||
66 | module_param(enable, bool, 0444); | ||
67 | |||
67 | MODULE_LICENSE("GPL"); | 68 | MODULE_LICENSE("GPL"); |
68 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | 69 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," |
69 | "{Intel, ICH6M}," | 70 | "{Intel, ICH6M}," |
@@ -223,6 +224,9 @@ enum { | |||
223 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 | 224 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 |
224 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 | 225 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 |
225 | 226 | ||
227 | /* Defines for Nvidia HDA support */ | ||
228 | #define NVIDIA_HDA_TRANSREG_ADDR 0x4e | ||
229 | #define NVIDIA_HDA_ENABLE_COHBITS 0x0f | ||
226 | 230 | ||
227 | /* | 231 | /* |
228 | * Use CORB/RIRB for communication from/to codecs. | 232 | * Use CORB/RIRB for communication from/to codecs. |
@@ -328,6 +332,7 @@ enum { | |||
328 | AZX_DRIVER_VIA, | 332 | AZX_DRIVER_VIA, |
329 | AZX_DRIVER_SIS, | 333 | AZX_DRIVER_SIS, |
330 | AZX_DRIVER_ULI, | 334 | AZX_DRIVER_ULI, |
335 | AZX_DRIVER_NVIDIA, | ||
331 | }; | 336 | }; |
332 | 337 | ||
333 | static char *driver_short_names[] __devinitdata = { | 338 | static char *driver_short_names[] __devinitdata = { |
@@ -335,7 +340,8 @@ static char *driver_short_names[] __devinitdata = { | |||
335 | [AZX_DRIVER_ATI] = "HDA ATI SB", | 340 | [AZX_DRIVER_ATI] = "HDA ATI SB", |
336 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", | 341 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", |
337 | [AZX_DRIVER_SIS] = "HDA SIS966", | 342 | [AZX_DRIVER_SIS] = "HDA SIS966", |
338 | [AZX_DRIVER_ULI] = "HDA ULI M5461" | 343 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
344 | [AZX_DRIVER_NVIDIA] = "HDA NVidia", | ||
339 | }; | 345 | }; |
340 | 346 | ||
341 | /* | 347 | /* |
@@ -710,14 +716,14 @@ static void azx_stream_stop(azx_t *chip, azx_dev_t *azx_dev) | |||
710 | */ | 716 | */ |
711 | static void azx_init_chip(azx_t *chip) | 717 | static void azx_init_chip(azx_t *chip) |
712 | { | 718 | { |
713 | unsigned char tcsel_reg, ati_misc_cntl2; | 719 | unsigned char reg; |
714 | 720 | ||
715 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) | 721 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) |
716 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS | 722 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS |
717 | * Ensuring these bits are 0 clears playback static on some HD Audio codecs | 723 | * Ensuring these bits are 0 clears playback static on some HD Audio codecs |
718 | */ | 724 | */ |
719 | pci_read_config_byte (chip->pci, ICH6_PCIREG_TCSEL, &tcsel_reg); | 725 | pci_read_config_byte (chip->pci, ICH6_PCIREG_TCSEL, ®); |
720 | pci_write_config_byte(chip->pci, ICH6_PCIREG_TCSEL, tcsel_reg & 0xf8); | 726 | pci_write_config_byte(chip->pci, ICH6_PCIREG_TCSEL, reg & 0xf8); |
721 | 727 | ||
722 | /* reset controller */ | 728 | /* reset controller */ |
723 | azx_reset(chip); | 729 | azx_reset(chip); |
@@ -733,13 +739,21 @@ static void azx_init_chip(azx_t *chip) | |||
733 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); | 739 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); |
734 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); | 740 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); |
735 | 741 | ||
736 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ | 742 | switch (chip->driver_type) { |
737 | if (chip->driver_type == AZX_DRIVER_ATI) { | 743 | case AZX_DRIVER_ATI: |
744 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ | ||
738 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 745 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
739 | &ati_misc_cntl2); | 746 | ®); |
740 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 747 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
741 | (ati_misc_cntl2 & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP); | 748 | (reg & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP); |
742 | } | 749 | break; |
750 | case AZX_DRIVER_NVIDIA: | ||
751 | /* For NVIDIA HDA, enable snoop */ | ||
752 | pci_read_config_byte(chip->pci,NVIDIA_HDA_TRANSREG_ADDR, ®); | ||
753 | pci_write_config_byte(chip->pci,NVIDIA_HDA_TRANSREG_ADDR, | ||
754 | (reg & 0xf0) | NVIDIA_HDA_ENABLE_COHBITS); | ||
755 | break; | ||
756 | } | ||
743 | } | 757 | } |
744 | 758 | ||
745 | 759 | ||
@@ -1264,6 +1278,7 @@ static int __devinit azx_pcm_create(azx_t *chip) | |||
1264 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); | 1278 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); |
1265 | if (err < 0) | 1279 | if (err < 0) |
1266 | return err; | 1280 | return err; |
1281 | chip->pcm[pcm_dev]->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
1267 | pcm_dev++; | 1282 | pcm_dev++; |
1268 | } | 1283 | } |
1269 | } | 1284 | } |
@@ -1530,32 +1545,24 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1530 | 1545 | ||
1531 | static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | 1546 | static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) |
1532 | { | 1547 | { |
1533 | static int dev; | ||
1534 | snd_card_t *card; | 1548 | snd_card_t *card; |
1535 | azx_t *chip; | 1549 | azx_t *chip; |
1536 | int err = 0; | 1550 | int err = 0; |
1537 | 1551 | ||
1538 | if (dev >= SNDRV_CARDS) | 1552 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1539 | return -ENODEV; | ||
1540 | if (! enable[dev]) { | ||
1541 | dev++; | ||
1542 | return -ENOENT; | ||
1543 | } | ||
1544 | |||
1545 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1546 | if (NULL == card) { | 1553 | if (NULL == card) { |
1547 | snd_printk(KERN_ERR SFX "Error creating card!\n"); | 1554 | snd_printk(KERN_ERR SFX "Error creating card!\n"); |
1548 | return -ENOMEM; | 1555 | return -ENOMEM; |
1549 | } | 1556 | } |
1550 | 1557 | ||
1551 | if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data, | 1558 | if ((err = azx_create(card, pci, position_fix, pci_id->driver_data, |
1552 | &chip)) < 0) { | 1559 | &chip)) < 0) { |
1553 | snd_card_free(card); | 1560 | snd_card_free(card); |
1554 | return err; | 1561 | return err; |
1555 | } | 1562 | } |
1556 | 1563 | ||
1557 | /* create codec instances */ | 1564 | /* create codec instances */ |
1558 | if ((err = azx_codec_create(chip, model[dev])) < 0) { | 1565 | if ((err = azx_codec_create(chip, model)) < 0) { |
1559 | snd_card_free(card); | 1566 | snd_card_free(card); |
1560 | return err; | 1567 | return err; |
1561 | } | 1568 | } |
@@ -1581,7 +1588,6 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id * | |||
1581 | } | 1588 | } |
1582 | 1589 | ||
1583 | pci_set_drvdata(pci, card); | 1590 | pci_set_drvdata(pci, card); |
1584 | dev++; | ||
1585 | 1591 | ||
1586 | return err; | 1592 | return err; |
1587 | } | 1593 | } |
@@ -1601,6 +1607,8 @@ static struct pci_device_id azx_ids[] = { | |||
1601 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ | 1607 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ |
1602 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ | 1608 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ |
1603 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ | 1609 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ |
1610 | { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 026c */ | ||
1611 | { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 0371 */ | ||
1604 | { 0, } | 1612 | { 0, } |
1605 | }; | 1613 | }; |
1606 | MODULE_DEVICE_TABLE(pci, azx_ids); | 1614 | MODULE_DEVICE_TABLE(pci, azx_ids); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 810cfd2d9bba..f51a56f813c8 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -27,28 +27,36 @@ | |||
27 | * for mixer controls | 27 | * for mixer controls |
28 | */ | 28 | */ |
29 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) | 29 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) |
30 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | ||
30 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 31 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
31 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 32 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
32 | .info = snd_hda_mixer_amp_volume_info, \ | 33 | .info = snd_hda_mixer_amp_volume_info, \ |
33 | .get = snd_hda_mixer_amp_volume_get, \ | 34 | .get = snd_hda_mixer_amp_volume_get, \ |
34 | .put = snd_hda_mixer_amp_volume_put, \ | 35 | .put = snd_hda_mixer_amp_volume_put, \ |
35 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | 36 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } |
37 | /* stereo volume with index */ | ||
36 | #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \ | 38 | #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \ |
37 | HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) | 39 | HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) |
40 | /* mono volume */ | ||
38 | #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \ | 41 | #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \ |
39 | HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction) | 42 | HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction) |
43 | /* stereo volume */ | ||
40 | #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \ | 44 | #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \ |
41 | HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction) | 45 | HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction) |
46 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ | ||
42 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 47 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
43 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 48 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
44 | .info = snd_hda_mixer_amp_switch_info, \ | 49 | .info = snd_hda_mixer_amp_switch_info, \ |
45 | .get = snd_hda_mixer_amp_switch_get, \ | 50 | .get = snd_hda_mixer_amp_switch_get, \ |
46 | .put = snd_hda_mixer_amp_switch_put, \ | 51 | .put = snd_hda_mixer_amp_switch_put, \ |
47 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | 52 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } |
53 | /* stereo mute switch with index */ | ||
48 | #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \ | 54 | #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \ |
49 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) | 55 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) |
56 | /* mono mute switch */ | ||
50 | #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \ | 57 | #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \ |
51 | HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction) | 58 | HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction) |
59 | /* stereo mute switch */ | ||
52 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ | 60 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ |
53 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) | 61 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) |
54 | 62 | ||
@@ -59,6 +67,20 @@ int snd_hda_mixer_amp_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
59 | int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | 67 | int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); |
60 | int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | 68 | int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); |
61 | 69 | ||
70 | /* mono switch binding multiple inputs */ | ||
71 | #define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \ | ||
72 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
73 | .info = snd_hda_mixer_amp_switch_info, \ | ||
74 | .get = snd_hda_mixer_bind_switch_get, \ | ||
75 | .put = snd_hda_mixer_bind_switch_put, \ | ||
76 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) } | ||
77 | |||
78 | /* stereo switch binding multiple inputs */ | ||
79 | #define HDA_BIND_MUTE(xname,nid,indices,dir) HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir) | ||
80 | |||
81 | int snd_hda_mixer_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | ||
82 | int snd_hda_mixer_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); | ||
83 | |||
62 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); | 84 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); |
63 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); | 85 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); |
64 | 86 | ||
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 08f6a6efc5e6..39ddf1cd9019 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -281,6 +281,11 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
281 | print_pcm_caps(buffer, codec, nid); | 281 | print_pcm_caps(buffer, codec, nid); |
282 | } | 282 | } |
283 | 283 | ||
284 | if (wid_caps & AC_WCAP_POWER) | ||
285 | snd_iprintf(buffer, " Power: 0x%x\n", | ||
286 | snd_hda_codec_read(codec, nid, 0, | ||
287 | AC_VERB_GET_POWER_STATE, 0)); | ||
288 | |||
284 | if (wid_caps & AC_WCAP_CONN_LIST) { | 289 | if (wid_caps & AC_WCAP_CONN_LIST) { |
285 | int c, curr = -1; | 290 | int c, curr = -1; |
286 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) | 291 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index da6874d3988c..d7d636decef8 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -28,15 +28,38 @@ | |||
28 | #include "hda_local.h" | 28 | #include "hda_local.h" |
29 | 29 | ||
30 | struct ad198x_spec { | 30 | struct ad198x_spec { |
31 | struct semaphore amp_mutex; /* PCM volume/mute control mutex */ | 31 | snd_kcontrol_new_t *mixers[5]; |
32 | struct hda_multi_out multiout; /* playback */ | 32 | int num_mixers; |
33 | hda_nid_t adc_nid; | 33 | |
34 | const struct hda_verb *init_verbs[3]; /* initialization verbs | ||
35 | * don't forget NULL termination! | ||
36 | */ | ||
37 | unsigned int num_init_verbs; | ||
38 | |||
39 | /* playback */ | ||
40 | struct hda_multi_out multiout; /* playback set-up | ||
41 | * max_channels, dacs must be set | ||
42 | * dig_out_nid and hp_nid are optional | ||
43 | */ | ||
44 | |||
45 | /* capture */ | ||
46 | unsigned int num_adc_nids; | ||
47 | hda_nid_t *adc_nids; | ||
48 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | ||
49 | |||
50 | /* capture source */ | ||
34 | const struct hda_input_mux *input_mux; | 51 | const struct hda_input_mux *input_mux; |
35 | unsigned int cur_mux; /* capture source */ | 52 | unsigned int cur_mux[3]; |
53 | |||
54 | /* channel model */ | ||
55 | const struct alc_channel_mode *channel_mode; | ||
56 | int num_channel_mode; | ||
57 | |||
58 | /* PCM information */ | ||
59 | struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ | ||
60 | |||
61 | struct semaphore amp_mutex; /* PCM volume/mute control mutex */ | ||
36 | unsigned int spdif_route; | 62 | unsigned int spdif_route; |
37 | snd_kcontrol_new_t *mixers; | ||
38 | const struct hda_verb *init_verbs; | ||
39 | struct hda_pcm pcm_rec[2]; /* PCM information */ | ||
40 | }; | 63 | }; |
41 | 64 | ||
42 | /* | 65 | /* |
@@ -54,8 +77,9 @@ static int ad198x_mux_enum_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u | |||
54 | { | 77 | { |
55 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 78 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
56 | struct ad198x_spec *spec = codec->spec; | 79 | struct ad198x_spec *spec = codec->spec; |
80 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
57 | 81 | ||
58 | ucontrol->value.enumerated.item[0] = spec->cur_mux; | 82 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
59 | return 0; | 83 | return 0; |
60 | } | 84 | } |
61 | 85 | ||
@@ -63,9 +87,10 @@ static int ad198x_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u | |||
63 | { | 87 | { |
64 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 88 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
65 | struct ad198x_spec *spec = codec->spec; | 89 | struct ad198x_spec *spec = codec->spec; |
90 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
66 | 91 | ||
67 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 92 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
68 | spec->adc_nid, &spec->cur_mux); | 93 | spec->adc_nids[adc_idx], &spec->cur_mux[adc_idx]); |
69 | } | 94 | } |
70 | 95 | ||
71 | /* | 96 | /* |
@@ -74,22 +99,34 @@ static int ad198x_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u | |||
74 | static int ad198x_init(struct hda_codec *codec) | 99 | static int ad198x_init(struct hda_codec *codec) |
75 | { | 100 | { |
76 | struct ad198x_spec *spec = codec->spec; | 101 | struct ad198x_spec *spec = codec->spec; |
77 | snd_hda_sequence_write(codec, spec->init_verbs); | 102 | int i; |
103 | |||
104 | for (i = 0; i < spec->num_init_verbs; i++) | ||
105 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | ||
78 | return 0; | 106 | return 0; |
79 | } | 107 | } |
80 | 108 | ||
81 | static int ad198x_build_controls(struct hda_codec *codec) | 109 | static int ad198x_build_controls(struct hda_codec *codec) |
82 | { | 110 | { |
83 | struct ad198x_spec *spec = codec->spec; | 111 | struct ad198x_spec *spec = codec->spec; |
112 | unsigned int i; | ||
84 | int err; | 113 | int err; |
85 | 114 | ||
86 | err = snd_hda_add_new_ctls(codec, spec->mixers); | 115 | for (i = 0; i < spec->num_mixers; i++) { |
87 | if (err < 0) | 116 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
88 | return err; | 117 | if (err < 0) |
89 | if (spec->multiout.dig_out_nid) | 118 | return err; |
119 | } | ||
120 | if (spec->multiout.dig_out_nid) { | ||
90 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 121 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
91 | if (err < 0) | 122 | if (err < 0) |
92 | return err; | 123 | return err; |
124 | } | ||
125 | if (spec->dig_in_nid) { | ||
126 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | ||
127 | if (err < 0) | ||
128 | return err; | ||
129 | } | ||
93 | return 0; | 130 | return 0; |
94 | } | 131 | } |
95 | 132 | ||
@@ -152,7 +189,8 @@ static int ad198x_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
152 | snd_pcm_substream_t *substream) | 189 | snd_pcm_substream_t *substream) |
153 | { | 190 | { |
154 | struct ad198x_spec *spec = codec->spec; | 191 | struct ad198x_spec *spec = codec->spec; |
155 | snd_hda_codec_setup_stream(codec, spec->adc_nid, stream_tag, 0, format); | 192 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
193 | stream_tag, 0, format); | ||
156 | return 0; | 194 | return 0; |
157 | } | 195 | } |
158 | 196 | ||
@@ -161,7 +199,8 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
161 | snd_pcm_substream_t *substream) | 199 | snd_pcm_substream_t *substream) |
162 | { | 200 | { |
163 | struct ad198x_spec *spec = codec->spec; | 201 | struct ad198x_spec *spec = codec->spec; |
164 | snd_hda_codec_setup_stream(codec, spec->adc_nid, 0, 0, 0); | 202 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], |
203 | 0, 0, 0); | ||
165 | return 0; | 204 | return 0; |
166 | } | 205 | } |
167 | 206 | ||
@@ -171,7 +210,7 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
171 | static struct hda_pcm_stream ad198x_pcm_analog_playback = { | 210 | static struct hda_pcm_stream ad198x_pcm_analog_playback = { |
172 | .substreams = 1, | 211 | .substreams = 1, |
173 | .channels_min = 2, | 212 | .channels_min = 2, |
174 | .channels_max = 6, | 213 | .channels_max = 6, /* changed later */ |
175 | .nid = 0, /* fill later */ | 214 | .nid = 0, /* fill later */ |
176 | .ops = { | 215 | .ops = { |
177 | .open = ad198x_playback_pcm_open, | 216 | .open = ad198x_playback_pcm_open, |
@@ -181,7 +220,7 @@ static struct hda_pcm_stream ad198x_pcm_analog_playback = { | |||
181 | }; | 220 | }; |
182 | 221 | ||
183 | static struct hda_pcm_stream ad198x_pcm_analog_capture = { | 222 | static struct hda_pcm_stream ad198x_pcm_analog_capture = { |
184 | .substreams = 2, | 223 | .substreams = 1, |
185 | .channels_min = 2, | 224 | .channels_min = 2, |
186 | .channels_max = 2, | 225 | .channels_max = 2, |
187 | .nid = 0, /* fill later */ | 226 | .nid = 0, /* fill later */ |
@@ -202,6 +241,13 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = { | |||
202 | }, | 241 | }, |
203 | }; | 242 | }; |
204 | 243 | ||
244 | static struct hda_pcm_stream ad198x_pcm_digital_capture = { | ||
245 | .substreams = 1, | ||
246 | .channels_min = 2, | ||
247 | .channels_max = 2, | ||
248 | /* NID is set in alc_build_pcms */ | ||
249 | }; | ||
250 | |||
205 | static int ad198x_build_pcms(struct hda_codec *codec) | 251 | static int ad198x_build_pcms(struct hda_codec *codec) |
206 | { | 252 | { |
207 | struct ad198x_spec *spec = codec->spec; | 253 | struct ad198x_spec *spec = codec->spec; |
@@ -215,7 +261,8 @@ static int ad198x_build_pcms(struct hda_codec *codec) | |||
215 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->multiout.max_channels; | 261 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->multiout.max_channels; |
216 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | 262 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
217 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = ad198x_pcm_analog_capture; | 263 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = ad198x_pcm_analog_capture; |
218 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nid; | 264 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adc_nids; |
265 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | ||
219 | 266 | ||
220 | if (spec->multiout.dig_out_nid) { | 267 | if (spec->multiout.dig_out_nid) { |
221 | info++; | 268 | info++; |
@@ -223,6 +270,10 @@ static int ad198x_build_pcms(struct hda_codec *codec) | |||
223 | info->name = "AD198x Digital"; | 270 | info->name = "AD198x Digital"; |
224 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; | 271 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback; |
225 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | 272 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
273 | if (spec->dig_in_nid) { | ||
274 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = ad198x_pcm_digital_capture; | ||
275 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | ||
276 | } | ||
226 | } | 277 | } |
227 | 278 | ||
228 | return 0; | 279 | return 0; |
@@ -237,10 +288,15 @@ static void ad198x_free(struct hda_codec *codec) | |||
237 | static int ad198x_resume(struct hda_codec *codec) | 288 | static int ad198x_resume(struct hda_codec *codec) |
238 | { | 289 | { |
239 | struct ad198x_spec *spec = codec->spec; | 290 | struct ad198x_spec *spec = codec->spec; |
291 | int i; | ||
240 | 292 | ||
241 | ad198x_init(codec); | 293 | ad198x_init(codec); |
242 | snd_hda_resume_ctls(codec, spec->mixers); | 294 | for (i = 0; i < spec->num_mixers; i++) |
243 | snd_hda_resume_spdif_out(codec); | 295 | snd_hda_resume_ctls(codec, spec->mixers[i]); |
296 | if (spec->multiout.dig_out_nid) | ||
297 | snd_hda_resume_spdif_out(codec); | ||
298 | if (spec->dig_in_nid) | ||
299 | snd_hda_resume_spdif_in(codec); | ||
244 | return 0; | 300 | return 0; |
245 | } | 301 | } |
246 | #endif | 302 | #endif |
@@ -269,6 +325,7 @@ static struct hda_codec_ops ad198x_patch_ops = { | |||
269 | static hda_nid_t ad1986a_dac_nids[3] = { | 325 | static hda_nid_t ad1986a_dac_nids[3] = { |
270 | AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC | 326 | AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC |
271 | }; | 327 | }; |
328 | static hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC }; | ||
272 | 329 | ||
273 | static struct hda_input_mux ad1986a_capture_source = { | 330 | static struct hda_input_mux ad1986a_capture_source = { |
274 | .num_items = 7, | 331 | .num_items = 7, |
@@ -476,10 +533,13 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
476 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); | 533 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); |
477 | spec->multiout.dac_nids = ad1986a_dac_nids; | 534 | spec->multiout.dac_nids = ad1986a_dac_nids; |
478 | spec->multiout.dig_out_nid = AD1986A_SPDIF_OUT; | 535 | spec->multiout.dig_out_nid = AD1986A_SPDIF_OUT; |
479 | spec->adc_nid = AD1986A_ADC; | 536 | spec->num_adc_nids = 1; |
537 | spec->adc_nids = ad1986a_adc_nids; | ||
480 | spec->input_mux = &ad1986a_capture_source; | 538 | spec->input_mux = &ad1986a_capture_source; |
481 | spec->mixers = ad1986a_mixers; | 539 | spec->num_mixers = 1; |
482 | spec->init_verbs = ad1986a_init_verbs; | 540 | spec->mixers[0] = ad1986a_mixers; |
541 | spec->num_init_verbs = 1; | ||
542 | spec->init_verbs[0] = ad1986a_init_verbs; | ||
483 | 543 | ||
484 | codec->patch_ops = ad198x_patch_ops; | 544 | codec->patch_ops = ad198x_patch_ops; |
485 | 545 | ||
@@ -495,6 +555,7 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
495 | #define AD1983_ADC 0x04 | 555 | #define AD1983_ADC 0x04 |
496 | 556 | ||
497 | static hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC }; | 557 | static hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC }; |
558 | static hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC }; | ||
498 | 559 | ||
499 | static struct hda_input_mux ad1983_capture_source = { | 560 | static struct hda_input_mux ad1983_capture_source = { |
500 | .num_items = 4, | 561 | .num_items = 4, |
@@ -619,6 +680,7 @@ static struct hda_verb ad1983_init_verbs[] = { | |||
619 | { } /* end */ | 680 | { } /* end */ |
620 | }; | 681 | }; |
621 | 682 | ||
683 | |||
622 | static int patch_ad1983(struct hda_codec *codec) | 684 | static int patch_ad1983(struct hda_codec *codec) |
623 | { | 685 | { |
624 | struct ad198x_spec *spec; | 686 | struct ad198x_spec *spec; |
@@ -634,10 +696,13 @@ static int patch_ad1983(struct hda_codec *codec) | |||
634 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); | 696 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); |
635 | spec->multiout.dac_nids = ad1983_dac_nids; | 697 | spec->multiout.dac_nids = ad1983_dac_nids; |
636 | spec->multiout.dig_out_nid = AD1983_SPDIF_OUT; | 698 | spec->multiout.dig_out_nid = AD1983_SPDIF_OUT; |
637 | spec->adc_nid = AD1983_ADC; | 699 | spec->num_adc_nids = 1; |
700 | spec->adc_nids = ad1983_adc_nids; | ||
638 | spec->input_mux = &ad1983_capture_source; | 701 | spec->input_mux = &ad1983_capture_source; |
639 | spec->mixers = ad1983_mixers; | 702 | spec->num_mixers = 1; |
640 | spec->init_verbs = ad1983_init_verbs; | 703 | spec->mixers[0] = ad1983_mixers; |
704 | spec->num_init_verbs = 1; | ||
705 | spec->init_verbs[0] = ad1983_init_verbs; | ||
641 | spec->spdif_route = 0; | 706 | spec->spdif_route = 0; |
642 | 707 | ||
643 | codec->patch_ops = ad198x_patch_ops; | 708 | codec->patch_ops = ad198x_patch_ops; |
@@ -655,6 +720,7 @@ static int patch_ad1983(struct hda_codec *codec) | |||
655 | #define AD1981_ADC 0x04 | 720 | #define AD1981_ADC 0x04 |
656 | 721 | ||
657 | static hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC }; | 722 | static hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC }; |
723 | static hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC }; | ||
658 | 724 | ||
659 | /* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */ | 725 | /* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */ |
660 | static struct hda_input_mux ad1981_capture_source = { | 726 | static struct hda_input_mux ad1981_capture_source = { |
@@ -775,10 +841,13 @@ static int patch_ad1981(struct hda_codec *codec) | |||
775 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); | 841 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); |
776 | spec->multiout.dac_nids = ad1981_dac_nids; | 842 | spec->multiout.dac_nids = ad1981_dac_nids; |
777 | spec->multiout.dig_out_nid = AD1981_SPDIF_OUT; | 843 | spec->multiout.dig_out_nid = AD1981_SPDIF_OUT; |
778 | spec->adc_nid = AD1981_ADC; | 844 | spec->num_adc_nids = 1; |
845 | spec->adc_nids = ad1981_adc_nids; | ||
779 | spec->input_mux = &ad1981_capture_source; | 846 | spec->input_mux = &ad1981_capture_source; |
780 | spec->mixers = ad1981_mixers; | 847 | spec->num_mixers = 1; |
781 | spec->init_verbs = ad1981_init_verbs; | 848 | spec->mixers[0] = ad1981_mixers; |
849 | spec->num_init_verbs = 1; | ||
850 | spec->init_verbs[0] = ad1981_init_verbs; | ||
782 | spec->spdif_route = 0; | 851 | spec->spdif_route = 0; |
783 | 852 | ||
784 | codec->patch_ops = ad198x_patch_ops; | 853 | codec->patch_ops = ad198x_patch_ops; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7327deb6df9f..cffb83fdcff7 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -57,6 +57,7 @@ enum { | |||
57 | enum { | 57 | enum { |
58 | ALC260_BASIC, | 58 | ALC260_BASIC, |
59 | ALC260_HP, | 59 | ALC260_HP, |
60 | ALC260_FUJITSU_S702x, | ||
60 | ALC260_MODEL_LAST /* last tag */ | 61 | ALC260_MODEL_LAST /* last tag */ |
61 | }; | 62 | }; |
62 | 63 | ||
@@ -72,6 +73,7 @@ enum { | |||
72 | #define PIN_VREF50 0x21 | 73 | #define PIN_VREF50 0x21 |
73 | #define PIN_OUT 0x40 | 74 | #define PIN_OUT 0x40 |
74 | #define PIN_HP 0xc0 | 75 | #define PIN_HP 0xc0 |
76 | #define PIN_HP_AMP 0x80 | ||
75 | 77 | ||
76 | struct alc_spec { | 78 | struct alc_spec { |
77 | /* codec parameterization */ | 79 | /* codec parameterization */ |
@@ -113,8 +115,6 @@ struct alc_spec { | |||
113 | /* PCM information */ | 115 | /* PCM information */ |
114 | struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ | 116 | struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ |
115 | 117 | ||
116 | struct semaphore bind_mutex; /* for bound controls */ | ||
117 | |||
118 | /* dynamic controls, init_verbs and input_mux */ | 118 | /* dynamic controls, init_verbs and input_mux */ |
119 | struct auto_pin_cfg autocfg; | 119 | struct auto_pin_cfg autocfg; |
120 | unsigned int num_kctl_alloc, num_kctl_used; | 120 | unsigned int num_kctl_alloc, num_kctl_used; |
@@ -218,72 +218,53 @@ static int alc880_ch_mode_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc | |||
218 | 218 | ||
219 | 219 | ||
220 | /* | 220 | /* |
221 | * bound volume controls | 221 | * Control of pin widget settings via the mixer. Only boolean settings are |
222 | * | 222 | * supported, so VrefEn can't be controlled using these functions as they |
223 | * bind multiple volumes (# indices, from 0) | 223 | * stand. |
224 | */ | 224 | */ |
225 | 225 | static int alc_pinctl_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | |
226 | #define AMP_VAL_IDX_SHIFT 19 | ||
227 | #define AMP_VAL_IDX_MASK (0x0f<<19) | ||
228 | |||
229 | static int alc_bind_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | ||
230 | { | 226 | { |
231 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 227 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
232 | struct alc_spec *spec = codec->spec; | 228 | uinfo->count = 1; |
233 | unsigned long pval; | 229 | uinfo->value.integer.min = 0; |
234 | 230 | uinfo->value.integer.max = 1; | |
235 | down(&spec->bind_mutex); | ||
236 | pval = kcontrol->private_value; | ||
237 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ | ||
238 | snd_hda_mixer_amp_switch_info(kcontrol, uinfo); | ||
239 | kcontrol->private_value = pval; | ||
240 | up(&spec->bind_mutex); | ||
241 | return 0; | 231 | return 0; |
242 | } | 232 | } |
243 | 233 | ||
244 | static int alc_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 234 | static int alc_pinctl_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) |
245 | { | 235 | { |
246 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 236 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
247 | struct alc_spec *spec = codec->spec; | 237 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
248 | unsigned long pval; | 238 | long mask = (kcontrol->private_value >> 16) & 0xff; |
249 | 239 | long *valp = ucontrol->value.integer.value; | |
250 | down(&spec->bind_mutex); | 240 | |
251 | pval = kcontrol->private_value; | 241 | *valp = 0; |
252 | kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ | 242 | if (snd_hda_codec_read(codec,nid,0,AC_VERB_GET_PIN_WIDGET_CONTROL,0x00) & mask) |
253 | snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); | 243 | *valp = 1; |
254 | kcontrol->private_value = pval; | ||
255 | up(&spec->bind_mutex); | ||
256 | return 0; | 244 | return 0; |
257 | } | 245 | } |
258 | 246 | ||
259 | static int alc_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 247 | static int alc_pinctl_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) |
260 | { | 248 | { |
261 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 249 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
262 | struct alc_spec *spec = codec->spec; | 250 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
263 | unsigned long pval; | 251 | long mask = (kcontrol->private_value >> 16) & 0xff; |
264 | int i, indices, change = 0; | 252 | long *valp = ucontrol->value.integer.value; |
265 | 253 | unsigned int pinctl = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_PIN_WIDGET_CONTROL,0x00); | |
266 | down(&spec->bind_mutex); | 254 | int change = ((pinctl & mask)!=0) != *valp; |
267 | pval = kcontrol->private_value; | 255 | |
268 | indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; | 256 | if (change) |
269 | for (i = 0; i < indices; i++) { | 257 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, |
270 | kcontrol->private_value = (pval & ~AMP_VAL_IDX_MASK) | (i << AMP_VAL_IDX_SHIFT); | 258 | *valp?(pinctl|mask):(pinctl&~mask)); |
271 | change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); | ||
272 | } | ||
273 | kcontrol->private_value = pval; | ||
274 | up(&spec->bind_mutex); | ||
275 | return change; | 259 | return change; |
276 | } | 260 | } |
277 | 261 | ||
278 | #define ALC_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \ | 262 | #define ALC_PINCTL_SWITCH(xname, nid, mask) \ |
279 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | 263 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
280 | .info = alc_bind_switch_info, \ | 264 | .info = alc_pinctl_switch_info, \ |
281 | .get = alc_bind_switch_get, \ | 265 | .get = alc_pinctl_switch_get, \ |
282 | .put = alc_bind_switch_put, \ | 266 | .put = alc_pinctl_switch_put, \ |
283 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) } | 267 | .private_value = (nid) | (mask<<16) } |
284 | |||
285 | #define ALC_BIND_MUTE(xname,nid,indices,dir) ALC_BIND_MUTE_MONO(xname,nid,3,indices,dir) | ||
286 | |||
287 | 268 | ||
288 | /* | 269 | /* |
289 | * ALC880 3-stack model | 270 | * ALC880 3-stack model |
@@ -354,13 +335,13 @@ static struct alc_channel_mode alc880_threestack_modes[2] = { | |||
354 | 335 | ||
355 | static snd_kcontrol_new_t alc880_three_stack_mixer[] = { | 336 | static snd_kcontrol_new_t alc880_three_stack_mixer[] = { |
356 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 337 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
357 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 338 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
358 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 339 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
359 | ALC_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | 340 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
360 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 341 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
361 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 342 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
362 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 343 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
363 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | 344 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
364 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 345 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
365 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 346 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
366 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
@@ -441,7 +422,7 @@ static snd_kcontrol_new_t alc880_capture_alt_mixer[] = { | |||
441 | /* additional mixers to alc880_three_stack_mixer */ | 422 | /* additional mixers to alc880_three_stack_mixer */ |
442 | static snd_kcontrol_new_t alc880_five_stack_mixer[] = { | 423 | static snd_kcontrol_new_t alc880_five_stack_mixer[] = { |
443 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 424 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
444 | ALC_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), | 425 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
445 | { } /* end */ | 426 | { } /* end */ |
446 | }; | 427 | }; |
447 | 428 | ||
@@ -498,15 +479,15 @@ static struct alc_channel_mode alc880_sixstack_modes[1] = { | |||
498 | 479 | ||
499 | static snd_kcontrol_new_t alc880_six_stack_mixer[] = { | 480 | static snd_kcontrol_new_t alc880_six_stack_mixer[] = { |
500 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 481 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
501 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 482 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
502 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 483 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
503 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 484 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
504 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
505 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
506 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
507 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | 488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
508 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 489 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
509 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | 490 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
510 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 491 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
511 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 492 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
512 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 493 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
@@ -566,13 +547,13 @@ static struct alc_channel_mode alc880_w810_modes[1] = { | |||
566 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | 547 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
567 | static snd_kcontrol_new_t alc880_w810_base_mixer[] = { | 548 | static snd_kcontrol_new_t alc880_w810_base_mixer[] = { |
568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 549 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
569 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 550 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 551 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
571 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 552 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 553 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
573 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 554 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
574 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 555 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
575 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | 556 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 557 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
577 | { } /* end */ | 558 | { } /* end */ |
578 | }; | 559 | }; |
@@ -597,9 +578,9 @@ static struct alc_channel_mode alc880_2_jack_modes[1] = { | |||
597 | 578 | ||
598 | static snd_kcontrol_new_t alc880_z71v_mixer[] = { | 579 | static snd_kcontrol_new_t alc880_z71v_mixer[] = { |
599 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 580 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
600 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 581 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
601 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 582 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
602 | ALC_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | 583 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
603 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 584 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
604 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 585 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
605 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 586 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
@@ -623,9 +604,9 @@ static hda_nid_t alc880_f1734_dac_nids[1] = { | |||
623 | 604 | ||
624 | static snd_kcontrol_new_t alc880_f1734_mixer[] = { | 605 | static snd_kcontrol_new_t alc880_f1734_mixer[] = { |
625 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 606 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
626 | ALC_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | 607 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
627 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 608 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
628 | ALC_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | 609 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 610 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 611 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
631 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
@@ -648,13 +629,13 @@ static snd_kcontrol_new_t alc880_f1734_mixer[] = { | |||
648 | 629 | ||
649 | static snd_kcontrol_new_t alc880_asus_mixer[] = { | 630 | static snd_kcontrol_new_t alc880_asus_mixer[] = { |
650 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
651 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 632 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
652 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 633 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
653 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 634 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
654 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 635 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
655 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 636 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
656 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 637 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
657 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | 638 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
658 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 639 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
659 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 640 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
660 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 641 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
@@ -1383,10 +1364,10 @@ static snd_kcontrol_new_t alc880_test_mixer[] = { | |||
1383 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 1364 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
1384 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | 1365 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
1385 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 1366 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
1386 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 1367 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
1387 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 1368 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
1388 | ALC_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | 1369 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
1389 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | 1370 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
1390 | PIN_CTL_TEST("Front Pin Mode", 0x14), | 1371 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
1391 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | 1372 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
1392 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | 1373 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
@@ -1769,7 +1750,7 @@ enum { | |||
1769 | static snd_kcontrol_new_t alc880_control_templates[] = { | 1750 | static snd_kcontrol_new_t alc880_control_templates[] = { |
1770 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 1751 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
1771 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 1752 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
1772 | ALC_BIND_MUTE(NULL, 0, 0, 0), | 1753 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
1773 | }; | 1754 | }; |
1774 | 1755 | ||
1775 | /* add dynamic controls */ | 1756 | /* add dynamic controls */ |
@@ -2087,7 +2068,6 @@ static int patch_alc880(struct hda_codec *codec) | |||
2087 | if (spec == NULL) | 2068 | if (spec == NULL) |
2088 | return -ENOMEM; | 2069 | return -ENOMEM; |
2089 | 2070 | ||
2090 | init_MUTEX(&spec->bind_mutex); | ||
2091 | codec->spec = spec; | 2071 | codec->spec = spec; |
2092 | 2072 | ||
2093 | board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); | 2073 | board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); |
@@ -2205,6 +2185,17 @@ static struct hda_input_mux alc260_capture_source = { | |||
2205 | }, | 2185 | }, |
2206 | }; | 2186 | }; |
2207 | 2187 | ||
2188 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack | ||
2189 | * and the internal CD lines. | ||
2190 | */ | ||
2191 | static struct hda_input_mux alc260_fujitsu_capture_source = { | ||
2192 | .num_items = 2, | ||
2193 | .items = { | ||
2194 | { "Mic/Line", 0x0 }, | ||
2195 | { "CD", 0x4 }, | ||
2196 | }, | ||
2197 | }; | ||
2198 | |||
2208 | /* | 2199 | /* |
2209 | * This is just place-holder, so there's something for alc_build_pcms to look | 2200 | * This is just place-holder, so there's something for alc_build_pcms to look |
2210 | * at when it calculates the maximum number of channels. ALC260 has no mixer | 2201 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
@@ -2217,7 +2208,7 @@ static struct alc_channel_mode alc260_modes[1] = { | |||
2217 | 2208 | ||
2218 | static snd_kcontrol_new_t alc260_base_mixer[] = { | 2209 | static snd_kcontrol_new_t alc260_base_mixer[] = { |
2219 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | 2210 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
2220 | ALC_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | 2211 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
2221 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | 2212 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
2222 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | 2213 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
2223 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | 2214 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
@@ -2229,9 +2220,9 @@ static snd_kcontrol_new_t alc260_base_mixer[] = { | |||
2229 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | 2220 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
2230 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | 2221 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
2231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | 2222 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
2232 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | 2223 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
2233 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | 2224 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
2234 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | 2225 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
2235 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), | 2226 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
2236 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | 2227 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
2237 | { | 2228 | { |
@@ -2246,7 +2237,7 @@ static snd_kcontrol_new_t alc260_base_mixer[] = { | |||
2246 | 2237 | ||
2247 | static snd_kcontrol_new_t alc260_hp_mixer[] = { | 2238 | static snd_kcontrol_new_t alc260_hp_mixer[] = { |
2248 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | 2239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
2249 | ALC_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | 2240 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
2250 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | 2241 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
2251 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | 2242 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
2252 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | 2243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
@@ -2256,9 +2247,9 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = { | |||
2256 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | 2247 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
2257 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | 2248 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
2258 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | 2249 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
2259 | ALC_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | 2250 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
2260 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | 2251 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
2261 | ALC_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | 2252 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
2262 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), | 2253 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
2263 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), | 2254 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
2264 | { | 2255 | { |
@@ -2271,6 +2262,30 @@ static snd_kcontrol_new_t alc260_hp_mixer[] = { | |||
2271 | { } /* end */ | 2262 | { } /* end */ |
2272 | }; | 2263 | }; |
2273 | 2264 | ||
2265 | static snd_kcontrol_new_t alc260_fujitsu_mixer[] = { | ||
2266 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
2267 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | ||
2268 | ALC_PINCTL_SWITCH("Headphone Amp Switch", 0x14, PIN_HP_AMP), | ||
2269 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
2270 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
2271 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
2272 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
2273 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | ||
2274 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | ||
2275 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
2276 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), | ||
2277 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), | ||
2278 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), | ||
2279 | { | ||
2280 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2281 | .name = "Capture Source", | ||
2282 | .info = alc_mux_enum_info, | ||
2283 | .get = alc_mux_enum_get, | ||
2284 | .put = alc_mux_enum_put, | ||
2285 | }, | ||
2286 | { } /* end */ | ||
2287 | }; | ||
2288 | |||
2274 | static struct hda_verb alc260_init_verbs[] = { | 2289 | static struct hda_verb alc260_init_verbs[] = { |
2275 | /* Line In pin widget for input */ | 2290 | /* Line In pin widget for input */ |
2276 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 2291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
@@ -2332,6 +2347,60 @@ static struct hda_verb alc260_init_verbs[] = { | |||
2332 | { } | 2347 | { } |
2333 | }; | 2348 | }; |
2334 | 2349 | ||
2350 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | ||
2351 | * laptops. | ||
2352 | */ | ||
2353 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | ||
2354 | /* Disable all GPIOs */ | ||
2355 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | ||
2356 | /* Internal speaker is connected to headphone pin */ | ||
2357 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
2358 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | ||
2359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
2360 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ | ||
2361 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
2362 | /* Ensure all other unused pins are disabled and muted. | ||
2363 | * Note: trying to set widget 0x15 to anything blocks all audio | ||
2364 | * output for some reason, so just leave that at the default. | ||
2365 | */ | ||
2366 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2367 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2368 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2369 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2370 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
2371 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2372 | /* Disable digital (SPDIF) pins */ | ||
2373 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
2374 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
2375 | |||
2376 | /* Start with mixer outputs muted */ | ||
2377 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2378 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2379 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2380 | |||
2381 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | ||
2382 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2383 | /* Unmute Line1 pin widget amp left and right (no equiv mixer ctrl) */ | ||
2384 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
2385 | /* Unmute pin widget used for Line-in (no equiv mixer ctrl) */ | ||
2386 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2387 | |||
2388 | /* Mute capture amp left and right */ | ||
2389 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
2390 | /* Set ADC connection select to line in (on mic1 pin) */ | ||
2391 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
2392 | |||
2393 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
2394 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
2395 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
2396 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
2397 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
2398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
2399 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
2400 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
2401 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
2402 | }; | ||
2403 | |||
2335 | static struct hda_pcm_stream alc260_pcm_analog_playback = { | 2404 | static struct hda_pcm_stream alc260_pcm_analog_playback = { |
2336 | .substreams = 1, | 2405 | .substreams = 1, |
2337 | .channels_min = 2, | 2406 | .channels_min = 2, |
@@ -2347,6 +2416,8 @@ static struct hda_pcm_stream alc260_pcm_analog_capture = { | |||
2347 | static struct hda_board_config alc260_cfg_tbl[] = { | 2416 | static struct hda_board_config alc260_cfg_tbl[] = { |
2348 | { .modelname = "hp", .config = ALC260_HP }, | 2417 | { .modelname = "hp", .config = ALC260_HP }, |
2349 | { .pci_subvendor = 0x103c, .config = ALC260_HP }, | 2418 | { .pci_subvendor = 0x103c, .config = ALC260_HP }, |
2419 | { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702x }, | ||
2420 | { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702x }, | ||
2350 | {} | 2421 | {} |
2351 | }; | 2422 | }; |
2352 | 2423 | ||
@@ -2359,7 +2430,6 @@ static int patch_alc260(struct hda_codec *codec) | |||
2359 | if (spec == NULL) | 2430 | if (spec == NULL) |
2360 | return -ENOMEM; | 2431 | return -ENOMEM; |
2361 | 2432 | ||
2362 | init_MUTEX(&spec->bind_mutex); | ||
2363 | codec->spec = spec; | 2433 | codec->spec = spec; |
2364 | 2434 | ||
2365 | board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); | 2435 | board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); |
@@ -2373,14 +2443,23 @@ static int patch_alc260(struct hda_codec *codec) | |||
2373 | spec->mixers[spec->num_mixers] = alc260_hp_mixer; | 2443 | spec->mixers[spec->num_mixers] = alc260_hp_mixer; |
2374 | spec->num_mixers++; | 2444 | spec->num_mixers++; |
2375 | break; | 2445 | break; |
2446 | case ALC260_FUJITSU_S702x: | ||
2447 | spec->mixers[spec->num_mixers] = alc260_fujitsu_mixer; | ||
2448 | spec->num_mixers++; | ||
2449 | break; | ||
2376 | default: | 2450 | default: |
2377 | spec->mixers[spec->num_mixers] = alc260_base_mixer; | 2451 | spec->mixers[spec->num_mixers] = alc260_base_mixer; |
2378 | spec->num_mixers++; | 2452 | spec->num_mixers++; |
2379 | break; | 2453 | break; |
2380 | } | 2454 | } |
2381 | 2455 | ||
2382 | spec->init_verbs[0] = alc260_init_verbs; | 2456 | if (board_config != ALC260_FUJITSU_S702x) { |
2383 | spec->num_init_verbs = 1; | 2457 | spec->init_verbs[0] = alc260_init_verbs; |
2458 | spec->num_init_verbs = 1; | ||
2459 | } else { | ||
2460 | spec->init_verbs[0] = alc260_fujitsu_init_verbs; | ||
2461 | spec->num_init_verbs = 1; | ||
2462 | } | ||
2384 | 2463 | ||
2385 | spec->channel_mode = alc260_modes; | 2464 | spec->channel_mode = alc260_modes; |
2386 | spec->num_channel_mode = ARRAY_SIZE(alc260_modes); | 2465 | spec->num_channel_mode = ARRAY_SIZE(alc260_modes); |
@@ -2393,7 +2472,11 @@ static int patch_alc260(struct hda_codec *codec) | |||
2393 | spec->multiout.num_dacs = ARRAY_SIZE(alc260_dac_nids); | 2472 | spec->multiout.num_dacs = ARRAY_SIZE(alc260_dac_nids); |
2394 | spec->multiout.dac_nids = alc260_dac_nids; | 2473 | spec->multiout.dac_nids = alc260_dac_nids; |
2395 | 2474 | ||
2396 | spec->input_mux = &alc260_capture_source; | 2475 | if (board_config != ALC260_FUJITSU_S702x) { |
2476 | spec->input_mux = &alc260_capture_source; | ||
2477 | } else { | ||
2478 | spec->input_mux = &alc260_fujitsu_capture_source; | ||
2479 | } | ||
2397 | switch (board_config) { | 2480 | switch (board_config) { |
2398 | case ALC260_HP: | 2481 | case ALC260_HP: |
2399 | spec->num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids); | 2482 | spec->num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids); |
@@ -2483,15 +2566,15 @@ static int alc882_mux_enum_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *u | |||
2483 | */ | 2566 | */ |
2484 | static snd_kcontrol_new_t alc882_base_mixer[] = { | 2567 | static snd_kcontrol_new_t alc882_base_mixer[] = { |
2485 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 2568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2486 | ALC_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 2569 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
2487 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 2570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
2488 | ALC_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 2571 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
2489 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | 2572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
2490 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 2573 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
2491 | ALC_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | 2574 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2492 | ALC_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | 2575 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
2493 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | 2576 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
2494 | ALC_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | 2577 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
2495 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 2578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
2496 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 2579 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2497 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 2580 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
@@ -2609,7 +2692,6 @@ static int patch_alc882(struct hda_codec *codec) | |||
2609 | if (spec == NULL) | 2692 | if (spec == NULL) |
2610 | return -ENOMEM; | 2693 | return -ENOMEM; |
2611 | 2694 | ||
2612 | init_MUTEX(&spec->bind_mutex); | ||
2613 | codec->spec = spec; | 2695 | codec->spec = spec; |
2614 | 2696 | ||
2615 | spec->mixers[spec->num_mixers] = alc882_base_mixer; | 2697 | spec->mixers[spec->num_mixers] = alc882_base_mixer; |
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index d014b7bb70df..9c7fe0b3200a 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * HD audio interface patch for Silicon Labs 3054/5 modem codec | 4 | * HD audio interface patch for Silicon Labs 3054/5 modem codec |
5 | * | 5 | * |
6 | * Copyright (c) 2005 Sasha Khapyorsky <sashak@smlink.com> | 6 | * Copyright (c) 2005 Sasha Khapyorsky <sashak@alsa-project.org> |
7 | * Takashi Iwai <tiwai@suse.de> | 7 | * Takashi Iwai <tiwai@suse.de> |
8 | * | 8 | * |
9 | * | 9 | * |
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 2e0a31613ee6..db12b038286b 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c | |||
@@ -960,7 +960,7 @@ static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucont | |||
960 | if (change) | 960 | if (change) |
961 | wm_put(ice, WM_ADC_MUX, nval); | 961 | wm_put(ice, WM_ADC_MUX, nval); |
962 | snd_ice1712_restore_gpio_status(ice); | 962 | snd_ice1712_restore_gpio_status(ice); |
963 | return 0; | 963 | return change; |
964 | } | 964 | } |
965 | 965 | ||
966 | /* | 966 | /* |
@@ -1672,9 +1672,9 @@ static int __devinit aureon_add_controls(ice1712_t *ice) | |||
1672 | snd_ice1712_save_gpio_status(ice); | 1672 | snd_ice1712_save_gpio_status(ice); |
1673 | id = aureon_cs8415_get(ice, CS8415_ID); | 1673 | id = aureon_cs8415_get(ice, CS8415_ID); |
1674 | if (id != 0x41) | 1674 | if (id != 0x41) |
1675 | snd_printk("No CS8415 chip. Skipping CS8415 controls.\n"); | 1675 | snd_printk(KERN_INFO "No CS8415 chip. Skipping CS8415 controls.\n"); |
1676 | else if ((id & 0x0F) != 0x01) | 1676 | else if ((id & 0x0F) != 0x01) |
1677 | snd_printk("Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); | 1677 | snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); |
1678 | else { | 1678 | else { |
1679 | for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { | 1679 | for (i = 0; i< ARRAY_SIZE(cs8415_controls); i++) { |
1680 | snd_kcontrol_t *kctl; | 1680 | snd_kcontrol_t *kctl; |
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index 39fbe662965d..576f69d482c9 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c | |||
@@ -546,7 +546,7 @@ static int __devinit snd_ice1712_delta_init(ice1712_t *ice) | |||
546 | case ICE1712_SUBDEVICE_DELTA1010LT: | 546 | case ICE1712_SUBDEVICE_DELTA1010LT: |
547 | case ICE1712_SUBDEVICE_VX442: | 547 | case ICE1712_SUBDEVICE_VX442: |
548 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { | 548 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { |
549 | snd_printk("unable to create I2C bus\n"); | 549 | snd_printk(KERN_ERR "unable to create I2C bus\n"); |
550 | return err; | 550 | return err; |
551 | } | 551 | } |
552 | ice->i2c->private_data = ice; | 552 | ice->i2c->private_data = ice; |
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index e36efa1bdac3..c8ec5cac3c17 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c | |||
@@ -438,7 +438,7 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice) | |||
438 | 438 | ||
439 | /* create i2c */ | 439 | /* create i2c */ |
440 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { | 440 | if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { |
441 | snd_printk("unable to create I2C bus\n"); | 441 | snd_printk(KERN_ERR "unable to create I2C bus\n"); |
442 | return err; | 442 | return err; |
443 | } | 443 | } |
444 | ice->i2c->private_data = ice; | 444 | ice->i2c->private_data = ice; |
@@ -448,7 +448,7 @@ static int __devinit snd_ice1712_ews_init(ice1712_t *ice) | |||
448 | switch (ice->eeprom.subvendor) { | 448 | switch (ice->eeprom.subvendor) { |
449 | case ICE1712_SUBDEVICE_DMX6FIRE: | 449 | case ICE1712_SUBDEVICE_DMX6FIRE: |
450 | if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->spec.i2cdevs[EWS_I2C_6FIRE])) < 0) { | 450 | if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", ICE1712_6FIRE_PCF9554_ADDR, &ice->spec.i2cdevs[EWS_I2C_6FIRE])) < 0) { |
451 | snd_printk("PCF9554 initialization failed\n"); | 451 | snd_printk(KERN_ERR "PCF9554 initialization failed\n"); |
452 | return err; | 452 | return err; |
453 | } | 453 | } |
454 | snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); | 454 | snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); |
@@ -791,7 +791,7 @@ static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg) | |||
791 | byte = 0; | 791 | byte = 0; |
792 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { | 792 | if (snd_i2c_readbytes(ice->spec.i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { |
793 | snd_i2c_unlock(ice->i2c); | 793 | snd_i2c_unlock(ice->i2c); |
794 | printk("cannot read pca\n"); | 794 | printk(KERN_ERR "cannot read pca\n"); |
795 | return -EIO; | 795 | return -EIO; |
796 | } | 796 | } |
797 | snd_i2c_unlock(ice->i2c); | 797 | snd_i2c_unlock(ice->i2c); |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index a6d98013c331..5aca37798c32 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -387,7 +387,7 @@ int __devinit snd_ice1712_init_cs8427(ice1712_t *ice, int addr) | |||
387 | if ((err = snd_cs8427_create(ice->i2c, addr, | 387 | if ((err = snd_cs8427_create(ice->i2c, addr, |
388 | (ice->cs8427_timeout * HZ) / 1000, | 388 | (ice->cs8427_timeout * HZ) / 1000, |
389 | &ice->cs8427)) < 0) { | 389 | &ice->cs8427)) < 0) { |
390 | snd_printk("CS8427 initialization failed\n"); | 390 | snd_printk(KERN_ERR "CS8427 initialization failed\n"); |
391 | return err; | 391 | return err; |
392 | } | 392 | } |
393 | ice->spdif.ops.open = open_cs8427; | 393 | ice->spdif.ops.open = open_cs8427; |
@@ -2348,12 +2348,12 @@ static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice, const char *modelna | |||
2348 | if (ice->eeprom.size < 6) | 2348 | if (ice->eeprom.size < 6) |
2349 | ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ | 2349 | ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ |
2350 | else if (ice->eeprom.size > 32) { | 2350 | else if (ice->eeprom.size > 32) { |
2351 | snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); | 2351 | snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size); |
2352 | return -EIO; | 2352 | return -EIO; |
2353 | } | 2353 | } |
2354 | ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); | 2354 | ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); |
2355 | if (ice->eeprom.version != 1) { | 2355 | if (ice->eeprom.version != 1) { |
2356 | snd_printk("invalid EEPROM version %i\n", ice->eeprom.version); | 2356 | snd_printk(KERN_ERR "invalid EEPROM version %i\n", ice->eeprom.version); |
2357 | /* return -EIO; */ | 2357 | /* return -EIO; */ |
2358 | } | 2358 | } |
2359 | size = ice->eeprom.size - 6; | 2359 | size = ice->eeprom.size - 6; |
@@ -2524,7 +2524,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card, | |||
2524 | /* check, if we can restrict PCI DMA transfers to 28 bits */ | 2524 | /* check, if we can restrict PCI DMA transfers to 28 bits */ |
2525 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 2525 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || |
2526 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 2526 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { |
2527 | snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); | 2527 | snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); |
2528 | pci_disable_device(pci); | 2528 | pci_disable_device(pci); |
2529 | return -ENXIO; | 2529 | return -ENXIO; |
2530 | } | 2530 | } |
@@ -2573,7 +2573,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card, | |||
2573 | ice->profi_port = pci_resource_start(pci, 3); | 2573 | ice->profi_port = pci_resource_start(pci, 3); |
2574 | 2574 | ||
2575 | if (request_irq(pci->irq, snd_ice1712_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1712", (void *) ice)) { | 2575 | if (request_irq(pci->irq, snd_ice1712_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1712", (void *) ice)) { |
2576 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2576 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2577 | snd_ice1712_free(ice); | 2577 | snd_ice1712_free(ice); |
2578 | return -EIO; | 2578 | return -EIO; |
2579 | } | 2579 | } |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index c3ce8f93740b..5b4293f5a652 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -675,9 +675,12 @@ static snd_pcm_hardware_t snd_vt1724_spdif = | |||
675 | SNDRV_PCM_INFO_MMAP_VALID | | 675 | SNDRV_PCM_INFO_MMAP_VALID | |
676 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START), | 676 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START), |
677 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | 677 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
678 | .rates = SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, | 678 | .rates = (SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100| |
679 | SNDRV_PCM_RATE_48000|SNDRV_PCM_RATE_88200| | ||
680 | SNDRV_PCM_RATE_96000|SNDRV_PCM_RATE_176400| | ||
681 | SNDRV_PCM_RATE_192000), | ||
679 | .rate_min = 32000, | 682 | .rate_min = 32000, |
680 | .rate_max = 48000, | 683 | .rate_max = 192000, |
681 | .channels_min = 2, | 684 | .channels_min = 2, |
682 | .channels_max = 2, | 685 | .channels_max = 2, |
683 | .buffer_bytes_max = (1UL << 18), /* 16bits dword */ | 686 | .buffer_bytes_max = (1UL << 18), /* 16bits dword */ |
@@ -905,6 +908,10 @@ static void update_spdif_rate(ice1712_t *ice, unsigned int rate) | |||
905 | case 44100: break; | 908 | case 44100: break; |
906 | case 48000: nval |= 2 << 12; break; | 909 | case 48000: nval |= 2 << 12; break; |
907 | case 32000: nval |= 3 << 12; break; | 910 | case 32000: nval |= 3 << 12; break; |
911 | case 88200: nval |= 4 << 12; break; | ||
912 | case 96000: nval |= 5 << 12; break; | ||
913 | case 192000: nval |= 6 << 12; break; | ||
914 | case 176400: nval |= 7 << 12; break; | ||
908 | } | 915 | } |
909 | if (val != nval) | 916 | if (val != nval) |
910 | update_spdif_bits(ice, nval); | 917 | update_spdif_bits(ice, nval); |
@@ -1292,22 +1299,32 @@ static int snd_vt1724_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * | |||
1292 | 1299 | ||
1293 | static unsigned int encode_spdif_bits(snd_aes_iec958_t *diga) | 1300 | static unsigned int encode_spdif_bits(snd_aes_iec958_t *diga) |
1294 | { | 1301 | { |
1295 | unsigned int val; | 1302 | unsigned int val, rbits; |
1296 | 1303 | ||
1297 | val = diga->status[0] & 0x03; /* professional, non-audio */ | 1304 | val = diga->status[0] & 0x03; /* professional, non-audio */ |
1298 | if (val & 0x01) { | 1305 | if (val & 0x01) { |
1299 | /* professional */ | 1306 | /* professional */ |
1300 | if ((diga->status[0] & IEC958_AES0_PRO_EMPHASIS) == IEC958_AES0_PRO_EMPHASIS_5015) | 1307 | if ((diga->status[0] & IEC958_AES0_PRO_EMPHASIS) == IEC958_AES0_PRO_EMPHASIS_5015) |
1301 | val |= 1U << 3; | 1308 | val |= 1U << 3; |
1302 | switch (diga->status[0] & IEC958_AES0_PRO_FS) { | 1309 | rbits = (diga->status[4] >> 3) & 0x0f; |
1303 | case IEC958_AES0_PRO_FS_44100: | 1310 | if (rbits) { |
1304 | break; | 1311 | switch (rbits) { |
1305 | case IEC958_AES0_PRO_FS_32000: | 1312 | case 2: val |= 5 << 12; break; /* 96k */ |
1306 | val |= 3U << 12; | 1313 | case 3: val |= 6 << 12; break; /* 192k */ |
1307 | break; | 1314 | case 10: val |= 4 << 12; break; /* 88.2k */ |
1308 | default: | 1315 | case 11: val |= 7 << 12; break; /* 176.4k */ |
1309 | val |= 2U << 12; | 1316 | } |
1310 | break; | 1317 | } else { |
1318 | switch (diga->status[0] & IEC958_AES0_PRO_FS) { | ||
1319 | case IEC958_AES0_PRO_FS_44100: | ||
1320 | break; | ||
1321 | case IEC958_AES0_PRO_FS_32000: | ||
1322 | val |= 3U << 12; | ||
1323 | break; | ||
1324 | default: | ||
1325 | val |= 2U << 12; | ||
1326 | break; | ||
1327 | } | ||
1311 | } | 1328 | } |
1312 | } else { | 1329 | } else { |
1313 | /* consumer */ | 1330 | /* consumer */ |
@@ -2154,7 +2171,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card, | |||
2154 | ice->profi_port = pci_resource_start(pci, 1); | 2171 | ice->profi_port = pci_resource_start(pci, 1); |
2155 | 2172 | ||
2156 | if (request_irq(pci->irq, snd_vt1724_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1724", (void *) ice)) { | 2173 | if (request_irq(pci->irq, snd_vt1724_interrupt, SA_INTERRUPT|SA_SHIRQ, "ICE1724", (void *) ice)) { |
2157 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2174 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2158 | snd_vt1724_free(ice); | 2175 | snd_vt1724_free(ice); |
2159 | return -EIO; | 2176 | return -EIO; |
2160 | } | 2177 | } |
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index a5f852b1f575..773a1ecb75ce 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c | |||
@@ -794,8 +794,7 @@ static int __devinit pontis_init(ice1712_t *ice) | |||
794 | /* initialize WM8776 codec */ | 794 | /* initialize WM8776 codec */ |
795 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) | 795 | for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2) |
796 | wm_put(ice, wm_inits[i], wm_inits[i+1]); | 796 | wm_put(ice, wm_inits[i], wm_inits[i+1]); |
797 | set_current_state(TASK_UNINTERRUPTIBLE); | 797 | schedule_timeout_uninterruptible(1); |
798 | schedule_timeout(1); | ||
799 | for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2) | 798 | for (i = 0; i < ARRAY_SIZE(wm_inits2); i += 2) |
800 | wm_put(ice, wm_inits2[i], wm_inits2[i+1]); | 799 | wm_put(ice, wm_inits2[i], wm_inits2[i+1]); |
801 | 800 | ||
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c index d48d42524ac5..1fe21009ca84 100644 --- a/sound/pci/ice1712/revo.c +++ b/sound/pci/ice1712/revo.c | |||
@@ -128,17 +128,6 @@ static struct snd_ak4xxx_private akm_revo_surround_priv __devinitdata = { | |||
128 | .mask_flags = 0, | 128 | .mask_flags = 0, |
129 | }; | 129 | }; |
130 | 130 | ||
131 | static unsigned int rates[] = { | ||
132 | 32000, 44100, 48000, 64000, 88200, 96000, | ||
133 | 176400, 192000, | ||
134 | }; | ||
135 | |||
136 | static snd_pcm_hw_constraint_list_t revo_rates = { | ||
137 | .count = ARRAY_SIZE(rates), | ||
138 | .list = rates, | ||
139 | .mask = 0, | ||
140 | }; | ||
141 | |||
142 | static int __devinit revo_init(ice1712_t *ice) | 131 | static int __devinit revo_init(ice1712_t *ice) |
143 | { | 132 | { |
144 | akm4xxx_t *ak; | 133 | akm4xxx_t *ak; |
@@ -173,8 +162,6 @@ static int __devinit revo_init(ice1712_t *ice) | |||
173 | break; | 162 | break; |
174 | } | 163 | } |
175 | 164 | ||
176 | ice->hw_rates = &revo_rates; /* AK codecs don't support lower than 32k */ | ||
177 | |||
178 | return 0; | 165 | return 0; |
179 | } | 166 | } |
180 | 167 | ||
diff --git a/sound/pci/ice1712/vt1720_mobo.c b/sound/pci/ice1712/vt1720_mobo.c index ab61e383024f..90c85cd95479 100644 --- a/sound/pci/ice1712/vt1720_mobo.c +++ b/sound/pci/ice1712/vt1720_mobo.c | |||
@@ -71,6 +71,22 @@ static unsigned char k8x800_eeprom[] __devinitdata = { | |||
71 | 0x00, /* - */ | 71 | 0x00, /* - */ |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static unsigned char sn25p_eeprom[] __devinitdata = { | ||
75 | 0x01, /* SYSCONF: clock 256, 1ADC, 2DACs */ | ||
76 | 0x02, /* ACLINK: ACLINK, packed */ | ||
77 | 0x00, /* I2S: - */ | ||
78 | 0x41, /* SPDIF: - */ | ||
79 | 0xff, /* GPIO_DIR */ | ||
80 | 0xff, /* GPIO_DIR1 */ | ||
81 | 0x00, /* - */ | ||
82 | 0xff, /* GPIO_MASK */ | ||
83 | 0xff, /* GPIO_MASK1 */ | ||
84 | 0x00, /* - */ | ||
85 | 0x00, /* GPIO_STATE */ | ||
86 | 0x00, /* GPIO_STATE1 */ | ||
87 | 0x00, /* - */ | ||
88 | }; | ||
89 | |||
74 | 90 | ||
75 | /* entry point */ | 91 | /* entry point */ |
76 | struct snd_ice1712_card_info snd_vt1720_mobo_cards[] __devinitdata = { | 92 | struct snd_ice1712_card_info snd_vt1720_mobo_cards[] __devinitdata = { |
@@ -113,11 +129,11 @@ struct snd_ice1712_card_info snd_vt1720_mobo_cards[] __devinitdata = { | |||
113 | { | 129 | { |
114 | .subvendor = VT1720_SUBDEVICE_SN25P, | 130 | .subvendor = VT1720_SUBDEVICE_SN25P, |
115 | .name = "Shuttle SN25P", | 131 | .name = "Shuttle SN25P", |
116 | /* identical with k8x800 */ | 132 | .model = "sn25p", |
117 | .chip_init = k8x800_init, | 133 | .chip_init = k8x800_init, |
118 | .build_controls = k8x800_add_controls, | 134 | .build_controls = k8x800_add_controls, |
119 | .eeprom_size = sizeof(k8x800_eeprom), | 135 | .eeprom_size = sizeof(k8x800_eeprom), |
120 | .eeprom_data = k8x800_eeprom, | 136 | .eeprom_data = sn25p_eeprom, |
121 | }, | 137 | }, |
122 | { } /* terminator */ | 138 | { } /* terminator */ |
123 | }; | 139 | }; |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 1a96198a17ae..0801083f32dd 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -64,36 +64,35 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | |||
64 | "{AMD,AMD8111}," | 64 | "{AMD,AMD8111}," |
65 | "{ALI,M5455}}"); | 65 | "{ALI,M5455}}"); |
66 | 66 | ||
67 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 67 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
68 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 68 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
69 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 69 | static int ac97_clock = 0; |
70 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | 70 | static char *ac97_quirk; |
71 | static char *ac97_quirk[SNDRV_CARDS]; | 71 | static int buggy_semaphore; |
72 | static int buggy_semaphore[SNDRV_CARDS]; | 72 | static int buggy_irq = -1; /* auto-check */ |
73 | static int buggy_irq[SNDRV_CARDS]; | 73 | static int xbox; |
74 | static int xbox[SNDRV_CARDS]; | 74 | |
75 | 75 | module_param(index, int, 0444); | |
76 | #ifdef SUPPORT_MIDI | ||
77 | static int mpu_port[SNDRV_CARDS]; /* disabled */ | ||
78 | #endif | ||
79 | |||
80 | module_param_array(index, int, NULL, 0444); | ||
81 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard."); | 76 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard."); |
82 | module_param_array(id, charp, NULL, 0444); | 77 | module_param(id, charp, 0444); |
83 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard."); | 78 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard."); |
84 | module_param_array(enable, bool, NULL, 0444); | 79 | module_param(ac97_clock, int, 0444); |
85 | MODULE_PARM_DESC(enable, "Enable Intel i8x0 soundcard."); | ||
86 | module_param_array(ac97_clock, int, NULL, 0444); | ||
87 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | 80 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); |
88 | module_param_array(ac97_quirk, charp, NULL, 0444); | 81 | module_param(ac97_quirk, charp, 0444); |
89 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | 82 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); |
90 | module_param_array(buggy_semaphore, bool, NULL, 0444); | 83 | module_param(buggy_semaphore, bool, 0444); |
91 | MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); | 84 | MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); |
92 | module_param_array(buggy_irq, bool, NULL, 0444); | 85 | module_param(buggy_irq, bool, 0444); |
93 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); | 86 | MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); |
94 | module_param_array(xbox, bool, NULL, 0444); | 87 | module_param(xbox, bool, 0444); |
95 | MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); | 88 | MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); |
96 | 89 | ||
90 | /* just for backward compatibility */ | ||
91 | static int enable; | ||
92 | module_param(enable, bool, 0444); | ||
93 | static int joystick; | ||
94 | module_param(joystick, int, 0444); | ||
95 | |||
97 | /* | 96 | /* |
98 | * Direct registers | 97 | * Direct registers |
99 | */ | 98 | */ |
@@ -539,7 +538,7 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec) | |||
539 | /* access to some forbidden (non existant) ac97 registers will not | 538 | /* access to some forbidden (non existant) ac97 registers will not |
540 | * reset the semaphore. So even if you don't get the semaphore, still | 539 | * reset the semaphore. So even if you don't get the semaphore, still |
541 | * continue the access. We don't need the semaphore anyway. */ | 540 | * continue the access. We don't need the semaphore anyway. */ |
542 | snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", | 541 | snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", |
543 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); | 542 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); |
544 | iagetword(chip, 0); /* clear semaphore flag */ | 543 | iagetword(chip, 0); /* clear semaphore flag */ |
545 | /* I don't care about the semaphore */ | 544 | /* I don't care about the semaphore */ |
@@ -554,7 +553,7 @@ static void snd_intel8x0_codec_write(ac97_t *ac97, | |||
554 | 553 | ||
555 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { | 554 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { |
556 | if (! chip->in_ac97_init) | 555 | if (! chip->in_ac97_init) |
557 | snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 556 | snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
558 | } | 557 | } |
559 | iaputword(chip, reg + ac97->num * 0x80, val); | 558 | iaputword(chip, reg + ac97->num * 0x80, val); |
560 | } | 559 | } |
@@ -568,7 +567,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
568 | 567 | ||
569 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { | 568 | if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { |
570 | if (! chip->in_ac97_init) | 569 | if (! chip->in_ac97_init) |
571 | snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 570 | snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
572 | res = 0xffff; | 571 | res = 0xffff; |
573 | } else { | 572 | } else { |
574 | res = iagetword(chip, reg + ac97->num * 0x80); | 573 | res = iagetword(chip, reg + ac97->num * 0x80); |
@@ -576,7 +575,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
576 | /* reset RCS and preserve other R/WC bits */ | 575 | /* reset RCS and preserve other R/WC bits */ |
577 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); | 576 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); |
578 | if (! chip->in_ac97_init) | 577 | if (! chip->in_ac97_init) |
579 | snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); | 578 | snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); |
580 | res = 0xffff; | 579 | res = 0xffff; |
581 | } | 580 | } |
582 | } | 581 | } |
@@ -607,16 +606,19 @@ static int snd_intel8x0_ali_codec_ready(intel8x0_t *chip, int mask) | |||
607 | if (val & mask) | 606 | if (val & mask) |
608 | return 0; | 607 | return 0; |
609 | } | 608 | } |
610 | snd_printd(KERN_WARNING "intel8x0: AC97 codec ready timeout.\n"); | 609 | if (! chip->in_ac97_init) |
610 | snd_printd(KERN_WARNING "intel8x0: AC97 codec ready timeout.\n"); | ||
611 | return -EBUSY; | 611 | return -EBUSY; |
612 | } | 612 | } |
613 | 613 | ||
614 | static int snd_intel8x0_ali_codec_semaphore(intel8x0_t *chip) | 614 | static int snd_intel8x0_ali_codec_semaphore(intel8x0_t *chip) |
615 | { | 615 | { |
616 | int time = 100; | 616 | int time = 100; |
617 | if (chip->buggy_semaphore) | ||
618 | return 0; /* just ignore ... */ | ||
617 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) | 619 | while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) |
618 | udelay(1); | 620 | udelay(1); |
619 | if (! time) | 621 | if (! time && ! chip->in_ac97_init) |
620 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); | 622 | snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n"); |
621 | return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY); | 623 | return snd_intel8x0_ali_codec_ready(chip, ALI_CSPSR_CODEC_READY); |
622 | } | 624 | } |
@@ -1716,6 +1718,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1716 | .type = AC97_TUNE_HP_ONLY | 1718 | .type = AC97_TUNE_HP_ONLY |
1717 | }, | 1719 | }, |
1718 | { | 1720 | { |
1721 | .subvendor = 0x1025, | ||
1722 | .subdevice = 0x0083, | ||
1723 | .name = "Acer Aspire 3003LCi", | ||
1724 | .type = AC97_TUNE_HP_ONLY | ||
1725 | }, | ||
1726 | { | ||
1719 | .subvendor = 0x1028, | 1727 | .subvendor = 0x1028, |
1720 | .subdevice = 0x00d8, | 1728 | .subdevice = 0x00d8, |
1721 | .name = "Dell Precision 530", /* AD1885 */ | 1729 | .name = "Dell Precision 530", /* AD1885 */ |
@@ -1758,6 +1766,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { | |||
1758 | .type = AC97_TUNE_HP_ONLY | 1766 | .type = AC97_TUNE_HP_ONLY |
1759 | }, | 1767 | }, |
1760 | { | 1768 | { |
1769 | .subvendor = 0x1028, | ||
1770 | .subdevice = 0x0191, | ||
1771 | .name = "Dell Inspiron 8600", | ||
1772 | .type = AC97_TUNE_HP_ONLY | ||
1773 | }, | ||
1774 | { | ||
1761 | .subvendor = 0x103c, | 1775 | .subvendor = 0x103c, |
1762 | .subdevice = 0x006d, | 1776 | .subdevice = 0x006d, |
1763 | .name = "HP zv5000", | 1777 | .name = "HP zv5000", |
@@ -2022,7 +2036,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock, const | |||
2022 | if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) | 2036 | if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) |
2023 | goto __err; | 2037 | goto __err; |
2024 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; | 2038 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; |
2025 | pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with modem driver */ | ||
2026 | if (ac97_clock >= 8000 && ac97_clock <= 48000) | 2039 | if (ac97_clock >= 8000 && ac97_clock <= 48000) |
2027 | pbus->clock = ac97_clock; | 2040 | pbus->clock = ac97_clock; |
2028 | /* FIXME: my test board doesn't work well with VRA... */ | 2041 | /* FIXME: my test board doesn't work well with VRA... */ |
@@ -2131,14 +2144,13 @@ static void do_ali_reset(intel8x0_t *chip) | |||
2131 | iputdword(chip, ICHREG(ALI_FIFOCR2), 0x83838383); | 2144 | iputdword(chip, ICHREG(ALI_FIFOCR2), 0x83838383); |
2132 | iputdword(chip, ICHREG(ALI_FIFOCR3), 0x83838383); | 2145 | iputdword(chip, ICHREG(ALI_FIFOCR3), 0x83838383); |
2133 | iputdword(chip, ICHREG(ALI_INTERFACECR), | 2146 | iputdword(chip, ICHREG(ALI_INTERFACECR), |
2134 | ICH_ALI_IF_MC|ICH_ALI_IF_PI|ICH_ALI_IF_PO); | 2147 | ICH_ALI_IF_PI|ICH_ALI_IF_PO); |
2135 | iputdword(chip, ICHREG(ALI_INTERRUPTCR), 0x00000000); | 2148 | iputdword(chip, ICHREG(ALI_INTERRUPTCR), 0x00000000); |
2136 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); | 2149 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); |
2137 | } | 2150 | } |
2138 | 2151 | ||
2139 | #define do_delay(chip) do {\ | 2152 | #define do_delay(chip) do {\ |
2140 | set_current_state(TASK_UNINTERRUPTIBLE);\ | 2153 | schedule_timeout_uninterruptible(1);\ |
2141 | schedule_timeout(1);\ | ||
2142 | } while (0) | 2154 | } while (0) |
2143 | 2155 | ||
2144 | static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) | 2156 | static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) |
@@ -2166,7 +2178,7 @@ static int snd_intel8x0_ich_chip_init(intel8x0_t *chip, int probing) | |||
2166 | goto __ok; | 2178 | goto __ok; |
2167 | do_delay(chip); | 2179 | do_delay(chip); |
2168 | } while (time_after_eq(end_time, jiffies)); | 2180 | } while (time_after_eq(end_time, jiffies)); |
2169 | snd_printk("AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); | 2181 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); |
2170 | return -EIO; | 2182 | return -EIO; |
2171 | 2183 | ||
2172 | __ok: | 2184 | __ok: |
@@ -2441,7 +2453,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
2441 | 2453 | ||
2442 | subs = chip->pcm[0]->streams[0].substream; | 2454 | subs = chip->pcm[0]->streams[0].substream; |
2443 | if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { | 2455 | if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { |
2444 | snd_printk("no playback buffer allocated - aborting measure ac97 clock\n"); | 2456 | snd_printk(KERN_WARNING "no playback buffer allocated - aborting measure ac97 clock\n"); |
2445 | return; | 2457 | return; |
2446 | } | 2458 | } |
2447 | ichdev = &chip->ichd[ICHD_PCMOUT]; | 2459 | ichdev = &chip->ichd[ICHD_PCMOUT]; |
@@ -2477,7 +2489,7 @@ static void __devinit intel8x0_measure_ac97_clock(intel8x0_t *chip) | |||
2477 | do_gettimeofday(&stop_time); | 2489 | do_gettimeofday(&stop_time); |
2478 | /* stop */ | 2490 | /* stop */ |
2479 | if (chip->device_type == DEVICE_ALI) { | 2491 | if (chip->device_type == DEVICE_ALI) { |
2480 | iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 8)); | 2492 | iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); |
2481 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); | 2493 | iputbyte(chip, port + ICH_REG_OFF_CR, 0); |
2482 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) | 2494 | while (igetbyte(chip, port + ICH_REG_OFF_CR)) |
2483 | ; | 2495 | ; |
@@ -2556,7 +2568,6 @@ struct ich_reg_info { | |||
2556 | static int __devinit snd_intel8x0_create(snd_card_t * card, | 2568 | static int __devinit snd_intel8x0_create(snd_card_t * card, |
2557 | struct pci_dev *pci, | 2569 | struct pci_dev *pci, |
2558 | unsigned long device_type, | 2570 | unsigned long device_type, |
2559 | int buggy_sem, | ||
2560 | intel8x0_t ** r_intel8x0) | 2571 | intel8x0_t ** r_intel8x0) |
2561 | { | 2572 | { |
2562 | intel8x0_t *chip; | 2573 | intel8x0_t *chip; |
@@ -2614,18 +2625,17 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2614 | chip->card = card; | 2625 | chip->card = card; |
2615 | chip->pci = pci; | 2626 | chip->pci = pci; |
2616 | chip->irq = -1; | 2627 | chip->irq = -1; |
2617 | chip->buggy_semaphore = buggy_sem; | 2628 | |
2629 | /* module parameters */ | ||
2630 | chip->buggy_irq = buggy_irq; | ||
2631 | chip->buggy_semaphore = buggy_semaphore; | ||
2632 | if (xbox) | ||
2633 | chip->xbox = 1; | ||
2618 | 2634 | ||
2619 | if (pci->vendor == PCI_VENDOR_ID_INTEL && | 2635 | if (pci->vendor == PCI_VENDOR_ID_INTEL && |
2620 | pci->device == PCI_DEVICE_ID_INTEL_440MX) | 2636 | pci->device == PCI_DEVICE_ID_INTEL_440MX) |
2621 | chip->fix_nocache = 1; /* enable workaround */ | 2637 | chip->fix_nocache = 1; /* enable workaround */ |
2622 | 2638 | ||
2623 | /* some Nforce[2] and ICH boards have problems with IRQ handling. | ||
2624 | * Needs to return IRQ_HANDLED for unknown irqs. | ||
2625 | */ | ||
2626 | if (device_type == DEVICE_NFORCE) | ||
2627 | chip->buggy_irq = 1; | ||
2628 | |||
2629 | if ((err = pci_request_regions(pci, card->shortname)) < 0) { | 2639 | if ((err = pci_request_regions(pci, card->shortname)) < 0) { |
2630 | kfree(chip); | 2640 | kfree(chip); |
2631 | pci_disable_device(pci); | 2641 | pci_disable_device(pci); |
@@ -2644,7 +2654,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2644 | chip->remap_addr = ioremap_nocache(chip->addr, | 2654 | chip->remap_addr = ioremap_nocache(chip->addr, |
2645 | pci_resource_len(pci, 2)); | 2655 | pci_resource_len(pci, 2)); |
2646 | if (chip->remap_addr == NULL) { | 2656 | if (chip->remap_addr == NULL) { |
2647 | snd_printk("AC'97 space ioremap problem\n"); | 2657 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
2648 | snd_intel8x0_free(chip); | 2658 | snd_intel8x0_free(chip); |
2649 | return -EIO; | 2659 | return -EIO; |
2650 | } | 2660 | } |
@@ -2657,7 +2667,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2657 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, | 2667 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, |
2658 | pci_resource_len(pci, 3)); | 2668 | pci_resource_len(pci, 3)); |
2659 | if (chip->remap_bmaddr == NULL) { | 2669 | if (chip->remap_bmaddr == NULL) { |
2660 | snd_printk("Controller space ioremap problem\n"); | 2670 | snd_printk(KERN_ERR "Controller space ioremap problem\n"); |
2661 | snd_intel8x0_free(chip); | 2671 | snd_intel8x0_free(chip); |
2662 | return -EIO; | 2672 | return -EIO; |
2663 | } | 2673 | } |
@@ -2666,15 +2676,6 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2666 | } | 2676 | } |
2667 | 2677 | ||
2668 | port_inited: | 2678 | port_inited: |
2669 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | ||
2670 | snd_printk("unable to grab IRQ %d\n", pci->irq); | ||
2671 | snd_intel8x0_free(chip); | ||
2672 | return -EBUSY; | ||
2673 | } | ||
2674 | chip->irq = pci->irq; | ||
2675 | pci_set_master(pci); | ||
2676 | synchronize_irq(chip->irq); | ||
2677 | |||
2678 | chip->bdbars_count = bdbars[device_type]; | 2679 | chip->bdbars_count = bdbars[device_type]; |
2679 | 2680 | ||
2680 | /* initialize offsets */ | 2681 | /* initialize offsets */ |
@@ -2725,13 +2726,27 @@ static int __devinit snd_intel8x0_create(snd_card_t * card, | |||
2725 | int_sta_masks = 0; | 2726 | int_sta_masks = 0; |
2726 | for (i = 0; i < chip->bdbars_count; i++) { | 2727 | for (i = 0; i < chip->bdbars_count; i++) { |
2727 | ichdev = &chip->ichd[i]; | 2728 | ichdev = &chip->ichd[i]; |
2728 | ichdev->bdbar = ((u32 *)chip->bdbars.area) + (i * ICH_MAX_FRAGS * 2); | 2729 | ichdev->bdbar = ((u32 *)chip->bdbars.area) + |
2729 | ichdev->bdbar_addr = chip->bdbars.addr + (i * sizeof(u32) * ICH_MAX_FRAGS * 2); | 2730 | (i * ICH_MAX_FRAGS * 2); |
2731 | ichdev->bdbar_addr = chip->bdbars.addr + | ||
2732 | (i * sizeof(u32) * ICH_MAX_FRAGS * 2); | ||
2730 | int_sta_masks |= ichdev->int_sta_mask; | 2733 | int_sta_masks |= ichdev->int_sta_mask; |
2731 | } | 2734 | } |
2732 | chip->int_sta_reg = device_type == DEVICE_ALI ? ICH_REG_ALI_INTERRUPTSR : ICH_REG_GLOB_STA; | 2735 | chip->int_sta_reg = device_type == DEVICE_ALI ? |
2736 | ICH_REG_ALI_INTERRUPTSR : ICH_REG_GLOB_STA; | ||
2733 | chip->int_sta_mask = int_sta_masks; | 2737 | chip->int_sta_mask = int_sta_masks; |
2734 | 2738 | ||
2739 | /* request irq after initializaing int_sta_mask, etc */ | ||
2740 | if (request_irq(pci->irq, snd_intel8x0_interrupt, | ||
2741 | SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | ||
2742 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | ||
2743 | snd_intel8x0_free(chip); | ||
2744 | return -EBUSY; | ||
2745 | } | ||
2746 | chip->irq = pci->irq; | ||
2747 | pci_set_master(pci); | ||
2748 | synchronize_irq(chip->irq); | ||
2749 | |||
2735 | if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) { | 2750 | if ((err = snd_intel8x0_chip_init(chip, 1)) < 0) { |
2736 | snd_intel8x0_free(chip); | 2751 | snd_intel8x0_free(chip); |
2737 | return err; | 2752 | return err; |
@@ -2782,20 +2797,12 @@ static struct shortname_table { | |||
2782 | static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | 2797 | static int __devinit snd_intel8x0_probe(struct pci_dev *pci, |
2783 | const struct pci_device_id *pci_id) | 2798 | const struct pci_device_id *pci_id) |
2784 | { | 2799 | { |
2785 | static int dev; | ||
2786 | snd_card_t *card; | 2800 | snd_card_t *card; |
2787 | intel8x0_t *chip; | 2801 | intel8x0_t *chip; |
2788 | int err; | 2802 | int err; |
2789 | struct shortname_table *name; | 2803 | struct shortname_table *name; |
2790 | 2804 | ||
2791 | if (dev >= SNDRV_CARDS) | 2805 | card = snd_card_new(index, id, THIS_MODULE, 0); |
2792 | return -ENODEV; | ||
2793 | if (!enable[dev]) { | ||
2794 | dev++; | ||
2795 | return -ENOENT; | ||
2796 | } | ||
2797 | |||
2798 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
2799 | if (card == NULL) | 2806 | if (card == NULL) |
2800 | return -ENOMEM; | 2807 | return -ENOMEM; |
2801 | 2808 | ||
@@ -2819,17 +2826,23 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2819 | } | 2826 | } |
2820 | } | 2827 | } |
2821 | 2828 | ||
2829 | if (buggy_irq < 0) { | ||
2830 | /* some Nforce[2] and ICH boards have problems with IRQ handling. | ||
2831 | * Needs to return IRQ_HANDLED for unknown irqs. | ||
2832 | */ | ||
2833 | if (pci_id->driver_data == DEVICE_NFORCE) | ||
2834 | buggy_irq = 1; | ||
2835 | else | ||
2836 | buggy_irq = 0; | ||
2837 | } | ||
2838 | |||
2822 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, | 2839 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, |
2823 | buggy_semaphore[dev], &chip)) < 0) { | 2840 | &chip)) < 0) { |
2824 | snd_card_free(card); | 2841 | snd_card_free(card); |
2825 | return err; | 2842 | return err; |
2826 | } | 2843 | } |
2827 | if (buggy_irq[dev]) | ||
2828 | chip->buggy_irq = 1; | ||
2829 | if (xbox[dev]) | ||
2830 | chip->xbox = 1; | ||
2831 | 2844 | ||
2832 | if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev], ac97_quirk[dev])) < 0) { | 2845 | if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) { |
2833 | snd_card_free(card); | 2846 | snd_card_free(card); |
2834 | return err; | 2847 | return err; |
2835 | } | 2848 | } |
@@ -2844,7 +2857,7 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2844 | "%s with %s at %#lx, irq %i", card->shortname, | 2857 | "%s with %s at %#lx, irq %i", card->shortname, |
2845 | snd_ac97_get_short_name(chip->ac97[0]), chip->addr, chip->irq); | 2858 | snd_ac97_get_short_name(chip->ac97[0]), chip->addr, chip->irq); |
2846 | 2859 | ||
2847 | if (! ac97_clock[dev]) | 2860 | if (! ac97_clock) |
2848 | intel8x0_measure_ac97_clock(chip); | 2861 | intel8x0_measure_ac97_clock(chip); |
2849 | 2862 | ||
2850 | if ((err = snd_card_register(card)) < 0) { | 2863 | if ((err = snd_card_register(card)) < 0) { |
@@ -2852,7 +2865,6 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
2852 | return err; | 2865 | return err; |
2853 | } | 2866 | } |
2854 | pci_set_drvdata(pci, card); | 2867 | pci_set_drvdata(pci, card); |
2855 | dev++; | ||
2856 | return 0; | 2868 | return 0; |
2857 | } | 2869 | } |
2858 | 2870 | ||
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 9e2060d56c24..acfb197a833c 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> | 4 | * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> |
5 | * | 5 | * |
6 | * This is modified (by Sasha Khapyorsky <sashak@smlink.com>) version | 6 | * This is modified (by Sasha Khapyorsky <sashak@alsa-project.org>) version |
7 | * of ALSA ICH sound driver intel8x0.c . | 7 | * of ALSA ICH sound driver intel8x0.c . |
8 | * | 8 | * |
9 | * | 9 | * |
@@ -56,20 +56,21 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH}," | |||
56 | "{NVidia,NForce3 Modem}," | 56 | "{NVidia,NForce3 Modem}," |
57 | "{AMD,AMD768}}"); | 57 | "{AMD,AMD768}}"); |
58 | 58 | ||
59 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | 59 | static int index = -2; /* Exclude the first card */ |
60 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 60 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
61 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 61 | static int ac97_clock = 0; |
62 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; | ||
63 | 62 | ||
64 | module_param_array(index, int, NULL, 0444); | 63 | module_param(index, int, 0444); |
65 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard."); | 64 | MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard."); |
66 | module_param_array(id, charp, NULL, 0444); | 65 | module_param(id, charp, 0444); |
67 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard."); | 66 | MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard."); |
68 | module_param_array(enable, bool, NULL, 0444); | 67 | module_param(ac97_clock, int, 0444); |
69 | MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard."); | ||
70 | module_param_array(ac97_clock, int, NULL, 0444); | ||
71 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); | 68 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); |
72 | 69 | ||
70 | /* just for backward compatibility */ | ||
71 | static int enable; | ||
72 | module_param(enable, bool, 0444); | ||
73 | |||
73 | /* | 74 | /* |
74 | * Direct registers | 75 | * Direct registers |
75 | */ | 76 | */ |
@@ -362,7 +363,7 @@ static int snd_intel8x0m_codec_semaphore(intel8x0_t *chip, unsigned int codec) | |||
362 | /* access to some forbidden (non existant) ac97 registers will not | 363 | /* access to some forbidden (non existant) ac97 registers will not |
363 | * reset the semaphore. So even if you don't get the semaphore, still | 364 | * reset the semaphore. So even if you don't get the semaphore, still |
364 | * continue the access. We don't need the semaphore anyway. */ | 365 | * continue the access. We don't need the semaphore anyway. */ |
365 | snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", | 366 | snd_printk(KERN_ERR "codec_semaphore: semaphore is not ready [0x%x][0x%x]\n", |
366 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); | 367 | igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, ICHREG(GLOB_STA))); |
367 | iagetword(chip, 0); /* clear semaphore flag */ | 368 | iagetword(chip, 0); /* clear semaphore flag */ |
368 | /* I don't care about the semaphore */ | 369 | /* I don't care about the semaphore */ |
@@ -377,7 +378,7 @@ static void snd_intel8x0_codec_write(ac97_t *ac97, | |||
377 | 378 | ||
378 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { | 379 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { |
379 | if (! chip->in_ac97_init) | 380 | if (! chip->in_ac97_init) |
380 | snd_printk("codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 381 | snd_printk(KERN_ERR "codec_write %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
381 | } | 382 | } |
382 | iaputword(chip, reg + ac97->num * 0x80, val); | 383 | iaputword(chip, reg + ac97->num * 0x80, val); |
383 | } | 384 | } |
@@ -391,7 +392,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
391 | 392 | ||
392 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { | 393 | if (snd_intel8x0m_codec_semaphore(chip, ac97->num) < 0) { |
393 | if (! chip->in_ac97_init) | 394 | if (! chip->in_ac97_init) |
394 | snd_printk("codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); | 395 | snd_printk(KERN_ERR "codec_read %d: semaphore is not ready for register 0x%x\n", ac97->num, reg); |
395 | res = 0xffff; | 396 | res = 0xffff; |
396 | } else { | 397 | } else { |
397 | res = iagetword(chip, reg + ac97->num * 0x80); | 398 | res = iagetword(chip, reg + ac97->num * 0x80); |
@@ -399,7 +400,7 @@ static unsigned short snd_intel8x0_codec_read(ac97_t *ac97, | |||
399 | /* reset RCS and preserve other R/WC bits */ | 400 | /* reset RCS and preserve other R/WC bits */ |
400 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); | 401 | iputdword(chip, ICHREG(GLOB_STA), tmp & ~(ICH_SRI|ICH_PRI|ICH_TRI|ICH_GSCI)); |
401 | if (! chip->in_ac97_init) | 402 | if (! chip->in_ac97_init) |
402 | snd_printk("codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); | 403 | snd_printk(KERN_ERR "codec_read %d: read timeout for register 0x%x\n", ac97->num, reg); |
403 | res = 0xffff; | 404 | res = 0xffff; |
404 | } | 405 | } |
405 | } | 406 | } |
@@ -746,6 +747,7 @@ static int __devinit snd_intel8x0_pcm1(intel8x0_t *chip, int device, struct ich_ | |||
746 | 747 | ||
747 | pcm->private_data = chip; | 748 | pcm->private_data = chip; |
748 | pcm->info_flags = 0; | 749 | pcm->info_flags = 0; |
750 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
749 | if (rec->suffix) | 751 | if (rec->suffix) |
750 | sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); | 752 | sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); |
751 | else | 753 | else |
@@ -854,7 +856,6 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
854 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) | 856 | if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus)) < 0) |
855 | goto __err; | 857 | goto __err; |
856 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; | 858 | pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; |
857 | pbus->shared_type = AC97_SHARED_TYPE_ICH; /* shared with audio driver */ | ||
858 | if (ac97_clock >= 8000 && ac97_clock <= 48000) | 859 | if (ac97_clock >= 8000 && ac97_clock <= 48000) |
859 | pbus->clock = ac97_clock; | 860 | pbus->clock = ac97_clock; |
860 | chip->ac97_bus = pbus; | 861 | chip->ac97_bus = pbus; |
@@ -889,8 +890,7 @@ static int __devinit snd_intel8x0_mixer(intel8x0_t *chip, int ac97_clock) | |||
889 | */ | 890 | */ |
890 | 891 | ||
891 | #define do_delay(chip) do {\ | 892 | #define do_delay(chip) do {\ |
892 | set_current_state(TASK_UNINTERRUPTIBLE);\ | 893 | schedule_timeout_uninterruptible(1);\ |
893 | schedule_timeout(1);\ | ||
894 | } while (0) | 894 | } while (0) |
895 | 895 | ||
896 | static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) | 896 | static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) |
@@ -916,7 +916,7 @@ static int snd_intel8x0m_ich_chip_init(intel8x0_t *chip, int probing) | |||
916 | goto __ok; | 916 | goto __ok; |
917 | do_delay(chip); | 917 | do_delay(chip); |
918 | } while (time_after_eq(end_time, jiffies)); | 918 | } while (time_after_eq(end_time, jiffies)); |
919 | snd_printk("AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); | 919 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", igetdword(chip, ICHREG(GLOB_CNT))); |
920 | return -EIO; | 920 | return -EIO; |
921 | 921 | ||
922 | __ok: | 922 | __ok: |
@@ -1142,7 +1142,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1142 | chip->remap_addr = ioremap_nocache(chip->addr, | 1142 | chip->remap_addr = ioremap_nocache(chip->addr, |
1143 | pci_resource_len(pci, 2)); | 1143 | pci_resource_len(pci, 2)); |
1144 | if (chip->remap_addr == NULL) { | 1144 | if (chip->remap_addr == NULL) { |
1145 | snd_printk("AC'97 space ioremap problem\n"); | 1145 | snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); |
1146 | snd_intel8x0_free(chip); | 1146 | snd_intel8x0_free(chip); |
1147 | return -EIO; | 1147 | return -EIO; |
1148 | } | 1148 | } |
@@ -1155,7 +1155,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1155 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, | 1155 | chip->remap_bmaddr = ioremap_nocache(chip->bmaddr, |
1156 | pci_resource_len(pci, 3)); | 1156 | pci_resource_len(pci, 3)); |
1157 | if (chip->remap_bmaddr == NULL) { | 1157 | if (chip->remap_bmaddr == NULL) { |
1158 | snd_printk("Controller space ioremap problem\n"); | 1158 | snd_printk(KERN_ERR "Controller space ioremap problem\n"); |
1159 | snd_intel8x0_free(chip); | 1159 | snd_intel8x0_free(chip); |
1160 | return -EIO; | 1160 | return -EIO; |
1161 | } | 1161 | } |
@@ -1165,7 +1165,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card, | |||
1165 | 1165 | ||
1166 | port_inited: | 1166 | port_inited: |
1167 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { | 1167 | if (request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip)) { |
1168 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1168 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1169 | snd_intel8x0_free(chip); | 1169 | snd_intel8x0_free(chip); |
1170 | return -EBUSY; | 1170 | return -EBUSY; |
1171 | } | 1171 | } |
@@ -1263,20 +1263,12 @@ static struct shortname_table { | |||
1263 | static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | 1263 | static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, |
1264 | const struct pci_device_id *pci_id) | 1264 | const struct pci_device_id *pci_id) |
1265 | { | 1265 | { |
1266 | static int dev; | ||
1267 | snd_card_t *card; | 1266 | snd_card_t *card; |
1268 | intel8x0_t *chip; | 1267 | intel8x0_t *chip; |
1269 | int err; | 1268 | int err; |
1270 | struct shortname_table *name; | 1269 | struct shortname_table *name; |
1271 | 1270 | ||
1272 | if (dev >= SNDRV_CARDS) | 1271 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1273 | return -ENODEV; | ||
1274 | if (!enable[dev]) { | ||
1275 | dev++; | ||
1276 | return -ENOENT; | ||
1277 | } | ||
1278 | |||
1279 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1280 | if (card == NULL) | 1272 | if (card == NULL) |
1281 | return -ENOMEM; | 1273 | return -ENOMEM; |
1282 | 1274 | ||
@@ -1295,7 +1287,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1295 | return err; | 1287 | return err; |
1296 | } | 1288 | } |
1297 | 1289 | ||
1298 | if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev])) < 0) { | 1290 | if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) { |
1299 | snd_card_free(card); | 1291 | snd_card_free(card); |
1300 | return err; | 1292 | return err; |
1301 | } | 1293 | } |
@@ -1314,7 +1306,6 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1314 | return err; | 1306 | return err; |
1315 | } | 1307 | } |
1316 | pci_set_drvdata(pci, card); | 1308 | pci_set_drvdata(pci, card); |
1317 | dev++; | ||
1318 | return 0; | 1309 | return 0; |
1319 | } | 1310 | } |
1320 | 1311 | ||
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 2693b6f731f3..99eb76c56f81 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -1492,7 +1492,7 @@ static int snd_m3_pcm_hw_params(snd_pcm_substream_t * substream, | |||
1492 | /* set buffer address */ | 1492 | /* set buffer address */ |
1493 | s->buffer_addr = substream->runtime->dma_addr; | 1493 | s->buffer_addr = substream->runtime->dma_addr; |
1494 | if (s->buffer_addr & 0x3) { | 1494 | if (s->buffer_addr & 0x3) { |
1495 | snd_printk("oh my, not aligned\n"); | 1495 | snd_printk(KERN_ERR "oh my, not aligned\n"); |
1496 | s->buffer_addr = s->buffer_addr & ~0x3; | 1496 | s->buffer_addr = s->buffer_addr & ~0x3; |
1497 | } | 1497 | } |
1498 | return 0; | 1498 | return 0; |
@@ -1942,7 +1942,7 @@ static int snd_m3_ac97_wait(m3_t *chip) | |||
1942 | return 0; | 1942 | return 0; |
1943 | } while (i-- > 0); | 1943 | } while (i-- > 0); |
1944 | 1944 | ||
1945 | snd_printk("ac97 serial bus busy\n"); | 1945 | snd_printk(KERN_ERR "ac97 serial bus busy\n"); |
1946 | return 1; | 1946 | return 1; |
1947 | } | 1947 | } |
1948 | 1948 | ||
@@ -2046,8 +2046,7 @@ static void snd_m3_ac97_reset(m3_t *chip) | |||
2046 | outw(0, io + GPIO_DATA); | 2046 | outw(0, io + GPIO_DATA); |
2047 | outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION); | 2047 | outw(dir | GPO_PRIMARY_AC97, io + GPIO_DIRECTION); |
2048 | 2048 | ||
2049 | set_current_state(TASK_UNINTERRUPTIBLE); | 2049 | schedule_timeout_uninterruptible(msecs_to_jiffies(delay1)); |
2050 | schedule_timeout((delay1 * HZ) / 1000); | ||
2051 | 2050 | ||
2052 | outw(GPO_PRIMARY_AC97, io + GPIO_DATA); | 2051 | outw(GPO_PRIMARY_AC97, io + GPIO_DATA); |
2053 | udelay(5); | 2052 | udelay(5); |
@@ -2055,8 +2054,7 @@ static void snd_m3_ac97_reset(m3_t *chip) | |||
2055 | outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A); | 2054 | outw(IO_SRAM_ENABLE | SERIAL_AC_LINK_ENABLE, io + RING_BUS_CTRL_A); |
2056 | outw(~0, io + GPIO_MASK); | 2055 | outw(~0, io + GPIO_MASK); |
2057 | 2056 | ||
2058 | set_current_state(TASK_UNINTERRUPTIBLE); | 2057 | schedule_timeout_uninterruptible(msecs_to_jiffies(delay2)); |
2059 | schedule_timeout((delay2 * HZ) / 1000); | ||
2060 | 2058 | ||
2061 | if (! snd_m3_try_read_vendor(chip)) | 2059 | if (! snd_m3_try_read_vendor(chip)) |
2062 | break; | 2060 | break; |
@@ -2101,8 +2099,7 @@ static int __devinit snd_m3_mixer(m3_t *chip) | |||
2101 | 2099 | ||
2102 | /* seems ac97 PCM needs initialization.. hack hack.. */ | 2100 | /* seems ac97 PCM needs initialization.. hack hack.. */ |
2103 | snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15); | 2101 | snd_ac97_write(chip->ac97, AC97_PCM, 0x8000 | (15 << 8) | 15); |
2104 | set_current_state(TASK_UNINTERRUPTIBLE); | 2102 | schedule_timeout_uninterruptible(msecs_to_jiffies(100)); |
2105 | schedule_timeout(HZ / 10); | ||
2106 | snd_ac97_write(chip->ac97, AC97_PCM, 0); | 2103 | snd_ac97_write(chip->ac97, AC97_PCM, 0); |
2107 | 2104 | ||
2108 | memset(&id, 0, sizeof(id)); | 2105 | memset(&id, 0, sizeof(id)); |
@@ -2367,7 +2364,7 @@ static int __devinit snd_m3_assp_client_init(m3_t *chip, m3_dma_t *s, int index) | |||
2367 | address = 0x1100 + ((data_bytes/2) * index); | 2364 | address = 0x1100 + ((data_bytes/2) * index); |
2368 | 2365 | ||
2369 | if ((address + (data_bytes/2)) >= 0x1c00) { | 2366 | if ((address + (data_bytes/2)) >= 0x1c00) { |
2370 | snd_printk("no memory for %d bytes at ind %d (addr 0x%x)\n", | 2367 | snd_printk(KERN_ERR "no memory for %d bytes at ind %d (addr 0x%x)\n", |
2371 | data_bytes, index, address); | 2368 | data_bytes, index, address); |
2372 | return -ENOMEM; | 2369 | return -ENOMEM; |
2373 | } | 2370 | } |
@@ -2476,6 +2473,7 @@ snd_m3_chip_init(m3_t *chip) | |||
2476 | t |= ASSP_0_WS_ENABLE; | 2473 | t |= ASSP_0_WS_ENABLE; |
2477 | outb(t, chip->iobase + ASSP_CONTROL_A); | 2474 | outb(t, chip->iobase + ASSP_CONTROL_A); |
2478 | 2475 | ||
2476 | snd_m3_assp_init(chip); /* download DSP code before starting ASSP below */ | ||
2479 | outb(RUN_ASSP, chip->iobase + ASSP_CONTROL_B); | 2477 | outb(RUN_ASSP, chip->iobase + ASSP_CONTROL_B); |
2480 | 2478 | ||
2481 | outb(0x00, io + HARDWARE_VOL_CTRL); | 2479 | outb(0x00, io + HARDWARE_VOL_CTRL); |
@@ -2655,7 +2653,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2655 | /* check, if we can restrict PCI DMA transfers to 28 bits */ | 2653 | /* check, if we can restrict PCI DMA transfers to 28 bits */ |
2656 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 2654 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || |
2657 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 2655 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { |
2658 | snd_printk("architecture does not support 28bit PCI busmaster DMA\n"); | 2656 | snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); |
2659 | pci_disable_device(pci); | 2657 | pci_disable_device(pci); |
2660 | return -ENXIO; | 2658 | return -ENXIO; |
2661 | } | 2659 | } |
@@ -2734,14 +2732,13 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci, | |||
2734 | 2732 | ||
2735 | snd_m3_ac97_reset(chip); | 2733 | snd_m3_ac97_reset(chip); |
2736 | 2734 | ||
2737 | snd_m3_assp_init(chip); | ||
2738 | snd_m3_amp_enable(chip, 1); | 2735 | snd_m3_amp_enable(chip, 1); |
2739 | 2736 | ||
2740 | tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); | 2737 | tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); |
2741 | 2738 | ||
2742 | if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, | 2739 | if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, |
2743 | card->driver, (void *)chip)) { | 2740 | card->driver, (void *)chip)) { |
2744 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2741 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2745 | snd_m3_free(chip); | 2742 | snd_m3_free(chip); |
2746 | return -ENOMEM; | 2743 | return -ENOMEM; |
2747 | } | 2744 | } |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 1a62c7f6c52b..c341c99ec783 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -451,8 +451,7 @@ static int mixart_sync_nonblock_events(mixart_mgr_t *mgr) | |||
451 | snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); | 451 | snd_printk(KERN_ERR "mixart: cannot process nonblock events!\n"); |
452 | return -EBUSY; | 452 | return -EBUSY; |
453 | } | 453 | } |
454 | set_current_state(TASK_UNINTERRUPTIBLE); | 454 | schedule_timeout_uninterruptible(1); |
455 | schedule_timeout(1); | ||
456 | } | 455 | } |
457 | return 0; | 456 | return 0; |
458 | } | 457 | } |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 5c55a3b1d121..e7aa15178453 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -52,37 +52,43 @@ MODULE_SUPPORTED_DEVICE("{{NeoMagic,NM256AV}," | |||
52 | * some compile conditions. | 52 | * some compile conditions. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 55 | static int index = SNDRV_DEFAULT_IDX1; /* Index */ |
56 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 56 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
57 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 57 | static int playback_bufsize = 16; |
58 | static int playback_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 16}; | 58 | static int capture_bufsize = 16; |
59 | static int capture_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 16}; | 59 | static int force_ac97; /* disabled as default */ |
60 | static int force_ac97[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled as default */ | 60 | static int buffer_top; /* not specified */ |
61 | static int buffer_top[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* not specified */ | 61 | static int use_cache; /* disabled */ |
62 | static int use_cache[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */ | 62 | static int vaio_hack; /* disabled */ |
63 | static int vaio_hack[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; /* disabled */ | 63 | static int reset_workaround; |
64 | static int reset_workaround[SNDRV_CARDS]; | 64 | static int reset_workaround_2; |
65 | 65 | ||
66 | module_param_array(index, int, NULL, 0444); | 66 | module_param(index, int, 0444); |
67 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); | 67 | MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); |
68 | module_param_array(id, charp, NULL, 0444); | 68 | module_param(id, charp, 0444); |
69 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); | 69 | MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); |
70 | module_param_array(enable, bool, NULL, 0444); | 70 | module_param(playback_bufsize, int, 0444); |
71 | MODULE_PARM_DESC(enable, "Enable this soundcard."); | ||
72 | module_param_array(playback_bufsize, int, NULL, 0444); | ||
73 | MODULE_PARM_DESC(playback_bufsize, "DAC frame size in kB for " CARD_NAME " soundcard."); | 71 | MODULE_PARM_DESC(playback_bufsize, "DAC frame size in kB for " CARD_NAME " soundcard."); |
74 | module_param_array(capture_bufsize, int, NULL, 0444); | 72 | module_param(capture_bufsize, int, 0444); |
75 | MODULE_PARM_DESC(capture_bufsize, "ADC frame size in kB for " CARD_NAME " soundcard."); | 73 | MODULE_PARM_DESC(capture_bufsize, "ADC frame size in kB for " CARD_NAME " soundcard."); |
76 | module_param_array(force_ac97, bool, NULL, 0444); | 74 | module_param(force_ac97, bool, 0444); |
77 | MODULE_PARM_DESC(force_ac97, "Force to use AC97 codec for " CARD_NAME " soundcard."); | 75 | MODULE_PARM_DESC(force_ac97, "Force to use AC97 codec for " CARD_NAME " soundcard."); |
78 | module_param_array(buffer_top, int, NULL, 0444); | 76 | module_param(buffer_top, int, 0444); |
79 | MODULE_PARM_DESC(buffer_top, "Set the top address of audio buffer for " CARD_NAME " soundcard."); | 77 | MODULE_PARM_DESC(buffer_top, "Set the top address of audio buffer for " CARD_NAME " soundcard."); |
80 | module_param_array(use_cache, bool, NULL, 0444); | 78 | module_param(use_cache, bool, 0444); |
81 | MODULE_PARM_DESC(use_cache, "Enable the cache for coefficient table access."); | 79 | MODULE_PARM_DESC(use_cache, "Enable the cache for coefficient table access."); |
82 | module_param_array(vaio_hack, bool, NULL, 0444); | 80 | module_param(vaio_hack, bool, 0444); |
83 | MODULE_PARM_DESC(vaio_hack, "Enable workaround for Sony VAIO notebooks."); | 81 | MODULE_PARM_DESC(vaio_hack, "Enable workaround for Sony VAIO notebooks."); |
84 | module_param_array(reset_workaround, bool, NULL, 0444); | 82 | module_param(reset_workaround, bool, 0444); |
85 | MODULE_PARM_DESC(reset_workaround, "Enable AC97 RESET workaround for some laptops."); | 83 | MODULE_PARM_DESC(reset_workaround, "Enable AC97 RESET workaround for some laptops."); |
84 | module_param(reset_workaround_2, bool, 0444); | ||
85 | MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); | ||
86 | |||
87 | /* just for backward compatibility */ | ||
88 | static int enable; | ||
89 | module_param(enable, bool, 0444); | ||
90 | |||
91 | |||
86 | 92 | ||
87 | /* | 93 | /* |
88 | * hw definitions | 94 | * hw definitions |
@@ -226,6 +232,7 @@ struct snd_nm256 { | |||
226 | unsigned int coeffs_current: 1; /* coeff. table is loaded? */ | 232 | unsigned int coeffs_current: 1; /* coeff. table is loaded? */ |
227 | unsigned int use_cache: 1; /* use one big coef. table */ | 233 | unsigned int use_cache: 1; /* use one big coef. table */ |
228 | unsigned int reset_workaround: 1; /* Workaround for some laptops to avoid freeze */ | 234 | unsigned int reset_workaround: 1; /* Workaround for some laptops to avoid freeze */ |
235 | unsigned int reset_workaround_2: 1; /* Extended workaround for some other laptops to avoid freeze */ | ||
229 | 236 | ||
230 | int mixer_base; /* register offset of ac97 mixer */ | 237 | int mixer_base; /* register offset of ac97 mixer */ |
231 | int mixer_status_offset; /* offset of mixer status reg. */ | 238 | int mixer_status_offset; /* offset of mixer status reg. */ |
@@ -313,9 +320,9 @@ static inline void | |||
313 | snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size) | 320 | snd_nm256_write_buffer(nm256_t *chip, void *src, int offset, int size) |
314 | { | 321 | { |
315 | offset -= chip->buffer_start; | 322 | offset -= chip->buffer_start; |
316 | #ifdef SNDRV_CONFIG_DEBUG | 323 | #ifdef CONFIG_SND_DEBUG |
317 | if (offset < 0 || offset >= chip->buffer_size) { | 324 | if (offset < 0 || offset >= chip->buffer_size) { |
318 | snd_printk("write_buffer invalid offset = %d size = %d\n", offset, size); | 325 | snd_printk(KERN_ERR "write_buffer invalid offset = %d size = %d\n", offset, size); |
319 | return; | 326 | return; |
320 | } | 327 | } |
321 | #endif | 328 | #endif |
@@ -459,7 +466,7 @@ static int snd_nm256_acquire_irq(nm256_t *chip) | |||
459 | if (chip->irq < 0) { | 466 | if (chip->irq < 0) { |
460 | if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, | 467 | if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, |
461 | chip->card->driver, (void*)chip)) { | 468 | chip->card->driver, (void*)chip)) { |
462 | snd_printk("unable to grab IRQ %d\n", chip->pci->irq); | 469 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); |
463 | up(&chip->irq_mutex); | 470 | up(&chip->irq_mutex); |
464 | return -EBUSY; | 471 | return -EBUSY; |
465 | } | 472 | } |
@@ -1199,8 +1206,11 @@ snd_nm256_ac97_reset(ac97_t *ac97) | |||
1199 | /* Dell latitude LS will lock up by this */ | 1206 | /* Dell latitude LS will lock up by this */ |
1200 | snd_nm256_writeb(chip, 0x6cc, 0x87); | 1207 | snd_nm256_writeb(chip, 0x6cc, 0x87); |
1201 | } | 1208 | } |
1202 | snd_nm256_writeb(chip, 0x6cc, 0x80); | 1209 | if (! chip->reset_workaround_2) { |
1203 | snd_nm256_writeb(chip, 0x6cc, 0x0); | 1210 | /* Dell latitude CSx will lock up by this */ |
1211 | snd_nm256_writeb(chip, 0x6cc, 0x80); | ||
1212 | snd_nm256_writeb(chip, 0x6cc, 0x0); | ||
1213 | } | ||
1204 | } | 1214 | } |
1205 | 1215 | ||
1206 | /* create an ac97 mixer interface */ | 1216 | /* create an ac97 mixer interface */ |
@@ -1263,7 +1273,7 @@ snd_nm256_peek_for_sig(nm256_t *chip) | |||
1263 | 1273 | ||
1264 | temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); | 1274 | temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16); |
1265 | if (temp == NULL) { | 1275 | if (temp == NULL) { |
1266 | snd_printk("Unable to scan for card signature in video RAM\n"); | 1276 | snd_printk(KERN_ERR "Unable to scan for card signature in video RAM\n"); |
1267 | return -EBUSY; | 1277 | return -EBUSY; |
1268 | } | 1278 | } |
1269 | 1279 | ||
@@ -1277,7 +1287,7 @@ snd_nm256_peek_for_sig(nm256_t *chip) | |||
1277 | if (pointer == 0xffffffff || | 1287 | if (pointer == 0xffffffff || |
1278 | pointer < chip->buffer_size || | 1288 | pointer < chip->buffer_size || |
1279 | pointer > chip->buffer_end) { | 1289 | pointer > chip->buffer_end) { |
1280 | snd_printk("invalid signature found: 0x%x\n", pointer); | 1290 | snd_printk(KERN_ERR "invalid signature found: 0x%x\n", pointer); |
1281 | iounmap(temp); | 1291 | iounmap(temp); |
1282 | return -ENODEV; | 1292 | return -ENODEV; |
1283 | } else { | 1293 | } else { |
@@ -1347,14 +1357,8 @@ static int snd_nm256_free(nm256_t *chip) | |||
1347 | iounmap(chip->cport); | 1357 | iounmap(chip->cport); |
1348 | if (chip->buffer) | 1358 | if (chip->buffer) |
1349 | iounmap(chip->buffer); | 1359 | iounmap(chip->buffer); |
1350 | if (chip->res_cport) { | 1360 | release_and_free_resource(chip->res_cport); |
1351 | release_resource(chip->res_cport); | 1361 | release_and_free_resource(chip->res_buffer); |
1352 | kfree_nocheck(chip->res_cport); | ||
1353 | } | ||
1354 | if (chip->res_buffer) { | ||
1355 | release_resource(chip->res_buffer); | ||
1356 | kfree_nocheck(chip->res_buffer); | ||
1357 | } | ||
1358 | if (chip->irq >= 0) | 1362 | if (chip->irq >= 0) |
1359 | free_irq(chip->irq, (void*)chip); | 1363 | free_irq(chip->irq, (void*)chip); |
1360 | 1364 | ||
@@ -1420,14 +1424,14 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1420 | chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, | 1424 | chip->res_cport = request_mem_region(chip->cport_addr, NM_PORT2_SIZE, |
1421 | card->driver); | 1425 | card->driver); |
1422 | if (chip->res_cport == NULL) { | 1426 | if (chip->res_cport == NULL) { |
1423 | snd_printk("memory region 0x%lx (size 0x%x) busy\n", | 1427 | snd_printk(KERN_ERR "memory region 0x%lx (size 0x%x) busy\n", |
1424 | chip->cport_addr, NM_PORT2_SIZE); | 1428 | chip->cport_addr, NM_PORT2_SIZE); |
1425 | err = -EBUSY; | 1429 | err = -EBUSY; |
1426 | goto __error; | 1430 | goto __error; |
1427 | } | 1431 | } |
1428 | chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); | 1432 | chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE); |
1429 | if (chip->cport == NULL) { | 1433 | if (chip->cport == NULL) { |
1430 | snd_printk("unable to map control port %lx\n", chip->cport_addr); | 1434 | snd_printk(KERN_ERR "unable to map control port %lx\n", chip->cport_addr); |
1431 | err = -ENOMEM; | 1435 | err = -ENOMEM; |
1432 | goto __error; | 1436 | goto __error; |
1433 | } | 1437 | } |
@@ -1485,7 +1489,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1485 | chip->buffer_size, | 1489 | chip->buffer_size, |
1486 | card->driver); | 1490 | card->driver); |
1487 | if (chip->res_buffer == NULL) { | 1491 | if (chip->res_buffer == NULL) { |
1488 | snd_printk("nm256: buffer 0x%lx (size 0x%x) busy\n", | 1492 | snd_printk(KERN_ERR "nm256: buffer 0x%lx (size 0x%x) busy\n", |
1489 | chip->buffer_addr, chip->buffer_size); | 1493 | chip->buffer_addr, chip->buffer_size); |
1490 | err = -EBUSY; | 1494 | err = -EBUSY; |
1491 | goto __error; | 1495 | goto __error; |
@@ -1493,7 +1497,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci, | |||
1493 | chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); | 1497 | chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size); |
1494 | if (chip->buffer == NULL) { | 1498 | if (chip->buffer == NULL) { |
1495 | err = -ENOMEM; | 1499 | err = -ENOMEM; |
1496 | snd_printk("unable to map ring buffer at %lx\n", chip->buffer_addr); | 1500 | snd_printk(KERN_ERR "unable to map ring buffer at %lx\n", chip->buffer_addr); |
1497 | goto __error; | 1501 | goto __error; |
1498 | } | 1502 | } |
1499 | 1503 | ||
@@ -1542,7 +1546,7 @@ struct nm256_quirk { | |||
1542 | int type; | 1546 | int type; |
1543 | }; | 1547 | }; |
1544 | 1548 | ||
1545 | enum { NM_BLACKLISTED, NM_RESET_WORKAROUND }; | 1549 | enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 }; |
1546 | 1550 | ||
1547 | static struct nm256_quirk nm256_quirks[] __devinitdata = { | 1551 | static struct nm256_quirk nm256_quirks[] __devinitdata = { |
1548 | /* HP omnibook 4150 has cs4232 codec internally */ | 1552 | /* HP omnibook 4150 has cs4232 codec internally */ |
@@ -1551,6 +1555,8 @@ static struct nm256_quirk nm256_quirks[] __devinitdata = { | |||
1551 | { .vendor = 0x104d, .device = 0x8041, .type = NM_RESET_WORKAROUND }, | 1555 | { .vendor = 0x104d, .device = 0x8041, .type = NM_RESET_WORKAROUND }, |
1552 | /* Dell Latitude LS */ | 1556 | /* Dell Latitude LS */ |
1553 | { .vendor = 0x1028, .device = 0x0080, .type = NM_RESET_WORKAROUND }, | 1557 | { .vendor = 0x1028, .device = 0x0080, .type = NM_RESET_WORKAROUND }, |
1558 | /* Dell Latitude CSx */ | ||
1559 | { .vendor = 0x1028, .device = 0x0091, .type = NM_RESET_WORKAROUND_2 }, | ||
1554 | { } /* terminator */ | 1560 | { } /* terminator */ |
1555 | }; | 1561 | }; |
1556 | 1562 | ||
@@ -1558,7 +1564,6 @@ static struct nm256_quirk nm256_quirks[] __devinitdata = { | |||
1558 | static int __devinit snd_nm256_probe(struct pci_dev *pci, | 1564 | static int __devinit snd_nm256_probe(struct pci_dev *pci, |
1559 | const struct pci_device_id *pci_id) | 1565 | const struct pci_device_id *pci_id) |
1560 | { | 1566 | { |
1561 | static int dev; | ||
1562 | snd_card_t *card; | 1567 | snd_card_t *card; |
1563 | nm256_t *chip; | 1568 | nm256_t *chip; |
1564 | int err; | 1569 | int err; |
@@ -1566,13 +1571,6 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1566 | struct nm256_quirk *q; | 1571 | struct nm256_quirk *q; |
1567 | u16 subsystem_vendor, subsystem_device; | 1572 | u16 subsystem_vendor, subsystem_device; |
1568 | 1573 | ||
1569 | if (dev >= SNDRV_CARDS) | ||
1570 | return -ENODEV; | ||
1571 | if (!enable[dev]) { | ||
1572 | dev++; | ||
1573 | return -ENOENT; | ||
1574 | } | ||
1575 | |||
1576 | pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); | 1574 | pci_read_config_word(pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); |
1577 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); | 1575 | pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &subsystem_device); |
1578 | 1576 | ||
@@ -1582,14 +1580,17 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1582 | case NM_BLACKLISTED: | 1580 | case NM_BLACKLISTED: |
1583 | printk(KERN_INFO "nm256: The device is blacklisted. Loading stopped\n"); | 1581 | printk(KERN_INFO "nm256: The device is blacklisted. Loading stopped\n"); |
1584 | return -ENODEV; | 1582 | return -ENODEV; |
1583 | case NM_RESET_WORKAROUND_2: | ||
1584 | reset_workaround_2 = 1; | ||
1585 | /* Fall-through */ | ||
1585 | case NM_RESET_WORKAROUND: | 1586 | case NM_RESET_WORKAROUND: |
1586 | reset_workaround[dev] = 1; | 1587 | reset_workaround = 1; |
1587 | break; | 1588 | break; |
1588 | } | 1589 | } |
1589 | } | 1590 | } |
1590 | } | 1591 | } |
1591 | 1592 | ||
1592 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1593 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1593 | if (card == NULL) | 1594 | if (card == NULL) |
1594 | return -ENOMEM; | 1595 | return -ENOMEM; |
1595 | 1596 | ||
@@ -1604,40 +1605,45 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1604 | strcpy(card->driver, "NM256XL+"); | 1605 | strcpy(card->driver, "NM256XL+"); |
1605 | break; | 1606 | break; |
1606 | default: | 1607 | default: |
1607 | snd_printk("invalid device id 0x%x\n", pci->device); | 1608 | snd_printk(KERN_ERR "invalid device id 0x%x\n", pci->device); |
1608 | snd_card_free(card); | 1609 | snd_card_free(card); |
1609 | return -EINVAL; | 1610 | return -EINVAL; |
1610 | } | 1611 | } |
1611 | 1612 | ||
1612 | if (vaio_hack[dev]) | 1613 | if (vaio_hack) |
1613 | xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ | 1614 | xbuffer_top = 0x25a800; /* this avoids conflicts with XFree86 server */ |
1614 | else | 1615 | else |
1615 | xbuffer_top = buffer_top[dev]; | 1616 | xbuffer_top = buffer_top; |
1616 | 1617 | ||
1617 | if (playback_bufsize[dev] < 4) | 1618 | if (playback_bufsize < 4) |
1618 | playback_bufsize[dev] = 4; | 1619 | playback_bufsize = 4; |
1619 | if (playback_bufsize[dev] > 128) | 1620 | if (playback_bufsize > 128) |
1620 | playback_bufsize[dev] = 128; | 1621 | playback_bufsize = 128; |
1621 | if (capture_bufsize[dev] < 4) | 1622 | if (capture_bufsize < 4) |
1622 | capture_bufsize[dev] = 4; | 1623 | capture_bufsize = 4; |
1623 | if (capture_bufsize[dev] > 128) | 1624 | if (capture_bufsize > 128) |
1624 | capture_bufsize[dev] = 128; | 1625 | capture_bufsize = 128; |
1625 | if ((err = snd_nm256_create(card, pci, | 1626 | if ((err = snd_nm256_create(card, pci, |
1626 | playback_bufsize[dev] * 1024, /* in bytes */ | 1627 | playback_bufsize * 1024, /* in bytes */ |
1627 | capture_bufsize[dev] * 1024, /* in bytes */ | 1628 | capture_bufsize * 1024, /* in bytes */ |
1628 | force_ac97[dev], | 1629 | force_ac97, |
1629 | xbuffer_top, | 1630 | xbuffer_top, |
1630 | use_cache[dev], | 1631 | use_cache, |
1631 | &chip)) < 0) { | 1632 | &chip)) < 0) { |
1632 | snd_card_free(card); | 1633 | snd_card_free(card); |
1633 | return err; | 1634 | return err; |
1634 | } | 1635 | } |
1635 | 1636 | ||
1636 | if (reset_workaround[dev]) { | 1637 | if (reset_workaround) { |
1637 | snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); | 1638 | snd_printdd(KERN_INFO "nm256: reset_workaround activated\n"); |
1638 | chip->reset_workaround = 1; | 1639 | chip->reset_workaround = 1; |
1639 | } | 1640 | } |
1640 | 1641 | ||
1642 | if (reset_workaround_2) { | ||
1643 | snd_printdd(KERN_INFO "nm256: reset_workaround_2 activated\n"); | ||
1644 | chip->reset_workaround_2 = 1; | ||
1645 | } | ||
1646 | |||
1641 | if ((err = snd_nm256_pcm(chip, 0)) < 0 || | 1647 | if ((err = snd_nm256_pcm(chip, 0)) < 0 || |
1642 | (err = snd_nm256_mixer(chip)) < 0) { | 1648 | (err = snd_nm256_mixer(chip)) < 0) { |
1643 | snd_card_free(card); | 1649 | snd_card_free(card); |
@@ -1655,7 +1661,6 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1655 | } | 1661 | } |
1656 | 1662 | ||
1657 | pci_set_drvdata(pci, card); | 1663 | pci_set_drvdata(pci, card); |
1658 | dev++; | ||
1659 | return 0; | 1664 | return 0; |
1660 | } | 1665 | } |
1661 | 1666 | ||
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index cd313af6ebcf..e6627b0e38e4 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -1369,13 +1369,13 @@ static int __devinit snd_rme32_create(rme32_t * rme32) | |||
1369 | rme32->port = pci_resource_start(rme32->pci, 0); | 1369 | rme32->port = pci_resource_start(rme32->pci, 0); |
1370 | 1370 | ||
1371 | if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) { | 1371 | if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) { |
1372 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1372 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1373 | return -EBUSY; | 1373 | return -EBUSY; |
1374 | } | 1374 | } |
1375 | rme32->irq = pci->irq; | 1375 | rme32->irq = pci->irq; |
1376 | 1376 | ||
1377 | if ((rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE)) == 0) { | 1377 | if ((rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE)) == 0) { |
1378 | snd_printk("unable to remap memory region 0x%lx-0x%lx\n", | 1378 | snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", |
1379 | rme32->port, rme32->port + RME32_IO_SIZE - 1); | 1379 | rme32->port, rme32->port + RME32_IO_SIZE - 1); |
1380 | return -ENOMEM; | 1380 | return -ENOMEM; |
1381 | } | 1381 | } |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index c495cae78dbf..0eddeb16a10f 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -1570,13 +1570,13 @@ snd_rme96_create(rme96_t *rme96) | |||
1570 | rme96->port = pci_resource_start(rme96->pci, 0); | 1570 | rme96->port = pci_resource_start(rme96->pci, 0); |
1571 | 1571 | ||
1572 | if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) { | 1572 | if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) { |
1573 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1573 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1574 | return -EBUSY; | 1574 | return -EBUSY; |
1575 | } | 1575 | } |
1576 | rme96->irq = pci->irq; | 1576 | rme96->irq = pci->irq; |
1577 | 1577 | ||
1578 | if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) { | 1578 | if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) { |
1579 | snd_printk("unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1); | 1579 | snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1); |
1580 | return -ENOMEM; | 1580 | return -ENOMEM; |
1581 | } | 1581 | } |
1582 | 1582 | ||
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 52525eb198c7..845158b01b02 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -671,11 +671,7 @@ static int snd_hdsp_load_firmware_from_cache(hdsp_t *hdsp) { | |||
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
674 | if ((1000 / HZ) < 3000) { | 674 | ssleep(3); |
675 | ssleep(3); | ||
676 | } else { | ||
677 | mdelay(3000); | ||
678 | } | ||
679 | 675 | ||
680 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { | 676 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { |
681 | snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); | 677 | snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); |
@@ -692,7 +688,7 @@ static int snd_hdsp_load_firmware_from_cache(hdsp_t *hdsp) { | |||
692 | 688 | ||
693 | } | 689 | } |
694 | if (hdsp->state & HDSP_InitializationComplete) { | 690 | if (hdsp->state & HDSP_InitializationComplete) { |
695 | snd_printk("Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); | 691 | snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); |
696 | spin_lock_irqsave(&hdsp->lock, flags); | 692 | spin_lock_irqsave(&hdsp->lock, flags); |
697 | snd_hdsp_set_defaults(hdsp); | 693 | snd_hdsp_set_defaults(hdsp); |
698 | spin_unlock_irqrestore(&hdsp->lock, flags); | 694 | spin_unlock_irqrestore(&hdsp->lock, flags); |
@@ -709,9 +705,8 @@ static int hdsp_get_iobox_version (hdsp_t *hdsp) | |||
709 | 705 | ||
710 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); | 706 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); |
711 | hdsp_write (hdsp, HDSP_fifoData, 0); | 707 | hdsp_write (hdsp, HDSP_fifoData, 0); |
712 | if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) { | 708 | if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) |
713 | return -EIO; | 709 | return -EIO; |
714 | } | ||
715 | 710 | ||
716 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); | 711 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); |
717 | hdsp_write (hdsp, HDSP_fifoData, 0); | 712 | hdsp_write (hdsp, HDSP_fifoData, 0); |
@@ -726,22 +721,30 @@ static int hdsp_get_iobox_version (hdsp_t *hdsp) | |||
726 | } | 721 | } |
727 | } else { | 722 | } else { |
728 | /* firmware was already loaded, get iobox type */ | 723 | /* firmware was already loaded, get iobox type */ |
729 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { | 724 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) |
730 | hdsp->io_type = Multiface; | 725 | hdsp->io_type = Multiface; |
731 | } else { | 726 | else |
732 | hdsp->io_type = Digiface; | 727 | hdsp->io_type = Digiface; |
733 | } | ||
734 | } | 728 | } |
735 | return 0; | 729 | return 0; |
736 | } | 730 | } |
737 | 731 | ||
738 | 732 | ||
739 | static int hdsp_check_for_firmware (hdsp_t *hdsp) | 733 | static int hdsp_check_for_firmware (hdsp_t *hdsp, int show_err) |
740 | { | 734 | { |
741 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; | 735 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; |
742 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 736 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
743 | snd_printk("Hammerfall-DSP: firmware not present.\n"); | 737 | snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n"); |
744 | hdsp->state &= ~HDSP_FirmwareLoaded; | 738 | hdsp->state &= ~HDSP_FirmwareLoaded; |
739 | if (! show_err) | ||
740 | return -EIO; | ||
741 | /* try to load firmware */ | ||
742 | if (hdsp->state & HDSP_FirmwareCached) { | ||
743 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) | ||
744 | snd_printk(KERN_ERR "Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
745 | } else { | ||
746 | snd_printk(KERN_ERR "Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
747 | } | ||
745 | return -EIO; | 748 | return -EIO; |
746 | } | 749 | } |
747 | return 0; | 750 | return 0; |
@@ -775,9 +778,9 @@ static int hdsp_fifo_wait(hdsp_t *hdsp, int count, int timeout) | |||
775 | 778 | ||
776 | static int hdsp_read_gain (hdsp_t *hdsp, unsigned int addr) | 779 | static int hdsp_read_gain (hdsp_t *hdsp, unsigned int addr) |
777 | { | 780 | { |
778 | if (addr >= HDSP_MATRIX_MIXER_SIZE) { | 781 | if (addr >= HDSP_MATRIX_MIXER_SIZE) |
779 | return 0; | 782 | return 0; |
780 | } | 783 | |
781 | return hdsp->mixer_matrix[addr]; | 784 | return hdsp->mixer_matrix[addr]; |
782 | } | 785 | } |
783 | 786 | ||
@@ -802,13 +805,11 @@ static int hdsp_write_gain(hdsp_t *hdsp, unsigned int addr, unsigned short data) | |||
802 | memory." | 805 | memory." |
803 | */ | 806 | */ |
804 | 807 | ||
805 | if (hdsp->io_type == H9632 && addr >= 512) { | 808 | if (hdsp->io_type == H9632 && addr >= 512) |
806 | return 0; | 809 | return 0; |
807 | } | ||
808 | 810 | ||
809 | if (hdsp->io_type == H9652 && addr >= 1352) { | 811 | if (hdsp->io_type == H9652 && addr >= 1352) |
810 | return 0; | 812 | return 0; |
811 | } | ||
812 | 813 | ||
813 | hdsp->mixer_matrix[addr] = data; | 814 | hdsp->mixer_matrix[addr] = data; |
814 | 815 | ||
@@ -832,9 +833,8 @@ static int hdsp_write_gain(hdsp_t *hdsp, unsigned int addr, unsigned short data) | |||
832 | 833 | ||
833 | ad = (addr << 16) + data; | 834 | ad = (addr << 16) + data; |
834 | 835 | ||
835 | if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) { | 836 | if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) |
836 | return -1; | 837 | return -1; |
837 | } | ||
838 | 838 | ||
839 | hdsp_write (hdsp, HDSP_fifoData, ad); | 839 | hdsp_write (hdsp, HDSP_fifoData, ad); |
840 | hdsp->mixer_matrix[addr] = data; | 840 | hdsp->mixer_matrix[addr] = data; |
@@ -851,9 +851,8 @@ static int snd_hdsp_use_is_exclusive(hdsp_t *hdsp) | |||
851 | 851 | ||
852 | spin_lock_irqsave(&hdsp->lock, flags); | 852 | spin_lock_irqsave(&hdsp->lock, flags); |
853 | if ((hdsp->playback_pid != hdsp->capture_pid) && | 853 | if ((hdsp->playback_pid != hdsp->capture_pid) && |
854 | (hdsp->playback_pid >= 0) && (hdsp->capture_pid >= 0)) { | 854 | (hdsp->playback_pid >= 0) && (hdsp->capture_pid >= 0)) |
855 | ret = 0; | 855 | ret = 0; |
856 | } | ||
857 | spin_unlock_irqrestore(&hdsp->lock, flags); | 856 | spin_unlock_irqrestore(&hdsp->lock, flags); |
858 | return ret; | 857 | return ret; |
859 | } | 858 | } |
@@ -880,9 +879,8 @@ static int hdsp_spdif_sample_rate(hdsp_t *hdsp) | |||
880 | unsigned int status = hdsp_read(hdsp, HDSP_statusRegister); | 879 | unsigned int status = hdsp_read(hdsp, HDSP_statusRegister); |
881 | unsigned int rate_bits = (status & HDSP_spdifFrequencyMask); | 880 | unsigned int rate_bits = (status & HDSP_spdifFrequencyMask); |
882 | 881 | ||
883 | if (status & HDSP_SPDIFErrorFlag) { | 882 | if (status & HDSP_SPDIFErrorFlag) |
884 | return 0; | 883 | return 0; |
885 | } | ||
886 | 884 | ||
887 | switch (rate_bits) { | 885 | switch (rate_bits) { |
888 | case HDSP_spdifFrequency32KHz: return 32000; | 886 | case HDSP_spdifFrequency32KHz: return 32000; |
@@ -918,9 +916,8 @@ static snd_pcm_uframes_t hdsp_hw_pointer(hdsp_t *hdsp) | |||
918 | 916 | ||
919 | position = hdsp_read(hdsp, HDSP_statusRegister); | 917 | position = hdsp_read(hdsp, HDSP_statusRegister); |
920 | 918 | ||
921 | if (!hdsp->precise_ptr) { | 919 | if (!hdsp->precise_ptr) |
922 | return (position & HDSP_BufferID) ? (hdsp->period_bytes / 4) : 0; | 920 | return (position & HDSP_BufferID) ? (hdsp->period_bytes / 4) : 0; |
923 | } | ||
924 | 921 | ||
925 | position &= HDSP_BufferPositionMask; | 922 | position &= HDSP_BufferPositionMask; |
926 | position /= 4; | 923 | position /= 4; |
@@ -989,19 +986,19 @@ static int hdsp_set_rate(hdsp_t *hdsp, int rate, int called_internally) | |||
989 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { | 986 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { |
990 | if (called_internally) { | 987 | if (called_internally) { |
991 | /* request from ctl or card initialization */ | 988 | /* request from ctl or card initialization */ |
992 | snd_printk("Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); | 989 | snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); |
993 | return -1; | 990 | return -1; |
994 | } else { | 991 | } else { |
995 | /* hw_param request while in AutoSync mode */ | 992 | /* hw_param request while in AutoSync mode */ |
996 | int external_freq = hdsp_external_sample_rate(hdsp); | 993 | int external_freq = hdsp_external_sample_rate(hdsp); |
997 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); | 994 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); |
998 | 995 | ||
999 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) { | 996 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1000 | snd_printk("Hammerfall-DSP: Detected ADAT in double speed mode\n"); | 997 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); |
1001 | } else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) { | 998 | else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1002 | snd_printk("Hammerfall-DSP: Detected ADAT in quad speed mode\n"); | 999 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); |
1003 | } else if (rate != external_freq) { | 1000 | else if (rate != external_freq) { |
1004 | snd_printk("Hammerfall-DSP: No AutoSync source for requested rate\n"); | 1001 | snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); |
1005 | return -1; | 1002 | return -1; |
1006 | } | 1003 | } |
1007 | } | 1004 | } |
@@ -1019,63 +1016,53 @@ static int hdsp_set_rate(hdsp_t *hdsp, int rate, int called_internally) | |||
1019 | exists for externally-driven rate changes. All we can do | 1016 | exists for externally-driven rate changes. All we can do |
1020 | is to flag rate changes in the read/write routines. */ | 1017 | is to flag rate changes in the read/write routines. */ |
1021 | 1018 | ||
1022 | if (rate > 96000 && hdsp->io_type != H9632) { | 1019 | if (rate > 96000 && hdsp->io_type != H9632) |
1023 | return -EINVAL; | 1020 | return -EINVAL; |
1024 | } | ||
1025 | 1021 | ||
1026 | switch (rate) { | 1022 | switch (rate) { |
1027 | case 32000: | 1023 | case 32000: |
1028 | if (current_rate > 48000) { | 1024 | if (current_rate > 48000) |
1029 | reject_if_open = 1; | 1025 | reject_if_open = 1; |
1030 | } | ||
1031 | rate_bits = HDSP_Frequency32KHz; | 1026 | rate_bits = HDSP_Frequency32KHz; |
1032 | break; | 1027 | break; |
1033 | case 44100: | 1028 | case 44100: |
1034 | if (current_rate > 48000) { | 1029 | if (current_rate > 48000) |
1035 | reject_if_open = 1; | 1030 | reject_if_open = 1; |
1036 | } | ||
1037 | rate_bits = HDSP_Frequency44_1KHz; | 1031 | rate_bits = HDSP_Frequency44_1KHz; |
1038 | break; | 1032 | break; |
1039 | case 48000: | 1033 | case 48000: |
1040 | if (current_rate > 48000) { | 1034 | if (current_rate > 48000) |
1041 | reject_if_open = 1; | 1035 | reject_if_open = 1; |
1042 | } | ||
1043 | rate_bits = HDSP_Frequency48KHz; | 1036 | rate_bits = HDSP_Frequency48KHz; |
1044 | break; | 1037 | break; |
1045 | case 64000: | 1038 | case 64000: |
1046 | if (current_rate <= 48000 || current_rate > 96000) { | 1039 | if (current_rate <= 48000 || current_rate > 96000) |
1047 | reject_if_open = 1; | 1040 | reject_if_open = 1; |
1048 | } | ||
1049 | rate_bits = HDSP_Frequency64KHz; | 1041 | rate_bits = HDSP_Frequency64KHz; |
1050 | break; | 1042 | break; |
1051 | case 88200: | 1043 | case 88200: |
1052 | if (current_rate <= 48000 || current_rate > 96000) { | 1044 | if (current_rate <= 48000 || current_rate > 96000) |
1053 | reject_if_open = 1; | 1045 | reject_if_open = 1; |
1054 | } | ||
1055 | rate_bits = HDSP_Frequency88_2KHz; | 1046 | rate_bits = HDSP_Frequency88_2KHz; |
1056 | break; | 1047 | break; |
1057 | case 96000: | 1048 | case 96000: |
1058 | if (current_rate <= 48000 || current_rate > 96000) { | 1049 | if (current_rate <= 48000 || current_rate > 96000) |
1059 | reject_if_open = 1; | 1050 | reject_if_open = 1; |
1060 | } | ||
1061 | rate_bits = HDSP_Frequency96KHz; | 1051 | rate_bits = HDSP_Frequency96KHz; |
1062 | break; | 1052 | break; |
1063 | case 128000: | 1053 | case 128000: |
1064 | if (current_rate < 128000) { | 1054 | if (current_rate < 128000) |
1065 | reject_if_open = 1; | 1055 | reject_if_open = 1; |
1066 | } | ||
1067 | rate_bits = HDSP_Frequency128KHz; | 1056 | rate_bits = HDSP_Frequency128KHz; |
1068 | break; | 1057 | break; |
1069 | case 176400: | 1058 | case 176400: |
1070 | if (current_rate < 128000) { | 1059 | if (current_rate < 128000) |
1071 | reject_if_open = 1; | 1060 | reject_if_open = 1; |
1072 | } | ||
1073 | rate_bits = HDSP_Frequency176_4KHz; | 1061 | rate_bits = HDSP_Frequency176_4KHz; |
1074 | break; | 1062 | break; |
1075 | case 192000: | 1063 | case 192000: |
1076 | if (current_rate < 128000) { | 1064 | if (current_rate < 128000) |
1077 | reject_if_open = 1; | 1065 | reject_if_open = 1; |
1078 | } | ||
1079 | rate_bits = HDSP_Frequency192KHz; | 1066 | rate_bits = HDSP_Frequency192KHz; |
1080 | break; | 1067 | break; |
1081 | default: | 1068 | default: |
@@ -1096,11 +1083,10 @@ static int hdsp_set_rate(hdsp_t *hdsp, int rate, int called_internally) | |||
1096 | if (rate >= 128000) { | 1083 | if (rate >= 128000) { |
1097 | hdsp->channel_map = channel_map_H9632_qs; | 1084 | hdsp->channel_map = channel_map_H9632_qs; |
1098 | } else if (rate > 48000) { | 1085 | } else if (rate > 48000) { |
1099 | if (hdsp->io_type == H9632) { | 1086 | if (hdsp->io_type == H9632) |
1100 | hdsp->channel_map = channel_map_H9632_ds; | 1087 | hdsp->channel_map = channel_map_H9632_ds; |
1101 | } else { | 1088 | else |
1102 | hdsp->channel_map = channel_map_ds; | 1089 | hdsp->channel_map = channel_map_ds; |
1103 | } | ||
1104 | } else { | 1090 | } else { |
1105 | switch (hdsp->io_type) { | 1091 | switch (hdsp->io_type) { |
1106 | case Multiface: | 1092 | case Multiface: |
@@ -1131,54 +1117,48 @@ static int hdsp_set_rate(hdsp_t *hdsp, int rate, int called_internally) | |||
1131 | static unsigned char snd_hdsp_midi_read_byte (hdsp_t *hdsp, int id) | 1117 | static unsigned char snd_hdsp_midi_read_byte (hdsp_t *hdsp, int id) |
1132 | { | 1118 | { |
1133 | /* the hardware already does the relevant bit-mask with 0xff */ | 1119 | /* the hardware already does the relevant bit-mask with 0xff */ |
1134 | if (id) { | 1120 | if (id) |
1135 | return hdsp_read(hdsp, HDSP_midiDataIn1); | 1121 | return hdsp_read(hdsp, HDSP_midiDataIn1); |
1136 | } else { | 1122 | else |
1137 | return hdsp_read(hdsp, HDSP_midiDataIn0); | 1123 | return hdsp_read(hdsp, HDSP_midiDataIn0); |
1138 | } | ||
1139 | } | 1124 | } |
1140 | 1125 | ||
1141 | static void snd_hdsp_midi_write_byte (hdsp_t *hdsp, int id, int val) | 1126 | static void snd_hdsp_midi_write_byte (hdsp_t *hdsp, int id, int val) |
1142 | { | 1127 | { |
1143 | /* the hardware already does the relevant bit-mask with 0xff */ | 1128 | /* the hardware already does the relevant bit-mask with 0xff */ |
1144 | if (id) { | 1129 | if (id) |
1145 | hdsp_write(hdsp, HDSP_midiDataOut1, val); | 1130 | hdsp_write(hdsp, HDSP_midiDataOut1, val); |
1146 | } else { | 1131 | else |
1147 | hdsp_write(hdsp, HDSP_midiDataOut0, val); | 1132 | hdsp_write(hdsp, HDSP_midiDataOut0, val); |
1148 | } | ||
1149 | } | 1133 | } |
1150 | 1134 | ||
1151 | static int snd_hdsp_midi_input_available (hdsp_t *hdsp, int id) | 1135 | static int snd_hdsp_midi_input_available (hdsp_t *hdsp, int id) |
1152 | { | 1136 | { |
1153 | if (id) { | 1137 | if (id) |
1154 | return (hdsp_read(hdsp, HDSP_midiStatusIn1) & 0xff); | 1138 | return (hdsp_read(hdsp, HDSP_midiStatusIn1) & 0xff); |
1155 | } else { | 1139 | else |
1156 | return (hdsp_read(hdsp, HDSP_midiStatusIn0) & 0xff); | 1140 | return (hdsp_read(hdsp, HDSP_midiStatusIn0) & 0xff); |
1157 | } | ||
1158 | } | 1141 | } |
1159 | 1142 | ||
1160 | static int snd_hdsp_midi_output_possible (hdsp_t *hdsp, int id) | 1143 | static int snd_hdsp_midi_output_possible (hdsp_t *hdsp, int id) |
1161 | { | 1144 | { |
1162 | int fifo_bytes_used; | 1145 | int fifo_bytes_used; |
1163 | 1146 | ||
1164 | if (id) { | 1147 | if (id) |
1165 | fifo_bytes_used = hdsp_read(hdsp, HDSP_midiStatusOut1) & 0xff; | 1148 | fifo_bytes_used = hdsp_read(hdsp, HDSP_midiStatusOut1) & 0xff; |
1166 | } else { | 1149 | else |
1167 | fifo_bytes_used = hdsp_read(hdsp, HDSP_midiStatusOut0) & 0xff; | 1150 | fifo_bytes_used = hdsp_read(hdsp, HDSP_midiStatusOut0) & 0xff; |
1168 | } | ||
1169 | 1151 | ||
1170 | if (fifo_bytes_used < 128) { | 1152 | if (fifo_bytes_used < 128) |
1171 | return 128 - fifo_bytes_used; | 1153 | return 128 - fifo_bytes_used; |
1172 | } else { | 1154 | else |
1173 | return 0; | 1155 | return 0; |
1174 | } | ||
1175 | } | 1156 | } |
1176 | 1157 | ||
1177 | static void snd_hdsp_flush_midi_input (hdsp_t *hdsp, int id) | 1158 | static void snd_hdsp_flush_midi_input (hdsp_t *hdsp, int id) |
1178 | { | 1159 | { |
1179 | while (snd_hdsp_midi_input_available (hdsp, id)) { | 1160 | while (snd_hdsp_midi_input_available (hdsp, id)) |
1180 | snd_hdsp_midi_read_byte (hdsp, id); | 1161 | snd_hdsp_midi_read_byte (hdsp, id); |
1181 | } | ||
1182 | } | 1162 | } |
1183 | 1163 | ||
1184 | static int snd_hdsp_midi_output_write (hdsp_midi_t *hmidi) | 1164 | static int snd_hdsp_midi_output_write (hdsp_midi_t *hmidi) |
@@ -1219,28 +1199,23 @@ static int snd_hdsp_midi_input_read (hdsp_midi_t *hmidi) | |||
1219 | spin_lock_irqsave (&hmidi->lock, flags); | 1199 | spin_lock_irqsave (&hmidi->lock, flags); |
1220 | if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) { | 1200 | if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) { |
1221 | if (hmidi->input) { | 1201 | if (hmidi->input) { |
1222 | if (n_pending > (int)sizeof (buf)) { | 1202 | if (n_pending > (int)sizeof (buf)) |
1223 | n_pending = sizeof (buf); | 1203 | n_pending = sizeof (buf); |
1224 | } | 1204 | for (i = 0; i < n_pending; ++i) |
1225 | for (i = 0; i < n_pending; ++i) { | ||
1226 | buf[i] = snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); | 1205 | buf[i] = snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); |
1227 | } | 1206 | if (n_pending) |
1228 | if (n_pending) { | ||
1229 | snd_rawmidi_receive (hmidi->input, buf, n_pending); | 1207 | snd_rawmidi_receive (hmidi->input, buf, n_pending); |
1230 | } | ||
1231 | } else { | 1208 | } else { |
1232 | /* flush the MIDI input FIFO */ | 1209 | /* flush the MIDI input FIFO */ |
1233 | while (--n_pending) { | 1210 | while (--n_pending) |
1234 | snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); | 1211 | snd_hdsp_midi_read_byte (hmidi->hdsp, hmidi->id); |
1235 | } | ||
1236 | } | 1212 | } |
1237 | } | 1213 | } |
1238 | hmidi->pending = 0; | 1214 | hmidi->pending = 0; |
1239 | if (hmidi->id) { | 1215 | if (hmidi->id) |
1240 | hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable; | 1216 | hmidi->hdsp->control_register |= HDSP_Midi1InterruptEnable; |
1241 | } else { | 1217 | else |
1242 | hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable; | 1218 | hmidi->hdsp->control_register |= HDSP_Midi0InterruptEnable; |
1243 | } | ||
1244 | hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register); | 1219 | hdsp_write(hmidi->hdsp, HDSP_controlRegister, hmidi->hdsp->control_register); |
1245 | spin_unlock_irqrestore (&hmidi->lock, flags); | 1220 | spin_unlock_irqrestore (&hmidi->lock, flags); |
1246 | return snd_hdsp_midi_output_write (hmidi); | 1221 | return snd_hdsp_midi_output_write (hmidi); |
@@ -1310,9 +1285,8 @@ static void snd_hdsp_midi_output_trigger(snd_rawmidi_substream_t * substream, in | |||
1310 | hmidi->istimer++; | 1285 | hmidi->istimer++; |
1311 | } | 1286 | } |
1312 | } else { | 1287 | } else { |
1313 | if (hmidi->istimer && --hmidi->istimer <= 0) { | 1288 | if (hmidi->istimer && --hmidi->istimer <= 0) |
1314 | del_timer (&hmidi->timer); | 1289 | del_timer (&hmidi->timer); |
1315 | } | ||
1316 | } | 1290 | } |
1317 | spin_unlock_irqrestore (&hmidi->lock, flags); | 1291 | spin_unlock_irqrestore (&hmidi->lock, flags); |
1318 | if (up) | 1292 | if (up) |
@@ -1400,9 +1374,8 @@ static int __devinit snd_hdsp_create_midi (snd_card_t *card, hdsp_t *hdsp, int i | |||
1400 | spin_lock_init (&hdsp->midi[id].lock); | 1374 | spin_lock_init (&hdsp->midi[id].lock); |
1401 | 1375 | ||
1402 | sprintf (buf, "%s MIDI %d", card->shortname, id+1); | 1376 | sprintf (buf, "%s MIDI %d", card->shortname, id+1); |
1403 | if (snd_rawmidi_new (card, buf, id, 1, 1, &hdsp->midi[id].rmidi) < 0) { | 1377 | if (snd_rawmidi_new (card, buf, id, 1, 1, &hdsp->midi[id].rmidi) < 0) |
1404 | return -1; | 1378 | return -1; |
1405 | } | ||
1406 | 1379 | ||
1407 | sprintf (hdsp->midi[id].rmidi->name, "%s MIDI %d", card->id, id+1); | 1380 | sprintf (hdsp->midi[id].rmidi->name, "%s MIDI %d", card->id, id+1); |
1408 | hdsp->midi[id].rmidi->private_data = &hdsp->midi[id]; | 1381 | hdsp->midi[id].rmidi->private_data = &hdsp->midi[id]; |
@@ -1588,11 +1561,10 @@ static int hdsp_spdif_out(hdsp_t *hdsp) | |||
1588 | 1561 | ||
1589 | static int hdsp_set_spdif_output(hdsp_t *hdsp, int out) | 1562 | static int hdsp_set_spdif_output(hdsp_t *hdsp, int out) |
1590 | { | 1563 | { |
1591 | if (out) { | 1564 | if (out) |
1592 | hdsp->control_register |= HDSP_SPDIFOpticalOut; | 1565 | hdsp->control_register |= HDSP_SPDIFOpticalOut; |
1593 | } else { | 1566 | else |
1594 | hdsp->control_register &= ~HDSP_SPDIFOpticalOut; | 1567 | hdsp->control_register &= ~HDSP_SPDIFOpticalOut; |
1595 | } | ||
1596 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 1568 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
1597 | return 0; | 1569 | return 0; |
1598 | } | 1570 | } |
@@ -1642,11 +1614,10 @@ static int hdsp_spdif_professional(hdsp_t *hdsp) | |||
1642 | 1614 | ||
1643 | static int hdsp_set_spdif_professional(hdsp_t *hdsp, int val) | 1615 | static int hdsp_set_spdif_professional(hdsp_t *hdsp, int val) |
1644 | { | 1616 | { |
1645 | if (val) { | 1617 | if (val) |
1646 | hdsp->control_register |= HDSP_SPDIFProfessional; | 1618 | hdsp->control_register |= HDSP_SPDIFProfessional; |
1647 | } else { | 1619 | else |
1648 | hdsp->control_register &= ~HDSP_SPDIFProfessional; | 1620 | hdsp->control_register &= ~HDSP_SPDIFProfessional; |
1649 | } | ||
1650 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 1621 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
1651 | return 0; | 1622 | return 0; |
1652 | } | 1623 | } |
@@ -1687,11 +1658,10 @@ static int hdsp_spdif_emphasis(hdsp_t *hdsp) | |||
1687 | 1658 | ||
1688 | static int hdsp_set_spdif_emphasis(hdsp_t *hdsp, int val) | 1659 | static int hdsp_set_spdif_emphasis(hdsp_t *hdsp, int val) |
1689 | { | 1660 | { |
1690 | if (val) { | 1661 | if (val) |
1691 | hdsp->control_register |= HDSP_SPDIFEmphasis; | 1662 | hdsp->control_register |= HDSP_SPDIFEmphasis; |
1692 | } else { | 1663 | else |
1693 | hdsp->control_register &= ~HDSP_SPDIFEmphasis; | 1664 | hdsp->control_register &= ~HDSP_SPDIFEmphasis; |
1694 | } | ||
1695 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 1665 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
1696 | return 0; | 1666 | return 0; |
1697 | } | 1667 | } |
@@ -1732,11 +1702,10 @@ static int hdsp_spdif_nonaudio(hdsp_t *hdsp) | |||
1732 | 1702 | ||
1733 | static int hdsp_set_spdif_nonaudio(hdsp_t *hdsp, int val) | 1703 | static int hdsp_set_spdif_nonaudio(hdsp_t *hdsp, int val) |
1734 | { | 1704 | { |
1735 | if (val) { | 1705 | if (val) |
1736 | hdsp->control_register |= HDSP_SPDIFNonAudio; | 1706 | hdsp->control_register |= HDSP_SPDIFNonAudio; |
1737 | } else { | 1707 | else |
1738 | hdsp->control_register &= ~HDSP_SPDIFNonAudio; | 1708 | hdsp->control_register &= ~HDSP_SPDIFNonAudio; |
1739 | } | ||
1740 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 1709 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
1741 | return 0; | 1710 | return 0; |
1742 | } | 1711 | } |
@@ -1921,11 +1890,10 @@ static int snd_hdsp_get_autosync_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_ | |||
1921 | 1890 | ||
1922 | static int hdsp_system_clock_mode(hdsp_t *hdsp) | 1891 | static int hdsp_system_clock_mode(hdsp_t *hdsp) |
1923 | { | 1892 | { |
1924 | if (hdsp->control_register & HDSP_ClockModeMaster) { | 1893 | if (hdsp->control_register & HDSP_ClockModeMaster) |
1925 | return 0; | 1894 | return 0; |
1926 | } else if (hdsp_external_sample_rate(hdsp) != hdsp->system_sample_rate) { | 1895 | else if (hdsp_external_sample_rate(hdsp) != hdsp->system_sample_rate) |
1927 | return 0; | 1896 | return 0; |
1928 | } | ||
1929 | return 1; | 1897 | return 1; |
1930 | } | 1898 | } |
1931 | 1899 | ||
@@ -2074,16 +2042,17 @@ static int snd_hdsp_put_clock_source(snd_kcontrol_t * kcontrol, snd_ctl_elem_val | |||
2074 | val = ucontrol->value.enumerated.item[0]; | 2042 | val = ucontrol->value.enumerated.item[0]; |
2075 | if (val < 0) val = 0; | 2043 | if (val < 0) val = 0; |
2076 | if (hdsp->io_type == H9632) { | 2044 | if (hdsp->io_type == H9632) { |
2077 | if (val > 9) val = 9; | 2045 | if (val > 9) |
2046 | val = 9; | ||
2078 | } else { | 2047 | } else { |
2079 | if (val > 6) val = 6; | 2048 | if (val > 6) |
2049 | val = 6; | ||
2080 | } | 2050 | } |
2081 | spin_lock_irq(&hdsp->lock); | 2051 | spin_lock_irq(&hdsp->lock); |
2082 | if (val != hdsp_clock_source(hdsp)) { | 2052 | if (val != hdsp_clock_source(hdsp)) |
2083 | change = (hdsp_set_clock_source(hdsp, val) == 0) ? 1 : 0; | 2053 | change = (hdsp_set_clock_source(hdsp, val) == 0) ? 1 : 0; |
2084 | } else { | 2054 | else |
2085 | change = 0; | 2055 | change = 0; |
2086 | } | ||
2087 | spin_unlock_irq(&hdsp->lock); | 2056 | spin_unlock_irq(&hdsp->lock); |
2088 | return change; | 2057 | return change; |
2089 | } | 2058 | } |
@@ -2193,11 +2162,10 @@ static int snd_hdsp_put_da_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2193 | if (val < 0) val = 0; | 2162 | if (val < 0) val = 0; |
2194 | if (val > 2) val = 2; | 2163 | if (val > 2) val = 2; |
2195 | spin_lock_irq(&hdsp->lock); | 2164 | spin_lock_irq(&hdsp->lock); |
2196 | if (val != hdsp_da_gain(hdsp)) { | 2165 | if (val != hdsp_da_gain(hdsp)) |
2197 | change = (hdsp_set_da_gain(hdsp, val) == 0) ? 1 : 0; | 2166 | change = (hdsp_set_da_gain(hdsp, val) == 0) ? 1 : 0; |
2198 | } else { | 2167 | else |
2199 | change = 0; | 2168 | change = 0; |
2200 | } | ||
2201 | spin_unlock_irq(&hdsp->lock); | 2169 | spin_unlock_irq(&hdsp->lock); |
2202 | return change; | 2170 | return change; |
2203 | } | 2171 | } |
@@ -2279,11 +2247,10 @@ static int snd_hdsp_put_ad_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2279 | if (val < 0) val = 0; | 2247 | if (val < 0) val = 0; |
2280 | if (val > 2) val = 2; | 2248 | if (val > 2) val = 2; |
2281 | spin_lock_irq(&hdsp->lock); | 2249 | spin_lock_irq(&hdsp->lock); |
2282 | if (val != hdsp_ad_gain(hdsp)) { | 2250 | if (val != hdsp_ad_gain(hdsp)) |
2283 | change = (hdsp_set_ad_gain(hdsp, val) == 0) ? 1 : 0; | 2251 | change = (hdsp_set_ad_gain(hdsp, val) == 0) ? 1 : 0; |
2284 | } else { | 2252 | else |
2285 | change = 0; | 2253 | change = 0; |
2286 | } | ||
2287 | spin_unlock_irq(&hdsp->lock); | 2254 | spin_unlock_irq(&hdsp->lock); |
2288 | return change; | 2255 | return change; |
2289 | } | 2256 | } |
@@ -2365,11 +2332,10 @@ static int snd_hdsp_put_phone_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
2365 | if (val < 0) val = 0; | 2332 | if (val < 0) val = 0; |
2366 | if (val > 2) val = 2; | 2333 | if (val > 2) val = 2; |
2367 | spin_lock_irq(&hdsp->lock); | 2334 | spin_lock_irq(&hdsp->lock); |
2368 | if (val != hdsp_phone_gain(hdsp)) { | 2335 | if (val != hdsp_phone_gain(hdsp)) |
2369 | change = (hdsp_set_phone_gain(hdsp, val) == 0) ? 1 : 0; | 2336 | change = (hdsp_set_phone_gain(hdsp, val) == 0) ? 1 : 0; |
2370 | } else { | 2337 | else |
2371 | change = 0; | 2338 | change = 0; |
2372 | } | ||
2373 | spin_unlock_irq(&hdsp->lock); | 2339 | spin_unlock_irq(&hdsp->lock); |
2374 | return change; | 2340 | return change; |
2375 | } | 2341 | } |
@@ -2385,19 +2351,17 @@ static int snd_hdsp_put_phone_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
2385 | 2351 | ||
2386 | static int hdsp_xlr_breakout_cable(hdsp_t *hdsp) | 2352 | static int hdsp_xlr_breakout_cable(hdsp_t *hdsp) |
2387 | { | 2353 | { |
2388 | if (hdsp->control_register & HDSP_XLRBreakoutCable) { | 2354 | if (hdsp->control_register & HDSP_XLRBreakoutCable) |
2389 | return 1; | 2355 | return 1; |
2390 | } | ||
2391 | return 0; | 2356 | return 0; |
2392 | } | 2357 | } |
2393 | 2358 | ||
2394 | static int hdsp_set_xlr_breakout_cable(hdsp_t *hdsp, int mode) | 2359 | static int hdsp_set_xlr_breakout_cable(hdsp_t *hdsp, int mode) |
2395 | { | 2360 | { |
2396 | if (mode) { | 2361 | if (mode) |
2397 | hdsp->control_register |= HDSP_XLRBreakoutCable; | 2362 | hdsp->control_register |= HDSP_XLRBreakoutCable; |
2398 | } else { | 2363 | else |
2399 | hdsp->control_register &= ~HDSP_XLRBreakoutCable; | 2364 | hdsp->control_register &= ~HDSP_XLRBreakoutCable; |
2400 | } | ||
2401 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 2365 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
2402 | return 0; | 2366 | return 0; |
2403 | } | 2367 | } |
@@ -2450,19 +2414,17 @@ static int snd_hdsp_put_xlr_breakout_cable(snd_kcontrol_t * kcontrol, snd_ctl_el | |||
2450 | 2414 | ||
2451 | static int hdsp_aeb(hdsp_t *hdsp) | 2415 | static int hdsp_aeb(hdsp_t *hdsp) |
2452 | { | 2416 | { |
2453 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) { | 2417 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) |
2454 | return 1; | 2418 | return 1; |
2455 | } | ||
2456 | return 0; | 2419 | return 0; |
2457 | } | 2420 | } |
2458 | 2421 | ||
2459 | static int hdsp_set_aeb(hdsp_t *hdsp, int mode) | 2422 | static int hdsp_set_aeb(hdsp_t *hdsp, int mode) |
2460 | { | 2423 | { |
2461 | if (mode) { | 2424 | if (mode) |
2462 | hdsp->control_register |= HDSP_AnalogExtensionBoard; | 2425 | hdsp->control_register |= HDSP_AnalogExtensionBoard; |
2463 | } else { | 2426 | else |
2464 | hdsp->control_register &= ~HDSP_AnalogExtensionBoard; | 2427 | hdsp->control_register &= ~HDSP_AnalogExtensionBoard; |
2465 | } | ||
2466 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 2428 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
2467 | return 0; | 2429 | return 0; |
2468 | } | 2430 | } |
@@ -2705,11 +2667,10 @@ static int hdsp_line_out(hdsp_t *hdsp) | |||
2705 | 2667 | ||
2706 | static int hdsp_set_line_output(hdsp_t *hdsp, int out) | 2668 | static int hdsp_set_line_output(hdsp_t *hdsp, int out) |
2707 | { | 2669 | { |
2708 | if (out) { | 2670 | if (out) |
2709 | hdsp->control_register |= HDSP_LineOut; | 2671 | hdsp->control_register |= HDSP_LineOut; |
2710 | } else { | 2672 | else |
2711 | hdsp->control_register &= ~HDSP_LineOut; | 2673 | hdsp->control_register &= ~HDSP_LineOut; |
2712 | } | ||
2713 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 2674 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
2714 | return 0; | 2675 | return 0; |
2715 | } | 2676 | } |
@@ -2760,11 +2721,10 @@ static int snd_hdsp_put_line_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
2760 | 2721 | ||
2761 | static int hdsp_set_precise_pointer(hdsp_t *hdsp, int precise) | 2722 | static int hdsp_set_precise_pointer(hdsp_t *hdsp, int precise) |
2762 | { | 2723 | { |
2763 | if (precise) { | 2724 | if (precise) |
2764 | hdsp->precise_ptr = 1; | 2725 | hdsp->precise_ptr = 1; |
2765 | } else { | 2726 | else |
2766 | hdsp->precise_ptr = 0; | 2727 | hdsp->precise_ptr = 0; |
2767 | } | ||
2768 | return 0; | 2728 | return 0; |
2769 | } | 2729 | } |
2770 | 2730 | ||
@@ -2814,11 +2774,10 @@ static int snd_hdsp_put_precise_pointer(snd_kcontrol_t * kcontrol, snd_ctl_elem_ | |||
2814 | 2774 | ||
2815 | static int hdsp_set_use_midi_tasklet(hdsp_t *hdsp, int use_tasklet) | 2775 | static int hdsp_set_use_midi_tasklet(hdsp_t *hdsp, int use_tasklet) |
2816 | { | 2776 | { |
2817 | if (use_tasklet) { | 2777 | if (use_tasklet) |
2818 | hdsp->use_midi_tasklet = 1; | 2778 | hdsp->use_midi_tasklet = 1; |
2819 | } else { | 2779 | else |
2820 | hdsp->use_midi_tasklet = 0; | 2780 | hdsp->use_midi_tasklet = 0; |
2821 | } | ||
2822 | return 0; | 2781 | return 0; |
2823 | } | 2782 | } |
2824 | 2783 | ||
@@ -2889,11 +2848,10 @@ static int snd_hdsp_get_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
2889 | source = ucontrol->value.integer.value[0]; | 2848 | source = ucontrol->value.integer.value[0]; |
2890 | destination = ucontrol->value.integer.value[1]; | 2849 | destination = ucontrol->value.integer.value[1]; |
2891 | 2850 | ||
2892 | if (source >= hdsp->max_channels) { | 2851 | if (source >= hdsp->max_channels) |
2893 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); | 2852 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); |
2894 | } else { | 2853 | else |
2895 | addr = hdsp_input_to_output_key(hdsp,source, destination); | 2854 | addr = hdsp_input_to_output_key(hdsp,source, destination); |
2896 | } | ||
2897 | 2855 | ||
2898 | spin_lock_irq(&hdsp->lock); | 2856 | spin_lock_irq(&hdsp->lock); |
2899 | ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); | 2857 | ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); |
@@ -2916,11 +2874,10 @@ static int snd_hdsp_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
2916 | source = ucontrol->value.integer.value[0]; | 2874 | source = ucontrol->value.integer.value[0]; |
2917 | destination = ucontrol->value.integer.value[1]; | 2875 | destination = ucontrol->value.integer.value[1]; |
2918 | 2876 | ||
2919 | if (source >= hdsp->max_channels) { | 2877 | if (source >= hdsp->max_channels) |
2920 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels, destination); | 2878 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels, destination); |
2921 | } else { | 2879 | else |
2922 | addr = hdsp_input_to_output_key(hdsp,source, destination); | 2880 | addr = hdsp_input_to_output_key(hdsp,source, destination); |
2923 | } | ||
2924 | 2881 | ||
2925 | gain = ucontrol->value.integer.value[2]; | 2882 | gain = ucontrol->value.integer.value[2]; |
2926 | 2883 | ||
@@ -2957,14 +2914,12 @@ static int hdsp_wc_sync_check(hdsp_t *hdsp) | |||
2957 | { | 2914 | { |
2958 | int status2 = hdsp_read(hdsp, HDSP_status2Register); | 2915 | int status2 = hdsp_read(hdsp, HDSP_status2Register); |
2959 | if (status2 & HDSP_wc_lock) { | 2916 | if (status2 & HDSP_wc_lock) { |
2960 | if (status2 & HDSP_wc_sync) { | 2917 | if (status2 & HDSP_wc_sync) |
2961 | return 2; | 2918 | return 2; |
2962 | } else { | 2919 | else |
2963 | return 1; | 2920 | return 1; |
2964 | } | 2921 | } else |
2965 | } else { | ||
2966 | return 0; | 2922 | return 0; |
2967 | } | ||
2968 | return 0; | 2923 | return 0; |
2969 | } | 2924 | } |
2970 | 2925 | ||
@@ -2988,14 +2943,13 @@ static int snd_hdsp_get_wc_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_va | |||
2988 | static int hdsp_spdif_sync_check(hdsp_t *hdsp) | 2943 | static int hdsp_spdif_sync_check(hdsp_t *hdsp) |
2989 | { | 2944 | { |
2990 | int status = hdsp_read(hdsp, HDSP_statusRegister); | 2945 | int status = hdsp_read(hdsp, HDSP_statusRegister); |
2991 | if (status & HDSP_SPDIFErrorFlag) { | 2946 | if (status & HDSP_SPDIFErrorFlag) |
2992 | return 0; | 2947 | return 0; |
2993 | } else { | 2948 | else { |
2994 | if (status & HDSP_SPDIFSync) { | 2949 | if (status & HDSP_SPDIFSync) |
2995 | return 2; | 2950 | return 2; |
2996 | } else { | 2951 | else |
2997 | return 1; | 2952 | return 1; |
2998 | } | ||
2999 | } | 2953 | } |
3000 | return 0; | 2954 | return 0; |
3001 | } | 2955 | } |
@@ -3021,14 +2975,12 @@ static int hdsp_adatsync_sync_check(hdsp_t *hdsp) | |||
3021 | { | 2975 | { |
3022 | int status = hdsp_read(hdsp, HDSP_statusRegister); | 2976 | int status = hdsp_read(hdsp, HDSP_statusRegister); |
3023 | if (status & HDSP_TimecodeLock) { | 2977 | if (status & HDSP_TimecodeLock) { |
3024 | if (status & HDSP_TimecodeSync) { | 2978 | if (status & HDSP_TimecodeSync) |
3025 | return 2; | 2979 | return 2; |
3026 | } else { | 2980 | else |
3027 | return 1; | 2981 | return 1; |
3028 | } | 2982 | } else |
3029 | } else { | ||
3030 | return 0; | 2983 | return 0; |
3031 | } | ||
3032 | } | 2984 | } |
3033 | 2985 | ||
3034 | static int snd_hdsp_get_adatsync_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 2986 | static int snd_hdsp_get_adatsync_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) |
@@ -3051,14 +3003,12 @@ static int hdsp_adat_sync_check(hdsp_t *hdsp, int idx) | |||
3051 | int status = hdsp_read(hdsp, HDSP_statusRegister); | 3003 | int status = hdsp_read(hdsp, HDSP_statusRegister); |
3052 | 3004 | ||
3053 | if (status & (HDSP_Lock0>>idx)) { | 3005 | if (status & (HDSP_Lock0>>idx)) { |
3054 | if (status & (HDSP_Sync0>>idx)) { | 3006 | if (status & (HDSP_Sync0>>idx)) |
3055 | return 2; | 3007 | return 2; |
3056 | } else { | 3008 | else |
3057 | return 1; | 3009 | return 1; |
3058 | } | 3010 | } else |
3059 | } else { | ||
3060 | return 0; | 3011 | return 0; |
3061 | } | ||
3062 | } | 3012 | } |
3063 | 3013 | ||
3064 | static int snd_hdsp_get_adat_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 3014 | static int snd_hdsp_get_adat_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) |
@@ -3171,9 +3121,8 @@ static int snd_hdsp_create_controls(snd_card_t *card, hdsp_t *hdsp) | |||
3171 | snd_kcontrol_t *kctl; | 3121 | snd_kcontrol_t *kctl; |
3172 | 3122 | ||
3173 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) { | 3123 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) { |
3174 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) { | 3124 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) |
3175 | return err; | 3125 | return err; |
3176 | } | ||
3177 | if (idx == 1) /* IEC958 (S/PDIF) Stream */ | 3126 | if (idx == 1) /* IEC958 (S/PDIF) Stream */ |
3178 | hdsp->spdif_ctl = kctl; | 3127 | hdsp->spdif_ctl = kctl; |
3179 | } | 3128 | } |
@@ -3181,32 +3130,28 @@ static int snd_hdsp_create_controls(snd_card_t *card, hdsp_t *hdsp) | |||
3181 | /* ADAT SyncCheck status */ | 3130 | /* ADAT SyncCheck status */ |
3182 | snd_hdsp_adat_sync_check.name = "ADAT Lock Status"; | 3131 | snd_hdsp_adat_sync_check.name = "ADAT Lock Status"; |
3183 | snd_hdsp_adat_sync_check.index = 1; | 3132 | snd_hdsp_adat_sync_check.index = 1; |
3184 | if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) { | 3133 | if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) |
3185 | return err; | 3134 | return err; |
3186 | } | ||
3187 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { | 3135 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { |
3188 | for (idx = 1; idx < 3; ++idx) { | 3136 | for (idx = 1; idx < 3; ++idx) { |
3189 | snd_hdsp_adat_sync_check.index = idx+1; | 3137 | snd_hdsp_adat_sync_check.index = idx+1; |
3190 | if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) { | 3138 | if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) |
3191 | return err; | 3139 | return err; |
3192 | } | ||
3193 | } | 3140 | } |
3194 | } | 3141 | } |
3195 | 3142 | ||
3196 | /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ | 3143 | /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ |
3197 | if (hdsp->io_type == H9632) { | 3144 | if (hdsp->io_type == H9632) { |
3198 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { | 3145 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { |
3199 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp))) < 0) { | 3146 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp))) < 0) |
3200 | return err; | 3147 | return err; |
3201 | } | ||
3202 | } | 3148 | } |
3203 | } | 3149 | } |
3204 | 3150 | ||
3205 | /* AEB control for H96xx card */ | 3151 | /* AEB control for H96xx card */ |
3206 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) { | 3152 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) { |
3207 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp))) < 0) { | 3153 | if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp))) < 0) |
3208 | return err; | 3154 | return err; |
3209 | } | ||
3210 | } | 3155 | } |
3211 | 3156 | ||
3212 | return 0; | 3157 | return 0; |
@@ -3228,12 +3173,11 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
3228 | char *clock_source; | 3173 | char *clock_source; |
3229 | int x; | 3174 | int x; |
3230 | 3175 | ||
3231 | if (hdsp_check_for_iobox (hdsp)) { | 3176 | if (hdsp_check_for_iobox (hdsp)) |
3232 | snd_iprintf(buffer, "No I/O box connected.\nPlease connect one and upload firmware.\n"); | 3177 | snd_iprintf(buffer, "No I/O box connected.\nPlease connect one and upload firmware.\n"); |
3233 | return; | 3178 | return; |
3234 | } | ||
3235 | 3179 | ||
3236 | if (hdsp_check_for_firmware(hdsp)) { | 3180 | if (hdsp_check_for_firmware(hdsp, 0)) { |
3237 | if (hdsp->state & HDSP_FirmwareCached) { | 3181 | if (hdsp->state & HDSP_FirmwareCached) { |
3238 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | 3182 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { |
3239 | snd_iprintf(buffer, "Firmware loading from cache failed, please upload manually.\n"); | 3183 | snd_iprintf(buffer, "Firmware loading from cache failed, please upload manually.\n"); |
@@ -3314,11 +3258,10 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
3314 | } | 3258 | } |
3315 | snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); | 3259 | snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); |
3316 | 3260 | ||
3317 | if (hdsp_system_clock_mode(hdsp)) { | 3261 | if (hdsp_system_clock_mode(hdsp)) |
3318 | system_clock_mode = "Slave"; | 3262 | system_clock_mode = "Slave"; |
3319 | } else { | 3263 | else |
3320 | system_clock_mode = "Master"; | 3264 | system_clock_mode = "Master"; |
3321 | } | ||
3322 | 3265 | ||
3323 | switch (hdsp_pref_sync_ref (hdsp)) { | 3266 | switch (hdsp_pref_sync_ref (hdsp)) { |
3324 | case HDSP_SYNC_FROM_WORD: | 3267 | case HDSP_SYNC_FROM_WORD: |
@@ -3400,85 +3343,75 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
3400 | break; | 3343 | break; |
3401 | } | 3344 | } |
3402 | 3345 | ||
3403 | if (hdsp->control_register & HDSP_SPDIFOpticalOut) { | 3346 | if (hdsp->control_register & HDSP_SPDIFOpticalOut) |
3404 | snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); | 3347 | snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); |
3405 | } else { | 3348 | else |
3406 | snd_iprintf(buffer, "IEC958 output: Coaxial only\n"); | 3349 | snd_iprintf(buffer, "IEC958 output: Coaxial only\n"); |
3407 | } | ||
3408 | 3350 | ||
3409 | if (hdsp->control_register & HDSP_SPDIFProfessional) { | 3351 | if (hdsp->control_register & HDSP_SPDIFProfessional) |
3410 | snd_iprintf(buffer, "IEC958 quality: Professional\n"); | 3352 | snd_iprintf(buffer, "IEC958 quality: Professional\n"); |
3411 | } else { | 3353 | else |
3412 | snd_iprintf(buffer, "IEC958 quality: Consumer\n"); | 3354 | snd_iprintf(buffer, "IEC958 quality: Consumer\n"); |
3413 | } | ||
3414 | 3355 | ||
3415 | if (hdsp->control_register & HDSP_SPDIFEmphasis) { | 3356 | if (hdsp->control_register & HDSP_SPDIFEmphasis) |
3416 | snd_iprintf(buffer, "IEC958 emphasis: on\n"); | 3357 | snd_iprintf(buffer, "IEC958 emphasis: on\n"); |
3417 | } else { | 3358 | else |
3418 | snd_iprintf(buffer, "IEC958 emphasis: off\n"); | 3359 | snd_iprintf(buffer, "IEC958 emphasis: off\n"); |
3419 | } | ||
3420 | 3360 | ||
3421 | if (hdsp->control_register & HDSP_SPDIFNonAudio) { | 3361 | if (hdsp->control_register & HDSP_SPDIFNonAudio) |
3422 | snd_iprintf(buffer, "IEC958 NonAudio: on\n"); | 3362 | snd_iprintf(buffer, "IEC958 NonAudio: on\n"); |
3423 | } else { | 3363 | else |
3424 | snd_iprintf(buffer, "IEC958 NonAudio: off\n"); | 3364 | snd_iprintf(buffer, "IEC958 NonAudio: off\n"); |
3425 | } | 3365 | if ((x = hdsp_spdif_sample_rate (hdsp)) != 0) |
3426 | if ((x = hdsp_spdif_sample_rate (hdsp)) != 0) { | ||
3427 | snd_iprintf (buffer, "IEC958 sample rate: %d\n", x); | 3366 | snd_iprintf (buffer, "IEC958 sample rate: %d\n", x); |
3428 | } else { | 3367 | else |
3429 | snd_iprintf (buffer, "IEC958 sample rate: Error flag set\n"); | 3368 | snd_iprintf (buffer, "IEC958 sample rate: Error flag set\n"); |
3430 | } | ||
3431 | 3369 | ||
3432 | snd_iprintf(buffer, "\n"); | 3370 | snd_iprintf(buffer, "\n"); |
3433 | 3371 | ||
3434 | /* Sync Check */ | 3372 | /* Sync Check */ |
3435 | x = status & HDSP_Sync0; | 3373 | x = status & HDSP_Sync0; |
3436 | if (status & HDSP_Lock0) { | 3374 | if (status & HDSP_Lock0) |
3437 | snd_iprintf(buffer, "ADAT1: %s\n", x ? "Sync" : "Lock"); | 3375 | snd_iprintf(buffer, "ADAT1: %s\n", x ? "Sync" : "Lock"); |
3438 | } else { | 3376 | else |
3439 | snd_iprintf(buffer, "ADAT1: No Lock\n"); | 3377 | snd_iprintf(buffer, "ADAT1: No Lock\n"); |
3440 | } | ||
3441 | 3378 | ||
3442 | switch (hdsp->io_type) { | 3379 | switch (hdsp->io_type) { |
3443 | case Digiface: | 3380 | case Digiface: |
3444 | case H9652: | 3381 | case H9652: |
3445 | x = status & HDSP_Sync1; | 3382 | x = status & HDSP_Sync1; |
3446 | if (status & HDSP_Lock1) { | 3383 | if (status & HDSP_Lock1) |
3447 | snd_iprintf(buffer, "ADAT2: %s\n", x ? "Sync" : "Lock"); | 3384 | snd_iprintf(buffer, "ADAT2: %s\n", x ? "Sync" : "Lock"); |
3448 | } else { | 3385 | else |
3449 | snd_iprintf(buffer, "ADAT2: No Lock\n"); | 3386 | snd_iprintf(buffer, "ADAT2: No Lock\n"); |
3450 | } | ||
3451 | x = status & HDSP_Sync2; | 3387 | x = status & HDSP_Sync2; |
3452 | if (status & HDSP_Lock2) { | 3388 | if (status & HDSP_Lock2) |
3453 | snd_iprintf(buffer, "ADAT3: %s\n", x ? "Sync" : "Lock"); | 3389 | snd_iprintf(buffer, "ADAT3: %s\n", x ? "Sync" : "Lock"); |
3454 | } else { | 3390 | else |
3455 | snd_iprintf(buffer, "ADAT3: No Lock\n"); | 3391 | snd_iprintf(buffer, "ADAT3: No Lock\n"); |
3456 | } | 3392 | break; |
3457 | default: | 3393 | default: |
3458 | /* relax */ | 3394 | /* relax */ |
3459 | break; | 3395 | break; |
3460 | } | 3396 | } |
3461 | 3397 | ||
3462 | x = status & HDSP_SPDIFSync; | 3398 | x = status & HDSP_SPDIFSync; |
3463 | if (status & HDSP_SPDIFErrorFlag) { | 3399 | if (status & HDSP_SPDIFErrorFlag) |
3464 | snd_iprintf (buffer, "SPDIF: No Lock\n"); | 3400 | snd_iprintf (buffer, "SPDIF: No Lock\n"); |
3465 | } else { | 3401 | else |
3466 | snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); | 3402 | snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); |
3467 | } | ||
3468 | 3403 | ||
3469 | x = status2 & HDSP_wc_sync; | 3404 | x = status2 & HDSP_wc_sync; |
3470 | if (status2 & HDSP_wc_lock) { | 3405 | if (status2 & HDSP_wc_lock) |
3471 | snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); | 3406 | snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); |
3472 | } else { | 3407 | else |
3473 | snd_iprintf (buffer, "Word Clock: No Lock\n"); | 3408 | snd_iprintf (buffer, "Word Clock: No Lock\n"); |
3474 | } | ||
3475 | 3409 | ||
3476 | x = status & HDSP_TimecodeSync; | 3410 | x = status & HDSP_TimecodeSync; |
3477 | if (status & HDSP_TimecodeLock) { | 3411 | if (status & HDSP_TimecodeLock) |
3478 | snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); | 3412 | snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); |
3479 | } else { | 3413 | else |
3480 | snd_iprintf(buffer, "ADAT Sync: No Lock\n"); | 3414 | snd_iprintf(buffer, "ADAT Sync: No Lock\n"); |
3481 | } | ||
3482 | 3415 | ||
3483 | snd_iprintf(buffer, "\n"); | 3416 | snd_iprintf(buffer, "\n"); |
3484 | 3417 | ||
@@ -3527,11 +3460,10 @@ snd_hdsp_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer) | |||
3527 | 3460 | ||
3528 | snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); | 3461 | snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); |
3529 | 3462 | ||
3530 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) { | 3463 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) |
3531 | snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); | 3464 | snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); |
3532 | } else { | 3465 | else |
3533 | snd_iprintf(buffer, "AEB : off (ADAT1 external)\n"); | 3466 | snd_iprintf(buffer, "AEB : off (ADAT1 external)\n"); |
3534 | } | ||
3535 | snd_iprintf(buffer, "\n"); | 3467 | snd_iprintf(buffer, "\n"); |
3536 | } | 3468 | } |
3537 | 3469 | ||
@@ -3610,25 +3542,22 @@ static int snd_hdsp_set_defaults(hdsp_t *hdsp) | |||
3610 | #else | 3542 | #else |
3611 | hdsp->control2_register = 0; | 3543 | hdsp->control2_register = 0; |
3612 | #endif | 3544 | #endif |
3613 | if (hdsp->io_type == H9652) { | 3545 | if (hdsp->io_type == H9652) |
3614 | snd_hdsp_9652_enable_mixer (hdsp); | 3546 | snd_hdsp_9652_enable_mixer (hdsp); |
3615 | } else { | 3547 | else |
3616 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); | 3548 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); |
3617 | } | ||
3618 | 3549 | ||
3619 | hdsp_reset_hw_pointer(hdsp); | 3550 | hdsp_reset_hw_pointer(hdsp); |
3620 | hdsp_compute_period_size(hdsp); | 3551 | hdsp_compute_period_size(hdsp); |
3621 | 3552 | ||
3622 | /* silence everything */ | 3553 | /* silence everything */ |
3623 | 3554 | ||
3624 | for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) { | 3555 | for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) |
3625 | hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; | 3556 | hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; |
3626 | } | ||
3627 | 3557 | ||
3628 | for (i = 0; i < ((hdsp->io_type == H9652 || hdsp->io_type == H9632) ? 1352 : HDSP_MATRIX_MIXER_SIZE); ++i) { | 3558 | for (i = 0; i < ((hdsp->io_type == H9652 || hdsp->io_type == H9632) ? 1352 : HDSP_MATRIX_MIXER_SIZE); ++i) { |
3629 | if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) { | 3559 | if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) |
3630 | return -EIO; | 3560 | return -EIO; |
3631 | } | ||
3632 | } | 3561 | } |
3633 | 3562 | ||
3634 | /* H9632 specific defaults */ | 3563 | /* H9632 specific defaults */ |
@@ -3649,12 +3578,10 @@ static void hdsp_midi_tasklet(unsigned long arg) | |||
3649 | { | 3578 | { |
3650 | hdsp_t *hdsp = (hdsp_t *)arg; | 3579 | hdsp_t *hdsp = (hdsp_t *)arg; |
3651 | 3580 | ||
3652 | if (hdsp->midi[0].pending) { | 3581 | if (hdsp->midi[0].pending) |
3653 | snd_hdsp_midi_input_read (&hdsp->midi[0]); | 3582 | snd_hdsp_midi_input_read (&hdsp->midi[0]); |
3654 | } | 3583 | if (hdsp->midi[1].pending) |
3655 | if (hdsp->midi[1].pending) { | ||
3656 | snd_hdsp_midi_input_read (&hdsp->midi[1]); | 3584 | snd_hdsp_midi_input_read (&hdsp->midi[1]); |
3657 | } | ||
3658 | } | 3585 | } |
3659 | 3586 | ||
3660 | static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 3587 | static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
@@ -3674,9 +3601,8 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id, struct pt_regs *reg | |||
3674 | midi0 = status & HDSP_midi0IRQPending; | 3601 | midi0 = status & HDSP_midi0IRQPending; |
3675 | midi1 = status & HDSP_midi1IRQPending; | 3602 | midi1 = status & HDSP_midi1IRQPending; |
3676 | 3603 | ||
3677 | if (!audio && !midi0 && !midi1) { | 3604 | if (!audio && !midi0 && !midi1) |
3678 | return IRQ_NONE; | 3605 | return IRQ_NONE; |
3679 | } | ||
3680 | 3606 | ||
3681 | hdsp_write(hdsp, HDSP_interruptConfirmation, 0); | 3607 | hdsp_write(hdsp, HDSP_interruptConfirmation, 0); |
3682 | 3608 | ||
@@ -3684,13 +3610,11 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id, struct pt_regs *reg | |||
3684 | midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; | 3610 | midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; |
3685 | 3611 | ||
3686 | if (audio) { | 3612 | if (audio) { |
3687 | if (hdsp->capture_substream) { | 3613 | if (hdsp->capture_substream) |
3688 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); | 3614 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); |
3689 | } | ||
3690 | 3615 | ||
3691 | if (hdsp->playback_substream) { | 3616 | if (hdsp->playback_substream) |
3692 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | 3617 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); |
3693 | } | ||
3694 | } | 3618 | } |
3695 | 3619 | ||
3696 | if (midi0 && midi0status) { | 3620 | if (midi0 && midi0status) { |
@@ -3735,15 +3659,13 @@ static char *hdsp_channel_buffer_location(hdsp_t *hdsp, | |||
3735 | 3659 | ||
3736 | snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL); | 3660 | snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL); |
3737 | 3661 | ||
3738 | if ((mapped_channel = hdsp->channel_map[channel]) < 0) { | 3662 | if ((mapped_channel = hdsp->channel_map[channel]) < 0) |
3739 | return NULL; | 3663 | return NULL; |
3740 | } | ||
3741 | 3664 | ||
3742 | if (stream == SNDRV_PCM_STREAM_CAPTURE) { | 3665 | if (stream == SNDRV_PCM_STREAM_CAPTURE) |
3743 | return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); | 3666 | return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); |
3744 | } else { | 3667 | else |
3745 | return hdsp->playback_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); | 3668 | return hdsp->playback_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); |
3746 | } | ||
3747 | } | 3669 | } |
3748 | 3670 | ||
3749 | static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, | 3671 | static int snd_hdsp_playback_copy(snd_pcm_substream_t *substream, int channel, |
@@ -3824,20 +3746,11 @@ static int snd_hdsp_hw_params(snd_pcm_substream_t *substream, | |||
3824 | pid_t this_pid; | 3746 | pid_t this_pid; |
3825 | pid_t other_pid; | 3747 | pid_t other_pid; |
3826 | 3748 | ||
3827 | if (hdsp_check_for_iobox (hdsp)) { | 3749 | if (hdsp_check_for_iobox (hdsp)) |
3828 | return -EIO; | 3750 | return -EIO; |
3829 | } | ||
3830 | 3751 | ||
3831 | if (hdsp_check_for_firmware(hdsp)) { | 3752 | if (hdsp_check_for_firmware(hdsp, 1)) |
3832 | if (hdsp->state & HDSP_FirmwareCached) { | ||
3833 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | ||
3834 | snd_printk("Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
3835 | } | ||
3836 | } else { | ||
3837 | snd_printk("Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
3838 | } | ||
3839 | return -EIO; | 3753 | return -EIO; |
3840 | } | ||
3841 | 3754 | ||
3842 | spin_lock_irq(&hdsp->lock); | 3755 | spin_lock_irq(&hdsp->lock); |
3843 | 3756 | ||
@@ -3908,9 +3821,8 @@ static int snd_hdsp_channel_info(snd_pcm_substream_t *substream, | |||
3908 | 3821 | ||
3909 | snd_assert(info->channel < hdsp->max_channels, return -EINVAL); | 3822 | snd_assert(info->channel < hdsp->max_channels, return -EINVAL); |
3910 | 3823 | ||
3911 | if ((mapped_channel = hdsp->channel_map[info->channel]) < 0) { | 3824 | if ((mapped_channel = hdsp->channel_map[info->channel]) < 0) |
3912 | return -EINVAL; | 3825 | return -EINVAL; |
3913 | } | ||
3914 | 3826 | ||
3915 | info->offset = mapped_channel * HDSP_CHANNEL_BUFFER_BYTES; | 3827 | info->offset = mapped_channel * HDSP_CHANNEL_BUFFER_BYTES; |
3916 | info->first = 0; | 3828 | info->first = 0; |
@@ -3923,14 +3835,9 @@ static int snd_hdsp_ioctl(snd_pcm_substream_t *substream, | |||
3923 | { | 3835 | { |
3924 | switch (cmd) { | 3836 | switch (cmd) { |
3925 | case SNDRV_PCM_IOCTL1_RESET: | 3837 | case SNDRV_PCM_IOCTL1_RESET: |
3926 | { | ||
3927 | return snd_hdsp_reset(substream); | 3838 | return snd_hdsp_reset(substream); |
3928 | } | ||
3929 | case SNDRV_PCM_IOCTL1_CHANNEL_INFO: | 3839 | case SNDRV_PCM_IOCTL1_CHANNEL_INFO: |
3930 | { | 3840 | return snd_hdsp_channel_info(substream, arg); |
3931 | snd_pcm_channel_info_t *info = arg; | ||
3932 | return snd_hdsp_channel_info(substream, info); | ||
3933 | } | ||
3934 | default: | 3841 | default: |
3935 | break; | 3842 | break; |
3936 | } | 3843 | } |
@@ -3944,20 +3851,11 @@ static int snd_hdsp_trigger(snd_pcm_substream_t *substream, int cmd) | |||
3944 | snd_pcm_substream_t *other; | 3851 | snd_pcm_substream_t *other; |
3945 | int running; | 3852 | int running; |
3946 | 3853 | ||
3947 | if (hdsp_check_for_iobox (hdsp)) { | 3854 | if (hdsp_check_for_iobox (hdsp)) |
3948 | return -EIO; | 3855 | return -EIO; |
3949 | } | ||
3950 | 3856 | ||
3951 | if (hdsp_check_for_firmware(hdsp)) { | 3857 | if (hdsp_check_for_firmware(hdsp, 1)) |
3952 | if (hdsp->state & HDSP_FirmwareCached) { | ||
3953 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | ||
3954 | snd_printk("Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
3955 | } | ||
3956 | } else { | ||
3957 | snd_printk("Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
3958 | } | ||
3959 | return -EIO; | 3858 | return -EIO; |
3960 | } | ||
3961 | 3859 | ||
3962 | spin_lock(&hdsp->lock); | 3860 | spin_lock(&hdsp->lock); |
3963 | running = hdsp->running; | 3861 | running = hdsp->running; |
@@ -4022,20 +3920,11 @@ static int snd_hdsp_prepare(snd_pcm_substream_t *substream) | |||
4022 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); | 3920 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); |
4023 | int result = 0; | 3921 | int result = 0; |
4024 | 3922 | ||
4025 | if (hdsp_check_for_iobox (hdsp)) { | 3923 | if (hdsp_check_for_iobox (hdsp)) |
4026 | return -EIO; | 3924 | return -EIO; |
4027 | } | ||
4028 | 3925 | ||
4029 | if (hdsp_check_for_firmware(hdsp)) { | 3926 | if (hdsp_check_for_firmware(hdsp, 1)) |
4030 | if (hdsp->state & HDSP_FirmwareCached) { | ||
4031 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | ||
4032 | snd_printk("Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
4033 | } | ||
4034 | } else { | ||
4035 | snd_printk("Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
4036 | } | ||
4037 | return -EIO; | 3927 | return -EIO; |
4038 | } | ||
4039 | 3928 | ||
4040 | spin_lock_irq(&hdsp->lock); | 3929 | spin_lock_irq(&hdsp->lock); |
4041 | if (!hdsp->running) | 3930 | if (!hdsp->running) |
@@ -4285,20 +4174,11 @@ static int snd_hdsp_playback_open(snd_pcm_substream_t *substream) | |||
4285 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); | 4174 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); |
4286 | snd_pcm_runtime_t *runtime = substream->runtime; | 4175 | snd_pcm_runtime_t *runtime = substream->runtime; |
4287 | 4176 | ||
4288 | if (hdsp_check_for_iobox (hdsp)) { | 4177 | if (hdsp_check_for_iobox (hdsp)) |
4289 | return -EIO; | 4178 | return -EIO; |
4290 | } | ||
4291 | 4179 | ||
4292 | if (hdsp_check_for_firmware(hdsp)) { | 4180 | if (hdsp_check_for_firmware(hdsp, 1)) |
4293 | if (hdsp->state & HDSP_FirmwareCached) { | ||
4294 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | ||
4295 | snd_printk("Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
4296 | } | ||
4297 | } else { | ||
4298 | snd_printk("Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
4299 | } | ||
4300 | return -EIO; | 4181 | return -EIO; |
4301 | } | ||
4302 | 4182 | ||
4303 | spin_lock_irq(&hdsp->lock); | 4183 | spin_lock_irq(&hdsp->lock); |
4304 | 4184 | ||
@@ -4367,20 +4247,11 @@ static int snd_hdsp_capture_open(snd_pcm_substream_t *substream) | |||
4367 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); | 4247 | hdsp_t *hdsp = snd_pcm_substream_chip(substream); |
4368 | snd_pcm_runtime_t *runtime = substream->runtime; | 4248 | snd_pcm_runtime_t *runtime = substream->runtime; |
4369 | 4249 | ||
4370 | if (hdsp_check_for_iobox (hdsp)) { | 4250 | if (hdsp_check_for_iobox (hdsp)) |
4371 | return -EIO; | 4251 | return -EIO; |
4372 | } | ||
4373 | 4252 | ||
4374 | if (hdsp_check_for_firmware(hdsp)) { | 4253 | if (hdsp_check_for_firmware(hdsp, 1)) |
4375 | if (hdsp->state & HDSP_FirmwareCached) { | ||
4376 | if (snd_hdsp_load_firmware_from_cache(hdsp) != 0) { | ||
4377 | snd_printk("Hammerfall-DSP: Firmware loading from cache failed, please upload manually.\n"); | ||
4378 | } | ||
4379 | } else { | ||
4380 | snd_printk("Hammerfall-DSP: No firmware loaded nor cached, please upload firmware.\n"); | ||
4381 | } | ||
4382 | return -EIO; | 4254 | return -EIO; |
4383 | } | ||
4384 | 4255 | ||
4385 | spin_lock_irq(&hdsp->lock); | 4256 | spin_lock_irq(&hdsp->lock); |
4386 | 4257 | ||
@@ -4589,19 +4460,17 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int | |||
4589 | int i; | 4460 | int i; |
4590 | 4461 | ||
4591 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { | 4462 | if (!(hdsp->state & HDSP_FirmwareLoaded)) { |
4592 | snd_printk("Hammerfall-DSP: Firmware needs to be uploaded to the card.\n"); | 4463 | snd_printk(KERN_ERR "Hammerfall-DSP: Firmware needs to be uploaded to the card.\n"); |
4593 | return -EINVAL; | 4464 | return -EINVAL; |
4594 | } | 4465 | } |
4595 | spin_lock_irqsave(&hdsp->lock, flags); | 4466 | spin_lock_irqsave(&hdsp->lock, flags); |
4596 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); | 4467 | info.pref_sync_ref = (unsigned char)hdsp_pref_sync_ref(hdsp); |
4597 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); | 4468 | info.wordclock_sync_check = (unsigned char)hdsp_wc_sync_check(hdsp); |
4598 | if (hdsp->io_type != H9632) { | 4469 | if (hdsp->io_type != H9632) |
4599 | info.adatsync_sync_check = (unsigned char)hdsp_adatsync_sync_check(hdsp); | 4470 | info.adatsync_sync_check = (unsigned char)hdsp_adatsync_sync_check(hdsp); |
4600 | } | ||
4601 | info.spdif_sync_check = (unsigned char)hdsp_spdif_sync_check(hdsp); | 4471 | info.spdif_sync_check = (unsigned char)hdsp_spdif_sync_check(hdsp); |
4602 | for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != H9632) ? 3 : 1); ++i) { | 4472 | for (i = 0; i < ((hdsp->io_type != Multiface && hdsp->io_type != H9632) ? 3 : 1); ++i) |
4603 | info.adat_sync_check[i] = (unsigned char)hdsp_adat_sync_check(hdsp, i); | 4473 | info.adat_sync_check[i] = (unsigned char)hdsp_adat_sync_check(hdsp, i); |
4604 | } | ||
4605 | info.spdif_in = (unsigned char)hdsp_spdif_in(hdsp); | 4474 | info.spdif_in = (unsigned char)hdsp_spdif_in(hdsp); |
4606 | info.spdif_out = (unsigned char)hdsp_spdif_out(hdsp); | 4475 | info.spdif_out = (unsigned char)hdsp_spdif_out(hdsp); |
4607 | info.spdif_professional = (unsigned char)hdsp_spdif_professional(hdsp); | 4476 | info.spdif_professional = (unsigned char)hdsp_spdif_professional(hdsp); |
@@ -4621,9 +4490,8 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int | |||
4621 | info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); | 4490 | info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); |
4622 | 4491 | ||
4623 | } | 4492 | } |
4624 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) { | 4493 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) |
4625 | info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); | 4494 | info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); |
4626 | } | ||
4627 | spin_unlock_irqrestore(&hdsp->lock, flags); | 4495 | spin_unlock_irqrestore(&hdsp->lock, flags); |
4628 | if (copy_to_user(argp, &info, sizeof(info))) | 4496 | if (copy_to_user(argp, &info, sizeof(info))) |
4629 | return -EFAULT; | 4497 | return -EFAULT; |
@@ -4645,15 +4513,13 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int | |||
4645 | 4513 | ||
4646 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; | 4514 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; |
4647 | if (hdsp->io_type == Undefined) { | 4515 | if (hdsp->io_type == Undefined) { |
4648 | if ((err = hdsp_get_iobox_version(hdsp)) < 0) { | 4516 | if ((err = hdsp_get_iobox_version(hdsp)) < 0) |
4649 | return err; | 4517 | return err; |
4650 | } | ||
4651 | } | 4518 | } |
4652 | hdsp_version.io_type = hdsp->io_type; | 4519 | hdsp_version.io_type = hdsp->io_type; |
4653 | hdsp_version.firmware_rev = hdsp->firmware_rev; | 4520 | hdsp_version.firmware_rev = hdsp->firmware_rev; |
4654 | if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))) { | 4521 | if ((err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version)))) |
4655 | return -EFAULT; | 4522 | return -EFAULT; |
4656 | } | ||
4657 | break; | 4523 | break; |
4658 | } | 4524 | } |
4659 | case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: { | 4525 | case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: { |
@@ -4668,38 +4534,33 @@ static int snd_hdsp_hwdep_ioctl(snd_hwdep_t *hw, struct file *file, unsigned int | |||
4668 | if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded)) | 4534 | if (hdsp->state & (HDSP_FirmwareCached | HDSP_FirmwareLoaded)) |
4669 | return -EBUSY; | 4535 | return -EBUSY; |
4670 | 4536 | ||
4671 | snd_printk("Hammerfall-DSP: initializing firmware upload\n"); | 4537 | snd_printk(KERN_INFO "Hammerfall-DSP: initializing firmware upload\n"); |
4672 | firmware = (hdsp_firmware_t __user *)argp; | 4538 | firmware = (hdsp_firmware_t __user *)argp; |
4673 | 4539 | ||
4674 | if (get_user(firmware_data, &firmware->firmware_data)) { | 4540 | if (get_user(firmware_data, &firmware->firmware_data)) |
4675 | return -EFAULT; | 4541 | return -EFAULT; |
4676 | } | ||
4677 | 4542 | ||
4678 | if (hdsp_check_for_iobox (hdsp)) { | 4543 | if (hdsp_check_for_iobox (hdsp)) |
4679 | return -EIO; | 4544 | return -EIO; |
4680 | } | ||
4681 | 4545 | ||
4682 | if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) { | 4546 | if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) |
4683 | return -EFAULT; | 4547 | return -EFAULT; |
4684 | } | ||
4685 | 4548 | ||
4686 | hdsp->state |= HDSP_FirmwareCached; | 4549 | hdsp->state |= HDSP_FirmwareCached; |
4687 | 4550 | ||
4688 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) { | 4551 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) |
4689 | return err; | 4552 | return err; |
4690 | } | ||
4691 | 4553 | ||
4692 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4554 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4693 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) { | 4555 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) |
4694 | return err; | 4556 | return err; |
4695 | } | ||
4696 | 4557 | ||
4697 | snd_hdsp_initialize_channels(hdsp); | 4558 | snd_hdsp_initialize_channels(hdsp); |
4698 | snd_hdsp_initialize_midi_flush(hdsp); | 4559 | snd_hdsp_initialize_midi_flush(hdsp); |
4699 | 4560 | ||
4700 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { | 4561 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { |
4701 | snd_printk("Hammerfall-DSP: error creating alsa devices\n"); | 4562 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); |
4702 | return err; | 4563 | return err; |
4703 | } | 4564 | } |
4704 | } | 4565 | } |
4705 | break; | 4566 | break; |
@@ -4790,7 +4651,7 @@ static int snd_hdsp_enable_io (hdsp_t *hdsp) | |||
4790 | int i; | 4651 | int i; |
4791 | 4652 | ||
4792 | if (hdsp_fifo_wait (hdsp, 0, 100)) { | 4653 | if (hdsp_fifo_wait (hdsp, 0, 100)) { |
4793 | snd_printk("Hammerfall-DSP: enable_io fifo_wait failed\n"); | 4654 | snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); |
4794 | return -EIO; | 4655 | return -EIO; |
4795 | } | 4656 | } |
4796 | 4657 | ||
@@ -4856,25 +4717,25 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp) | |||
4856 | int err; | 4717 | int err; |
4857 | 4718 | ||
4858 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { | 4719 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { |
4859 | snd_printk("Hammerfall-DSP: Error creating pcm interface\n"); | 4720 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); |
4860 | return err; | 4721 | return err; |
4861 | } | 4722 | } |
4862 | 4723 | ||
4863 | 4724 | ||
4864 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { | 4725 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { |
4865 | snd_printk("Hammerfall-DSP: Error creating first midi interface\n"); | 4726 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); |
4866 | return err; | 4727 | return err; |
4867 | } | 4728 | } |
4868 | 4729 | ||
4869 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { | 4730 | if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { |
4870 | if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { | 4731 | if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { |
4871 | snd_printk("Hammerfall-DSP: Error creating second midi interface\n"); | 4732 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating second midi interface\n"); |
4872 | return err; | 4733 | return err; |
4873 | } | 4734 | } |
4874 | } | 4735 | } |
4875 | 4736 | ||
4876 | if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { | 4737 | if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { |
4877 | snd_printk("Hammerfall-DSP: Error creating ctl interface\n"); | 4738 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating ctl interface\n"); |
4878 | return err; | 4739 | return err; |
4879 | } | 4740 | } |
4880 | 4741 | ||
@@ -4887,7 +4748,7 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp) | |||
4887 | hdsp->playback_substream = NULL; | 4748 | hdsp->playback_substream = NULL; |
4888 | 4749 | ||
4889 | if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { | 4750 | if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { |
4890 | snd_printk("Hammerfall-DSP: Error setting default values\n"); | 4751 | snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); |
4891 | return err; | 4752 | return err; |
4892 | } | 4753 | } |
4893 | 4754 | ||
@@ -4897,7 +4758,7 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp) | |||
4897 | hdsp->port, hdsp->irq); | 4758 | hdsp->port, hdsp->irq); |
4898 | 4759 | ||
4899 | if ((err = snd_card_register(card)) < 0) { | 4760 | if ((err = snd_card_register(card)) < 0) { |
4900 | snd_printk("Hammerfall-DSP: error registering card\n"); | 4761 | snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); |
4901 | return err; | 4762 | return err; |
4902 | } | 4763 | } |
4903 | hdsp->state |= HDSP_InitializationComplete; | 4764 | hdsp->state |= HDSP_InitializationComplete; |
@@ -4963,18 +4824,17 @@ static int __devinit hdsp_request_fw_loader(hdsp_t *hdsp) | |||
4963 | return err; | 4824 | return err; |
4964 | 4825 | ||
4965 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4826 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4966 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) { | 4827 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) |
4967 | return err; | 4828 | return err; |
4968 | } | ||
4969 | 4829 | ||
4970 | if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { | 4830 | if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { |
4971 | snd_printk("Hammerfall-DSP: error creating hwdep device\n"); | 4831 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating hwdep device\n"); |
4972 | return err; | 4832 | return err; |
4973 | } | 4833 | } |
4974 | snd_hdsp_initialize_channels(hdsp); | 4834 | snd_hdsp_initialize_channels(hdsp); |
4975 | snd_hdsp_initialize_midi_flush(hdsp); | 4835 | snd_hdsp_initialize_midi_flush(hdsp); |
4976 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { | 4836 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { |
4977 | snd_printk("Hammerfall-DSP: error creating alsa devices\n"); | 4837 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); |
4978 | return err; | 4838 | return err; |
4979 | } | 4839 | } |
4980 | } | 4840 | } |
@@ -5029,11 +4889,11 @@ static int __devinit snd_hdsp_create(snd_card_t *card, | |||
5029 | strcpy(card->driver, "H-DSP"); | 4889 | strcpy(card->driver, "H-DSP"); |
5030 | strcpy(card->mixername, "Xilinx FPGA"); | 4890 | strcpy(card->mixername, "Xilinx FPGA"); |
5031 | 4891 | ||
5032 | if (hdsp->firmware_rev < 0xa) { | 4892 | if (hdsp->firmware_rev < 0xa) |
5033 | return -ENODEV; | 4893 | return -ENODEV; |
5034 | } else if (hdsp->firmware_rev < 0x64) { | 4894 | else if (hdsp->firmware_rev < 0x64) |
5035 | hdsp->card_name = "RME Hammerfall DSP"; | 4895 | hdsp->card_name = "RME Hammerfall DSP"; |
5036 | } else if (hdsp->firmware_rev < 0x96) { | 4896 | else if (hdsp->firmware_rev < 0x96) { |
5037 | hdsp->card_name = "RME HDSP 9652"; | 4897 | hdsp->card_name = "RME HDSP 9652"; |
5038 | is_9652 = 1; | 4898 | is_9652 = 1; |
5039 | } else { | 4899 | } else { |
@@ -5042,9 +4902,8 @@ static int __devinit snd_hdsp_create(snd_card_t *card, | |||
5042 | is_9632 = 1; | 4902 | is_9632 = 1; |
5043 | } | 4903 | } |
5044 | 4904 | ||
5045 | if ((err = pci_enable_device(pci)) < 0) { | 4905 | if ((err = pci_enable_device(pci)) < 0) |
5046 | return err; | 4906 | return err; |
5047 | } | ||
5048 | 4907 | ||
5049 | pci_set_master(hdsp->pci); | 4908 | pci_set_master(hdsp->pci); |
5050 | 4909 | ||
@@ -5052,12 +4911,12 @@ static int __devinit snd_hdsp_create(snd_card_t *card, | |||
5052 | return err; | 4911 | return err; |
5053 | hdsp->port = pci_resource_start(pci, 0); | 4912 | hdsp->port = pci_resource_start(pci, 0); |
5054 | if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) { | 4913 | if ((hdsp->iobase = ioremap_nocache(hdsp->port, HDSP_IO_EXTENT)) == NULL) { |
5055 | snd_printk("Hammerfall-DSP: unable to remap region 0x%lx-0x%lx\n", hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); | 4914 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to remap region 0x%lx-0x%lx\n", hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); |
5056 | return -EBUSY; | 4915 | return -EBUSY; |
5057 | } | 4916 | } |
5058 | 4917 | ||
5059 | if (request_irq(pci->irq, snd_hdsp_interrupt, SA_INTERRUPT|SA_SHIRQ, "hdsp", (void *)hdsp)) { | 4918 | if (request_irq(pci->irq, snd_hdsp_interrupt, SA_INTERRUPT|SA_SHIRQ, "hdsp", (void *)hdsp)) { |
5060 | snd_printk("Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); | 4919 | snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); |
5061 | return -EBUSY; | 4920 | return -EBUSY; |
5062 | } | 4921 | } |
5063 | 4922 | ||
@@ -5065,71 +4924,58 @@ static int __devinit snd_hdsp_create(snd_card_t *card, | |||
5065 | hdsp->precise_ptr = 1; | 4924 | hdsp->precise_ptr = 1; |
5066 | hdsp->use_midi_tasklet = 1; | 4925 | hdsp->use_midi_tasklet = 1; |
5067 | 4926 | ||
5068 | if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) { | 4927 | if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) |
5069 | return err; | 4928 | return err; |
5070 | } | ||
5071 | 4929 | ||
5072 | if (!is_9652 && !is_9632) { | 4930 | if (!is_9652 && !is_9632) { |
5073 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 4931 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ |
5074 | if ((1000 / HZ) < 2000) { | 4932 | ssleep(2); |
5075 | ssleep(2); | ||
5076 | } else { | ||
5077 | mdelay(2000); | ||
5078 | } | ||
5079 | 4933 | ||
5080 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 4934 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
5081 | #ifdef HDSP_FW_LOADER | 4935 | #ifdef HDSP_FW_LOADER |
5082 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) { | 4936 | if ((err = hdsp_request_fw_loader(hdsp)) < 0) |
5083 | /* we don't fail as this can happen | 4937 | /* we don't fail as this can happen |
5084 | if userspace is not ready for | 4938 | if userspace is not ready for |
5085 | firmware upload | 4939 | firmware upload |
5086 | */ | 4940 | */ |
5087 | snd_printk("Hammerfall-DSP: couldn't get firmware from userspace. try using hdsploader\n"); | 4941 | snd_printk(KERN_ERR "Hammerfall-DSP: couldn't get firmware from userspace. try using hdsploader\n"); |
5088 | } else { | 4942 | else |
5089 | /* init is complete, we return */ | 4943 | /* init is complete, we return */ |
5090 | return 0; | 4944 | return 0; |
5091 | } | ||
5092 | #endif | 4945 | #endif |
5093 | /* no iobox connected, we defer initialization */ | 4946 | /* no iobox connected, we defer initialization */ |
5094 | snd_printk("Hammerfall-DSP: card initialization pending : waiting for firmware\n"); | 4947 | snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); |
5095 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { | 4948 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5096 | return err; | 4949 | return err; |
5097 | } | ||
5098 | return 0; | 4950 | return 0; |
5099 | } else { | 4951 | } else { |
5100 | snd_printk("Hammerfall-DSP: Firmware already present, initializing card.\n"); | 4952 | snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); |
5101 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { | 4953 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) |
5102 | hdsp->io_type = Multiface; | 4954 | hdsp->io_type = Multiface; |
5103 | } else { | 4955 | else |
5104 | hdsp->io_type = Digiface; | 4956 | hdsp->io_type = Digiface; |
5105 | } | ||
5106 | } | 4957 | } |
5107 | } | 4958 | } |
5108 | 4959 | ||
5109 | if ((err = snd_hdsp_enable_io(hdsp)) != 0) { | 4960 | if ((err = snd_hdsp_enable_io(hdsp)) != 0) |
5110 | return err; | 4961 | return err; |
5111 | } | ||
5112 | 4962 | ||
5113 | if (is_9652) { | 4963 | if (is_9652) |
5114 | hdsp->io_type = H9652; | 4964 | hdsp->io_type = H9652; |
5115 | } | ||
5116 | 4965 | ||
5117 | if (is_9632) { | 4966 | if (is_9632) |
5118 | hdsp->io_type = H9632; | 4967 | hdsp->io_type = H9632; |
5119 | } | ||
5120 | 4968 | ||
5121 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { | 4969 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5122 | return err; | 4970 | return err; |
5123 | } | ||
5124 | 4971 | ||
5125 | snd_hdsp_initialize_channels(hdsp); | 4972 | snd_hdsp_initialize_channels(hdsp); |
5126 | snd_hdsp_initialize_midi_flush(hdsp); | 4973 | snd_hdsp_initialize_midi_flush(hdsp); |
5127 | 4974 | ||
5128 | hdsp->state |= HDSP_FirmwareLoaded; | 4975 | hdsp->state |= HDSP_FirmwareLoaded; |
5129 | 4976 | ||
5130 | if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) { | 4977 | if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) |
5131 | return err; | 4978 | return err; |
5132 | } | ||
5133 | 4979 | ||
5134 | return 0; | 4980 | return 0; |
5135 | } | 4981 | } |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index fc3f3283ff37..60a1141f1327 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -3563,8 +3563,7 @@ static int snd_hdspm_free(hdspm_t * hdspm) | |||
3563 | free_irq(hdspm->irq, (void *) hdspm); | 3563 | free_irq(hdspm->irq, (void *) hdspm); |
3564 | 3564 | ||
3565 | 3565 | ||
3566 | if (hdspm->mixer) | 3566 | kfree(hdspm->mixer); |
3567 | kfree(hdspm->mixer); | ||
3568 | 3567 | ||
3569 | if (hdspm->iobase) | 3568 | if (hdspm->iobase) |
3570 | iounmap(hdspm->iobase); | 3569 | iounmap(hdspm->iobase); |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index b600f45e1834..59fcef9b6b81 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -779,7 +779,7 @@ static inline int rme9652_spdif_sample_rate(rme9652_t *s) | |||
779 | break; | 779 | break; |
780 | 780 | ||
781 | default: | 781 | default: |
782 | snd_printk("%s: unknown S/PDIF input rate (bits = 0x%x)\n", | 782 | snd_printk(KERN_ERR "%s: unknown S/PDIF input rate (bits = 0x%x)\n", |
783 | s->card_name, rate_bits); | 783 | s->card_name, rate_bits); |
784 | return 0; | 784 | return 0; |
785 | break; | 785 | break; |
@@ -2496,12 +2496,12 @@ static int __devinit snd_rme9652_create(snd_card_t *card, | |||
2496 | rme9652->port = pci_resource_start(pci, 0); | 2496 | rme9652->port = pci_resource_start(pci, 0); |
2497 | rme9652->iobase = ioremap_nocache(rme9652->port, RME9652_IO_EXTENT); | 2497 | rme9652->iobase = ioremap_nocache(rme9652->port, RME9652_IO_EXTENT); |
2498 | if (rme9652->iobase == NULL) { | 2498 | if (rme9652->iobase == NULL) { |
2499 | snd_printk("unable to remap region 0x%lx-0x%lx\n", rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1); | 2499 | snd_printk(KERN_ERR "unable to remap region 0x%lx-0x%lx\n", rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1); |
2500 | return -EBUSY; | 2500 | return -EBUSY; |
2501 | } | 2501 | } |
2502 | 2502 | ||
2503 | if (request_irq(pci->irq, snd_rme9652_interrupt, SA_INTERRUPT|SA_SHIRQ, "rme9652", (void *)rme9652)) { | 2503 | if (request_irq(pci->irq, snd_rme9652_interrupt, SA_INTERRUPT|SA_SHIRQ, "rme9652", (void *)rme9652)) { |
2504 | snd_printk("unable to request IRQ %d\n", pci->irq); | 2504 | snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq); |
2505 | return -EBUSY; | 2505 | return -EBUSY; |
2506 | } | 2506 | } |
2507 | rme9652->irq = pci->irq; | 2507 | rme9652->irq = pci->irq; |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 1f6c2bfd43fd..9a35474aad05 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -591,7 +591,7 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg | |||
591 | return IRQ_NONE; | 591 | return IRQ_NONE; |
592 | if (status == 0xff) { /* failure */ | 592 | if (status == 0xff) { /* failure */ |
593 | outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK)); | 593 | outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK)); |
594 | snd_printk("IRQ failure - interrupts disabled!!\n"); | 594 | snd_printk(KERN_ERR "IRQ failure - interrupts disabled!!\n"); |
595 | return IRQ_HANDLED; | 595 | return IRQ_HANDLED; |
596 | } | 596 | } |
597 | if (sonic->pcm) { | 597 | if (sonic->pcm) { |
@@ -1205,14 +1205,8 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic) | |||
1205 | pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); | 1205 | pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); |
1206 | if (sonic->irq >= 0) | 1206 | if (sonic->irq >= 0) |
1207 | free_irq(sonic->irq, (void *)sonic); | 1207 | free_irq(sonic->irq, (void *)sonic); |
1208 | if (sonic->res_dmaa) { | 1208 | release_and_free_resource(sonic->res_dmaa); |
1209 | release_resource(sonic->res_dmaa); | 1209 | release_and_free_resource(sonic->res_dmac); |
1210 | kfree_nocheck(sonic->res_dmaa); | ||
1211 | } | ||
1212 | if (sonic->res_dmac) { | ||
1213 | release_resource(sonic->res_dmac); | ||
1214 | kfree_nocheck(sonic->res_dmac); | ||
1215 | } | ||
1216 | pci_release_regions(sonic->pci); | 1210 | pci_release_regions(sonic->pci); |
1217 | pci_disable_device(sonic->pci); | 1211 | pci_disable_device(sonic->pci); |
1218 | kfree(sonic); | 1212 | kfree(sonic); |
@@ -1245,7 +1239,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card, | |||
1245 | /* check, if we can restrict PCI DMA transfers to 24 bits */ | 1239 | /* check, if we can restrict PCI DMA transfers to 24 bits */ |
1246 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || | 1240 | if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || |
1247 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { | 1241 | pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { |
1248 | snd_printk("architecture does not support 24bit PCI busmaster DMA\n"); | 1242 | snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); |
1249 | pci_disable_device(pci); | 1243 | pci_disable_device(pci); |
1250 | return -ENXIO; | 1244 | return -ENXIO; |
1251 | } | 1245 | } |
@@ -1273,7 +1267,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card, | |||
1273 | sonic->game_port = pci_resource_start(pci, 4); | 1267 | sonic->game_port = pci_resource_start(pci, 4); |
1274 | 1268 | ||
1275 | if (request_irq(pci->irq, snd_sonicvibes_interrupt, SA_INTERRUPT|SA_SHIRQ, "S3 SonicVibes", (void *)sonic)) { | 1269 | if (request_irq(pci->irq, snd_sonicvibes_interrupt, SA_INTERRUPT|SA_SHIRQ, "S3 SonicVibes", (void *)sonic)) { |
1276 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1270 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1277 | snd_sonicvibes_free(sonic); | 1271 | snd_sonicvibes_free(sonic); |
1278 | return -EBUSY; | 1272 | return -EBUSY; |
1279 | } | 1273 | } |
@@ -1287,24 +1281,24 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card, | |||
1287 | if (!dmaa) { | 1281 | if (!dmaa) { |
1288 | dmaa = dmaio; | 1282 | dmaa = dmaio; |
1289 | dmaio += 0x10; | 1283 | dmaio += 0x10; |
1290 | snd_printk("BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa); | 1284 | snd_printk(KERN_INFO "BIOS did not allocate DDMA channel A i/o, allocated at 0x%x\n", dmaa); |
1291 | } | 1285 | } |
1292 | if (!dmac) { | 1286 | if (!dmac) { |
1293 | dmac = dmaio; | 1287 | dmac = dmaio; |
1294 | dmaio += 0x10; | 1288 | dmaio += 0x10; |
1295 | snd_printk("BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac); | 1289 | snd_printk(KERN_INFO "BIOS did not allocate DDMA channel C i/o, allocated at 0x%x\n", dmac); |
1296 | } | 1290 | } |
1297 | pci_write_config_dword(pci, 0x40, dmaa); | 1291 | pci_write_config_dword(pci, 0x40, dmaa); |
1298 | pci_write_config_dword(pci, 0x48, dmac); | 1292 | pci_write_config_dword(pci, 0x48, dmac); |
1299 | 1293 | ||
1300 | if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) { | 1294 | if ((sonic->res_dmaa = request_region(dmaa, 0x10, "S3 SonicVibes DDMA-A")) == NULL) { |
1301 | snd_sonicvibes_free(sonic); | 1295 | snd_sonicvibes_free(sonic); |
1302 | snd_printk("unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1); | 1296 | snd_printk(KERN_ERR "unable to grab DDMA-A port at 0x%x-0x%x\n", dmaa, dmaa + 0x10 - 1); |
1303 | return -EBUSY; | 1297 | return -EBUSY; |
1304 | } | 1298 | } |
1305 | if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) { | 1299 | if ((sonic->res_dmac = request_region(dmac, 0x10, "S3 SonicVibes DDMA-C")) == NULL) { |
1306 | snd_sonicvibes_free(sonic); | 1300 | snd_sonicvibes_free(sonic); |
1307 | snd_printk("unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1); | 1301 | snd_printk(KERN_ERR "unable to grab DDMA-C port at 0x%x-0x%x\n", dmac, dmac + 0x10 - 1); |
1308 | return -EBUSY; | 1302 | return -EBUSY; |
1309 | } | 1303 | } |
1310 | 1304 | ||
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index 777da9a7298b..b9b93c7faafd 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -153,7 +153,7 @@ static unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | if (count == 0 && !trident->ac97_detect) { | 155 | if (count == 0 && !trident->ac97_detect) { |
156 | snd_printk("ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n", reg, data); | 156 | snd_printk(KERN_ERR "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n", reg, data); |
157 | data = 0; | 157 | data = 0; |
158 | } | 158 | } |
159 | 159 | ||
@@ -2893,7 +2893,8 @@ static void snd_trident_notify_pcm_change1(snd_card_t * card, snd_kcontrol_t *kc | |||
2893 | { | 2893 | { |
2894 | snd_ctl_elem_id_t id; | 2894 | snd_ctl_elem_id_t id; |
2895 | 2895 | ||
2896 | snd_runtime_check(kctl != NULL, return); | 2896 | if (! kctl) |
2897 | return; | ||
2897 | if (activate) | 2898 | if (activate) |
2898 | kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | 2899 | kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; |
2899 | else | 2900 | else |
@@ -2989,13 +2990,13 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device | |||
2989 | _ac97.num = 1; | 2990 | _ac97.num = 1; |
2990 | err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec); | 2991 | err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec); |
2991 | if (err < 0) | 2992 | if (err < 0) |
2992 | snd_printk("SI7018: the secondary codec - invalid access\n"); | 2993 | snd_printk(KERN_ERR "SI7018: the secondary codec - invalid access\n"); |
2993 | #if 0 // only for my testing purpose --jk | 2994 | #if 0 // only for my testing purpose --jk |
2994 | { | 2995 | { |
2995 | ac97_t *mc97; | 2996 | ac97_t *mc97; |
2996 | err = snd_ac97_modem(trident->card, &_ac97, &mc97); | 2997 | err = snd_ac97_modem(trident->card, &_ac97, &mc97); |
2997 | if (err < 0) | 2998 | if (err < 0) |
2998 | snd_printk("snd_ac97_modem returned error %i\n", err); | 2999 | snd_printk(KERN_ERR "snd_ac97_modem returned error %i\n", err); |
2999 | } | 3000 | } |
3000 | #endif | 3001 | #endif |
3001 | } | 3002 | } |
@@ -3206,8 +3207,7 @@ static inline void snd_trident_free_gameport(trident_t *chip) { } | |||
3206 | */ | 3207 | */ |
3207 | static inline void do_delay(trident_t *chip) | 3208 | static inline void do_delay(trident_t *chip) |
3208 | { | 3209 | { |
3209 | set_current_state(TASK_UNINTERRUPTIBLE); | 3210 | schedule_timeout_uninterruptible(1); |
3210 | schedule_timeout(1); | ||
3211 | } | 3211 | } |
3212 | 3212 | ||
3213 | /* | 3213 | /* |
@@ -3243,7 +3243,7 @@ static int snd_trident_sis_reset(trident_t *trident) | |||
3243 | goto __si7018_ok; | 3243 | goto __si7018_ok; |
3244 | do_delay(trident); | 3244 | do_delay(trident); |
3245 | } while (time_after_eq(end_time, jiffies)); | 3245 | } while (time_after_eq(end_time, jiffies)); |
3246 | snd_printk("AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL))); | 3246 | snd_printk(KERN_ERR "AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL))); |
3247 | if (r-- > 0) { | 3247 | if (r-- > 0) { |
3248 | end_time = jiffies + HZ; | 3248 | end_time = jiffies + HZ; |
3249 | do { | 3249 | do { |
@@ -3541,7 +3541,7 @@ int __devinit snd_trident_create(snd_card_t * card, | |||
3541 | /* check, if we can restrict PCI DMA transfers to 30 bits */ | 3541 | /* check, if we can restrict PCI DMA transfers to 30 bits */ |
3542 | if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || | 3542 | if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || |
3543 | pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { | 3543 | pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { |
3544 | snd_printk("architecture does not support 30bit PCI busmaster DMA\n"); | 3544 | snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); |
3545 | pci_disable_device(pci); | 3545 | pci_disable_device(pci); |
3546 | return -ENXIO; | 3546 | return -ENXIO; |
3547 | } | 3547 | } |
@@ -3578,7 +3578,7 @@ int __devinit snd_trident_create(snd_card_t * card, | |||
3578 | trident->port = pci_resource_start(pci, 0); | 3578 | trident->port = pci_resource_start(pci, 0); |
3579 | 3579 | ||
3580 | if (request_irq(pci->irq, snd_trident_interrupt, SA_INTERRUPT|SA_SHIRQ, "Trident Audio", (void *) trident)) { | 3580 | if (request_irq(pci->irq, snd_trident_interrupt, SA_INTERRUPT|SA_SHIRQ, "Trident Audio", (void *) trident)) { |
3581 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 3581 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
3582 | snd_trident_free(trident); | 3582 | snd_trident_free(trident); |
3583 | return -EBUSY; | 3583 | return -EBUSY; |
3584 | } | 3584 | } |
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c index 333d3790692a..f3e6c546af74 100644 --- a/sound/pci/trident/trident_memory.c +++ b/sound/pci/trident/trident_memory.c | |||
@@ -170,11 +170,11 @@ __found_pages: | |||
170 | static int is_valid_page(unsigned long ptr) | 170 | static int is_valid_page(unsigned long ptr) |
171 | { | 171 | { |
172 | if (ptr & ~0x3fffffffUL) { | 172 | if (ptr & ~0x3fffffffUL) { |
173 | snd_printk("max memory size is 1GB!!\n"); | 173 | snd_printk(KERN_ERR "max memory size is 1GB!!\n"); |
174 | return 0; | 174 | return 0; |
175 | } | 175 | } |
176 | if (ptr & (SNDRV_TRIDENT_PAGE_SIZE-1)) { | 176 | if (ptr & (SNDRV_TRIDENT_PAGE_SIZE-1)) { |
177 | snd_printk("page is not aligned\n"); | 177 | snd_printk(KERN_ERR "page is not aligned\n"); |
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | return 1; | 180 | return 1; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 3c0205b91e10..523eace250f7 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -41,6 +41,9 @@ | |||
41 | * device for applications. | 41 | * device for applications. |
42 | * - clean up the code, separate low-level initialization | 42 | * - clean up the code, separate low-level initialization |
43 | * routines for each chipset. | 43 | * routines for each chipset. |
44 | * | ||
45 | * Sep. 26, 2005 Karsten Wiese <annabellesgarden@yahoo.de> | ||
46 | * - Optimize position calculation for the 823x chips. | ||
44 | */ | 47 | */ |
45 | 48 | ||
46 | #include <sound/driver.h> | 49 | #include <sound/driver.h> |
@@ -73,36 +76,37 @@ MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}"); | |||
73 | #define SUPPORT_JOYSTICK 1 | 76 | #define SUPPORT_JOYSTICK 1 |
74 | #endif | 77 | #endif |
75 | 78 | ||
76 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 79 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
77 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 80 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
78 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 81 | static long mpu_port; |
79 | static long mpu_port[SNDRV_CARDS]; | ||
80 | #ifdef SUPPORT_JOYSTICK | 82 | #ifdef SUPPORT_JOYSTICK |
81 | static int joystick[SNDRV_CARDS]; | 83 | static int joystick; |
82 | #endif | 84 | #endif |
83 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000}; | 85 | static int ac97_clock = 48000; |
84 | static char *ac97_quirk[SNDRV_CARDS]; | 86 | static char *ac97_quirk; |
85 | static int dxs_support[SNDRV_CARDS]; | 87 | static int dxs_support; |
86 | 88 | ||
87 | module_param_array(index, int, NULL, 0444); | 89 | module_param(index, int, 0444); |
88 | MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge."); | 90 | MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge."); |
89 | module_param_array(id, charp, NULL, 0444); | 91 | module_param(id, charp, 0444); |
90 | MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge."); | 92 | MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge."); |
91 | module_param_array(enable, bool, NULL, 0444); | 93 | module_param(mpu_port, long, 0444); |
92 | MODULE_PARM_DESC(enable, "Enable audio part of VIA 82xx bridge."); | ||
93 | module_param_array(mpu_port, long, NULL, 0444); | ||
94 | MODULE_PARM_DESC(mpu_port, "MPU-401 port. (VT82C686x only)"); | 94 | MODULE_PARM_DESC(mpu_port, "MPU-401 port. (VT82C686x only)"); |
95 | #ifdef SUPPORT_JOYSTICK | 95 | #ifdef SUPPORT_JOYSTICK |
96 | module_param_array(joystick, bool, NULL, 0444); | 96 | module_param(joystick, bool, 0444); |
97 | MODULE_PARM_DESC(joystick, "Enable joystick. (VT82C686x only)"); | 97 | MODULE_PARM_DESC(joystick, "Enable joystick. (VT82C686x only)"); |
98 | #endif | 98 | #endif |
99 | module_param_array(ac97_clock, int, NULL, 0444); | 99 | module_param(ac97_clock, int, 0444); |
100 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); | 100 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); |
101 | module_param_array(ac97_quirk, charp, NULL, 0444); | 101 | module_param(ac97_quirk, charp, 0444); |
102 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); | 102 | MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); |
103 | module_param_array(dxs_support, int, NULL, 0444); | 103 | module_param(dxs_support, int, 0444); |
104 | MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); | 104 | MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); |
105 | 105 | ||
106 | /* just for backward compatibility */ | ||
107 | static int enable; | ||
108 | module_param(enable, bool, 0444); | ||
109 | |||
106 | 110 | ||
107 | /* revision numbers for via686 */ | 111 | /* revision numbers for via686 */ |
108 | #define VIA_REV_686_A 0x10 | 112 | #define VIA_REV_686_A 0x10 |
@@ -130,6 +134,7 @@ MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 | |||
130 | /* common offsets */ | 134 | /* common offsets */ |
131 | #define VIA_REG_OFFSET_STATUS 0x00 /* byte - channel status */ | 135 | #define VIA_REG_OFFSET_STATUS 0x00 /* byte - channel status */ |
132 | #define VIA_REG_STAT_ACTIVE 0x80 /* RO */ | 136 | #define VIA_REG_STAT_ACTIVE 0x80 /* RO */ |
137 | #define VIA8233_SHADOW_STAT_ACTIVE 0x08 /* RO */ | ||
133 | #define VIA_REG_STAT_PAUSED 0x40 /* RO */ | 138 | #define VIA_REG_STAT_PAUSED 0x40 /* RO */ |
134 | #define VIA_REG_STAT_TRIGGER_QUEUED 0x08 /* RO */ | 139 | #define VIA_REG_STAT_TRIGGER_QUEUED 0x08 /* RO */ |
135 | #define VIA_REG_STAT_STOPPED 0x04 /* RWC */ | 140 | #define VIA_REG_STAT_STOPPED 0x04 /* RWC */ |
@@ -328,6 +333,9 @@ struct via_dev { | |||
328 | unsigned int fragsize; | 333 | unsigned int fragsize; |
329 | unsigned int bufsize; | 334 | unsigned int bufsize; |
330 | unsigned int bufsize2; | 335 | unsigned int bufsize2; |
336 | int hwptr_done; /* processed frame position in the buffer */ | ||
337 | int in_interrupt; | ||
338 | int shadow_shift; | ||
331 | }; | 339 | }; |
332 | 340 | ||
333 | 341 | ||
@@ -360,7 +368,8 @@ struct _snd_via82xx { | |||
360 | unsigned int mpu_port_saved; | 368 | unsigned int mpu_port_saved; |
361 | #endif | 369 | #endif |
362 | 370 | ||
363 | unsigned char playback_volume[2]; /* for VIA8233/C/8235; default = 0 */ | 371 | unsigned char playback_volume[4][2]; /* for VIA8233/C/8235; default = 0 */ |
372 | unsigned char playback_volume_c[2]; /* for VIA8233/C/8235; default = 0 */ | ||
364 | 373 | ||
365 | unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ | 374 | unsigned int intr_mask; /* SGD_SHADOW mask to check interrupts */ |
366 | 375 | ||
@@ -393,8 +402,10 @@ struct _snd_via82xx { | |||
393 | }; | 402 | }; |
394 | 403 | ||
395 | static struct pci_device_id snd_via82xx_ids[] = { | 404 | static struct pci_device_id snd_via82xx_ids[] = { |
396 | { 0x1106, 0x3058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, }, /* 686A */ | 405 | /* 0x1106, 0x3058 */ |
397 | { 0x1106, 0x3059, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA8233, }, /* VT8233 */ | 406 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA686, }, /* 686A */ |
407 | /* 0x1106, 0x3059 */ | ||
408 | { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TYPE_CARD_VIA8233, }, /* VT8233 */ | ||
398 | { 0, } | 409 | { 0, } |
399 | }; | 410 | }; |
400 | 411 | ||
@@ -548,7 +559,7 @@ static void snd_via82xx_codec_write(ac97_t *ac97, | |||
548 | { | 559 | { |
549 | via82xx_t *chip = ac97->private_data; | 560 | via82xx_t *chip = ac97->private_data; |
550 | unsigned int xval; | 561 | unsigned int xval; |
551 | 562 | ||
552 | xval = !ac97->num ? VIA_REG_AC97_CODEC_ID_PRIMARY : VIA_REG_AC97_CODEC_ID_SECONDARY; | 563 | xval = !ac97->num ? VIA_REG_AC97_CODEC_ID_PRIMARY : VIA_REG_AC97_CODEC_ID_SECONDARY; |
553 | xval <<= VIA_REG_AC97_CODEC_ID_SHIFT; | 564 | xval <<= VIA_REG_AC97_CODEC_ID_SHIFT; |
554 | xval |= reg << VIA_REG_AC97_CMD_SHIFT; | 565 | xval |= reg << VIA_REG_AC97_CMD_SHIFT; |
@@ -596,14 +607,15 @@ static void snd_via82xx_channel_reset(via82xx_t *chip, viadev_t *viadev) | |||
596 | outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */ | 607 | outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */ |
597 | // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR)); | 608 | // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR)); |
598 | viadev->lastpos = 0; | 609 | viadev->lastpos = 0; |
610 | viadev->hwptr_done = 0; | ||
599 | } | 611 | } |
600 | 612 | ||
601 | 613 | ||
602 | /* | 614 | /* |
603 | * Interrupt handler | 615 | * Interrupt handler |
616 | * Used for 686 and 8233A | ||
604 | */ | 617 | */ |
605 | 618 | static irqreturn_t snd_via686_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |
606 | static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
607 | { | 619 | { |
608 | via82xx_t *chip = dev_id; | 620 | via82xx_t *chip = dev_id; |
609 | unsigned int status; | 621 | unsigned int status; |
@@ -622,13 +634,23 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * | |||
622 | for (i = 0; i < chip->num_devs; i++) { | 634 | for (i = 0; i < chip->num_devs; i++) { |
623 | viadev_t *viadev = &chip->devs[i]; | 635 | viadev_t *viadev = &chip->devs[i]; |
624 | unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); | 636 | unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); |
625 | c_status &= (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED); | 637 | if (! (c_status & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG|VIA_REG_STAT_STOPPED))) |
626 | if (! c_status) | ||
627 | continue; | 638 | continue; |
628 | if (viadev->substream && viadev->running) { | 639 | if (viadev->substream && viadev->running) { |
640 | /* | ||
641 | * Update hwptr_done based on 'period elapsed' | ||
642 | * interrupts. We'll use it, when the chip returns 0 | ||
643 | * for OFFSET_CURR_COUNT. | ||
644 | */ | ||
645 | if (c_status & VIA_REG_STAT_EOL) | ||
646 | viadev->hwptr_done = 0; | ||
647 | else | ||
648 | viadev->hwptr_done += viadev->fragsize; | ||
649 | viadev->in_interrupt = c_status; | ||
629 | spin_unlock(&chip->reg_lock); | 650 | spin_unlock(&chip->reg_lock); |
630 | snd_pcm_period_elapsed(viadev->substream); | 651 | snd_pcm_period_elapsed(viadev->substream); |
631 | spin_lock(&chip->reg_lock); | 652 | spin_lock(&chip->reg_lock); |
653 | viadev->in_interrupt = 0; | ||
632 | } | 654 | } |
633 | outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ | 655 | outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ |
634 | } | 656 | } |
@@ -637,6 +659,60 @@ static irqreturn_t snd_via82xx_interrupt(int irq, void *dev_id, struct pt_regs * | |||
637 | } | 659 | } |
638 | 660 | ||
639 | /* | 661 | /* |
662 | * Interrupt handler | ||
663 | */ | ||
664 | static irqreturn_t snd_via8233_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
665 | { | ||
666 | via82xx_t *chip = dev_id; | ||
667 | unsigned int status; | ||
668 | unsigned int i; | ||
669 | int irqreturn = 0; | ||
670 | |||
671 | /* check status for each stream */ | ||
672 | spin_lock(&chip->reg_lock); | ||
673 | status = inl(VIAREG(chip, SGD_SHADOW)); | ||
674 | |||
675 | for (i = 0; i < chip->num_devs; i++) { | ||
676 | viadev_t *viadev = &chip->devs[i]; | ||
677 | snd_pcm_substream_t *substream; | ||
678 | unsigned char c_status, shadow_status; | ||
679 | |||
680 | shadow_status = (status >> viadev->shadow_shift) & | ||
681 | (VIA8233_SHADOW_STAT_ACTIVE|VIA_REG_STAT_EOL| | ||
682 | VIA_REG_STAT_FLAG); | ||
683 | c_status = shadow_status & (VIA_REG_STAT_EOL|VIA_REG_STAT_FLAG); | ||
684 | if (!c_status) | ||
685 | continue; | ||
686 | |||
687 | substream = viadev->substream; | ||
688 | if (substream && viadev->running) { | ||
689 | /* | ||
690 | * Update hwptr_done based on 'period elapsed' | ||
691 | * interrupts. We'll use it, when the chip returns 0 | ||
692 | * for OFFSET_CURR_COUNT. | ||
693 | */ | ||
694 | if (c_status & VIA_REG_STAT_EOL) | ||
695 | viadev->hwptr_done = 0; | ||
696 | else | ||
697 | viadev->hwptr_done += viadev->fragsize; | ||
698 | viadev->in_interrupt = c_status; | ||
699 | if (shadow_status & VIA8233_SHADOW_STAT_ACTIVE) | ||
700 | viadev->in_interrupt |= VIA_REG_STAT_ACTIVE; | ||
701 | spin_unlock(&chip->reg_lock); | ||
702 | |||
703 | snd_pcm_period_elapsed(substream); | ||
704 | |||
705 | spin_lock(&chip->reg_lock); | ||
706 | viadev->in_interrupt = 0; | ||
707 | } | ||
708 | outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ | ||
709 | irqreturn = 1; | ||
710 | } | ||
711 | spin_unlock(&chip->reg_lock); | ||
712 | return IRQ_RETVAL(irqreturn); | ||
713 | } | ||
714 | |||
715 | /* | ||
640 | * PCM callbacks | 716 | * PCM callbacks |
641 | */ | 717 | */ |
642 | 718 | ||
@@ -699,6 +775,8 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u | |||
699 | size = viadev->idx_table[idx].size; | 775 | size = viadev->idx_table[idx].size; |
700 | base = viadev->idx_table[idx].offset; | 776 | base = viadev->idx_table[idx].offset; |
701 | res = base + size - count; | 777 | res = base + size - count; |
778 | if (res >= viadev->bufsize) | ||
779 | res -= viadev->bufsize; | ||
702 | 780 | ||
703 | /* check the validity of the calculated position */ | 781 | /* check the validity of the calculated position */ |
704 | if (size < count) { | 782 | if (size < count) { |
@@ -728,9 +806,6 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u | |||
728 | } | 806 | } |
729 | } | 807 | } |
730 | } | 808 | } |
731 | viadev->lastpos = res; /* remember the last position */ | ||
732 | if (res >= viadev->bufsize) | ||
733 | res -= viadev->bufsize; | ||
734 | return res; | 809 | return res; |
735 | } | 810 | } |
736 | 811 | ||
@@ -758,6 +833,7 @@ static snd_pcm_uframes_t snd_via686_pcm_pointer(snd_pcm_substream_t *substream) | |||
758 | else /* CURR_PTR holds the address + 8 */ | 833 | else /* CURR_PTR holds the address + 8 */ |
759 | idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; | 834 | idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; |
760 | res = calc_linear_pos(viadev, idx, count); | 835 | res = calc_linear_pos(viadev, idx, count); |
836 | viadev->lastpos = res; /* remember the last position */ | ||
761 | spin_unlock(&chip->reg_lock); | 837 | spin_unlock(&chip->reg_lock); |
762 | 838 | ||
763 | return bytes_to_frames(substream->runtime, res); | 839 | return bytes_to_frames(substream->runtime, res); |
@@ -771,30 +847,44 @@ static snd_pcm_uframes_t snd_via8233_pcm_pointer(snd_pcm_substream_t *substream) | |||
771 | via82xx_t *chip = snd_pcm_substream_chip(substream); | 847 | via82xx_t *chip = snd_pcm_substream_chip(substream); |
772 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; | 848 | viadev_t *viadev = (viadev_t *)substream->runtime->private_data; |
773 | unsigned int idx, count, res; | 849 | unsigned int idx, count, res; |
774 | int timeout = 5000; | 850 | int status; |
775 | 851 | ||
776 | snd_assert(viadev->tbl_entries, return 0); | 852 | snd_assert(viadev->tbl_entries, return 0); |
777 | if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE)) | 853 | |
778 | return 0; | ||
779 | spin_lock(&chip->reg_lock); | 854 | spin_lock(&chip->reg_lock); |
780 | do { | 855 | count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)); |
781 | count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)); | 856 | status = viadev->in_interrupt; |
782 | /* some mobos read 0 count */ | 857 | if (!status) |
783 | if ((count & 0xffffff) || ! viadev->running) | 858 | status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); |
784 | break; | 859 | |
785 | } while (--timeout); | 860 | if (!(status & VIA_REG_STAT_ACTIVE)) { |
786 | if (! timeout) | 861 | res = 0; |
787 | snd_printd(KERN_ERR "zero position is read\n"); | 862 | goto unlock; |
788 | idx = count >> 24; | 863 | } |
789 | if (idx >= viadev->tbl_entries) { | 864 | if (count & 0xffffff) { |
865 | idx = count >> 24; | ||
866 | if (idx >= viadev->tbl_entries) { | ||
790 | #ifdef POINTER_DEBUG | 867 | #ifdef POINTER_DEBUG |
791 | printk("fail: invalid idx = %i/%i\n", idx, viadev->tbl_entries); | 868 | printk(KERN_DEBUG "fail: invalid idx = %i/%i\n", idx, viadev->tbl_entries); |
792 | #endif | 869 | #endif |
793 | res = viadev->lastpos; | 870 | res = viadev->lastpos; |
871 | } else { | ||
872 | count &= 0xffffff; | ||
873 | res = calc_linear_pos(viadev, idx, count); | ||
874 | } | ||
794 | } else { | 875 | } else { |
795 | count &= 0xffffff; | 876 | res = viadev->hwptr_done; |
796 | res = calc_linear_pos(viadev, idx, count); | 877 | if (!viadev->in_interrupt) { |
797 | } | 878 | if (status & VIA_REG_STAT_EOL) { |
879 | res = 0; | ||
880 | } else | ||
881 | if (status & VIA_REG_STAT_FLAG) { | ||
882 | res += viadev->fragsize; | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | unlock: | ||
887 | viadev->lastpos = res; | ||
798 | spin_unlock(&chip->reg_lock); | 888 | spin_unlock(&chip->reg_lock); |
799 | 889 | ||
800 | return bytes_to_frames(substream->runtime, res); | 890 | return bytes_to_frames(substream->runtime, res); |
@@ -936,8 +1026,8 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream) | |||
936 | snd_assert((rbits & ~0xfffff) == 0, return -EINVAL); | 1026 | snd_assert((rbits & ~0xfffff) == 0, return -EINVAL); |
937 | snd_via82xx_channel_reset(chip, viadev); | 1027 | snd_via82xx_channel_reset(chip, viadev); |
938 | snd_via82xx_set_table_ptr(chip, viadev); | 1028 | snd_via82xx_set_table_ptr(chip, viadev); |
939 | outb(chip->playback_volume[0], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L)); | 1029 | outb(chip->playback_volume[viadev->reg_offset / 0x10][0], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L)); |
940 | outb(chip->playback_volume[1], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R)); | 1030 | outb(chip->playback_volume[viadev->reg_offset / 0x10][1], VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R)); |
941 | outl((runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA8233_REG_TYPE_16BIT : 0) | /* format */ | 1031 | outl((runtime->format == SNDRV_PCM_FORMAT_S16_LE ? VIA8233_REG_TYPE_16BIT : 0) | /* format */ |
942 | (runtime->channels > 1 ? VIA8233_REG_TYPE_STEREO : 0) | /* stereo */ | 1032 | (runtime->channels > 1 ? VIA8233_REG_TYPE_STEREO : 0) | /* stereo */ |
943 | rbits | /* rate */ | 1033 | rbits | /* rate */ |
@@ -1239,9 +1329,10 @@ static snd_pcm_ops_t snd_via8233_capture_ops = { | |||
1239 | }; | 1329 | }; |
1240 | 1330 | ||
1241 | 1331 | ||
1242 | static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int direction) | 1332 | static void init_viadev(via82xx_t *chip, int idx, unsigned int reg_offset, int shadow_pos, int direction) |
1243 | { | 1333 | { |
1244 | chip->devs[idx].reg_offset = reg_offset; | 1334 | chip->devs[idx].reg_offset = reg_offset; |
1335 | chip->devs[idx].shadow_shift = shadow_pos * 4; | ||
1245 | chip->devs[idx].direction = direction; | 1336 | chip->devs[idx].direction = direction; |
1246 | chip->devs[idx].port = chip->port + reg_offset; | 1337 | chip->devs[idx].port = chip->port + reg_offset; |
1247 | } | 1338 | } |
@@ -1271,9 +1362,9 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip) | |||
1271 | chip->pcms[0] = pcm; | 1362 | chip->pcms[0] = pcm; |
1272 | /* set up playbacks */ | 1363 | /* set up playbacks */ |
1273 | for (i = 0; i < 4; i++) | 1364 | for (i = 0; i < 4; i++) |
1274 | init_viadev(chip, i, 0x10 * i, 0); | 1365 | init_viadev(chip, i, 0x10 * i, i, 0); |
1275 | /* capture */ | 1366 | /* capture */ |
1276 | init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 1); | 1367 | init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1); |
1277 | 1368 | ||
1278 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1369 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1279 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 1370 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) |
@@ -1289,9 +1380,9 @@ static int __devinit snd_via8233_pcm_new(via82xx_t *chip) | |||
1289 | strcpy(pcm->name, chip->card->shortname); | 1380 | strcpy(pcm->name, chip->card->shortname); |
1290 | chip->pcms[1] = pcm; | 1381 | chip->pcms[1] = pcm; |
1291 | /* set up playback */ | 1382 | /* set up playback */ |
1292 | init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0); | 1383 | init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0); |
1293 | /* set up capture */ | 1384 | /* set up capture */ |
1294 | init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 1); | 1385 | init_viadev(chip, chip->capture_devno + 1, VIA_REG_CAPTURE_8233_STATUS + 0x10, 7, 1); |
1295 | 1386 | ||
1296 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1387 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1297 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 1388 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) |
@@ -1324,9 +1415,9 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) | |||
1324 | strcpy(pcm->name, chip->card->shortname); | 1415 | strcpy(pcm->name, chip->card->shortname); |
1325 | chip->pcms[0] = pcm; | 1416 | chip->pcms[0] = pcm; |
1326 | /* set up playback */ | 1417 | /* set up playback */ |
1327 | init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 0); | 1418 | init_viadev(chip, chip->multi_devno, VIA_REG_MULTPLAY_STATUS, 4, 0); |
1328 | /* capture */ | 1419 | /* capture */ |
1329 | init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 1); | 1420 | init_viadev(chip, chip->capture_devno, VIA_REG_CAPTURE_8233_STATUS, 6, 1); |
1330 | 1421 | ||
1331 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1422 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1332 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 1423 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) |
@@ -1345,7 +1436,7 @@ static int __devinit snd_via8233a_pcm_new(via82xx_t *chip) | |||
1345 | strcpy(pcm->name, chip->card->shortname); | 1436 | strcpy(pcm->name, chip->card->shortname); |
1346 | chip->pcms[1] = pcm; | 1437 | chip->pcms[1] = pcm; |
1347 | /* set up playback */ | 1438 | /* set up playback */ |
1348 | init_viadev(chip, chip->playback_devno, 0x30, 0); | 1439 | init_viadev(chip, chip->playback_devno, 0x30, 3, 0); |
1349 | 1440 | ||
1350 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1441 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1351 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 1442 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) |
@@ -1375,8 +1466,8 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) | |||
1375 | pcm->private_data = chip; | 1466 | pcm->private_data = chip; |
1376 | strcpy(pcm->name, chip->card->shortname); | 1467 | strcpy(pcm->name, chip->card->shortname); |
1377 | chip->pcms[0] = pcm; | 1468 | chip->pcms[0] = pcm; |
1378 | init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0); | 1469 | init_viadev(chip, 0, VIA_REG_PLAYBACK_STATUS, 0, 0); |
1379 | init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 1); | 1470 | init_viadev(chip, 1, VIA_REG_CAPTURE_STATUS, 0, 1); |
1380 | 1471 | ||
1381 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, | 1472 | if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG, |
1382 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) | 1473 | snd_dma_pci_data(chip->pci), 64*1024, 128*1024)) < 0) |
@@ -1497,14 +1588,46 @@ static int snd_via8233_dxs_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in | |||
1497 | static int snd_via8233_dxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 1588 | static int snd_via8233_dxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) |
1498 | { | 1589 | { |
1499 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); | 1590 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); |
1500 | ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[0]; | 1591 | unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); |
1501 | ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[1]; | 1592 | |
1593 | ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][0]; | ||
1594 | ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume[idx][1]; | ||
1595 | return 0; | ||
1596 | } | ||
1597 | |||
1598 | static int snd_via8233_pcmdxs_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
1599 | { | ||
1600 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); | ||
1601 | ucontrol->value.integer.value[0] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[0]; | ||
1602 | ucontrol->value.integer.value[1] = VIA_DXS_MAX_VOLUME - chip->playback_volume_c[1]; | ||
1502 | return 0; | 1603 | return 0; |
1503 | } | 1604 | } |
1504 | 1605 | ||
1505 | static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 1606 | static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) |
1506 | { | 1607 | { |
1507 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); | 1608 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); |
1609 | unsigned int idx = snd_ctl_get_ioff(kcontrol, &ucontrol->id); | ||
1610 | unsigned long port = chip->port + 0x10 * idx; | ||
1611 | unsigned char val; | ||
1612 | int i, change = 0; | ||
1613 | |||
1614 | for (i = 0; i < 2; i++) { | ||
1615 | val = ucontrol->value.integer.value[i]; | ||
1616 | if (val > VIA_DXS_MAX_VOLUME) | ||
1617 | val = VIA_DXS_MAX_VOLUME; | ||
1618 | val = VIA_DXS_MAX_VOLUME - val; | ||
1619 | change |= val != chip->playback_volume[idx][i]; | ||
1620 | if (change) { | ||
1621 | chip->playback_volume[idx][i] = val; | ||
1622 | outb(val, port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); | ||
1623 | } | ||
1624 | } | ||
1625 | return change; | ||
1626 | } | ||
1627 | |||
1628 | static int snd_via8233_pcmdxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | ||
1629 | { | ||
1630 | via82xx_t *chip = snd_kcontrol_chip(kcontrol); | ||
1508 | unsigned int idx; | 1631 | unsigned int idx; |
1509 | unsigned char val; | 1632 | unsigned char val; |
1510 | int i, change = 0; | 1633 | int i, change = 0; |
@@ -1514,11 +1637,12 @@ static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
1514 | if (val > VIA_DXS_MAX_VOLUME) | 1637 | if (val > VIA_DXS_MAX_VOLUME) |
1515 | val = VIA_DXS_MAX_VOLUME; | 1638 | val = VIA_DXS_MAX_VOLUME; |
1516 | val = VIA_DXS_MAX_VOLUME - val; | 1639 | val = VIA_DXS_MAX_VOLUME - val; |
1517 | if (val != chip->playback_volume[i]) { | 1640 | if (val != chip->playback_volume_c[i]) { |
1518 | change = 1; | 1641 | change = 1; |
1519 | chip->playback_volume[i] = val; | 1642 | chip->playback_volume_c[i] = val; |
1520 | for (idx = 0; idx < 4; idx++) { | 1643 | for (idx = 0; idx < 4; idx++) { |
1521 | unsigned long port = chip->port + 0x10 * idx; | 1644 | unsigned long port = chip->port + 0x10 * idx; |
1645 | chip->playback_volume[idx][i] = val; | ||
1522 | outb(val, port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); | 1646 | outb(val, port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); |
1523 | } | 1647 | } |
1524 | } | 1648 | } |
@@ -1526,10 +1650,19 @@ static int snd_via8233_dxs_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val | |||
1526 | return change; | 1650 | return change; |
1527 | } | 1651 | } |
1528 | 1652 | ||
1529 | static snd_kcontrol_new_t snd_via8233_dxs_volume_control __devinitdata = { | 1653 | static snd_kcontrol_new_t snd_via8233_pcmdxs_volume_control __devinitdata = { |
1530 | .name = "PCM Playback Volume", | 1654 | .name = "PCM Playback Volume", |
1531 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1655 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1532 | .info = snd_via8233_dxs_volume_info, | 1656 | .info = snd_via8233_dxs_volume_info, |
1657 | .get = snd_via8233_pcmdxs_volume_get, | ||
1658 | .put = snd_via8233_pcmdxs_volume_put, | ||
1659 | }; | ||
1660 | |||
1661 | static snd_kcontrol_new_t snd_via8233_dxs_volume_control __devinitdata = { | ||
1662 | .name = "VIA DXS Playback Volume", | ||
1663 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1664 | .count = 4, | ||
1665 | .info = snd_via8233_dxs_volume_info, | ||
1533 | .get = snd_via8233_dxs_volume_get, | 1666 | .get = snd_via8233_dxs_volume_get, |
1534 | .put = snd_via8233_dxs_volume_put, | 1667 | .put = snd_via8233_dxs_volume_put, |
1535 | }; | 1668 | }; |
@@ -1616,12 +1749,12 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_ov | |||
1616 | return err; | 1749 | return err; |
1617 | chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus; | 1750 | chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus; |
1618 | chip->ac97_bus->clock = chip->ac97_clock; | 1751 | chip->ac97_bus->clock = chip->ac97_clock; |
1619 | chip->ac97_bus->shared_type = AC97_SHARED_TYPE_VIA; | ||
1620 | 1752 | ||
1621 | memset(&ac97, 0, sizeof(ac97)); | 1753 | memset(&ac97, 0, sizeof(ac97)); |
1622 | ac97.private_data = chip; | 1754 | ac97.private_data = chip; |
1623 | ac97.private_free = snd_via82xx_mixer_free_ac97; | 1755 | ac97.private_free = snd_via82xx_mixer_free_ac97; |
1624 | ac97.pci = chip->pci; | 1756 | ac97.pci = chip->pci; |
1757 | ac97.scaps = AC97_SCAP_SKIP_MODEM; | ||
1625 | if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0) | 1758 | if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97)) < 0) |
1626 | return err; | 1759 | return err; |
1627 | 1760 | ||
@@ -1637,12 +1770,12 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_ov | |||
1637 | 1770 | ||
1638 | #ifdef SUPPORT_JOYSTICK | 1771 | #ifdef SUPPORT_JOYSTICK |
1639 | #define JOYSTICK_ADDR 0x200 | 1772 | #define JOYSTICK_ADDR 0x200 |
1640 | static int __devinit snd_via686_create_gameport(via82xx_t *chip, int dev, unsigned char *legacy) | 1773 | static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy) |
1641 | { | 1774 | { |
1642 | struct gameport *gp; | 1775 | struct gameport *gp; |
1643 | struct resource *r; | 1776 | struct resource *r; |
1644 | 1777 | ||
1645 | if (!joystick[dev]) | 1778 | if (!joystick) |
1646 | return -ENODEV; | 1779 | return -ENODEV; |
1647 | 1780 | ||
1648 | r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); | 1781 | r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); |
@@ -1654,8 +1787,7 @@ static int __devinit snd_via686_create_gameport(via82xx_t *chip, int dev, unsign | |||
1654 | chip->gameport = gp = gameport_allocate_port(); | 1787 | chip->gameport = gp = gameport_allocate_port(); |
1655 | if (!gp) { | 1788 | if (!gp) { |
1656 | printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n"); | 1789 | printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n"); |
1657 | release_resource(r); | 1790 | release_and_free_resource(r); |
1658 | kfree_nocheck(r); | ||
1659 | return -ENOMEM; | 1791 | return -ENOMEM; |
1660 | } | 1792 | } |
1661 | 1793 | ||
@@ -1681,12 +1813,11 @@ static void snd_via686_free_gameport(via82xx_t *chip) | |||
1681 | 1813 | ||
1682 | gameport_unregister_port(chip->gameport); | 1814 | gameport_unregister_port(chip->gameport); |
1683 | chip->gameport = NULL; | 1815 | chip->gameport = NULL; |
1684 | release_resource(r); | 1816 | release_and_free_resource(r); |
1685 | kfree_nocheck(r); | ||
1686 | } | 1817 | } |
1687 | } | 1818 | } |
1688 | #else | 1819 | #else |
1689 | static inline int snd_via686_create_gameport(via82xx_t *chip, int dev, unsigned char *legacy) | 1820 | static inline int snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy) |
1690 | { | 1821 | { |
1691 | return -ENOSYS; | 1822 | return -ENOSYS; |
1692 | } | 1823 | } |
@@ -1698,7 +1829,7 @@ static inline void snd_via686_free_gameport(via82xx_t *chip) { } | |||
1698 | * | 1829 | * |
1699 | */ | 1830 | */ |
1700 | 1831 | ||
1701 | static int __devinit snd_via8233_init_misc(via82xx_t *chip, int dev) | 1832 | static int __devinit snd_via8233_init_misc(via82xx_t *chip) |
1702 | { | 1833 | { |
1703 | int i, err, caps; | 1834 | int i, err, caps; |
1704 | unsigned char val; | 1835 | unsigned char val; |
@@ -1724,12 +1855,19 @@ static int __devinit snd_via8233_init_misc(via82xx_t *chip, int dev) | |||
1724 | strcpy(sid.name, "PCM Playback Volume"); | 1855 | strcpy(sid.name, "PCM Playback Volume"); |
1725 | sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 1856 | sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
1726 | if (! snd_ctl_find_id(chip->card, &sid)) { | 1857 | if (! snd_ctl_find_id(chip->card, &sid)) { |
1858 | snd_printd(KERN_INFO "Using DXS as PCM Playback\n"); | ||
1859 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_pcmdxs_volume_control, chip)); | ||
1860 | if (err < 0) | ||
1861 | return err; | ||
1862 | } | ||
1863 | else /* Using DXS when PCM emulation is enabled is really weird */ | ||
1864 | { | ||
1865 | /* Standalone DXS controls */ | ||
1727 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip)); | 1866 | err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_via8233_dxs_volume_control, chip)); |
1728 | if (err < 0) | 1867 | if (err < 0) |
1729 | return err; | 1868 | return err; |
1730 | } | 1869 | } |
1731 | } | 1870 | } |
1732 | |||
1733 | /* select spdif data slot 10/11 */ | 1871 | /* select spdif data slot 10/11 */ |
1734 | pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val); | 1872 | pci_read_config_byte(chip->pci, VIA8233_SPDIF_CTRL, &val); |
1735 | val = (val & ~VIA8233_SPDIF_SLOT_MASK) | VIA8233_SPDIF_SLOT_1011; | 1873 | val = (val & ~VIA8233_SPDIF_SLOT_MASK) | VIA8233_SPDIF_SLOT_1011; |
@@ -1739,7 +1877,7 @@ static int __devinit snd_via8233_init_misc(via82xx_t *chip, int dev) | |||
1739 | return 0; | 1877 | return 0; |
1740 | } | 1878 | } |
1741 | 1879 | ||
1742 | static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev) | 1880 | static int __devinit snd_via686_init_misc(via82xx_t *chip) |
1743 | { | 1881 | { |
1744 | unsigned char legacy, legacy_cfg; | 1882 | unsigned char legacy, legacy_cfg; |
1745 | int rev_h = 0; | 1883 | int rev_h = 0; |
@@ -1750,32 +1888,33 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev) | |||
1750 | legacy &= ~VIA_FUNC_ENABLE_GAME; /* disable joystick */ | 1888 | legacy &= ~VIA_FUNC_ENABLE_GAME; /* disable joystick */ |
1751 | if (chip->revision >= VIA_REV_686_H) { | 1889 | if (chip->revision >= VIA_REV_686_H) { |
1752 | rev_h = 1; | 1890 | rev_h = 1; |
1753 | if (mpu_port[dev] >= 0x200) { /* force MIDI */ | 1891 | if (mpu_port >= 0x200) { /* force MIDI */ |
1754 | mpu_port[dev] &= 0xfffc; | 1892 | mpu_port &= 0xfffc; |
1755 | pci_write_config_dword(chip->pci, 0x18, mpu_port[dev] | 0x01); | 1893 | pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01); |
1756 | #ifdef CONFIG_PM | 1894 | #ifdef CONFIG_PM |
1757 | chip->mpu_port_saved = mpu_port[dev]; | 1895 | chip->mpu_port_saved = mpu_port; |
1758 | #endif | 1896 | #endif |
1759 | } else { | 1897 | } else { |
1760 | mpu_port[dev] = pci_resource_start(chip->pci, 2); | 1898 | mpu_port = pci_resource_start(chip->pci, 2); |
1761 | } | 1899 | } |
1762 | } else { | 1900 | } else { |
1763 | switch (mpu_port[dev]) { /* force MIDI */ | 1901 | switch (mpu_port) { /* force MIDI */ |
1764 | case 0x300: | 1902 | case 0x300: |
1765 | case 0x310: | 1903 | case 0x310: |
1766 | case 0x320: | 1904 | case 0x320: |
1767 | case 0x330: | 1905 | case 0x330: |
1768 | legacy_cfg &= ~(3 << 2); | 1906 | legacy_cfg &= ~(3 << 2); |
1769 | legacy_cfg |= (mpu_port[dev] & 0x0030) >> 2; | 1907 | legacy_cfg |= (mpu_port & 0x0030) >> 2; |
1770 | break; | 1908 | break; |
1771 | default: /* no, use BIOS settings */ | 1909 | default: /* no, use BIOS settings */ |
1772 | if (legacy & VIA_FUNC_ENABLE_MIDI) | 1910 | if (legacy & VIA_FUNC_ENABLE_MIDI) |
1773 | mpu_port[dev] = 0x300 + ((legacy_cfg & 0x000c) << 2); | 1911 | mpu_port = 0x300 + ((legacy_cfg & 0x000c) << 2); |
1774 | break; | 1912 | break; |
1775 | } | 1913 | } |
1776 | } | 1914 | } |
1777 | if (mpu_port[dev] >= 0x200 && | 1915 | if (mpu_port >= 0x200 && |
1778 | (chip->mpu_res = request_region(mpu_port[dev], 2, "VIA82xx MPU401")) != NULL) { | 1916 | (chip->mpu_res = request_region(mpu_port, 2, "VIA82xx MPU401")) |
1917 | != NULL) { | ||
1779 | if (rev_h) | 1918 | if (rev_h) |
1780 | legacy |= VIA_FUNC_MIDI_PNP; /* enable PCI I/O 2 */ | 1919 | legacy |= VIA_FUNC_MIDI_PNP; /* enable PCI I/O 2 */ |
1781 | legacy |= VIA_FUNC_ENABLE_MIDI; | 1920 | legacy |= VIA_FUNC_ENABLE_MIDI; |
@@ -1783,16 +1922,17 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev) | |||
1783 | if (rev_h) | 1922 | if (rev_h) |
1784 | legacy &= ~VIA_FUNC_MIDI_PNP; /* disable PCI I/O 2 */ | 1923 | legacy &= ~VIA_FUNC_MIDI_PNP; /* disable PCI I/O 2 */ |
1785 | legacy &= ~VIA_FUNC_ENABLE_MIDI; | 1924 | legacy &= ~VIA_FUNC_ENABLE_MIDI; |
1786 | mpu_port[dev] = 0; | 1925 | mpu_port = 0; |
1787 | } | 1926 | } |
1788 | 1927 | ||
1789 | pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy); | 1928 | pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy); |
1790 | pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg); | 1929 | pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg); |
1791 | if (chip->mpu_res) { | 1930 | if (chip->mpu_res) { |
1792 | if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A, | 1931 | if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A, |
1793 | mpu_port[dev], 1, | 1932 | mpu_port, 1, |
1794 | chip->irq, 0, &chip->rmidi) < 0) { | 1933 | chip->irq, 0, &chip->rmidi) < 0) { |
1795 | printk(KERN_WARNING "unable to initialize MPU-401 at 0x%lx, skipping\n", mpu_port[dev]); | 1934 | printk(KERN_WARNING "unable to initialize MPU-401" |
1935 | " at 0x%lx, skipping\n", mpu_port); | ||
1796 | legacy &= ~VIA_FUNC_ENABLE_MIDI; | 1936 | legacy &= ~VIA_FUNC_ENABLE_MIDI; |
1797 | } else { | 1937 | } else { |
1798 | legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */ | 1938 | legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */ |
@@ -1800,7 +1940,7 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev) | |||
1800 | pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy); | 1940 | pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy); |
1801 | } | 1941 | } |
1802 | 1942 | ||
1803 | snd_via686_create_gameport(chip, dev, &legacy); | 1943 | snd_via686_create_gameport(chip, &legacy); |
1804 | 1944 | ||
1805 | #ifdef CONFIG_PM | 1945 | #ifdef CONFIG_PM |
1806 | chip->legacy_saved = legacy; | 1946 | chip->legacy_saved = legacy; |
@@ -1887,12 +2027,11 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1887 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); | 2027 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); |
1888 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ | 2028 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ |
1889 | break; | 2029 | break; |
1890 | set_current_state(TASK_UNINTERRUPTIBLE); | 2030 | schedule_timeout_uninterruptible(1); |
1891 | schedule_timeout(1); | ||
1892 | } while (time_before(jiffies, end_time)); | 2031 | } while (time_before(jiffies, end_time)); |
1893 | 2032 | ||
1894 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) | 2033 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) |
1895 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); | 2034 | snd_printk(KERN_ERR "AC'97 codec is not ready [0x%x]\n", val); |
1896 | 2035 | ||
1897 | #if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */ | 2036 | #if 0 /* FIXME: we don't support the second codec yet so skip the detection now.. */ |
1898 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 2037 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
@@ -1907,8 +2046,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1907 | chip->ac97_secondary = 1; | 2046 | chip->ac97_secondary = 1; |
1908 | goto __ac97_ok2; | 2047 | goto __ac97_ok2; |
1909 | } | 2048 | } |
1910 | set_current_state(TASK_INTERRUPTIBLE); | 2049 | schedule_timeout_interruptible(1); |
1911 | schedule_timeout(1); | ||
1912 | } while (time_before(jiffies, end_time)); | 2050 | } while (time_before(jiffies, end_time)); |
1913 | /* This is ok, the most of motherboards have only one codec */ | 2051 | /* This is ok, the most of motherboards have only one codec */ |
1914 | 2052 | ||
@@ -1940,8 +2078,10 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1940 | int i, idx; | 2078 | int i, idx; |
1941 | for (idx = 0; idx < 4; idx++) { | 2079 | for (idx = 0; idx < 4; idx++) { |
1942 | unsigned long port = chip->port + 0x10 * idx; | 2080 | unsigned long port = chip->port + 0x10 * idx; |
1943 | for (i = 0; i < 2; i++) | 2081 | for (i = 0; i < 2; i++) { |
1944 | outb(chip->playback_volume[i], port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); | 2082 | chip->playback_volume[idx][i]=chip->playback_volume_c[i]; |
2083 | outb(chip->playback_volume_c[i], port + VIA_REG_OFS_PLAYBACK_VOLUME_L + i); | ||
2084 | } | ||
1945 | } | 2085 | } |
1946 | } | 2086 | } |
1947 | 2087 | ||
@@ -2020,10 +2160,7 @@ static int snd_via82xx_free(via82xx_t *chip) | |||
2020 | __end_hw: | 2160 | __end_hw: |
2021 | if (chip->irq >= 0) | 2161 | if (chip->irq >= 0) |
2022 | free_irq(chip->irq, (void *)chip); | 2162 | free_irq(chip->irq, (void *)chip); |
2023 | if (chip->mpu_res) { | 2163 | release_and_free_resource(chip->mpu_res); |
2024 | release_resource(chip->mpu_res); | ||
2025 | kfree_nocheck(chip->mpu_res); | ||
2026 | } | ||
2027 | pci_release_regions(chip->pci); | 2164 | pci_release_regions(chip->pci); |
2028 | 2165 | ||
2029 | if (chip->chip_type == TYPE_VIA686) { | 2166 | if (chip->chip_type == TYPE_VIA686) { |
@@ -2084,9 +2221,12 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
2084 | return err; | 2221 | return err; |
2085 | } | 2222 | } |
2086 | chip->port = pci_resource_start(pci, 0); | 2223 | chip->port = pci_resource_start(pci, 0); |
2087 | if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, | 2224 | if (request_irq(pci->irq, |
2225 | chip_type == TYPE_VIA8233 ? | ||
2226 | snd_via8233_interrupt : snd_via686_interrupt, | ||
2227 | SA_INTERRUPT|SA_SHIRQ, | ||
2088 | card->driver, (void *)chip)) { | 2228 | card->driver, (void *)chip)) { |
2089 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2229 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2090 | snd_via82xx_free(chip); | 2230 | snd_via82xx_free(chip); |
2091 | return -EBUSY; | 2231 | return -EBUSY; |
2092 | } | 2232 | } |
@@ -2178,6 +2318,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2178 | { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */ | 2318 | { .subvendor = 0x147b, .subdevice = 0x1415, .action = VIA_DXS_NO_VRA }, /* Abit AV8 */ |
2179 | { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */ | 2319 | { .subvendor = 0x14ff, .subdevice = 0x0403, .action = VIA_DXS_ENABLE }, /* Twinhead mobo */ |
2180 | { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_SRC }, /* Twinhead laptop */ | 2320 | { .subvendor = 0x14ff, .subdevice = 0x0408, .action = VIA_DXS_SRC }, /* Twinhead laptop */ |
2321 | { .subvendor = 0x1558, .subdevice = 0x4701, .action = VIA_DXS_SRC }, /* Clevo D470 */ | ||
2181 | { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */ | 2322 | { .subvendor = 0x1584, .subdevice = 0x8120, .action = VIA_DXS_ENABLE }, /* Gericom/Targa/Vobis/Uniwill laptop */ |
2182 | { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */ | 2323 | { .subvendor = 0x1584, .subdevice = 0x8123, .action = VIA_DXS_NO_VRA }, /* Uniwill (Targa Visionary XP-210) */ |
2183 | { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */ | 2324 | { .subvendor = 0x161f, .subdevice = 0x202b, .action = VIA_DXS_NO_VRA }, /* Amira Note book */ |
@@ -2221,7 +2362,6 @@ static int __devinit check_dxs_list(struct pci_dev *pci) | |||
2221 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, | 2362 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, |
2222 | const struct pci_device_id *pci_id) | 2363 | const struct pci_device_id *pci_id) |
2223 | { | 2364 | { |
2224 | static int dev; | ||
2225 | snd_card_t *card; | 2365 | snd_card_t *card; |
2226 | via82xx_t *chip; | 2366 | via82xx_t *chip; |
2227 | unsigned char revision; | 2367 | unsigned char revision; |
@@ -2229,14 +2369,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2229 | unsigned int i; | 2369 | unsigned int i; |
2230 | int err; | 2370 | int err; |
2231 | 2371 | ||
2232 | if (dev >= SNDRV_CARDS) | 2372 | card = snd_card_new(index, id, THIS_MODULE, 0); |
2233 | return -ENODEV; | ||
2234 | if (!enable[dev]) { | ||
2235 | dev++; | ||
2236 | return -ENOENT; | ||
2237 | } | ||
2238 | |||
2239 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
2240 | if (card == NULL) | 2373 | if (card == NULL) |
2241 | return -ENOMEM; | 2374 | return -ENOMEM; |
2242 | 2375 | ||
@@ -2259,12 +2392,12 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2259 | } | 2392 | } |
2260 | } | 2393 | } |
2261 | if (chip_type != TYPE_VIA8233A) { | 2394 | if (chip_type != TYPE_VIA8233A) { |
2262 | if (dxs_support[dev] == VIA_DXS_AUTO) | 2395 | if (dxs_support == VIA_DXS_AUTO) |
2263 | dxs_support[dev] = check_dxs_list(pci); | 2396 | dxs_support = check_dxs_list(pci); |
2264 | /* force to use VIA8233 or 8233A model according to | 2397 | /* force to use VIA8233 or 8233A model according to |
2265 | * dxs_support module option | 2398 | * dxs_support module option |
2266 | */ | 2399 | */ |
2267 | if (dxs_support[dev] == VIA_DXS_DISABLE) | 2400 | if (dxs_support == VIA_DXS_DISABLE) |
2268 | chip_type = TYPE_VIA8233A; | 2401 | chip_type = TYPE_VIA8233A; |
2269 | else | 2402 | else |
2270 | chip_type = TYPE_VIA8233; | 2403 | chip_type = TYPE_VIA8233; |
@@ -2282,14 +2415,15 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2282 | goto __error; | 2415 | goto __error; |
2283 | } | 2416 | } |
2284 | 2417 | ||
2285 | if ((err = snd_via82xx_create(card, pci, chip_type, revision, ac97_clock[dev], &chip)) < 0) | 2418 | if ((err = snd_via82xx_create(card, pci, chip_type, revision, |
2419 | ac97_clock, &chip)) < 0) | ||
2286 | goto __error; | 2420 | goto __error; |
2287 | if ((err = snd_via82xx_mixer_new(chip, ac97_quirk[dev])) < 0) | 2421 | if ((err = snd_via82xx_mixer_new(chip, ac97_quirk)) < 0) |
2288 | goto __error; | 2422 | goto __error; |
2289 | 2423 | ||
2290 | if (chip_type == TYPE_VIA686) { | 2424 | if (chip_type == TYPE_VIA686) { |
2291 | if ((err = snd_via686_pcm_new(chip)) < 0 || | 2425 | if ((err = snd_via686_pcm_new(chip)) < 0 || |
2292 | (err = snd_via686_init_misc(chip, dev)) < 0) | 2426 | (err = snd_via686_init_misc(chip)) < 0) |
2293 | goto __error; | 2427 | goto __error; |
2294 | } else { | 2428 | } else { |
2295 | if (chip_type == TYPE_VIA8233A) { | 2429 | if (chip_type == TYPE_VIA8233A) { |
@@ -2299,16 +2433,16 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2299 | } else { | 2433 | } else { |
2300 | if ((err = snd_via8233_pcm_new(chip)) < 0) | 2434 | if ((err = snd_via8233_pcm_new(chip)) < 0) |
2301 | goto __error; | 2435 | goto __error; |
2302 | if (dxs_support[dev] == VIA_DXS_48K) | 2436 | if (dxs_support == VIA_DXS_48K) |
2303 | chip->dxs_fixed = 1; | 2437 | chip->dxs_fixed = 1; |
2304 | else if (dxs_support[dev] == VIA_DXS_NO_VRA) | 2438 | else if (dxs_support == VIA_DXS_NO_VRA) |
2305 | chip->no_vra = 1; | 2439 | chip->no_vra = 1; |
2306 | else if (dxs_support[dev] == VIA_DXS_SRC) { | 2440 | else if (dxs_support == VIA_DXS_SRC) { |
2307 | chip->no_vra = 1; | 2441 | chip->no_vra = 1; |
2308 | chip->dxs_src = 1; | 2442 | chip->dxs_src = 1; |
2309 | } | 2443 | } |
2310 | } | 2444 | } |
2311 | if ((err = snd_via8233_init_misc(chip, dev)) < 0) | 2445 | if ((err = snd_via8233_init_misc(chip)) < 0) |
2312 | goto __error; | 2446 | goto __error; |
2313 | } | 2447 | } |
2314 | 2448 | ||
@@ -2329,7 +2463,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2329 | return err; | 2463 | return err; |
2330 | } | 2464 | } |
2331 | pci_set_drvdata(pci, card); | 2465 | pci_set_drvdata(pci, card); |
2332 | dev++; | ||
2333 | return 0; | 2466 | return 0; |
2334 | 2467 | ||
2335 | __error: | 2468 | __error: |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 7eac6f6ac737..011f0fb63bf9 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -26,7 +26,7 @@ | |||
26 | /* | 26 | /* |
27 | * Changes: | 27 | * Changes: |
28 | * | 28 | * |
29 | * Sep. 2, 2004 Sasha Khapyorsky <sashak@smlink.com> | 29 | * Sep. 2, 2004 Sasha Khapyorsky <sashak@alsa-project.org> |
30 | * Modified from original audio driver 'via82xx.c' to support AC97 | 30 | * Modified from original audio driver 'via82xx.c' to support AC97 |
31 | * modems. | 31 | * modems. |
32 | */ | 32 | */ |
@@ -55,20 +55,21 @@ MODULE_DESCRIPTION("VIA VT82xx modem"); | |||
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
56 | MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C modem,pci}}"); | 56 | MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C modem,pci}}"); |
57 | 57 | ||
58 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | 58 | static int index = -2; /* Exclude the first card */ |
59 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 59 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
60 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 60 | static int ac97_clock = 48000; |
61 | static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000}; | ||
62 | 61 | ||
63 | module_param_array(index, int, NULL, 0444); | 62 | module_param(index, int, 0444); |
64 | MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge."); | 63 | MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge."); |
65 | module_param_array(id, charp, NULL, 0444); | 64 | module_param(id, charp, 0444); |
66 | MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge."); | 65 | MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge."); |
67 | module_param_array(enable, bool, NULL, 0444); | 66 | module_param(ac97_clock, int, 0444); |
68 | MODULE_PARM_DESC(enable, "Enable modem part of VIA 82xx bridge."); | ||
69 | module_param_array(ac97_clock, int, NULL, 0444); | ||
70 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); | 67 | MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); |
71 | 68 | ||
69 | /* just for backward compatibility */ | ||
70 | static int enable; | ||
71 | module_param(enable, bool, 0444); | ||
72 | |||
72 | 73 | ||
73 | /* | 74 | /* |
74 | * Direct registers | 75 | * Direct registers |
@@ -569,7 +570,7 @@ static inline unsigned int calc_linear_pos(viadev_t *viadev, unsigned int idx, u | |||
569 | res = viadev->lastpos; | 570 | res = viadev->lastpos; |
570 | } else if (check_invalid_pos(viadev, res)) { | 571 | } else if (check_invalid_pos(viadev, res)) { |
571 | #ifdef POINTER_DEBUG | 572 | #ifdef POINTER_DEBUG |
572 | printk("fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count); | 573 | printk(KERN_DEBUG "fail: idx = %i/%i, lastpos = 0x%x, bufsize2 = 0x%x, offsize = 0x%x, size = 0x%x, count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos, viadev->bufsize2, viadev->idx_table[idx].offset, viadev->idx_table[idx].size, count); |
573 | #endif | 574 | #endif |
574 | if (count && size < count) { | 575 | if (count && size < count) { |
575 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n"); | 576 | snd_printd(KERN_ERR "invalid via82xx_cur_ptr, using last valid pointer\n"); |
@@ -832,6 +833,7 @@ static int __devinit snd_via686_pcm_new(via82xx_t *chip) | |||
832 | return err; | 833 | return err; |
833 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via686_playback_ops); | 834 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_via686_playback_ops); |
834 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops); | 835 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_via686_capture_ops); |
836 | pcm->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
835 | pcm->private_data = chip; | 837 | pcm->private_data = chip; |
836 | strcpy(pcm->name, chip->card->shortname); | 838 | strcpy(pcm->name, chip->card->shortname); |
837 | chip->pcms[0] = pcm; | 839 | chip->pcms[0] = pcm; |
@@ -878,7 +880,6 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip) | |||
878 | return err; | 880 | return err; |
879 | chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus; | 881 | chip->ac97_bus->private_free = snd_via82xx_mixer_free_ac97_bus; |
880 | chip->ac97_bus->clock = chip->ac97_clock; | 882 | chip->ac97_bus->clock = chip->ac97_clock; |
881 | chip->ac97_bus->shared_type = AC97_SHARED_TYPE_VIA; | ||
882 | 883 | ||
883 | memset(&ac97, 0, sizeof(ac97)); | 884 | memset(&ac97, 0, sizeof(ac97)); |
884 | ac97.private_data = chip; | 885 | ac97.private_data = chip; |
@@ -967,12 +968,11 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
967 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); | 968 | pci_read_config_byte(chip->pci, VIA_ACLINK_STAT, &pval); |
968 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ | 969 | if (pval & VIA_ACLINK_C00_READY) /* primary codec ready */ |
969 | break; | 970 | break; |
970 | set_current_state(TASK_UNINTERRUPTIBLE); | 971 | schedule_timeout_uninterruptible(1); |
971 | schedule_timeout(1); | ||
972 | } while (time_before(jiffies, end_time)); | 972 | } while (time_before(jiffies, end_time)); |
973 | 973 | ||
974 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) | 974 | if ((val = snd_via82xx_codec_xread(chip)) & VIA_REG_AC97_BUSY) |
975 | snd_printk("AC'97 codec is not ready [0x%x]\n", val); | 975 | snd_printk(KERN_ERR "AC'97 codec is not ready [0x%x]\n", val); |
976 | 976 | ||
977 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | | 977 | snd_via82xx_codec_xwrite(chip, VIA_REG_AC97_READ | |
978 | VIA_REG_AC97_SECONDARY_VALID | | 978 | VIA_REG_AC97_SECONDARY_VALID | |
@@ -986,8 +986,7 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
986 | chip->ac97_secondary = 1; | 986 | chip->ac97_secondary = 1; |
987 | goto __ac97_ok2; | 987 | goto __ac97_ok2; |
988 | } | 988 | } |
989 | set_current_state(TASK_INTERRUPTIBLE); | 989 | schedule_timeout_interruptible(1); |
990 | schedule_timeout(1); | ||
991 | } while (time_before(jiffies, end_time)); | 990 | } while (time_before(jiffies, end_time)); |
992 | /* This is ok, the most of motherboards have only one codec */ | 991 | /* This is ok, the most of motherboards have only one codec */ |
993 | 992 | ||
@@ -1101,7 +1100,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
1101 | chip->port = pci_resource_start(pci, 0); | 1100 | chip->port = pci_resource_start(pci, 0); |
1102 | if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, | 1101 | if (request_irq(pci->irq, snd_via82xx_interrupt, SA_INTERRUPT|SA_SHIRQ, |
1103 | card->driver, (void *)chip)) { | 1102 | card->driver, (void *)chip)) { |
1104 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 1103 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
1105 | snd_via82xx_free(chip); | 1104 | snd_via82xx_free(chip); |
1106 | return -EBUSY; | 1105 | return -EBUSY; |
1107 | } | 1106 | } |
@@ -1135,7 +1134,6 @@ static int __devinit snd_via82xx_create(snd_card_t * card, | |||
1135 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, | 1134 | static int __devinit snd_via82xx_probe(struct pci_dev *pci, |
1136 | const struct pci_device_id *pci_id) | 1135 | const struct pci_device_id *pci_id) |
1137 | { | 1136 | { |
1138 | static int dev; | ||
1139 | snd_card_t *card; | 1137 | snd_card_t *card; |
1140 | via82xx_t *chip; | 1138 | via82xx_t *chip; |
1141 | unsigned char revision; | 1139 | unsigned char revision; |
@@ -1143,14 +1141,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
1143 | unsigned int i; | 1141 | unsigned int i; |
1144 | int err; | 1142 | int err; |
1145 | 1143 | ||
1146 | if (dev >= SNDRV_CARDS) | 1144 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1147 | return -ENODEV; | ||
1148 | if (!enable[dev]) { | ||
1149 | dev++; | ||
1150 | return -ENOENT; | ||
1151 | } | ||
1152 | |||
1153 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1154 | if (card == NULL) | 1145 | if (card == NULL) |
1155 | return -ENOMEM; | 1146 | return -ENOMEM; |
1156 | 1147 | ||
@@ -1167,7 +1158,8 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
1167 | goto __error; | 1158 | goto __error; |
1168 | } | 1159 | } |
1169 | 1160 | ||
1170 | if ((err = snd_via82xx_create(card, pci, chip_type, revision, ac97_clock[dev], &chip)) < 0) | 1161 | if ((err = snd_via82xx_create(card, pci, chip_type, revision, |
1162 | ac97_clock, &chip)) < 0) | ||
1171 | goto __error; | 1163 | goto __error; |
1172 | if ((err = snd_via82xx_mixer_new(chip)) < 0) | 1164 | if ((err = snd_via82xx_mixer_new(chip)) < 0) |
1173 | goto __error; | 1165 | goto __error; |
@@ -1191,7 +1183,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
1191 | return err; | 1183 | return err; |
1192 | } | 1184 | } |
1193 | pci_set_drvdata(pci, card); | 1185 | pci_set_drvdata(pci, card); |
1194 | dev++; | ||
1195 | return 0; | 1186 | return 0; |
1196 | 1187 | ||
1197 | __error: | 1188 | __error: |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 2e69abe51aa9..1bbba32517ff 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -130,8 +130,7 @@ static int __devinit snd_ymfpci_create_gameport(ymfpci_t *chip, int dev, | |||
130 | chip->gameport = gp = gameport_allocate_port(); | 130 | chip->gameport = gp = gameport_allocate_port(); |
131 | if (!gp) { | 131 | if (!gp) { |
132 | printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n"); | 132 | printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n"); |
133 | release_resource(r); | 133 | release_and_free_resource(r); |
134 | kfree_nocheck(r); | ||
135 | return -ENOMEM; | 134 | return -ENOMEM; |
136 | } | 135 | } |
137 | 136 | ||
@@ -161,8 +160,7 @@ void snd_ymfpci_free_gameport(ymfpci_t *chip) | |||
161 | gameport_unregister_port(chip->gameport); | 160 | gameport_unregister_port(chip->gameport); |
162 | chip->gameport = NULL; | 161 | chip->gameport = NULL; |
163 | 162 | ||
164 | release_resource(r); | 163 | release_and_free_resource(r); |
165 | kfree_nocheck(r); | ||
166 | } | 164 | } |
167 | } | 165 | } |
168 | #else | 166 | #else |
@@ -267,14 +265,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, | |||
267 | old_legacy_ctrl, | 265 | old_legacy_ctrl, |
268 | &chip)) < 0) { | 266 | &chip)) < 0) { |
269 | snd_card_free(card); | 267 | snd_card_free(card); |
270 | if (mpu_res) { | 268 | release_and_free_resource(mpu_res); |
271 | release_resource(mpu_res); | 269 | release_and_free_resource(fm_res); |
272 | kfree_nocheck(mpu_res); | ||
273 | } | ||
274 | if (fm_res) { | ||
275 | release_resource(fm_res); | ||
276 | kfree_nocheck(fm_res); | ||
277 | } | ||
278 | return err; | 270 | return err; |
279 | } | 271 | } |
280 | chip->fm_res = fm_res; | 272 | chip->fm_res = fm_res; |
@@ -328,7 +320,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, | |||
328 | pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); | 320 | pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); |
329 | } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 321 | } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { |
330 | snd_card_free(card); | 322 | snd_card_free(card); |
331 | snd_printk("cannot create opl3 hwdep\n"); | 323 | snd_printk(KERN_ERR "cannot create opl3 hwdep\n"); |
332 | return err; | 324 | return err; |
333 | } | 325 | } |
334 | } | 326 | } |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 27fa523639ae..88a43e091d77 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -92,9 +92,9 @@ static int snd_ymfpci_codec_ready(ymfpci_t *chip, int secondary) | |||
92 | if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) | 92 | if ((snd_ymfpci_readw(chip, reg) & 0x8000) == 0) |
93 | return 0; | 93 | return 0; |
94 | set_current_state(TASK_UNINTERRUPTIBLE); | 94 | set_current_state(TASK_UNINTERRUPTIBLE); |
95 | schedule_timeout(1); | 95 | schedule_timeout_uninterruptible(1); |
96 | } while (time_before(jiffies, end_time)); | 96 | } while (time_before(jiffies, end_time)); |
97 | snd_printk("codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); | 97 | snd_printk(KERN_ERR "codec_ready: codec %i is not ready [0x%x]\n", secondary, snd_ymfpci_readw(chip, reg)); |
98 | return -EBUSY; | 98 | return -EBUSY; |
99 | } | 99 | } |
100 | 100 | ||
@@ -728,8 +728,7 @@ static void snd_ymfpci_irq_wait(ymfpci_t *chip) | |||
728 | init_waitqueue_entry(&wait, current); | 728 | init_waitqueue_entry(&wait, current); |
729 | add_wait_queue(&chip->interrupt_sleep, &wait); | 729 | add_wait_queue(&chip->interrupt_sleep, &wait); |
730 | atomic_inc(&chip->interrupt_sleep_count); | 730 | atomic_inc(&chip->interrupt_sleep_count); |
731 | set_current_state(TASK_UNINTERRUPTIBLE); | 731 | schedule_timeout_uninterruptible(msecs_to_jiffies(50)); |
732 | schedule_timeout(HZ/20); | ||
733 | remove_wait_queue(&chip->interrupt_sleep, &wait); | 732 | remove_wait_queue(&chip->interrupt_sleep, &wait); |
734 | } | 733 | } |
735 | } | 734 | } |
@@ -1421,15 +1420,18 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = { | |||
1421 | * Mixer controls | 1420 | * Mixer controls |
1422 | */ | 1421 | */ |
1423 | 1422 | ||
1424 | #define YMFPCI_SINGLE(xname, xindex, reg) \ | 1423 | #define YMFPCI_SINGLE(xname, xindex, reg, shift) \ |
1425 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | 1424 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ |
1426 | .info = snd_ymfpci_info_single, \ | 1425 | .info = snd_ymfpci_info_single, \ |
1427 | .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \ | 1426 | .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \ |
1428 | .private_value = reg } | 1427 | .private_value = ((reg) | ((shift) << 16)) } |
1429 | 1428 | ||
1430 | static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 1429 | static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, |
1430 | snd_ctl_elem_info_t *uinfo) | ||
1431 | { | 1431 | { |
1432 | switch (kcontrol->private_value) { | 1432 | int reg = kcontrol->private_value & 0xffff; |
1433 | |||
1434 | switch (reg) { | ||
1433 | case YDSXGR_SPDIFOUTCTRL: break; | 1435 | case YDSXGR_SPDIFOUTCTRL: break; |
1434 | case YDSXGR_SPDIFINCTRL: break; | 1436 | case YDSXGR_SPDIFINCTRL: break; |
1435 | default: return -EINVAL; | 1437 | default: return -EINVAL; |
@@ -1441,30 +1443,35 @@ static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
1441 | return 0; | 1443 | return 0; |
1442 | } | 1444 | } |
1443 | 1445 | ||
1444 | static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1446 | static int snd_ymfpci_get_single(snd_kcontrol_t *kcontrol, |
1447 | snd_ctl_elem_value_t *ucontrol) | ||
1445 | { | 1448 | { |
1446 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1449 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1447 | int reg = kcontrol->private_value; | 1450 | int reg = kcontrol->private_value & 0xffff; |
1448 | unsigned int shift = 0, mask = 1; | 1451 | unsigned int shift = (kcontrol->private_value >> 16) & 0xff; |
1452 | unsigned int mask = 1; | ||
1449 | 1453 | ||
1450 | switch (kcontrol->private_value) { | 1454 | switch (reg) { |
1451 | case YDSXGR_SPDIFOUTCTRL: break; | 1455 | case YDSXGR_SPDIFOUTCTRL: break; |
1452 | case YDSXGR_SPDIFINCTRL: break; | 1456 | case YDSXGR_SPDIFINCTRL: break; |
1453 | default: return -EINVAL; | 1457 | default: return -EINVAL; |
1454 | } | 1458 | } |
1455 | ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; | 1459 | ucontrol->value.integer.value[0] = |
1460 | (snd_ymfpci_readl(chip, reg) >> shift) & mask; | ||
1456 | return 0; | 1461 | return 0; |
1457 | } | 1462 | } |
1458 | 1463 | ||
1459 | static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1464 | static int snd_ymfpci_put_single(snd_kcontrol_t *kcontrol, |
1465 | snd_ctl_elem_value_t *ucontrol) | ||
1460 | { | 1466 | { |
1461 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1467 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1462 | int reg = kcontrol->private_value; | 1468 | int reg = kcontrol->private_value & 0xffff; |
1463 | unsigned int shift = 0, mask = 1; | 1469 | unsigned int shift = (kcontrol->private_value >> 16) & 0xff; |
1470 | unsigned int mask = 1; | ||
1464 | int change; | 1471 | int change; |
1465 | unsigned int val, oval; | 1472 | unsigned int val, oval; |
1466 | 1473 | ||
1467 | switch (kcontrol->private_value) { | 1474 | switch (reg) { |
1468 | case YDSXGR_SPDIFOUTCTRL: break; | 1475 | case YDSXGR_SPDIFOUTCTRL: break; |
1469 | case YDSXGR_SPDIFINCTRL: break; | 1476 | case YDSXGR_SPDIFINCTRL: break; |
1470 | default: return -EINVAL; | 1477 | default: return -EINVAL; |
@@ -1583,8 +1590,9 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVO | |||
1583 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL), | 1590 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL), |
1584 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL), | 1591 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL), |
1585 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL), | 1592 | YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL), |
1586 | YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL), | 1593 | YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0), |
1587 | YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL), | 1594 | YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0), |
1595 | YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4), | ||
1588 | { | 1596 | { |
1589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1597 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1590 | .name = "4ch Duplication", | 1598 | .name = "4ch Duplication", |
@@ -1842,9 +1850,7 @@ static int snd_ymfpci_timer_start(snd_timer_t *timer) | |||
1842 | unsigned int count; | 1850 | unsigned int count; |
1843 | 1851 | ||
1844 | chip = snd_timer_chip(timer); | 1852 | chip = snd_timer_chip(timer); |
1845 | count = timer->sticks - 1; | 1853 | count = (timer->sticks << 1) - 1; |
1846 | if (count == 0) /* minimum time is 20.8 us */ | ||
1847 | count = 1; | ||
1848 | spin_lock_irqsave(&chip->reg_lock, flags); | 1854 | spin_lock_irqsave(&chip->reg_lock, flags); |
1849 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); | 1855 | snd_ymfpci_writew(chip, YDSXGR_TIMERCOUNT, count); |
1850 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); | 1856 | snd_ymfpci_writeb(chip, YDSXGR_TIMERCTRL, 0x03); |
@@ -1868,14 +1874,14 @@ static int snd_ymfpci_timer_precise_resolution(snd_timer_t *timer, | |||
1868 | unsigned long *num, unsigned long *den) | 1874 | unsigned long *num, unsigned long *den) |
1869 | { | 1875 | { |
1870 | *num = 1; | 1876 | *num = 1; |
1871 | *den = 96000; | 1877 | *den = 48000; |
1872 | return 0; | 1878 | return 0; |
1873 | } | 1879 | } |
1874 | 1880 | ||
1875 | static struct _snd_timer_hardware snd_ymfpci_timer_hw = { | 1881 | static struct _snd_timer_hardware snd_ymfpci_timer_hw = { |
1876 | .flags = SNDRV_TIMER_HW_AUTO, | 1882 | .flags = SNDRV_TIMER_HW_AUTO, |
1877 | .resolution = 10417, /* 1/2fs = 10.41666...us */ | 1883 | .resolution = 20833, /* 1/fs = 20.8333...us */ |
1878 | .ticks = 65536, | 1884 | .ticks = 0x8000, |
1879 | .start = snd_ymfpci_timer_start, | 1885 | .start = snd_ymfpci_timer_start, |
1880 | .stop = snd_ymfpci_timer_stop, | 1886 | .stop = snd_ymfpci_timer_stop, |
1881 | .precise_resolution = snd_ymfpci_timer_precise_resolution, | 1887 | .precise_resolution = snd_ymfpci_timer_precise_resolution, |
@@ -2142,14 +2148,8 @@ static int snd_ymfpci_free(ymfpci_t *chip) | |||
2142 | #ifdef CONFIG_PM | 2148 | #ifdef CONFIG_PM |
2143 | vfree(chip->saved_regs); | 2149 | vfree(chip->saved_regs); |
2144 | #endif | 2150 | #endif |
2145 | if (chip->mpu_res) { | 2151 | release_and_free_resource(chip->mpu_res); |
2146 | release_resource(chip->mpu_res); | 2152 | release_and_free_resource(chip->fm_res); |
2147 | kfree_nocheck(chip->mpu_res); | ||
2148 | } | ||
2149 | if (chip->fm_res) { | ||
2150 | release_resource(chip->fm_res); | ||
2151 | kfree_nocheck(chip->fm_res); | ||
2152 | } | ||
2153 | snd_ymfpci_free_gameport(chip); | 2153 | snd_ymfpci_free_gameport(chip); |
2154 | if (chip->reg_area_virt) | 2154 | if (chip->reg_area_virt) |
2155 | iounmap(chip->reg_area_virt); | 2155 | iounmap(chip->reg_area_virt); |
@@ -2158,10 +2158,7 @@ static int snd_ymfpci_free(ymfpci_t *chip) | |||
2158 | 2158 | ||
2159 | if (chip->irq >= 0) | 2159 | if (chip->irq >= 0) |
2160 | free_irq(chip->irq, (void *)chip); | 2160 | free_irq(chip->irq, (void *)chip); |
2161 | if (chip->res_reg_area) { | 2161 | release_and_free_resource(chip->res_reg_area); |
2162 | release_resource(chip->res_reg_area); | ||
2163 | kfree_nocheck(chip->res_reg_area); | ||
2164 | } | ||
2165 | 2162 | ||
2166 | pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); | 2163 | pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); |
2167 | 2164 | ||
@@ -2290,12 +2287,12 @@ int __devinit snd_ymfpci_create(snd_card_t * card, | |||
2290 | pci_set_master(pci); | 2287 | pci_set_master(pci); |
2291 | 2288 | ||
2292 | if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) { | 2289 | if ((chip->res_reg_area = request_mem_region(chip->reg_area_phys, 0x8000, "YMFPCI")) == NULL) { |
2293 | snd_printk("unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); | 2290 | snd_printk(KERN_ERR "unable to grab memory region 0x%lx-0x%lx\n", chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); |
2294 | snd_ymfpci_free(chip); | 2291 | snd_ymfpci_free(chip); |
2295 | return -EBUSY; | 2292 | return -EBUSY; |
2296 | } | 2293 | } |
2297 | if (request_irq(pci->irq, snd_ymfpci_interrupt, SA_INTERRUPT|SA_SHIRQ, "YMFPCI", (void *) chip)) { | 2294 | if (request_irq(pci->irq, snd_ymfpci_interrupt, SA_INTERRUPT|SA_SHIRQ, "YMFPCI", (void *) chip)) { |
2298 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 2295 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2299 | snd_ymfpci_free(chip); | 2296 | snd_ymfpci_free(chip); |
2300 | return -EBUSY; | 2297 | return -EBUSY; |
2301 | } | 2298 | } |
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 0a954dc11b73..20b86d8df7a3 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | |||
@@ -50,9 +50,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | |||
50 | if (runtime->dma_area) { | 50 | if (runtime->dma_area) { |
51 | if (runtime->dma_bytes >= size) | 51 | if (runtime->dma_bytes >= size) |
52 | return 0; /* already enough large */ | 52 | return 0; /* already enough large */ |
53 | vfree_nocheck(runtime->dma_area); | 53 | vfree(runtime->dma_area); |
54 | } | 54 | } |
55 | runtime->dma_area = vmalloc_nocheck(size); | 55 | runtime->dma_area = vmalloc_32(size); |
56 | if (! runtime->dma_area) | 56 | if (! runtime->dma_area) |
57 | return -ENOMEM; | 57 | return -ENOMEM; |
58 | runtime->dma_bytes = size; | 58 | runtime->dma_bytes = size; |
@@ -67,7 +67,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | |||
67 | { | 67 | { |
68 | snd_pcm_runtime_t *runtime = subs->runtime; | 68 | snd_pcm_runtime_t *runtime = subs->runtime; |
69 | if (runtime->dma_area) { | 69 | if (runtime->dma_area) { |
70 | vfree_nocheck(runtime->dma_area); | 70 | vfree(runtime->dma_area); |
71 | runtime->dma_area = NULL; | 71 | runtime->dma_area = NULL; |
72 | } | 72 | } |
73 | return 0; | 73 | return 0; |
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c index 1681ee13efbb..d4ec6cc3f1c5 100644 --- a/sound/ppc/beep.c +++ b/sound/ppc/beep.c | |||
@@ -171,8 +171,6 @@ static int snd_pmac_beep_event(struct input_dev *dev, unsigned int type, unsigne | |||
171 | * beep volume mixer | 171 | * beep volume mixer |
172 | */ | 172 | */ |
173 | 173 | ||
174 | #define chip_t pmac_t | ||
175 | |||
176 | static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 174 | static int snd_pmac_info_beep(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) |
177 | { | 175 | { |
178 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 176 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c index 392b2abd9f13..db2f1815fc30 100644 --- a/sound/ppc/pmac.c +++ b/sound/ppc/pmac.c | |||
@@ -220,7 +220,8 @@ static int snd_pmac_pcm_prepare(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substr | |||
220 | 220 | ||
221 | /* set up constraints */ | 221 | /* set up constraints */ |
222 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); | 222 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); |
223 | snd_runtime_check(astr, return -EINVAL); | 223 | if (! astr) |
224 | return -EINVAL; | ||
224 | astr->cur_freqs = 1 << rate_index; | 225 | astr->cur_freqs = 1 << rate_index; |
225 | astr->cur_formats = 1 << runtime->format; | 226 | astr->cur_formats = 1 << runtime->format; |
226 | chip->rate_index = rate_index; | 227 | chip->rate_index = rate_index; |
@@ -467,7 +468,8 @@ static int snd_pmac_hw_rule_rate(snd_pcm_hw_params_t *params, | |||
467 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 468 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
468 | int i, freq_table[8], num_freqs; | 469 | int i, freq_table[8], num_freqs; |
469 | 470 | ||
470 | snd_runtime_check(rec, return -EINVAL); | 471 | if (! rec) |
472 | return -EINVAL; | ||
471 | num_freqs = 0; | 473 | num_freqs = 0; |
472 | for (i = chip->num_freqs - 1; i >= 0; i--) { | 474 | for (i = chip->num_freqs - 1; i >= 0; i--) { |
473 | if (rec->cur_freqs & (1 << i)) | 475 | if (rec->cur_freqs & (1 << i)) |
@@ -484,7 +486,8 @@ static int snd_pmac_hw_rule_format(snd_pcm_hw_params_t *params, | |||
484 | pmac_t *chip = rule->private; | 486 | pmac_t *chip = rule->private; |
485 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); | 487 | pmac_stream_t *rec = snd_pmac_get_stream(chip, rule->deps[0]); |
486 | 488 | ||
487 | snd_runtime_check(rec, return -EINVAL); | 489 | if (! rec) |
490 | return -EINVAL; | ||
488 | return snd_mask_refine_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), | 491 | return snd_mask_refine_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), |
489 | rec->cur_formats); | 492 | rec->cur_formats); |
490 | } | 493 | } |
@@ -569,7 +572,8 @@ static int snd_pmac_pcm_close(pmac_t *chip, pmac_stream_t *rec, snd_pcm_substrea | |||
569 | snd_pmac_dma_stop(rec); | 572 | snd_pmac_dma_stop(rec); |
570 | 573 | ||
571 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); | 574 | astr = snd_pmac_get_stream(chip, another_stream(rec->stream)); |
572 | snd_runtime_check(astr, return -EINVAL); | 575 | if (! astr) |
576 | return -EINVAL; | ||
573 | 577 | ||
574 | /* reset constraints */ | 578 | /* reset constraints */ |
575 | astr->cur_freqs = chip->freqs_ok; | 579 | astr->cur_freqs = chip->freqs_ok; |
@@ -1158,7 +1162,6 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return) | |||
1158 | .dev_free = snd_pmac_dev_free, | 1162 | .dev_free = snd_pmac_dev_free, |
1159 | }; | 1163 | }; |
1160 | 1164 | ||
1161 | snd_runtime_check(chip_return, return -EINVAL); | ||
1162 | *chip_return = NULL; | 1165 | *chip_return = NULL; |
1163 | 1166 | ||
1164 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1167 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
@@ -1382,7 +1385,8 @@ static int snd_pmac_sleep_notify(struct pmu_sleep_notifier *self, int when) | |||
1382 | pmac_t *chip; | 1385 | pmac_t *chip; |
1383 | 1386 | ||
1384 | chip = sleeping_pmac; | 1387 | chip = sleeping_pmac; |
1385 | snd_runtime_check(chip, return 0); | 1388 | if (! chip) |
1389 | return 0; | ||
1386 | 1390 | ||
1387 | switch (when) { | 1391 | switch (when) { |
1388 | case PBOOK_SLEEP_NOW: | 1392 | case PBOOK_SLEEP_NOW: |
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index b5c4c15ae7f0..59a771294709 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
@@ -343,9 +343,6 @@ typedef struct snd_dbri { | |||
343 | struct snd_dbri *next; | 343 | struct snd_dbri *next; |
344 | } snd_dbri_t; | 344 | } snd_dbri_t; |
345 | 345 | ||
346 | /* Needed for the ALSA macros to work */ | ||
347 | #define chip_t snd_dbri_t | ||
348 | |||
349 | #define DBRI_MAX_VOLUME 63 /* Output volume */ | 346 | #define DBRI_MAX_VOLUME 63 /* Output volume */ |
350 | #define DBRI_MAX_GAIN 15 /* Input gain */ | 347 | #define DBRI_MAX_GAIN 15 /* Input gain */ |
351 | #define DBRI_RIGHT_BALANCE 255 | 348 | #define DBRI_RIGHT_BALANCE 255 |
@@ -1767,7 +1764,7 @@ play: | |||
1767 | spin_unlock_irqrestore(&dbri->lock, flags); | 1764 | spin_unlock_irqrestore(&dbri->lock, flags); |
1768 | } | 1765 | } |
1769 | 1766 | ||
1770 | DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0); | 1767 | static DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0); |
1771 | 1768 | ||
1772 | /* transmission_complete_intr() | 1769 | /* transmission_complete_intr() |
1773 | * | 1770 | * |
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index 751bf1272af3..bd71b73be657 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c | |||
@@ -171,7 +171,6 @@ snd_emux_note_off(void *p, int note, int vel, snd_midi_channel_t *chan) | |||
171 | vp = &emu->voices[ch]; | 171 | vp = &emu->voices[ch]; |
172 | if (STATE_IS_PLAYING(vp->state) && | 172 | if (STATE_IS_PLAYING(vp->state) && |
173 | vp->chan == chan && vp->key == note) { | 173 | vp->chan == chan && vp->key == note) { |
174 | vp->time = emu->use_time++; | ||
175 | vp->state = SNDRV_EMUX_ST_RELEASED; | 174 | vp->state = SNDRV_EMUX_ST_RELEASED; |
176 | if (vp->ontime == jiffies) { | 175 | if (vp->ontime == jiffies) { |
177 | /* if note-off is sent too shortly after | 176 | /* if note-off is sent too shortly after |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 2ead878bcb8f..99dae024b640 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <sound/driver.h> | 41 | #include <sound/driver.h> |
42 | #include <linux/bitops.h> | 42 | #include <linux/bitops.h> |
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/interrupt.h> | ||
45 | #include <linux/list.h> | 44 | #include <linux/list.h> |
46 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
47 | #include <linux/string.h> | 46 | #include <linux/string.h> |
@@ -185,7 +184,6 @@ struct snd_usb_substream { | |||
185 | unsigned int num_formats; /* number of supported audio formats (list) */ | 184 | unsigned int num_formats; /* number of supported audio formats (list) */ |
186 | struct list_head fmt_list; /* format list */ | 185 | struct list_head fmt_list; /* format list */ |
187 | spinlock_t lock; | 186 | spinlock_t lock; |
188 | struct tasklet_struct start_period_elapsed; /* for start trigger */ | ||
189 | 187 | ||
190 | struct snd_urb_ops ops; /* callbacks (must be filled at init) */ | 188 | struct snd_urb_ops ops; /* callbacks (must be filled at init) */ |
191 | }; | 189 | }; |
@@ -480,6 +478,28 @@ static int retire_playback_sync_urb_hs(snd_usb_substream_t *subs, | |||
480 | } | 478 | } |
481 | 479 | ||
482 | /* | 480 | /* |
481 | * Prepare urb for streaming before playback starts. | ||
482 | * | ||
483 | * We don't care about (or have) any data, so we just send a transfer delimiter. | ||
484 | */ | ||
485 | static int prepare_startup_playback_urb(snd_usb_substream_t *subs, | ||
486 | snd_pcm_runtime_t *runtime, | ||
487 | struct urb *urb) | ||
488 | { | ||
489 | unsigned int i; | ||
490 | snd_urb_ctx_t *ctx = urb->context; | ||
491 | |||
492 | urb->dev = ctx->subs->dev; | ||
493 | urb->number_of_packets = subs->packs_per_ms; | ||
494 | for (i = 0; i < subs->packs_per_ms; ++i) { | ||
495 | urb->iso_frame_desc[i].offset = 0; | ||
496 | urb->iso_frame_desc[i].length = 0; | ||
497 | } | ||
498 | urb->transfer_buffer_length = 0; | ||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | /* | ||
483 | * prepare urb for playback data pipe | 503 | * prepare urb for playback data pipe |
484 | * | 504 | * |
485 | * Since a URB can handle only a single linear buffer, we must use double | 505 | * Since a URB can handle only a single linear buffer, we must use double |
@@ -568,12 +588,8 @@ static int prepare_playback_urb(snd_usb_substream_t *subs, | |||
568 | subs->hwptr_done -= runtime->buffer_size; | 588 | subs->hwptr_done -= runtime->buffer_size; |
569 | spin_unlock_irqrestore(&subs->lock, flags); | 589 | spin_unlock_irqrestore(&subs->lock, flags); |
570 | urb->transfer_buffer_length = offs * stride; | 590 | urb->transfer_buffer_length = offs * stride; |
571 | if (period_elapsed) { | 591 | if (period_elapsed) |
572 | if (likely(subs->running)) | 592 | snd_pcm_period_elapsed(subs->pcm_substream); |
573 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
574 | else | ||
575 | tasklet_hi_schedule(&subs->start_period_elapsed); | ||
576 | } | ||
577 | return 0; | 593 | return 0; |
578 | } | 594 | } |
579 | 595 | ||
@@ -588,22 +604,12 @@ static int retire_playback_urb(snd_usb_substream_t *subs, | |||
588 | return 0; | 604 | return 0; |
589 | } | 605 | } |
590 | 606 | ||
591 | /* | ||
592 | * Delay the snd_pcm_period_elapsed() call until after the start trigger | ||
593 | * callback so that we're not longer in the substream's lock. | ||
594 | */ | ||
595 | static void start_period_elapsed(unsigned long data) | ||
596 | { | ||
597 | snd_usb_substream_t *subs = (snd_usb_substream_t *)data; | ||
598 | snd_pcm_period_elapsed(subs->pcm_substream); | ||
599 | } | ||
600 | |||
601 | 607 | ||
602 | /* | 608 | /* |
603 | */ | 609 | */ |
604 | static struct snd_urb_ops audio_urb_ops[2] = { | 610 | static struct snd_urb_ops audio_urb_ops[2] = { |
605 | { | 611 | { |
606 | .prepare = prepare_playback_urb, | 612 | .prepare = prepare_startup_playback_urb, |
607 | .retire = retire_playback_urb, | 613 | .retire = retire_playback_urb, |
608 | .prepare_sync = prepare_playback_sync_urb, | 614 | .prepare_sync = prepare_playback_sync_urb, |
609 | .retire_sync = retire_playback_sync_urb, | 615 | .retire_sync = retire_playback_sync_urb, |
@@ -618,7 +624,7 @@ static struct snd_urb_ops audio_urb_ops[2] = { | |||
618 | 624 | ||
619 | static struct snd_urb_ops audio_urb_ops_high_speed[2] = { | 625 | static struct snd_urb_ops audio_urb_ops_high_speed[2] = { |
620 | { | 626 | { |
621 | .prepare = prepare_playback_urb, | 627 | .prepare = prepare_startup_playback_urb, |
622 | .retire = retire_playback_urb, | 628 | .retire = retire_playback_urb, |
623 | .prepare_sync = prepare_playback_sync_urb_hs, | 629 | .prepare_sync = prepare_playback_sync_urb_hs, |
624 | .retire_sync = retire_playback_sync_urb_hs, | 630 | .retire_sync = retire_playback_sync_urb_hs, |
@@ -692,9 +698,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | |||
692 | if (runtime->dma_area) { | 698 | if (runtime->dma_area) { |
693 | if (runtime->dma_bytes >= size) | 699 | if (runtime->dma_bytes >= size) |
694 | return 0; /* already large enough */ | 700 | return 0; /* already large enough */ |
695 | vfree_nocheck(runtime->dma_area); | 701 | vfree(runtime->dma_area); |
696 | } | 702 | } |
697 | runtime->dma_area = vmalloc_nocheck(size); | 703 | runtime->dma_area = vmalloc(size); |
698 | if (! runtime->dma_area) | 704 | if (! runtime->dma_area) |
699 | return -ENOMEM; | 705 | return -ENOMEM; |
700 | runtime->dma_bytes = size; | 706 | runtime->dma_bytes = size; |
@@ -706,7 +712,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | |||
706 | { | 712 | { |
707 | snd_pcm_runtime_t *runtime = subs->runtime; | 713 | snd_pcm_runtime_t *runtime = subs->runtime; |
708 | if (runtime->dma_area) { | 714 | if (runtime->dma_area) { |
709 | vfree_nocheck(runtime->dma_area); | 715 | vfree(runtime->dma_area); |
710 | runtime->dma_area = NULL; | 716 | runtime->dma_area = NULL; |
711 | } | 717 | } |
712 | return 0; | 718 | return 0; |
@@ -838,8 +844,7 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) | |||
838 | } | 844 | } |
839 | if (! alive) | 845 | if (! alive) |
840 | break; | 846 | break; |
841 | set_current_state(TASK_UNINTERRUPTIBLE); | 847 | schedule_timeout_uninterruptible(1); |
842 | schedule_timeout(1); | ||
843 | } while (time_before(jiffies, end_time)); | 848 | } while (time_before(jiffies, end_time)); |
844 | if (alive) | 849 | if (alive) |
845 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); | 850 | snd_printk(KERN_ERR "timeout: still %d active urbs..\n", alive); |
@@ -864,25 +869,40 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) | |||
864 | 869 | ||
865 | 870 | ||
866 | /* | 871 | /* |
867 | * start/stop substream | 872 | * start/stop playback substream |
868 | */ | 873 | */ |
869 | static int snd_usb_pcm_trigger(snd_pcm_substream_t *substream, int cmd) | 874 | static int snd_usb_pcm_playback_trigger(snd_pcm_substream_t *substream, |
875 | int cmd) | ||
870 | { | 876 | { |
871 | snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; | 877 | snd_usb_substream_t *subs = substream->runtime->private_data; |
872 | int err; | ||
873 | 878 | ||
874 | switch (cmd) { | 879 | switch (cmd) { |
875 | case SNDRV_PCM_TRIGGER_START: | 880 | case SNDRV_PCM_TRIGGER_START: |
876 | err = start_urbs(subs, substream->runtime); | 881 | subs->ops.prepare = prepare_playback_urb; |
877 | break; | 882 | return 0; |
878 | case SNDRV_PCM_TRIGGER_STOP: | 883 | case SNDRV_PCM_TRIGGER_STOP: |
879 | err = deactivate_urbs(subs, 0, 0); | 884 | return deactivate_urbs(subs, 0, 0); |
880 | break; | ||
881 | default: | 885 | default: |
882 | err = -EINVAL; | 886 | return -EINVAL; |
883 | break; | 887 | } |
888 | } | ||
889 | |||
890 | /* | ||
891 | * start/stop capture substream | ||
892 | */ | ||
893 | static int snd_usb_pcm_capture_trigger(snd_pcm_substream_t *substream, | ||
894 | int cmd) | ||
895 | { | ||
896 | snd_usb_substream_t *subs = substream->runtime->private_data; | ||
897 | |||
898 | switch (cmd) { | ||
899 | case SNDRV_PCM_TRIGGER_START: | ||
900 | return start_urbs(subs, substream->runtime); | ||
901 | case SNDRV_PCM_TRIGGER_STOP: | ||
902 | return deactivate_urbs(subs, 0, 0); | ||
903 | default: | ||
904 | return -EINVAL; | ||
884 | } | 905 | } |
885 | return err < 0 ? err : 0; | ||
886 | } | 906 | } |
887 | 907 | ||
888 | 908 | ||
@@ -1044,7 +1064,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
1044 | u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | 1064 | u->urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
1045 | u->urb->interval = 1 << subs->datainterval; | 1065 | u->urb->interval = 1 << subs->datainterval; |
1046 | u->urb->context = u; | 1066 | u->urb->context = u; |
1047 | u->urb->complete = snd_usb_complete_callback(snd_complete_urb); | 1067 | u->urb->complete = snd_complete_urb; |
1048 | } | 1068 | } |
1049 | 1069 | ||
1050 | if (subs->syncpipe) { | 1070 | if (subs->syncpipe) { |
@@ -1070,7 +1090,7 @@ static int init_substream_urbs(snd_usb_substream_t *subs, unsigned int period_by | |||
1070 | u->urb->number_of_packets = 1; | 1090 | u->urb->number_of_packets = 1; |
1071 | u->urb->interval = 1 << subs->syncinterval; | 1091 | u->urb->interval = 1 << subs->syncinterval; |
1072 | u->urb->context = u; | 1092 | u->urb->context = u; |
1073 | u->urb->complete = snd_usb_complete_callback(snd_complete_sync_urb); | 1093 | u->urb->complete = snd_complete_sync_urb; |
1074 | } | 1094 | } |
1075 | } | 1095 | } |
1076 | return 0; | 1096 | return 0; |
@@ -1414,7 +1434,7 @@ static int snd_usb_hw_free(snd_pcm_substream_t *substream) | |||
1414 | static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) | 1434 | static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) |
1415 | { | 1435 | { |
1416 | snd_pcm_runtime_t *runtime = substream->runtime; | 1436 | snd_pcm_runtime_t *runtime = substream->runtime; |
1417 | snd_usb_substream_t *subs = (snd_usb_substream_t *)runtime->private_data; | 1437 | snd_usb_substream_t *subs = runtime->private_data; |
1418 | 1438 | ||
1419 | if (! subs->cur_audiofmt) { | 1439 | if (! subs->cur_audiofmt) { |
1420 | snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); | 1440 | snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); |
@@ -1434,7 +1454,13 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream) | |||
1434 | deactivate_urbs(subs, 0, 1); | 1454 | deactivate_urbs(subs, 0, 1); |
1435 | wait_clear_urbs(subs); | 1455 | wait_clear_urbs(subs); |
1436 | 1456 | ||
1437 | return 0; | 1457 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
1458 | * updates for all URBs would happen at the same time when starting */ | ||
1459 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1460 | subs->ops.prepare = prepare_startup_playback_urb; | ||
1461 | return start_urbs(subs, runtime); | ||
1462 | } else | ||
1463 | return 0; | ||
1438 | } | 1464 | } |
1439 | 1465 | ||
1440 | static snd_pcm_hardware_t snd_usb_playback = | 1466 | static snd_pcm_hardware_t snd_usb_playback = |
@@ -1848,7 +1874,7 @@ static snd_pcm_ops_t snd_usb_playback_ops = { | |||
1848 | .hw_params = snd_usb_hw_params, | 1874 | .hw_params = snd_usb_hw_params, |
1849 | .hw_free = snd_usb_hw_free, | 1875 | .hw_free = snd_usb_hw_free, |
1850 | .prepare = snd_usb_pcm_prepare, | 1876 | .prepare = snd_usb_pcm_prepare, |
1851 | .trigger = snd_usb_pcm_trigger, | 1877 | .trigger = snd_usb_pcm_playback_trigger, |
1852 | .pointer = snd_usb_pcm_pointer, | 1878 | .pointer = snd_usb_pcm_pointer, |
1853 | .page = snd_pcm_get_vmalloc_page, | 1879 | .page = snd_pcm_get_vmalloc_page, |
1854 | }; | 1880 | }; |
@@ -1860,7 +1886,7 @@ static snd_pcm_ops_t snd_usb_capture_ops = { | |||
1860 | .hw_params = snd_usb_hw_params, | 1886 | .hw_params = snd_usb_hw_params, |
1861 | .hw_free = snd_usb_hw_free, | 1887 | .hw_free = snd_usb_hw_free, |
1862 | .prepare = snd_usb_pcm_prepare, | 1888 | .prepare = snd_usb_pcm_prepare, |
1863 | .trigger = snd_usb_pcm_trigger, | 1889 | .trigger = snd_usb_pcm_capture_trigger, |
1864 | .pointer = snd_usb_pcm_pointer, | 1890 | .pointer = snd_usb_pcm_pointer, |
1865 | .page = snd_pcm_get_vmalloc_page, | 1891 | .page = snd_pcm_get_vmalloc_page, |
1866 | }; | 1892 | }; |
@@ -2079,9 +2105,6 @@ static void init_substream(snd_usb_stream_t *as, int stream, struct audioformat | |||
2079 | 2105 | ||
2080 | INIT_LIST_HEAD(&subs->fmt_list); | 2106 | INIT_LIST_HEAD(&subs->fmt_list); |
2081 | spin_lock_init(&subs->lock); | 2107 | spin_lock_init(&subs->lock); |
2082 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
2083 | tasklet_init(&subs->start_period_elapsed, start_period_elapsed, | ||
2084 | (unsigned long)subs); | ||
2085 | 2108 | ||
2086 | subs->stream = as; | 2109 | subs->stream = as; |
2087 | subs->direction = stream; | 2110 | subs->direction = stream; |
@@ -2755,9 +2778,9 @@ static int create_fixed_stream_quirk(snd_usb_audio_t *chip, | |||
2755 | /* | 2778 | /* |
2756 | * create a stream for an interface with proper descriptors | 2779 | * create a stream for an interface with proper descriptors |
2757 | */ | 2780 | */ |
2758 | static int create_standard_interface_quirk(snd_usb_audio_t *chip, | 2781 | static int create_standard_audio_quirk(snd_usb_audio_t *chip, |
2759 | struct usb_interface *iface, | 2782 | struct usb_interface *iface, |
2760 | const snd_usb_audio_quirk_t *quirk) | 2783 | const snd_usb_audio_quirk_t *quirk) |
2761 | { | 2784 | { |
2762 | struct usb_host_interface *alts; | 2785 | struct usb_host_interface *alts; |
2763 | struct usb_interface_descriptor *altsd; | 2786 | struct usb_interface_descriptor *altsd; |
@@ -2765,24 +2788,14 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip, | |||
2765 | 2788 | ||
2766 | alts = &iface->altsetting[0]; | 2789 | alts = &iface->altsetting[0]; |
2767 | altsd = get_iface_desc(alts); | 2790 | altsd = get_iface_desc(alts); |
2768 | switch (quirk->type) { | 2791 | err = parse_audio_endpoints(chip, altsd->bInterfaceNumber); |
2769 | case QUIRK_AUDIO_STANDARD_INTERFACE: | ||
2770 | err = parse_audio_endpoints(chip, altsd->bInterfaceNumber); | ||
2771 | if (!err) | ||
2772 | usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0); /* reset the current interface */ | ||
2773 | break; | ||
2774 | case QUIRK_MIDI_STANDARD_INTERFACE: | ||
2775 | err = snd_usb_create_midi_interface(chip, iface, NULL); | ||
2776 | break; | ||
2777 | default: | ||
2778 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | ||
2779 | return -ENXIO; | ||
2780 | } | ||
2781 | if (err < 0) { | 2792 | if (err < 0) { |
2782 | snd_printk(KERN_ERR "cannot setup if %d: error %d\n", | 2793 | snd_printk(KERN_ERR "cannot setup if %d: error %d\n", |
2783 | altsd->bInterfaceNumber, err); | 2794 | altsd->bInterfaceNumber, err); |
2784 | return err; | 2795 | return err; |
2785 | } | 2796 | } |
2797 | /* reset the current interface */ | ||
2798 | usb_set_interface(chip->dev, altsd->bInterfaceNumber, 0); | ||
2786 | return 0; | 2799 | return 0; |
2787 | } | 2800 | } |
2788 | 2801 | ||
@@ -3044,7 +3057,7 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip, | |||
3044 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, | 3057 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, |
3045 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, | 3058 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, |
3046 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, | 3059 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, |
3047 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk, | 3060 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, |
3048 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, | 3061 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
3049 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, | 3062 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, |
3050 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, | 3063 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
@@ -3222,7 +3235,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
3222 | struct usb_interface *intf, | 3235 | struct usb_interface *intf, |
3223 | const struct usb_device_id *usb_id) | 3236 | const struct usb_device_id *usb_id) |
3224 | { | 3237 | { |
3225 | struct usb_host_config *config = dev->actconfig; | ||
3226 | const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)usb_id->driver_info; | 3238 | const snd_usb_audio_quirk_t *quirk = (const snd_usb_audio_quirk_t *)usb_id->driver_info; |
3227 | int i, err; | 3239 | int i, err; |
3228 | snd_usb_audio_t *chip; | 3240 | snd_usb_audio_t *chip; |
@@ -3243,7 +3255,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
3243 | if (id == USB_ID(0x041e, 0x3000)) { | 3255 | if (id == USB_ID(0x041e, 0x3000)) { |
3244 | if (snd_usb_extigy_boot_quirk(dev, intf) < 0) | 3256 | if (snd_usb_extigy_boot_quirk(dev, intf) < 0) |
3245 | goto __err_val; | 3257 | goto __err_val; |
3246 | config = dev->actconfig; | ||
3247 | } | 3258 | } |
3248 | /* SB Audigy 2 NX needs its own boot-up magic, too */ | 3259 | /* SB Audigy 2 NX needs its own boot-up magic, too */ |
3249 | if (id == USB_ID(0x041e, 0x3020)) { | 3260 | if (id == USB_ID(0x041e, 0x3020)) { |
@@ -3272,11 +3283,6 @@ static void *snd_usb_audio_probe(struct usb_device *dev, | |||
3272 | /* it's a fresh one. | 3283 | /* it's a fresh one. |
3273 | * now look for an empty slot and create a new card instance | 3284 | * now look for an empty slot and create a new card instance |
3274 | */ | 3285 | */ |
3275 | /* first, set the current configuration for this device */ | ||
3276 | if (usb_reset_configuration(dev) < 0) { | ||
3277 | snd_printk(KERN_ERR "cannot reset configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue); | ||
3278 | goto __error; | ||
3279 | } | ||
3280 | for (i = 0; i < SNDRV_CARDS; i++) | 3286 | for (i = 0; i < SNDRV_CARDS; i++) |
3281 | if (enable[i] && ! usb_chip[i] && | 3287 | if (enable[i] && ! usb_chip[i] && |
3282 | (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && | 3288 | (vid[i] == -1 || vid[i] == USB_ID_VENDOR(id)) && |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index ad9eab211d8f..b5802022bb19 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -249,14 +249,6 @@ void snd_usbmidi_disconnect(struct list_head *p); | |||
249 | #define get_cfg_desc(cfg) (&(cfg)->desc) | 249 | #define get_cfg_desc(cfg) (&(cfg)->desc) |
250 | #endif | 250 | #endif |
251 | 251 | ||
252 | #ifndef usb_pipe_needs_resubmit | ||
253 | #define usb_pipe_needs_resubmit(pipe) 1 | ||
254 | #endif | ||
255 | |||
256 | #ifndef snd_usb_complete_callback | ||
257 | #define snd_usb_complete_callback(x) (x) | ||
258 | #endif | ||
259 | |||
260 | #ifndef snd_usb_get_speed | 252 | #ifndef snd_usb_get_speed |
261 | #define snd_usb_get_speed(dev) ((dev)->speed) | 253 | #define snd_usb_get_speed(dev) ((dev)->speed) |
262 | #endif | 254 | #endif |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index f1a2e2c2e02f..f8aa662562a0 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -47,7 +47,6 @@ | |||
47 | #include <linux/timer.h> | 47 | #include <linux/timer.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <sound/core.h> | 49 | #include <sound/core.h> |
50 | #include <sound/minors.h> | ||
51 | #include <sound/rawmidi.h> | 50 | #include <sound/rawmidi.h> |
52 | #include "usbaudio.h" | 51 | #include "usbaudio.h" |
53 | 52 | ||
@@ -246,10 +245,8 @@ static void snd_usbmidi_in_urb_complete(struct urb* urb, struct pt_regs *regs) | |||
246 | } | 245 | } |
247 | } | 246 | } |
248 | 247 | ||
249 | if (usb_pipe_needs_resubmit(urb->pipe)) { | 248 | urb->dev = ep->umidi->chip->dev; |
250 | urb->dev = ep->umidi->chip->dev; | 249 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); |
251 | snd_usbmidi_submit_urb(urb, GFP_ATOMIC); | ||
252 | } | ||
253 | } | 250 | } |
254 | 251 | ||
255 | static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) | 252 | static void snd_usbmidi_out_urb_complete(struct urb* urb, struct pt_regs *regs) |
@@ -863,13 +860,12 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi, | |||
863 | return -ENOMEM; | 860 | return -ENOMEM; |
864 | } | 861 | } |
865 | if (ep_info->in_interval) | 862 | if (ep_info->in_interval) |
866 | usb_fill_int_urb(ep->urb, umidi->chip->dev, pipe, buffer, length, | 863 | usb_fill_int_urb(ep->urb, umidi->chip->dev, pipe, buffer, |
867 | snd_usb_complete_callback(snd_usbmidi_in_urb_complete), | 864 | length, snd_usbmidi_in_urb_complete, ep, |
868 | ep, ep_info->in_interval); | 865 | ep_info->in_interval); |
869 | else | 866 | else |
870 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, length, | 867 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, |
871 | snd_usb_complete_callback(snd_usbmidi_in_urb_complete), | 868 | length, snd_usbmidi_in_urb_complete, ep); |
872 | ep); | ||
873 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 869 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
874 | 870 | ||
875 | rep->in = ep; | 871 | rep->in = ep; |
@@ -933,8 +929,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi, | |||
933 | return -ENOMEM; | 929 | return -ENOMEM; |
934 | } | 930 | } |
935 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, | 931 | usb_fill_bulk_urb(ep->urb, umidi->chip->dev, pipe, buffer, |
936 | ep->max_transfer, | 932 | ep->max_transfer, snd_usbmidi_out_urb_complete, ep); |
937 | snd_usb_complete_callback(snd_usbmidi_out_urb_complete), ep); | ||
938 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 933 | ep->urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; |
939 | 934 | ||
940 | spin_lock_init(&ep->buffer_lock); | 935 | spin_lock_init(&ep->buffer_lock); |
@@ -1550,46 +1545,45 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip, | |||
1550 | 1545 | ||
1551 | /* detect the endpoint(s) to use */ | 1546 | /* detect the endpoint(s) to use */ |
1552 | memset(endpoints, 0, sizeof(endpoints)); | 1547 | memset(endpoints, 0, sizeof(endpoints)); |
1553 | if (!quirk) { | 1548 | switch (quirk ? quirk->type : QUIRK_MIDI_STANDARD_INTERFACE) { |
1549 | case QUIRK_MIDI_STANDARD_INTERFACE: | ||
1554 | err = snd_usbmidi_get_ms_info(umidi, endpoints); | 1550 | err = snd_usbmidi_get_ms_info(umidi, endpoints); |
1555 | } else { | 1551 | break; |
1556 | switch (quirk->type) { | 1552 | case QUIRK_MIDI_FIXED_ENDPOINT: |
1557 | case QUIRK_MIDI_FIXED_ENDPOINT: | 1553 | memcpy(&endpoints[0], quirk->data, |
1558 | memcpy(&endpoints[0], quirk->data, | 1554 | sizeof(snd_usb_midi_endpoint_info_t)); |
1559 | sizeof(snd_usb_midi_endpoint_info_t)); | 1555 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1560 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1556 | break; |
1561 | break; | 1557 | case QUIRK_MIDI_YAMAHA: |
1562 | case QUIRK_MIDI_YAMAHA: | 1558 | err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]); |
1563 | err = snd_usbmidi_detect_yamaha(umidi, &endpoints[0]); | 1559 | break; |
1564 | break; | 1560 | case QUIRK_MIDI_MIDIMAN: |
1565 | case QUIRK_MIDI_MIDIMAN: | 1561 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; |
1566 | umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; | 1562 | memcpy(&endpoints[0], quirk->data, |
1567 | memcpy(&endpoints[0], quirk->data, | 1563 | sizeof(snd_usb_midi_endpoint_info_t)); |
1568 | sizeof(snd_usb_midi_endpoint_info_t)); | 1564 | err = 0; |
1569 | err = 0; | 1565 | break; |
1570 | break; | 1566 | case QUIRK_MIDI_NOVATION: |
1571 | case QUIRK_MIDI_NOVATION: | 1567 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; |
1572 | umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; | 1568 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1573 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1569 | break; |
1574 | break; | 1570 | case QUIRK_MIDI_RAW: |
1575 | case QUIRK_MIDI_RAW: | 1571 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; |
1576 | umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; | 1572 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1577 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1573 | break; |
1578 | break; | 1574 | case QUIRK_MIDI_EMAGIC: |
1579 | case QUIRK_MIDI_EMAGIC: | 1575 | umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; |
1580 | umidi->usb_protocol_ops = &snd_usbmidi_emagic_ops; | 1576 | memcpy(&endpoints[0], quirk->data, |
1581 | memcpy(&endpoints[0], quirk->data, | 1577 | sizeof(snd_usb_midi_endpoint_info_t)); |
1582 | sizeof(snd_usb_midi_endpoint_info_t)); | 1578 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); |
1583 | err = snd_usbmidi_detect_endpoints(umidi, &endpoints[0], 1); | 1579 | break; |
1584 | break; | 1580 | case QUIRK_MIDI_MIDITECH: |
1585 | case QUIRK_MIDI_MIDITECH: | 1581 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); |
1586 | err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); | 1582 | break; |
1587 | break; | 1583 | default: |
1588 | default: | 1584 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); |
1589 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | 1585 | err = -ENXIO; |
1590 | err = -ENXIO; | 1586 | break; |
1591 | break; | ||
1592 | } | ||
1593 | } | 1587 | } |
1594 | if (err < 0) { | 1588 | if (err < 0) { |
1595 | kfree(umidi); | 1589 | kfree(umidi); |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index c3c08c9cb46e..e570d140258d 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -911,7 +911,7 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, | |||
911 | case USB_ID(0x0672, 0x1041): | 911 | case USB_ID(0x0672, 0x1041): |
912 | if (!strcmp(kctl->id.name, "PCM Playback Volume") && | 912 | if (!strcmp(kctl->id.name, "PCM Playback Volume") && |
913 | cval->min == -15616) { | 913 | cval->min == -15616) { |
914 | snd_printk("using volume control quirk for the UDA1321/N101 chip\n"); | 914 | snd_printk(KERN_INFO "using volume control quirk for the UDA1321/N101 chip\n"); |
915 | cval->max = -256; | 915 | cval->max = -256; |
916 | } | 916 | } |
917 | } | 917 | } |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index 948759da6563..ba506c3871f4 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -294,6 +294,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
294 | } | 294 | } |
295 | }, | 295 | }, |
296 | { | 296 | { |
297 | /* a later revision uses ID 0x0099 */ | ||
297 | USB_DEVICE(0x0582, 0x0005), | 298 | USB_DEVICE(0x0582, 0x0005), |
298 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 299 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
299 | .vendor_name = "EDIROL", | 300 | .vendor_name = "EDIROL", |
@@ -384,6 +385,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
384 | } | 385 | } |
385 | }, | 386 | }, |
386 | { | 387 | { |
388 | /* a later revision uses ID 0x009d */ | ||
387 | USB_DEVICE(0x0582, 0x0009), | 389 | USB_DEVICE(0x0582, 0x0009), |
388 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 390 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
389 | .vendor_name = "EDIROL", | 391 | .vendor_name = "EDIROL", |
@@ -532,6 +534,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
532 | } | 534 | } |
533 | }, | 535 | }, |
534 | { | 536 | { |
537 | /* has ID 0x0013 when not in "Advanced Driver" mode */ | ||
535 | USB_DEVICE(0x0582, 0x0012), | 538 | USB_DEVICE(0x0582, 0x0012), |
536 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 539 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
537 | .vendor_name = "Roland", | 540 | .vendor_name = "Roland", |
@@ -545,6 +548,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
545 | } | 548 | } |
546 | }, | 549 | }, |
547 | { | 550 | { |
551 | /* has ID 0x0015 when not in "Advanced Driver" mode */ | ||
548 | USB_DEVICE(0x0582, 0x0014), | 552 | USB_DEVICE(0x0582, 0x0014), |
549 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 553 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
550 | .vendor_name = "EDIROL", | 554 | .vendor_name = "EDIROL", |
@@ -558,6 +562,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
558 | } | 562 | } |
559 | }, | 563 | }, |
560 | { | 564 | { |
565 | /* has ID 0x0017 when not in "Advanced Driver" mode */ | ||
561 | USB_DEVICE(0x0582, 0x0016), | 566 | USB_DEVICE(0x0582, 0x0016), |
562 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 567 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
563 | .vendor_name = "EDIROL", | 568 | .vendor_name = "EDIROL", |
@@ -588,6 +593,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
588 | } | 593 | } |
589 | }, | 594 | }, |
590 | { | 595 | { |
596 | /* has ID 0x001c when not in "Advanced Driver" mode */ | ||
591 | USB_DEVICE(0x0582, 0x001b), | 597 | USB_DEVICE(0x0582, 0x001b), |
592 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 598 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
593 | .vendor_name = "Roland", | 599 | .vendor_name = "Roland", |
@@ -618,6 +624,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
618 | } | 624 | } |
619 | }, | 625 | }, |
620 | { | 626 | { |
627 | /* has ID 0x001e when not in "Advanced Driver" mode */ | ||
621 | USB_DEVICE(0x0582, 0x001d), | 628 | USB_DEVICE(0x0582, 0x001d), |
622 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 629 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
623 | .vendor_name = "Roland", | 630 | .vendor_name = "Roland", |
@@ -631,6 +638,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
631 | } | 638 | } |
632 | }, | 639 | }, |
633 | { | 640 | { |
641 | /* has ID 0x0024 when not in "Advanced Driver" mode */ | ||
634 | USB_DEVICE(0x0582, 0x0023), | 642 | USB_DEVICE(0x0582, 0x0023), |
635 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 643 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
636 | .vendor_name = "EDIROL", | 644 | .vendor_name = "EDIROL", |
@@ -675,6 +683,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
675 | } | 683 | } |
676 | }, | 684 | }, |
677 | { | 685 | { |
686 | /* has ID 0x0028 when not in "Advanced Driver" mode */ | ||
678 | USB_DEVICE(0x0582, 0x0027), | 687 | USB_DEVICE(0x0582, 0x0027), |
679 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 688 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
680 | .vendor_name = "EDIROL", | 689 | .vendor_name = "EDIROL", |
@@ -688,6 +697,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
688 | } | 697 | } |
689 | }, | 698 | }, |
690 | { | 699 | { |
700 | /* has ID 0x002a when not in "Advanced Driver" mode */ | ||
691 | USB_DEVICE(0x0582, 0x0029), | 701 | USB_DEVICE(0x0582, 0x0029), |
692 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 702 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
693 | .vendor_name = "EDIROL", | 703 | .vendor_name = "EDIROL", |
@@ -732,6 +742,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
732 | } | 742 | } |
733 | }, | 743 | }, |
734 | { | 744 | { |
745 | /* has ID 0x002e when not in "Advanced Driver" mode */ | ||
735 | USB_DEVICE(0x0582, 0x002d), | 746 | USB_DEVICE(0x0582, 0x002d), |
736 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 747 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
737 | .vendor_name = "Roland", | 748 | .vendor_name = "Roland", |
@@ -745,6 +756,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
745 | } | 756 | } |
746 | }, | 757 | }, |
747 | { | 758 | { |
759 | /* has ID 0x0030 when not in "Advanced Driver" mode */ | ||
748 | USB_DEVICE(0x0582, 0x002f), | 760 | USB_DEVICE(0x0582, 0x002f), |
749 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 761 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
750 | .vendor_name = "Roland", | 762 | .vendor_name = "Roland", |
@@ -758,6 +770,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
758 | } | 770 | } |
759 | }, | 771 | }, |
760 | { | 772 | { |
773 | /* has ID 0x0034 when not in "Advanced Driver" mode */ | ||
761 | USB_DEVICE(0x0582, 0x0033), | 774 | USB_DEVICE(0x0582, 0x0033), |
762 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 775 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
763 | .vendor_name = "EDIROL", | 776 | .vendor_name = "EDIROL", |
@@ -770,7 +783,12 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
770 | } | 783 | } |
771 | } | 784 | } |
772 | }, | 785 | }, |
786 | /* TODO: add Roland M-1000 support */ | ||
773 | { | 787 | { |
788 | /* | ||
789 | * Has ID 0x0038 when not in "Advanced Driver" mode; | ||
790 | * later revisions use IDs 0x0054 and 0x00a2. | ||
791 | */ | ||
774 | USB_DEVICE(0x0582, 0x0037), | 792 | USB_DEVICE(0x0582, 0x0037), |
775 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 793 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
776 | .vendor_name = "Roland", | 794 | .vendor_name = "Roland", |
@@ -815,6 +833,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
815 | } | 833 | } |
816 | }, | 834 | }, |
817 | { | 835 | { |
836 | /* has ID 0x0041 when not in "Advanced Driver" mode */ | ||
818 | USB_DEVICE(0x0582, 0x0040), | 837 | USB_DEVICE(0x0582, 0x0040), |
819 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 838 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
820 | .vendor_name = "Roland", | 839 | .vendor_name = "Roland", |
@@ -828,6 +847,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
828 | } | 847 | } |
829 | }, | 848 | }, |
830 | { | 849 | { |
850 | /* has ID 0x0043 when not in "Advanced Driver" mode */ | ||
831 | USB_DEVICE(0x0582, 0x0042), | 851 | USB_DEVICE(0x0582, 0x0042), |
832 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 852 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
833 | .vendor_name = "Roland", | 853 | .vendor_name = "Roland", |
@@ -871,6 +891,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
871 | } | 891 | } |
872 | }, | 892 | }, |
873 | { | 893 | { |
894 | /* has ID 0x004a when not in "Advanced Driver" mode */ | ||
874 | USB_DEVICE(0x0582, 0x0048), | 895 | USB_DEVICE(0x0582, 0x0048), |
875 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 896 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
876 | .vendor_name = "EDIROL", | 897 | .vendor_name = "EDIROL", |
@@ -883,7 +904,9 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
883 | } | 904 | } |
884 | } | 905 | } |
885 | }, | 906 | }, |
907 | /* TODO: add Edirol M-100FX support */ | ||
886 | { | 908 | { |
909 | /* has ID 0x004f when not in "Advanced Driver" mode */ | ||
887 | USB_DEVICE(0x0582, 0x004d), | 910 | USB_DEVICE(0x0582, 0x004d), |
888 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 911 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
889 | .vendor_name = "EDIROL", | 912 | .vendor_name = "EDIROL", |
@@ -931,7 +954,9 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
931 | .type = QUIRK_MIDI_STANDARD_INTERFACE | 954 | .type = QUIRK_MIDI_STANDARD_INTERFACE |
932 | } | 955 | } |
933 | }, | 956 | }, |
957 | /* TODO: add Roland EXR support */ | ||
934 | { | 958 | { |
959 | /* has ID 0x0067 when not in "Advanced Driver" mode */ | ||
935 | USB_DEVICE(0x0582, 0x0065), | 960 | USB_DEVICE(0x0582, 0x0065), |
936 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 961 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
937 | .vendor_name = "EDIROL", | 962 | .vendor_name = "EDIROL", |
@@ -945,6 +970,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
945 | } | 970 | } |
946 | }, | 971 | }, |
947 | { | 972 | { |
973 | /* has ID 0x006b when not in "Advanced Driver" mode */ | ||
948 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x006a), | 974 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x006a), |
949 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 975 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
950 | .vendor_name = "Roland", | 976 | .vendor_name = "Roland", |
@@ -958,6 +984,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
958 | } | 984 | } |
959 | }, | 985 | }, |
960 | { | 986 | { |
987 | /* has ID 0x006e when not in "Advanced Driver" mode */ | ||
961 | USB_DEVICE(0x0582, 0x006d), | 988 | USB_DEVICE(0x0582, 0x006d), |
962 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 989 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
963 | .vendor_name = "Roland", | 990 | .vendor_name = "Roland", |
@@ -1002,6 +1029,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1002 | } | 1029 | } |
1003 | }, | 1030 | }, |
1004 | { | 1031 | { |
1032 | /* has ID 0x0076 when not in "Advanced Driver" mode */ | ||
1005 | USB_DEVICE(0x0582, 0x0075), | 1033 | USB_DEVICE(0x0582, 0x0075), |
1006 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 1034 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
1007 | .vendor_name = "BOSS", | 1035 | .vendor_name = "BOSS", |
@@ -1015,10 +1043,11 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1015 | } | 1043 | } |
1016 | }, | 1044 | }, |
1017 | { | 1045 | { |
1046 | /* has ID 0x007b when not in "Advanced Driver" mode */ | ||
1018 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a), | 1047 | USB_DEVICE_VENDOR_SPEC(0x0582, 0x007a), |
1019 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { | 1048 | .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { |
1020 | .vendor_name = "Roland", | 1049 | .vendor_name = "Roland", |
1021 | /* RD-700SX, RD-300SX */ | 1050 | /* "RD" or "RD-700SX"? */ |
1022 | .ifnum = 0, | 1051 | .ifnum = 0, |
1023 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | 1052 | .type = QUIRK_MIDI_FIXED_ENDPOINT, |
1024 | .data = & (const snd_usb_midi_endpoint_info_t) { | 1053 | .data = & (const snd_usb_midi_endpoint_info_t) { |
@@ -1048,6 +1077,15 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1048 | } | 1077 | } |
1049 | } | 1078 | } |
1050 | }, | 1079 | }, |
1080 | /* TODO: add Edirol UA-101 support */ | ||
1081 | /* TODO: add Roland G-70 support */ | ||
1082 | /* TODO: add Roland V-SYNTH XT support */ | ||
1083 | /* TODO: add BOSS GT-PRO support */ | ||
1084 | /* TODO: add Edirol PC-50 support */ | ||
1085 | /* TODO: add Edirol PC-80 support */ | ||
1086 | /* TODO: add Edirol UA-1EX support */ | ||
1087 | /* TODO: add Edirol UM-3 support */ | ||
1088 | /* TODO: add Edirol MD-P1 support */ | ||
1051 | 1089 | ||
1052 | /* Midiman/M-Audio devices */ | 1090 | /* Midiman/M-Audio devices */ |
1053 | { | 1091 | { |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 0281a362857a..8abe08611df6 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -193,7 +193,7 @@ static int usX2Y_create_alsa_devices(snd_card_t* card) | |||
193 | 193 | ||
194 | do { | 194 | do { |
195 | if ((err = usX2Y_create_usbmidi(card)) < 0) { | 195 | if ((err = usX2Y_create_usbmidi(card)) < 0) { |
196 | snd_printk("usX2Y_create_alsa_devices: usX2Y_create_usbmidi error %i \n", err); | 196 | snd_printk(KERN_ERR "usX2Y_create_alsa_devices: usX2Y_create_usbmidi error %i \n", err); |
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | if ((err = usX2Y_audio_create(card)) < 0) | 199 | if ((err = usX2Y_audio_create(card)) < 0) |
@@ -224,7 +224,7 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) | |||
224 | } | 224 | } |
225 | err = usb_set_interface(dev, 0, 1); | 225 | err = usb_set_interface(dev, 0, 1); |
226 | if (err) | 226 | if (err) |
227 | snd_printk("usb_set_interface error \n"); | 227 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
228 | else | 228 | else |
229 | err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000); | 229 | err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000); |
230 | kfree(buf); | 230 | kfree(buf); |
@@ -235,17 +235,17 @@ static int snd_usX2Y_hwdep_dsp_load(snd_hwdep_t *hw, snd_hwdep_dsp_image_t *dsp) | |||
235 | msleep(250); // give the device some time | 235 | msleep(250); // give the device some time |
236 | err = usX2Y_AsyncSeq04_init(priv); | 236 | err = usX2Y_AsyncSeq04_init(priv); |
237 | if (err) { | 237 | if (err) { |
238 | snd_printk("usX2Y_AsyncSeq04_init error \n"); | 238 | snd_printk(KERN_ERR "usX2Y_AsyncSeq04_init error \n"); |
239 | return err; | 239 | return err; |
240 | } | 240 | } |
241 | err = usX2Y_In04_init(priv); | 241 | err = usX2Y_In04_init(priv); |
242 | if (err) { | 242 | if (err) { |
243 | snd_printk("usX2Y_In04_init error \n"); | 243 | snd_printk(KERN_ERR "usX2Y_In04_init error \n"); |
244 | return err; | 244 | return err; |
245 | } | 245 | } |
246 | err = usX2Y_create_alsa_devices(hw->card); | 246 | err = usX2Y_create_alsa_devices(hw->card); |
247 | if (err) { | 247 | if (err) { |
248 | snd_printk("usX2Y_create_alsa_devices error %i \n", err); | 248 | snd_printk(KERN_ERR "usX2Y_create_alsa_devices error %i \n", err); |
249 | snd_card_free(hw->card); | 249 | snd_card_free(hw->card); |
250 | return err; | 250 | return err; |
251 | } | 251 | } |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index e6e6da159671..cf77313c609d 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -251,9 +251,8 @@ static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs) | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | if (err) { | 254 | if (err) |
255 | snd_printk("In04Int() usb_submit_urb err=%i\n", err); | 255 | snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err); |
256 | } | ||
257 | 256 | ||
258 | urb->dev = usX2Y->chip.dev; | 257 | urb->dev = usX2Y->chip.dev; |
259 | usb_submit_urb(urb, GFP_ATOMIC); | 258 | usb_submit_urb(urb, GFP_ATOMIC); |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index 0f09e0de52dd..affda973cece 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -78,7 +78,7 @@ static int usX2Y_urb_capt_retire(snd_usX2Y_substream_t *subs) | |||
78 | for (i = 0; i < nr_of_packs(); i++) { | 78 | for (i = 0; i < nr_of_packs(); i++) { |
79 | cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; | 79 | cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; |
80 | if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ | 80 | if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ |
81 | snd_printk("activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); | 81 | snd_printk(KERN_ERR "activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); |
82 | return urb->iso_frame_desc[i].status; | 82 | return urb->iso_frame_desc[i].status; |
83 | } | 83 | } |
84 | len = urb->iso_frame_desc[i].actual_length / usX2Y->stride; | 84 | len = urb->iso_frame_desc[i].actual_length / usX2Y->stride; |
@@ -134,7 +134,7 @@ static int usX2Y_urb_play_prepare(snd_usX2Y_substream_t *subs, | |||
134 | counts = cap_urb->iso_frame_desc[pack].actual_length / usX2Y->stride; | 134 | counts = cap_urb->iso_frame_desc[pack].actual_length / usX2Y->stride; |
135 | count += counts; | 135 | count += counts; |
136 | if (counts < 43 || counts > 50) { | 136 | if (counts < 43 || counts > 50) { |
137 | snd_printk("should not be here with counts=%i\n", counts); | 137 | snd_printk(KERN_ERR "should not be here with counts=%i\n", counts); |
138 | return -EPIPE; | 138 | return -EPIPE; |
139 | } | 139 | } |
140 | /* set up descriptor */ | 140 | /* set up descriptor */ |
@@ -196,7 +196,7 @@ static int usX2Y_urb_submit(snd_usX2Y_substream_t *subs, struct urb *urb, int fr | |||
196 | urb->hcpriv = NULL; | 196 | urb->hcpriv = NULL; |
197 | urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ | 197 | urb->dev = subs->usX2Y->chip.dev; /* we need to set this at each time */ |
198 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { | 198 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
199 | snd_printk("usb_submit_urb() returned %i\n", err); | 199 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); |
200 | return err; | 200 | return err; |
201 | } | 201 | } |
202 | return 0; | 202 | return 0; |
@@ -283,16 +283,16 @@ static void usX2Y_clients_stop(usX2Ydev_t *usX2Y) | |||
283 | 283 | ||
284 | static void usX2Y_error_urb_status(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) | 284 | static void usX2Y_error_urb_status(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) |
285 | { | 285 | { |
286 | snd_printk("ep=%i stalled with status=%i\n", subs->endpoint, urb->status); | 286 | snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); |
287 | urb->status = 0; | 287 | urb->status = 0; |
288 | usX2Y_clients_stop(usX2Y); | 288 | usX2Y_clients_stop(usX2Y); |
289 | } | 289 | } |
290 | 290 | ||
291 | static void usX2Y_error_sequence(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) | 291 | static void usX2Y_error_sequence(usX2Ydev_t *usX2Y, snd_usX2Y_substream_t *subs, struct urb *urb) |
292 | { | 292 | { |
293 | snd_printk("Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" | 293 | snd_printk(KERN_ERR "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" |
294 | "Most propably some urb of usb-frame %i is still missing.\n" | 294 | KERN_ERR "Most propably some urb of usb-frame %i is still missing.\n" |
295 | "Cause could be too long delays in usb-hcd interrupt handling.\n", | 295 | KERN_ERR "Cause could be too long delays in usb-hcd interrupt handling.\n", |
296 | usb_get_current_frame_number(usX2Y->chip.dev), | 296 | usb_get_current_frame_number(usX2Y->chip.dev), |
297 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); | 297 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); |
298 | usX2Y_clients_stop(usX2Y); | 298 | usX2Y_clients_stop(usX2Y); |
@@ -653,9 +653,8 @@ static void i_usX2Y_04Int(struct urb* urb, struct pt_regs *regs) | |||
653 | { | 653 | { |
654 | usX2Ydev_t* usX2Y = urb->context; | 654 | usX2Ydev_t* usX2Y = urb->context; |
655 | 655 | ||
656 | if (urb->status) { | 656 | if (urb->status) |
657 | snd_printk("snd_usX2Y_04Int() urb->status=%i\n", urb->status); | 657 | snd_printk(KERN_ERR "snd_usX2Y_04Int() urb->status=%i\n", urb->status); |
658 | } | ||
659 | if (0 == --usX2Y->US04->len) | 658 | if (0 == --usX2Y->US04->len) |
660 | wake_up(&usX2Y->In04WaitQueue); | 659 | wake_up(&usX2Y->In04WaitQueue); |
661 | } | 660 | } |
@@ -740,7 +739,7 @@ static int usX2Y_format_set(usX2Ydev_t *usX2Y, snd_pcm_format_t format) | |||
740 | } | 739 | } |
741 | usb_kill_urb(usX2Y->In04urb); | 740 | usb_kill_urb(usX2Y->In04urb); |
742 | if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { | 741 | if ((err = usb_set_interface(usX2Y->chip.dev, 0, alternate))) { |
743 | snd_printk("usb_set_interface error \n"); | 742 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
744 | return err; | 743 | return err; |
745 | } | 744 | } |
746 | usX2Y->In04urb->dev = usX2Y->chip.dev; | 745 | usX2Y->In04urb->dev = usX2Y->chip.dev; |
@@ -787,7 +786,7 @@ static int snd_usX2Y_pcm_hw_params(snd_pcm_substream_t *substream, | |||
787 | } | 786 | } |
788 | } | 787 | } |
789 | if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { | 788 | if (0 > (err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)))) { |
790 | snd_printk("snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", substream, params_buffer_bytes(hw_params), err); | 789 | snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", substream, params_buffer_bytes(hw_params), err); |
791 | return err; | 790 | return err; |
792 | } | 791 | } |
793 | return 0; | 792 | return 0; |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index d0199c4e5551..0dc828ff9e94 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -73,7 +73,7 @@ static int usX2Y_usbpcm_urb_capt_retire(snd_usX2Y_substream_t *subs) | |||
73 | } | 73 | } |
74 | for (i = 0; i < nr_of_packs(); i++) { | 74 | for (i = 0; i < nr_of_packs(); i++) { |
75 | if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ | 75 | if (urb->iso_frame_desc[i].status) { /* active? hmm, skip this */ |
76 | snd_printk("activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); | 76 | snd_printk(KERN_ERR "activ frame status %i. Most propably some hardware problem.\n", urb->iso_frame_desc[i].status); |
77 | return urb->iso_frame_desc[i].status; | 77 | return urb->iso_frame_desc[i].status; |
78 | } | 78 | } |
79 | lens += urb->iso_frame_desc[i].actual_length / usX2Y->stride; | 79 | lens += urb->iso_frame_desc[i].actual_length / usX2Y->stride; |
@@ -126,7 +126,7 @@ static int usX2Y_hwdep_urb_play_prepare(snd_usX2Y_substream_t *subs, | |||
126 | /* calculate the size of a packet */ | 126 | /* calculate the size of a packet */ |
127 | counts = shm->captured_iso[shm->playback_iso_head].length / usX2Y->stride; | 127 | counts = shm->captured_iso[shm->playback_iso_head].length / usX2Y->stride; |
128 | if (counts < 43 || counts > 50) { | 128 | if (counts < 43 || counts > 50) { |
129 | snd_printk("should not be here with counts=%i\n", counts); | 129 | snd_printk(KERN_ERR "should not be here with counts=%i\n", counts); |
130 | return -EPIPE; | 130 | return -EPIPE; |
131 | } | 131 | } |
132 | /* set up descriptor */ | 132 | /* set up descriptor */ |