Changeset 92
- Timestamp:
- May 2, 2007, 9:13:43 AM (18 years ago)
- Location:
- GPL/branches/alsa-resync1/alsa-kernel
- Files:
-
- 4 added
- 60 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/core/control.c
r84 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * 20 */ 21 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 */ 21 22 #define __NO_VERSION__ 22 23 #include <sound/driver.h> 24 #include <linux/interrupt.h> 25 #include <linux/slab.h> 26 #include <linux/vmalloc.h> 27 #include <linux/time.h> 28 #include <sound/core.h> 23 29 #include <sound/minors.h> 24 30 #include <sound/info.h> … … 43 49 static int snd_ctl_open(struct inode *inode, struct file *file) 44 50 { 45 int cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev));46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 51 int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev)); 52 unsigned long flags; 53 struct snd_card *card; 54 struct snd_ctl_file *ctl; 55 int err; 56 57 card = snd_cards[cardnum]; 58 if (!card) { 59 err = -ENODEV; 60 goto __error1; 61 } 62 err = snd_card_file_add(card, file); 63 if (err < 0) { 64 err = -ENODEV; 65 goto __error1; 66 } 67 if (!try_module_get(card->module)) { 68 err = -EFAULT; 69 goto __error2; 70 } 71 ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); 72 if (ctl == NULL) { 73 err = -ENOMEM; 74 goto __error; 75 } 76 INIT_LIST_HEAD(&ctl->events); 77 init_waitqueue_head(&ctl->change_sleep); 78 spin_lock_init(&ctl->read_lock); 79 ctl->card = card; 80 ctl->pid = current->pid; 81 file->private_data = ctl; 82 write_lock_irqsave(&card->ctl_files_rwlock, flags); 83 list_add_tail(&ctl->list, &card->ctl_files); 84 write_unlock_irqrestore(&card->ctl_files_rwlock, flags); 85 return 0; 80 86 81 87 __error: … … 84 90 snd_card_file_remove(card, file); 85 91 __error1: 86 92 return err; 87 93 } 88 94 … … 90 96 { 91 97 struct snd_kctl_event *cread; 92 93 94 95 96 97 98 99 98 99 spin_lock(&ctl->read_lock); 100 while (!list_empty(&ctl->events)) { 101 cread = snd_kctl_event(ctl->events.next); 102 list_del(&cread->list); 103 kfree(cread); 104 } 105 spin_unlock(&ctl->read_lock); 100 106 } 101 107 102 108 static int snd_ctl_release(struct inode *inode, struct file *file) 103 109 { 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 110 unsigned long flags; 111 struct list_head *list; 112 struct snd_card *card; 113 struct snd_ctl_file *ctl; 114 struct snd_kcontrol *control; 115 unsigned int idx; 116 117 ctl = file->private_data; 118 fasync_helper(-1, file, 0, &ctl->fasync); 119 file->private_data = NULL; 120 card = ctl->card; 121 write_lock_irqsave(&card->ctl_files_rwlock, flags); 122 list_del(&ctl->list); 123 write_unlock_irqrestore(&card->ctl_files_rwlock, flags); 124 down_write(&card->controls_rwsem); 125 list_for_each(list, &card->controls) { 126 control = snd_kcontrol(list); 127 for (idx = 0; idx < control->count; idx++) 128 if (control->vd[idx].owner == ctl) 129 control->vd[idx].owner = NULL; 130 } 131 up_write(&card->controls_rwsem); 132 snd_ctl_empty_read_queue(ctl); 133 kfree(ctl); 134 module_put(card->module); 135 snd_card_file_remove(card, file); 136 return 0; 131 137 } 132 138 133 139 void snd_ctl_notify(struct snd_card *card, unsigned int mask, struct snd_ctl_elem_id *id) 134 140 { 135 136 137 138 139 140 141 142 143 144 145 141 unsigned long flags; 142 struct list_head *flist; 143 struct snd_ctl_file *ctl; 144 struct snd_kctl_event *ev; 145 146 snd_runtime_check(card != NULL && id != NULL, return); 147 148 control_id_changed = id->numid; 149 card_id_changed = card->number; 150 // printk("ctl id %i changed\n", id->numid); 151 read_lock(&card->ctl_files_rwlock); 146 152 #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 147 153 card->mixer_oss_change_count++; 148 154 #endif 149 155 list_for_each(flist, &card->ctl_files) { 150 156 struct list_head *elist; 151 157 ctl = snd_ctl_file(flist); … … 166 172 list_add_tail(&ev->list, &ctl->events); 167 173 } else { 168 snd_printk("No memory available to allocate event\n");169 174 snd_printk(KERN_ERR "No memory available to allocate event\n"); 175 } 170 176 _found: 171 177 wake_up(&ctl->change_sleep); … … 338 344 } 339 345 #endif 340 346 list_add_tail(&kcontrol->list, &card->controls); 341 347 card->controls_count += kcontrol->count; 342 343 344 345 346 347 348 kcontrol->id.numid = card->last_numid + 1; 349 card->last_numid += kcontrol->count; 350 up_write(&card->controls_rwsem); 351 for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++) 352 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); 353 return 0; 348 354 349 355 error: 350 356 snd_ctl_free_one(kcontrol); 351 357 return err; 352 358 } 353 359 -
GPL/branches/alsa-resync1/alsa-kernel/core/device.c
r34 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * 20 */ 21 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 */ 21 22 #define __NO_VERSION__ 22 23 #include <sound/driver.h> 24 #include <linux/slab.h> 25 #include <linux/time.h> 26 #include <sound/core.h> 23 27 24 28 /** … … 84 88 dev->ops->dev_unregister) { 85 89 if (dev->ops->dev_unregister(dev)) 86 snd_printk( "device unregister failure\n");90 snd_printk(KERN_ERR "device unregister failure\n"); 87 91 } else { 88 92 if (dev->ops->dev_free) { 89 93 if (dev->ops->dev_free(dev)) 90 snd_printk( "device free failure\n");94 snd_printk(KERN_ERR "device free failure\n"); 91 95 } 92 96 } -
GPL/branches/alsa-resync1/alsa-kernel/core/info.c
r32 r92 20 20 */ 21 21 22 #define __NO_VERSION__ 22 23 #include <sound/driver.h> 24 #include <linux/init.h> 25 #include <linux/vmalloc.h> 26 #include <linux/time.h> 27 #ifndef TARGET_OS2 /* Introduced in version 0.9.0beta12, not present */ 28 #include <linux/smp_lock.h> 29 #endif /* TARGET_OS2 */ 30 #include <sound/core.h> 23 31 #include <sound/minors.h> 24 32 #include <sound/info.h> 25 33 #include <sound/version.h> 26 #include < stdarg.h>34 #include <linux/proc_fs.h> 27 35 #ifdef CONFIG_DEVFS_FS 28 36 #include <linux/devfs_fs_kernel.h> 29 37 #endif 38 #include <stdarg.h> 30 39 31 40 #define min(x,y) (x < y ? x : y ) … … 39 48 static char *reserved[] = 40 49 { 50 "dev", 41 51 "version", 42 52 "meminfo", … … 44 54 "detect", 45 55 "devices", 46 "oss",56 "oss-devices", 47 57 "cards", 48 58 "timers", … … 166 176 data->file_private_data, 167 177 file, offset, orig); 168 169 170 171 172 178 goto out; 179 } 180 break; 181 } 182 ret = -ENXIO; 173 183 out: 174 184 #ifndef TARGET_OS2 175 176 #endif 177 185 unlock_kernel(); 186 #endif 187 return ret; 178 188 } 179 189 … … 272 282 273 283 down(&info_mutex); 274 p = (struct proc_dir_entry *) inode->u.generic_ip;284 p = PDE(inode); 275 285 entry = p == NULL ? NULL : (snd_info_entry_t *)p->data; 276 286 if (entry == NULL) { … … 278 288 return -ENODEV; 279 289 } 280 #if ndef LINUX_2_3290 #ifdef LINUX_2_2 281 291 MOD_INC_USE_COUNT; 282 292 #endif … … 415 425 entry->c.text.write(entry, data->wbuffer); 416 426 if (data->wbuffer->error) { 417 snd_printk("data write error to %s (%i)\n",427 snd_printk(KERN_WARNING "data write error to %s (%i)\n", 418 428 entry->name, 419 429 data->wbuffer->error); … … 525 535 static struct file_operations snd_info_entry_operations = 526 536 { 527 #if def LINUX_2_3537 #ifndef LINUX_2_2 528 538 owner: THIS_MODULE, 529 539 #endif … … 538 548 }; 539 549 540 #if ndef LINUX_2_3550 #ifdef LINUX_2_2 541 551 static struct inode_operations snd_info_entry_inode_operations = 542 552 { … … 548 558 &snd_fops, /* default sound info directory file-ops */ 549 559 }; 550 #endif /* LINUX_2_ 3*/560 #endif /* LINUX_2_2 */ 551 561 552 562 static int snd_info_card_readlink(struct dentry *dentry, 553 563 char *buffer, int buflen) 554 564 { 555 char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;556 #if def LINUX_2_3565 char *s = PDE(dentry->d_inode)->data; 566 #ifndef LINUX_2_2 557 567 return vfs_readlink(dentry, buffer, buflen, s); 558 568 #else … … 570 580 } 571 581 572 #if def LINUX_2_3582 #ifndef LINUX_2_2 573 583 static int snd_info_card_followlink(struct dentry *dentry, 574 584 struct nameidata *nd) 575 585 { 576 char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;586 char *s = PDE(dentry->d_inode)->data; 577 587 return vfs_follow_link(nd, s); 578 588 } … … 582 592 unsigned int follow) 583 593 { 584 char *s = ((struct proc_dir_entry *) dentry->d_inode->u.generic_ip)->data;594 char *s = PDE(dentry->d_inode)->data; 585 595 return lookup_dentry(s, base, follow); 586 596 } 587 597 #endif 588 598 589 #if ndef LINUX_2_3599 #ifdef LINUX_2_2 590 600 static struct file_operations snd_info_card_link_operations = 591 601 { … … 596 606 struct inode_operations snd_info_card_link_inode_operations = 597 607 { 598 #if ndef LINUX_2_3608 #ifdef LINUX_2_2 599 609 default_file_ops: &snd_info_card_link_operations, 600 610 #endif … … 683 693 snd_info_version_done(); 684 694 if (snd_proc_root) { 685 #if def CONFIG_SND_SEQUENCER695 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 686 696 if (snd_seq_root) 687 697 snd_info_unregister(snd_seq_root); … … 1019 1029 return -ENOMEM; 1020 1030 } 1021 #if def LINUX_2_31031 #ifndef LINUX_2_2 1022 1032 p->owner = entry->module; 1023 1033 #endif … … 1025 1035 #ifndef TARGET_OS2 1026 1036 if (!S_ISDIR(entry->mode)) { 1027 #if def LINUX_2_31037 #ifndef LINUX_2_2 1028 1038 p->proc_fops = &snd_info_entry_operations; 1029 1039 #else … … 1072 1082 1073 1083 snd_iprintf(buffer, 1074 "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION".\n"1084 "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n" 1075 1085 "Compiled on " __DATE__ " for kernel %s" 1076 1086 #ifdef __SMP__ -
GPL/branches/alsa-resync1/alsa-kernel/core/init.c
r34 r92 102 102 write_unlock(&snd_card_rwlock); 103 103 if (idx >= snd_ecards_limit) 104 snd_printk( "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1);104 snd_printk(KERN_ERR "card %i is out of range (0-%i)\n", idx, snd_ecards_limit-1); 105 105 goto __error; 106 106 } … … 277 277 #endif 278 278 if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { 279 snd_printk( "unable to free all devices (pre)\n");279 snd_printk(KERN_ERR "unable to free all devices (pre)\n"); 280 280 /* Fatal, but this situation should never occur */ 281 281 } 282 282 if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) { 283 snd_printk( "unable to free all devices (normal)\n");283 snd_printk(KERN_ERR "unable to free all devices (normal)\n"); 284 284 /* Fatal, but this situation should never occur */ 285 285 } 286 286 if (snd_ctl_unregister(card) < 0) { 287 snd_printk( "unable to unregister control minors\n");287 snd_printk(KERN_ERR "unable to unregister control minors\n"); 288 288 /* Not fatal error */ 289 289 } 290 290 if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) { 291 snd_printk( "unable to free all devices (post)\n");291 snd_printk(KERN_ERR "unable to free all devices (post)\n"); 292 292 /* Fatal, but this situation should never occur */ 293 293 } -
GPL/branches/alsa-resync1/alsa-kernel/core/memory.c
r73 r92 21 21 */ 22 22 23 #define __NO_VERSION__ 23 24 #include <sound/driver.h> 25 #include <asm/io.h> 26 #include <asm/uaccess.h> 27 #include <linux/init.h> 28 #include <linux/slab.h> 29 #include <linux/time.h> 30 #include <sound/core.h> 24 31 #include <sound/info.h> 25 32 #include <sound/memalloc.h> … … 61 68 void snd_memory_done(void) 62 69 { 63 64 65 66 snd_printk("Not freed snd_alloc_pages = %li\n", snd_alloc_pages);67 68 snd_printk("Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc);69 70 snd_printk("Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc);71 72 73 74 snd_printk("Corrupted kmalloc\n");75 76 77 snd_printk("kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);78 79 80 81 82 snd_printk("Corrupted vmalloc\n");83 84 85 snd_printk("vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller);86 70 struct list_head *head; 71 struct snd_alloc_track *t; 72 if (snd_alloc_pages > 0) 73 snd_printk(KERN_ERR "Not freed snd_alloc_pages = %li\n", snd_alloc_pages); 74 if (snd_alloc_kmalloc > 0) 75 snd_printk(KERN_ERR "Not freed snd_alloc_kmalloc = %li\n", snd_alloc_kmalloc); 76 if (snd_alloc_vmalloc > 0) 77 snd_printk(KERN_ERR "Not freed snd_alloc_vmalloc = %li\n", snd_alloc_vmalloc); 78 list_for_each_prev(head, &snd_alloc_kmalloc_list) { 79 t = list_entry(head, struct snd_alloc_track, list); 80 if (t->magic != KMALLOC_MAGIC) { 81 snd_printk(KERN_ERR "Corrupted kmalloc\n"); 82 break; 83 } 84 snd_printk(KERN_ERR "kmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); 85 } 86 list_for_each_prev(head, &snd_alloc_vmalloc_list) { 87 t = list_entry(head, struct snd_alloc_track, list); 88 if (t->magic != VMALLOC_MAGIC) { 89 snd_printk(KERN_ERR "Corrupted vmalloc\n"); 90 break; 91 } 92 snd_printk(KERN_ERR "vmalloc(%ld) from %p not freed\n", (long) t->size, t->caller); 93 } 87 94 } 88 95 89 96 void *__snd_kmalloc(size_t size, int flags, void *caller) 90 97 { 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 98 unsigned long cpu_flags; 99 struct snd_alloc_track *t; 100 void *ptr; 101 102 ptr = snd_wrapper_kmalloc(size + sizeof(struct snd_alloc_track), flags); 103 if (ptr != NULL) { 104 t = (struct snd_alloc_track *)ptr; 105 t->magic = KMALLOC_MAGIC; 106 t->caller = caller; 107 spin_lock_irqsave(&snd_alloc_kmalloc_lock, cpu_flags); 108 list_add_tail(&t->list, &snd_alloc_kmalloc_list); 109 spin_unlock_irqrestore(&snd_alloc_kmalloc_lock, cpu_flags); 110 t->size = size; 111 snd_alloc_kmalloc += size; 112 ptr = t->data; 113 } 114 return ptr; 108 115 } 109 116 … … 111 118 void *snd_hidden_kmalloc(size_t size, int flags) 112 119 { 113 120 return _snd_kmalloc(size, flags); 114 121 } 115 122 … … 127 134 void snd_hidden_kfree(const void *obj) 128 135 { 129 130 131 132 snd_printk("null kfree (called from %p)\n", __builtin_return_address(0));133 134 135 136 137 snd_printk("bad kfree (called from %p)\n", __builtin_return_address(0));138 139 140 141 142 143 144 145 146 136 unsigned long flags; 137 struct snd_alloc_track *t; 138 if (obj == NULL) { 139 snd_printk(KERN_WARNING "null kfree (called from %p)\n", __builtin_return_address(0)); 140 return; 141 } 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); 147 154 } 148 155 149 156 void *snd_hidden_vmalloc(unsigned long size) 150 157 { 151 152 153 154 155 156 157 158 159 160 161 162 163 164 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; 165 172 } 166 173 167 174 void snd_hidden_vfree(void *obj) 168 175 { 169 170 171 snd_printk("null vfree (called from %p)\n", __builtin_return_address(0));172 173 174 175 176 snd_printk("bad vfree (called from %p)\n", __builtin_return_address(0));177 178 179 180 181 182 183 184 185 176 struct snd_alloc_track *t; 177 if (obj == NULL) { 178 snd_printk(KERN_WARNING "null vfree (called from %p)\n", __builtin_return_address(0)); 179 return; 180 } 181 t = snd_alloc_track_entry(obj); 182 if (t->magic != VMALLOC_MAGIC) { 183 snd_printk(KERN_ERR "bad vfree (called from %p)\n", __builtin_return_address(0)); 184 return; 185 } 186 spin_lock(&snd_alloc_vmalloc_lock); 187 list_del(&t->list); 188 spin_unlock(&snd_alloc_vmalloc_lock); 189 t->magic = 0; 190 snd_alloc_vmalloc -= t->size; 191 obj = t; 192 snd_wrapper_vfree(obj); 186 193 } 187 194 188 195 static void snd_memory_info_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer) 189 196 { 190 191 192 193 197 long pages = snd_alloc_pages >> (PAGE_SHIFT-12); 198 snd_iprintf(buffer, "pages : %li bytes (%li pages per %likB)\n", pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); 199 snd_iprintf(buffer, "kmalloc: %li bytes\n", snd_alloc_kmalloc); 200 snd_iprintf(buffer, "vmalloc: %li bytes\n", snd_alloc_vmalloc); 194 201 } 195 202 196 203 int __init snd_memory_info_init(void) 197 204 { 198 199 200 201 202 203 204 205 206 207 208 209 210 211 205 snd_info_entry_t *entry; 206 207 entry = snd_info_create_module_entry(THIS_MODULE, "meminfo", NULL); 208 if (entry) { 209 entry->content = SNDRV_INFO_CONTENT_TEXT; 210 entry->c.text.read_size = 256; 211 entry->c.text.read = snd_memory_info_read; 212 if (snd_info_register(entry) < 0) { 213 snd_info_free_entry(entry); 214 entry = NULL; 215 } 216 } 217 snd_memory_info_entry = entry; 218 return 0; 212 219 } 213 220 214 221 int __exit snd_memory_info_done(void) 215 222 { 216 217 218 223 if (snd_memory_info_entry) 224 snd_info_unregister(snd_memory_info_entry); 225 return 0; 219 226 } 220 227 #else -
GPL/branches/alsa-resync1/alsa-kernel/core/misc.c
r86 r92 21 21 22 22 #include <sound/driver.h> 23 #include < sound/firmware.h>23 #include <linux/firmware.h> 24 24 int snd_task_name(struct task_struct *task, char *name, size_t size) 25 25 { … … 541 541 } 542 542 543 #if 0 543 544 void flush_workqueue(struct workqueue_struct *wq) 544 545 { … … 561 562 } 562 563 } 564 #endif 563 565 564 566 void destroy_workqueue(struct workqueue_struct *wq) 565 567 { 568 #if 0 566 569 flush_workqueue(wq); 567 #if 0568 570 kill_proc(wq->task_pid, SIGKILL, 1); 569 571 if (wq->task_pid >= 0) … … 686 688 } 687 689 688 int request_firmware(const struct firmware **fw, const char *name) 690 int request_firmware(const struct firmware **fw, const char *name, 691 struct device *device) 689 692 { 690 693 struct firmware *firmware; -
GPL/branches/alsa-resync1/alsa-kernel/core/pcm.c
r34 r92 21 21 22 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/slab.h> 25 #include <linux/time.h> 26 #include <sound/core.h> 23 27 #include <sound/minors.h> 24 28 #include <sound/pcm.h> … … 564 568 int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count) 565 569 { 566 570 int idx, err; 567 571 snd_pcm_str_t *pstr = &pcm->streams[stream]; 568 572 struct snd_pcm_substream *substream, *prev; 569 573 570 574 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 571 575 init_MUTEX(&pstr->oss.setup_mutex); 572 576 #endif 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 } 577 pstr->stream = stream; 578 pstr->pcm = pcm; 579 pstr->substream_count = substream_count; 580 pstr->reg = &snd_pcm_reg[stream]; 581 if (substream_count > 0) { 582 err = snd_pcm_stream_proc_init(pstr); 583 if (err < 0) 584 return err; 585 } 586 prev = NULL; 587 for (idx = 0, prev = NULL; idx < substream_count; idx++) { 588 substream = (struct snd_pcm_substream *)kzalloc(sizeof(*substream), GFP_KERNEL); 589 if (substream == NULL) 590 return -ENOMEM; 591 substream->pcm = pcm; 592 substream->pstr = pstr; 593 substream->number = idx; 594 substream->stream = stream; 595 sprintf(substream->name, "subdevice #%i", idx); 596 substream->buffer_bytes_max = UINT_MAX; 597 if (prev == NULL) 598 pstr->substream = substream; 599 else 600 prev->next = substream; 601 err = snd_pcm_substream_proc_init(substream); 602 if (err < 0) { 603 kfree(substream); 604 return err; 605 } 606 substream->group = &substream->self_group; 607 spin_lock_init(&substream->self_group.lock); 608 INIT_LIST_HEAD(&substream->self_group.substreams); 609 list_add_tail(&substream->link_list, &substream->self_group.substreams); 610 spin_lock_init(&substream->timer_lock); 611 prev = substream; 612 } 613 return 0; 614 } 611 615 612 616 /** … … 627 631 */ 628 632 int snd_pcm_new(snd_card_t * card, char *id, int device, 629 630 631 { 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 633 int playback_count, int capture_count, 634 snd_pcm_t ** rpcm) 635 { 636 snd_pcm_t *pcm; 637 int err; 638 static snd_device_ops_t ops = { 639 snd_pcm_dev_free, 640 snd_pcm_dev_register, 641 snd_pcm_dev_disconnect, 642 snd_pcm_dev_unregister 643 }; 644 645 snd_assert(rpcm != NULL, return -EINVAL); 646 *rpcm = NULL; 647 snd_assert(card != NULL, return -ENXIO); 648 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); 649 if (pcm == NULL) 650 return -ENOMEM; 651 pcm->card = card; 652 pcm->device = device; 653 if (id) { 654 strlcpy(pcm->id, id, sizeof(pcm->id)); 655 } 656 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) { 657 snd_pcm_free(pcm); 658 return err; 659 } 660 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) { 661 snd_pcm_free(pcm); 658 662 return err; 659 663 } -
GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c
r34 r92 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <sound/core.h> 24 #include <linux/major.h> 25 #include <linux/init.h> 26 #include <linux/sched.h> 27 #include <linux/slab.h> 28 #include <linux/time.h> 29 #include <linux/wait.h> 24 30 #include <sound/rawmidi.h> 25 31 #include <sound/info.h> … … 346 352 static int snd_rawmidi_open(struct inode *inode, struct file *file) 347 353 { 348 int major = MAJOR(inode->i_rdev);354 int maj = major(inode->i_rdev); 349 355 int cardnum; 350 356 snd_card_t *card; … … 359 365 360 366 printk("rawmidi open\n"); 361 switch (maj or) {367 switch (maj) { 362 368 case CONFIG_SND_MAJOR: 363 369 cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev)); … … 382 388 return -ENODEV; 383 389 #ifdef CONFIG_SND_OSSEMUL 384 if (major== SOUND_MAJOR && !rmidi->ossreg)390 if (maj == SOUND_MAJOR && !rmidi->ossreg) 385 391 return -ENXIO; 386 392 #endif … … 392 398 return -ENODEV; 393 399 fflags = snd_rawmidi_file_flags(file); 394 if ((file->f_flags & O_APPEND) || major!= CONFIG_SND_MAJOR) /* OSS emul? */400 if ((file->f_flags & O_APPEND) || maj != CONFIG_SND_MAJOR) /* OSS emul? */ 395 401 fflags |= SNDRV_RAWMIDI_LFLG_APPEND; 396 402 fflags |= SNDRV_RAWMIDI_LFLG_NOOPENLOCK; … … 781 787 #ifdef CONFIG_SND_DEBUG 782 788 default: 783 snd_printk("rawmidi: unknown command = 0x%x\n", cmd);789 snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd); 784 790 #endif 785 791 } … … 1454 1460 } 1455 1461 1456 #if def CONFIG_SND_SEQUENCER1462 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 1457 1463 static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device) 1458 1464 { … … 1482 1488 rmidi->card, rmidi->device, 1483 1489 &snd_rawmidi_reg, name)) < 0) { 1484 snd_printk("unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);1490 snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device); 1485 1491 snd_rawmidi_devices[idx] = NULL; 1486 1492 up(®ister_mutex); … … 1499 1505 if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, 1500 1506 rmidi->card, 0, &snd_rawmidi_reg, name) < 0) { 1501 snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);1507 snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0); 1502 1508 } else { 1503 1509 rmidi->ossreg++; … … 1510 1516 if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, 1511 1517 rmidi->card, 1, &snd_rawmidi_reg, name) < 0) { 1512 snd_printk("unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);1518 snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1); 1513 1519 } else { 1514 1520 rmidi->ossreg++; … … 1529 1535 } 1530 1536 rmidi->proc_entry = entry; 1531 #if def CONFIG_SND_SEQUENCER1537 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 1532 1538 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */ 1533 1539 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) { … … 1584 1590 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); 1585 1591 up(®ister_mutex); 1586 #if def CONFIG_SND_SEQUENCER1592 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 1587 1593 if (rmidi->seq_dev) { 1588 1594 snd_device_free(rmidi->card, rmidi->seq_dev); … … 1623 1629 { int i; 1624 1630 /* check device map table */ 1625 1626 1627 1628 1629 1630 1631 1632 1633 1631 for (i = 0; i < SNDRV_CARDS; i++) { 1632 if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { 1633 snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, midi_map[i]); 1634 midi_map[i] = 0; 1635 } 1636 if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) { 1637 snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, amidi_map[i]); 1638 amidi_map[i] = 1; 1639 } 1634 1640 } 1635 1641 } -
GPL/branches/alsa-resync1/alsa-kernel/core/rtctimer.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 * … … 29 29 */ 30 30 31 #define SNDRV_MAIN_OBJECT_FILE32 31 #include <sound/driver.h> 32 #include <linux/init.h> 33 #include <linux/time.h> 34 #include <sound/core.h> 33 35 #include <sound/timer.h> 34 36 #include <sound/info.h> … … 124 126 125 127 #ifdef USE_TASKLET 126 static void rtctimer_interrupt2( void *private_data)127 { 128 snd_timer_t *timer = private_data;128 static void rtctimer_interrupt2(unsigned long private_data) 129 { 130 snd_timer_t *timer = (snd_timer_t *)private_data; 129 131 snd_assert(timer != NULL, return); 130 132 do { … … 151 153 152 154 if (rtctimer_freq < 2 || rtctimer_freq > 8192) { 153 snd_printk( "rtctimer: invalid frequency %d\n", rtctimer_freq);155 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); 154 156 return -EINVAL; 155 157 } … … 157 159 ; 158 160 if (rtctimer_freq != order) { 159 snd_printk( "rtctimer: invalid frequency %d\n", rtctimer_freq);161 snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n", rtctimer_freq); 160 162 return -EINVAL; 161 163 } … … 167 169 168 170 #ifdef USE_TASKLET 169 tasklet_init(&rtc_tq, rtctimer_interrupt2, timer);171 tasklet_init(&rtc_tq, rtctimer_interrupt2, (unsigned long)timer); 170 172 #endif /* USE_TASKLET */ 171 173 … … 213 215 MODULE_PARM_DESC(rtctimer_freq, "timer frequency in Hz"); 214 216 217 MODULE_LICENSE("GPL"); 218 219 EXPORT_NO_SYMBOLS; 220 215 221 #endif /* CONFIG_RTC || CONFIG_RTC_MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/core/timer.c
r34 r92 1873 1873 snd_timer_proc_entry = entry; 1874 1874 if ((err = snd_timer_register_system()) < 0) 1875 snd_printk("unable to register system timer (%i)\n", err);1875 snd_printk(KERN_ERR "unable to register system timer (%i)\n", err); 1876 1876 if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, 1877 1877 NULL, 0, &snd_timer_reg, "timer"))<0) 1878 snd_printk("unable to register timer device (%i)\n", err);1878 snd_printk(KERN_ERR "unable to register timer device (%i)\n", err); 1879 1879 return 0; 1880 1880 } -
GPL/branches/alsa-resync1/alsa-kernel/drivers/dummy.c
r32 r92 15 15 * You should have received a copy of the GNU General Public License 16 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 * 19 19 */ 20 20 21 #define SNDRV_MAIN_OBJECT_FILE22 21 #include <sound/driver.h> 22 #include <linux/init.h> 23 #include <linux/sched.h> 24 #include <linux/slab.h> 25 #include <linux/time.h> 26 #include <linux/wait.h> 27 #include <sound/core.h> 23 28 #include <sound/control.h> 24 29 #include <sound/pcm.h> … … 26 31 #define SNDRV_GET_ID 27 32 #include <sound/initval.h> 33 34 EXPORT_NO_SYMBOLS; 28 35 29 36 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 609 616 if (snd_card_dummy_probe(dev) < 0) { 610 617 #ifdef MODULE 611 snd_printk("Dummy soundcard #%i not found or device busy\n", dev + 1);618 printk(KERN_ERR "Dummy soundcard #%i not found or device busy\n", dev + 1); 612 619 #endif 613 620 break; … … 617 624 if (!cards) { 618 625 #ifdef MODULE 619 snd_printk("Dummy soundcard not found or device busy\n");626 printk(KERN_ERR "Dummy soundcard not found or device busy\n"); 620 627 #endif 621 628 return -ENODEV; … … 637 644 #ifndef MODULE 638 645 639 /* format is: snd- card-dummy=snd_enable,snd_index,snd_id,646 /* format is: snd-dummy=snd_enable,snd_index,snd_id, 640 647 snd_pcm_devs,snd_pcm_substreams */ 641 648 -
GPL/branches/alsa-resync1/alsa-kernel/drivers/mpu401/mpu401.c
r32 r92 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/wait.h> 25 #include <linux/sched.h> 26 #include <linux/slab.h> 27 #include <sound/core.h> 24 28 #include <sound/mpu401.h> 25 29 #define SNDRV_GET_ID 26 30 #include <sound/initval.h> 31 #include <linux/delay.h> 32 33 EXPORT_NO_SYMBOLS; 27 34 28 35 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 119 126 if (!cards) { 120 127 #ifdef MODULE 121 snd_printk("MPU-401 device not found or device busy\n");128 printk(KERN_ERR "MPU-401 device not found or device busy\n"); 122 129 #endif 123 130 return -ENODEV; … … 139 146 #ifndef MODULE 140 147 141 /* format is: snd-mpu401= enable,index,id,port,irq */148 /* format is: snd-mpu401=snd_enable,snd_index,snd_id,snd_port,snd_irq */ 142 149 143 150 static int __init alsa_card_mpu401_setup(char *str) -
GPL/branches/alsa-resync1/alsa-kernel/drivers/mtpav.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 * … … 51 51 */ 52 52 53 #define SNDRV_MAIN_OBJECT_FILE54 53 #include <sound/driver.h> 54 #include <asm/io.h> 55 #include <linux/init.h> 56 #include <linux/slab.h> 57 #include <sound/core.h> 55 58 #define SNDRV_GET_ID 56 59 #include <sound/initval.h> 57 60 #include <sound/rawmidi.h> 61 #include <linux/delay.h> 58 62 59 63 /* … … 61 65 */ 62 66 EXPORT_NO_SYMBOLS; 67 68 MODULE_AUTHOR("Michael T. Mayers"); 63 69 MODULE_DESCRIPTION("MOTU MidiTimePiece AV multiport MIDI"); 70 MODULE_LICENSE("GPL"); 64 71 MODULE_CLASSES("{sound}"); 65 72 MODULE_DEVICES("{{MOTU,MidiTimePiece AV multiport MIDI}}"); … … 84 91 MODULE_PARM(snd_port, "l"); 85 92 MODULE_PARM_DESC(snd_port, "Parallel port # for MotuMTPAV MIDI."); 86 MODULE_PARM_SYNTAX(snd_port, "allows:{{0x378},{0x278}},dialog:list");93 MODULE_PARM_SYNTAX(snd_port, SNDRV_ENABLED ",allows:{{0x378},{0x278}},dialog:list"); 87 94 MODULE_PARM(snd_irq, "i"); 88 95 MODULE_PARM_DESC(snd_irq, "Parallel IRQ # for MotuMTPAV MIDI."); 89 MODULE_PARM_SYNTAX(snd_irq, "allows:{{7},{5}},dialog:list");96 MODULE_PARM_SYNTAX(snd_irq, SNDRV_ENABLED ",allows:{{7},{5}},dialog:list"); 90 97 MODULE_PARM(snd_hwports, "i"); 91 98 MODULE_PARM_DESC(snd_hwports, "Hardware ports # for MotuMTPAV MIDI."); 92 MODULE_PARM_SYNTAX(snd_hwports, "allows:{{1,8}},dialog:list");99 MODULE_PARM_SYNTAX(snd_hwports, SNDRV_ENABLED ",allows:{{1,8}},dialog:list"); 93 100 94 101 /* … … 721 728 if (crd->irq >= 0) 722 729 free_irq(crd->irq, (void *)crd); 723 if (crd->res_port) 730 if (crd->res_port) { 724 731 release_resource(crd->res_port); 732 kfree_nocheck(crd->res_port); 733 } 725 734 if (crd != NULL) 726 735 kfree(crd); … … 769 778 snd_mtpav_portscan(mtp_card); 770 779 771 snd_printk("Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port);780 printk(KERN_INFO "Motu MidiTimePiece on parallel port irq: %d ioport: 0x%lx\n", snd_irq, snd_port); 772 781 773 782 return 0; … … 799 808 #ifndef MODULE 800 809 801 /* format is: snd- card-mtpav=snd_enable,snd_index,snd_id,810 /* format is: snd-mtpav=snd_enable,snd_index,snd_id, 802 811 snd_port,snd_irq,snd_hwports */ 803 812 … … 815 824 } 816 825 817 __setup("snd- card-mtpav=", alsa_card_mtpav_setup);826 __setup("snd-mtpav=", alsa_card_mtpav_setup); 818 827 819 828 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/drivers/serial-u16550.c
r34 r92 8 8 * This code is based on the code from ALSA 0.5.9, but heavily rewritten. 9 9 * 10 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com 10 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com 11 11 * Added support for the Midiator MS-124T and for the MS-124W in 12 12 * Single Addressed (S/A) or Multiple Burst (M/B) mode, with 13 13 * power derived either parasitically from the serial port or 14 14 * from a separate power supply. 15 * 15 * 16 16 * The new snd_adaptor module parameter allows you to select 17 17 * either the default Roland Soundcanvas support (0), which was … … 21 21 * Midiator MS-124W, you must set the physical M-S and A-B 22 22 * switches on the Midiator to match the driver mode you select. 23 * 23 * 24 24 * - In Roland Soundcanvas mode, multiple ALSA raw MIDI 25 25 * substreams are supported (midiCnD0-midiCnD15). Whenever you … … 99 99 * You should have received a copy of the GNU General Public License 100 100 * along with this program; if not, write to the Free Software 101 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.101 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 102 102 * 103 103 */ 104 104 105 106 #define SNDRV_MAIN_OBJECT_FILE107 108 105 #include <sound/driver.h> 106 #include <asm/io.h> 107 #include <linux/init.h> 108 #include <linux/slab.h> 109 #include <sound/core.h> 109 110 #include <sound/rawmidi.h> 110 111 #define SNDRV_GET_ID … … 115 116 EXPORT_NO_SYMBOLS; 116 117 MODULE_DESCRIPTION("MIDI serial"); 118 MODULE_LICENSE("GPL"); 117 119 MODULE_CLASSES("{sound}"); 118 120 MODULE_DEVICES("{{ALSA, MIDI serial}}"); … … 769 771 if (uart->irq >= 0) 770 772 free_irq(uart->irq, (void *)uart); 771 if (uart->res_base) 773 if (uart->res_base) { 772 774 release_resource(uart->res_base); 773 kfree(uart); 775 kfree_nocheck(uart->res_base); 776 } 777 snd_magic_kfree(uart); 774 778 return 0; 775 779 }; … … 918 922 if ((err = snd_uart16550_detect(snd_port[dev])) <= 0) { 919 923 snd_card_free(card); 920 snd_printk("no UART detected at 0x%lx\n", (long)snd_port[dev]);924 printk(KERN_ERR "no UART detected at 0x%lx\n", (long)snd_port[dev]); 921 925 return err; 922 926 } … … 967 971 if (cards == 0) { 968 972 #ifdef MODULE 969 snd_printk("serial midi soundcard not found or device busy\n");973 printk(KERN_ERR "serial midi soundcard not found or device busy\n"); 970 974 #endif 971 975 return -ENODEV; … … 989 993 #ifndef MODULE 990 994 991 /* format is: snd- card-serial=snd_enable,snd_index,snd_id,995 /* format is: snd-serial=snd_enable,snd_index,snd_id, 992 996 snd_port,snd_irq,snd_speed,snd_base,snd_outs */ 993 997 … … 1011 1015 } 1012 1016 1013 __setup("snd- card-serial=", alsa_card_serial_setup);1017 __setup("snd-serial=", alsa_card_serial_setup); 1014 1018 1015 1019 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/drivers/virmidi.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ … … 30 30 * 31 31 * Typical usage is like following: 32 * - Load snd- card-virmidi module.33 * # modprobe snd- card-virmidi snd_index=232 * - Load snd-virmidi module. 33 * # modprobe snd-virmidi snd_index=2 34 34 * Then, sequencer clients 72:0 to 75:0 will be created, which are 35 35 * mapped from /dev/snd/midiC1D0 to /dev/snd/midiC1D3, respectively. … … 42 42 */ 43 43 44 #define SNDRV_MAIN_OBJECT_FILE45 44 #include <sound/driver.h> 45 #include <linux/init.h> 46 #include <linux/wait.h> 47 #include <linux/sched.h> 48 #include <sound/core.h> 46 49 #include <sound/seq_kernel.h> 47 50 #include <sound/seq_virmidi.h> … … 50 53 51 54 EXPORT_NO_SYMBOLS; 55 56 MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); 52 57 MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices"); 58 MODULE_LICENSE("GPL"); 53 59 MODULE_CLASSES("{sound}"); 54 60 MODULE_DEVICES("{{ALSA,Virtual rawmidi device}}"); … … 136 142 if (snd_card_virmidi_probe(dev) < 0) { 137 143 #ifdef MODULE 138 snd_printk("Card-VirMIDI #%i not found or device busy\n", dev + 1);144 printk(KERN_ERR "Card-VirMIDI #%i not found or device busy\n", dev + 1); 139 145 #endif 140 146 break; … … 144 150 if (!cards) { 145 151 #ifdef MODULE 146 snd_printk("Card-VirMIDI soundcard not found or device busy\n");152 printk(KERN_ERR "Card-VirMIDI soundcard not found or device busy\n"); 147 153 #endif 148 154 return -ENODEV; … … 164 170 #ifndef MODULE 165 171 166 /* format is: snd- card-virmidi=snd_enable,snd_index,snd_id,snd_midi_devs */172 /* format is: snd-virmidi=snd_enable,snd_index,snd_id,snd_midi_devs */ 167 173 168 174 static int __init alsa_card_virmidi_setup(char *str) … … 180 186 } 181 187 182 __setup("snd- card-virmidi=", alsa_card_virmidi_setup);188 __setup("snd-virmidi=", alsa_card_virmidi_setup); 183 189 184 190 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h
r86 r92 106 106 #include <linux/kernel.h> 107 107 #include <linux/sched.h> 108 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 7) 108 109 #include <linux/malloc.h> 110 #else 111 #include <linux/slab.h> 112 #endif 109 113 #include <linux/delay.h> 114 #include <linux/bitops.h> 110 115 111 116 #include <linux/ioport.h> … … 136 141 #endif 137 142 #include "compat_22.h" 138 #endif 143 #endif /* LINUX_2_2 */ 144 139 145 #ifdef LINUX_2_3 140 146 #include <linux/init.h> … … 166 172 #define pci_alloc_consistent snd_pci_hack_alloc_consistent 167 173 #endif /* i386 or ppc */ 174 #ifndef list_for_each_safe 175 #define list_for_each_safe(pos, n, head) \ 176 for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next) 177 #endif 168 178 #endif 169 179 … … 180 190 #endif 181 191 192 #ifndef MODULE_LICENSE 193 #define MODULE_LICENSE(license) 182 194 #ifndef PCI_D0 183 195 #define PCI_D0 0 … … 227 239 #define schedule_work(w) snd_compat_schedule_work(w) 228 240 229 /* Name change*/241 /* Typedef's */ 230 242 typedef struct timeval snd_timestamp_t; 231 243 #ifndef TARGET_OS2 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/initval.h
r32 r92 1 #ifndef __ INITVAL_H2 #define __ INITVAL_H1 #ifndef __SOUND_INITVAL_H 2 #define __SOUND_INITVAL_H 3 3 4 4 /* … … 18 18 * You should have received a copy of the GNU General Public License 19 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 * 22 22 */ … … 73 73 #define SNDRV_DEFAULT_ENABLE { 1,1,1,1,1,1,1,1 } 74 74 #define SNDRV_DEFAULT_ENABLE_PNP SNDRV_DEFAULT_ENABLE 75 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP 75 76 #define SNDRV_DEFAULT_PORT { REPEAT_SNDRV(-1) } 76 77 #define SNDRV_DEFAULT_IRQ { REPEAT_SNDRV(SNDRV_AUTO_IRQ) } … … 85 86 #define SNDRV_DEFAULT_STR { [0 ... (SNDRV_CARDS-1)] = NULL } 86 87 #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 } 88 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 } 89 #ifdef __ISAPNP__ 90 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP 91 #else 92 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE 93 #endif 87 94 #define SNDRV_DEFAULT_PORT { SNDRV_AUTO_PORT, [1 ... (SNDRV_CARDS-1)] = -1 } 88 95 #define SNDRV_DEFAULT_IRQ { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ } … … 196 203 #endif 197 204 198 #endif /* __INITVAL_H */205 #endif /* __SOUND_INITVAL_H */ -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_params.h
r32 r92 1 #ifndef __ PCM_PARAMS_H2 #define __ PCM_PARAMS_H1 #ifndef __SOUND_PCM_PARAMS_H 2 #define __SOUND_PCM_PARAMS_H 3 3 4 4 /* … … 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 22 * 23 23 */ … … 363 363 #undef assert 364 364 365 #endif 365 #endif /* __SOUND_PCM_PARAMS_H */ 366 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/version.h
r32 r92 2 2 * Configuration header file for compilation of the ALSA driver 3 3 */ 4 #define CONFIG_SND_DATE "04-29-2007" 4 5 5 6 #ifndef __ALSA_VERSION_H__ -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a.c
r32 r92 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 #define SNDRV_MAIN_OBJECT_FILE22 21 #include <sound/driver.h> 22 #include <linux/init.h> 23 #include <linux/time.h> 24 #include <linux/wait.h> 25 #ifndef LINUX_ISAPNP_H 26 #include <linux/isapnp.h> 27 #define isapnp_card pci_bus 28 #define isapnp_dev pci_dev 29 #endif 30 #include <sound/core.h> 23 31 #define SNDRV_GET_ID 24 32 #include <sound/initval.h> … … 29 37 #define chip_t ad1816a_t 30 38 39 #define PFX "ad1816a: " 40 31 41 EXPORT_NO_SYMBOLS; 42 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 32 43 MODULE_DESCRIPTION("AD1816A, AD1815"); 44 MODULE_LICENSE("GPL"); 33 45 MODULE_CLASSES("{sound}"); 34 46 MODULE_DEVICES("{{Highscreen,Sound-Boostar 16 3D}," … … 36 48 "{Analog Devices,AD1816A}," 37 49 "{TerraTec,Base 64}," 38 "{Aztech/Newcom SC-16 3D}}"); 50 "{TerraTec,AudioSystem EWS64S}," 51 "{Aztech/Newcom SC-16 3D}," 52 "{Shark Predator ISA}}"); 39 53 40 54 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 41 55 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 42 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ; /* Enable this card */56 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 43 57 static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 44 58 static long snd_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 121 135 /* Analog Devices AD1816A - Terratec Base 64 */ 122 136 ISAPNP_AD1816A('T','E','R',0x1411,'A','D','S',0x7180,0x7181), 137 /* Analog Devices AD1816A - Terratec AudioSystem EWS64S */ 138 ISAPNP_AD1816A('T','E','R',0x1112,'A','D','S',0x7180,0x7181), 123 139 /* Analog Devices AD1816A - Aztech/Newcom SC-16 3D */ 124 140 ISAPNP_AD1816A('A','Z','T',0x1022,'A','Z','T',0x1018,0x2002), 141 /* Shark Predator ISA - added by Ken Arromdee */ 142 ISAPNP_AD1816A('S','M','M',0x7180,'A','D','S',0x7180,0x7181), 125 143 { ISAPNP_CARD_END, } 126 144 }; … … 170 188 171 189 if (pdev->activate(pdev) < 0) { 172 snd_printk("AUDIO isapnp configure failure\n");190 printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); 173 191 return -EBUSY; 174 192 } … … 196 214 if (pdev->activate(pdev) < 0) { 197 215 /* not fatal error */ 198 snd_printk("MPU-401 isapnp configure failure\n");216 printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); 199 217 snd_mpu_port[dev] = -1; 200 218 acard->devmpu = NULL; … … 251 269 } 252 270 #else 253 snd_printk("you have to enable ISA PnP support.\n");271 printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); 254 272 return -ENOSYS; 255 273 #endif /* __ISAPNP__ */ … … 278 296 snd_mpu_port[dev], 0, snd_mpu_irq[dev], SA_INTERRUPT, 279 297 NULL) < 0) 280 snd_printk("no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]);298 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", snd_mpu_port[dev]); 281 299 } 282 300 … … 285 303 snd_fm_port[dev], snd_fm_port[dev] + 2, 286 304 OPL3_HW_AUTO, 0, &opl3) < 0) { 287 snd_printk("no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2);305 printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx.\n", snd_fm_port[dev], snd_fm_port[dev] + 2); 288 306 } else { 289 307 if ((error = snd_opl3_timer_new(opl3, 1, 2)) < 0) { … … 340 358 cards += isapnp_probe_cards(snd_ad1816a_pnpids, snd_ad1816a_isapnp_detect); 341 359 #else 342 snd_printk("you have to enable ISA PnP support.\n");360 printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); 343 361 #endif 344 362 #ifdef MODULE 345 363 if (!cards) 346 snd_printk("no AD1816A based soundcards found.\n");364 printk(KERN_ERR "no AD1816A based soundcards found.\n"); 347 365 #endif /* MODULE */ 348 366 return cards ? 0 : -ENODEV; … … 362 380 #ifndef MODULE 363 381 364 /* format is: snd- card-ad1816a=snd_enable,snd_index,snd_id,snd_port,382 /* format is: snd-ad1816a=snd_enable,snd_index,snd_id,snd_port, 365 383 snd_mpu_port,snd_fm_port,snd_irq,snd_mpu_irq, 366 384 snd_dma1,snd_dma2 */ … … 386 404 } 387 405 388 __setup("snd- card-ad1816a=", alsa_card_ad1816a_setup);406 __setup("snd-ad1816a=", alsa_card_ad1816a_setup); 389 407 390 408 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c
r32 r92 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 #define SNDRV_MAIN_OBJECT_FILE22 21 #include <sound/driver.h> 22 #include <asm/io.h> 23 #include <asm/dma.h> 24 #include <linux/delay.h> 25 #include <linux/init.h> 26 #include <linux/slab.h> 27 #include <sound/core.h> 23 28 #include <sound/ad1816a.h> 29 30 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 31 MODULE_DESCRIPTION("lowlevel code for Analog Devices AD1816A chip"); 32 MODULE_LICENSE("GPL"); 24 33 25 34 #define chip_t ad1816a_t … … 233 242 AD1816A_PLAYBACK_ENABLE | AD1816A_PLAYBACK_PIO, 0x00); 234 243 235 snd_dma_program(chip->dma1, runtime->dma_a rea, size,244 snd_dma_program(chip->dma1, runtime->dma_addr, size, 236 245 DMA_MODE_WRITE | DMA_AUTOINIT); 237 246 … … 262 271 AD1816A_CAPTURE_ENABLE | AD1816A_CAPTURE_PIO, 0x00); 263 272 264 snd_dma_program(chip->dma2, runtime->dma_a rea, size,273 snd_dma_program(chip->dma2, runtime->dma_addr, size, 265 274 DMA_MODE_READ | DMA_AUTOINIT); 266 275 … … 490 499 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); 491 500 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max); 501 chip->playback_substream = substream; 492 502 return 0; 493 503 } … … 505 515 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); 506 516 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max); 517 chip->capture_substream = substream; 507 518 return 0; 508 519 } … … 573 584 static int snd_ad1816a_free(ad1816a_t *chip) 574 585 { 575 if (chip->res_port) 586 if (chip->res_port) { 576 587 release_resource(chip->res_port); 588 kfree_nocheck(chip->res_port); 589 } 577 590 if (chip->irq >= 0) 578 591 free_irq(chip->irq, (void *) chip); … … 745 758 snd_ad1816a_init(chip); 746 759 747 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);760 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 748 761 749 762 chip->pcm = pcm; … … 978 991 static snd_kcontrol_new_t snd_ad1816a_controls[] = { 979 992 AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), 980 AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 0),993 AD1816A_DOUBLE("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1), 981 994 AD1816A_DOUBLE("PCM Playback Switch", AD1816A_VOICE_ATT, 15, 7, 1, 1), 982 AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 0),995 AD1816A_DOUBLE("PCM Playback Volume", AD1816A_VOICE_ATT, 8, 0, 63, 1), 983 996 AD1816A_DOUBLE("Line Playback Switch", AD1816A_LINE_GAIN_ATT, 15, 7, 1, 1), 984 AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 0),997 AD1816A_DOUBLE("Line Playback Volume", AD1816A_LINE_GAIN_ATT, 8, 0, 31, 1), 985 998 AD1816A_DOUBLE("CD Playback Switch", AD1816A_CD_GAIN_ATT, 15, 7, 1, 1), 986 AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 0),999 AD1816A_DOUBLE("CD Playback Volume", AD1816A_CD_GAIN_ATT, 8, 0, 31, 1), 987 1000 AD1816A_DOUBLE("Synth Playback Switch", AD1816A_SYNTH_GAIN_ATT, 15, 7, 1, 1), 988 AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 0),1001 AD1816A_DOUBLE("Synth Playback Volume", AD1816A_SYNTH_GAIN_ATT, 8, 0, 31, 1), 989 1002 AD1816A_DOUBLE("FM Playback Switch", AD1816A_FM_ATT, 15, 7, 1, 1), 990 AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 0),1003 AD1816A_DOUBLE("FM Playback Volume", AD1816A_FM_ATT, 8, 0, 63, 1), 991 1004 AD1816A_SINGLE("Mic Playback Switch", AD1816A_MIC_GAIN_ATT, 15, 1, 1), 992 AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 0),1005 AD1816A_SINGLE("Mic Playback Volume", AD1816A_MIC_GAIN_ATT, 8, 63, 1), 993 1006 AD1816A_SINGLE("Mic Boost", AD1816A_MIC_GAIN_ATT, 14, 1, 0), 994 1007 AD1816A_DOUBLE("Video Playback Switch", AD1816A_VID_GAIN_ATT, 15, 7, 1, 1), 995 AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 0),1008 AD1816A_DOUBLE("Video Playback Volume", AD1816A_VID_GAIN_ATT, 8, 0, 31, 1), 996 1009 AD1816A_SINGLE("Phone Capture Switch", AD1816A_PHONE_IN_GAIN_ATT, 15, 1, 1), 997 AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 31, 0),1010 AD1816A_SINGLE("Phone Capture Volume", AD1816A_PHONE_IN_GAIN_ATT, 0, 15, 1), 998 1011 AD1816A_SINGLE("Phone Playback Switch", AD1816A_PHONE_OUT_ATT, 7, 1, 1), 999 AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 0),1012 AD1816A_SINGLE("Phone Playback Volume", AD1816A_PHONE_OUT_ATT, 0, 31, 1), 1000 1013 { 1001 1014 #ifdef TARGET_OS2 -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848.c
r32 r92 18 18 * You should have received a copy of the GNU General Public License 19 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 * 22 22 */ 23 23 24 #define SNDRV_MAIN_OBJECT_FILE25 24 #include <sound/driver.h> 25 #include <linux/init.h> 26 #include <linux/time.h> 27 #include <linux/wait.h> 28 #include <sound/core.h> 26 29 #include <sound/ad1848.h> 27 30 #define SNDRV_GET_ID … … 31 34 32 35 EXPORT_NO_SYMBOLS; 36 MODULE_AUTHOR("Tugrul Galatali <galatalt@stuy.edu>, Jaroslav Kysela <perex@suse.cz>"); 33 37 MODULE_DESCRIPTION("AD1848/AD1847/CS4248"); 38 MODULE_LICENSE("GPL"); 34 39 MODULE_CLASSES("{sound}"); 35 40 MODULE_DEVICES("{{Analog Devices,AD1848}," … … 131 136 if (!cards) { 132 137 #ifdef MODULE 133 snd_printk("AD1848 soundcard not found or device busy\n");138 printk(KERN_ERR "AD1848 soundcard not found or device busy\n"); 134 139 #endif 135 140 return -ENODEV; … … 151 156 #ifndef MODULE 152 157 153 /* format is: snd- card-ad1848=snd_enable,snd_index,snd_id,snd_port,158 /* format is: snd-ad1848=snd_enable,snd_index,snd_id,snd_port, 154 159 snd_irq,snd_dma1 */ 155 160 … … 170 175 } 171 176 172 __setup("snd- card-ad1848=", alsa_card_ad1848_setup);177 __setup("snd-ad1848=", alsa_card_ad1848_setup); 173 178 174 179 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ … … 22 22 #define SNDRV_MAIN_OBJECT_FILE 23 23 #include <sound/driver.h> 24 #include <asm/io.h> 25 #include <asm/dma.h> 26 #include <linux/delay.h> 27 #include <linux/slab.h> 28 #include <sound/core.h> 24 29 #include <sound/ad1848.h> 30 31 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 32 MODULE_DESCRIPTION("Routines for control of AD1848/AD1847/CS4248"); 33 MODULE_LICENSE("GPL"); 25 34 26 35 #define chip_t ad1848_t … … 114 123 } 115 124 116 staticvoid snd_ad1848_dout(ad1848_t *chip,125 void snd_ad1848_dout(ad1848_t *chip, 117 126 unsigned char reg, 118 127 unsigned char value) … … 127 136 } 128 137 129 staticunsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg)138 unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg) 130 139 { 131 140 int timeout; … … 172 181 */ 173 182 174 staticvoid snd_ad1848_mce_up(ad1848_t *chip)183 void snd_ad1848_mce_up(ad1848_t *chip) 175 184 { 176 185 unsigned long flags; … … 193 202 } 194 203 195 staticvoid snd_ad1848_mce_down(ad1848_t *chip)204 void snd_ad1848_mce_down(ad1848_t *chip) 196 205 { 197 206 unsigned long flags; … … 292 301 } 293 302 snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] |= what); 303 chip->mode |= AD1848_MODE_RUNNING; 294 304 } else if (cmd == SNDRV_PCM_TRIGGER_STOP) { 295 305 if (!(chip->image[AD1848_IFACE_CTRL] & what)) { … … 298 308 } 299 309 snd_ad1848_out(chip, AD1848_IFACE_CTRL, chip->image[AD1848_IFACE_CTRL] &= ~what); 310 chip->mode &= ~AD1848_MODE_RUNNING; 300 311 } else { 301 312 result = -EINVAL; … … 524 535 chip->dma_size = size; 525 536 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_PLAYBACK_ENABLE | AD1848_PLAYBACK_PIO); 526 snd_dma_program(chip->dma, runtime->dma_a rea, size, DMA_MODE_WRITE | DMA_AUTOINIT);537 snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 527 538 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; 528 539 spin_lock_irqsave(&chip->reg_lock, flags); … … 568 579 chip->dma_size = size; 569 580 chip->image[AD1848_IFACE_CTRL] &= ~(AD1848_CAPTURE_ENABLE | AD1848_CAPTURE_PIO); 570 snd_dma_program(chip->dma, runtime->dma_a rea, size, DMA_MODE_READ | DMA_AUTOINIT);581 snd_dma_program(chip->dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 571 582 count = snd_ad1848_get_count(chip->image[AD1848_DATA_FORMAT], count) - 1; 572 583 spin_lock_irqsave(&chip->reg_lock, flags); … … 581 592 ad1848_t *chip = snd_magic_cast(ad1848_t, dev_id, return); 582 593 583 if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream) 594 if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream && 595 (chip->mode & AD1848_MODE_RUNNING)) 584 596 snd_pcm_period_elapsed(chip->playback_substream); 585 if ((chip->mode & AD1848_MODE_CAPTURE) && chip->capture_substream) 597 if ((chip->mode & AD1848_MODE_CAPTURE) && chip->capture_substream && 598 (chip->mode & AD1848_MODE_RUNNING)) 586 599 snd_pcm_period_elapsed(chip->capture_substream); 587 600 outb(0, AD1848P(chip, STATUS)); /* clear global interrupt bit */ … … 821 834 static int snd_ad1848_free(ad1848_t *chip) 822 835 { 823 if (chip->res_port) 836 if (chip->res_port) { 824 837 release_resource(chip->res_port); 838 kfree_nocheck(chip->res_port); 839 } 825 840 if (chip->irq >= 0) 826 841 free_irq(chip->irq, (void *) chip); … … 980 995 strcpy(pcm->name, snd_ad1848_chip_id(chip)); 981 996 982 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);997 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma > 3 ? 128*1024 : 64*1024); 983 998 984 999 chip->pcm = pcm; … … 995 1010 { 996 1011 static char *texts[4] = { 997 "Line 1", "Aux", "Line2", "Mix"1012 "Line", "Aux", "Mic", "Mix" 998 1013 }; 999 1014 … … 1172 1187 AD1848_DOUBLE("Aux Playback Switch", 1, AD1848_AUX2_LEFT_INPUT, AD1848_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 1173 1188 AD1848_DOUBLE("Aux Playback Volume", 1, AD1848_AUX2_LEFT_INPUT, AD1848_AUX2_RIGHT_INPUT, 0, 0, 31, 1), 1174 AD1848_DOUBLE("Capture Volume", 0, AD1848_LEFT_INPUT, AD1848_ LEFT_INPUT, 0, 0, 15, 0),1189 AD1848_DOUBLE("Capture Volume", 0, AD1848_LEFT_INPUT, AD1848_RIGHT_INPUT, 0, 0, 15, 0), 1175 1190 { 1176 1191 #ifdef TARGET_OS2 … … 1212 1227 } 1213 1228 1229 EXPORT_SYMBOL(snd_ad1848_in); 1214 1230 EXPORT_SYMBOL(snd_ad1848_out); 1231 EXPORT_SYMBOL(snd_ad1848_dout); 1232 EXPORT_SYMBOL(snd_ad1848_mce_up); 1233 EXPORT_SYMBOL(snd_ad1848_mce_down); 1215 1234 EXPORT_SYMBOL(snd_ad1848_interrupt); 1216 1235 EXPORT_SYMBOL(snd_ad1848_create); -
GPL/branches/alsa-resync1/alsa-kernel/isa/als100.c
r32 r92 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 23 23 #define SNDRV_MAIN_OBJECT_FILE 24 24 #include <sound/driver.h> 25 #include <linux/init.h> 26 #include <linux/wait.h> 27 #include <linux/sched.h> 28 #include <linux/time.h> 29 #include <sound/core.h> 25 30 #define SNDRV_GET_ID 26 31 #include <sound/initval.h> … … 31 36 #define chip_t sb_t 32 37 38 #define PFX "als100: " 39 33 40 EXPORT_NO_SYMBOLS; 41 42 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 34 43 MODULE_DESCRIPTION("Avance Logic ALS1X0"); 44 MODULE_LICENSE("GPL"); 35 45 MODULE_CLASSES("{sound}"); 36 46 MODULE_DEVICES("{{Avance Logic,ALS100 - PRO16PNP}," 37 47 "{Avance Logic,ALS110}," 48 "{Avance Logic,ALS120}," 49 "{Avance Logic,ALS200}," 38 50 "{3D Melody,MF1000}," 39 51 "{Digimate,3D Sound}," … … 122 134 /* ALS120 */ 123 135 ISAPNP_ALS100('A','L','S',0x0120,0x2001,0x2001,0x2001), 136 /* ALS200 */ 137 ISAPNP_ALS100('A','L','S',0x0200,0x0020,0x0020,0x0001), 124 138 /* RTL3000 */ 125 139 ISAPNP_ALS100('R','T','L',0x3000,0x2001,0x2001,0x2001), … … 173 187 174 188 if (pdev->activate(pdev)<0) { 175 snd_printk("AUDIO isapnp configure failure\n");189 printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); 176 190 return -EBUSY; 177 191 } … … 196 210 197 211 if (pdev->activate(pdev)<0) { 198 snd_printk("MPU-401 isapnp configure failure\n");212 printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); 199 213 snd_mpu_port[dev] = -1; 200 214 acard->devmpu = NULL; … … 214 228 215 229 if (pdev->activate(pdev)<0) { 216 snd_printk("OPL isapnp configure failure\n");230 printk(KERN_ERR PFX "OPL isapnp configure failure\n"); 217 231 snd_fm_port[dev] = -1; 218 232 acard->devopl = NULL; … … 272 286 } 273 287 #else 274 snd_printk("you have to enable PnP support ...\n");288 printk(KERN_ERR PFX "you have to enable PnP support ...\n"); 275 289 snd_card_free(card); 276 290 return -ENOSYS; … … 302 316 snd_mpu_irq[dev], SA_INTERRUPT, 303 317 NULL) < 0) 304 snd_printk("no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]);318 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", snd_mpu_port[dev]); 305 319 } 306 320 … … 309 323 snd_fm_port[dev], snd_fm_port[dev] + 2, 310 324 OPL3_HW_AUTO, 0, &opl3) < 0) { 311 snd_printk("no OPL device at 0x%lx-0x%lx\n",325 printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", 312 326 snd_fm_port[dev], snd_fm_port[dev] + 2); 313 327 } else { … … 365 379 cards += isapnp_probe_cards(snd_als100_pnpids, snd_als100_isapnp_detect); 366 380 #else 367 snd_printk("you have to enable ISA PnP support.\n");381 printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); 368 382 #endif 369 383 #ifdef MODULE 370 384 if (!cards) 371 snd_printk("no ALS100 based soundcards found\n");385 printk(KERN_ERR "no ALS100 based soundcards found\n"); 372 386 #endif 373 387 return cards ? 0 : -ENODEV; … … 387 401 #ifndef MODULE 388 402 389 /* format is: snd- card-als100=snd_enable,snd_index,snd_id,snd_port,403 /* format is: snd-als100=snd_enable,snd_index,snd_id,snd_port, 390 404 snd_mpu_port,snd_fm_port,snd_irq,snd_mpu_irq, 391 405 snd_dma8,snd_dma16 */ … … 411 425 } 412 426 413 __setup("snd- card-als100=", alsa_card_als100_setup);427 __setup("snd-als100=", alsa_card_als100_setup); 414 428 415 429 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c
r32 r92 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 31 31 */ 32 32 33 #define SNDRV_MAIN_OBJECT_FILE34 33 #include <sound/driver.h> 34 #include <asm/io.h> 35 #include <linux/delay.h> 36 #include <linux/init.h> 37 #include <linux/time.h> 38 #include <linux/wait.h> 39 #include <sound/core.h> 35 40 #define SNDRV_GET_ID 36 41 #include <sound/initval.h> … … 41 46 #define chip_t cs4231_t 42 47 48 #define PFX "azt2320: " 49 43 50 EXPORT_NO_SYMBOLS; 51 52 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 44 53 MODULE_DESCRIPTION("Aztech Systems AZT2320"); 54 MODULE_LICENSE("GPL"); 45 55 MODULE_CLASSES("{sound}"); 46 56 MODULE_DEVICES("{{Aztech Systems,PRO16V}," … … 188 198 189 199 if (pdev->activate(pdev) < 0) { 190 snd_printk("AUDIO isapnp configure failure\n");200 printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); 191 201 return -EBUSY; 192 202 } … … 214 224 if (pdev->activate(pdev) < 0) { 215 225 /* not fatal error */ 216 snd_printk("MPU-401 isapnp configure failure\n");226 printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); 217 227 snd_mpu_port[dev] = -1; 218 228 acard->devmpu = NULL; … … 326 336 snd_mpu_irq[dev], SA_INTERRUPT, 327 337 NULL) < 0) 328 snd_printk("no MPU-401 device at 0x%lx\n",338 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", 329 339 snd_mpu_port[dev]); 330 340 } … … 334 344 snd_fm_port[dev], snd_fm_port[dev] + 2, 335 345 OPL3_HW_AUTO, 0, &opl3) < 0) { 336 snd_printk("no OPL device at 0x%lx-0x%lx\n",346 printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", 337 347 snd_fm_port[dev], snd_fm_port[dev] + 2); 338 348 } else { … … 390 400 cards += isapnp_probe_cards(snd_azt2320_pnpids, snd_azt2320_isapnp_detect); 391 401 #else 392 snd_printk("you have to enable ISA PnP support.\n");402 printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); 393 403 #endif 394 404 #ifdef MODULE 395 405 if (!cards) 396 snd_printk("no AZT2320 based soundcards found\n");406 printk(KERN_ERR "no AZT2320 based soundcards found\n"); 397 407 #endif 398 408 return cards ? 0 : -ENODEV; … … 412 422 #ifndef MODULE 413 423 414 /* format is: snd- card-azt2320=snd_enable,snd_index,snd_id,snd_port,424 /* format is: snd-azt2320=snd_enable,snd_index,snd_id,snd_port, 415 425 snd_wss_port,snd_mpu_port,snd_fm_port, 416 426 snd_irq,snd_mpu_irq,snd_dma1,snd_dma2 */ … … 436 446 } 437 447 438 __setup("snd- card-azt2320=", alsa_card_azt2320_setup);448 __setup("snd-azt2320=", alsa_card_azt2320_setup); 439 449 440 450 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ … … 44 44 */ 45 45 46 #define SNDRV_MAIN_OBJECT_FILE47 48 46 #include <sound/driver.h> 47 #include <linux/init.h> 48 #include <linux/slab.h> 49 #include <sound/core.h> 49 50 #include <sound/ad1848.h> 50 51 #include <sound/sb.h> … … 53 54 54 55 EXPORT_NO_SYMBOLS; 56 57 MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>"); 55 58 MODULE_DESCRIPTION("C-Media CMI8330"); 59 MODULE_LICENSE("GPL"); 56 60 MODULE_CLASSES("{sound}"); 57 61 MODULE_DEVICES("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}"); … … 75 79 static int snd_wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; 76 80 77 MODULE_AUTHOR("George Talusan <gstalusan@uwaterloo.ca>");78 81 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 79 82 MODULE_PARM_DESC(snd_index, "Index value for CMI8330 soundcard."); … … 499 502 if (!cards) { 500 503 #ifdef MODULE 501 snd_printk("CMI8330 not found or device busy\n");504 printk(KERN_ERR "CMI8330 not found or device busy\n"); 502 505 #endif 503 506 return -ENODEV; … … 511 514 #ifndef MODULE 512 515 513 /* format is: snd-c ard-cmi8330=snd_enable,snd_index,snd_id,snd_isapnp,516 /* format is: snd-cmi8330=snd_enable,snd_index,snd_id,snd_isapnp, 514 517 snd_sbport,snd_sbirq, 515 518 snd_sbdma8,snd_sbdma16, … … 532 535 get_option(&str,&snd_sbdma8[nr_dev]) == 2 && 533 536 get_option(&str,&snd_sbdma16[nr_dev]) == 2 && 534 get_option(&str, &snd_wssport[nr_dev]) == 2 &&537 get_option(&str,(int *)&snd_wssport[nr_dev]) == 2 && 535 538 get_option(&str,&snd_wssirq[nr_dev]) == 2 && 536 539 get_option(&str,&snd_wssdma[nr_dev]) == 2); … … 543 546 } 544 547 545 __setup("snd-c ard-cmi8330=", alsa_card_cmi8330_setup);548 __setup("snd-cmi8330=", alsa_card_cmi8330_setup); 546 549 547 550 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 */ 22 22 23 #define SNDRV_MAIN_OBJECT_FILE24 23 #include <sound/driver.h> 24 #include <linux/init.h> 25 #include <linux/time.h> 26 #include <linux/wait.h> 27 #include <sound/core.h> 25 28 #include <sound/cs4231.h> 26 29 #include <sound/mpu401.h> … … 31 34 32 35 EXPORT_NO_SYMBOLS; 36 37 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 33 38 MODULE_DESCRIPTION("Generic CS4231"); 39 MODULE_LICENSE("GPL"); 34 40 MODULE_CLASSES("{sound}"); 35 41 MODULE_DEVICES("{{Crystal Semiconductors,CS4231}}"); … … 130 136 snd_mpu_irq[dev], SA_INTERRUPT, 131 137 NULL) < 0) 132 snd_printk("MPU401 not detected\n");138 printk(KERN_ERR "cs4231: MPU401 not detected\n"); 133 139 } 134 140 strcpy(card->driver, "CS4231"); … … 156 162 if (!cards) { 157 163 #ifdef MODULE 158 snd_printk("CS4231 soundcard not found or device busy\n");164 printk(KERN_ERR "CS4231 soundcard not found or device busy\n"); 159 165 #endif 160 166 return -ENODEV; … … 176 182 #ifndef MODULE 177 183 178 /* format is: snd-c ard-cs4231=snd_enable,snd_index,snd_id,184 /* format is: snd-cs4231=snd_enable,snd_index,snd_id, 179 185 snd_port,snd_mpu_port,snd_irq,snd_mpu_irq, 180 186 snd_dma1,snd_dma2 */ … … 201 207 } 202 208 203 __setup("snd-c ard-cs4231=", alsa_card_cs4231_setup);209 __setup("snd-cs4231=", alsa_card_cs4231_setup); 204 210 205 211 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c
r32 r92 21 21 * You should have received a copy of the GNU General Public License 22 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 * 25 25 */ 26 26 27 #define SNDRV_MAIN_OBJECT_FILE28 27 #include <sound/driver.h> 28 #include <asm/io.h> 29 #include <asm/dma.h> 30 #include <asm/irq.h> 31 #include <linux/delay.h> 32 #include <linux/pm.h> 33 #include <linux/init.h> 34 #include <linux/slab.h> 35 #include <sound/core.h> 29 36 #include <sound/cs4231.h> 37 38 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 39 MODULE_DESCRIPTION("Routines for control of CS4231(A)/CS4232/InterWave & compatible chips"); 40 MODULE_LICENSE("GPL"); 30 41 31 42 #define chip_t cs4231_t … … 743 754 chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; 744 755 snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); 745 spin_unlock_irqrestore(&chip->reg_lock, flags);746 756 747 757 /* now disable record & playback */ 748 758 749 spin_lock_irqsave(&chip->reg_lock, flags);750 759 if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | 751 760 CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) { … … 849 858 unsigned int count = snd_pcm_lib_period_bytes(substream); 850 859 860 spin_lock_irqsave(&chip->reg_lock, flags); 851 861 chip->p_dma_size = size; 852 862 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); 853 snd_dma_program(chip->dma1, runtime->dma_a rea, size, DMA_MODE_WRITE | DMA_AUTOINIT);863 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 854 864 count = snd_cs4231_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; 855 spin_lock_irqsave(&chip->reg_lock, flags);856 865 snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); 857 866 snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); … … 891 900 unsigned int count = snd_pcm_lib_period_bytes(substream); 892 901 902 spin_lock_irqsave(&chip->reg_lock, flags); 893 903 chip->c_dma_size = size; 894 904 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); 895 snd_dma_program(chip->dma2, runtime->dma_a rea, size, DMA_MODE_READ | DMA_AUTOINIT);905 snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 896 906 count = snd_cs4231_get_count(chip->image[CS4231_REC_FORMAT], count) - 1; 897 spin_lock_irqsave(&chip->reg_lock, flags);898 907 if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) { 899 908 snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); … … 1358 1367 } 1359 1368 snd_cs4231_busy_wait(chip); 1360 return;1369 spin_unlock_irqrestore(&chip->reg_lock, flags); 1361 1370 #endif 1362 1371 } … … 1383 1392 static int snd_cs4231_free(cs4231_t *chip) 1384 1393 { 1385 if (chip->res_port) 1394 if (chip->res_port) { 1386 1395 release_resource(chip->res_port); 1387 if (chip->res_cport) 1396 kfree_nocheck(chip->res_port); 1397 } 1398 if (chip->res_cport) { 1388 1399 release_resource(chip->res_cport); 1400 kfree_nocheck(chip->res_cport); 1401 } 1389 1402 if (chip->irq >= 0) { 1390 1403 disable_irq(chip->irq); … … 1612 1625 strcpy(pcm->name, snd_cs4231_chip_id(chip)); 1613 1626 1614 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);1627 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 1615 1628 1616 1629 chip->pcm = pcm; -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/slab.h> 25 #ifndef LINUX_ISAPNP_H 26 #include <linux/isapnp.h> 27 #define isapnp_card pci_bus 28 #define isapnp_dev pci_dev 29 #endif 30 #include <sound/core.h> 24 31 #include <sound/cs4231.h> 25 32 #include <sound/mpu401.h> … … 31 38 32 39 EXPORT_NO_SYMBOLS; 40 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 41 MODULE_LICENSE("GPL"); 42 MODULE_CLASSES("{sound}"); 33 43 #ifdef CS4232 34 44 MODULE_DESCRIPTION("Cirrus Logic CS4232"); 35 MODULE_CLASSES("{sound}");36 45 MODULE_DEVICES("{{Turtle Beach,TBS-2000}," 37 46 "{Turtle Beach,Tropez Plus}," 38 47 "{SIC CrystalWave 32}," 39 "{HP,Omnibook 5500}}," 40 "{TerraTec,Maestro 32/96}"); 48 "{Hewlett Packard,Omnibook 5500}," 49 "{TerraTec,Maestro 32/96}," 50 "{Philips,PCA70PS}}"); 41 51 #else 42 52 MODULE_DESCRIPTION("Cirrus Logic CS4235-9"); 43 MODULE_CLASSES("{sound}");44 53 MODULE_DEVICES("{{Crystal Semiconductors,CS4235}," 45 54 "{Crystal Semiconductors,CS4236}," … … 47 56 "{Crystal Semiconductors,CS4238}," 48 57 "{Crystal Semiconductors,CS4239}," 58 "{Acer,AW37}," 59 "{Acer,AW35/Pro}," 60 "{Crystal,3D}," 61 "{Crystal Computer,TidalWave128}," 62 "{Dell,Optiplex GX1}," 63 "{Dell,Workstation 400 sound}," 64 "{EliteGroup,P5TX-LA sound}," 65 "{Gallant,SC-70P}," 66 "{Gateway,E1000 Onboard CS4236B}," 49 67 "{Genius,Sound Maker 3DJ}," 50 68 "{Hewlett Packard,HP6330 sound}," 51 "{Crystal Computer,TidalWave128}," 52 "{Acer,AW37}," 53 "{EliteGroup,P5TX-LA sound}," 54 "{Crystal,3D}," 69 "{IBM,PC 300PL sound}," 70 "{IBM,Aptiva 2137 E24}," 71 "{IBM,IntelliStation M Pro}," 72 "{Intel,Marlin Spike Mobo CS4235}," 73 "{Guillemot,MaxiSound 16 PnP}," 74 "{NewClear,3D}," 75 "{TerraTec,AudioSystem EWS64L/XL}," 55 76 "{Typhoon Soundsystem,CS4236B}," 56 "{TerraTec, AudioSystem EWS64XL},"57 "{NewClear,3D},"58 "{Dell,Optiplex GX1},"59 "{Dell,Workstation 400 sound},"60 77 "{Turtle Beach,Malibu}," 61 "{Crystal Semiconductors,CS4235}," 62 "{IBM,Adaptiva 2137 E24}," 63 "{Maxi Sound,16 PnP}," 64 "{Gallant,SC-70P}," 65 "{Acer,AW37/Pro}," 66 "{Acer,AW35/Pro}," 67 "{Intel, Marlin Spike Mobo CS4235}," 68 "{IBM,IntelliStation M Pro}}"); 78 "{Unknown,Digital PC 5000 Onboard}}"); 69 79 #endif 70 80 … … 77 87 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 78 88 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 79 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */89 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 80 90 #ifdef __ISAPNP__ 81 91 #ifdef TARGET_OS2 … … 200 210 #ifdef CS4232 201 211 static struct isapnp_card_id snd_card_pnpids[] __devinitdata = { 212 /* Philips PCA70PS */ 213 ISAPNP_CS4232_1('C','S','C',0x0d32,0x0000,0x0010,0xb006), 214 /* TerraTec Maestro 32/96 (CS4232) */ 215 ISAPNP_CS4232('C','S','C',0x1a32,0x0000,0x0010,0x0003), 202 216 /* HP Omnibook 5500 onboard */ 203 217 ISAPNP_CS4232('C','S','C',0x4232,0x0000,0x0002,0x0003), … … 208 222 /* SIC CrystalWave 32 (CS4232) */ 209 223 ISAPNP_CS4232('C','S','C',0xf032,0x0000,0x0010,0x0003), 210 /* TerraTec Maestro 32/96 (CS4232) */211 ISAPNP_CS4232('C','S','C',0x1a32,0x0000,0x0010,0x0003),212 224 /* --- */ 213 225 { ISAPNP_CARD_END, } /* end */ … … 221 233 /* Genius Sound Maker 3DJ - CS4237B */ 222 234 ISAPNP_CS4232('C','S','C',0x0437,0x0000,0x0010,0x0003), 235 /* Digital PC 5000 Onboard - CS4236B */ 236 ISAPNP_CS4232_WOMPU('C','S','C',0x0735,0x0000,0x0010), 223 237 /* some uknown CS4236B */ 224 238 ISAPNP_CS4232('C','S','C',0x0b35,0x0000,0x0010,0x0003), 225 239 /* CS4235 on mainboard without MPU */ 226 240 ISAPNP_CS4232_WOMPU('C','S','C',0x1425,0x0100,0x0110), 241 /* Gateway E1000 Onboard CS4236B */ 242 ISAPNP_CS4232('C','S','C',0x1335,0x0000,0x0010,0x0003), 227 243 /* HP 6330 Onboard sound */ 228 244 ISAPNP_CS4232('C','S','C',0x1525,0x0100,0x0110,0x0103), … … 253 269 /* CS4235 - onboard */ 254 270 ISAPNP_CS4232('C','S','C',0x8025,0x0100,0x0110,0x0103), 271 /* IBM PC 300PL Onboard - CS4236B */ 272 ISAPNP_CS4232_WOMPU('C','S','C',0xe836,0x0000,0x0010), 255 273 /* IBM Aptiva 2137 E24 Onboard - CS4237B */ 256 274 ISAPNP_CS4232('C','S','C',0x8037,0x0000,0x0010,0x0003), 257 /* Maxi Sound 16 PnP - CS4236B */ 275 /* IBM IntelliStation M Pro motherboard */ 276 ISAPNP_CS4232_WOMPU('C','S','C',0xc835,0x0000,0x0010), 277 /* Guillemot MaxiSound 16 PnP - CS4236B */ 258 278 ISAPNP_CS4232('C','S','C',0x9836,0x0000,0x0010,0x0003), 259 279 /* Gallant SC-70P */ 260 280 ISAPNP_CS4232('C','S','C',0x9837,0x0000,0x0010,0x0003), 261 /* IBM IntelliStation M Pro motherboard */262 ISAPNP_CS4232_WOMPU('C','S','C',0xc835,0x0000,0x0010),263 281 /* ACER AW37/Pro - CS4235 */ 264 282 ISAPNP_CS4232('C','S','C',0xd925,0x0000,0x0010,0x0003), … … 319 337 isapnp_resource_change(&pdev->dma_resource[1], snd_dma2[dev] < 0 ? 4 : snd_dma2[dev], 1); 320 338 if (pdev->activate(pdev)<0) { 321 snd_printk(IDENT " isapnp configure failed for WSS (out of resources?)\n");339 printk(KERN_ERR IDENT " isapnp configure failed for WSS (out of resources?)\n"); 322 340 return -EBUSY; 323 341 } … … 341 359 isapnp_resource_change(&pdev->resource[0], snd_cport[dev], 8); 342 360 if (pdev->activate(pdev)<0) { 343 snd_printk(IDENT " isapnp configure failed for control (out of resources?)\n");361 printk(KERN_ERR IDENT " isapnp configure failed for control (out of resources?)\n"); 344 362 acard->wss->deactivate(acard->wss); 345 363 return -EBUSY; … … 361 379 if (pdev->activate(pdev)<0) { 362 380 snd_mpu_port[dev] = SNDRV_AUTO_PORT; 363 snd_printk(IDENT " isapnp configure failed for MPU (out of resources?)\n"); 381 snd_mpu_irq[dev] = SNDRV_AUTO_IRQ; 382 printk(KERN_ERR IDENT " isapnp configure failed for MPU (out of resources?)\n"); 364 383 } else { 365 384 snd_mpu_port[dev] = pdev->resource[0].start; 385 if (pdev->irq_resource[0].flags & IORESOURCE_IRQ) { 366 386 snd_mpu_irq[dev] = pdev->irq_resource[0].start; 387 } else { 388 snd_mpu_irq[dev] = -1; /* disable interrupt */ 389 } 367 390 } 368 391 snd_printdd("isapnp MPU: port=0x%lx, irq=%i\n", snd_mpu_port[dev], snd_mpu_irq[dev]); … … 396 419 snd_card_cs4236_deactivate(acard); 397 420 #endif 398 if (acard->res_sb_port) 421 if (acard->res_sb_port) { 399 422 release_resource(acard->res_sb_port); 423 kfree_nocheck(acard->res_sb_port); 424 } 400 425 } 401 426 } … … 432 457 #ifdef __ISAPNP__ 433 458 if (snd_isapnp[dev] && (err = snd_card_cs4236_isapnp(dev, acard))<0) { 434 snd_printk("isapnp detection failed and probing for " IDENT " is not supported\n");459 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); 435 460 snd_card_free(card); 436 461 return -ENXIO; … … 445 470 if (snd_sb_port[dev] != SNDRV_AUTO_PORT) 446 471 if ((acard->res_sb_port = request_region(snd_sb_port[dev], 16, IDENT " SB")) == NULL) { 447 snd_printk("unable to register SB port at 0x%lx\n", snd_sb_port[dev]);472 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", snd_sb_port[dev]); 448 473 snd_card_free(card); 449 474 return -ENOMEM; … … 504 529 snd_fm_port[dev], snd_fm_port[dev] + 2, 505 530 OPL3_HW_OPL3_CS, 0, &opl3) < 0) { 506 snd_printk(IDENT ": OPL3 not detected\n");531 printk(KERN_ERR IDENT ": OPL3 not detected\n"); 507 532 } else { 508 533 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { … … 516 541 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, 517 542 snd_mpu_port[dev], 0, 518 snd_mpu_irq[dev], SA_INTERRUPT, NULL) < 0) 519 snd_printk(IDENT ": MPU401 not detected\n"); 543 snd_mpu_irq[dev], 544 snd_mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) 545 printk(KERN_ERR IDENT ": MPU401 not detected\n"); 520 546 } 521 547 strcpy(card->driver, pcm->name); … … 577 603 if (!cards) { 578 604 #ifdef MODULE 579 snd_printk(IDENT " soundcard not found or device busy\n");605 printk(KERN_ERR IDENT " soundcard not found or device busy\n"); 580 606 #endif 581 607 return -ENODEV; … … 597 623 #ifndef MODULE 598 624 599 /* format is: snd-c ard-cs4232=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,625 /* format is: snd-cs4232=snd_enable,snd_index,snd_id,snd_isapnp,snd_port, 600 626 snd_cport,snd_mpu_port,snd_fm_port,snd_sb_port, 601 627 snd_irq,snd_mpu_irq,snd_dma1,snd_dma1_size, 602 628 snd_dma2,snd_dma2_size */ 603 /* format is: snd-c ard-cs4236=snd_enable,snd_index,snd_id,snd_isapnp,snd_port,629 /* format is: snd-cs4236=snd_enable,snd_index,snd_id,snd_isapnp,snd_port, 604 630 snd_cport,snd_mpu_port,snd_fm_port,snd_sb_port, 605 631 snd_irq,snd_mpu_irq,snd_dma1,snd_dma1_size, … … 635 661 636 662 #ifdef CS4232 637 __setup("snd-c ard-cs4232=", alsa_card_cs423x_setup);663 __setup("snd-cs4232=", alsa_card_cs423x_setup); 638 664 #else /* CS4236 */ 639 __setup("snd-c ard-cs4236=", alsa_card_cs423x_setup);665 __setup("snd-cs4236=", alsa_card_cs423x_setup); 640 666 #endif 641 667 -
GPL/branches/alsa-resync1/alsa-kernel/isa/dt0197h.c
r32 r92 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 #define SNDRV_MAIN_OBJECT_FILE22 21 #include <sound/driver.h> 22 #include <linux/init.h> 23 #include <linux/sched.h> 24 #include <linux/wait.h> 25 #include <sound/core.h> 23 26 #define SNDRV_GET_ID 24 27 #include <sound/initval.h> … … 29 32 #define chip_t sb_t 30 33 34 #define PFX "dt0197h: " 35 31 36 EXPORT_NO_SYMBOLS; 37 38 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 32 39 MODULE_DESCRIPTION("Diamond Technologies DT-0197H"); 40 MODULE_LICENSE("GPL"); 33 41 MODULE_CLASSES("{sound}"); 34 42 MODULE_DEVICES("{{Diamond Technologies,DT-0197H}}"); … … 147 155 148 156 if (pdev->activate(pdev)<0) { 149 snd_printk("AUDIO isapnp configure failure\n");157 printk(KERN_ERR PFX "AUDIO isapnp configure failure\n"); 150 158 return -EBUSY; 151 159 } … … 167 175 168 176 if (pdev->activate(pdev)<0) { 169 snd_printk("MPU-401 isapnp configure failure\n");177 printk(KERN_ERR PFX "MPU-401 isapnp configure failure\n"); 170 178 snd_mpu_port[dev] = -1; 171 179 acard->devmpu = NULL; … … 183 191 184 192 if (pdev->activate(pdev)<0) { 185 snd_printk("OPL isapnp configure failure\n");193 printk(KERN_ERR PFX "OPL isapnp configure failure\n"); 186 194 snd_fm_port[dev] = -1; 187 195 acard->devopl = NULL; … … 241 249 } 242 250 #else 243 snd_printk("you have to enable PnP support ...\n");251 printk(KERN_ERR PFX "you have to enable PnP support ...\n"); 244 252 snd_card_free(card); 245 253 return -ENOSYS; … … 273 281 SA_INTERRUPT, 274 282 NULL) < 0) 275 snd_printk("no MPU-401 device at 0x%lx ?\n",283 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx ?\n", 276 284 snd_mpu_port[dev]); 277 285 } … … 282 290 snd_fm_port[dev] + 2, 283 291 OPL3_HW_AUTO, 0, &opl3) < 0) { 284 snd_printk("no OPL device at 0x%lx-0x%lx ?\n",292 printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx ?\n", 285 293 snd_fm_port[dev], snd_fm_port[dev] + 2); 286 294 } else { … … 338 346 cards += isapnp_probe_cards(snd_dt0197h_pnpids, snd_dt0197h_isapnp_detect); 339 347 #else 340 snd_printk("you have to enable ISA PnP support.\n");348 printk(KERN_ERR PFX "you have to enable ISA PnP support.\n"); 341 349 #endif 342 350 #ifdef MODULE 343 351 if (!cards) 344 snd_printk("no DT-0197H based soundcards found\n");352 printk(KERN_ERR "no DT-0197H based soundcards found\n"); 345 353 #endif 346 354 return cards ? 0 : -ENODEV; … … 360 368 #ifndef MODULE 361 369 362 /* format is: snd- card-dt0197h=snd_enable,snd_index,snd_id,snd_isapnp,370 /* format is: snd-dt0197h=snd_enable,snd_index,snd_id,snd_isapnp, 363 371 snd_port,snd_mpu_port,snd_fm_port, 364 372 snd_irq,snd_mpu_irq,snd_dma8,snd_dma8_size */ … … 383 391 } 384 392 385 __setup("snd- card-dt0197h=", alsa_card_dt0197h_setup);393 __setup("snd-dt0197h=", alsa_card_dt0197h_setup); 386 394 387 395 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/dma.h> 24 #include <linux/init.h> 25 #include <linux/time.h> 26 #include <linux/wait.h> 27 #include <sound/core.h> 24 28 #include <sound/es1688.h> 25 29 #include <sound/mpu401.h> … … 34 38 35 39 EXPORT_NO_SYMBOLS; 40 41 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 36 42 MODULE_DESCRIPTION("ESS ESx688 AudioDrive"); 43 MODULE_LICENSE("GPL"); 37 44 MODULE_CLASSES("{sound}"); 38 45 MODULE_DEVICES("{{ESS,ES688 PnP AudioDrive,pnp:ESS0100}," … … 131 138 132 139 if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { 133 snd_printk("opl3 not detected at 0x%lx\n", chip->port);140 printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); 134 141 } else { 135 142 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { … … 212 219 #ifndef MODULE 213 220 214 /* format is: snd- card-es1688=snd_enable,snd_index,snd_id,221 /* format is: snd-es1688=snd_enable,snd_index,snd_id, 215 222 snd_port,snd_mpu_port, 216 223 snd_irq,snd_mpu_irq, … … 235 242 } 236 243 237 __setup("snd- card-es1688=", alsa_card_es1688_setup);244 __setup("snd-es1688=", alsa_card_es1688_setup); 238 245 239 246 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/io.h> 24 #include <asm/dma.h> 25 #include <linux/init.h> 26 #include <linux/delay.h> 27 #include <linux/slab.h> 28 #include <sound/core.h> 24 29 #include <sound/es1688.h> 30 #include <sound/initval.h> 31 32 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 33 MODULE_DESCRIPTION("ESS ESx688 lowlevel module"); 34 MODULE_CLASSES("{sound}"); 35 MODULE_LICENSE("GPL"); 25 36 26 37 #define chip_t es1688_t … … 419 430 /* --- */ 420 431 count = -count; 421 snd_dma_program(chip->dma8, runtime->dma_a rea, size, DMA_MODE_WRITE | DMA_AUTOINIT);432 snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 422 433 spin_lock_irqsave(&chip->reg_lock, flags); 423 434 snd_es1688_write(chip, 0xa4, (unsigned char) count); … … 476 487 /* --- */ 477 488 count = -count; 478 snd_dma_program(chip->dma8, runtime->dma_a rea, size, DMA_MODE_READ | DMA_AUTOINIT);489 snd_dma_program(chip->dma8, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 479 490 spin_lock_irqsave(&chip->reg_lock, flags); 480 491 snd_es1688_write(chip, 0xa4, (unsigned char) count); … … 656 667 snd_es1688_init(chip, 0); 657 668 release_resource(chip->res_port); 669 kfree_nocheck(chip->res_port); 658 670 } 659 671 if (chip->irq >= 0) … … 823 835 chip->pcm = pcm; 824 836 825 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, 64*1024, GFP_KERNEL|GFP_DMA);837 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024); 826 838 827 839 if (rpcm) 828 *rpcm = NULL;840 *rpcm = pcm; 829 841 return 0; 830 842 } -
GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 */ … … 65 65 66 66 67 #define SNDRV_MAIN_OBJECT_FILE68 67 #include <sound/driver.h> 68 #include <asm/io.h> 69 #include <asm/dma.h> 70 #include <linux/init.h> 71 #include <linux/pm.h> 72 #include <linux/slab.h> 73 #ifndef LINUX_ISAPNP_H 74 #include <linux/isapnp.h> 75 #define isapnp_card pci_bus 76 #define isapnp_dev pci_dev 77 #endif 78 #include <sound/core.h> 69 79 #include <sound/control.h> 70 80 #include <sound/pcm.h> … … 76 86 #define SNDRV_GET_ID 77 87 #include <sound/initval.h> 88 89 #define PFX "es18xx: " 78 90 79 91 struct _snd_es18xx { … … 114 126 spinlock_t mixer_lock; 115 127 spinlock_t ctrl_lock; 128 #ifdef CONFIG_PM 129 struct pm_dev *pm_dev; 130 unsigned char pm_reg; 131 #endif 116 132 }; 117 133 … … 133 149 #define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ 134 150 #define ES18XX_CONTROL 0x0800 /* Has control ports */ 151 152 /* Power Management */ 153 #define ES18XX_PM 0x07 154 #define ES18XX_PM_GPO0 0x01 155 #define ES18XX_PM_GPO1 0x02 156 #define ES18XX_PM_PDR 0x03 157 #define ES18XX_PM_ANA 0x04 158 #define ES18XX_PM_FM 0x06 159 #define ES18XX_PM_SUS 0x08 135 160 136 161 typedef struct _snd_es18xx es18xx_t; … … 502 527 503 528 /* Set DMA controller */ 504 snd_dma_program(chip->dma2, runtime->dma_a rea, size, DMA_MODE_WRITE | DMA_AUTOINIT);529 snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 505 530 506 531 return 0; … … 614 639 615 640 /* Set DMA controler */ 616 snd_dma_program(chip->dma1, runtime->dma_a rea, size, DMA_MODE_READ | DMA_AUTOINIT);641 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 617 642 618 643 return 0; … … 677 702 678 703 /* Set DMA controler */ 679 snd_dma_program(chip->dma1, runtime->dma_a rea, size, DMA_MODE_WRITE | DMA_AUTOINIT);704 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 680 705 681 706 return 0; … … 1620 1645 { 1621 1646 if (snd_es18xx_identify(chip) < 0) { 1622 snd_printk("[0x%lx] ESS chip not found\n", chip->port);1647 printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); 1623 1648 return -ENODEV; 1624 1649 } … … 1736 1761 chip->pcm = pcm; 1737 1762 1738 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);1763 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 1739 1764 1740 1765 if (rpcm) … … 1743 1768 } 1744 1769 1770 /* Power Management support functions */ 1771 #ifdef CONFIG_PM 1772 static void snd_es18xx_suspend(es18xx_t *chip) 1773 { 1774 snd_card_t *card = chip->card; 1775 1776 snd_power_lock(card); 1777 if (card->power_state == SNDRV_CTL_POWER_D3hot) 1778 goto __skip; 1779 1780 snd_pcm_suspend_all(chip->pcm); 1781 1782 /* power down */ 1783 chip->pm_reg = (unsigned char)snd_es18xx_read(chip, ES18XX_PM); 1784 chip->pm_reg |= (ES18XX_PM_FM | ES18XX_PM_SUS); 1785 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg); 1786 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_SUS); 1787 1788 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1789 __skip: 1790 snd_power_unlock(card); 1791 } 1792 1793 static void snd_es18xx_resume(es18xx_t *chip) 1794 { 1795 snd_card_t *card = chip->card; 1796 1797 snd_power_lock(card); 1798 if (card->power_state == SNDRV_CTL_POWER_D0) 1799 goto __skip; 1800 1801 /* restore PM register, we won't wake till (not 0x07) i/o activity though */ 1802 snd_es18xx_write(chip, ES18XX_PM, chip->pm_reg ^= ES18XX_PM_FM); 1803 1804 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1805 __skip: 1806 snd_power_unlock(card); 1807 } 1808 1809 /* callback for control API */ 1810 static int snd_es18xx_set_power_state(snd_card_t *card, unsigned int power_state) 1811 { 1812 es18xx_t *chip = (es18xx_t *) card->power_state_private_data; 1813 switch (power_state) { 1814 case SNDRV_CTL_POWER_D0: 1815 case SNDRV_CTL_POWER_D1: 1816 case SNDRV_CTL_POWER_D2: 1817 snd_es18xx_resume(chip); 1818 break; 1819 case SNDRV_CTL_POWER_D3hot: 1820 case SNDRV_CTL_POWER_D3cold: 1821 snd_es18xx_suspend(chip); 1822 break; 1823 default: 1824 return -EINVAL; 1825 } 1826 return 0; 1827 } 1828 1829 static int snd_es18xx_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) 1830 { 1831 es18xx_t *chip = snd_magic_cast(es18xx_t, dev->data, return 0); 1832 1833 switch (rqst) { 1834 case PM_SUSPEND: 1835 snd_es18xx_suspend(chip); 1836 break; 1837 case PM_RESUME: 1838 snd_es18xx_resume(chip); 1839 break; 1840 } 1841 return 0; 1842 } 1843 #endif /* CONFIG_PM */ 1844 1745 1845 static int snd_es18xx_free(es18xx_t *chip) 1746 1846 { 1747 if (chip->res_port) 1847 #ifdef CONFIG_PM 1848 if (chip->pm_dev) 1849 pm_unregister(chip->pm_dev); 1850 #endif 1851 if (chip->res_port) { 1748 1852 release_resource(chip->res_port); 1749 if (chip->res_ctrl_port) 1853 kfree_nocheck(chip->res_port); 1854 } 1855 if (chip->res_ctrl_port) { 1750 1856 release_resource(chip->res_ctrl_port); 1751 if (chip->res_mpu_port) 1857 kfree_nocheck(chip->res_ctrl_port); 1858 } 1859 if (chip->res_mpu_port) { 1752 1860 release_resource(chip->res_mpu_port); 1861 kfree_nocheck(chip->res_mpu_port); 1862 } 1753 1863 if (chip->irq >= 0) 1754 1864 free_irq(chip->irq, (void *) chip); … … 1809 1919 if ((chip->res_port = request_region(port, 16, "ES18xx")) == NULL) { 1810 1920 snd_es18xx_free(chip); 1811 snd_printk("unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1);1921 printk(KERN_ERR PFX "unable to grap ports 0x%lx-0x%lx\n", port, port + 16 - 1); 1812 1922 return -EBUSY; 1813 1923 } … … 1821 1931 if (request_irq(irq, snd_es18xx_interrupt, SA_INTERRUPT, "ES18xx", (void *) chip)) { 1822 1932 snd_es18xx_free(chip); 1823 snd_printk("unable to grap IRQ %d\n", irq);1933 printk(KERN_ERR PFX "unable to grap IRQ %d\n", irq); 1824 1934 return -EBUSY; 1825 1935 } … … 1828 1938 if (request_dma(dma1, "ES18xx DMA 1")) { 1829 1939 snd_es18xx_free(chip); 1830 snd_printk("unable to grap DMA1 %d\n", dma1);1940 printk(KERN_ERR PFX "unable to grap DMA1 %d\n", dma1); 1831 1941 return -EBUSY; 1832 1942 } … … 1835 1945 if (request_dma(dma2, "ES18xx DMA 2")) { 1836 1946 snd_es18xx_free(chip); 1837 snd_printk("unable to grap DMA2 %d\n", dma2);1947 printk(KERN_ERR PFX "unable to grap DMA2 %d\n", dma2); 1838 1948 return -EBUSY; 1839 1949 } … … 1909 2019 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre1_control, chip))) < 0) 1910 2020 return err; 2021 break; 1911 2022 case 0x1869: 1912 2023 case 0x1879: 1913 2024 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_micpre2_control, chip))) < 0) 1914 2025 return err; 2026 break; 1915 2027 } 1916 2028 if (chip->caps & ES18XX_SPATIALIZER) { … … 1943 2055 1944 2056 EXPORT_NO_SYMBOLS; 2057 MODULE_AUTHOR("Christian Fischbach <fishbach@pool.informatik.rwth-aachen.de>, Abramo Bagnara <abramo@alsa-project.org>"); 1945 2058 MODULE_DESCRIPTION("ESS ES18xx AudioDrive"); 2059 MODULE_LICENSE("GPL"); 1946 2060 MODULE_CLASSES("{sound}"); 1947 2061 MODULE_DEVICES("{{ESS,ES1868 PnP AudioDrive}," … … 1951 2065 "{ESS,ES1887 PnP AudioDrive}," 1952 2066 "{ESS,ES1888 PnP AudioDrive}," 1953 "{ESS,ES1887 AudioDrive} "2067 "{ESS,ES1887 AudioDrive}," 1954 2068 "{ESS,ES1888 AudioDrive}}"); 1955 2069 1956 2070 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 1957 2071 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 1958 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */2072 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1959 2073 #ifdef __ISAPNP__ 1960 2074 #ifdef TARGET_OS2 … … 2083 2197 return -EAGAIN; 2084 2198 if (acard->devc->activate(acard->devc)<0) { 2085 snd_printk("isapnp control configure failure (out of resources?)\n");2199 printk(KERN_ERR PFX "isapnp control configure failure (out of resources?)\n"); 2086 2200 return -EAGAIN; 2087 2201 } … … 2106 2220 isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); 2107 2221 if (pdev->activate(pdev)<0) { 2108 snd_printk("isapnp configure failure (out of resources?)\n");2222 printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n"); 2109 2223 acard->devc->deactivate(acard->devc); 2110 2224 return -EBUSY; … … 2222 2336 2223 2337 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { 2224 snd_printk("opl3 not detected at 0x%lx\n", chip->port);2338 printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->port); 2225 2339 } else { 2226 2340 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { … … 2230 2344 } 2231 2345 2232 if (snd_mpu_port[dev] >SNDRV_AUTO_PORT) {2346 if (snd_mpu_port[dev] != SNDRV_AUTO_PORT) { 2233 2347 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2234 2348 chip->mpu_port, 0, … … 2240 2354 chip->rmidi = rmidi; 2241 2355 } 2356 2357 #ifdef CONFIG_PM 2358 /* Power Management */ 2359 chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_es18xx_pm_callback); 2360 if (chip->pm_dev) { 2361 chip->pm_dev->data = chip; 2362 /* set control api callback */ 2363 card->set_power_state = snd_es18xx_set_power_state; 2364 card->power_state_private_data = chip; 2365 } 2366 #endif 2242 2367 sprintf(card->driver, "ES%x", chip->version); 2243 2368 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); … … 2323 2448 if(!cards) { 2324 2449 #ifdef MODULE 2325 snd_printk("ESS AudioDrive ES18xx soundcard not found or device busy\n");2450 printk(KERN_ERR "ESS AudioDrive ES18xx soundcard not found or device busy\n"); 2326 2451 #endif 2327 2452 return -ENODEV; … … 2343 2468 #ifndef MODULE 2344 2469 2345 /* format is: snd- card-es18xx=snd_enable,snd_index,snd_id,snd_isapnp,2470 /* format is: snd-es18xx=snd_enable,snd_index,snd_id,snd_isapnp, 2346 2471 snd_port,snd_mpu_port,snd_fm_port,snd_irq, 2347 2472 snd_dma1,snd_dma2 */ … … 2372 2497 } 2373 2498 2374 __setup("snd- card-es18xx=", alsa_card_es18xx_setup);2499 __setup("snd-es18xx=", alsa_card_es18xx_setup); 2375 2500 2376 2501 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_pcm.c
r32 r92 22 22 * You should have received a copy of the GNU General Public License 23 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 25 * 26 26 */ 27 27 28 #define __NO_VERSION__ 28 29 #include <sound/driver.h> 30 #include <asm/dma.h> 31 #include <linux/slab.h> 32 #include <sound/core.h> 29 33 #include <sound/control.h> 30 34 #include <sound/gus.h> … … 91 95 block.addr = addr & ~31; 92 96 block.buffer = runtime->dma_area + offset; 97 block.buf_addr = runtime->dma_addr + offset; 93 98 block.count = count; 94 99 block.private_data = pcmp; … … 582 587 snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */ 583 588 snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL); /* Sampling Control Register */ 584 snd_dma_program(gus->gf1.dma2, &runtime->dma_area, gus->c_period_size, DMA_MODE_READ);589 snd_dma_program(gus->gf1.dma2, runtime->dma_addr, gus->c_period_size, DMA_MODE_READ); 585 590 return 0; 586 591 } … … 925 930 snd_pcm_t *pcm; 926 931 snd_pcm_substream_t *substream; 927 int err;932 int capture, err; 928 933 929 934 if (rpcm) 930 935 *rpcm = NULL; 931 936 card = gus->card; 937 capture = !gus->interwave && !gus->ess_flag && !gus->ace_flag ? 1 : 0; 932 938 err = snd_pcm_new(card, 933 939 gus->interwave ? "AMD InterWave" : "GF1", 934 940 pcm_dev, 935 941 gus->gf1.pcm_channels / 2, 936 !gus->interwave && !gus->ess_flag ? 1 : 0,942 capture, 937 943 &pcm); 938 944 if (err < 0) … … 944 950 945 951 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) 946 snd_pcm_lib_preallocate_ pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);952 snd_pcm_lib_preallocate_isa_pages(substream, 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); 947 953 948 954 pcm->info_flags = 0; 949 955 pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX; 950 if (gus->interwave && !gus->ess_flag && !gus->ace_flag) { 951 /* capture setup */ 956 if (capture) { 952 957 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_gf1_pcm_capture_ops); 953 958 if (gus->gf1.dma2 == gus->gf1.dma1) 954 959 pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; 955 snd_pcm_lib_preallocate_ pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);960 snd_pcm_lib_preallocate_isa_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); 956 961 } 957 962 strcpy(pcm->name, pcm->id); -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/dma.h> 24 #include <linux/init.h> 25 #include <linux/delay.h> 26 #include <linux/time.h> 27 #include <sound/core.h> 24 28 #include <sound/gus.h> 25 29 #define SNDRV_LEGACY_AUTO_PROBE … … 30 34 31 35 EXPORT_NO_SYMBOLS; 36 37 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 32 38 MODULE_DESCRIPTION("Gravis UltraSound Classic"); 39 MODULE_LICENSE("GPL"); 33 40 MODULE_CLASSES("{sound}"); 34 41 MODULE_DEVICES("{{Gravis,UltraSound Classic}}"); … … 252 259 if (!cards) { 253 260 #ifdef MODULE 254 snd_printk("GUS Classic soundcard not found or device busy\n");261 printk(KERN_ERR "GUS Classic soundcard not found or device busy\n"); 255 262 #endif 256 263 return -ENODEV; … … 272 279 #ifndef MODULE 273 280 274 /* format is: snd- card-gusclassic=snd_enable,snd_index,snd_id,281 /* format is: snd-gusclassic=snd_enable,snd_index,snd_id, 275 282 snd_port,snd_irq, 276 283 snd_dma1,snd_dma2, … … 298 305 } 299 306 300 __setup("snd- card-gusclassic=", alsa_card_gusclassic_setup);307 __setup("snd-gusclassic=", alsa_card_gusclassic_setup); 301 308 302 309 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/dma.h> 24 #include <linux/init.h> 25 #include <linux/delay.h> 26 #include <linux/time.h> 27 #include <sound/core.h> 24 28 #include <sound/gus.h> 25 29 #include <sound/es1688.h> … … 33 37 34 38 EXPORT_NO_SYMBOLS; 39 40 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 35 41 MODULE_DESCRIPTION("Gravis UltraSound Extreme"); 42 MODULE_LICENSE("GPL"); 36 43 MODULE_CLASSES("{sound}"); 37 44 MODULE_DEVICES("{{Gravis,UltraSound Extreme}}"); … … 322 329 if (snd_opl3_create(card, es1688->port, es1688->port + 2, 323 330 OPL3_HW_OPL3, 0, &opl3) < 0) { 324 snd_printk("opl3 not detected at 0x%lx\n", es1688->port);331 printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); 325 332 } else { 326 333 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) { … … 382 389 if (!cards) { 383 390 #ifdef MODULE 384 snd_printk("GUS Extreme soundcard not found or device busy\n");391 printk(KERN_ERR "GUS Extreme soundcard not found or device busy\n"); 385 392 #endif 386 393 return -ENODEV; … … 409 416 #ifndef MODULE 410 417 411 /* format is: snd- card-gusextreme=snd_enable,snd_index,snd_id,418 /* format is: snd-gusextreme=snd_enable,snd_index,snd_id, 412 419 snd_port,snd_gf1_port,snd_mpu_port, 413 420 snd_irq,snd_gf1_irq,snd_mpu_irq, … … 437 444 } 438 445 439 __setup("snd- card-gusextreme=", alsa_card_gusextreme_setup);446 __setup("snd-gusextreme=", alsa_card_gusextreme_setup); 440 447 441 448 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/dma.h> 24 #include <linux/init.h> 25 #include <linux/delay.h> 26 #include <linux/time.h> 27 #include <sound/core.h> 24 28 #include <sound/gus.h> 25 29 #include <sound/cs4231.h> … … 31 35 32 36 EXPORT_NO_SYMBOLS; 37 38 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 33 39 MODULE_DESCRIPTION("Gravis UltraSound MAX"); 40 MODULE_LICENSE("GPL"); 34 41 MODULE_CLASSES("{sound}"); 35 42 MODULE_DEVICES("{{Gravis,UltraSound MAX}}"); … … 293 300 if (!gus->max_flag) { 294 301 snd_card_free(card); 295 snd_printk("GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);302 printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); 296 303 return -ENODEV; 297 304 } … … 299 306 if (request_irq(irq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { 300 307 snd_card_free(card); 301 snd_printk("unable to grab IRQ %d\n", irq);308 printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", irq); 302 309 return -EBUSY; 303 310 } … … 388 395 if (!cards) { 389 396 #ifdef MODULE 390 snd_printk("GUS MAX soundcard not found or device busy\n");397 printk(KERN_ERR "GUS MAX soundcard not found or device busy\n"); 391 398 #endif 392 399 return -ENODEV; … … 408 415 #ifndef MODULE 409 416 410 /* format is: snd- card-gusmax=snd_enable,snd_index,snd_id,417 /* format is: snd-gusmax=snd_enable,snd_index,snd_id, 411 418 snd_port,snd_irq, 412 419 snd_dma1,snd_dma2, … … 434 441 } 435 442 436 __setup("snd- card-gusmax=", alsa_card_gusmax_setup);443 __setup("snd-gusmax=", alsa_card_gusmax_setup); 437 444 438 445 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 * 1999/07/22 Erik Inge Bolso <knan@mo.himolde.no> … … 23 23 */ 24 24 25 #define SNDRV_MAIN_OBJECT_FILE26 25 #include <sound/driver.h> 26 #include <asm/dma.h> 27 #include <linux/delay.h> 28 #include <linux/init.h> 29 #include <linux/slab.h> 30 #ifndef LINUX_ISAPNP_H 31 #include <linux/isapnp.h> 32 #define isapnp_card pci_bus 33 #define isapnp_dev pci_dev 34 #endif 35 #include <sound/core.h> 27 36 #include <sound/gus.h> 28 37 #include <sound/cs4231.h> … … 37 46 38 47 EXPORT_NO_SYMBOLS; 48 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 49 MODULE_CLASSES("{sound}"); 50 MODULE_LICENSE("GPL"); 39 51 #ifndef SNDRV_STB 40 52 MODULE_DESCRIPTION("AMD InterWave"); 41 MODULE_CLASSES("{sound}");42 53 MODULE_DEVICES("{{Gravis,UltraSound Plug & Play}," 43 54 "{STB,SoundRage32}," … … 47 58 #else 48 59 MODULE_DESCRIPTION("AMD InterWave STB with TEA6330T"); 49 MODULE_CLASSES("{sound}");50 60 MODULE_DEVICES("{{AMD,InterWave STB with TEA6330T}}"); 51 61 #endif … … 53 63 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 54 64 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 55 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */65 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 56 66 #ifdef __ISAPNP__ 57 67 #ifdef TARGET_OS2 … … 212 222 } 213 223 214 static int snd_interwave_i2c_get dataline(snd_i2c_bus_t *bus)224 static int snd_interwave_i2c_getclockline(snd_i2c_bus_t *bus) 215 225 { 216 226 unsigned long port = bus->private_value; 217 227 unsigned char res; 218 228 229 res = inb(port) & 1; 230 #if 0 231 printk("i2c_getclockline - 0x%lx -> %i\n", port, res); 232 #endif 233 return res; 234 } 235 236 static int snd_interwave_i2c_getdataline(snd_i2c_bus_t *bus, int ack) 237 { 238 unsigned long port = bus->private_value; 239 unsigned char res; 240 241 if (ack) 242 udelay(10); 219 243 res = (inb(port) & 2) >> 1; 220 244 #if 0 … … 224 248 } 225 249 250 static snd_i2c_bit_ops_t snd_interwave_i2c_bit_ops = { 251 setlines: snd_interwave_i2c_setlines, 252 getclock: snd_interwave_i2c_getclockline, 253 getdata: snd_interwave_i2c_getdataline, 254 }; 255 226 256 static int __init snd_interwave_detect_stb(struct snd_interwave *iwcard, 227 257 snd_gus_card_t * gus, int dev, … … 231 261 snd_i2c_bus_t *bus; 232 262 snd_card_t *card = iwcard->card; 233 unsigned long flags;234 263 char name[32]; 235 264 int err; … … 254 283 } 255 284 sprintf(name, "InterWave-%i", card->number); 256 if ((err = snd_i2c_bus_create(card, name, &bus)) < 0)285 if ((err = snd_i2c_bus_create(card, name, NULL, &bus)) < 0) 257 286 return err; 258 287 bus->private_value = port; 259 bus->i2c_setlines = snd_interwave_i2c_setlines; 260 bus->i2c_getdataline = snd_interwave_i2c_getdataline; 261 SNDRV_LOCK_I2C_BUS(bus); 262 snd_i2c_reset(bus); 263 #if 0 264 { 265 int idx, ack; 266 for (idx = 0; idx < 256; idx += 2) { 267 snd_i2c_start(bus); 268 ack = snd_i2c_sendbyte(bus, idx, 0); 269 snd_i2c_stop(bus); 270 if (!ack) { 271 printk("i2c: scanning bus %s: found device at addr=0x%x\n", 272 bus->name, idx); 273 } 274 } 275 } 276 #endif 277 SNDRV_UNLOCK_I2C_BUS(bus); 288 bus->hw_ops.bit = &snd_interwave_i2c_bit_ops; 278 289 if ((err = snd_tea6330t_detect(bus, 0)) < 0) 279 290 return err; … … 707 718 #endif 708 719 #ifdef SNDRV_STB 709 if (iwcard->i2c_res) 720 if (iwcard->i2c_res) { 710 721 release_resource(iwcard->i2c_res); 722 kfree_nocheck(iwcard->i2c_res); 723 } 711 724 #endif 712 725 if (iwcard->irq >= 0) … … 961 974 } 962 975 #ifdef MODULE 963 snd_printk("InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]);976 printk(KERN_ERR "InterWave soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); 964 977 #endif 965 978 } … … 973 986 if (!cards) { 974 987 #ifdef MODULE 975 snd_printk("InterWave soundcard not found or device busy\n");988 printk(KERN_ERR "InterWave soundcard not found or device busy\n"); 976 989 #endif 977 990 return -ENODEV; … … 993 1006 #ifndef MODULE 994 1007 995 /* format is: snd- card-interwave=snd_enable,snd_index,snd_id,snd_isapnp,1008 /* format is: snd-interwave=snd_enable,snd_index,snd_id,snd_isapnp, 996 1009 snd_port[,snd_port_tc],snd_irq, 997 1010 snd_dma1,snd_dma2, … … 1030 1043 1031 1044 #ifndef SNDRV_STB 1032 __setup("snd- card-interwave=", alsa_card_interwave_setup);1033 #else 1034 __setup("snd- card-interwave-stb=", alsa_card_interwave_setup);1045 __setup("snd-interwave=", alsa_card_interwave_setup); 1046 #else 1047 __setup("snd-interwave-stb=", alsa_card_interwave_setup); 1035 1048 #endif 1036 1049 -
GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/io.h> 24 #include <linux/init.h> 25 #include <linux/pm.h> 26 #include <linux/slab.h> 27 #ifndef LINUX_ISAPNP_H 28 #include <linux/isapnp.h> 29 #define isapnp_card pci_bus 30 #define isapnp_dev pci_dev 31 #endif 32 #include <sound/core.h> 24 33 #include <sound/cs4231.h> 25 34 #include <sound/mpu401.h> … … 29 38 30 39 EXPORT_NO_SYMBOLS; 40 41 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 31 42 MODULE_DESCRIPTION("Yamaha OPL3SA2+"); 43 MODULE_LICENSE("GPL"); 32 44 MODULE_CLASSES("{sound}"); 33 45 MODULE_DEVICES("{{Yamaha,YMF719E-S}," … … 39 51 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40 52 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */53 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 42 54 #ifdef __ISAPNP__ 43 55 #ifdef TARGET_OS2 … … 101 113 MODULE_PARM_SYNTAX(snd_opl3sa3_ymode, SNDRV_ENABLED ",allows:{{0,3}},dialog:list"); /* SL Added */ 102 114 103 struct snd_opl3sa { 115 /* control ports */ 116 #define OPL3SA2_PM_CTRL 0x01 117 #define OPL3SA2_SYS_CTRL 0x02 118 #define OPL3SA2_IRQ_CONFIG 0x03 119 #define OPL3SA2_IRQ_STATUS 0x04 120 #define OPL3SA2_DMA_CONFIG 0x06 121 #define OPL3SA2_MASTER_LEFT 0x07 122 #define OPL3SA2_MASTER_RIGHT 0x08 123 #define OPL3SA2_MIC 0x09 124 #define OPL3SA2_MISC 0x0A 125 126 /* opl3sa3 only */ 127 #define OPL3SA3_DGTL_DOWN 0x12 128 #define OPL3SA3_ANLG_DOWN 0x13 129 #define OPL3SA3_WIDE 0x14 130 #define OPL3SA3_BASS 0x15 131 #define OPL3SA3_TREBLE 0x16 132 133 /* power management bits */ 134 #define OPL3SA2_PM_ADOWN 0x20 135 #define OPL3SA2_PM_PSV 0x04 136 #define OPL3SA2_PM_PDN 0x02 137 #define OPL3SA2_PM_PDX 0x01 138 139 #define OPL3SA2_PM_D0 0x00 140 #define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX) 141 142 typedef struct snd_opl3sa2 opl3sa2_t; 143 #define chip_t opl3sa2_t 144 145 struct snd_opl3sa2 { 104 146 snd_card_t *card; 105 147 int version; /* 2 or 3 */ … … 119 161 snd_kcontrol_t *master_switch; 120 162 snd_kcontrol_t *master_volume; 163 #ifdef CONFIG_PM 164 struct pm_dev *pm_dev; 165 void (*cs4231_suspend)(cs4231_t *); 166 void (*cs4231_resume)(cs4231_t *); 167 #endif 121 168 }; 122 169 123 static snd_card_t *snd_opl3sa _cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;170 static snd_card_t *snd_opl3sa2_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 124 171 125 172 #ifdef __ISAPNP__ … … 159 206 #endif /* __ISAPNP__ */ 160 207 161 static unsigned char snd_opl3sa_read(unsigned long port, unsigned char reg) 162 { 163 unsigned long flags; 208 209 /* read control port (w/o spinlock) */ 210 static unsigned char __snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg) 211 { 164 212 unsigned char result; 165 166 save_flags(flags);167 cli();168 213 #if 0 169 214 outb(0x1d, port); /* password */ 170 215 printk("read [0x%lx] = 0x%x\n", port, inb(port)); 171 216 #endif 172 outb(reg, port); /* register */ 173 result = inb(port + 1); 174 restore_flags(flags); 217 outb(reg, chip->port); /* register */ 218 result = inb(chip->port + 1); 175 219 #if 0 176 220 printk("read [0x%lx] = 0x%x [0x%x]\n", port, result, inb(port)); … … 179 223 } 180 224 181 static void snd_opl3sa_write(unsigned long port, 182 unsigned char reg, unsigned char value)225 /* read control port (with spinlock) */ 226 static unsigned char snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg) 183 227 { 184 228 unsigned long flags; 185 186 save_flags(flags); 187 cli(); 229 unsigned char result; 230 231 spin_lock_irqsave(&chip->reg_lock, flags); 232 result = __snd_opl3sa2_read(chip, reg); 233 spin_unlock_irqrestore(&chip->reg_lock, flags); 234 return result; 235 } 236 237 /* write control port (w/o spinlock) */ 238 static void __snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value) 239 { 188 240 #if 0 189 241 outb(0x1d, port); /* password */ 190 242 #endif 191 outb(reg, port); /* register */ 192 outb(value, port + 1); 193 restore_flags(flags); 194 } 195 196 static int __init snd_opl3sa_detect(struct snd_opl3sa *oplcard) 243 outb(reg, chip->port); /* register */ 244 outb(value, chip->port + 1); 245 chip->ctlregs[reg] = value; 246 } 247 248 /* write control port (with spinlock) */ 249 static void snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value) 250 { 251 unsigned long flags; 252 spin_lock_irqsave(&chip->reg_lock, flags); 253 __snd_opl3sa2_write(chip, reg, value); 254 spin_unlock_irqrestore(&chip->reg_lock, flags); 255 } 256 257 static int __init snd_opl3sa2_detect(opl3sa2_t *chip) 197 258 { 198 259 snd_card_t *card; … … 201 262 char str[2]; 202 263 203 card = oplcard->card;204 port = oplcard->port;205 if (( oplcard->res_port = request_region(port, 2, "OPL3-SA control")) == NULL)264 card = chip->card; 265 port = chip->port; 266 if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) 206 267 return -EBUSY; 207 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa _read(port, 0x0a));208 oplcard->version = 0;209 tmp = snd_opl3sa _read(port, 0x0a);268 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); 269 chip->version = 0; 270 tmp = snd_opl3sa2_read(chip, OPL3SA2_MISC); 210 271 if (tmp == 0xff) { 211 272 snd_printd("OPL3-SA [0x%lx] detect = 0x%x\n", port, tmp); … … 214 275 switch (tmp & 0x07) { 215 276 case 0x01: 216 oplcard->version = 2;277 chip->version = 2; /* YMF711 */ 217 278 break; 218 279 default: 219 oplcard->version = 3;280 chip->version = 3; 220 281 /* 0x02 - standard */ 221 282 /* 0x03 - YM715B */ … … 224 285 break; 225 286 } 226 str[0] = oplcard->version + '0';287 str[0] = chip->version + '0'; 227 288 str[1] = 0; 228 289 strcat(card->shortname, str); 229 snd_opl3sa _write(port, 0x0a, tmp ^ 7);230 if ((tmp1 = snd_opl3sa _read(port, 0x0a)) != tmp) {290 snd_opl3sa2_write(chip, OPL3SA2_MISC, tmp ^ 7); 291 if ((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MISC)) != tmp) { 231 292 snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1); 232 293 return -ENODEV; 233 294 } 234 295 /* try if the MIC register is accesible */ 235 tmp = snd_opl3sa _read(port, 0x09);236 snd_opl3sa _write(port, 0x09, 0x8a);237 if (((tmp1 = snd_opl3sa _read(port, 0x09)) & 0x9f) != 0x8a) {296 tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC); 297 snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a); 298 if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) { 238 299 snd_printd("OPL3-SA [0x%lx] detect (2) = 0x%x (0x%x)\n", port, tmp, tmp1); 239 300 return -ENODEV; 240 301 } 241 snd_opl3sa _write(port, 0x09, 0x9f);302 snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x9f); 242 303 /* initialization */ 243 snd_opl3sa_write(port, 0x01, 0x00); /* Power Management - default */ 244 if (oplcard->version > 2) { /* SL Added */ 245 snd_opl3sa_write(port, 0x02, (oplcard->ymode << 4)); /* SL Modified - System Control - ymode is bits 4&5 (of 0 to 7) on all but opl3sa2 versions */ 246 } else { /* SL Added */ 247 snd_opl3sa_write(port, 0x02, 0x00); /* SL Modified - System Control - default for opl3sa2 versions */ 248 } /* SL Added */ 249 snd_opl3sa_write(port, 0x03, 0x0d); /* Interrupt Channel Configuration - IRQ A = OPL3 + MPU + WSS */ 250 if (oplcard->single_dma) { 251 snd_opl3sa_write(port, 0x06, 0x03); /* DMA Configuration - DMA A = WSS-R + WSS-P */ 304 /* Power Management - full on */ 305 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); 306 if (chip->version > 2) { 307 /* ymode is bits 4&5 (of 0 to 7) on all but opl3sa2 versions */ 308 snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, (chip->ymode << 4)); 252 309 } else { 253 snd_opl3sa_write(port, 0x06, 0x21); /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */ 254 } 255 snd_opl3sa_write(port, 0x0a, 0x80 | (tmp & 7)); /* Miscellaneous - default */ 256 if (oplcard->version > 2) { 257 snd_opl3sa_write(port, 0x12, 0x00); /* Digital Block Partial Power Down - default */ 258 snd_opl3sa_write(port, 0x13, 0x00); /* Analog Block Partial Power Down - default */ 259 } 260 return 0; 261 } 262 263 static void snd_opl3sa_interrupt(int irq, void *dev_id, struct pt_regs *regs) 310 /* default for opl3sa2 versions */ 311 snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, 0x00); 312 } 313 snd_opl3sa2_write(chip, OPL3SA2_IRQ_CONFIG, 0x0d); /* Interrupt Channel Configuration - IRQ A = OPL3 + MPU + WSS */ 314 if (chip->single_dma) { 315 snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x03); /* DMA Configuration - DMA A = WSS-R + WSS-P */ 316 } else { 317 snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x21); /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */ 318 } 319 snd_opl3sa2_write(chip, OPL3SA2_MISC, 0x80 | (tmp & 7)); /* Miscellaneous - default */ 320 if (chip->version > 2) { 321 snd_opl3sa2_write(chip, OPL3SA3_DGTL_DOWN, 0x00); /* Digital Block Partial Power Down - default */ 322 snd_opl3sa2_write(chip, OPL3SA3_ANLG_DOWN, 0x00); /* Analog Block Partial Power Down - default */ 323 } 324 return 0; 325 } 326 327 static void snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *regs) 264 328 { 265 329 unsigned short status; 266 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)dev_id;267 268 if ( oplcard == NULL || oplcard->card == NULL)330 opl3sa2_t *chip = dev_id; 331 332 if (chip == NULL || chip->card == NULL) 269 333 return; 270 334 271 spin_lock(&oplcard->reg_lock); 272 outb(0x04, oplcard->port); /* register - Interrupt IRQ-A status */ 273 status = inb(oplcard->port + 1); 274 spin_unlock(&oplcard->reg_lock); 335 status = snd_opl3sa2_read(chip, OPL3SA2_IRQ_STATUS); 275 336 276 337 if (status & 0x20) 277 snd_opl3_interrupt( oplcard->synth);278 279 if ((status & 0x10) && oplcard->rmidi != NULL)280 snd_mpu401_uart_interrupt(irq, oplcard->rmidi->private_data, regs);338 snd_opl3_interrupt(chip->synth); 339 340 if ((status & 0x10) && chip->rmidi != NULL) 341 snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data, regs); 281 342 282 343 if (status & 0x07) /* TI,CI,PI */ 283 snd_cs4231_interrupt(irq, oplcard->cs4231, regs);284 285 if (status & 0x40) { 344 snd_cs4231_interrupt(irq, chip->cs4231, regs); 345 346 if (status & 0x40) { /* hardware volume change */ 286 347 /* reading from Master Lch register at 0x07 clears this bit */ 287 snd_opl3sa_read(oplcard->port, 0x08); 288 snd_opl3sa_read(oplcard->port, 0x07); 289 snd_ctl_notify(oplcard->card, SNDRV_CTL_EVENT_MASK_VALUE, &oplcard->master_switch->id); 290 snd_ctl_notify(oplcard->card, SNDRV_CTL_EVENT_MASK_VALUE, &oplcard->master_volume->id); 348 snd_opl3sa2_read(chip, OPL3SA2_MASTER_RIGHT); 349 snd_opl3sa2_read(chip, OPL3SA2_MASTER_LEFT); 350 if (chip->master_switch && chip->master_volume) { 351 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); 352 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); 353 } 291 354 } 292 355 } 293 356 294 357 #ifdef TARGET_OS2 295 #define OPL3SA _SINGLE(xname, xindex, reg, shift, mask, invert) \358 #define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \ 296 359 { SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \ 297 0, 0, snd_opl3sa _info_single, \298 snd_opl3sa _get_single, snd_opl3sa_put_single, \360 0, 0, snd_opl3sa2_info_single, \ 361 snd_opl3sa2_get_single, snd_opl3sa2_put_single, \ 299 362 reg | (shift << 8) | (mask << 16) | (invert << 24) } 300 363 301 364 #else 302 #define OPL3SA _SINGLE(xname, xindex, reg, shift, mask, invert) \365 #define OPL3SA2_SINGLE(xname, xindex, reg, shift, mask, invert) \ 303 366 { iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \ 304 info: snd_opl3sa _info_single, \305 get: snd_opl3sa _get_single, put: snd_opl3sa_put_single, \367 info: snd_opl3sa2_info_single, \ 368 get: snd_opl3sa2_get_single, put: snd_opl3sa2_put_single, \ 306 369 private_value: reg | (shift << 8) | (mask << 16) | (invert << 24) } 307 370 #endif 308 371 309 static int snd_opl3sa _info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)372 static int snd_opl3sa2_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 310 373 { 311 374 int mask = (kcontrol->private_value >> 16) & 0xff; … … 318 381 } 319 382 320 int snd_opl3sa _get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)321 { 322 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);383 int snd_opl3sa2_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 384 { 385 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 323 386 unsigned long flags; 324 387 int reg = kcontrol->private_value & 0xff; … … 327 390 int invert = (kcontrol->private_value >> 24) & 0xff; 328 391 329 spin_lock_irqsave(& oplcard->reg_lock, flags);330 ucontrol->value.integer.value[0] = ( oplcard->ctlregs[reg] >> shift) & mask;331 spin_unlock_irqrestore(& oplcard->reg_lock, flags);392 spin_lock_irqsave(&chip->reg_lock, flags); 393 ucontrol->value.integer.value[0] = (chip->ctlregs[reg] >> shift) & mask; 394 spin_unlock_irqrestore(&chip->reg_lock, flags); 332 395 if (invert) 333 396 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; … … 335 398 } 336 399 337 int snd_opl3sa _put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)338 { 339 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);400 int snd_opl3sa2_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 401 { 402 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 340 403 unsigned long flags; 341 404 int reg = kcontrol->private_value & 0xff; … … 350 413 val = mask - val; 351 414 val <<= shift; 352 spin_lock_irqsave(& oplcard->reg_lock, flags);353 oval = oplcard->ctlregs[reg];415 spin_lock_irqsave(&chip->reg_lock, flags); 416 oval = chip->ctlregs[reg]; 354 417 val = (oval & ~(mask << shift)) | val; 355 418 change = val != oval; 356 snd_opl3sa_write(oplcard->port, reg, oplcard->ctlregs[reg] =val);357 spin_unlock_irqrestore(& oplcard->reg_lock, flags);419 __snd_opl3sa2_write(chip, reg, val); 420 spin_unlock_irqrestore(&chip->reg_lock, flags); 358 421 return change; 359 422 } 360 423 361 424 #ifdef TARGET_OS2 362 #define OPL3SA _DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \425 #define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 363 426 { SNDRV_CTL_ELEM_IFACE_MIXER, 0, 0, xname, xindex, \ 364 0, 0, snd_opl3sa _info_double, \365 snd_opl3sa _get_double, snd_opl3sa_put_double, \427 0, 0, snd_opl3sa2_info_double, \ 428 snd_opl3sa2_get_double, snd_opl3sa2_put_double, \ 366 429 left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 367 430 368 431 #else 369 #define OPL3SA _DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \432 #define OPL3SA2_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ 370 433 { iface: SNDRV_CTL_ELEM_IFACE_MIXER, name: xname, index: xindex, \ 371 info: snd_opl3sa _info_double, \372 get: snd_opl3sa _get_double, put: snd_opl3sa_put_double, \434 info: snd_opl3sa2_info_double, \ 435 get: snd_opl3sa2_get_double, put: snd_opl3sa2_put_double, \ 373 436 private_value: left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 374 437 #endif 375 438 376 int snd_opl3sa _info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)439 int snd_opl3sa2_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 377 440 { 378 441 int mask = (kcontrol->private_value >> 24) & 0xff; … … 385 448 } 386 449 387 int snd_opl3sa _get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)388 { 389 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);450 int snd_opl3sa2_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 451 { 452 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 390 453 unsigned long flags; 391 454 int left_reg = kcontrol->private_value & 0xff; … … 396 459 int invert = (kcontrol->private_value >> 22) & 1; 397 460 398 spin_lock_irqsave(& oplcard->reg_lock, flags);399 ucontrol->value.integer.value[0] = ( oplcard->ctlregs[left_reg] >> shift_left) & mask;400 ucontrol->value.integer.value[1] = ( oplcard->ctlregs[right_reg] >> shift_right) & mask;401 spin_unlock_irqrestore(& oplcard->reg_lock, flags);461 spin_lock_irqsave(&chip->reg_lock, flags); 462 ucontrol->value.integer.value[0] = (chip->ctlregs[left_reg] >> shift_left) & mask; 463 ucontrol->value.integer.value[1] = (chip->ctlregs[right_reg] >> shift_right) & mask; 464 spin_unlock_irqrestore(&chip->reg_lock, flags); 402 465 if (invert) { 403 466 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; … … 407 470 } 408 471 409 int snd_opl3sa _put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)410 { 411 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol);472 int snd_opl3sa2_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 473 { 474 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 412 475 unsigned long flags; 413 476 int left_reg = kcontrol->private_value & 0xff; … … 428 491 val1 <<= shift_left; 429 492 val2 <<= shift_right; 430 spin_lock_irqsave(& oplcard->reg_lock, flags);493 spin_lock_irqsave(&chip->reg_lock, flags); 431 494 if (left_reg != right_reg) { 432 oval1 = oplcard->ctlregs[left_reg];433 oval2 = oplcard->ctlregs[right_reg];495 oval1 = chip->ctlregs[left_reg]; 496 oval2 = chip->ctlregs[right_reg]; 434 497 val1 = (oval1 & ~(mask << shift_left)) | val1; 435 498 val2 = (oval2 & ~(mask << shift_right)) | val2; 436 499 change = val1 != oval1 || val2 != oval2; 437 snd_opl3sa_write(oplcard->port, left_reg, oplcard->ctlregs[left_reg] =val1);438 snd_opl3sa_write(oplcard->port, right_reg, oplcard->ctlregs[right_reg] =val2);500 __snd_opl3sa2_write(chip, left_reg, val1); 501 __snd_opl3sa2_write(chip, right_reg, val2); 439 502 } else { 440 oval1 = oplcard->ctlregs[left_reg];503 oval1 = chip->ctlregs[left_reg]; 441 504 val1 = (oval1 & ~((mask << shift_left) | (mask << shift_right))) | val1 | val2; 442 505 change = val1 != oval1; 443 snd_opl3sa_write(oplcard->port, left_reg, oplcard->ctlregs[left_reg] =val1);444 } 445 spin_unlock_irqrestore(& oplcard->reg_lock, flags);506 __snd_opl3sa2_write(chip, left_reg, val1); 507 } 508 spin_unlock_irqrestore(&chip->reg_lock, flags); 446 509 return change; 447 510 } 448 511 449 #define OPL3SA _CONTROLS (sizeof(snd_opl3sa_controls)/sizeof(snd_kcontrol_new_t))450 451 static snd_kcontrol_new_t snd_opl3sa _controls[] = {452 OPL3SA _DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1),453 OPL3SA _DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1),454 OPL3SA _SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1),455 OPL3SA _SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1)512 #define OPL3SA2_CONTROLS (sizeof(snd_opl3sa2_controls)/sizeof(snd_kcontrol_new_t)) 513 514 static snd_kcontrol_new_t snd_opl3sa2_controls[] = { 515 OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), 516 OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1), 517 OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), 518 OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1) 456 519 }; 457 520 458 #define OPL3SA _TONE_CONTROLS (sizeof(snd_opl3sa_tone_controls)/sizeof(snd_kcontrol_new_t))459 460 static snd_kcontrol_new_t snd_opl3sa _tone_controls[] = {461 OPL3SA _DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0),462 OPL3SA _DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0),463 OPL3SA _DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)521 #define OPL3SA2_TONE_CONTROLS (sizeof(snd_opl3sa2_tone_controls)/sizeof(snd_kcontrol_new_t)) 522 523 static snd_kcontrol_new_t snd_opl3sa2_tone_controls[] = { 524 OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), 525 OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), 526 OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0) 464 527 }; 465 528 466 static void snd_opl3sa_master_free(snd_kcontrol_t *kcontrol) 467 { 468 struct snd_opl3sa *oplcard = (struct snd_opl3sa *)_snd_kcontrol_chip(kcontrol); 469 470 oplcard->master_switch = NULL; 471 oplcard->master_volume = NULL; 472 } 473 474 static int __init snd_opl3sa_mixer(struct snd_opl3sa *oplcard) 475 { 476 snd_card_t *card = oplcard->card; 529 static void snd_opl3sa2_master_free(snd_kcontrol_t *kcontrol) 530 { 531 opl3sa2_t *chip = _snd_kcontrol_chip(kcontrol); 532 chip->master_switch = NULL; 533 chip->master_volume = NULL; 534 } 535 536 static int __init snd_opl3sa2_mixer(opl3sa2_t *chip) 537 { 538 snd_card_t *card = chip->card; 477 539 snd_ctl_elem_id_t id1, id2; 478 540 snd_kcontrol_t *kctl; … … 501 563 return err; 502 564 /* add OPL3SA2 controls */ 503 for (idx = 0; idx < OPL3SA _CONTROLS; idx++) {504 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa _controls[idx], oplcard))) < 0)565 for (idx = 0; idx < OPL3SA2_CONTROLS; idx++) { 566 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_opl3sa2_controls[idx], chip))) < 0) 505 567 return err; 506 568 switch (idx) { 507 case 0: oplcard->master_switch = kctl; kctl->private_free = snd_opl3sa_master_free; break;508 case 1: oplcard->master_volume = kctl; kctl->private_free = snd_opl3sa_master_free; break;569 case 0: chip->master_switch = kctl; kctl->private_free = snd_opl3sa2_master_free; break; 570 case 1: chip->master_volume = kctl; kctl->private_free = snd_opl3sa2_master_free; break; 509 571 } 510 572 } 511 if ( oplcard->version > 2) {512 for (idx = 0; idx < OPL3SA _TONE_CONTROLS; idx++)513 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa _tone_controls[idx], oplcard))) < 0)573 if (chip->version > 2) { 574 for (idx = 0; idx < OPL3SA2_TONE_CONTROLS; idx++) 575 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opl3sa2_tone_controls[idx], chip))) < 0) 514 576 return err; 515 577 } … … 517 579 } 518 580 519 #ifdef __ISAPNP__ 520 static int __init snd_opl3sa_isapnp(int dev, struct snd_opl3sa *oplcard) 581 /* Power Management support functions */ 582 #ifdef CONFIG_PM 583 static void snd_opl3sa2_suspend(opl3sa2_t *chip) 584 { 585 snd_card_t *card = chip->card; 586 587 snd_power_lock(card); 588 if (card->power_state == SNDRV_CTL_POWER_D3hot) 589 goto __skip; 590 591 /* FIXME: is this order ok? */ 592 chip->cs4231_suspend(chip->cs4231); 593 snd_pcm_suspend_all(chip->cs4231->pcm); 594 595 /* power down */ 596 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D3); 597 598 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 599 __skip: 600 snd_power_unlock(card); 601 } 602 603 static void snd_opl3sa2_resume(opl3sa2_t *chip) 604 { 605 snd_card_t *card = chip->card; 606 int i; 607 608 snd_power_lock(card); 609 if (card->power_state == SNDRV_CTL_POWER_D0) 610 goto __skip; 611 612 /* power up */ 613 snd_opl3sa2_write(chip, OPL3SA2_PM_CTRL, OPL3SA2_PM_D0); 614 615 /* restore registers */ 616 for (i = 2; i <= 0x0a; i++) { 617 if (i != OPL3SA2_IRQ_STATUS) 618 snd_opl3sa2_write(chip, i, chip->ctlregs[i]); 619 } 620 if (chip->version > 2) { 621 for (i = 0x12; i <= 0x16; i++) 622 snd_opl3sa2_write(chip, i, chip->ctlregs[i]); 623 } 624 /* restore cs4231 */ 625 chip->cs4231_resume(chip->cs4231); 626 627 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 628 __skip: 629 snd_power_unlock(card); 630 } 631 632 /* callback for control API */ 633 static int snd_opl3sa2_set_power_state(snd_card_t *card, unsigned int power_state) 634 { 635 opl3sa2_t *chip = (opl3sa2_t *) card->pm_private_data; 636 switch (power_state) { 637 case SNDRV_CTL_POWER_D0: 638 case SNDRV_CTL_POWER_D1: 639 case SNDRV_CTL_POWER_D2: 640 snd_opl3sa2_resume(chip); 641 break; 642 case SNDRV_CTL_POWER_D3hot: 643 case SNDRV_CTL_POWER_D3cold: 644 snd_opl3sa2_suspend(chip); 645 break; 646 default: 647 return -EINVAL; 648 } 649 return 0; 650 } 651 652 static int snd_opl3sa2_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) 653 { 654 opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, dev->data, return 0); 655 656 switch (rqst) { 657 case PM_SUSPEND: 658 snd_opl3sa2_suspend(chip); 659 break; 660 case PM_RESUME: 661 snd_opl3sa2_resume(chip); 662 break; 663 } 664 return 0; 665 } 666 667 #endif /* CONFIG_PM */ 668 669 #ifdef __ISAPNP__ 670 static int __init snd_opl3sa2_isapnp(int dev, opl3sa2_t *chip) 521 671 { 522 672 const struct isapnp_card_id *id = snd_opl3sa2_isapnp_id[dev]; … … 524 674 struct isapnp_dev *pdev; 525 675 526 oplcard->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);527 if ( oplcard->dev->active) {528 oplcard->dev = NULL;676 chip->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL); 677 if (chip->dev->active) { 678 chip->dev = NULL; 529 679 return -EBUSY; 530 680 } 531 681 /* PnP initialization */ 532 pdev = oplcard->dev;682 pdev = chip->dev; 533 683 if (pdev->prepare(pdev)<0) 534 684 return -EAGAIN; … … 568 718 } 569 719 570 static void snd_opl3sa _deactivate(struct snd_opl3sa *oplcard)571 { 572 if ( oplcard->dev) {573 oplcard->dev->deactivate(oplcard->dev);574 oplcard->dev = NULL;720 static void snd_opl3sa2_deactivate(opl3sa2_t *chip) 721 { 722 if (chip->dev) { 723 chip->dev->deactivate(chip->dev); 724 chip->dev = NULL; 575 725 } 576 726 } 577 727 #endif /* __ISAPNP__ */ 578 728 579 static void snd_card_opl3sa2_free(snd_card_t *card) 580 { 581 struct snd_opl3sa *acard = (struct snd_opl3sa *)card->private_data; 582 583 if (acard) { 584 #ifdef __ISAPNP__ 585 snd_opl3sa_deactivate(acard); 586 #endif 587 if (acard->irq >= 0) 588 free_irq(acard->irq, (void *)acard); 589 if (acard->res_port) 590 release_resource(acard->res_port); 591 } 592 } 593 594 static int __init snd_opl3sa_probe(int dev) 729 static int snd_opl3sa2_free(opl3sa2_t *chip) 730 { 731 #ifdef __ISAPNP__ 732 snd_opl3sa2_deactivate(chip); 733 #endif 734 #ifdef CONFIG_PM 735 if (chip->pm_dev) 736 pm_unregister(chip->pm_dev); 737 #endif 738 if (chip->irq >= 0) 739 free_irq(chip->irq, (void *)chip); 740 if (chip->res_port) { 741 release_resource(chip->res_port); 742 kfree_nocheck(chip->res_port); 743 } 744 snd_magic_kfree(chip); 745 return 0; 746 } 747 748 static int snd_opl3sa2_dev_free(snd_device_t *device) 749 { 750 opl3sa2_t *chip = snd_magic_cast(opl3sa2_t, device->device_data, return -ENXIO); 751 return snd_opl3sa2_free(chip); 752 } 753 754 static int __init snd_opl3sa2_probe(int dev) 595 755 { 596 756 int irq, dma1, dma2; 597 757 snd_card_t *card; 598 struct snd_opl3sa *oplcard;758 struct snd_opl3sa2 *chip; 599 759 cs4231_t *cs4231; 600 760 opl3_t *opl3; 761 static snd_device_ops_t ops = { 762 dev_free: snd_opl3sa2_dev_free, 763 }; 601 764 int err; 602 765 … … 623 786 } 624 787 #endif 625 card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 626 sizeof(struct snd_opl3sa)); 788 card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0); 627 789 if (card == NULL) 628 790 return -ENOMEM; 629 oplcard = (struct snd_opl3sa *)card->private_data;630 oplcard->irq = -1;631 card->private_free = snd_card_opl3sa2_free;632 791 strcpy(card->driver, "OPL3SA2"); 633 792 strcpy(card->shortname, "Yamaha OPL3-SA2"); 634 #ifdef __ISAPNP__ 635 if (snd_isapnp[dev] && snd_opl3sa_isapnp(dev, oplcard) < 0) { 636 snd_card_free(card); 637 return -EBUSY; 638 } 639 #endif 640 oplcard->ymode = snd_opl3sa3_ymode[dev] & 0x03 ; /* SL Added - initialise this card from supplied (or default) parameter*/ 641 oplcard->card = card; 642 oplcard->port = snd_port[dev]; 793 chip = snd_magic_kcalloc(opl3sa2_t, 0, GFP_KERNEL); 794 if (chip == NULL) { 795 err = -ENOMEM; 796 goto __error; 797 } 798 chip->irq = -1; 799 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) 800 goto __error; 801 #ifdef __ISAPNP__ 802 if (snd_isapnp[dev] && (err = snd_opl3sa2_isapnp(dev, chip)) < 0) 803 goto __error; 804 #endif 805 chip->ymode = snd_opl3sa3_ymode[dev] & 0x03 ; /* initialise this card from supplied (or default) parameter*/ 806 chip->card = card; 807 chip->port = snd_port[dev]; 643 808 irq = snd_irq[dev]; 644 809 dma1 = snd_dma1[dev]; 645 810 dma2 = snd_dma2[dev]; 646 811 if (dma2 < 0) 647 oplcard->single_dma = 1; 648 if ((snd_opl3sa_detect(oplcard)) < 0) { 649 snd_card_free(card); 650 return -ENODEV; 651 } 652 if (request_irq(irq, snd_opl3sa_interrupt, SA_INTERRUPT, "OPL3-SA2/3", (void *)oplcard)) { 653 snd_card_free(card); 654 return -ENODEV; 655 } 656 oplcard->irq = irq; 812 chip->single_dma = 1; 813 if ((err = snd_opl3sa2_detect(chip)) < 0) 814 goto __error; 815 if (request_irq(irq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2/3", (void *)chip)) { 816 err = -ENODEV; 817 goto __error; 818 } 819 chip->irq = irq; 657 820 if ((err = snd_cs4231_create(card, 658 821 snd_wss_port[dev] + 4, -1, … … 662 825 &cs4231)) < 0) { 663 826 snd_printd("Oops, WSS not detected at 0x%lx\n", snd_wss_port[dev] + 4); 664 snd_card_free(card); 665 return err; 666 } 667 oplcard->cs4231 = cs4231; 668 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) { 669 snd_card_free(card); 670 return err; 671 } 672 if ((err = snd_cs4231_mixer(cs4231)) < 0) { 673 snd_card_free(card); 674 return err; 675 } 676 if ((err = snd_opl3sa_mixer(oplcard)) < 0) { 677 snd_card_free(card); 678 return err; 679 } 680 if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0) { 681 snd_card_free(card); 682 return err; 683 } 827 goto __error; 828 } 829 chip->cs4231 = cs4231; 830 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) 831 goto __error; 832 if ((err = snd_cs4231_mixer(cs4231)) < 0) 833 goto __error; 834 if ((err = snd_opl3sa2_mixer(chip)) < 0) 835 goto __error; 836 if ((err = snd_cs4231_timer(cs4231, 0, NULL)) < 0) 837 goto __error; 684 838 if (snd_fm_port[dev] >= 0x340 && snd_fm_port[dev] < 0x400) { 685 839 if ((err = snd_opl3_create(card, snd_fm_port[dev], 686 840 snd_fm_port[dev] + 2, 687 OPL3_HW_OPL3, 0, &opl3)) < 0) { 688 snd_card_free(card); 689 return err; 690 } 691 if ((err = snd_opl3_timer_new(opl3, 1, 2)) < 0) { 692 snd_card_free(card); 693 return err; 694 } 695 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, &oplcard->synth)) < 0) { 696 snd_card_free(card); 697 return err; 698 } 841 OPL3_HW_OPL3, 0, &opl3)) < 0) 842 goto __error; 843 if ((err = snd_opl3_timer_new(opl3, 1, 2)) < 0) 844 goto __error; 845 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, &chip->synth)) < 0) 846 goto __error; 699 847 } 700 848 if (snd_midi_port[dev] >= 0x300 && snd_midi_port[dev] < 0x340) { 701 849 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2, 702 850 snd_midi_port[dev], 0, 703 irq, 0, &oplcard->rmidi)) < 0) { 704 snd_card_free(card); 705 return err; 706 } 707 } 851 irq, 0, &chip->rmidi)) < 0) 852 goto __error; 853 } 854 #ifdef CONFIG_PM 855 /* Power Management */ 856 chip->pm_dev = pm_register(PM_ISA_DEV, 0, snd_opl3sa2_pm_callback); 857 if (chip->pm_dev) { 858 chip->pm_dev->data = chip; 859 /* remember callbacks for cs4231 - they are called inside 860 * opl3sa2 pm callback 861 */ 862 chip->cs4231_suspend = chip->cs4231->suspend; 863 chip->cs4231_resume = chip->cs4231->resume; 864 /* now clear callbacks for cs4231 */ 865 chip->cs4231->suspend = NULL; 866 chip->cs4231->resume = NULL; 867 /* set control api callback */ 868 card->set_power_state = snd_opl3sa2_set_power_state; 869 card->pm_private_data = chip; 870 } 871 #endif 872 708 873 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 709 card->shortname, oplcard->port, irq, dma1);874 card->shortname, chip->port, irq, dma1); 710 875 if (dma2 >= 0) 711 876 sprintf(card->longname + strlen(card->longname), "&%d", dma2); 712 877 713 if ((err = snd_card_register(card)) < 0) { 714 snd_card_free(card); 715 return err; 716 } 717 snd_opl3sa_cards[dev] = card; 718 return 0; 878 if ((err = snd_card_register(card)) < 0) 879 goto __error; 880 881 snd_opl3sa2_cards[dev] = card; 882 return 0; 883 884 __error: 885 snd_card_free(card); 886 return err; 719 887 } 720 888 … … 731 899 snd_opl3sa2_isapnp_cards[dev] = card; 732 900 snd_opl3sa2_isapnp_id[dev] = id; 733 res = snd_opl3sa _probe(dev);901 res = snd_opl3sa2_probe(dev); 734 902 if (res < 0) 735 903 return res; … … 752 920 continue; 753 921 #endif 754 if (snd_opl3sa _probe(dev) >= 0)922 if (snd_opl3sa2_probe(dev) >= 0) 755 923 cards++; 756 924 } … … 760 928 if (!cards) { 761 929 #ifdef MODULE 762 snd_printk("Yamaha OPL3-SA soundcard not found or device busy\n");930 printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); 763 931 #endif 764 932 return -ENODEV; … … 772 940 773 941 for (idx = 0; idx < SNDRV_CARDS; idx++) 774 snd_card_free(snd_opl3sa _cards[idx]);942 snd_card_free(snd_opl3sa2_cards[idx]); 775 943 } 776 944 … … 780 948 #ifndef MODULE 781 949 782 /* format is: snd- card-opl3sa2=snd_enable,snd_index,snd_id,snd_isapnp,950 /* format is: snd-opl3sa2=snd_enable,snd_index,snd_id,snd_isapnp, 783 951 snd_port,snd_sb_port,snd_wss_port,snd_fm_port, 784 952 snd_midi_port,snd_irq,snd_dma1,snd_dma2, … … 813 981 } 814 982 815 __setup("snd- card-opl3sa2=", alsa_card_opl3sa2_setup);983 __setup("snd-opl3sa2=", alsa_card_opl3sa2_setup); 816 984 817 985 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/opti9xx/opti92x-ad1848.c
r32 r92 20 20 You should have received a copy of the GNU General Public License 21 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 23 */ 24 24 25 #define SNDRV_MAIN_OBJECT_FILE 25 26 26 #include <sound/driver.h> 27 #include <asm/io.h> 28 #include <asm/dma.h> 29 #include <linux/delay.h> 30 #include <linux/init.h> 31 #include <linux/slab.h> 32 #ifndef LINUX_ISAPNP_H 33 #include <linux/isapnp.h> 34 #define isapnp_card pci_bus 35 #define isapnp_dev pci_dev 36 #endif 37 #include <sound/core.h> 27 38 #ifdef CS4231 28 39 #include <sound/cs4231.h> … … 44 55 45 56 EXPORT_NO_SYMBOLS; 57 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 58 MODULE_CLASSES("{sound}"); 59 MODULE_LICENSE("GPL"); 46 60 #ifdef OPTi93X 47 61 MODULE_DESCRIPTION("OPTi93X"); 48 MODULE_CLASSES("{sound}");49 62 MODULE_DEVICES("{{OPTi,82C931/3}}"); 50 63 #else /* OPTi93X */ 51 64 #ifdef CS4231 52 65 MODULE_DESCRIPTION("OPTi92X - CS4231"); 53 MODULE_CLASSES("{sound}");54 66 MODULE_DEVICES("{{OPTi,82C924 (CS4231)}," 55 67 "{OPTi,82C925 (CS4231)}}"); 56 68 #else /* CS4231 */ 57 69 MODULE_DESCRIPTION("OPTi92X - AD1848"); 58 MODULE_CLASSES("{sound}");59 70 MODULE_DEVICES("{{OPTi,82C924 (AD1848)}," 60 "{OPTi,82C925 (AD1848)}}"); 71 "{OPTi,82C925 (AD1848)}," 72 "{OAK,Mozart}}"); 61 73 #endif /* CS4231 */ 62 74 #endif /* OPTi93X */ … … 1034 1046 ~(OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO)); 1035 1047 1036 snd_dma_program(chip->dma1, runtime->dma_a rea, size,1048 snd_dma_program(chip->dma1, runtime->dma_addr, size, 1037 1049 DMA_MODE_WRITE | DMA_AUTOINIT); 1038 1050 … … 1067 1079 (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO)); 1068 1080 1069 snd_dma_program(chip->dma2, runtime->dma_a rea, size,1081 snd_dma_program(chip->dma2, runtime->dma_addr, size, 1070 1082 DMA_MODE_READ | DMA_AUTOINIT); 1071 1083 … … 1292 1304 static int snd_opti93x_free(opti93x_t *chip) 1293 1305 { 1294 if (chip->res_port) 1306 if (chip->res_port) { 1295 1307 release_resource(chip->res_port); 1308 kfree_nocheck(chip->res_port); 1309 } 1296 1310 if (chip->dma1 >= 0) { 1297 1311 disable_dma(chip->dma1); … … 1458 1472 strcpy(pcm->name, snd_opti93x_chip_id(codec)); 1459 1473 1460 snd_pcm_lib_preallocate_ pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024, GFP_KERNEL|GFP_DMA);1474 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024); 1461 1475 1462 1476 codec->pcm = pcm; … … 1716 1730 1717 1731 snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); 1732 1718 1733 card = chip->card; 1719 1734 … … 1991 2006 snd_card_opti9xx_deactivate(chip); 1992 2007 #endif /* __ISAPNP__ */ 1993 if (chip->res_mc_base) 2008 if (chip->res_mc_base) { 1994 2009 release_resource(chip->res_mc_base); 2010 kfree_nocheck(chip->res_mc_base); 2011 } 1995 2012 } 1996 2013 } … … 2249 2266 #ifdef MODULE 2250 2267 #ifdef OPTi93X 2251 snd_printk("no OPTi 82C93x soundcard found\n");2252 #else 2253 snd_printk("no OPTi 82C92x soundcard found\n");2268 printk(KERN_ERR "no OPTi 82C93x soundcard found\n"); 2269 #else 2270 printk(KERN_ERR "no OPTi 82C92x soundcard found\n"); 2254 2271 #endif /* OPTi93X */ 2255 2272 #endif … … 2270 2287 #ifndef MODULE 2271 2288 2272 /* format is: snd- card-opti9xx=snd_enable,snd_index,snd_id,snd_isapnp,2289 /* format is: snd-opti9xx=snd_enable,snd_index,snd_id,snd_isapnp, 2273 2290 snd_port,snd_mpu_port,snd_fm_port, 2274 2291 snd_irq,snd_mpu_irq, … … 2303 2320 2304 2321 #if defined(OPTi93X) 2305 __setup("snd- card-opti93x=", alsa_card_opti9xx_setup);2322 __setup("snd-opti93x=", alsa_card_opti9xx_setup); 2306 2323 #elif defined(CS4231) 2307 __setup("snd- card-opti92x-cs4231=", alsa_card_opti9xx_setup);2308 #else 2309 __setup("snd- card-opti92x-ad1848=", alsa_card_opti9xx_setup);2324 __setup("snd-opti92x-cs4231=", alsa_card_opti9xx_setup); 2325 #else 2326 __setup("snd-opti92x-ad1848=", alsa_card_opti9xx_setup); 2310 2327 #endif 2311 2328 -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c
r32 r92 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 23 #define SNDRV_MAIN_OBJECT_FILE24 23 #include <sound/driver.h> 24 #include <linux/init.h> 25 #include <linux/time.h> 26 #ifndef LINUX_ISAPNP_H 27 #include <linux/isapnp.h> 28 #define isapnp_card pci_bus 29 #define isapnp_dev pci_dev 30 #endif 31 #include <sound/core.h> 25 32 #define SNDRV_GET_ID 26 33 #include <sound/initval.h> 27 34 #include <sound/sb.h> 28 35 36 #define chip_t sb_t 37 29 38 EXPORT_NO_SYMBOLS; 39 40 MODULE_AUTHOR("Massimo Piccioni <dafastidio@libero.it>"); 30 41 MODULE_DESCRIPTION("ESS AudioDrive ES968"); 42 MODULE_LICENSE("GPL"); 31 43 MODULE_CLASSES("{sound}"); 32 44 MODULE_DEVICES("{{ESS,AudioDrive ES968}}"); … … 34 46 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 35 47 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 36 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */48 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 37 49 static long snd_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 38 50 static int snd_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* Pnp setup */ … … 93 105 struct pt_regs *regs) 94 106 { 95 sb_t *chip = dev_id;107 sb_t *chip = snd_magic_cast(sb_t, dev_id, return); 96 108 97 109 if (chip->open & SB_OPEN_PCM) { … … 272 284 #ifndef MODULE 273 285 274 /* format is: snd- card-es968=snd_enable,snd_index,snd_id,286 /* format is: snd-es968=snd_enable,snd_index,snd_id, 275 287 snd_port,snd_irq,snd_dma1 */ 276 288 … … 291 303 } 292 304 293 __setup("snd- card-es968=", alsa_card_es968_setup);305 __setup("snd-es968=", alsa_card_es968_setup); 294 306 295 307 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <asm/dma.h> 24 #include <linux/init.h> 25 #include <linux/slab.h> 26 #ifndef LINUX_ISAPNP_H 27 #include <linux/isapnp.h> 28 #define isapnp_card pci_bus 29 #define isapnp_dev pci_dev 30 #endif 31 #include <sound/core.h> 24 32 #include <sound/sb.h> 25 33 #include <sound/sb16_csp.h> … … 34 42 #include <sound/initval.h> 35 43 44 #define chip_t sb_t 45 46 #ifdef SNDRV_SBAWE 47 #define PFX "sbawe: " 48 #else 49 #define PFX "sb16: " 50 #endif 51 52 #ifndef SNDRV_SBAWE 36 53 EXPORT_NO_SYMBOLS; 54 #endif 55 56 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 57 MODULE_LICENSE("GPL"); 58 MODULE_CLASSES("{sound}"); 37 59 #ifndef SNDRV_SBAWE 38 60 MODULE_DESCRIPTION("Sound Blaster 16"); 39 MODULE_CLASSES("{sound}");40 61 MODULE_DEVICES("{{Creative Labs,SB 16}," 41 62 "{Creative Labs,SB Vibra16S}," … … 45 66 #else 46 67 MODULE_DESCRIPTION("Sound Blaster AWE"); 47 MODULE_CLASSES("{sound}");48 68 MODULE_DEVICES("{{Creative Labs,SB AWE 32}," 49 69 "{Creative Labs,SB AWE 64}," … … 55 75 #endif 56 76 57 #if defined(SNDRV_SBAWE) && defined(CONFIG_SND_SEQUENCER) && defined(CONFIG_SND_SYNTH_EMU8000)77 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)) 58 78 #define SNDRV_SBAWE_EMU8000 59 79 #endif … … 61 81 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 62 82 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 63 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE ;/* Enable this card */83 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 64 84 #ifdef __ISAPNP__ 65 85 #ifdef TARGET_OS2 … … 139 159 MODULE_PARM(snd_mic_agc, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 140 160 MODULE_PARM_DESC(snd_mic_agc, "Mic Auto-Gain-Control switch."); 141 MODULE_PARM_SYNTAX(snd_mic_agc m, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC);161 MODULE_PARM_SYNTAX(snd_mic_agc, SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC); 142 162 #ifdef CONFIG_SND_SB16_CSP 143 163 MODULE_PARM(snd_csp, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); … … 212 232 ISAPNP_SB16('C','T','L',0x002b,0x0031), 213 233 /* Sound Blaster 16 PnP */ 214 ISAPNP_SB16('C','T','L',0x002c,0x0031), 234 ISAPNP_SB16('C','T','L',0x002c,0x0031), 215 235 /* Sound Blaster Vibra16S */ 216 236 ISAPNP_SB16('C','T','L',0x0051,0x0001), … … 264 284 /* Sound Blaster AWE 64 PnP */ 265 285 ISAPNP_SBAWE('C','T','L',0x00e4,0x0045,0x0022), 286 /* Sound Blaster AWE 64 PnP */ 287 ISAPNP_SBAWE('C','T','L',0x00e9,0x0045,0x0022), 266 288 /* Sound Blaster 16 PnP (AWE) */ 267 289 ISAPNP_SBAWE('C','T','L',0x00ed,0x0041,0x0070), … … 295 317 return -EBUSY; 296 318 } 297 #endif 319 #endif 298 320 /* Audio initialization */ 299 321 pdev = acard->dev; … … 313 335 isapnp_resource_change(&pdev->irq_resource[0], snd_irq[dev], 1); 314 336 if (pdev->activate(pdev) < 0) { 315 snd_printk("isapnp configure failure (out of resources?)\n");337 printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n"); 316 338 return -EBUSY; 317 339 } … … 333 355 return -EAGAIN; 334 356 } 335 if (snd_awe_port[dev] != SNDRV_AUTO_PORT) 357 if (snd_awe_port[dev] != SNDRV_AUTO_PORT) { 336 358 isapnp_resource_change(&pdev->resource[0], snd_awe_port[dev], 4); 359 isapnp_resource_change(&pdev->resource[1], snd_awe_port[dev] + 0x400, 4); 360 isapnp_resource_change(&pdev->resource[2], snd_awe_port[dev] + 0x800, 4); 361 } 337 362 if (pdev->activate(pdev)<0) { 338 snd_printk("WaveTable isapnp configure failure (out of resources?)\n");339 acard->dev->deactivate(acard->dev); 363 printk(KERN_ERR PFX "WaveTable isapnp configure failure (out of resources?)\n"); 364 acard->dev->deactivate(acard->dev); 340 365 return -EBUSY; 341 366 } … … 368 393 if (acard == NULL) 369 394 return; 370 if (acard->fm_res) 395 if (acard->fm_res) { 371 396 release_resource(acard->fm_res); 397 kfree_nocheck(acard->fm_res); 398 } 372 399 #ifdef __ISAPNP__ 373 400 snd_sb16_deactivate(acard); … … 386 413 opl3_t *opl3; 387 414 snd_hwdep_t *synth = NULL; 415 #ifdef CONFIG_SND_SB16_CSP 388 416 snd_hwdep_t *csp = NULL; 417 #endif 389 418 unsigned long flags; 390 419 int err; … … 412 441 if ((irq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 413 442 snd_card_free(card); 414 snd_printk("unable to find a free IRQ\n");443 printk(KERN_ERR PFX "unable to find a free IRQ\n"); 415 444 return -EBUSY; 416 445 } … … 419 448 if ((dma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { 420 449 snd_card_free(card); 421 snd_printk("unable to find a free 8-bit DMA\n");450 printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); 422 451 return -EBUSY; 423 452 } … … 426 455 if ((dma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { 427 456 snd_card_free(card); 428 snd_printk("unable to find a free 16-bit DMA\n");457 printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); 429 458 return -EBUSY; 430 459 } … … 485 514 OPL3_HW_OPL3, snd_fm_port[dev] == snd_port[dev], 486 515 &opl3) < 0) { 487 snd_printk("no OPL device at 0x%lx-0x%lx\n",516 printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", 488 517 snd_fm_port[dev], snd_fm_port[dev] + 2); 489 518 } else { … … 513 542 chip->hardware = SB_HW_16CSP; 514 543 } else { 515 snd_printk("warning - CSP chip not detected on soundcard #%i\n", dev + 1);544 printk(KERN_INFO PFX "warning - CSP chip not detected on soundcard #%i\n", dev + 1); 516 545 } 517 546 } … … 521 550 if (snd_emu8000_new(card, 1, snd_awe_port[dev], 522 551 snd_seq_ports[dev], NULL) < 0) { 523 snd_printk("fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", snd_awe_port[dev]);552 printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", snd_awe_port[dev]); 524 553 snd_card_free(card); 525 554 return -ENXIO; … … 535 564 spin_unlock_irqrestore(&chip->mixer_lock, flags); 536 565 537 strcpy(card->driver, 566 strcpy(card->driver, 538 567 #ifdef SNDRV_SBAWE_EMU8000 539 568 snd_awe_port[dev] > 0 ? "SB AWE" : … … 622 651 } 623 652 #ifdef MODULE 624 snd_printk("Sound Blaster 16+ soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]);625 #endif 653 printk(KERN_ERR "Sound Blaster 16+ soundcard #%i not found at 0x%lx or device busy\n", dev, snd_port[dev]); 654 #endif 626 655 } 627 656 /* legacy auto configured cards */ … … 634 663 if (!cards) { 635 664 #ifdef MODULE 636 snd_printk("Sound Blaster 16 soundcard not found or device busy\n");637 #ifdef SNDRV_SBAWE_EMU8000 638 snd_printk("In case, if you have non-AWE card, try snd-card-sb16 module\n");639 #else 640 snd_printk("In case, if you have AWE card, try snd-card-sbawe module\n");665 printk(KERN_ERR "Sound Blaster 16 soundcard not found or device busy\n"); 666 #ifdef SNDRV_SBAWE_EMU8000 667 printk(KERN_ERR "In case, if you have non-AWE card, try snd-card-sb16 module\n"); 668 #else 669 printk(KERN_ERR "In case, if you have AWE card, try snd-card-sbawe module\n"); 641 670 #endif 642 671 #endif … … 659 688 #ifndef MODULE 660 689 661 /* format is: snd-card-sb16=snd_enable,snd_index,snd_id,snd_isapnp,690 /* format is: snd-sb16=snd_enable,snd_index,snd_id,snd_isapnp, 662 691 snd_port,snd_mpu_port,snd_fm_port, 663 692 snd_irq,snd_dma8,snd_dma16, … … 683 712 get_option(&str,&snd_dma8[nr_dev]) == 2 && 684 713 get_option(&str,&snd_dma16[nr_dev]) == 2 && 685 get_option(&str,&snd_mic_agc[nr_dev]) == 2 && 714 get_option(&str,&snd_mic_agc[nr_dev]) == 2 715 #ifdef CONFIG_SND_SB16_CSP 716 && 686 717 get_option(&str,&snd_csp[nr_dev]) == 2 718 #endif 687 719 #ifdef SNDRV_SBAWE_EMU8000 688 720 && … … 704 736 705 737 #ifndef SNDRV_SBAWE_EMU8000 706 __setup("snd-card-sb16=", alsa_card_sb16_setup);707 #else 708 __setup("snd-card-sbawe=", alsa_card_sb16_setup);738 __setup("snd-sb16=", alsa_card_sb16_setup); 739 #else 740 __setup("snd-sbawe=", alsa_card_sb16_setup); 709 741 #endif 710 742 -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_csp.c
r32 r92 20 20 * You should have received a copy of the GNU General Public License 21 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 23 * 24 24 */ 25 25 26 #define SNDRV_MAIN_OBJECT_FILE27 26 #include <sound/driver.h> 27 #include <linux/delay.h> 28 #include <linux/init.h> 29 #include <linux/slab.h> 30 #include <sound/core.h> 28 31 #include <sound/control.h> 29 32 #include <sound/info.h> … … 33 36 MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>"); 34 37 MODULE_DESCRIPTION("ALSA driver for SB16 Creative Signal Processor"); 38 MODULE_LICENSE("GPL"); 35 39 MODULE_CLASSES("{sound}"); 36 40 37 41 #ifdef SNDRV_LITTLE_ENDIAN 38 42 #define CSP_HDR_VALUE(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24)) 39 #define LE_SHORT(v) (v)40 #define LE_INT(v) (v)41 43 #else 42 #include <byteswap.h>43 44 #define CSP_HDR_VALUE(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24)) 44 45 #define LE_SHORT(v) bswap_16(v) 45 46 #define LE_INT(v) bswap_32(v) 46 47 #endif 48 #define LE_SHORT(v) le16_to_cpu(v) 49 #define LE_INT(v) le32_to_cpu(v) 47 50 48 51 #define RIFF_HEADER CSP_HDR_VALUE('R', 'I', 'F', 'F') … … 316 319 if ((file_h.name != RIFF_HEADER) || 317 320 (LE_INT(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { 318 snd_printd(__FUNCTION__ ": Invalid RIFF header\n");321 snd_printd("%s: Invalid RIFF header\n", __FUNCTION__); 319 322 return -EINVAL; 320 323 } … … 325 328 return -EFAULT; 326 329 if (item_type != CSP__HEADER) { 327 snd_printd(__FUNCTION__ ": Invalid RIFF file type\n");330 snd_printd("%s: Invalid RIFF file type\n", __FUNCTION__); 328 331 return -EINVAL; 329 332 } … … 380 383 381 384 if (code_h.name != MAIN_HEADER) { 382 snd_printd(__FUNCTION__ ": Missing 'main' microcode\n");385 snd_printd("%s: Missing 'main' microcode\n", __FUNCTION__); 383 386 return -EINVAL; 384 387 } … … 424 427 p->acc_format = p->acc_width = p->acc_rates = 0; 425 428 p->mode = 0; 426 snd_printd(__FUNCTION__ ": Unsupported CSP codec type: 0x%04x\n", 429 snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", 430 __FUNCTION__, 427 431 LE_SHORT(funcdesc_h.VOC_type)); 428 432 return -EINVAL; … … 443 447 } 444 448 } 445 snd_printd(__FUNCTION__ ": Function #%d not found\n", info.func_req);449 snd_printd("%s: Function #%d not found\n", __FUNCTION__, info.func_req); 446 450 return -EINVAL; 447 451 } … … 597 601 { 598 602 if (p->version < 0x10 || p->version > 0x1f) { 599 snd_printd(__FUNCTION__ ": Invalid CSP version: 0x%x\n", p->version);603 snd_printd("%s: Invalid CSP version: 0x%x\n", __FUNCTION__, p->version); 600 604 return 1; 601 605 } … … 616 620 snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ 617 621 if (snd_sbdsp_get_byte(p->chip)) { 618 snd_printd(__FUNCTION__ ": Download command failed\n");622 snd_printd("%s: Download command failed\n", __FUNCTION__); 619 623 goto __fail; 620 624 } … … 661 665 } 662 666 if (status != 0x55) { 663 snd_printd(__FUNCTION__ ": Microcode initialization failed\n");667 snd_printd("%s: Microcode initialization failed\n", __FUNCTION__); 664 668 goto __fail; 665 669 } … … 776 780 777 781 if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { 778 snd_printd(__FUNCTION__ ": Microcode not loaded\n");782 snd_printd("%s: Microcode not loaded\n", __FUNCTION__); 779 783 return -ENXIO; 780 784 } 781 785 if (p->running & SNDRV_SB_CSP_ST_RUNNING) { 782 snd_printd(__FUNCTION__ ": CSP already running\n");786 snd_printd("%s: CSP already running\n", __FUNCTION__); 783 787 return -EBUSY; 784 788 } 785 789 if (!(sample_width & p->acc_width)) { 786 snd_printd(__FUNCTION__ ": Unsupported PCM sample width\n");790 snd_printd("%s: Unsupported PCM sample width\n", __FUNCTION__); 787 791 return -EINVAL; 788 792 } 789 793 if (!(channels & p->acc_channels)) { 790 snd_printd(__FUNCTION__ ": Invalid number of channels\n");794 snd_printd("%s: Invalid number of channels\n", __FUNCTION__); 791 795 return -EINVAL; 792 796 } … … 810 814 811 815 if (set_codec_parameter(p->chip, 0x81, s_type)) { 812 snd_printd(__FUNCTION__ ": Set sample type command failed\n");816 snd_printd("%s: Set sample type command failed\n", __FUNCTION__); 813 817 goto __fail; 814 818 } 815 819 if (set_codec_parameter(p->chip, 0x80, 0x00)) { 816 snd_printd(__FUNCTION__ ": Codec start command failed\n");820 snd_printd("%s: Codec start command failed\n", __FUNCTION__); 817 821 goto __fail; 818 822 } -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_main.c
r32 r92 24 24 * You should have received a copy of the GNU General Public License 25 25 * along with this program; if not, write to the Free Software 26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 27 * 28 28 */ 29 29 30 #define SNDRV_MAIN_OBJECT_FILE31 30 #include <sound/driver.h> 31 #include <asm/io.h> 32 #include <asm/dma.h> 33 #include <linux/init.h> 34 #include <linux/time.h> 35 #include <sound/core.h> 32 36 #include <sound/sb.h> 33 37 #include <sound/sb16_csp.h> … … 35 39 #include <sound/control.h> 36 40 #include <sound/info.h> 41 42 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 43 MODULE_DESCRIPTION("Routines for control of 16-bit SoundBlaster cards and clones"); 44 MODULE_LICENSE("GPL"); 45 46 #define chip_t sb_t 37 47 38 48 #ifdef CONFIG_SND_SB16_CSP … … 261 271 size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream); 262 272 dma = (chip->mode & SB_MODE_PLAYBACK_8) ? chip->dma8 : chip->dma16; 263 snd_dma_program(dma, runtime->dma_area, size, DMA_MODE_WRITE | DMA_AUTOINIT);273 snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 264 274 265 275 count = snd_pcm_lib_period_bytes(substream); … … 328 338 size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream); 329 339 dma = (chip->mode & SB_MODE_CAPTURE_8) ? chip->dma8 : chip->dma16; 330 snd_dma_program(dma, runtime->dma_area, size, DMA_MODE_READ | DMA_AUTOINIT);340 snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 331 341 332 342 count = snd_pcm_lib_period_bytes(substream); … … 932 942 snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip)); 933 943 934 snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, 128*1024, GFP_KERNEL|GFP_DMA);944 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024); 935 945 936 946 if (rpcm) -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/slab.h> 25 #include <sound/core.h> 24 26 #include <sound/sb.h> 25 27 #include <sound/opl3.h> … … 28 30 #include <sound/initval.h> 29 31 32 #define chip_t sb_t 33 30 34 EXPORT_NO_SYMBOLS; 35 36 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 31 37 MODULE_DESCRIPTION("Sound Blaster 1.0/2.0/Pro"); 38 MODULE_LICENSE("GPL"); 32 39 MODULE_CLASSES("{sound}"); 33 40 MODULE_DEVICES("{{Creative Labs,SB 1.0/SB 2.0/SB Pro}}"); … … 82 89 if (acard == NULL) 83 90 return; 84 if (acard->fm_res) 91 if (acard->fm_res) { 85 92 release_resource(acard->fm_res); 93 kfree_nocheck(acard->fm_res); 94 } 86 95 } 87 96 … … 136 145 OPL3_HW_AUTO, 1, 137 146 &opl3)) < 0) { 138 snd_printk("no OPL device at 0x%lx\n", chip->port + 8);147 printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8); 139 148 } 140 149 } else { … … 142 151 OPL3_HW_AUTO, 1, 143 152 &opl3)) < 0) { 144 snd_printk("no OPL device at 0x%lx-0x%lx\n",153 printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n", 145 154 chip->port, chip->port + 2); 146 155 } … … 203 212 if (!cards) { 204 213 #ifdef MODULE 205 snd_printk("Sound Blaster soundcard not found or device busy\n");214 printk(KERN_ERR "Sound Blaster soundcard not found or device busy\n"); 206 215 #endif 207 216 return -ENODEV; … … 223 232 #ifndef MODULE 224 233 225 /* format is: snd- card-sb8=snd_enable,snd_index,snd_id,234 /* format is: snd-sb8=snd_enable,snd_index,snd_id, 226 235 snd_port,snd_irq,snd_dma8 */ 227 236 … … 242 251 } 243 252 244 __setup("snd- card-sb8=", alsa_card_sb8_setup);253 __setup("snd-sb8=", alsa_card_sb8_setup); 245 254 246 255 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8_main.c
r32 r92 19 19 * You should have received a copy of the GNU General Public License 20 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 22 * 23 23 * -- … … 31 31 */ 32 32 33 #define SNDRV_MAIN_OBJECT_FILE34 33 #include <sound/driver.h> 34 #include <asm/io.h> 35 #include <asm/dma.h> 36 #include <linux/init.h> 37 #include <linux/time.h> 38 #include <sound/core.h> 35 39 #include <sound/sb.h> 40 41 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Uros Bizjak <uros@kss-loka.si>"); 42 MODULE_DESCRIPTION("Routines for control of 8-bit SoundBlaster cards and clones"); 43 MODULE_LICENSE("GPL"); 44 45 #define chip_t sb_t 36 46 37 47 #define SB8_CLOCK 1000000 … … 172 182 snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT); 173 183 runtime->dma_area[0] = 0x80; 174 snd_dma_program(chip->dma8, runtime->dma_area, 1, DMA_MODE_WRITE);184 snd_dma_program(chip->dma8, runtime->dma_addr, 1, DMA_MODE_WRITE); 175 185 /* force interrupt */ 176 186 chip->mode = SB_MODE_HALT; … … 199 209 } 200 210 spin_unlock_irqrestore(&chip->reg_lock, flags); 201 snd_dma_program(chip->dma8, runtime->dma_area,211 snd_dma_program(chip->dma8, runtime->dma_addr, 202 212 size, DMA_MODE_WRITE | DMA_AUTOINIT); 203 213 return 0; … … 311 321 } 312 322 spin_unlock_irqrestore(&chip->reg_lock, flags); 313 snd_dma_program(chip->dma8, runtime->dma_area,323 snd_dma_program(chip->dma8, runtime->dma_addr, 314 324 size, DMA_MODE_READ | DMA_AUTOINIT); 315 325 return 0; … … 622 632 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops); 623 633 624 snd_pcm_lib_preallocate_pages_for_all(pcm, 64*1024, 64*1024, GFP_KERNEL|GFP_DMA);634 snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 64*1024); 625 635 626 636 if (rpcm) -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb_common.c
r34 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 */ 22 22 23 #define SNDRV_MAIN_OBJECT_FILE24 23 #include <sound/driver.h> 24 #include <asm/io.h> 25 #include <asm/dma.h> 26 #include <linux/delay.h> 27 #include <linux/init.h> 28 #include <linux/slab.h> 29 #include <sound/core.h> 25 30 #include <sound/sb.h> 26 31 #include <sound/initval.h> … … 28 33 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 29 34 MODULE_DESCRIPTION("ALSA lowlevel driver for Sound Blaster cards"); 35 MODULE_LICENSE("GPL"); 30 36 MODULE_CLASSES("{sound}"); 31 37 … … 172 178 if (chip->irq >= 0) 173 179 free_irq(chip->irq, (void *) chip); 180 #ifdef CONFIG_ISA 174 181 if (chip->dma8 >= 0) { 175 182 disable_dma(chip->dma8); … … 180 187 free_dma(chip->dma16); 181 188 } 182 kfree(chip); 189 #endif 190 kfree(chip); 183 191 return 0; 184 192 } … … 241 249 } 242 250 251 #ifdef CONFIG_ISA 243 252 if (dma8 >= 0 && request_dma(dma8, "SoundBlaster - 8bit")) { 244 253 snd_sbdsp_free(chip); … … 251 260 } 252 261 chip->dma16 = dma16; 262 #endif 253 263 254 264 __skip_allocation: -
GPL/branches/alsa-resync1/alsa-kernel/isa/sgalaxy.c
r32 r92 18 18 * You should have received a copy of the GNU General Public License 19 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 * 22 22 */ 23 23 24 #define SNDRV_MAIN_OBJECT_FILE25 24 #include <sound/driver.h> 25 #include <asm/dma.h> 26 #include <linux/init.h> 27 #include <linux/delay.h> 28 #include <linux/time.h> 29 #include <sound/core.h> 26 30 #include <sound/sb.h> 27 31 #include <sound/ad1848.h> … … 32 36 33 37 EXPORT_NO_SYMBOLS; 38 39 MODULE_AUTHOR("Christopher Butler <chrisb@sandy.force9.co.uk>"); 34 40 MODULE_DESCRIPTION("Aztech Sound Galaxy"); 41 MODULE_LICENSE("GPL"); 35 42 MODULE_CLASSES("{sound}"); 36 43 MODULE_DEVICES("{{Aztech Systems,Sound Galaxy}}"); … … 117 124 if ((tmp = inb(port + 3)) == 0xff) 118 125 { 119 snd_printdd("I/O address dead (0x%lx)\n", tmp);126 snd_printdd("I/O address dead (0x%lx)\n", port); 120 127 return 0; 121 128 } … … 299 306 if (!cards) { 300 307 #ifdef MODULE 301 snd_printk("Sound Galaxy soundcard not found or device busy\n");308 printk(KERN_ERR "Sound Galaxy soundcard not found or device busy\n"); 302 309 #endif 303 310 return -ENODEV; … … 320 327 #ifndef MODULE 321 328 322 /* format is: snd- card-sgalaxy=snd_enable,snd_index,snd_id,329 /* format is: snd-sgalaxy=snd_enable,snd_index,snd_id, 323 330 snd_sbport,snd_wssport, 324 331 snd_irq,snd_dma1 */ … … 341 348 } 342 349 343 __setup("snd- card-sgalaxy=", alsa_card_sgalaxy_setup);350 __setup("snd-sgalaxy=", alsa_card_sgalaxy_setup); 344 351 345 352 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/slab.h> 25 #ifndef LINUX_ISAPNP_H 26 #include <linux/isapnp.h> 27 #define isapnp_card pci_bus 28 #define isapnp_dev pci_dev 29 #endif 30 #include <sound/core.h> 24 31 #define SNDRV_GET_ID 25 32 #include <sound/initval.h> … … 30 37 31 38 EXPORT_NO_SYMBOLS; 39 MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>"); 32 40 MODULE_DESCRIPTION("Turtle Beach Wavefront"); 41 MODULE_LICENSE("GPL"); 33 42 MODULE_CLASSES("{sound}"); 34 43 MODULE_DEVICES("{{Turtle Beach,Maui/Tropez/Tropez+}}"); … … 45 54 static int snd_ics2115_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,9,11,12,15 */ 46 55 static long snd_fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 47 static long snd_control_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */48 static long snd_wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */49 56 static int snd_dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 50 57 static int snd_dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 51 52 MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>"); 58 static int snd_use_cs4232_midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 59 53 60 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 54 61 MODULE_PARM_SYNTAX(snd_index, "Index value for WaveFront soundcard."); … … 91 98 MODULE_PARM_DESC(snd_fm_port, "FM port #."); 92 99 MODULE_PARM_SYNTAX(snd_fm_port, SNDRV_PORT12_DESC); 93 MODULE_PARM(snd_ wss_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");94 MODULE_PARM_DESC(snd_ wss_port, "Windows Sound System port #.");95 MODULE_PARM_SYNTAX(snd_ wss_port, SNDRV_PORT12_DESC);100 MODULE_PARM(snd_use_cs4232_midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 101 MODULE_PARM_DESC(snd_use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)"); 102 MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED ",allows use of CS4323 MPU-401 interface"); 96 103 97 104 static snd_card_t *snd_wavefront_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; … … 132 139 /* Check for each logical device. */ 133 140 134 /* "windows sound system" has id0 */141 /* CS4232 chip (aka "windows sound system") is logical device 0 */ 135 142 136 143 acard->wss = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL); … … 140 147 } 141 148 142 /* control interface has id 1 */ 143 144 acard->ctrl = isapnp_find_dev(card, id->devs[1].vendor, id->devs[1].function, NULL); 145 if (acard->ctrl->active) { 146 acard->wss = acard->ctrl = NULL; 147 return -EBUSY; 148 } 149 150 /* synth has id 3 */ 149 /* there is a game port at logical device 1, but we ignore it completely */ 150 151 /* the control interface is logical device 2, but we ignore it 152 completely. in fact, nobody even seems to know what it 153 does. 154 */ 155 156 /* Only configure the CS4232 MIDI interface if its been 157 specifically requested. It is logical device 3. 158 */ 159 160 if (snd_use_cs4232_midi[dev]) { 161 acard->mpu = isapnp_find_dev(card, id->devs[2].vendor, id->devs[2].function, NULL); 162 if (acard->mpu->active) { 163 acard->wss = acard->synth = acard->mpu = NULL; 164 return -EBUSY; 165 } 166 } 167 168 /* The ICS2115 synth is logical device 4 */ 151 169 152 170 acard->synth = isapnp_find_dev(card, id->devs[3].vendor, id->devs[3].function, NULL); 153 171 if (acard->synth->active) { 154 acard->wss = acard-> ctrl = acard->synth = NULL;172 acard->wss = acard->synth = NULL; 155 173 return -EBUSY; 156 }157 158 /* Only configure the CS4232 MIDI interface is its been159 requested. It has id 2.160 */161 162 if (snd_cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {163 acard->mpu = isapnp_find_dev(card, id->devs[2].vendor, id->devs[2].function, NULL);164 if (acard->mpu->active) {165 acard->wss = acard->ctrl = acard->synth = acard->mpu = NULL;166 return -EBUSY;167 }168 174 } 169 175 … … 174 180 if ((tmp = pdev->prepare (pdev)) < 0) { 175 181 if (tmp == -EBUSY) { 176 snd_printk ("ISA PnP configuration appears to have been"177 " done. Restart the isa-pnp module.\n");182 snd_printk ("ISA PnP configuration appears to have " 183 "been done. Restart the isapnp module.\n"); 178 184 return 0; 179 185 } 180 181 186 snd_printk ("isapnp WSS preparation failed\n"); 182 187 return -EAGAIN; 183 188 } 189 190 /* An interesting note from the Tropez+ FAQ: 191 192 Q. [Ports] Why is the base address of the WSS I/O ports off by 4? 193 194 A. WSS I/O requires a block of 8 I/O addresses ("ports"). Of these, the first 195 4 are used to identify and configure the board. With the advent of PnP, 196 these first 4 addresses have become obsolete, and software applications 197 only use the last 4 addresses to control the codec chip. Therefore, the 198 base address setting "skips past" the 4 unused addresses. 199 200 */ 184 201 185 202 if (snd_cs4232_pcm_port[dev] != SNDRV_AUTO_PORT) … … 187 204 if (snd_fm_port[dev] != SNDRV_AUTO_PORT) 188 205 isapnp_resource_change(&pdev->resource[1], snd_fm_port[dev], 4); 189 if (snd_wss_port[dev] != SNDRV_AUTO_PORT)190 isapnp_resource_change(&pdev->resource[2], snd_wss_port[dev], 4);191 192 if (snd_ics2115_port[dev] != SNDRV_AUTO_PORT)193 isapnp_resource_change(&pdev->resource[3], snd_ics2115_port[dev], 8);194 if (snd_ics2115_irq[dev] != SNDRV_AUTO_IRQ)195 isapnp_resource_change(&pdev->irq_resource[3], snd_ics2115_irq[dev], 1);196 197 206 if (snd_dma1[dev] != SNDRV_AUTO_DMA) 198 207 isapnp_resource_change(&pdev->dma_resource[0], snd_dma1[dev], 1); 199 208 if (snd_dma2[dev] != SNDRV_AUTO_DMA) 200 209 isapnp_resource_change(&pdev->dma_resource[1], snd_dma2[dev], 1); 201 202 210 if (snd_cs4232_pcm_irq[dev] != SNDRV_AUTO_IRQ) 203 211 isapnp_resource_change(&pdev->irq_resource[0], snd_cs4232_pcm_irq[dev], 1); … … 210 218 snd_cs4232_pcm_port[dev] = pdev->resource[0].start; 211 219 snd_fm_port[dev] = pdev->resource[1].start; 212 snd_wss_port[dev] = pdev->resource[2].start;213 214 snd_ics2115_port[dev] = pdev->resource[3].start;215 snd_ics2115_irq[dev] = pdev->irq_resource[3].start;216 217 220 snd_dma1[dev] = pdev->dma_resource[0].start; 218 snd_dma2[dev] = pdev->dma_resource[1].start == 4 ? -1 : pdev->dma_resource[1].start; 219 221 snd_dma2[dev] = pdev->dma_resource[1].start; 220 222 snd_cs4232_pcm_irq[dev] = pdev->irq_resource[0].start; 221 223 222 snd_printk ("CS4232: port=0x%lx, fm port=0x%lx, wss port=0x%lx\n" 223 "CS4232: dma1=%i, dma2=%i, irq=%i\n" 224 "ICS2115: port=0x%lx, irq=%i\n", 225 snd_cs4232_pcm_port[dev], snd_fm_port[dev], snd_wss_port[dev], 226 snd_dma1[dev], snd_dma2[dev], snd_cs4232_pcm_irq[dev], 227 snd_ics2115_port[dev], 228 snd_ics2115_irq[dev]); 229 230 /* CTRL initialization */ 231 232 if (snd_control_port[dev] != SNDRV_AUTO_PORT) { 233 234 pdev = acard->ctrl; 235 236 if (pdev->prepare(pdev)<0) { 224 /* Synth initialization */ 225 226 pdev = acard->synth; 227 228 if ((tmp = pdev->prepare(pdev))<0) { 229 if (tmp == -EBUSY) { 230 snd_printk ("ISA PnP configuration appears to have " 231 "been done. Restart the isapnp module.\n"); 232 } 237 233 acard->wss->deactivate(acard->wss); 238 snd_printk ("isapnp CTRL preparation failed\n");239 return -EAGAIN;240 }241 242 if (snd_control_port[dev] != SNDRV_AUTO_PORT)243 isapnp_resource_change(&pdev->resource[0], snd_control_port[dev], 8);244 245 if (pdev->activate(pdev)<0) {246 snd_printk("isapnp CTRL activation failed\n");247 acard->wss->deactivate(acard->wss);248 return -EBUSY;249 }250 251 snd_control_port[dev] = pdev->resource[0].start;252 snd_printk ("isapnp CTRL: control port=0x%lx\n",253 snd_control_port[dev]);254 }255 256 /* Synth initialization */257 258 if (snd_ics2115_port[dev] != SNDRV_AUTO_PORT) {259 260 pdev = acard->synth;261 262 if (pdev->prepare(pdev)<0) {263 acard->wss->deactivate(acard->wss);264 if (acard->ctrl)265 acard->ctrl->deactivate(acard->ctrl);266 234 snd_printk ("ICS2115 synth preparation failed\n"); 267 235 return -EAGAIN; 268 236 } 237 if (snd_ics2115_port[dev] != SNDRV_AUTO_PORT) { 238 isapnp_resource_change(&pdev->resource[0], snd_ics2115_port[dev], 16); 239 } 269 240 270 isapnp_resource_change(&pdev->resource[0], snd_ics2115_port[dev], 8); 271 if (snd_ics2115_irq[dev] != SNDRV_AUTO_IRQ) 241 if (snd_ics2115_port[dev] != SNDRV_AUTO_IRQ) { 272 242 isapnp_resource_change(&pdev->irq_resource[0], snd_ics2115_irq[dev], 1); 243 } 273 244 274 245 if (pdev->activate(pdev)<0) { 275 snd_printk("synth configurationfailed\n");246 snd_printk("isapnp activation for ICS2115 failed\n"); 276 247 acard->wss->deactivate(acard->wss); 277 if (acard->ctrl)278 acard->ctrl->deactivate(acard->ctrl);279 248 return -EBUSY; 280 249 } … … 282 251 snd_ics2115_port[dev] = pdev->resource[0].start; 283 252 snd_ics2115_irq[dev] = pdev->irq_resource[0].start; 284 }285 253 286 254 /* CS4232 MPU initialization. Configure this only if … … 289 257 */ 290 258 291 if (snd_ cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {259 if (snd_use_cs4232_midi[dev]) { 292 260 293 261 pdev = acard->mpu; … … 295 263 if (pdev->prepare(pdev)<0) { 296 264 acard->wss->deactivate(acard->wss); 297 if (acard->ctrl)298 acard->ctrl->deactivate(acard->ctrl);299 265 if (acard->synth) 300 266 acard->synth->deactivate(acard->synth); … … 320 286 snd_cs4232_mpu_irq[dev]); 321 287 } 288 289 snd_printdd ("CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n", 290 snd_cs4232_pcm_port[dev], 291 snd_fm_port[dev], 292 snd_dma1[dev], 293 snd_dma2[dev], 294 snd_cs4232_pcm_irq[dev], 295 snd_ics2115_port[dev], 296 snd_ics2115_irq[dev]); 322 297 323 298 return 0; … … 469 444 snd_wavefront_deactivate(acard); 470 445 #endif 471 if (acard->wavefront.res_base != NULL) 446 if (acard->wavefront.res_base != NULL) { 472 447 release_resource(acard->wavefront.res_base); 448 kfree_nocheck(acard->wavefront.res_base); 449 } 473 450 if (acard->wavefront.irq > 0) 474 451 free_irq(acard->wavefront.irq, (void *)acard); … … 526 503 #ifdef __ISAPNP__ 527 504 if (snd_isapnp[dev] && snd_wavefront_isapnp (dev, acard) < 0) { 528 if (snd_cs4232_pcm_port[dev] == SNDRV_AUTO_PORT || 529 snd_control_port[dev] == SNDRV_AUTO_PORT) { 505 if (snd_cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { 530 506 snd_printk ("isapnp detection failed\n"); 531 507 snd_card_free (card); … … 539 515 if ((err = snd_cs4231_create (card, 540 516 snd_cs4232_pcm_port[dev], 541 snd_control_port[dev],517 -1, 542 518 snd_cs4232_pcm_irq[dev], 543 519 snd_dma1[dev], … … 765 741 if (!cards) { 766 742 #ifdef MODULE 767 snd_printk ("Nocards found or devices busy\n");743 printk (KERN_ERR "No WaveFront cards found or devices busy\n"); 768 744 #endif 769 745 return -ENODEV; … … 785 761 #ifndef MODULE 786 762 787 /* format is: snd- card-wavefront=snd_enable,snd_index,snd_id,snd_isapnp,763 /* format is: snd-wavefront=snd_enable,snd_index,snd_id,snd_isapnp, 788 764 snd_cs4232_pcm_port,snd_cs4232_pcm_irq, 789 765 snd_cs4232_mpu_port,snd_cs4232_mpu_irq, 790 766 snd_ics2115_port,snd_ics2115_irq, 791 snd_fm_port,snd_control_port,snd_wss_port, 792 snd_dma1,snd_dma2 */ 767 snd_fm_port, 768 snd_dma1,snd_dma2, 769 snd_use_cs4232_midi */ 793 770 794 771 static int __init alsa_card_wavefront_setup(char *str) … … 809 786 get_option(&str,&snd_ics2115_irq[nr_dev]) == 2 && 810 787 get_option(&str,(int *)&snd_fm_port[nr_dev]) == 2 && 811 get_option(&str,(int *)&snd_control_port[nr_dev]) == 2 &&812 get_option(&str,(int *)&snd_wss_port[nr_dev]) == 2 &&813 788 get_option(&str,&snd_dma1[nr_dev]) == 2 && 814 get_option(&str,&snd_dma2[nr_dev]) == 2); 789 get_option(&str,&snd_dma2[nr_dev]) == 2 && 790 get_option(&str,&snd_use_cs4232_midi[nr_dev]) == 2); 815 791 nr_dev++; 816 792 return 1; 817 793 } 818 794 819 __setup("snd- card-wavefront=", alsa_card_wavefront_setup);795 __setup("snd-wavefront=", alsa_card_wavefront_setup); 820 796 821 797 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/ali5451/ali5451.c
r34 r92 27 27 28 28 #define __SNDRV_OSS_COMPAT__ 29 #define SNDRV_MAIN_OBJECT_FILE 30 31 #include "sound/driver.h" 32 #include "sound/pcm.h" 33 #include "sound/info.h" 34 #include "sound/ac97_codec.h" 35 #include "sound/mpu401.h" 29 30 #include <sound/driver.h> 31 #include <asm/io.h> 32 #include <linux/delay.h> 33 #include <linux/interrupt.h> 34 #include <linux/init.h> 35 #include <linux/slab.h> 36 #include <sound/core.h> 37 #include <sound/pcm.h> 38 #include <sound/info.h> 39 #include <sound/ac97_codec.h> 40 #include <sound/mpu401.h> 36 41 #define SNDRV_GET_ID 37 #include "sound/initval.h"42 #include <sound/initval.h> 38 43 39 44 MODULE_AUTHOR("Matt Wu <Matt_Wu@acersoftech.com.cn>"); … … 2323 2328 if ((err = pci_module_init(&driver)) < 0) { 2324 2329 #ifdef MODULE 2325 // snd_printk("ALi pci audio not found or device busy.\n");2330 // snd_printk(KERN_ERR "ALi pci audio not found or device busy.\n"); 2326 2331 #endif 2327 2332 return err; -
GPL/branches/alsa-resync1/alsa-kernel/pci/als4000.c
r34 r92 731 731 &chip->rmidi)) < 0) { 732 732 snd_card_free(card); 733 snd_printk("no MPU-401device at 0x%lx ?\n", gcr+0x30);733 printk(KERN_ERR "als4000: no MPU-401device at 0x%lx ?\n", gcr+0x30); 734 734 return err; 735 735 } … … 746 746 if (snd_opl3_create(card, gcr+0x10, gcr+0x12, 747 747 OPL3_HW_AUTO, 1, &opl3) < 0) { 748 snd_printk("no OPL device at 0x%lx-0x%lx ?\n",748 printk(KERN_ERR "als4000: no OPL device at 0x%lx-0x%lx ?\n", 749 749 gcr+0x10, gcr+0x12 ); 750 750 } else { … … 797 797 if ((err = pci_module_init(&driver)) < 0) { 798 798 #ifdef MODULE 799 // snd_printk("no ALS4000 based soundcards found or device busy\n");799 // snd_printk(KERN_ERR "no ALS4000 based soundcards found or device busy\n"); 800 800 #endif 801 801 return err; -
GPL/branches/alsa-resync1/alsa-kernel/pci/emu10k1/emu10k1_main.c
r84 r92 39 39 #include <sound/core.h> 40 40 #include <sound/emu10k1.h> 41 #include < sound/firmware.h>41 #include <linux/firmware.h> 42 42 #include "p16v.h" 43 43 #include "tina2.h" … … 597 597 return 0; 598 598 } 599 599 600 600 601 static int snd_emu1010_load_firmware(struct snd_emu10k1 * emu, const char * filename) … … 1020 1021 return 0; 1021 1022 } 1022 1023 1023 1024 1024 /* -
GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c
r77 r92 1606 1606 es->substream = substream; 1607 1607 es->mode = ESM_MODE_PLAY; 1608 INIT_LIST_HEAD(&es->list); 1608 1609 1609 1610 runtime->private_data = es; … … 1657 1658 es->substream = substream; 1658 1659 es->mode = ESM_MODE_CAPTURE; 1660 INIT_LIST_HEAD(&es->list); 1659 1661 1660 1662 /* get mixbuffer */ … … 1717 1719 return 0; 1718 1720 } 1721 1719 1722 static snd_pcm_ops_t snd_es1968_playback_ops = { 1720 1723 /* open: */ snd_es1968_playback_open, … … 2005 2008 2006 2009 if (event & ESM_SOUND_IRQ) { 2007 struct list_head *p;2010 struct list_head *p, *n; 2008 2011 spin_lock(&chip->substream_lock); 2009 list_for_each(p, &chip->substream_list) { 2012 /* we need to use list_for_each_safe here since the substream 2013 * can be deleted in period_elapsed(). 2014 */ 2015 list_for_each_safe(p, n, &chip->substream_list) { 2010 2016 esschan_t *es = list_entry(p, esschan_t, list); 2011 2017 if (es->running) … … 2841 2847 if ((err = pci_module_init(&driver)) < 0) { 2842 2848 #ifdef MODULE 2843 // snd_printk("ESS Maestro soundcard not found or device busy\n");2849 // snd_printk(KERN_ERR "ESS Maestro soundcard not found or device busy\n"); 2844 2850 #endif 2845 2851 return err; -
GPL/branches/alsa-resync1/alsa-kernel/pci/hda/patch_analog.c
r88 r92 2619 2619 if (is_rev2(codec)) 2620 2620 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); 2621 2621 //paul 2622 snd_printk(KERN_INFO "patch_analog: Vendor Id: 0x%x\n", codec->vendor_id); 2623 snd_printk(KERN_INFO "patch_analog: Subsystem Id: 0x%x\n", codec->subsystem_id); 2624 snd_printk(KERN_INFO "patch_analog: Revision Id: 0x%x\n", codec->revision_id); 2625 snd_printk(KERN_INFO "patch_analog: Model Name: %s\n", codec->bus->modelname); 2626 //endpaul 2622 2627 board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, 2623 2628 ad1988_models, NULL); … … 2638 2643 } 2639 2644 } 2640 2645 //paul 2646 snd_printk(KERN_INFO "patch_analog: board_config: %d\n", board_config); 2647 board_config = AD1988_3STACK_DIG; 2648 snd_printk(KERN_INFO "patch_analog: kludged board_config: %d\n", board_config); 2649 //endpaul 2641 2650 switch (board_config) { 2642 2651 case AD1988_6STACK: -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712.c
r32 r92 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 */ … … 22 22 /* 23 23 NOTES: 24 - spdif nonaudio consumer mode does not work (at least with my 24 - spdif nonaudio consumer mode does not work (at least with my 25 25 Sony STR-DB830) 26 26 */ 27 27 28 #define SNDRV_MAIN_OBJECT_FILE29 30 28 #include <sound/driver.h> 29 #include <asm/io.h> 30 #include <linux/delay.h> 31 #include <linux/interrupt.h> 32 #include <linux/init.h> 33 #include <linux/slab.h> 34 #include <sound/core.h> 31 35 #include <sound/control.h> 32 36 #include <sound/pcm.h> 33 37 #include <sound/ac97_codec.h> 34 38 #include <sound/mpu401.h> 39 #include <sound/i2c.h> 40 #include <sound/cs8427.h> 35 41 #include <sound/info.h> 36 42 #define SNDRV_GET_ID 37 43 #include <sound/initval.h> 38 44 45 #include <sound/asoundef.h> 46 47 #define SND_CS8403 48 #define SND_CS8404 49 #include <sound/cs8403.h> 50 39 51 EXPORT_NO_SYMBOLS; 52 53 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 40 54 MODULE_DESCRIPTION("ICEnsemble ICE1712 (Envy24)"); 55 MODULE_LICENSE("GPL"); 41 56 MODULE_CLASSES("{sound}"); 42 57 MODULE_DEVICES("{{Hoontech SoundTrack DSP 24}," … … 49 64 "{TerraTec,EWS 88MT}," 50 65 "{TerraTec,EWS 88D}," 66 "{TerraTec,DMX 6Fire}," 51 67 "{ICEnsemble,Generic ICE1712}," 52 68 "{ICEnsemble,Generic Envy24}}"); 53 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");54 69 55 70 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56 71 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 72 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 73 static int snd_omni[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 0}; /* Delta44 & 66 Omni I/O support */ 58 74 59 75 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); … … 66 82 MODULE_PARM_DESC(snd_enable, "Enable ICE1712 soundcard."); 67 83 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC); 84 MODULE_PARM(snd_omni, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 85 MODULE_PARM_DESC(snd_omni, "Enable Midiman M-Audio Delta Omni I/O support."); 86 MODULE_PARM_SYNTAX(snd_omni, SNDRV_ENABLED "," SNDRV_ENABLE_DESC); 68 87 69 88 #ifndef PCI_VENDOR_ID_ICE … … 83 102 #define ICE1712_SUBDEVICE_EWS88MT 0x3b151511 84 103 #define ICE1712_SUBDEVICE_EWS88D 0x3b152b11 104 #define ICE1712_SUBDEVICE_DMX6FIRE 0x3b153811 85 105 86 106 /* … … 256 276 #define ICE1712_CFG_SPDIF_OUT 0x01 /* S/PDIF output is present */ 257 277 258 /* MidiMan Delta GPIO definitions */ 259 260 #define ICE1712_DELTA_DFS 0x01 /* fast/slow sample rate mode */ 278 /* 279 * MidiMan M-Audio Delta GPIO definitions 280 */ 281 282 /* MidiMan M-Audio Delta1010 */ 283 #define ICE1712_DELTA_DFS 0x01 /* fast/slow sample rate mode */ 261 284 /* (>48kHz must be 1) */ 262 /* all cards */263 285 #define ICE1712_DELTA_SPDIF_IN_STAT 0x02 264 286 /* S/PDIF input status */ … … 275 297 /* all except Delta44 */ 276 298 /* look to CS8404A datasheet */ 299 /* MidiMan M-Audio DeltaDiO */ 300 /* 0x01 = DFS */ 301 /* 0x02 = SPDIF_IN_STAT */ 302 /* 0x04 = SPDIF_OUT_STAT_CLOCK */ 303 /* 0x08 = SPDIF_OUT_STAT_DATA */ 277 304 #define ICE1712_DELTA_SPDIF_INPUT_SELECT 0x10 278 305 /* coaxial (0), optical (1) */ 279 306 /* S/PDIF input select*/ 280 /* DeltaDiO only */ 307 308 /* MidiMan M-Audio Delta1010 */ 309 /* 0x01 = DFS */ 310 /* 0x02 = SPDIF_IN_STAT */ 311 /* 0x04 = SPDIF_OUT_STAT_CLOCK */ 312 /* 0x08 = SPDIF_OUT_STAT_DATA */ 281 313 #define ICE1712_DELTA_WORD_CLOCK_SELECT 0x10 282 314 /* 1 - clock are taken from S/PDIF input */ 283 315 /* 0 - clock are taken from Word Clock input */ 284 /* Delta1010 only (affected SPMCLKIN pin of Envy24) */ 316 /* affected SPMCLKIN pin of Envy24 */ 317 #define ICE1712_DELTA_WORD_CLOCK_STATUS 0x20 318 /* 0 = valid word clock signal is present */ 319 320 /* MidiMan M-Audio Delta66 */ 321 /* 0x01 = DFS */ 322 /* 0x02 = SPDIF_IN_STAT */ 323 /* 0x04 = SPDIF_OUT_STAT_CLOCK */ 324 /* 0x08 = SPDIF_OUT_STAT_DATA */ 285 325 #define ICE1712_DELTA_CODEC_SERIAL_DATA 0x10 286 326 /* AKM4524 serial data */ 287 /* Delta66 and Delta44 */288 #define ICE1712_DELTA_WORD_CLOCK_STATUS 0x20289 /* 0 = valid word clock signal is present */290 /* Delta1010 only */291 327 #define ICE1712_DELTA_CODEC_SERIAL_CLOCK 0x20 292 328 /* AKM4524 serial clock */ 293 329 /* (writting on rising edge - 0->1 */ 294 /* Delta66 and Delta44 */295 330 #define ICE1712_DELTA_CODEC_CHIP_A 0x40 296 331 #define ICE1712_DELTA_CODEC_CHIP_B 0x80 297 332 /* 1 - select chip A or B */ 298 /* Delta66 and Delta44 */ 299 300 /* M-Audio Audiophile definitions */ 333 334 /* MidiMan M-Audio Delta44 */ 301 335 /* 0x01 = DFS */ 302 #define ICE1712_DELTA_AP_CCLK 0x02 /* AudioPhile only */ 303 /* SPI clock */ 336 /* 0x10 = CODEC_SERIAL_DATA */ 337 /* 0x20 = CODEC_SERIAL_CLOCK */ 338 /* 0x40 = CODEC_CHIP_A */ 339 /* 0x80 = CODEC_CHIP_B */ 340 341 /* MidiMan M-Audio Audiophile definitions */ 342 /* 0x01 = DFS */ 343 #define ICE1712_DELTA_AP_CCLK 0x02 /* SPI clock */ 304 344 /* (clocking on rising edge - 0->1) */ 305 #define ICE1712_DELTA_AP_DIN 0x04 /* AudioPhile only -data input */306 #define ICE1712_DELTA_AP_DOUT 0x08 /* AudioPhile only -data output */307 #define ICE1712_DELTA_AP_CS_DIGITAL 0x10 /* AudioPhile only -CS8427 chip select */345 #define ICE1712_DELTA_AP_DIN 0x04 /* data input */ 346 #define ICE1712_DELTA_AP_DOUT 0x08 /* data output */ 347 #define ICE1712_DELTA_AP_CS_DIGITAL 0x10 /* CS8427 chip select */ 308 348 /* low signal = select */ 309 #define ICE1712_DELTA_AP_CS_CODEC 0x20 /* A udioPhile only - AK4528 chip select */349 #define ICE1712_DELTA_AP_CS_CODEC 0x20 /* AK4528 chip select */ 310 350 /* low signal = select */ 311 351 … … 353 393 /* TerraTec EWS 88MT/D configuration definitions */ 354 394 /* RW, SDA snd SCLK are identical with EWX24/96 */ 355 356 395 #define ICE1712_EWS88_CS8414_RATE 0x07 /* CS8414 sample rate: gpio 0-2 */ 357 396 #define ICE1712_EWS88_RW 0x08 /* read/write switch for i2c; high = write */ … … 362 401 363 402 /* i2c address */ 364 #define ICE1712_EWS88MT_CS8404_ADDR 0x40365 #define ICE1712_EWS88MT_INPUT_ADDR 0x46366 #define ICE1712_EWS88MT_OUTPUT_ADDR 0x48403 #define ICE1712_EWS88MT_CS8404_ADDR (0x40>>1) 404 #define ICE1712_EWS88MT_INPUT_ADDR (0x46>>1) 405 #define ICE1712_EWS88MT_OUTPUT_ADDR (0x48>>1) 367 406 #define ICE1712_EWS88MT_OUTPUT_SENSE 0x40 /* mask */ 368 #define ICE1712_EWS88D_PCF_ADDR 0x40 407 #define ICE1712_EWS88D_PCF_ADDR (0x40>>1) 408 409 /* TerraTec DMX 6Fire configuration definitions */ 410 #define ICE1712_6FIRE_AK4524_CS_MASK 0x07 /* AK4524 chip select #1-#3 */ 411 #define ICE1712_6FIRE_RW 0x08 /* read/write switch for i2c; high = write */ 412 #define ICE1712_6FIRE_SERIAL_DATA 0x10 /* i2c & ak4524 data */ 413 #define ICE1712_6FIRE_SERIAL_CLOCK 0x20 /* i2c & ak4524 clock */ 414 #define ICE1712_6FIRE_TX2 0x40 /* MIDI2 */ 415 #define ICE1712_6FIRE_RX2 0x80 /* MIDI2 */ 416 417 #define ICE1712_6FIRE_CS8427_ADDR (0x22>>1) /* ?? */ 369 418 370 419 /* … … 381 430 382 431 typedef struct _snd_ice1712 ice1712_t; 383 384 typedef struct {385 void (*write)(ice1712_t *ice, unsigned char reg, unsigned char data);386 unsigned char (*read)(ice1712_t *ice, unsigned char reg);387 void (*write_bytes)(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data);388 void (*read_bytes)(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data);389 } ice1712_cs8427_ops_t;390 432 391 433 typedef struct { … … 453 495 454 496 unsigned int pro_volumes[20]; 455 int num_adcs; 456 int num_dacs; 497 int ak4528: 1, /* AK4524 or AK4528 */ 498 omni: 1; /* Delta Omni I/O */ 499 int num_adcs; /* AK4524 or AK4528 ADCs */ 500 int num_dacs; /* AK4524 or AK4528 DACs */ 501 int num_total_dacs; /* total DACs */ 457 502 unsigned char ak4524_images[4][8]; 503 unsigned char ak4524_ipga_gain[4][2]; 458 504 unsigned char hoontech_boxbits[4]; 459 505 unsigned int hoontech_config; 460 506 unsigned short hoontech_boxconfig[4]; 461 507 508 snd_i2c_bus_t *i2c; /* I2C bus */ 509 snd_i2c_device_t *cs8404; /* CS8404A I2C device */ 510 snd_i2c_device_t *cs8427; /* CS8427 I2C device */ 511 snd_i2c_device_t *pcf8574[2]; /* PCF8574 Output/Input (EWS88MT) */ 512 snd_i2c_device_t *pcf8575; /* PCF8575 (EWS88D) */ 513 462 514 unsigned char cs8403_spdif_bits; 463 515 unsigned char cs8403_spdif_stream_bits; 464 516 snd_kcontrol_t *spdif_stream_ctl; 465 466 unsigned char cs8427_spdif_status[5];467 unsigned char cs8427_spdif_stream_status[5];468 ice1712_cs8427_ops_t *cs8427_ops;469 517 470 518 unsigned char gpio_direction, gpio_write_mask; … … 651 699 } 652 700 653 static snd_kcontrol_new_t snd_ice1712_mixer_digmix_route_ac97 = {701 static snd_kcontrol_new_t snd_ice1712_mixer_digmix_route_ac97 __devinitdata = { 654 702 #ifdef TARGET_OS2 655 703 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 670 718 /* 671 719 */ 720 672 721 static void snd_ice1712_delta_cs8403_spdif_write(ice1712_t *ice, unsigned char bits) 673 722 { … … 694 743 } 695 744 696 static void snd_ice1712_decode_cs8403_spdif_bits(snd_aes_iec958_t *diga,697 unsigned char bits)698 {699 if (bits & 0x01) { /* consumer */700 if (!(bits & 0x02))701 diga->status[0] |= IEC958_AES0_NONAUDIO;702 if (!(bits & 0x08))703 diga->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT;704 switch (bits & 0x10) {705 case 0x10: diga->status[0] |= IEC958_AES0_CON_EMPHASIS_NONE; break;706 case 0x00: diga->status[0] |= IEC958_AES0_CON_EMPHASIS_5015; break;707 }708 if (!(bits & 0x80))709 diga->status[1] |= IEC958_AES1_CON_ORIGINAL;710 switch (bits & 0x60) {711 case 0x00: diga->status[1] |= IEC958_AES1_CON_MAGNETIC_ID; break;712 case 0x20: diga->status[1] |= IEC958_AES1_CON_DIGDIGCONV_ID; break;713 case 0x40: diga->status[1] |= IEC958_AES1_CON_LASEROPT_ID; break;714 case 0x60: diga->status[1] |= IEC958_AES1_CON_GENERAL; break;715 }716 switch (bits & 0x06) {717 case 0x00: diga->status[3] |= IEC958_AES3_CON_FS_44100; break;718 case 0x02: diga->status[3] |= IEC958_AES3_CON_FS_48000; break;719 case 0x04: diga->status[3] |= IEC958_AES3_CON_FS_32000; break;720 }721 } else {722 diga->status[0] = IEC958_AES0_PROFESSIONAL;723 switch (bits & 0x18) {724 case 0x00: diga->status[0] |= IEC958_AES0_PRO_FS_32000; break;725 case 0x10: diga->status[0] |= IEC958_AES0_PRO_FS_44100; break;726 case 0x08: diga->status[0] |= IEC958_AES0_PRO_FS_48000; break;727 case 0x18: diga->status[0] |= IEC958_AES0_PRO_FS_NOTID; break;728 }729 switch (bits & 0x60) {730 case 0x20: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE; break;731 case 0x40: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; break;732 case 0x00: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT; break;733 case 0x60: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NOTID; break;734 }735 if (bits & 0x80)736 diga->status[1] |= IEC958_AES1_PRO_MODE_STEREOPHONIC;737 }738 }739 740 static unsigned char snd_ice1712_encode_cs8403_spdif_bits(snd_aes_iec958_t *diga)741 {742 unsigned char bits;743 744 if (!(diga->status[0] & IEC958_AES0_PROFESSIONAL)) {745 bits = 0x01; /* consumer mode */746 if (diga->status[0] & IEC958_AES0_NONAUDIO)747 bits &= ~0x02;748 else749 bits |= 0x02;750 if (diga->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT)751 bits &= ~0x08;752 else753 bits |= 0x08;754 switch (diga->status[0] & IEC958_AES0_CON_EMPHASIS) {755 default:756 case IEC958_AES0_CON_EMPHASIS_NONE: bits |= 0x10; break;757 case IEC958_AES0_CON_EMPHASIS_5015: bits |= 0x00; break;758 }759 if (diga->status[1] & IEC958_AES1_CON_ORIGINAL)760 bits &= ~0x80;761 else762 bits |= 0x80;763 if ((diga->status[1] & IEC958_AES1_CON_CATEGORY) == IEC958_AES1_CON_GENERAL)764 bits |= 0x60;765 else {766 switch(diga->status[1] & IEC958_AES1_CON_MAGNETIC_MASK) {767 case IEC958_AES1_CON_MAGNETIC_ID:768 bits |= 0x00; break;769 case IEC958_AES1_CON_DIGDIGCONV_ID:770 bits |= 0x20; break;771 default:772 case IEC958_AES1_CON_LASEROPT_ID:773 bits |= 0x40; break;774 }775 }776 switch (diga->status[3] & IEC958_AES3_CON_FS) {777 default:778 case IEC958_AES3_CON_FS_44100: bits |= 0x00; break;779 case IEC958_AES3_CON_FS_48000: bits |= 0x02; break;780 case IEC958_AES3_CON_FS_32000: bits |= 0x04; break;781 }782 } else {783 bits = 0x00; /* professional mode */784 if (diga->status[0] & IEC958_AES0_NONAUDIO)785 bits &= ~0x02;786 else787 bits |= 0x02;788 /* CHECKME: I'm not sure about the bit order in val here */789 switch (diga->status[0] & IEC958_AES0_PRO_FS) {790 case IEC958_AES0_PRO_FS_32000: bits |= 0x00; break;791 case IEC958_AES0_PRO_FS_44100: bits |= 0x10; break; /* 44.1kHz */792 case IEC958_AES0_PRO_FS_48000: bits |= 0x08; break; /* 48kHz */793 default:794 case IEC958_AES0_PRO_FS_NOTID: bits |= 0x18; break;795 }796 switch (diga->status[0] & IEC958_AES0_PRO_EMPHASIS) {797 case IEC958_AES0_PRO_EMPHASIS_NONE: bits |= 0x20; break;798 case IEC958_AES0_PRO_EMPHASIS_5015: bits |= 0x40; break;799 case IEC958_AES0_PRO_EMPHASIS_CCITT: bits |= 0x00; break;800 default:801 case IEC958_AES0_PRO_EMPHASIS_NOTID: bits |= 0x60; break;802 }803 switch (diga->status[1] & IEC958_AES1_PRO_MODE) {804 case IEC958_AES1_PRO_MODE_TWO:805 case IEC958_AES1_PRO_MODE_STEREOPHONIC: bits |= 0x00; break;806 default: bits |= 0x80; break;807 }808 }809 return bits;810 }811 812 745 813 746 /* … … 841 774 842 775 /* 843 * CS8427 via SPI mode (for Audiophile) 776 * CS8427 via SPI mode (for Audiophile), emulated I2C 844 777 */ 845 778 … … 899 832 } 900 833 901 /* write a register */ 902 static void snd_ice1712_ap_cs8427_write(ice1712_t *ice, unsigned char reg, unsigned char data) 903 { 834 /* sequential write */ 835 static int ap_cs8427_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 836 { 837 ice1712_t *ice = snd_magic_cast(ice1712_t, device->bus->private_data, return -EIO); 838 int res = count; 904 839 unsigned char tmp; 840 905 841 down(&ice->gpio_mutex); 906 842 tmp = ap_cs8427_codec_select(ice); 907 ap_cs8427_write_byte(ice, 0x20, tmp); /* address + write mode */908 ap_cs8427_write_byte(ice, reg, tmp);909 ap_cs8427_write_byte(ice, data, tmp);843 ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */ 844 while (count-- > 0) 845 ap_cs8427_write_byte(ice, *bytes++, tmp); 910 846 ap_cs8427_codec_deassert(ice, tmp); 911 847 up(&ice->gpio_mutex); 912 } 913 914 /* read a register */ 915 static unsigned char snd_ice1712_ap_cs8427_read(ice1712_t *ice, unsigned char reg) 916 { 917 unsigned char tmp, data; 848 return res; 849 } 850 851 /* sequential read */ 852 static int ap_cs8427_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) 853 { 854 ice1712_t *ice = snd_magic_cast(ice1712_t, device->bus->private_data, return -EIO); 855 int res = count; 856 unsigned char tmp; 918 857 919 858 down(&ice->gpio_mutex); 920 859 tmp = ap_cs8427_codec_select(ice); 921 ap_cs8427_write_byte(ice, 0x20, tmp); /* address + write mode */ 922 ap_cs8427_write_byte(ice, reg, tmp); 923 ap_cs8427_codec_deassert(ice, tmp); 924 udelay(5); 925 tmp = ap_cs8427_codec_select(ice); 926 ap_cs8427_write_byte(ice, 0x21, tmp); /* address + read mode */ 927 data = ap_cs8427_read_byte(ice, tmp); 860 ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */ 861 while (count-- > 0) 862 *bytes++ = ap_cs8427_read_byte(ice, tmp); 928 863 ap_cs8427_codec_deassert(ice, tmp); 929 864 up(&ice->gpio_mutex); 930 return data; 931 } 932 933 /* sequential write */ 934 static void snd_ice1712_ap_cs8427_write_bytes(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data) 935 { 936 #if 1 937 unsigned char tmp; 938 down(&ice->gpio_mutex); 939 tmp = ap_cs8427_codec_select(ice); 940 ap_cs8427_write_byte(ice, 0x20, tmp); /* address + write mode */ 941 ap_cs8427_write_byte(ice, reg | 0x80, tmp); /* incremental mode */ 942 while (bytes-- > 0) 943 ap_cs8427_write_byte(ice, *data++, tmp); 944 ap_cs8427_codec_deassert(ice, tmp); 945 up(&ice->gpio_mutex); 946 #else 947 while (bytes-- > 0) 948 snd_ice1712_ap_cs8427_write(ice, reg++, *data++); 949 #endif 950 } 951 952 /* sequential read */ 953 static void snd_ice1712_ap_cs8427_read_bytes(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data) 954 { 955 #if 0 // is this working? -- ti 956 unsigned char tmp; 957 958 down(&ice->gpio_mutex); 959 tmp = ap_cs8427_codec_select(ice); 960 ap_cs8427_write_byte(ice, 0x20, tmp); /* address + write mode */ 961 ap_cs8427_write_byte(ice, reg | 0x80, tmp); /* incremental mode */ 962 ap_cs8427_codec_deassert(ice, tmp); 963 udelay(5); 964 tmp = ap_cs8427_codec_select(ice); 965 ap_cs8427_write_byte(ice, 0x21, tmp); /* address + read mode */ 966 while (bytes-- > 0) 967 *data++ = ap_cs8427_read_byte(ice, tmp); 968 ap_cs8427_codec_deassert(ice, tmp); 969 up(&ice->gpio_mutex); 970 #else 971 while (bytes-- > 0) 972 *data++ = snd_ice1712_ap_cs8427_read(ice, reg++); 973 #endif 865 return res; 866 } 867 868 static int ap_cs8427_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) 869 { 870 if (addr == 0x10) 871 return 1; 872 return -ENOENT; 974 873 } 975 874 976 875 #ifdef TARGET_OS2 977 876 static ice1712_cs8427_ops_t snd_ice1712_ap_cs8427_ops = { 978 snd_ice1712_ap_cs8427_write, 979 snd_ice1712_ap_cs8427_read, 980 snd_ice1712_ap_cs8427_write_bytes, 981 snd_ice1712_ap_cs8427_read_bytes 877 ap_cs8427_sendbytes, 878 ap_cs8427_readbytes, 879 ap_cs8427_probeaddr, 982 880 }; 983 881 #else 984 static ice1712_cs8427_ops_t snd_ice1712_ap_cs8427_ops = { 985 write: snd_ice1712_ap_cs8427_write, 986 read: snd_ice1712_ap_cs8427_read, 987 write_bytes: snd_ice1712_ap_cs8427_write_bytes, 988 read_bytes: snd_ice1712_ap_cs8427_read_bytes, 882 static snd_i2c_ops_t ap_cs8427_i2c_ops = { 883 sendbytes: ap_cs8427_sendbytes, 884 readbytes: ap_cs8427_readbytes, 885 probeaddr: ap_cs8427_probeaddr, 989 886 }; 990 887 #endif 991 992 888 993 889 /* … … 996 892 997 893 /* send SDA and SCL */ 998 static void ewx_i2c_set(ice1712_t *ice, int clk, int data) 999 { 894 static void ewx_i2c_setlines(snd_i2c_bus_t *bus, int clk, int data) 895 { 896 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return); 1000 897 unsigned char tmp = 0; 1001 898 if (clk) … … 1007 904 } 1008 905 1009 /* send one bit */ 1010 static void ewx_i2c_send(ice1712_t *ice, int data) 1011 { 1012 ewx_i2c_set(ice, 0, data); 1013 ewx_i2c_set(ice, 1, data); 1014 ewx_i2c_set(ice, 0, data); 1015 } 1016 1017 /* start i2c */ 1018 static void ewx_i2c_start(ice1712_t *ice) 1019 { 1020 ewx_i2c_set(ice, 0, 1); 1021 ewx_i2c_set(ice, 1, 1); 1022 ewx_i2c_set(ice, 1, 0); 1023 ewx_i2c_set(ice, 0, 0); 1024 } 1025 1026 /* stop i2c */ 1027 static void ewx_i2c_stop(ice1712_t *ice) 1028 { 1029 ewx_i2c_set(ice, 0, 0); 1030 ewx_i2c_set(ice, 1, 0); 1031 ewx_i2c_set(ice, 1, 1); 1032 } 1033 1034 /* send a byte and get ack */ 1035 static void ewx_i2c_write(ice1712_t *ice, unsigned char val) 1036 { 1037 int i; 1038 for (i = 7; i >= 0; i--) 1039 ewx_i2c_send(ice, val & (1 << i)); 1040 ewx_i2c_send(ice, 1); /* ack */ 1041 } 1042 1043 /* prepare for write and send i2c_start */ 1044 static void ewx_i2c_write_prepare(ice1712_t *ice) 1045 { 1046 /* set RW high */ 1047 unsigned char mask = ICE1712_EWX2496_RW; 1048 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_EWX2496) 1049 mask |= ICE1712_EWX2496_AK4524_CS; /* CS high also */ 1050 snd_ice1712_gpio_write_bits(ice, mask, mask); 1051 /* set direction both SDA and SCL write */ 1052 ice->gpio_direction |= ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA; 1053 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio_direction); 1054 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA)); 1055 1056 ewx_i2c_start(ice); 1057 } 1058 1059 /* read a bit from serial data; 1060 this changes write mask 1061 SDA direction must be set to low 1062 */ 1063 static int ewx_i2c_read_bit(ice1712_t *ice) 1064 { 1065 int data; 906 static int ewx_i2c_getclock(snd_i2c_bus_t *bus) 907 { 908 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return -EIO); 909 return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0; 910 } 911 912 static int ewx_i2c_getdata(snd_i2c_bus_t *bus, int ack) 913 { 914 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return -EIO); 915 int bit; 1066 916 /* set RW pin to low */ 1067 917 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW); 1068 918 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, 0); 1069 data = (snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA) ? 1 : 0; 919 if (ack) 920 udelay(5); 921 bit = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA ? 1 : 0; 1070 922 /* set RW pin to high */ 1071 923 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_EWX2496_RW); 1072 return data; 1073 } 1074 1075 static void ewx_i2c_read_prepare(ice1712_t *ice) 1076 { 1077 /* set SCL - write, SDA - read */ 1078 ice->gpio_direction |= ICE1712_EWX2496_SERIAL_CLOCK; 1079 ice->gpio_direction &= ~ICE1712_EWX2496_SERIAL_DATA; 924 /* reset write mask */ 925 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK); 926 return bit; 927 } 928 929 static void ewx_i2c_start(snd_i2c_bus_t *bus) 930 { 931 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return); 932 unsigned char mask; 933 934 save_gpio_status(ice, (unsigned char *)&bus->private_value); 935 /* set RW high */ 936 mask = ICE1712_EWX2496_RW; 937 switch (ice->eeprom.subvendor) { 938 case ICE1712_SUBDEVICE_EWX2496: 939 mask |= ICE1712_EWX2496_AK4524_CS; /* CS high also */ 940 break; 941 case ICE1712_SUBDEVICE_DMX6FIRE: 942 mask |= ICE1712_6FIRE_AK4524_CS_MASK; /* CS high also */ 943 break; 944 } 945 snd_ice1712_gpio_write_bits(ice, mask, mask); 946 } 947 948 static void ewx_i2c_stop(snd_i2c_bus_t *bus) 949 { 950 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return); 951 restore_gpio_status(ice, (unsigned char *)&bus->private_value); 952 } 953 954 static void ewx_i2c_direction(snd_i2c_bus_t *bus, int clock, int data) 955 { 956 ice1712_t *ice = snd_magic_cast(ice1712_t, bus->private_data, return); 957 unsigned char mask = 0; 958 959 if (clock) 960 mask |= ICE1712_EWX2496_SERIAL_CLOCK; /* write SCL */ 961 if (data) 962 mask |= ICE1712_EWX2496_SERIAL_DATA; /* write SDA */ 963 ice->gpio_direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA); 964 ice->gpio_direction |= mask; 1080 965 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio_direction); 1081 /* set write mask only to SCL */ 1082 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK); 1083 } 1084 1085 static void ewx_i2c_read_post(ice1712_t *ice) 1086 { 1087 /* reset direction both SDA and SCL to write */ 1088 ice->gpio_direction |= ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA; 1089 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio_direction); 1090 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA)); 1091 } 1092 1093 /* read a byte (and ack bit) */ 1094 static unsigned char ewx_i2c_read(ice1712_t *ice) 1095 { 1096 int i; 1097 unsigned char data = 0; 1098 1099 for (i = 7; i >= 0; i--) { 1100 ewx_i2c_set(ice, 1, 0); 1101 data |= ewx_i2c_read_bit(ice) << i; 1102 /* reset write mask */ 1103 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, 1104 ~ICE1712_EWX2496_SERIAL_CLOCK); 1105 ewx_i2c_set(ice, 0, 0); 1106 } 1107 /* reset write mask */ 1108 ewx_i2c_read_post(ice); 1109 ewx_i2c_send(ice, 1); /* ack */ 1110 return data; 1111 } 1112 1113 1114 /* 1115 * CS8427 on EWX 24/96; Address 0x20 1116 */ 1117 /* write a register */ 1118 static void snd_ice1712_ewx_cs8427_write(ice1712_t *ice, unsigned char reg, unsigned char data) 1119 { 1120 unsigned char saved[2]; 1121 1122 save_gpio_status(ice, saved); 1123 ewx_i2c_write_prepare(ice); 1124 ewx_i2c_write(ice, 0x20); /* address + write */ 1125 ewx_i2c_write(ice, reg); /* MAP */ 1126 ewx_i2c_write(ice, data); 1127 ewx_i2c_stop(ice); 1128 restore_gpio_status(ice, saved); 1129 } 1130 1131 /* sequential write */ 1132 static void snd_ice1712_ewx_cs8427_write_bytes(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data) 1133 { 1134 unsigned char saved[2]; 1135 1136 save_gpio_status(ice, saved); 1137 ewx_i2c_write_prepare(ice); 1138 ewx_i2c_write(ice, 0x20); /* address + write */ 1139 ewx_i2c_write(ice, reg | 0x80); /* MAP incremental mode */ 1140 while (bytes-- > 0) 1141 ewx_i2c_write(ice, *data++); 1142 ewx_i2c_stop(ice); 1143 restore_gpio_status(ice, saved); 1144 } 1145 1146 /* read a register */ 1147 static unsigned char snd_ice1712_ewx_cs8427_read(ice1712_t *ice, unsigned char reg) 1148 { 1149 unsigned char saved[2]; 1150 unsigned char data; 1151 1152 save_gpio_status(ice, saved); 1153 ewx_i2c_write_prepare(ice); 1154 ewx_i2c_write(ice, 0x20); /* address + write */ 1155 ewx_i2c_write(ice, reg); /* MAP */ 1156 /* we set up the address first but without data */ 1157 ewx_i2c_stop(ice); 1158 1159 /* now read */ 1160 ewx_i2c_start(ice); 1161 ewx_i2c_write(ice, 0x21); /* address + read */ 1162 ewx_i2c_read_prepare(ice); 1163 data = ewx_i2c_read(ice); 1164 ewx_i2c_read_post(ice); 1165 ewx_i2c_stop(ice); 1166 1167 restore_gpio_status(ice, saved); 1168 return data; 1169 } 1170 1171 /* sequential read */ 1172 static void snd_ice1712_ewx_cs8427_read_bytes(ice1712_t *ice, unsigned char reg, int bytes, unsigned char *data) 1173 { 1174 #if 0 // the sequential read seems not working (yet).. 1175 unsigned char saved[2]; 1176 1177 save_gpio_status(ice, saved); 1178 ewx_i2c_write_prepare(ice); 1179 ewx_i2c_write(ice, 0x20); /* address + write */ 1180 ewx_i2c_write(ice, reg | 0x80); /* MAP incremental mode */ 1181 /* we set up the address first but without data */ 1182 ewx_i2c_stop(ice); 1183 1184 /* now read */ 1185 ewx_i2c_start(ice); 1186 ewx_i2c_write(ice, 0x21); /* address + read */ 1187 ewx_i2c_read_prepare(ice); 1188 while (bytes-- > 0) 1189 *data++ = ewx_i2c_read(ice); 1190 ewx_i2c_read_post(ice); 1191 ewx_i2c_stop(ice); 1192 restore_gpio_status(ice, saved); 1193 #else 1194 while (bytes-- > 0) 1195 *data++ = snd_ice1712_ewx_cs8427_read(ice, reg++); 1196 #endif 966 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask); 1197 967 } 1198 968 1199 969 #ifdef TARGET_OS2 1200 static ice1712_cs8427_ops_t snd_ice1712_ewx_cs8427_ops = { 1201 snd_ice1712_ewx_cs8427_write, 1202 snd_ice1712_ewx_cs8427_read, 1203 snd_ice1712_ewx_cs8427_write_bytes, 1204 snd_ice1712_ewx_cs8427_read_bytes, 970 static snd_i2c_bit_ops_t snd_ice1712_ewx_cs8427_bit_ops = { 971 ewx_i2c_start, 972 ewx_i2c_stop, 973 ewx_i2c_direction, 974 ewx_i2c_setlines, 975 ewx_i2c_getclock, 976 ewx_i2c_getdata, 1205 977 }; 1206 978 #else 1207 static ice1712_cs8427_ops_t snd_ice1712_ewx_cs8427_ops = { 1208 write: snd_ice1712_ewx_cs8427_write, 1209 read: snd_ice1712_ewx_cs8427_read, 1210 write_bytes: snd_ice1712_ewx_cs8427_write_bytes, 1211 read_bytes: snd_ice1712_ewx_cs8427_read_bytes, 979 static snd_i2c_bit_ops_t snd_ice1712_ewx_cs8427_bit_ops = { 980 start: ewx_i2c_start, 981 stop: ewx_i2c_stop, 982 direction: ewx_i2c_direction, 983 setlines: ewx_i2c_setlines, 984 getclock: ewx_i2c_getclock, 985 getdata: ewx_i2c_getdata, 1212 986 }; 1213 987 #endif 1214 988 1215 /*1216 * PCF8574 on EWS88MT1217 */1218 static void snd_ice1712_ews88mt_pcf8574_write(ice1712_t *ice, unsigned char addr, unsigned char data)1219 {1220 ewx_i2c_write_prepare(ice);1221 ewx_i2c_write(ice, addr); /* address + write */1222 ewx_i2c_write(ice, data);1223 ewx_i2c_stop(ice);1224 }1225 1226 static unsigned char snd_ice1712_ews88mt_pcf8574_read(ice1712_t *ice, unsigned char addr)1227 {1228 unsigned char data;1229 ewx_i2c_write_prepare(ice);1230 ewx_i2c_write(ice, addr | 0x01); /* address + read */1231 ewx_i2c_read_prepare(ice);1232 data = ewx_i2c_read(ice);1233 ewx_i2c_read_post(ice);1234 ewx_i2c_stop(ice);1235 return data;1236 }1237 1238 989 /* AK4524 chip select; address 0x48 bit 0-3 */ 1239 990 static void snd_ice1712_ews88mt_chip_select(ice1712_t *ice, int chip_mask) … … 1242 993 1243 994 snd_assert(chip_mask >= 0 && chip_mask <= 0x0f, return); 1244 data = snd_ice1712_ews88mt_pcf8574_read(ice, ICE1712_EWS88MT_OUTPUT_ADDR); 995 snd_i2c_lock(ice->i2c); 996 snd_runtime_check(snd_i2c_readbytes(ice->pcf8574[1], &data, 1) == 1, snd_i2c_unlock(ice->i2c); return); 1245 997 ndata = (data & 0xf0) | chip_mask; 1246 998 if (ndata != data) 1247 snd_ice1712_ews88mt_pcf8574_write(ice, ICE1712_EWS88MT_OUTPUT_ADDR, ndata); 1248 } 1249 1250 1251 /* 1252 * PCF8575 on EWS88D (16bit) 1253 */ 1254 static void snd_ice1712_ews88d_pcf8575_write(ice1712_t *ice, unsigned char addr, unsigned short data) 1255 { 1256 ewx_i2c_write_prepare(ice); 1257 ewx_i2c_write(ice, addr); /* address + write */ 1258 ewx_i2c_write(ice, data & 0xff); 1259 ewx_i2c_write(ice, (data >> 8) & 0xff); 1260 ewx_i2c_stop(ice); 1261 } 1262 1263 static unsigned short snd_ice1712_ews88d_pcf8575_read(ice1712_t *ice, unsigned char addr) 1264 { 1265 unsigned short data; 1266 ewx_i2c_write_prepare(ice); 1267 ewx_i2c_write(ice, addr | 0x01); /* address + read */ 1268 ewx_i2c_read_prepare(ice); 1269 data = ewx_i2c_read(ice); 1270 data |= (unsigned short)ewx_i2c_read(ice) << 8; 1271 //printk("pcf: read = 0x%x\n", data); 1272 ewx_i2c_read_post(ice); 1273 ewx_i2c_stop(ice); 1274 return data; 999 snd_runtime_check(snd_i2c_sendbytes(ice->pcf8574[1], &ndata, 1) == 1, snd_i2c_unlock(ice->i2c); return); 1000 snd_i2c_unlock(ice->i2c); 1275 1001 } 1276 1002 … … 1286 1012 unsigned int addrdata; 1287 1013 1288 snd_assert(chip >=0 && chip < 4, return); 1014 snd_assert(chip >= 0 && chip < 4, return); 1015 1289 1016 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_EWS88MT) { 1290 1017 /* assert AK4524 CS */ … … 1327 1054 ~(data_mask | clk_mask | 1328 1055 codecs_mask | ICE1712_EWS88_RW)); 1056 cif = 1; /* CIF high */ 1057 break; 1058 case ICE1712_SUBDEVICE_DMX6FIRE: 1059 data_mask = ICE1712_6FIRE_SERIAL_DATA; 1060 clk_mask = ICE1712_6FIRE_SERIAL_CLOCK; 1061 codecs_mask = (1 << chip) & ICE1712_6FIRE_AK4524_CS_MASK; 1062 tmp |= ICE1712_6FIRE_RW; /* set rw bit high */ 1063 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, 1064 ice->gpio_direction | data_mask | clk_mask | 1065 codecs_mask | ICE1712_6FIRE_RW); 1066 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, 1067 ~(data_mask | clk_mask | 1068 codecs_mask | ICE1712_6FIRE_RW)); 1329 1069 cif = 1; /* CIF high */ 1330 1070 break; … … 1360 1100 1361 1101 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_EWS88MT) { 1102 restore_gpio_status(ice, saved); 1362 1103 //snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f); 1363 1104 udelay(1); … … 1373 1114 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); 1374 1115 udelay(1); 1375 } 1376 1116 restore_gpio_status(ice, saved); 1117 } 1118 1119 if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0) 1377 1120 ice->ak4524_images[chip][addr] = data; 1378 restore_gpio_status(ice, saved); 1379 } 1380 1381 1382 /* 1383 * decode/encode channel status bits from CS8404A on EWS88MT&D 1384 */ 1385 static void snd_ice1712_ews_decode_cs8404_spdif_bits(snd_aes_iec958_t *diga, 1386 unsigned char bits) 1387 { 1388 if (bits & 0x10) { /* consumer */ 1389 if (!(bits & 0x20)) 1390 diga->status[0] |= IEC958_AES0_CON_NOT_COPYRIGHT; 1391 if (!(bits & 0x40)) 1392 diga->status[0] |= IEC958_AES0_CON_EMPHASIS_5015; 1393 if (!(bits & 0x80)) 1394 diga->status[1] |= IEC958_AES1_CON_ORIGINAL; 1395 switch (bits & 0x03) { 1396 case 0x00: diga->status[1] |= IEC958_AES1_CON_DAT; break; 1397 case 0x03: diga->status[1] |= IEC958_AES1_CON_GENERAL; break; 1398 } 1399 switch (bits & 0x06) { 1400 case 0x02: diga->status[3] |= IEC958_AES3_CON_FS_32000; break; 1401 case 0x04: diga->status[3] |= IEC958_AES3_CON_FS_48000; break; 1402 case 0x06: diga->status[3] |= IEC958_AES3_CON_FS_44100; break; 1403 } 1404 } else { 1405 diga->status[0] = IEC958_AES0_PROFESSIONAL; 1406 if (!(bits & 0x04)) 1407 diga->status[0] |= IEC958_AES0_NONAUDIO; 1408 switch (bits & 0x60) { 1409 case 0x00: diga->status[0] |= IEC958_AES0_PRO_FS_32000; break; 1410 case 0x40: diga->status[0] |= IEC958_AES0_PRO_FS_44100; break; 1411 case 0x20: diga->status[0] |= IEC958_AES0_PRO_FS_48000; break; 1412 case 0x60: diga->status[0] |= IEC958_AES0_PRO_FS_NOTID; break; 1413 } 1414 switch (bits & 0x03) { 1415 case 0x02: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NONE; break; 1416 case 0x01: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_5015; break; 1417 case 0x00: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_CCITT; break; 1418 case 0x03: diga->status[0] |= IEC958_AES0_PRO_EMPHASIS_NOTID; break; 1419 } 1420 if (!(bits & 0x80)) 1421 diga->status[1] |= IEC958_AES1_PRO_MODE_STEREOPHONIC; 1422 } 1423 } 1424 1425 static unsigned char snd_ice1712_ews_encode_cs8404_spdif_bits(snd_aes_iec958_t *diga) 1426 { 1427 unsigned char bits; 1428 1429 if (!(diga->status[0] & IEC958_AES0_PROFESSIONAL)) { 1430 bits = 0x10; /* consumer mode */ 1431 if (!(diga->status[0] & IEC958_AES0_CON_NOT_COPYRIGHT)) 1432 bits |= 0x20; 1433 if ((diga->status[0] & IEC958_AES0_CON_EMPHASIS) == IEC958_AES0_CON_EMPHASIS_NONE) 1434 bits |= 0x40; 1435 if (!(diga->status[1] & IEC958_AES1_CON_ORIGINAL)) 1436 bits |= 0x80; 1437 if ((diga->status[1] & IEC958_AES1_CON_CATEGORY) == IEC958_AES1_CON_GENERAL) 1438 bits |= 0x03; 1439 switch (diga->status[3] & IEC958_AES3_CON_FS) { 1440 default: 1441 case IEC958_AES3_CON_FS_44100: bits |= 0x06; break; 1442 case IEC958_AES3_CON_FS_48000: bits |= 0x04; break; 1443 case IEC958_AES3_CON_FS_32000: bits |= 0x02; break; 1444 } 1445 } else { 1446 bits = 0x00; /* professional mode */ 1447 if (!(diga->status[0] & IEC958_AES0_NONAUDIO)) 1448 bits |= 0x04; 1449 switch (diga->status[0] & IEC958_AES0_PRO_FS) { 1450 case IEC958_AES0_PRO_FS_32000: bits |= 0x00; break; 1451 case IEC958_AES0_PRO_FS_44100: bits |= 0x40; break; /* 44.1kHz */ 1452 case IEC958_AES0_PRO_FS_48000: bits |= 0x20; break; /* 48kHz */ 1453 default: 1454 case IEC958_AES0_PRO_FS_NOTID: bits |= 0x00; break; 1455 } 1456 switch (diga->status[0] & IEC958_AES0_PRO_EMPHASIS) { 1457 case IEC958_AES0_PRO_EMPHASIS_NONE: bits |= 0x02; break; 1458 case IEC958_AES0_PRO_EMPHASIS_5015: bits |= 0x01; break; 1459 case IEC958_AES0_PRO_EMPHASIS_CCITT: bits |= 0x00; break; 1460 default: 1461 case IEC958_AES0_PRO_EMPHASIS_NOTID: bits |= 0x03; break; 1462 } 1463 switch (diga->status[1] & IEC958_AES1_PRO_MODE) { 1464 case IEC958_AES1_PRO_MODE_TWO: 1465 case IEC958_AES1_PRO_MODE_STEREOPHONIC: bits |= 0x00; break; 1466 default: bits |= 0x80; break; 1467 } 1468 } 1469 return bits; 1470 } 1471 1472 /* write on i2c address 0x40 */ 1121 else 1122 ice->ak4524_ipga_gain[chip][addr-4] = data; 1123 } 1124 1125 static void snd_ice1712_ak4524_reset(ice1712_t *ice, int state) 1126 { 1127 int chip; 1128 unsigned char reg; 1129 1130 for (chip = 0; chip < ice->num_dacs/2; chip++) { 1131 snd_ice1712_ak4524_write(ice, chip, 0x01, state ? 0x00 : 0x03); 1132 if (state) 1133 continue; 1134 for (reg = 0x04; reg < (ice->ak4528 ? 0x06 : 0x08); reg++) 1135 snd_ice1712_ak4524_write(ice, chip, reg, ice->ak4524_images[chip][reg]); 1136 if (ice->ak4528) 1137 continue; 1138 for (reg = 0x04; reg < 0x06; reg++) 1139 snd_ice1712_ak4524_write(ice, chip, reg, ice->ak4524_ipga_gain[chip][reg-4]); 1140 } 1141 } 1142 1473 1143 static void snd_ice1712_ews_cs8404_spdif_write(ice1712_t *ice, unsigned char bits) 1474 1144 { 1475 unsigned short val, nval; 1476 1145 unsigned char bytes[2]; 1146 1147 snd_i2c_lock(ice->i2c); 1477 1148 switch (ice->eeprom.subvendor) { 1478 1149 case ICE1712_SUBDEVICE_EWS88MT: 1479 snd_ ice1712_ews88mt_pcf8574_write(ice, ICE1712_EWS88MT_CS8404_ADDR, bits);1150 snd_runtime_check(snd_i2c_sendbytes(ice->cs8404, &bits, 1) == 1, snd_i2c_unlock(ice->i2c); return); 1480 1151 break; 1481 1152 case ICE1712_SUBDEVICE_EWS88D: 1482 val = snd_ice1712_ews88d_pcf8575_read(ice, ICE1712_EWS88D_PCF_ADDR); 1483 nval = val & 0xff; 1484 nval |= bits << 8; 1485 if (val != nval) 1486 snd_ice1712_ews88d_pcf8575_write(ice, ICE1712_EWS88D_PCF_ADDR, nval); 1487 break; 1488 } 1153 snd_runtime_check(snd_i2c_readbytes(ice->pcf8575, bytes, 2) == 2, snd_i2c_unlock(ice->i2c); return); 1154 if (bits != bytes[1]) { 1155 bytes[1] = bits; 1156 snd_runtime_check(snd_i2c_readbytes(ice->pcf8575, bytes, 2) == 2, snd_i2c_unlock(ice->i2c); return); 1157 } 1158 break; 1159 } 1160 snd_i2c_unlock(ice->i2c); 1489 1161 } 1490 1162 … … 1496 1168 static int snd_ice1712_cs8427_set_input_clock(ice1712_t *ice, int spdif_clock) 1497 1169 { 1170 unsigned char reg[2] = { 0x80 | 4, 0 }; /* CS8427 auto increment | register number 4 + data */ 1498 1171 unsigned char val, nval; 1499 val = ice->cs8427_ops->read(ice, 4); 1172 snd_i2c_lock(ice->i2c); 1173 if (snd_i2c_sendbytes(ice->cs8427, reg, 1) != 1) { 1174 snd_i2c_unlock(ice->i2c); 1175 return -EREMOTE; 1176 } 1177 if (snd_i2c_readbytes(ice->cs8427, &val, 1) != 1) { 1178 snd_i2c_unlock(ice->i2c); 1179 return -EREMOTE; 1180 } 1500 1181 nval = val & 0xf0; 1501 1182 if (spdif_clock) … … 1504 1185 nval |= 0x04; 1505 1186 if (val != nval) { 1506 ice->cs8427_ops->write(ice, 4, nval); 1187 if (snd_i2c_sendbytes(ice->cs8427, reg, 2) != 2) { 1188 snd_i2c_unlock(ice->i2c); 1189 return -EREMOTE; 1190 } 1507 1191 return 1; 1508 1192 } 1509 return 0; 1510 } 1511 1512 #if 0 // we change clock selection automatically according to the ice1712 clock source 1513 static int snd_ice1712_cs8427_clock_select_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1514 { 1515 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1516 uinfo->count = 1; 1517 uinfo->value.integer.min = 0; 1518 uinfo->value.integer.max = 1; 1519 return 0; 1520 } 1521 1522 static int snd_ice1712_cs8427_clock_select_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1523 { 1524 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1525 int val; 1526 val = ice->cs8427_ops->read(ice, 4); 1527 ucontrol->value.integer.value[0] = (val & 0x01) ? 1 : 0; 1528 return 0; 1529 } 1530 1531 static int snd_ice1712_cs8427_clock_select_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1532 { 1533 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1534 return snd_ice1712_cs8427_set_input_clock(ice, ucontrol->value.integer.value[0]); 1535 } 1536 1537 static snd_kcontrol_new_t snd_ice1712_cs8427_clock_select = { 1538 iface: SNDRV_CTL_ELEM_IFACE_MIXER, 1539 name: "CS8427 Clock Select", 1540 info: snd_ice1712_cs8427_clock_select_info, 1541 get: snd_ice1712_cs8427_clock_select_get, 1542 put: snd_ice1712_cs8427_clock_select_put, 1543 }; 1544 #endif 1545 1546 1547 /* 1548 */ 1549 static int snd_ice1712_cs8427_in_status_info(snd_kcontrol_t *kcontrol, 1550 snd_ctl_elem_info_t *uinfo) 1551 { 1552 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1553 uinfo->count = 1; 1554 uinfo->value.integer.min = 0; 1555 uinfo->value.integer.max = 255; 1556 return 0; 1557 } 1558 1559 static int snd_ice1712_cs8427_in_status_get(snd_kcontrol_t *kcontrol, 1560 snd_ctl_elem_value_t *ucontrol) 1561 { 1562 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 1563 ucontrol->value.integer.value[0] = ice->cs8427_ops->read(ice, 15); 1564 return 0; 1565 } 1566 1567 static snd_kcontrol_new_t snd_ice1712_cs8427_in_status = { 1568 #ifdef TARGET_OS2 1569 SNDRV_CTL_ELEM_IFACE_PCM,0,0, 1570 "IEC958 Input Status",0, 1571 SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1572 snd_ice1712_cs8427_in_status_info, 1573 snd_ice1712_cs8427_in_status_get,0,0 1574 #else 1575 iface: SNDRV_CTL_ELEM_IFACE_PCM, 1576 info: snd_ice1712_cs8427_in_status_info, 1577 name: "IEC958 Input Status", 1578 access: SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1579 get: snd_ice1712_cs8427_in_status_get, 1580 #endif 1581 }; 1582 1193 snd_i2c_unlock(ice->i2c); 1194 return 0; 1195 } 1583 1196 1584 1197 /* … … 1624 1237 case ICE1712_SUBDEVICE_DELTA44: 1625 1238 case ICE1712_SUBDEVICE_AUDIOPHILE: 1626 /* FIXME: we should put AK452x codecs to reset state1627 when this bit is being changed */1628 1239 spin_unlock_irqrestore(&ice->reg_lock, flags); 1240 snd_ice1712_ak4524_reset(ice, 1); 1629 1241 down(&ice->gpio_mutex); 1630 1242 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); … … 1636 1248 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); 1637 1249 up(&ice->gpio_mutex); 1250 snd_ice1712_ak4524_reset(ice, 0); 1638 1251 return; 1639 1252 } … … 2197 1810 #endif 2198 1811 2199 static void __exitsnd_ice1712_pcm_free(snd_pcm_t *pcm)1812 static void snd_ice1712_pcm_free(snd_pcm_t *pcm) 2200 1813 { 2201 1814 ice1712_t *ice = snd_magic_cast(ice1712_t, pcm->private_data, return); … … 2204 1817 } 2205 1818 2206 static int __ init snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** rpcm)1819 static int __devinit snd_ice1712_pcm(ice1712_t * ice, int device, snd_pcm_t ** rpcm) 2207 1820 { 2208 1821 snd_pcm_t *pcm; … … 2229 1842 *rpcm = pcm; 2230 1843 2231 printk( "Consumer PCM code does not work well at the moment --jk\n");2232 2233 return 0; 2234 } 2235 2236 static void __exitsnd_ice1712_pcm_free_ds(snd_pcm_t *pcm)1844 printk(KERN_WARNING "Consumer PCM code does not work well at the moment --jk\n"); 1845 1846 return 0; 1847 } 1848 1849 static void snd_ice1712_pcm_free_ds(snd_pcm_t *pcm) 2237 1850 { 2238 1851 ice1712_t *ice = snd_magic_cast(ice1712_t, pcm->private_data, return); … … 2241 1854 } 2242 1855 2243 static int __ init snd_ice1712_pcm_ds(ice1712_t * ice, int device, snd_pcm_t ** rpcm)1856 static int __devinit snd_ice1712_pcm_ds(ice1712_t * ice, int device, snd_pcm_t ** rpcm) 2244 1857 { 2245 1858 snd_pcm_t *pcm; … … 2384 1997 } 2385 1998 2386 static void snd_ice1712_cs8427_set_status(ice1712_t *ice, snd_pcm_runtime_t *runtime,2387 unsigned char *status)2388 {2389 if (status[0] & IEC958_AES0_PROFESSIONAL) {2390 status[0] &= ~IEC958_AES0_PRO_FS;2391 switch (runtime->rate) {2392 case 32000: status[0] |= IEC958_AES0_PRO_FS_32000; break;2393 case 44100: status[0] |= IEC958_AES0_PRO_FS_44100; break;2394 case 48000: status[0] |= IEC958_AES0_PRO_FS_48000; break;2395 default: status[0] |= IEC958_AES0_PRO_FS_NOTID; break;2396 }2397 } else {2398 status[3] &= ~IEC958_AES3_CON_FS;2399 switch (runtime->rate) {2400 case 32000: status[3] |= IEC958_AES3_CON_FS_32000; break;2401 case 44100: status[3] |= IEC958_AES3_CON_FS_44100; break;2402 case 48000: status[3] |= IEC958_AES3_CON_FS_48000; break;2403 }2404 }2405 }2406 2407 1999 static int snd_ice1712_playback_pro_prepare(snd_pcm_substream_t * substream) 2408 2000 { … … 2410 2002 ice1712_t *ice = snd_pcm_substream_chip(substream); 2411 2003 unsigned int tmp; 2412 unsigned char tmpst[5];2413 2004 int change; 2414 2005 … … 2442 2033 case ICE1712_SUBDEVICE_EWX2496: 2443 2034 case ICE1712_SUBDEVICE_AUDIOPHILE: 2444 /* setup S/PDIF */ 2445 memcpy(tmpst, ice->cs8427_spdif_stream_status, 5); 2446 snd_ice1712_cs8427_set_status(ice, substream->runtime, tmpst); 2447 change = memcmp(tmpst, ice->cs8427_spdif_stream_status, 5) != 0; 2448 memcpy(ice->cs8427_spdif_stream_status, tmpst, 5); 2449 spin_unlock_irqrestore(&ice->reg_lock, flags); 2450 if (change) { 2451 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif_stream_ctl->id); 2452 ice->cs8427_ops->write_bytes(ice, 32, 5, tmpst); 2453 } 2454 return 0; 2035 snd_cs8427_iec958_pcm(ice->cs8427, substream->runtime->rate); 2036 break; 2455 2037 case ICE1712_SUBDEVICE_EWS88MT: 2456 2038 case ICE1712_SUBDEVICE_EWS88D: … … 2609 2191 2610 2192 ice->cs8403_spdif_stream_bits = ice->cs8403_spdif_bits; 2611 memcpy(ice->cs8427_spdif_stream_status, ice->cs8427_spdif_status, 5); 2612 if (ice->spdif_stream_ctl != NULL) { 2613 ice->spdif_stream_ctl->access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 2614 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE | 2615 SNDRV_CTL_EVENT_MASK_INFO, &ice->spdif_stream_ctl->id); 2616 } 2193 if (ice->cs8427) 2194 snd_cs8427_iec958_active(ice->cs8427, 1); 2617 2195 2618 2196 return 0; … … 2637 2215 2638 2216 ice->playback_pro_substream = NULL; 2639 2640 if (ice->spdif_stream_ctl != NULL) { 2641 ice->spdif_stream_ctl->access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 2642 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE | 2643 SNDRV_CTL_EVENT_MASK_INFO, &ice->spdif_stream_ctl->id); 2644 } 2217 if (ice->cs8427) 2218 snd_cs8427_iec958_active(ice->cs8427, 0); 2645 2219 2646 2220 return 0; … … 2655 2229 } 2656 2230 2657 static void __exitsnd_ice1712_pcm_profi_free(snd_pcm_t *pcm)2231 static void snd_ice1712_pcm_profi_free(snd_pcm_t *pcm) 2658 2232 { 2659 2233 ice1712_t *ice = snd_magic_cast(ice1712_t, pcm->private_data, return); … … 2708 2282 #endif 2709 2283 2710 static int __ init snd_ice1712_pcm_profi(ice1712_t * ice, int device, snd_pcm_t ** rpcm)2284 static int __devinit snd_ice1712_pcm_profi(ice1712_t * ice, int device, snd_pcm_t ** rpcm) 2711 2285 { 2712 2286 snd_pcm_t *pcm; … … 2733 2307 *rpcm = pcm; 2734 2308 2309 if (ice->cs8427) { 2310 /* assign channels to iec958 */ 2311 err = snd_cs8427_iec958_build(ice->cs8427, 2312 pcm->streams[0].substream, 2313 pcm->streams[1].substream); 2314 if (err < 0) 2315 return err; 2316 } 2317 2735 2318 if ((err = snd_ice1712_build_pro_mixer(ice)) < 0) 2736 2319 return err; … … 2858 2441 unsigned char nval = ucontrol->value.integer.value[0]; 2859 2442 int change = ice->ak4524_images[chip][addr] != nval; 2443 if (change) 2444 snd_ice1712_ak4524_write(ice, chip, addr, nval); 2445 return change; 2446 } 2447 2448 static int snd_ice1712_ak4524_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2449 { 2450 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2451 uinfo->count = 1; 2452 uinfo->value.integer.min = 0; 2453 uinfo->value.integer.max = 36; 2454 return 0; 2455 } 2456 2457 static int snd_ice1712_ak4524_ipga_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 2458 { 2459 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 2460 int chip = kcontrol->private_value / 8; 2461 int addr = kcontrol->private_value % 8; 2462 ucontrol->value.integer.value[0] = ice->ak4524_ipga_gain[chip][addr-4] & 0x7f; 2463 return 0; 2464 } 2465 2466 static int snd_ice1712_ak4524_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 2467 { 2468 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 2469 int chip = kcontrol->private_value / 8; 2470 int addr = kcontrol->private_value % 8; 2471 unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80; 2472 int change = ice->ak4524_ipga_gain[chip][addr] != nval; 2860 2473 if (change) 2861 2474 snd_ice1712_ak4524_write(ice, chip, addr, nval); … … 2960 2573 } 2961 2574 2962 return 0; 2963 } 2964 2965 static void /*__init*/ snd_ice1712_ac97_init(ac97_t *ac97) 2575 /* initialize volumes */ 2576 for (idx = 0; idx < 20; idx++) { 2577 ice->pro_volumes[idx] = 0x80008000; /* mute */ 2578 snd_ice1712_update_volume(ice, idx); 2579 } 2580 return 0; 2581 } 2582 2583 static void snd_ice1712_ac97_init(ac97_t *ac97) 2966 2584 { 2967 2585 // ice1712_t *ice = snd_magic_cast(ice1712_t, ac97->private_data, return); … … 2971 2589 } 2972 2590 2973 static void __exitsnd_ice1712_mixer_free_ac97(ac97_t *ac97)2591 static void snd_ice1712_mixer_free_ac97(ac97_t *ac97) 2974 2592 { 2975 2593 ice1712_t *ice = snd_magic_cast(ice1712_t, ac97->private_data, return); … … 2977 2595 } 2978 2596 2979 static int __ init snd_ice1712_ac97_mixer(ice1712_t * ice)2597 static int __devinit snd_ice1712_ac97_mixer(ice1712_t * ice) 2980 2598 { 2981 2599 int err; … … 2989 2607 ac97.private_data = ice; 2990 2608 ac97.private_free = snd_ice1712_mixer_free_ac97; 2991 if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) 2609 if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) { 2610 printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); 2611 // return err; 2612 } else { 2613 if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0) 2992 2614 return err; 2615 } 2993 2616 return 0; 2994 2617 } … … 3003 2626 ac97.private_free = snd_ice1712_mixer_free_ac97; 3004 2627 if ((err = snd_ac97_mixer(ice->card, &ac97, &ice->ac97)) < 0) 3005 return err;3006 if ((err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice))) < 0)3007 2628 return err; 3008 2629 return 0; … … 3047 2668 } 3048 2669 3049 static void __ init snd_ice1712_proc_init(ice1712_t * ice)2670 static void __devinit snd_ice1712_proc_init(ice1712_t * ice) 3050 2671 { 3051 2672 snd_info_entry_t *entry; … … 3092 2713 } 3093 2714 3094 static snd_kcontrol_new_t snd_ice1712_eeprom = {2715 static snd_kcontrol_new_t snd_ice1712_eeprom __devinitdata = { 3095 2716 #ifdef TARGET_OS2 3096 2717 SNDRV_CTL_ELEM_IFACE_CARD,0,0, … … 3126 2747 case ICE1712_SUBDEVICE_DELTADIO2496: 3127 2748 case ICE1712_SUBDEVICE_DELTA66: 3128 snd_ice1712_decode_cs8403_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits); 3129 break; 3130 case ICE1712_SUBDEVICE_AUDIOPHILE: 3131 case ICE1712_SUBDEVICE_EWX2496: 3132 memcpy(ucontrol->value.iec958.status, ice->cs8427_spdif_status, 5); 2749 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits); 3133 2750 break; 3134 2751 case ICE1712_SUBDEVICE_EWS88MT: 3135 2752 case ICE1712_SUBDEVICE_EWS88D: 3136 snd_ ice1712_ews_decode_cs8404_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits);2753 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_bits); 3137 2754 break; 3138 2755 } … … 3152 2769 case ICE1712_SUBDEVICE_DELTADIO2496: 3153 2770 case ICE1712_SUBDEVICE_DELTA66: 3154 val = snd_ ice1712_encode_cs8403_spdif_bits(&ucontrol->value.iec958);2771 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958); 3155 2772 spin_lock_irqsave(&ice->reg_lock, flags); 3156 2773 change = ice->cs8403_spdif_bits != val; … … 3163 2780 } 3164 2781 break; 3165 case ICE1712_SUBDEVICE_AUDIOPHILE:3166 case ICE1712_SUBDEVICE_EWX2496:3167 spin_lock_irqsave(&ice->reg_lock, flags);3168 change = memcmp(ucontrol->value.iec958.status, ice->cs8427_spdif_status, 5) != 0;3169 memcpy(ice->cs8427_spdif_status, ucontrol->value.iec958.status, 5);3170 if (change && ice->playback_pro_substream == NULL) {3171 spin_unlock_irqrestore(&ice->reg_lock, flags);3172 ice->cs8427_ops->write_bytes(ice, 32, 5, ice->cs8427_spdif_status);3173 } else3174 spin_unlock_irqrestore(&ice->reg_lock, flags);3175 break;3176 2782 case ICE1712_SUBDEVICE_EWS88MT: 3177 2783 case ICE1712_SUBDEVICE_EWS88D: 3178 val = snd_ ice1712_ews_encode_cs8404_spdif_bits(&ucontrol->value.iec958);2784 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958); 3179 2785 spin_lock_irqsave(&ice->reg_lock, flags); 3180 2786 change = ice->cs8403_spdif_bits != val; … … 3193 2799 } 3194 2800 3195 static snd_kcontrol_new_t snd_ice1712_spdif_default =2801 static snd_kcontrol_new_t snd_ice1712_spdif_default __devinitdata = 3196 2802 { 3197 2803 #ifdef TARGET_OS2 … … 3277 2883 } 3278 2884 3279 static snd_kcontrol_new_t snd_ice1712_spdif_maskc =2885 static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = 3280 2886 { 3281 2887 #ifdef TARGET_OS2 … … 3294 2900 }; 3295 2901 3296 static snd_kcontrol_new_t snd_ice1712_spdif_maskp =2902 static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata = 3297 2903 { 3298 2904 #ifdef TARGET_OS2 … … 3327 2933 case ICE1712_SUBDEVICE_DELTADIO2496: 3328 2934 case ICE1712_SUBDEVICE_DELTA66: 3329 snd_ice1712_decode_cs8403_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits); 3330 break; 3331 case ICE1712_SUBDEVICE_AUDIOPHILE: 3332 case ICE1712_SUBDEVICE_EWX2496: 3333 //ice->cs8427_ops->read_bytes(ice, 32, 5, ucontrol->value.iec958.status); 3334 memcpy(ucontrol->value.iec958.status, ice->cs8427_spdif_stream_status, 5); 2935 snd_cs8403_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits); 3335 2936 break; 3336 2937 case ICE1712_SUBDEVICE_EWS88MT: 3337 2938 case ICE1712_SUBDEVICE_EWS88D: 3338 snd_ ice1712_ews_decode_cs8404_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits);2939 snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->cs8403_spdif_stream_bits); 3339 2940 break; 3340 2941 } … … 3354 2955 case ICE1712_SUBDEVICE_DELTADIO2496: 3355 2956 case ICE1712_SUBDEVICE_DELTA66: 3356 val = snd_ ice1712_encode_cs8403_spdif_bits(&ucontrol->value.iec958);2957 val = snd_cs8403_encode_spdif_bits(&ucontrol->value.iec958); 3357 2958 spin_lock_irqsave(&ice->reg_lock, flags); 3358 2959 change = ice->cs8403_spdif_stream_bits != val; … … 3365 2966 } 3366 2967 break; 3367 case ICE1712_SUBDEVICE_AUDIOPHILE:3368 case ICE1712_SUBDEVICE_EWX2496:3369 spin_lock_irqsave(&ice->reg_lock, flags);3370 change = memcmp(ice->cs8427_spdif_stream_status,3371 ucontrol->value.iec958.status, 5) != 0;3372 if (change && ice->playback_pro_substream != NULL) {3373 memcpy(ice->cs8427_spdif_stream_status,3374 ucontrol->value.iec958.status, 5);3375 spin_unlock_irqrestore(&ice->reg_lock, flags);3376 ice->cs8427_ops->write_bytes(ice, 32, 5, ucontrol->value.iec958.status);3377 } else3378 spin_unlock_irqrestore(&ice->reg_lock, flags);3379 break;3380 2968 case ICE1712_SUBDEVICE_EWS88MT: 3381 2969 case ICE1712_SUBDEVICE_EWS88D: 3382 val = snd_ ice1712_ews_encode_cs8404_spdif_bits(&ucontrol->value.iec958);2970 val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958); 3383 2971 spin_lock_irqsave(&ice->reg_lock, flags); 3384 2972 change = ice->cs8403_spdif_stream_bits != val; … … 3397 2985 } 3398 2986 3399 static snd_kcontrol_new_t snd_ice1712_spdif_stream =2987 static snd_kcontrol_new_t snd_ice1712_spdif_stream __devinitdata = 3400 2988 { 3401 2989 #ifdef TARGET_OS2 … … 3417 3005 3418 3006 #ifdef TARGET_OS2 3419 #define ICE1712_GPIO(xiface, xname, xindex, shift, xaccess) \3007 #define ICE1712_GPIO(xiface, xname, xindex, mask, invert, xaccess) \ 3420 3008 { xiface, 0, 0, xname, 0, xaccess, snd_ice1712_gpio_info, \ 3421 3009 snd_ice1712_gpio_get, snd_ice1712_gpio_put, \ 3422 shift}3010 mask | (invert << 24) } 3423 3011 #else 3424 #define ICE1712_GPIO(xiface, xname, xindex, shift, xaccess) \3012 #define ICE1712_GPIO(xiface, xname, xindex, mask, invert, xaccess) \ 3425 3013 { iface: xiface, name: xname, access: xaccess, info: snd_ice1712_gpio_info, \ 3426 3014 get: snd_ice1712_gpio_get, put: snd_ice1712_gpio_put, \ 3427 private_value: shift}3015 private_value: mask | (invert << 24) } 3428 3016 #endif 3429 3017 … … 3441 3029 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3442 3030 unsigned char mask = kcontrol->private_value & 0xff; 3031 int invert = (kcontrol->private_value & (1<<24)) ? 1 : 0; 3443 3032 unsigned char saved[2]; 3444 3033 3445 3034 save_gpio_status(ice, saved); 3446 ucontrol->value.integer.value[0] = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0;3035 ucontrol->value.integer.value[0] = (snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0) ^ invert; 3447 3036 restore_gpio_status(ice, saved); 3448 3037 return 0; … … 3453 3042 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3454 3043 unsigned char mask = kcontrol->private_value & 0xff; 3044 int invert = (kcontrol->private_value & (1<<24)) ? mask : 0; 3455 3045 unsigned char saved[2]; 3456 3046 int val, nval; … … 3458 3048 if (kcontrol->private_value & (1 << 31)) 3459 3049 return -EPERM; 3460 nval = ucontrol->value.integer.value[0] ? mask : 0;3050 nval = (ucontrol->value.integer.value[0] ? mask : 0) ^ invert; 3461 3051 save_gpio_status(ice, saved); 3462 3052 val = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); … … 3467 3057 } 3468 3058 3469 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select =3470 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 0);3471 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status =3472 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);3473 static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select =3474 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0 );3475 static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status =3476 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);3059 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata = 3060 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0); 3061 static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata = 3062 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); 3063 static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata = 3064 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0); 3065 static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata = 3066 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); 3477 3067 3478 3068 static int snd_ice1712_pro_spdif_master_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) … … 3509 3099 spin_unlock_irqrestore(&ice->reg_lock, flags); 3510 3100 3511 if (ice->cs8427 _ops) {3101 if (ice->cs8427) { 3512 3102 /* change CS8427 clock source too */ 3513 3103 snd_ice1712_cs8427_set_input_clock(ice, ucontrol->value.integer.value[0]); … … 3517 3107 } 3518 3108 3519 static snd_kcontrol_new_t snd_ice1712_pro_spdif_master = {3109 static snd_kcontrol_new_t snd_ice1712_pro_spdif_master __devinitdata = { 3520 3110 #ifdef TARGET_OS2 3521 3111 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3563 3153 val >>= ((idx % 2) * 8) + ((idx / 2) * 2); 3564 3154 val &= 3; 3565 cval = in w(ICEMT(ice, ROUTE_CAPTURE));3155 cval = inl(ICEMT(ice, ROUTE_CAPTURE)); 3566 3156 cval >>= ((idx / 2) * 8) + ((idx % 2) * 4); 3567 3157 if (val == 1 && idx < 2) … … 3585 3175 /* update PSDOUT */ 3586 3176 if (ucontrol->value.enumerated.item[0] >= 11) 3587 nval = idx < 2 ? 1 : 0; 3177 nval = idx < 2 ? 1 : 0; /* dig mixer (or pcm) */ 3588 3178 else if (ucontrol->value.enumerated.item[0] >= 9) 3589 nval = 3; 3179 nval = 3; /* spdif in */ 3590 3180 else if (ucontrol->value.enumerated.item[0] >= 1) 3591 nval = 2; 3181 nval = 2; /* analog in */ 3592 3182 else 3593 nval = 0; 3183 nval = 0; /* pcm */ 3594 3184 shift = ((idx % 2) * 8) + ((idx / 2) * 2); 3595 3185 val = old_val = inw(ICEMT(ice, ROUTE_PSDOUT03)); … … 3599 3189 if (change) 3600 3190 outw(val, ICEMT(ice, ROUTE_PSDOUT03)); 3601 if (nval < 2) 3191 if (nval < 2) /* dig mixer of pcm */ 3602 3192 return change; 3603 3193 3604 3194 /* update CAPTURE */ 3605 val = old_val = in w(ICEMT(ice, ROUTE_CAPTURE));3195 val = old_val = inl(ICEMT(ice, ROUTE_CAPTURE)); 3606 3196 shift = ((idx / 2) * 8) + ((idx % 2) * 4); 3607 if (nval == 2) { 3197 if (nval == 2) { /* analog in */ 3608 3198 nval = ucontrol->value.enumerated.item[0] - 1; 3609 3199 val &= ~(0x07 << shift); 3610 3200 val |= nval << shift; 3611 } else { 3201 } else { /* spdif in */ 3612 3202 nval = (ucontrol->value.enumerated.item[0] - 9) << 3; 3613 3203 val &= ~(0x08 << shift); … … 3616 3206 if (val != old_val) { 3617 3207 change = 1; 3618 out w(val, ICEMT(ice, ROUTE_CAPTURE));3208 outl(val, ICEMT(ice, ROUTE_CAPTURE)); 3619 3209 } 3620 3210 return change; … … 3676 3266 } 3677 3267 3678 static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route = {3268 static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route __devinitdata = { 3679 3269 #ifdef TARGET_OS2 3680 3270 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3692 3282 }; 3693 3283 3694 static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route = {3284 static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { 3695 3285 #ifdef TARGET_OS2 3696 3286 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3742 3332 } 3743 3333 3744 static snd_kcontrol_new_t snd_ice1712_mixer_pro_volume_rate = {3334 static snd_kcontrol_new_t snd_ice1712_mixer_pro_volume_rate __devinitdata = { 3745 3335 #ifdef TARGET_OS2 3746 3336 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3782 3372 } 3783 3373 3784 static snd_kcontrol_new_t snd_ice1712_mixer_pro_peak = {3374 static snd_kcontrol_new_t snd_ice1712_mixer_pro_peak __devinitdata = { 3785 3375 #ifdef TARGET_OS2 3786 3376 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3846 3436 } 3847 3437 3848 static snd_kcontrol_new_t snd_ice1712_ewx_input_sense = {3438 static snd_kcontrol_new_t snd_ice1712_ewx_input_sense __devinitdata = { 3849 3439 #ifdef TARGET_OS2 3850 3440 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3864 3454 }; 3865 3455 3866 static snd_kcontrol_new_t snd_ice1712_ewx_output_sense = {3456 static snd_kcontrol_new_t snd_ice1712_ewx_output_sense __devinitdata = { 3867 3457 #ifdef TARGET_OS2 3868 3458 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3890 3480 { 3891 3481 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3892 unsigned char saved[2];3893 3482 unsigned char data; 3894 3483 3895 save_gpio_status(ice, saved); 3896 data = snd_ice1712_ews88mt_pcf8574_read(ice, ICE1712_EWS88MT_OUTPUT_ADDR); 3897 restore_gpio_status(ice, saved); 3484 snd_i2c_lock(ice->i2c); 3485 if (snd_i2c_readbytes(ice->pcf8574[1], &data, 1) != 1) { 3486 snd_i2c_unlock(ice->i2c); 3487 return -EREMOTE; 3488 } 3489 snd_i2c_unlock(ice->i2c); 3898 3490 ucontrol->value.enumerated.item[0] = data & ICE1712_EWS88MT_OUTPUT_SENSE ? 1 : 0; /* high = -10dBV, low = +4dBu */ 3899 3491 return 0; … … 3904 3496 { 3905 3497 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3906 unsigned char saved[2];3907 3498 unsigned char data, ndata; 3908 3499 3909 save_gpio_status(ice, saved); 3910 data = snd_ice1712_ews88mt_pcf8574_read(ice, ICE1712_EWS88MT_OUTPUT_ADDR); 3500 snd_i2c_lock(ice->i2c); 3501 if (snd_i2c_readbytes(ice->pcf8574[1], &data, 1) != 1) { 3502 snd_i2c_unlock(ice->i2c); 3503 return -EREMOTE; 3504 } 3911 3505 ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0); 3912 if (ndata != data) 3913 snd_ice1712_ews88mt_pcf8574_write(ice, ICE1712_EWS88MT_OUTPUT_ADDR, ndata); 3914 restore_gpio_status(ice, saved); 3506 if (ndata != data && snd_i2c_sendbytes(ice->pcf8574[1], &ndata, 1) != 1) { 3507 snd_i2c_unlock(ice->i2c); 3508 return -EREMOTE; 3509 } 3510 snd_i2c_unlock(ice->i2c); 3915 3511 return ndata != data; 3916 3917 3512 } 3918 3513 … … 3922 3517 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3923 3518 int channel = kcontrol->id.index; 3924 unsigned char saved[2];3925 3519 unsigned char data; 3926 3520 3927 3521 snd_assert(channel >= 0 && channel <= 7, return 0); 3928 save_gpio_status(ice, saved); 3929 data = snd_ice1712_ews88mt_pcf8574_read(ice, ICE1712_EWS88MT_INPUT_ADDR); 3930 restore_gpio_status(ice, saved); 3522 snd_i2c_lock(ice->i2c); 3523 if (snd_i2c_readbytes(ice->pcf8574[0], &data, 1) != 1) { 3524 snd_i2c_unlock(ice->i2c); 3525 return -EREMOTE; 3526 } 3931 3527 /* reversed; high = +4dBu, low = -10dBV */ 3932 3528 ucontrol->value.enumerated.item[0] = data & (1 << channel) ? 0 : 1; … … 3939 3535 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3940 3536 int channel = kcontrol->id.index; 3941 unsigned char saved[2];3942 3537 unsigned char data, ndata; 3943 3538 3944 3539 snd_assert(channel >= 0 && channel <= 7, return 0); 3945 save_gpio_status(ice, saved); 3946 data = snd_ice1712_ews88mt_pcf8574_read(ice, ICE1712_EWS88MT_INPUT_ADDR); 3540 snd_i2c_lock(ice->i2c); 3541 if (snd_i2c_readbytes(ice->pcf8574[0], &data, 1) != 1) { 3542 snd_i2c_unlock(ice->i2c); 3543 return -EREMOTE; 3544 } 3947 3545 ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel)); 3948 if (ndata != data) 3949 snd_ice1712_ews88mt_pcf8574_write(ice, ICE1712_EWS88MT_INPUT_ADDR, ndata); 3950 restore_gpio_status(ice, saved); 3546 if (ndata != data && snd_i2c_sendbytes(ice->pcf8574[0], &ndata, 1) != 1) { 3547 snd_i2c_unlock(ice->i2c); 3548 return -EREMOTE; 3549 } 3550 snd_i2c_unlock(ice->i2c); 3951 3551 return ndata != data; 3952 3552 } 3953 3553 3954 static snd_kcontrol_new_t snd_ice1712_ews88mt_input_sense = {3554 static snd_kcontrol_new_t snd_ice1712_ews88mt_input_sense __devinitdata = { 3955 3555 #ifdef TARGET_OS2 3956 3556 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 3968 3568 }; 3969 3569 3970 static snd_kcontrol_new_t snd_ice1712_ews88mt_output_sense = {3570 static snd_kcontrol_new_t snd_ice1712_ews88mt_output_sense __devinitdata = { 3971 3571 #ifdef TARGET_OS2 3972 3572 SNDRV_CTL_ELEM_IFACE_MIXER,0,0, … … 4003 3603 int shift = kcontrol->private_value & 0xff; 4004 3604 int invert = (kcontrol->private_value >> 8) & 1; 4005 unsigned short data;3605 unsigned char data[2]; 4006 3606 4007 data = snd_ice1712_ews88d_pcf8575_read(ice, ICE1712_EWS88D_PCF_ADDR); 4008 //printk("pcf: read 0x%x\n", data); 4009 data = (data >> shift) & 0x01; 3607 snd_i2c_lock(ice->i2c); 3608 if (snd_i2c_readbytes(ice->pcf8575, data, 2) != 2) { 3609 snd_i2c_unlock(ice->i2c); 3610 return -EREMOTE; 3611 } 3612 snd_i2c_unlock(ice->i2c); 3613 data[0] = (data[shift >> 3] >> (shift & 7)) & 0x01; 4010 3614 if (invert) 4011 data ^= 0x01;4012 ucontrol->value.integer.value[0] = data ;3615 data[0] ^= 0x01; 3616 ucontrol->value.integer.value[0] = data[0]; 4013 3617 return 0; 4014 3618 } … … 4019 3623 int shift = kcontrol->private_value & 0xff; 4020 3624 int invert = (kcontrol->private_value >> 8) & 1; 4021 unsigned short data, ndata;3625 unsigned char data[2], ndata[2]; 4022 3626 int change; 4023 3627 4024 data = snd_ice1712_ews88d_pcf8575_read(ice, ICE1712_EWS88D_PCF_ADDR); 4025 ndata = data & ~(1 << shift); 3628 snd_i2c_lock(ice->i2c); 3629 if (snd_i2c_readbytes(ice->pcf8575, data, 2) != 2) { 3630 snd_i2c_unlock(ice->i2c); 3631 return -EREMOTE; 3632 } 3633 ndata[shift >> 3] = data[shift >> 3] & ~(1 << (shift & 7)); 4026 3634 if (invert) { 4027 3635 if (! ucontrol->value.integer.value[0]) 4028 ndata |= (1 << shift);3636 ndata[shift >> 3] |= (1 << (shift & 7)); 4029 3637 } else { 4030 3638 if (ucontrol->value.integer.value[0]) 4031 ndata |= (1 << shift); 4032 } 4033 change = (data != ndata); 4034 if (change) { 4035 ndata &= 0xff; 4036 ndata |= (unsigned short)ice->cs8403_spdif_stream_bits << 8; 4037 snd_ice1712_ews88d_pcf8575_write(ice, ICE1712_EWS88D_PCF_ADDR, ndata); 4038 //printk("pcf: write 0x%x\n", ndata); 4039 } 3639 ndata[shift >> 3] |= (1 << (shift & 7)); 3640 } 3641 change = (data[shift >> 3] != ndata[shift >> 3]); 3642 if (change && snd_i2c_sendbytes(ice->pcf8575, data, 2) != 2) { 3643 snd_i2c_unlock(ice->i2c); 3644 return -EREMOTE; 3645 } 3646 snd_i2c_unlock(ice->i2c); 4040 3647 return change; 4041 3648 } 4042 3649 4043 3650 #ifdef TARGET_OS2 4044 #define EWS88D_CONTROL(xiface, xname, x index, xshift, xinvert, xaccess) \3651 #define EWS88D_CONTROL(xiface, xname, xshift, xinvert, xaccess) \ 4045 3652 { xiface,0,0,\ 4046 3653 xname, 0,\ … … 4052 3659 } 4053 3660 #else 4054 #define EWS88D_CONTROL(xiface, xname, x index, xshift, xinvert, xaccess) \3661 #define EWS88D_CONTROL(xiface, xname, xshift, xinvert, xaccess) \ 4055 3662 { iface: xiface,\ 4056 3663 name: xname,\ … … 4063 3670 #endif 4064 3671 4065 static snd_kcontrol_new_t snd_ice1712_ews88d_spdif_in_opt = 4066 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 0, 1, 0); /* inverted */ 4067 static snd_kcontrol_new_t snd_ice1712_ews88d_opt_out_adat = 4068 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 0, 1, 0, 0); 4069 static snd_kcontrol_new_t snd_ice1712_ews88d_master_adat = 4070 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 0, 2, 0, 0); 4071 static snd_kcontrol_new_t snd_ice1712_ews88d_adat_enable = 4072 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Enable ADAT", 0, 3, 0, 0); 4073 static snd_kcontrol_new_t snd_ice1712_ews88d_adat_through = 4074 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Through", 0, 4, 1, 0); 3672 static snd_kcontrol_new_t snd_ice1712_ews88d_controls[] __devinitdata = { 3673 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */ 3674 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0), 3675 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0), 3676 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Enable ADAT", 3, 0, 0), 3677 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Through", 4, 1, 0), 3678 }; 3679 3680 3681 /* 3682 * DMX 6Fire controls 3683 */ 3684 3685 #if 0 // XXX not working yet 3686 static int snd_ice1712_6fire_read_pca(ice1712_t *ice) 3687 { 3688 unsigned char byte; 3689 snd_i2c_lock(ice->i2c); 3690 byte = 0; /* read port */ 3691 snd_i2c_sendbytes(ice->pcf8575, &byte, 1); 3692 if (snd_i2c_readbytes(ice->pcf8575, &byte, 1) != 1) { 3693 snd_i2c_unlock(ice->i2c); 3694 return -EREMOTE; 3695 } 3696 snd_i2c_unlock(ice->i2c); 3697 return byte; 3698 } 3699 3700 static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char data) 3701 { 3702 unsigned char bytes[2]; 3703 snd_i2c_lock(ice->i2c); 3704 bytes[0] = 1; /* write port */ 3705 bytes[1] = data; 3706 if (snd_i2c_sendbytes(ice->pcf8575, bytes, 2) != 2) { 3707 snd_i2c_unlock(ice->i2c); 3708 return -EREMOTE; 3709 } 3710 snd_i2c_unlock(ice->i2c); 3711 return 0; 3712 } 3713 3714 static int snd_ice1712_6fire_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 3715 { 3716 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 3717 uinfo->count = 1; 3718 uinfo->value.integer.min = 0; 3719 uinfo->value.integer.max = 1; 3720 return 0; 3721 } 3722 3723 static int snd_ice1712_6fire_control_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 3724 { 3725 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3726 int shift = kcontrol->private_value & 0xff; 3727 int invert = (kcontrol->private_value >> 8) & 1; 3728 int data; 3729 3730 if ((data = snd_ice1712_6fire_read_pca(ice)) < 0) 3731 return data; 3732 data = (data >> shift) & 1; 3733 if (invert) 3734 data ^= 1; 3735 ucontrol->value.integer.value[0] = data; 3736 return 0; 3737 } 3738 3739 static int snd_ice1712_6fire_control_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 3740 { 3741 ice1712_t *ice = snd_kcontrol_chip(kcontrol); 3742 int shift = kcontrol->private_value & 0xff; 3743 int invert = (kcontrol->private_value >> 8) & 1; 3744 int data, ndata; 3745 3746 if ((data = snd_ice1712_6fire_read_pca(ice)) < 0) 3747 return data; 3748 ndata = data & ~(1 << shift); 3749 if (ucontrol->value.integer.value[0]) 3750 ndata |= (1 << shift); 3751 if (invert) 3752 ndata ^= (1 << shift); 3753 if (data != ndata) { 3754 snd_ice1712_6fire_write_pca(ice, (unsigned char)ndata); 3755 return 1; 3756 } 3757 return 0; 3758 } 3759 3760 #define DMX6FIRE_CONTROL(xiface, xname, xshift, xinvert, xaccess) \ 3761 { iface: xiface,\ 3762 name: xname,\ 3763 access: xaccess,\ 3764 info: snd_ice1712_6fire_control_info,\ 3765 get: snd_ice1712_6fire_control_get,\ 3766 put: snd_ice1712_6fire_control_put,\ 3767 private_value: xshift | (xinvert << 8),\ 3768 } 3769 3770 static snd_kcontrol_new_t snd_ice1712_6fire_led __devinitdata = 3771 DMX6FIRE_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Breakbox LED", 6, 0, 0); 3772 3773 #endif // XXX not working yet 4075 3774 4076 3775 … … 4079 3778 */ 4080 3779 4081 static unsigned char __ init snd_ice1712_read_i2c(ice1712_t *ice,3780 static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice, 4082 3781 unsigned char dev, 4083 3782 unsigned char addr) … … 4091 3790 } 4092 3791 4093 static int __ init snd_ice1712_read_eeprom(ice1712_t *ice)3792 static int __devinit snd_ice1712_read_eeprom(ice1712_t *ice) 4094 3793 { 4095 3794 int dev = 0xa0; /* EEPROM device address */ … … 4137 3836 } 4138 3837 4139 static void __init snd_ice1712_ak4524_init(ice1712_t *ice) 4140 { 4141 static unsigned char inits[8] = { 4142 0x07, /* 0: all power up */ 4143 0x03, /* 1: ADC/DAC reset */ 4144 0x60, /* 2: 24bit I2S */ 4145 0x19, /* 3: deemphasis off */ 4146 0x00, /* 4: ADC left muted */ 4147 0x00, /* 5: ADC right muted */ 4148 0x00, /* 6: DAC left muted */ 4149 0x00, /* 7: DAC right muted */ 3838 static void __devinit snd_ice1712_ak4524_init(ice1712_t *ice) 3839 { 3840 static unsigned char inits[] = { 3841 0x00, 0x07, /* 0: all power up */ 3842 0x01, 0x00, /* 1: ADC/DAC reset */ 3843 0x02, 0x60, /* 2: 24bit I2S */ 3844 0x03, 0x19, /* 3: deemphasis off */ 3845 0x01, 0x03, /* 1: ADC/DAC enable */ 3846 0x04, 0x00, /* 4: ADC left muted */ 3847 0x05, 0x00, /* 5: ADC right muted */ 3848 0x04, 0x80, /* 4: ADC IPGA gain 0dB */ 3849 0x05, 0x80, /* 5: ADC IPGA gain 0dB */ 3850 0x06, 0x00, /* 6: DAC left muted */ 3851 0x07, 0x00, /* 7: DAC right muted */ 3852 0xff, 0xff 4150 3853 }; 4151 int chip; 4152 unsigned char reg; 4153 4154 for (chip = 0; chip < ice->num_dacs/2; chip++) { 4155 for (reg = 0; reg < 8; ++reg) 4156 snd_ice1712_ak4524_write(ice, chip, reg, inits[reg]); 4157 } 4158 } 4159 4160 /* init CS8427 transciever */ 4161 static void __init snd_ice1712_cs8427_init(ice1712_t *ice) 4162 { 4163 static unsigned char initvals[] = { 4164 /* RMCK to OMCK, no validity, disable mutes, TCBL=output */ 4165 0x80, 4166 /* hold last valid audio sample, RMCK=256*Fs, normal stereo operation */ 4167 0x00, 4168 /* output drivers normal operation, Tx<=serial, Rx=>serial */ 4169 0x0c, 4170 /* Run off, CMCK=256*Fs, output time base = OMCK, input time base = 4171 covered input clock, recovered input clock source is Envy24 */ 4172 0x04, 4173 /* Serial audio input port data format = I2S */ 4174 0x05, /* SIDEL=1, SILRPOL=1 */ 4175 /* Serial audio output port data format = I2S */ 4176 0x05, /* SODEL=1, SOLRPOL=1 */ 4177 }; 4178 unsigned char buf[32]; 4179 4180 /* verify CS8427 ID */ 4181 if (ice->cs8427_ops->read(ice, 127) != 0x71) { 4182 snd_printk("unable to find CS8427 signature, initialization is not completed\n"); 4183 return; 4184 } 4185 /* turn off run bit while making changes to configuration */ 4186 ice->cs8427_ops->write(ice, 4, 0x00); 4187 /* send initial values */ 4188 ice->cs8427_ops->write_bytes(ice, 1, 6, initvals); 4189 /* Turn off CS8427 interrupt stuff that is not used in hardware */ 4190 memset(buf, 0, sizeof(buf)); 4191 /* from address 9 to 15 */ 4192 ice->cs8427_ops->write_bytes(ice, 9, 7, buf); 4193 /* unmask the input PLL clock, V, confidence, biphase, parity status bits */ 4194 //buf[0] = 0x1f; 4195 buf[0] = 0; 4196 /* Registers 32-55 window to CS buffer 4197 Inhibit D->E transfers from overwriting first 5 bytes of CS data. 4198 Allow D->E transfers (all) of CS data. 4199 Allow E->F transfer of CS data. 4200 One byte mode; both A/B channels get same written CB data. 4201 A channel info is output to chip's EMPH* pin. */ 4202 buf[1] = 0x10; 4203 /* Use internal buffer to transmit User (U) data. 4204 Chip's U pin is an output. 4205 Transmit all O's for user data. */ 4206 //buf[2] = 0x10; 4207 buf[2] = 0x00; 4208 ice->cs8427_ops->write_bytes(ice, 17, 3, buf); 4209 /* turn on run bit and rock'n'roll */ 4210 ice->cs8427_ops->write(ice, 4, initvals[3] | 0x40); 4211 /* write default channel status bytes */ 4212 ice->cs8427_ops->write_bytes(ice, 32, 5, ice->cs8427_spdif_status); 4213 4214 /* 4215 * add controls.. 4216 */ 4217 snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_cs8427_in_status, ice)); 4218 #if 0 4219 snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_cs8427_clock_select, ice)); 4220 #endif 4221 } 4222 4223 static void __init snd_ice1712_stdsp24_gpio_write(ice1712_t *ice, unsigned char byte) 3854 int chip, idx; 3855 unsigned char *ptr, reg, data; 3856 3857 for (chip = idx = 0; chip < ice->num_dacs/2; chip++) { 3858 ptr = inits; 3859 while (*ptr != 0xff) { 3860 reg = *ptr++; 3861 data = *ptr++; 3862 if (ice->ak4528) { 3863 if (reg > 5) 3864 continue; 3865 if (reg >= 4 && (data & 0x80)) 3866 continue; 3867 } 3868 if (reg == 0x03 && ice->ak4528) 3869 data = 0x0d; /* deemphasis off, turn LR highpass filters on */ 3870 snd_ice1712_ak4524_write(ice, chip, reg, data); 3871 } 3872 } 3873 } 3874 3875 static void __devinit snd_ice1712_stdsp24_gpio_write(ice1712_t *ice, unsigned char byte) 4224 3876 { 4225 3877 byte |= ICE1712_STDSP24_CLOCK_BIT; … … 4234 3886 } 4235 3887 4236 static void __ init snd_ice1712_stdsp24_darear(ice1712_t *ice, int activate)3888 static void __devinit snd_ice1712_stdsp24_darear(ice1712_t *ice, int activate) 4237 3889 { 4238 3890 down(&ice->gpio_mutex); … … 4242 3894 } 4243 3895 4244 static void __ init snd_ice1712_stdsp24_mute(ice1712_t *ice, int activate)3896 static void __devinit snd_ice1712_stdsp24_mute(ice1712_t *ice, int activate) 4245 3897 { 4246 3898 down(&ice->gpio_mutex); … … 4250 3902 } 4251 3903 4252 static void __ init snd_ice1712_stdsp24_insel(ice1712_t *ice, int activate)3904 static void __devinit snd_ice1712_stdsp24_insel(ice1712_t *ice, int activate) 4253 3905 { 4254 3906 down(&ice->gpio_mutex); … … 4258 3910 } 4259 3911 4260 static void __ init snd_ice1712_stdsp24_box_channel(ice1712_t *ice, int box, int chn, int activate)3912 static void __devinit snd_ice1712_stdsp24_box_channel(ice1712_t *ice, int box, int chn, int activate) 4261 3913 { 4262 3914 down(&ice->gpio_mutex); … … 4305 3957 } 4306 3958 4307 static void __ init snd_ice1712_stdsp24_box_midi(ice1712_t *ice, int box, int master, int slave)3959 static void __devinit snd_ice1712_stdsp24_box_midi(ice1712_t *ice, int box, int master, int slave) 4308 3960 { 4309 3961 down(&ice->gpio_mutex); … … 4336 3988 } 4337 3989 4338 static void __ init snd_ice1712_stdsp24_init(ice1712_t *ice)3990 static void __devinit snd_ice1712_stdsp24_init(ice1712_t *ice) 4339 3991 { 4340 3992 int box, chn; … … 4394 4046 } 4395 4047 4396 static int __init snd_ice1712_chip_init(ice1712_t *ice) 4397 { 4048 static int __devinit snd_ice1712_chip_init(ice1712_t *ice) 4049 { 4050 int err, has_i2c = 0; 4051 4398 4052 outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL)); 4399 4053 udelay(200); … … 4426 4080 } 4427 4081 4082 /* determine I2C, DACs and ADCs */ 4428 4083 switch (ice->eeprom.subvendor) { 4429 4084 case ICE1712_SUBDEVICE_AUDIOPHILE: 4085 ice->ak4528 = 1; 4086 /* follow thru */ 4430 4087 case ICE1712_SUBDEVICE_EWX2496: 4431 ice->num_adcs = ice->num_dacs = 2; 4088 has_i2c = 1; 4089 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 2; 4432 4090 break; 4433 4091 case ICE1712_SUBDEVICE_DELTA44: 4434 4092 case ICE1712_SUBDEVICE_DELTA66: 4435 ice->num_adcs = ice->num_dacs = 4; 4093 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 4; 4094 if (ice->omni) 4095 ice->num_total_dacs = 8; 4436 4096 break; 4437 4097 case ICE1712_SUBDEVICE_EWS88MT: 4438 ice->num_adcs = ice->num_dacs = 8; 4439 break; 4440 } 4441 4098 has_i2c = 1; 4099 /* follow thru */ 4100 case ICE1712_SUBDEVICE_DELTA1010: 4101 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 8; 4102 break; 4103 case ICE1712_SUBDEVICE_EWS88D: 4104 has_i2c = 1; 4105 break; 4106 case ICE1712_SUBDEVICE_DMX6FIRE: 4107 has_i2c = 1; 4108 ice->num_adcs = ice->num_dacs = ice->num_total_dacs = 6; 4109 break; 4110 } 4111 4112 if (has_i2c) { 4113 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { 4114 snd_printk("unable to create I2C bus\n"); 4115 return err; 4116 } 4117 ice->i2c->private_data = ice; 4118 switch (ice->eeprom.subvendor) { 4119 case ICE1712_SUBDEVICE_AUDIOPHILE: 4120 ice->i2c->ops = &ap_cs8427_i2c_ops; 4121 break; 4122 case ICE1712_SUBDEVICE_EWX2496: 4123 case ICE1712_SUBDEVICE_EWS88MT: 4124 case ICE1712_SUBDEVICE_EWS88D: 4125 case ICE1712_SUBDEVICE_DMX6FIRE: 4126 ice->i2c->hw_ops.bit = &snd_ice1712_ewx_cs8427_bit_ops; 4127 break; 4128 } 4129 switch (ice->eeprom.subvendor) { 4130 case ICE1712_SUBDEVICE_AUDIOPHILE: 4131 case ICE1712_SUBDEVICE_EWX2496: 4132 if ((err = snd_cs8427_create(ice->i2c, CS8427_BASE_ADDR, &ice->cs8427)) < 0) { 4133 snd_printk("CS8427 initialization failed\n"); 4134 return err; 4135 } 4136 break; 4137 case ICE1712_SUBDEVICE_DMX6FIRE: 4138 #if 0 // XXX not working yet 4139 if ((err = snd_i2c_device_create(ice->i2c, "PCF9554", 0x40>>1, &ice->pcf8575)) < 0) 4140 return err; 4141 if ((err = snd_cs8427_create(ice->i2c, 0x11, &ice->cs8427)) < 0) { 4142 snd_printk("CS8427 initialization failed\n"); 4143 return err; 4144 } 4145 #endif // XXX not working yet 4146 break; 4147 case ICE1712_SUBDEVICE_EWS88MT: 4148 if ((err = snd_i2c_device_create(ice->i2c, "CS8404", ICE1712_EWS88MT_CS8404_ADDR, &ice->cs8404)) < 0) 4149 return err; 4150 if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)", ICE1712_EWS88MT_INPUT_ADDR, &ice->pcf8574[0])) < 0) 4151 return err; 4152 if ((err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)", ICE1712_EWS88MT_OUTPUT_ADDR, &ice->pcf8574[1])) < 0) 4153 return err; 4154 break; 4155 case ICE1712_SUBDEVICE_EWS88D: 4156 if ((err = snd_i2c_device_create(ice->i2c, "PCF8575", ICE1712_EWS88D_PCF_ADDR, &ice->pcf8575)) < 0) 4157 return err; 4158 break; 4159 } 4160 } 4161 /* second stage of initialization, analog parts and others */ 4442 4162 switch (ice->eeprom.subvendor) { 4443 4163 case ICE1712_SUBDEVICE_DELTA66: … … 4446 4166 case ICE1712_SUBDEVICE_EWX2496: 4447 4167 case ICE1712_SUBDEVICE_EWS88MT: 4168 case ICE1712_SUBDEVICE_DMX6FIRE: 4448 4169 snd_ice1712_ak4524_init(ice); 4449 4170 break; … … 4467 4188 snd_ice1712_delta_cs8403_spdif_write(ice, ice->cs8403_spdif_bits); 4468 4189 break; 4190 } 4191 switch (ice->eeprom.subvendor) { 4469 4192 case ICE1712_SUBDEVICE_EWS88MT: 4470 4193 case ICE1712_SUBDEVICE_EWS88D: … … 4488 4211 if (err < 0) 4489 4212 return err; 4490 for (idx = 0; idx < ice->num_ dacs; idx++) {4213 for (idx = 0; idx < ice->num_total_dacs; idx++) { 4491 4214 kctl = snd_ctl_new1(&snd_ice1712_mixer_pro_analog_route, ice); 4492 4215 if (kctl == NULL) … … 4570 4293 case ICE1712_SUBDEVICE_DELTA66: 4571 4294 case ICE1712_SUBDEVICE_EWS88MT: 4295 case ICE1712_SUBDEVICE_DMX6FIRE: 4572 4296 for (idx = 0; idx < ice->num_dacs; ++idx) { 4573 4297 snd_kcontrol_t ctl; … … 4580 4304 ctl.get = snd_ice1712_ak4524_volume_get; 4581 4305 ctl.put = snd_ice1712_ak4524_volume_put; 4582 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 6; /* reigster 6 & 7 */ 4306 if (ice->ak4528) 4307 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */ 4308 else 4309 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 6; /* register 6 & 7 */ 4583 4310 ctl.private_data = ice; 4584 4311 if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0) 4585 4312 return err; 4586 4313 } 4587 for (idx = 0; idx < ice->num_adcs ; ++idx) {4314 for (idx = 0; idx < ice->num_adcs && !ice->ak4528; ++idx) { 4588 4315 snd_kcontrol_t ctl; 4589 4316 memset(&ctl, 0, sizeof(ctl)); … … 4595 4322 ctl.get = snd_ice1712_ak4524_volume_get; 4596 4323 ctl.put = snd_ice1712_ak4524_volume_put; 4597 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* reigster 4 & 5 */ 4324 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */ 4325 ctl.private_data = ice; 4326 if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0) 4327 return err; 4328 memset(&ctl, 0, sizeof(ctl)); 4329 strcpy(ctl.id.name, "IPGA Analog Capture Volume"); 4330 ctl.id.index = idx; 4331 ctl.id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 4332 ctl.info = snd_ice1712_ak4524_ipga_gain_info; 4333 ctl.access = SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE; 4334 ctl.get = snd_ice1712_ak4524_ipga_gain_get; 4335 ctl.put = snd_ice1712_ak4524_ipga_gain_put; 4336 ctl.private_value = (idx / 2) * 8 + (idx % 2) + 4; /* register 4 & 5 */ 4598 4337 ctl.private_data = ice; 4599 4338 if ((err = snd_ctl_add(ice->card, snd_ctl_new(&ctl))) < 0) … … 4638 4377 break; 4639 4378 case ICE1712_SUBDEVICE_EWS88D: 4640 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_spdif_in_opt, ice)); 4379 for (idx = 0; idx < sizeof(snd_ice1712_ews88d_controls)/sizeof(snd_ice1712_ews88d_controls[0]); idx++) { 4380 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice)); 4641 4381 if (err < 0) 4642 4382 return err; 4643 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_opt_out_adat, ice)); 4383 } 4384 break; 4385 case ICE1712_SUBDEVICE_DMX6FIRE: 4386 #if 0 // XXX not working yet 4387 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_led, ice)); 4644 4388 if (err < 0) 4645 4389 return err; 4646 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_master_adat, ice)); 4647 if (err < 0) 4648 return err; 4649 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_adat_enable, ice)); 4650 if (err < 0) 4651 return err; 4652 err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_adat_through, ice)); 4653 if (err < 0) 4654 return err; 4655 break; 4656 } 4657 4658 return 0; 4659 } 4660 4661 static int __exit snd_ice1712_free(ice1712_t *ice) 4390 #endif 4391 break; 4392 } 4393 4394 return 0; 4395 } 4396 4397 static int snd_ice1712_free(ice1712_t *ice) 4662 4398 { 4663 4399 if (ice->res_port == NULL) … … 4672 4408 if (ice->irq) 4673 4409 free_irq(ice->irq, (void *) ice); 4674 if (ice->res_port) 4410 if (ice->res_port) { 4675 4411 release_resource(ice->res_port); 4676 if (ice->res_ddma_port) 4412 kfree_nocheck(ice->res_port); 4413 } 4414 if (ice->res_ddma_port) { 4677 4415 release_resource(ice->res_ddma_port); 4678 if (ice->res_dmapath_port) 4416 kfree_nocheck(ice->res_ddma_port); 4417 } 4418 if (ice->res_dmapath_port) { 4679 4419 release_resource(ice->res_dmapath_port); 4680 if (ice->res_profi_port) 4420 kfree_nocheck(ice->res_dmapath_port); 4421 } 4422 if (ice->res_profi_port) { 4681 4423 release_resource(ice->res_profi_port); 4424 kfree_nocheck(ice->res_profi_port); 4425 } 4682 4426 snd_magic_kfree(ice); 4683 4427 return 0; 4684 4428 } 4685 4429 4686 static int __exitsnd_ice1712_dev_free(snd_device_t *device)4430 static int snd_ice1712_dev_free(snd_device_t *device) 4687 4431 { 4688 4432 ice1712_t *ice = snd_magic_cast(ice1712_t, device->device_data, return -ENXIO); … … 4690 4434 } 4691 4435 4692 static int __ init snd_ice1712_create(snd_card_t * card,4436 static int __devinit snd_ice1712_create(snd_card_t * card, 4693 4437 struct pci_dev *pci, 4438 int omni, 4694 4439 ice1712_t ** r_ice1712) 4695 4440 { … … 4705 4450 }; 4706 4451 #endif 4452 4707 4453 *r_ice1712 = NULL; 4708 4454 … … 4720 4466 if (ice == NULL) 4721 4467 return -ENOMEM; 4468 ice->omni = omni ? 1 : 0; 4722 4469 spin_lock_init(&ice->reg_lock); 4723 4470 init_MUTEX(&ice->gpio_mutex); … … 4726 4473 0x10 | /* no emphasis */ 4727 4474 0x20); /* PCM encoder/decoder */ 4728 ice->cs8427_spdif_status[0] = (SNDRV_PCM_DEFAULT_CON_SPDIF >> 0) & 0xff;4729 ice->cs8427_spdif_status[1] = (SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff;4730 ice->cs8427_spdif_status[2] = (SNDRV_PCM_DEFAULT_CON_SPDIF >> 16) & 0xff;4731 ice->cs8427_spdif_status[3] = (SNDRV_PCM_DEFAULT_CON_SPDIF >> 24) & 0xff;4732 memcpy(ice->cs8427_spdif_stream_status, ice->cs8427_spdif_status, 5);4733 4475 ice->card = card; 4734 4476 ice->pci = pci; … … 4795 4537 } 4796 4538 4797 static int __ init snd_ice1712_probe(struct pci_dev *pci,4539 static int __devinit snd_ice1712_probe(struct pci_dev *pci, 4798 4540 const struct pci_device_id *id) 4799 4541 { … … 4803 4545 int pcm_dev = 0, err; 4804 4546 4805 for ( ; dev < SNDRV_CARDS; dev++) { 4547 if (dev >= SNDRV_CARDS) 4548 return -ENODEV; 4806 4549 if (!snd_enable[dev]) { 4807 4550 dev++; 4808 4551 return -ENOENT; 4809 4552 } 4810 break;4811 }4812 if (dev >= SNDRV_CARDS)4813 return -ENODEV;4814 4553 4815 4554 card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0); … … 4817 4556 return -ENOMEM; 4818 4557 4819 if ((err = snd_ice1712_create(card, pci, &ice)) < 0) {4558 if ((err = snd_ice1712_create(card, pci, snd_omni[dev], &ice)) < 0) { 4820 4559 snd_card_free(card); 4821 4560 return err; … … 4880 4619 strcpy(card->shortname, "TerraTec EWS 88D"); 4881 4620 break; 4621 case ICE1712_SUBDEVICE_DMX6FIRE: 4622 strcpy(card->shortname, "TerraTec DMX 6Fire"); 4623 break; 4882 4624 } 4883 4625 … … 4907 4649 return err; 4908 4650 } 4909 PCI_SET_DRIVER_DATA(pci, card);4651 pci_set_drvdata(pci, card); 4910 4652 dev++; 4911 4653 return 0; 4912 4654 } 4913 4655 4914 static void __ exit snd_ice1712_remove(struct pci_dev *pci)4915 { 4916 snd_card_free( PCI_GET_DRIVER_DATA(pci));4917 PCI_SET_DRIVER_DATA(pci, NULL);4656 static void __devexit snd_ice1712_remove(struct pci_dev *pci) 4657 { 4658 snd_card_free(pci_get_drvdata(pci)); 4659 pci_set_drvdata(pci, NULL); 4918 4660 } 4919 4661 … … 4930 4672 id_table: snd_ice1712_ids, 4931 4673 probe: snd_ice1712_probe, 4932 remove: snd_ice1712_remove,4674 remove: __devexit_p(snd_ice1712_remove), 4933 4675 }; 4934 4676 #endif … … 4940 4682 if ((err = pci_module_init(&driver)) < 0) { 4941 4683 #ifdef MODULE 4942 snd_printk("ICE1712 soundcard not found or device busy\n");4684 printk(KERN_ERR "ICE1712 soundcard not found or device busy\n"); 4943 4685 #endif 4944 4686 return err; … … 4957 4699 #ifndef MODULE 4958 4700 4959 /* format is: snd- card-ice1712=snd_enable,snd_index,snd_id */4701 /* format is: snd-ice1712=snd_enable,snd_index,snd_id */ 4960 4702 4961 4703 static int __init alsa_card_ice1712_setup(char *str) … … 4972 4714 } 4973 4715 4974 __setup("snd- card-ice1712=", alsa_card_ice1712_setup);4716 __setup("snd-ice1712=", alsa_card_ice1712_setup); 4975 4717 4976 4718 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c
r77 r92 2924 2924 if ((err = pci_module_init(&driver)) < 0) { 2925 2925 #ifdef MODULE 2926 // snd_printk("Maestro3/Allegro soundcard not found or device busy\n");2926 // snd_printk(KERN_ERR "Maestro3/Allegro soundcard not found or device busy\n"); 2927 2927 #endif 2928 2928 return err; -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c
r32 r92 20 20 * You should have received a copy of the GNU General Public License 21 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 23 * 24 24 */ 25 25 26 #define SNDRV_MAIN_OBJECT_FILE27 28 26 #include <sound/driver.h> 27 #include <asm/io.h> 28 #include <linux/delay.h> 29 #include <linux/init.h> 30 #include <linux/slab.h> 31 #include <sound/core.h> 29 32 #include <sound/info.h> 30 33 #include <sound/control.h> 31 34 #include <sound/pcm.h> 35 #include <sound/asoundef.h> 32 36 #define SNDRV_GET_ID 33 37 #include <sound/initval.h> … … 35 39 /* note, two last pcis should be equal, it is not a bug */ 36 40 EXPORT_NO_SYMBOLS; 41 42 MODULE_AUTHOR("Anders Torger <torger@ludd.luth.se>"); 37 43 MODULE_DESCRIPTION("RME Digi96, Digi96/8, Digi96/8 PRO, Digi96/8 PST, " 38 44 "Digi96/8 PAD"); 45 MODULE_LICENSE("GPL"); 39 46 MODULE_CLASSES("{sound}"); 40 47 MODULE_DEVICES("{{RME,Digi96}," … … 240 247 size_t capture_periodsize; /* in bytes, zero if not used */ 241 248 249 snd_pcm_uframes_t playback_last_appl_ptr; 242 250 size_t playback_ptr; 243 251 size_t capture_ptr; … … 693 701 } 694 702 695 696 static int697 snd_rme96_playback_getrate(rme96_t *rme96)698 {699 int rate;700 701 rate = ((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_0) & 1) +702 (((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_1) & 1) << 1);703 switch (rate) {704 case 1:705 rate = 32000;706 break;707 case 2:708 rate = 44100;709 break;710 case 3:711 rate = 48000;712 break;713 default:714 return -1;715 }716 return (rme96->wcreg & RME96_WCR_DS) ? rate << 1 : rate;717 }718 719 703 static int 720 704 snd_rme96_capture_getrate(rme96_t *rme96, … … 781 765 782 766 static int 767 snd_rme96_playback_getrate(rme96_t *rme96) 768 { 769 int rate, dummy; 770 771 if (!(rme96->wcreg & RME96_WCR_MASTER) && 772 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0) 773 { 774 /* slave clock */ 775 return rate; 776 } 777 rate = ((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_0) & 1) + 778 (((rme96->wcreg >> RME96_WCR_BITPOS_FREQ_1) & 1) << 1); 779 switch (rate) { 780 case 1: 781 rate = 32000; 782 break; 783 case 2: 784 rate = 44100; 785 break; 786 case 3: 787 rate = 48000; 788 break; 789 default: 790 return -1; 791 } 792 return (rme96->wcreg & RME96_WCR_DS) ? rate << 1 : rate; 793 } 794 795 static int 783 796 snd_rme96_playback_setrate(rme96_t *rme96, 784 797 int rate) … … 930 943 break; 931 944 case RME96_INPUT_XLR: 932 if ( rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST ||933 rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PRO||945 if ((rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && 946 rme96->pci->device != PCI_DEVICE_ID_DIGI96_8_PRO) || 934 947 (rme96->pci->device == PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST && 935 948 rme96->rev > 4)) … … 1160 1173 int from_pause) 1161 1174 { 1162 snd_pcm_runtime_t *runtime = rme96->playback_substream->runtime;1163 1164 1175 if (!from_pause) { 1165 1176 writel(0, rme96->iobase + RME96_IO_RESET_PLAY_POS); 1166 if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) { 1167 memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER, 1168 runtime->dma_area, 1169 rme96->playback_periodsize); 1170 rme96->playback_ptr = rme96->playback_periodsize; 1171 } 1177 rme96->playback_last_appl_ptr = 0; 1178 rme96->playback_ptr = 0; 1172 1179 } 1173 1180 … … 1182 1189 if (!from_pause) { 1183 1190 writel(0, rme96->iobase + RME96_IO_RESET_REC_POS); 1191 rme96->capture_ptr = 0; 1184 1192 } 1185 1193 … … 1220 1228 { 1221 1229 rme96_t *rme96 = (rme96_t *)dev_id; 1222 snd_pcm_runtime_t *runtime;1223 1230 1224 1231 rme96->rcreg = readl(rme96->iobase + RME96_IO_CONTROL_REGISTER); … … 1232 1239 if (rme96->rcreg & RME96_RCR_IRQ) { 1233 1240 /* playback */ 1234 runtime = rme96->playback_substream->runtime;1235 if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) {1236 memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER +1237 rme96->playback_ptr,1238 runtime->dma_area + rme96->playback_ptr,1239 rme96->playback_periodsize);1240 rme96->playback_ptr += rme96->playback_periodsize;1241 if (rme96->playback_ptr == RME96_BUFFER_SIZE) {1242 rme96->playback_ptr = 0;1243 }1244 }1245 1241 snd_pcm_period_elapsed(rme96->playback_substream); 1246 1242 writel(0, rme96->iobase + RME96_IO_CONFIRM_PLAY_IRQ); … … 1248 1244 if (rme96->rcreg & RME96_RCR_IRQ_2) { 1249 1245 /* capture */ 1250 runtime = rme96->capture_substream->runtime;1251 if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) {1252 memcpy_fromio(runtime->dma_area + rme96->capture_ptr,1253 rme96->iobase + RME96_IO_REC_BUFFER +1254 rme96->capture_ptr,1255 rme96->capture_periodsize);1256 rme96->capture_ptr += rme96->capture_periodsize;1257 if (rme96->capture_ptr == RME96_BUFFER_SIZE) {1258 rme96->capture_ptr = 0;1259 }1260 }1261 1246 snd_pcm_period_elapsed(rme96->capture_substream); 1262 1247 writel(0, rme96->iobase + RME96_IO_CONFIRM_REC_IRQ); … … 1295 1280 writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); 1296 1281 rme96->playback_substream = substream; 1282 rme96->playback_last_appl_ptr = 0; 1297 1283 rme96->playback_ptr = 0; 1298 1284 spin_unlock_irqrestore(&rme96->lock, flags); … … 1354 1340 writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); 1355 1341 rme96->playback_substream = substream; 1342 rme96->playback_last_appl_ptr = 0; 1356 1343 rme96->playback_ptr = 0; 1357 1344 spin_unlock_irqrestore(&rme96->lock, flags); … … 1547 1534 { 1548 1535 rme96_t *rme96 = _snd_pcm_substream_chip(substream); 1536 snd_pcm_runtime_t *runtime = substream->runtime; 1537 snd_pcm_sframes_t diff; 1538 size_t bytes; 1539 1540 if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) { 1541 diff = runtime->control->appl_ptr - 1542 rme96->playback_last_appl_ptr; 1543 rme96->playback_last_appl_ptr = runtime->control->appl_ptr; 1544 if (diff != 0 && 1545 diff < -(snd_pcm_sframes_t)(runtime->boundary >> 1)) 1546 { 1547 diff += runtime->boundary; 1548 } 1549 bytes = diff << rme96->playback_frlog; 1550 1551 if (bytes > RME96_BUFFER_SIZE - rme96->playback_ptr) { 1552 memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + 1553 rme96->playback_ptr, 1554 runtime->dma_area + rme96->playback_ptr, 1555 RME96_BUFFER_SIZE - rme96->playback_ptr); 1556 bytes -= RME96_BUFFER_SIZE - rme96->playback_ptr; 1557 if (bytes > RME96_BUFFER_SIZE) { 1558 bytes = RME96_BUFFER_SIZE; 1559 } 1560 memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER, 1561 runtime->dma_area, 1562 bytes); 1563 rme96->playback_ptr = bytes; 1564 } else if (bytes != 0) { 1565 memcpy_toio(rme96->iobase + RME96_IO_PLAY_BUFFER + 1566 rme96->playback_ptr, 1567 runtime->dma_area + rme96->playback_ptr, 1568 bytes); 1569 rme96->playback_ptr += bytes; 1570 } 1571 } 1549 1572 return snd_rme96_playback_ptr(rme96); 1550 1573 } … … 1554 1577 { 1555 1578 rme96_t *rme96 = _snd_pcm_substream_chip(substream); 1556 return snd_rme96_capture_ptr(rme96); 1579 snd_pcm_runtime_t *runtime = substream->runtime; 1580 snd_pcm_uframes_t frameptr; 1581 size_t ptr; 1582 1583 frameptr = snd_rme96_capture_ptr(rme96); 1584 if (runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) { 1585 ptr = frameptr << rme96->capture_frlog; 1586 if (ptr > rme96->capture_ptr) { 1587 memcpy_fromio(runtime->dma_area + rme96->capture_ptr, 1588 rme96->iobase + RME96_IO_REC_BUFFER + 1589 rme96->capture_ptr, 1590 ptr - rme96->capture_ptr); 1591 rme96->capture_ptr += ptr - rme96->capture_ptr; 1592 } else if (ptr < rme96->capture_ptr) { 1593 memcpy_fromio(runtime->dma_area + rme96->capture_ptr, 1594 rme96->iobase + RME96_IO_REC_BUFFER + 1595 rme96->capture_ptr, 1596 RME96_BUFFER_SIZE - rme96->capture_ptr); 1597 memcpy_fromio(runtime->dma_area, 1598 rme96->iobase + RME96_IO_REC_BUFFER, 1599 ptr); 1600 rme96->capture_ptr = ptr; 1601 } 1602 } 1603 return frameptr; 1557 1604 } 1558 1605 … … 1683 1730 if (rme96->res_port != NULL) { 1684 1731 release_resource(rme96->res_port); 1732 kfree_nocheck(rme96->res_port); 1685 1733 rme96->res_port = NULL; 1686 1734 } … … 2614 2662 } 2615 2663 2616 static int __ init2664 static int __devinit 2617 2665 snd_rme96_probe(struct pci_dev *pci, 2618 2666 const struct pci_device_id *id) … … 2624 2672 u8 val; 2625 2673 2626 for ( ; dev < SNDRV_CARDS; dev++) { 2674 if (dev >= SNDRV_CARDS) { 2675 return -ENODEV; 2676 } 2627 2677 if (!snd_enable[dev]) { 2628 2678 dev++; 2629 2679 return -ENOENT; 2630 }2631 break;2632 }2633 if (dev >= SNDRV_CARDS) {2634 return -ENODEV;2635 2680 } 2636 2681 if ((card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, … … 2673 2718 return err; 2674 2719 } 2675 PCI_SET_DRIVER_DATA(pci, card);2720 pci_set_drvdata(pci, card); 2676 2721 dev++; 2677 2722 return 0; 2678 2723 } 2679 2724 2680 static void __ exit snd_rme96_remove(struct pci_dev *pci)2681 { 2682 snd_card_free( PCI_GET_DRIVER_DATA(pci));2683 PCI_SET_DRIVER_DATA(pci, NULL);2725 static void __devexit snd_rme96_remove(struct pci_dev *pci) 2726 { 2727 snd_card_free(pci_get_drvdata(pci)); 2728 pci_set_drvdata(pci, NULL); 2684 2729 } 2685 2730 … … 2696 2741 id_table: snd_rme96_ids, 2697 2742 probe: snd_rme96_probe, 2698 remove: snd_rme96_remove,2743 remove: __devexit_p(snd_rme96_remove), 2699 2744 }; 2700 2745 #endif … … 2706 2751 if ((err = pci_module_init(&driver)) < 0) { 2707 2752 #ifdef MODULE 2708 // snd_printk( "No RME Digi96 cards found\n");2753 // snd_printk(KERN_ERR "No RME Digi96 cards found\n"); 2709 2754 #endif 2710 2755 return err; … … 2723 2768 #ifndef MODULE 2724 2769 2725 /* format is: snd- card-rme96=snd_enable,snd_index,snd_id */2770 /* format is: snd-rme96=snd_enable,snd_index,snd_id */ 2726 2771 2727 2772 static int __init alsa_card_rme96_setup(char *str) … … 2738 2783 } 2739 2784 2740 __setup("snd- card-rme96=", alsa_card_rme96_setup);2785 __setup("snd-rme96=", alsa_card_rme96_setup); 2741 2786 2742 2787 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c
r32 r92 17 17 * You should have received a copy of the GNU General Public License 18 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 * 21 21 */ 22 22 23 #define SNDRV_MAIN_OBJECT_FILE24 23 #include <sound/driver.h> 24 #include <asm/io.h> 25 #include <linux/delay.h> 26 #include <linux/init.h> 27 #include <linux/slab.h> 28 #include <sound/core.h> 25 29 #include <sound/control.h> 26 30 #include <sound/pcm.h> 27 31 #include <sound/info.h> 32 #include <sound/asoundef.h> 28 33 #define SNDRV_GET_ID 29 34 #include <sound/initval.h> … … 31 36 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 32 37 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 33 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 38 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 39 static int snd_precise_ptr[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 0 }; /* Enable precise pointer */ 34 40 35 41 EXPORT_NO_SYMBOLS; … … 43 49 MODULE_PARM_DESC(snd_enable, "Enable/disable specific RME96{52,36} soundcards."); 44 50 MODULE_PARM_SYNTAX(snd_enable, SNDRV_ENABLE_DESC); 51 MODULE_PARM(snd_precise_ptr, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 52 MODULE_PARM_DESC(snd_precise_ptr, "Enable precise pointer (doesn't work reliably)."); 53 MODULE_PARM_SYNTAX(snd_precise_ptr, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC); 45 54 MODULE_AUTHOR("Paul Davis <pbd@op.net>, Winfried Ritsch"); 46 55 MODULE_DESCRIPTION("RME Digi9652/Digi9636"); 56 MODULE_LICENSE("GPL"); 47 57 MODULE_CLASSES("{sound}"); 48 58 MODULE_DEVICES("{{RME,Hammerfall}," … … 206 216 unsigned long iobase; 207 217 218 int precise_ptr; 219 208 220 u32 control_register; /* cached value */ 209 221 u32 thru_bits; /* thru 1=on, 0=off channel 1=Bit1... channel 26= Bit26 */ … … 349 361 rme9652->hw_offsetmask = 350 362 (rme9652->period_bytes * 2 - 1) & RME9652_buf_pos; 351 rme9652->max_jitter = 16 + (rme9652->period_bytes <= 1024 ? 32 : 64);352 } 353 354 static inlinesnd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652)363 rme9652->max_jitter = 80; 364 } 365 366 static snd_pcm_uframes_t rme9652_hw_pointer(rme9652_t *rme9652) 355 367 { 356 368 int status; … … 360 372 361 373 status = rme9652_read(rme9652, RME9652_status_register); 374 if (!rme9652->precise_ptr) 375 return (status & RME9652_buffer_id) ? period_size : 0; 362 376 offset = status & RME9652_buf_pos; 363 377 … … 379 393 if (offset > rme9652->max_jitter) { 380 394 if (frag) 381 printk( "Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n", status, offset);395 printk(KERN_ERR "Unexpected hw_pointer position (bufid == 0): status: %x offset: %d\n", status, offset); 382 396 } else if (!frag) 383 397 return 0; … … 388 402 if (offset > period_size + rme9652->max_jitter) { 389 403 if (!frag) 390 printk( "Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n", status, offset);404 printk(KERN_ERR "Unexpected hw_pointer position (bufid == 1): status: %x offset: %d\n", status, offset); 391 405 } else if (frag) 392 406 return period_size; … … 1732 1746 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", 1733 1747 rme9652->irq, rme9652->port, rme9652->iobase); 1748 snd_iprintf(buffer, "Control register: %x\n", rme9652->control_register); 1734 1749 1735 1750 snd_iprintf(buffer, "\n"); … … 1948 1963 if (rme9652->iobase) 1949 1964 iounmap((void *) rme9652->iobase); 1950 if (rme9652->res_port) 1965 if (rme9652->res_port) { 1951 1966 release_resource(rme9652->res_port); 1967 kfree_nocheck(rme9652->res_port); 1968 } 1952 1969 if (rme9652->irq >= 0) 1953 1970 free_irq(rme9652->irq, (void *)rme9652); … … 1985 2002 } 1986 2003 1987 snd_printk("%s: no buffers available\n", 1988 rme9652->card_name); 2004 printk(KERN_ERR "%s: no buffers available\n", rme9652->card_name); 1989 2005 return -ENOMEM; 1990 2006 } … … 1999 2015 /* Align to bus-space 64K boundary */ 2000 2016 2001 cb_bus = cb_addr; 2002 cb_bus = (cb_bus + 0xFFFF) & ~0xFFFFl; 2003 2004 pb_bus = pb_addr; 2005 pb_bus = (pb_bus + 0xFFFF) & ~0xFFFFl; 2017 cb_bus = (cb_addr + 0xFFFF) & ~0xFFFFl; 2018 pb_bus = (pb_addr + 0xFFFF) & ~0xFFFFl; 2006 2019 2007 2020 /* Tell the card where it is */ … … 2010 2023 rme9652_write(rme9652, RME9652_play_buffer, pb_bus); 2011 2024 2012 rme9652->capture_buffer = bus_to_virt(cb_bus);2013 rme9652->playback_buffer = bus_to_virt(pb_bus);2025 rme9652->capture_buffer = cb + (cb_bus - cb_addr); 2026 rme9652->playback_buffer = pb + (pb_bus - pb_addr); 2014 2027 2015 2028 return 0; … … 2745 2758 2746 2759 static int __init snd_rme9652_create(snd_card_t *card, 2747 rme9652_t *rme9652) 2760 rme9652_t *rme9652, 2761 int precise_ptr) 2748 2762 { 2749 2763 struct pci_dev *pci = rme9652->pci; … … 2772 2786 rme9652->irq = pci->irq; 2773 2787 2774 rme9652->iobase = (unsigned long) ioremap (rme9652->port, RME9652_IO_EXTENT);2788 rme9652->iobase = (unsigned long) ioremap_nocache(rme9652->port, RME9652_IO_EXTENT); 2775 2789 if (rme9652->iobase == 0) { 2776 2790 snd_printk("unable to remap region 0x%lx-0x%lx\n", rme9652->port, rme9652->port + RME9652_IO_EXTENT - 1); 2777 2791 return -EBUSY; 2778 2792 } 2793 2794 rme9652->precise_ptr = precise_ptr; 2779 2795 2780 2796 /* Determine the h/w rev level of the card. This seems like … … 2871 2887 } 2872 2888 2873 static int snd_rme9652_probe(struct pci_dev *pci,2889 static int __devinit snd_rme9652_probe(struct pci_dev *pci, 2874 2890 const struct pci_device_id *id) 2875 2891 { … … 2879 2895 int err; 2880 2896 2881 for (; dev < SNDRV_CARDS; dev++) { 2897 if (dev >= SNDRV_CARDS) 2898 return -ENODEV; 2882 2899 if (!snd_enable[dev]) { 2883 2900 dev++; 2884 2901 return -ENOENT; 2885 2902 } 2886 break;2887 }2888 2889 if (dev >= SNDRV_CARDS)2890 return -ENODEV;2891 2903 2892 2904 card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, … … 2901 2913 rme9652->pci = pci; 2902 2914 2903 if ((err = snd_rme9652_create(card, rme9652 )) < 0) {2915 if ((err = snd_rme9652_create(card, rme9652, snd_precise_ptr[dev])) < 0) { 2904 2916 snd_card_free(card); 2905 2917 return err; … … 2916 2928 return err; 2917 2929 } 2918 PCI_SET_DRIVER_DATA(pci, card);2930 pci_set_drvdata(pci, card); 2919 2931 dev++; 2920 2932 return 0; 2921 2933 } 2922 2934 2923 static void __ exit snd_rme9652_remove(struct pci_dev *pci)2924 { 2925 snd_card_free( PCI_GET_DRIVER_DATA(pci));2926 PCI_SET_DRIVER_DATA(pci, NULL);2935 static void __devexit snd_rme9652_remove(struct pci_dev *pci) 2936 { 2937 snd_card_free(pci_get_drvdata(pci)); 2938 pci_set_drvdata(pci, NULL); 2927 2939 } 2928 2940 … … 2939 2951 id_table:snd_rme9652_ids, 2940 2952 probe:snd_rme9652_probe, 2941 remove: snd_rme9652_remove,2953 remove:__devexit_p(snd_rme9652_remove), 2942 2954 }; 2943 2955 #endif … … 2947 2959 if (pci_module_init(&driver) < 0) { 2948 2960 #ifdef MODULE 2949 snd_printk("RME Digi9652/Digi9636: no cards found\n");2961 printk(KERN_ERR "RME Digi9652/Digi9636: no cards found\n"); 2950 2962 #endif 2951 2963 return -ENODEV; … … 2965 2977 #ifndef MODULE 2966 2978 2967 /* format is: snd- card-rme9652=snd_enable,snd_index,snd_id */2979 /* format is: snd-rme9652=snd_enable,snd_index,snd_id */ 2968 2980 2969 2981 static int __init alsa_card_rme9652_setup(char *str) … … 2980 2992 } 2981 2993 2982 __setup("snd- card-rme9652=", alsa_card_rme9652_setup);2994 __setup("snd-rme9652=", alsa_card_rme9652_setup); 2983 2995 2984 2996 #endif /* ifndef MODULE */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/trident/trident.c
r77 r92 22 22 */ 23 23 24 #define SNDRV_MAIN_OBJECT_FILE25 24 #include <sound/driver.h> 25 #include <linux/init.h> 26 #include <linux/time.h> 27 #include <sound/core.h> 26 28 #include <sound/trident.h> 27 29 #define SNDRV_GET_ID 28 30 #include <sound/initval.h> 29 31 30 EXPORT_NO_SYMBOLS;31 32 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, <audio@tridentmicro.com>"); 32 33 MODULE_DESCRIPTION("Trident 4D-WaveDX/NX & SiS SI7018"); … … 195 196 if ((err = pci_module_init(&driver)) < 0) { 196 197 #ifdef MODULE 197 // snd_printk( "Trident 4DWave PCI soundcard not found or device busy\n");198 // snd_printk(KERN_ERR "Trident 4DWave PCI soundcard not found or device busy\n"); 198 199 #endif 199 200 return err; … … 212 213 #ifndef MODULE 213 214 214 /* format is: snd- card-trident=snd_enable,snd_index,snd_id,215 /* format is: snd-trident=snd_enable,snd_index,snd_id, 215 216 snd_pcm_channels,snd_wavetable_size */ 216 217 -
GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci.c
r77 r92 20 20 */ 21 21 22 #define SNDRV_MAIN_OBJECT_FILE23 22 #include <sound/driver.h> 23 #include <linux/init.h> 24 #include <linux/time.h> 25 #include <sound/core.h> 24 26 #include <sound/ymfpci.h> 25 27 #include <sound/mpu401.h> … … 29 31 30 32 EXPORT_NO_SYMBOLS; 33 31 34 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 32 35 MODULE_DESCRIPTION("Yamaha DS-XG PCI"); … … 290 293 if ((err = pci_module_init(&driver)) < 0) { 291 294 #ifdef MODULE 292 // snd_printk( "Yamaha DS-XG PCI soundcard not found or device busy\n");295 // snd_printk(KERN_ERR "Yamaha DS-XG PCI soundcard not found or device busy\n"); 293 296 #endif 294 297 return err; … … 307 310 #ifndef MODULE 308 311 309 /* format is: snd- card-ymfpci=snd_enable,snd_index,snd_id,310 snd_fm_port,snd_mpu_port,snd_mpu_irq*/312 /* format is: snd-ymfpci=snd_enable,snd_index,snd_id, 313 snd_fm_port,snd_mpu_port */ 311 314 312 315 static int __init alsa_card_ymfpci_setup(char *str)
Note:
See TracChangeset
for help on using the changeset viewer.