Changeset 250
- Timestamp:
- Aug 27, 2007, 7:41:50 PM (18 years ago)
- Location:
- GPL/branches/alsa-resync1/alsa-kernel
- Files:
-
- 2 added
- 1 deleted
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/core/control.c
r210 r250 1295 1295 */ 1296 1296 1297 #ifdef TARGET_OS21298 1297 static struct file_operations snd_ctl_f_ops = 1299 1298 { 1300 #ifdef LINUX_2_3 1301 THIS_MODULE, 1302 #endif 1303 0, 1304 snd_ctl_read, 1305 0,0, 1306 snd_ctl_poll, 1307 snd_ctl_ioctl, 1308 0, 1309 snd_ctl_open,0, 1310 snd_ctl_release, 1311 0, 1312 snd_ctl_fasync, 1313 0,0,0 1299 #ifndef TARGET_OS2 1300 .owner = THIS_MODULE, 1301 #endif /* !TARGET_OS2 */ 1302 .read = snd_ctl_read, 1303 .open = snd_ctl_open, 1304 .release = snd_ctl_release, 1305 .poll = snd_ctl_poll, 1306 .ioctl = snd_ctl_ioctl, 1307 .fasync = snd_ctl_fasync, 1314 1308 }; 1315 1309 … … 1319 1313 .f_ops = &snd_ctl_f_ops, 1320 1314 }; 1321 1322 #else1323 static struct file_operations snd_ctl_f_ops =1324 {1325 #ifdef LINUX_2_31326 owner: THIS_MODULE,1327 #endif1328 read: snd_ctl_read,1329 open: snd_ctl_open,1330 release: snd_ctl_release,1331 poll: snd_ctl_poll,1332 ioctl: snd_ctl_ioctl,1333 fasync: snd_ctl_fasync,1334 };1335 1336 static snd_minor_t snd_ctl_reg =1337 {1338 comment: "ctl",1339 f_ops: &snd_ctl_f_ops,1340 };1341 #endif1342 1315 1343 1316 /* -
GPL/branches/alsa-resync1/alsa-kernel/core/info.c
r246 r250 46 46 static char *reserved[] = 47 47 { 48 "dev",49 48 "version", 50 49 "meminfo", … … 124 123 125 124 static struct proc_dir_entry *snd_proc_root = NULL; 126 struct proc_dir_entry *snd_proc_dev = NULL;127 125 snd_info_entry_t *snd_seq_root = NULL; 128 126 #ifdef CONFIG_SND_OSSEMUL … … 283 281 p = PDE(inode); 284 282 entry = p == NULL ? NULL : (snd_info_entry_t *)p->data; 285 if (entry == NULL) {283 if (entry == NULL || entry->disconnected) { 286 284 up(&info_mutex); 287 285 return -ENODEV; … … 506 504 } 507 505 508 #ifdef TARGET_OS2509 506 static struct file_operations snd_info_entry_operations = 510 507 { 511 #ifdef LINUX_2_3 512 THIS_MODULE, 513 #endif 514 snd_info_entry_llseek, 515 snd_info_entry_read, 516 snd_info_entry_write, 517 0, 518 snd_info_entry_poll, 519 snd_info_entry_ioctl, 520 snd_info_entry_mmap, 521 0, 522 // snd_info_entry_open, 523 0, 524 snd_info_entry_release, 525 0,0,0,0,0 526 }; 527 #else 528 static struct file_operations snd_info_entry_operations = 529 { 530 #ifndef LINUX_2_2 508 #ifndef TARGET_OS2 531 509 .owner = THIS_MODULE, 532 #endif 510 #endif /* !TARGET_OS2 */ 533 511 .llseek = snd_info_entry_llseek, 534 512 .read = snd_info_entry_read, … … 537 515 .ioctl = snd_info_entry_ioctl, 538 516 .mmap = snd_info_entry_mmap, 517 #ifndef TARGET_OS2 539 518 .open = snd_info_entry_open, 519 #endif /* !TARGET_OS2 */ 540 520 .release = snd_info_entry_release, 541 521 }; 542 543 #ifdef LINUX_2_2544 static struct inode_operations snd_info_entry_inode_operations =545 {546 &snd_info_entry_operations, /* default sound info directory file-ops */547 };548 549 static struct inode_operations snd_info_device_inode_operations =550 {551 &snd_fops, /* default sound info directory file-ops */552 };553 #endif /* LINUX_2_2 */554 555 static int snd_info_card_readlink(struct dentry *dentry,556 char *buffer, int buflen)557 {558 char *s = PDE(dentry->d_inode)->data;559 #ifndef LINUX_2_2560 return vfs_readlink(dentry, buffer, buflen, s);561 #else562 int len;563 564 if (s == NULL)565 return -EIO;566 len = strlen(s);567 if (len > buflen)568 len = buflen;569 if (copy_to_user(buffer, s, len))570 return -EFAULT;571 return len;572 #endif573 }574 575 #ifndef LINUX_2_2576 static int snd_info_card_followlink(struct dentry *dentry,577 struct nameidata *nd)578 {579 char *s = PDE(dentry->d_inode)->data;580 return vfs_follow_link(nd, s);581 }582 #else583 static struct dentry *snd_info_card_followlink(struct dentry *dentry,584 struct dentry *base,585 unsigned int follow)586 {587 char *s = PDE(dentry->d_inode)->data;588 return lookup_dentry(s, base, follow);589 }590 #endif591 592 #ifdef LINUX_2_2593 static struct file_operations snd_info_card_link_operations =594 {595 NULL596 };597 #endif598 599 struct inode_operations snd_info_card_link_inode_operations =600 {601 #ifdef LINUX_2_2602 .default_file_ops = &snd_info_card_link_operations,603 #endif604 .readlink = snd_info_card_readlink,605 .follow_link = snd_info_card_followlink,606 };607 #endif //TARGET_OS2608 522 609 523 /** … … 636 550 return -ENOMEM; 637 551 snd_proc_root = p; 638 p = snd_create_proc_entry("dev", S_IFDIR | S_IRUGO | S_IXUGO, snd_proc_root);639 if (p == NULL)640 return -ENOMEM;641 snd_proc_dev = p;642 552 #ifdef CONFIG_SND_OSSEMUL 643 553 { … … 667 577 #endif 668 578 snd_info_version_init(); 669 #ifdef CONFIG_SND_DEBUG_MEMORY670 579 snd_memory_info_init(); 671 #endif672 580 snd_minor_info_init(); 673 #ifdef CONFIG_SND_OSSEMUL674 581 snd_minor_info_oss_init(); 675 #endif676 582 snd_card_info_init(); 677 583 return 0; … … 681 587 { 682 588 snd_card_info_done(); 683 #ifdef CONFIG_SND_OSSEMUL684 589 snd_minor_info_oss_done(); 685 #endif686 590 snd_minor_info_done(); 687 #ifdef CONFIG_SND_DEBUG_MEMORY688 591 snd_memory_info_done(); 689 #endif690 592 snd_info_version_done(); 691 593 if (snd_proc_root) { … … 698 600 snd_info_unregister(snd_oss_root); 699 601 #endif 700 snd_remove_proc_entry(snd_proc_root, snd_proc_dev);701 602 snd_remove_proc_entry(&proc_root, snd_proc_root); 702 603 } … … 968 869 * Returns zero if successful, or a negative error code on failure. 969 870 */ 970 //#ifndef TARGET_OS2971 871 int snd_card_proc_new(snd_card_t *card, const char *name, 972 872 snd_info_entry_t **entryp) 973 873 { 974 874 static snd_device_ops_t ops = { 975 /*.dev_free = */snd_info_dev_free_entry,976 /*.dev_register =*/snd_info_dev_register_entry,977 /*.dev_disconnect = */snd_info_dev_disconnect_entry,978 /*.dev_unregister = */snd_info_dev_unregister_entry875 .dev_free = snd_info_dev_free_entry, 876 .dev_register = snd_info_dev_register_entry, 877 .dev_disconnect = snd_info_dev_disconnect_entry, 878 .dev_unregister = snd_info_dev_unregister_entry 979 879 }; 980 880 snd_info_entry_t *entry; … … 992 892 return 0; 993 893 } 994 //#endif995 894 996 895 /** … … 1031 930 return -ENOMEM; 1032 931 } 1033 #ifndef LINUX_2_21034 932 p->owner = entry->module; 1035 #endif1036 1037 933 #ifndef TARGET_OS2 1038 if (!S_ISDIR(entry->mode)) { 1039 #ifndef LINUX_2_2 934 if (!S_ISDIR(entry->mode)) 1040 935 p->proc_fops = &snd_info_entry_operations; 1041 #else1042 p->ops = &snd_info_entry_inode_operations;1043 #endif1044 }1045 936 #endif 1046 937 p->size = entry->size; -
GPL/branches/alsa-resync1/alsa-kernel/core/init.c
r222 r250 27 27 #include <linux/time.h> 28 28 #include <linux/ctype.h> 29 #ifndef TARGET_OS2 // TODO: implement linux/workqueue.h30 #include <linux/workqueue.h>31 #endif /* !TARGET_OS2 */32 29 #include <sound/core.h> 33 30 #include <sound/control.h> … … 208 205 209 206 memset(f_ops, 0, sizeof(*f_ops)); 210 #if def LINUX_2_3207 #ifndef TARGET_OS2 211 208 f_ops->owner = file->f_op->owner; 212 #endif 209 #endif /* !TARGET_OS2 */ 213 210 f_ops->release = file->f_op->release; 214 211 f_ops->poll = snd_disconnect_poll; -
GPL/branches/alsa-resync1/alsa-kernel/core/pcm_lib.c
r210 r250 70 70 if (frames > runtime->silence_size) 71 71 frames = runtime->silence_size; 72 else 73 frames = runtime->silence_threshold; 72 74 } else { 73 75 if (new_hw_ptr == ULONG_MAX) { /* initialization */ -
GPL/branches/alsa-resync1/alsa-kernel/core/pcm_native.c
r246 r250 1568 1568 inode = file->f_dentry->d_inode; 1569 1569 if (!S_ISCHR(inode->i_mode) || 1570 MAJOR(inode->i_rdev) != CONFIG_SND_MAJOR) {1570 major(inode->i_rdev) != snd_major) { 1571 1571 fput(file); 1572 1572 return 0; 1573 1573 } 1574 minor = MINOR(inode->i_rdev);1575 if (minor >= 256 || 1574 minor = minor(inode->i_rdev); 1575 if (minor >= 256 || 1576 1576 minor % SNDRV_MINOR_DEVICES < SNDRV_MINOR_PCM_PLAYBACK) { 1577 1577 fput(file); … … 2105 2105 int snd_pcm_open(struct inode *inode, struct file *file) 2106 2106 { 2107 int cardnum = SNDRV_MINOR_CARD(MINOR(inode->i_rdev));2108 int device = SNDRV_MINOR_DEVICE(MINOR(inode->i_rdev));2107 int cardnum = SNDRV_MINOR_CARD(minor(inode->i_rdev)); 2108 int device = SNDRV_MINOR_DEVICE(minor(inode->i_rdev)); 2109 2109 int err; 2110 2110 snd_pcm_t *pcm; … … 3292 3292 3293 3293 static struct file_operations snd_pcm_f_ops_playback = { 3294 #if def LINUX_2_33294 #ifndef TARGET_OS2 3295 3295 .owner = THIS_MODULE, 3296 #endif 3296 #endif /* !TARGET_OS2 */ 3297 3297 .write = snd_pcm_write, 3298 #if def LINUX_2_33298 #ifndef TARGET_OS2 3299 3299 .writev = snd_pcm_writev, 3300 #endif 3300 #endif /* !TARGET_OS2 */ 3301 3301 .open = snd_pcm_open, 3302 3302 .release = snd_pcm_release, 3303 3303 .poll = snd_pcm_playback_poll, 3304 3304 .ioctl = snd_pcm_playback_ioctl, 3305 #if def LINUX_2_33305 #ifndef TARGET_OS2 3306 3306 .compat_ioctl = snd_pcm_ioctl_compat, 3307 3307 .mmap = snd_pcm_mmap, 3308 #endif 3308 .fasync = snd_pcm_fasync, 3309 #endif 3310 }; 3311 3312 static struct file_operations snd_pcm_f_ops_capture = { 3309 3313 #ifndef TARGET_OS2 3310 .fasync = snd_pcm_fasync,3311 #endif3312 };3313 3314 static struct file_operations snd_pcm_f_ops_capture = {3315 #ifdef LINUX_2_33316 3314 .owner = THIS_MODULE, 3317 #endif 3315 #endif /* !TARGET_OS2 */ 3318 3316 .read = snd_pcm_read, 3319 #if def LINUX_2_33317 #ifndef TARGET_OS2 3320 3318 .readv = snd_pcm_readv, 3321 #endif 3319 #endif /* !TARGET_OS2 */ 3322 3320 .open = snd_pcm_open, 3323 3321 .release = snd_pcm_release, 3324 3322 .poll = snd_pcm_capture_poll, 3325 3323 .ioctl = snd_pcm_capture_ioctl, 3326 #if def LINUX_2_33324 #ifndef TARGET_OS2 3327 3325 .ioctl = snd_pcm_ioctl_compat, 3328 3326 .mmap = snd_pcm_mmap, 3329 #endif3330 #ifndef TARGET_OS23331 3327 .fasync = snd_pcm_fasync, 3332 3328 #endif -
GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c
r206 r250 1467 1467 } 1468 1468 1469 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)1469 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1470 1470 static void snd_rawmidi_dev_seq_free(snd_seq_device_t *device) 1471 1471 { … … 1542 1542 } 1543 1543 rmidi->proc_entry = entry; 1544 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)1544 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1545 1545 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */ 1546 1546 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) { … … 1597 1597 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); 1598 1598 up(®ister_mutex); 1599 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)1599 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1600 1600 if (rmidi->seq_dev) { 1601 1601 snd_device_free(rmidi->card, rmidi->seq_dev); -
GPL/branches/alsa-resync1/alsa-kernel/core/sound.c
r246 r250 164 164 } 165 165 166 #ifdef TARGET_OS2167 166 struct file_operations snd_fops = 168 167 { 169 0,0,0,0,0,0,0, 170 snd_open,0,0,0,0,0,0,0 171 }; 172 #else 173 struct file_operations snd_fops = 174 { 175 #ifndef LINUX_2_2 168 #ifndef TARGET_OS2 176 169 .owner = THIS_MODULE, 177 #endif 170 #endif /* !TARGET_OS2 */ 178 171 .open = snd_open 179 172 }; 180 #endif181 173 182 174 static int snd_kernel_minor(int type, struct snd_card * card, int dev) -
GPL/branches/alsa-resync1/alsa-kernel/drivers/dummy.c
r246 r250 22 22 #include <linux/version.h> 23 23 #include <linux/init.h> 24 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)24 #ifndef TARGET_OS2 //TODO: Implement linux/jiffies.h 25 25 #include <linux/jiffies.h> 26 #else 27 #include <linux/sched.h> 28 #endif 26 #endif /* !TARGET_OS2 */ 29 27 #include <linux/slab.h> 30 28 #include <linux/time.h> … … 60 58 #define MAX_BUFFER_SIZE (256 * 1024) 61 59 #define USE_FORMATS SNDRV_PCM_FMTBIT_S32_LE 62 #define USE_CHANNELS_MIN 1 263 #define USE_CHANNELS_MAX 1 260 #define USE_CHANNELS_MIN 10 61 #define USE_CHANNELS_MAX 10 64 62 #define USE_PERIODS_MIN 1 65 63 #define USE_PERIODS_MAX 1024 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/ad1848.h
r246 r250 121 121 #define AD1848_HW_CS4248 0x0003 /* CS4248 chip */ 122 122 #define AD1848_HW_CMI8330 0x0004 /* CMI8330 chip */ 123 #define AD1848_HW_THINKPAD 0x0005 /* Thinkpad 360/750/755 */ 124 125 /* IBM Thinkpad specific stuff */ 126 #define AD1848_THINKPAD_CTL_PORT1 0x15e8 127 #define AD1848_THINKPAD_CTL_PORT2 0x15e9 128 #define AD1848_THINKPAD_CS4248_ENABLE_BIT 0x02 123 129 124 130 struct _snd_ad1848 { … … 142 148 int dma_size; 143 149 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 150 int thinkpad_flag; /* Thinkpad CS4248 needs some extra help */ 151 #ifdef CONFIG_PM 152 struct pm_dev *thinkpad_pmstate; 153 #endif 144 154 145 155 spinlock_t reg_lock; -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h
r246 r250 51 51 #include <linux/module.h> 52 52 53 #ifdef CONFIG_HAVE_OLD_REQUEST_MODULE 54 #include <linux/kmod.h> 55 #undef request_module 56 void snd_compat_request_module(const char *name, ...); 57 #define request_module(name, args...) snd_compat_request_module(name, ##args) 58 #endif 59 60 #ifndef TARGET_OS2 61 #include <linux/compiler.h> 62 #endif /* !TARGET_OS2 */ 63 #ifndef __user 64 #define __user 65 #endif 66 53 67 #ifdef CONFIG_PCI 54 68 #include <linux/pci.h> … … 71 85 #include <linux/init.h> 72 86 #include <linux/pm.h> 87 #include <asm/page.h> 73 88 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 3) 74 89 #define pci_set_dma_mask(pci, mask) pci->dma_mask = mask … … 109 124 #endif 110 125 111 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 3) 126 #include <linux/sched.h> 127 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 3) && !defined(need_resched) 112 128 #define need_resched() (current->need_resched) 113 129 #endif … … 136 152 137 153 #if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) 138 #if (defined(CONFIG_ISAPNP_KERNEL) && defined(ALSA_BUILD)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 30) && !defined(ALSA_BUILD))139 #include <linux/isapnp.h>140 #define isapnp_dev pci_dev141 #define isapnp_card pci_bus142 #else143 154 #ifdef TARGET_OS2 144 155 #include "isapnp.h" 145 156 #else /* !TARGET_OS2 */ 146 157 #include <linux/isapnp.h> 147 #endif /* TARGET_OS2 */ 158 #endif /* !TARGET_OS2 */ 159 #ifndef CONFIG_PNP 160 #define CONFIG_PNP 161 #endif 162 #if (defined(CONFIG_ISAPNP_KERNEL) && defined(ALSA_BUILD)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 30) && !defined(ALSA_BUILD)) 163 #define isapnp_dev pci_dev 164 #define isapnp_card pci_bus 148 165 #endif 149 166 #undef __ISAPNP__ 150 167 #define __ISAPNP__ 168 #else 169 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) 170 #undef CONFIG_PNP 171 #endif 151 172 #endif 152 173 … … 159 180 #endif 160 181 161 /* no vsnprintf yet? */ 162 /* FIXME: the version number is not sure.. at least it exists already on 2.4.10 */ 163 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 10) && !TARGET_OS2 164 #define snprintf(buf,size,fmt,args...) sprintf(buf,fmt,##args) 165 #define vsnprintf(buf,size,fmt,args) vsprintf(buf,fmt,args) 182 #if !defined CONFIG_HAVE_STRLCPY && !defined TARGET_OS2 183 size_t snd_compat_strlcpy(char *dest, const char *src, size_t size); 184 #define strlcpy(dest, src, size) snd_compat_strlcpy(dest, src, size) 185 size_t snd_compat_strlcat(char *dest, const char *src, size_t size); 186 #define strlcat(dest, src, size) snd_compat_strlcat(dest, src, size) 187 #endif 188 189 #if !defined CONFIG_HAVE_SNPRINTF && !defined TARGET_OS2 190 #include <stdarg.h> 191 int snd_compat_snprintf(char * buf, size_t size, const char * fmt, ...); 192 int snd_compat_vsnprintf(char *buf, size_t size, const char *fmt, va_list args); 193 #define snprintf(buf,size,fmt,args...) snd_compat_snprintf(buf,size,fmt,##args) 194 #define vsnprintf(buf,size,fmt,args) snd_compat_vsnprintf(buf,size,fmt,args) 166 195 #endif 167 196 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/ak4xxx-adda.h
r246 r250 38 38 }; 39 39 40 #define AK4XXX_IMAGE_SIZE (AK4XXX_MAX_CHIPS * 16) /* 64 bytes */ 41 40 42 struct snd_akm4xxx { 41 43 snd_card_t *card; 42 44 unsigned int num_adcs; /* AK4524 or AK4528 ADCs */ 43 45 unsigned int num_dacs; /* AK4524 or AK4528 DACs */ 44 unsigned char images[AK4XXX_ MAX_CHIPS][16]; /* saved register image */46 unsigned char images[AK4XXX_IMAGE_SIZE]; /* saved register image */ 45 47 unsigned char ipga_gain[AK4XXX_MAX_CHIPS][2]; /* saved register image for IPGA (AK4528) */ 46 48 unsigned long private_value[AK4XXX_MAX_CHIPS]; /* helper for driver */ … … 59 61 int snd_akm4xxx_build_controls(akm4xxx_t *ak); 60 62 63 #define snd_akm4xxx_get(ak,chip,reg) (ak)->images[(chip) * 16 + (reg)] 64 #define snd_akm4xxx_set(ak,chip,reg,val) ((ak)->images[(chip) * 16 + (reg)] = (val)) 65 #define snd_akm4xxx_get_ipga(ak,chip,reg) (ak)->ipga_gain[chip][(reg)-4] 66 #define snd_akm4xxx_set_ipga(ak,chip,reg,val) ((ak)->ipga_gain[chip][(reg)-4] = (val)) 67 61 68 #endif /* __SOUND_AK4XXX_ADDA_H */ -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/compat_22.h
r234 r250 90 90 91 91 /* Some distributions use modified kill_fasync */ 92 #ifdef CONFIG_OLD_KILL_FASYNC 92 93 #include <linux/fs.h> 93 94 #undef kill_fasync 94 95 #define kill_fasync(fp, sig, band) snd_wrapper_kill_fasync(fp, sig, band) 95 96 void snd_wrapper_kill_fasync(struct fasync_struct **, int, int); 97 #endif 96 98 97 99 /* this is identical with tq_struct but the "routine" field is renamed to "func" */ -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h
r246 r250 25 25 #include <linux/sched.h> /* wake_up() */ 26 26 #include <asm/semaphore.h> 27 #ifndef TARGET_OS2 //TODO: implement linux/rwsem.h 27 #ifndef TARGET_OS2 //TODO: implement linux/rwsem.h, workqueue.h 28 28 #include <linux/rwsem.h> /* struct rw_semaphore */ 29 #include <linux/workqueue.h> /* struct workqueue_struct */ 29 30 #endif /* !TARGET_OS2 */ 30 31 #include <sound/typedefs.h> … … 213 214 int device; /* device number */ 214 215 const char *comment; /* for /proc/asound/devices */ 215 snd_info_entry_t *dev; /* for /proc/asound/dev */216 216 struct file_operations *f_ops; /* file operations */ 217 217 char name[1]; … … 241 241 242 242 #ifdef CONFIG_SND_OSSEMUL 243 244 243 int snd_minor_info_oss_init(void); 245 244 int snd_minor_info_oss_done(void); 246 247 245 int snd_oss_init_module(void); 248 246 #else 247 #define snd_minor_info_oss_init() /*NOP*/ 248 #define snd_minor_info_oss_done() /*NOP*/ 249 #define snd_oss_init_module() /*NOP*/ 249 250 #endif 250 251 … … 269 270 #define kstrdup(s, flags) snd_hidden_kstrdup(s, flags) 270 271 #else 272 #define snd_memory_init() /*NOP*/ 273 #define snd_memory_done() /*NOP*/ 274 #define snd_memory_info_init() /*NOP*/ 275 #define snd_memory_info_done() /*NOP*/ 271 276 #define kmalloc_nocheck(size, flags) kmalloc(size, flags) 272 277 #define vmalloc_nocheck(size) vmalloc(size) -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/hdsp.h
r246 r250 25 25 Digiface, 26 26 Multiface, 27 H9652, 27 28 Undefined, 28 29 } HDSP_IO_Type; -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/initval.h
r246 r250 87 87 #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 } 88 88 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 } 89 #ifdef __ISAPNP__89 #ifdef CONFIG_PNP 90 90 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP 91 91 #else -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/mpu401.h
r77 r250 92 92 spinlock_t timer_lock; 93 93 94 atomic_t rx_loop; 95 atomic_t tx_loop; 96 94 97 struct timer_list timer; 95 98 -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/ymfpci.h
r36 r250 26 26 #include "rawmidi.h" 27 27 #include "ac97_codec.h" 28 #ifndef TARGET_OS2 //TODO: Implement linux/gameport.h 29 #include <linux/gameport.h> 30 #endif /* !TARGET_OS2 */ 28 31 29 32 #ifndef PCI_VENDOR_ID_YAMAHA -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848.c
r212 r250 47 47 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 48 48 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 49 static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ 49 50 50 51 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); … … 66 67 MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver."); 67 68 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA_DESC); 69 MODULE_PARM(thinkpad, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 70 MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); 71 MODULE_PARM_SYNTAX(thinkpad, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC); 68 72 69 73 static snd_card_t *snd_ad1848_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; … … 78 82 79 83 if (port[dev] == SNDRV_AUTO_PORT) { 80 snd_printk( "specify port\n");84 snd_printk(KERN_ERR "ad1848: specify port\n"); 81 85 return -EINVAL; 82 86 } 83 87 if (irq[dev] == SNDRV_AUTO_IRQ) { 84 snd_printk( "specify irq\n");88 snd_printk(KERN_ERR "ad1848: specify irq\n"); 85 89 return -EINVAL; 86 90 } 87 91 if (dma1[dev] == SNDRV_AUTO_DMA) { 88 snd_printk( "specify dma1\n");92 snd_printk(KERN_ERR "ad1848: specify dma1\n"); 89 93 return -EINVAL; 90 94 } … … 97 101 irq[dev], 98 102 dma1[dev], 99 AD1848_HW_DETECT,103 thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, 100 104 &chip)) < 0) { 101 105 snd_card_free(card); … … 116 120 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 117 121 pcm->name, chip->port, irq[dev], dma1[dev]); 122 123 if (thinkpad[dev]) { 124 strcat(card->longname, " [Thinkpad]"); 125 } 118 126 119 127 if ((err = snd_card_register(card)) < 0) { … … 169 177 get_option(&str,(int *)&port[nr_dev]) == 2 && 170 178 get_option(&str,&irq[nr_dev]) == 2 && 171 get_option(&str,&dma1[nr_dev]) == 2); 179 get_option(&str,&dma1[nr_dev]) == 2 && 180 get_option(&str,&thinkpad[nr_dev]) == 2); 172 181 nr_dev++; 173 182 return 1; -
GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c
r246 r250 625 625 626 626 */ 627 628 static void snd_ad1848_thinkpad_twiddle(ad1848_t *chip, int on) { 629 630 int tmp; 631 632 if (!chip->thinkpad_flag) return; 633 634 outb(0x1c, AD1848_THINKPAD_CTL_PORT1); 635 tmp = inb(AD1848_THINKPAD_CTL_PORT2); 636 637 if (on) 638 /* turn it on */ 639 tmp |= AD1848_THINKPAD_CS4248_ENABLE_BIT; 640 else 641 /* turn it off */ 642 tmp &= ~AD1848_THINKPAD_CS4248_ENABLE_BIT; 643 644 outb(tmp, AD1848_THINKPAD_CTL_PORT2); 645 646 } 647 648 #ifdef CONFIG_PM 649 static void snd_ad1848_suspend(ad1848_t *chip) { 650 651 snd_card_t *card = chip->card; 652 653 if (card->power_state == SNDRV_CTL_POWER_D3hot) 654 return; 655 656 snd_pcm_suspend_all(chip->pcm); 657 /* FIXME: save registers? */ 658 659 if (chip->thinkpad_flag) 660 snd_ad1848_thinkpad_twiddle(chip, 0); 661 662 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 663 } 664 665 static void snd_ad1848_resume(ad1848_t *chip) { 666 667 snd_card_t *card = chip->card; 668 669 if (card->power_state == SNDRV_CTL_POWER_D0) 670 return; 671 672 if (chip->thinkpad_flag) 673 snd_ad1848_thinkpad_twiddle(chip, 1); 674 675 /* FIXME: restore registers? */ 676 677 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 678 } 679 680 /* callback for control API */ 681 static int snd_ad1848_set_power_state(snd_card_t *card, unsigned int power_state) 682 { 683 ad1848_t *chip = (ad1848_t *) card->power_state_private_data; 684 switch (power_state) { 685 case SNDRV_CTL_POWER_D0: 686 case SNDRV_CTL_POWER_D1: 687 case SNDRV_CTL_POWER_D2: 688 snd_ad1848_resume(chip); 689 break; 690 case SNDRV_CTL_POWER_D3hot: 691 case SNDRV_CTL_POWER_D3cold: 692 snd_ad1848_suspend(chip); 693 break; 694 default: 695 return -EINVAL; 696 } 697 return 0; 698 } 699 700 static int snd_ad1848_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data) 701 { 702 ad1848_t *chip = snd_magic_cast(ad1848_t, dev->data, return 0); 703 704 switch (rqst) { 705 case PM_SUSPEND: 706 snd_ad1848_suspend(chip); 707 break; 708 case PM_RESUME: 709 snd_ad1848_resume(chip); 710 break; 711 } 712 return 0; 713 } 714 715 #endif /* CONFIG_PM */ 627 716 628 717 static int snd_ad1848_probe(ad1848_t * chip) … … 800 889 static int snd_ad1848_free(ad1848_t *chip) 801 890 { 891 #ifdef CONFIG_PM 892 if (chip->thinkpad_pmstate) 893 pm_unregister(chip->thinkpad_pmstate); 894 #endif 802 895 if (chip->res_port) { 803 896 release_resource(chip->res_port); … … 870 963 } 871 964 chip->dma = dma; 965 966 if (hardware == AD1848_HW_THINKPAD) { 967 chip->thinkpad_flag = 1; 968 chip->hardware = AD1848_HW_DETECT; /* reset */ 969 snd_ad1848_thinkpad_twiddle(chip, 1); 970 #ifdef CONFIG_PM 971 chip->thinkpad_pmstate = pm_register(PM_ISA_DEV, 0, snd_ad1848_pm_callback); 972 if (chip->thinkpad_pmstate) { 973 chip->thinkpad_pmstate->data = chip; 974 card->set_power_state = snd_ad1848_set_power_state; /* callback */ 975 card->power_state_private_data = chip; 976 } 977 #endif 978 } 872 979 873 980 if (snd_ad1848_probe(chip) < 0) { … … 1149 1256 if (! ctl) 1150 1257 return -ENOMEM; 1151 str ncpy(ctl->id.name, name, sizeof(ctl->id.name)-1);1258 strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); 1152 1259 ctl->id.index = index; 1153 1260 ctl->private_value = value; -
GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c
r246 r250 1 2 1 /* 3 2 card-azt2320.c - driver for Aztech Systems AZT2320 based soundcards. … … 106 105 107 106 struct snd_card_azt2320 { 108 #ifdef CONFIG_PNP109 107 int dev_no; 110 108 struct pnp_dev *dev; 111 109 struct pnp_dev *devmpu; 112 #endif /* CONFIG_PNP */113 110 }; 114 111 -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c
r246 r250 1402 1402 switch (rqst) { 1403 1403 case PM_SUSPEND: 1404 if (chip->suspend) 1404 if (chip->suspend) { 1405 snd_pcm_suspend_all(chip->pcm); 1405 1406 (*chip->suspend)(chip); 1407 } 1406 1408 break; 1407 1409 case PM_RESUME: -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c
r246 r250 309 309 int err; 310 310 311 if (!cfg) 312 return -ENOMEM; 313 311 314 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 312 315 if (acard->wss == NULL) { … … 393 396 err = pnp_activate_dev(pdev); 394 397 if (err < 0) { 395 kfree(cfg);396 398 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n"); 397 399 mpu_port[dev] = SNDRV_AUTO_PORT; … … 410 412 return 0; 411 413 } 412 #endif 414 #endif /* CONFIG_PNP */ 413 415 414 416 static void snd_card_cs4236_free(snd_card_t *card) -
GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236_lib.c
r224 r250 285 285 286 286 if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) { 287 snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x% lx\n",chip->hardware);287 snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware); 288 288 snd_device_free(card, chip); 289 289 return -ENODEV; -
GPL/branches/alsa-resync1/alsa-kernel/isa/dt019x.c
r246 r250 128 128 pnp_resource_change(&cfg->port_resource[0], port[dev], 16); 129 129 if (dma8[dev] != SNDRV_AUTO_DMA) 130 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 131 1); 130 pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1); 132 131 if (irq[dev] != SNDRV_AUTO_IRQ) 133 132 pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1); … … 159 158 snd_printk(KERN_ERR PFX "DT-019X MPU401 the requested resources are invalid, using auto config\n"); 160 159 err = pnp_activate_dev(pdev); 161 if (err < 0) 160 if (err < 0) { 161 pnp_release_card_device(pdev); 162 snd_printk(KERN_ERR PFX "DT-019X MPU401 pnp configure failure, skipping\n"); 162 163 goto __mpu_error; 164 } 163 165 mpu_port[dev] = pnp_port_start(pdev, 0); 164 166 mpu_irq[dev] = pnp_irq(pdev, 0); … … 166 168 mpu_port[dev],mpu_irq[dev]); 167 169 } else { 168 __mpu_error: 169 if (pdev) { 170 pnp_release_card_device(pdev); 171 snd_printk(KERN_ERR PFX "DT-019X MPU401 pnp configure failure, skipping\n"); 172 } 170 __mpu_error: 173 171 acard->devmpu = NULL; 174 172 mpu_port[dev] = -1; … … 183 181 snd_printk(KERN_ERR PFX "DT-019X OPL3 the requested resources are invalid, using auto config\n"); 184 182 err = pnp_activate_dev(pdev); 185 if (err < 0) 183 if (err < 0) { 184 pnp_release_card_device(pdev); 185 snd_printk(KERN_ERR PFX "DT-019X OPL3 pnp configure failure, skipping\n"); 186 186 goto __fm_error; 187 } 187 188 fm_port[dev] = pnp_port_start(pdev, 0); 188 189 snd_printdd("dt019x: found OPL3 synth: port=0x%lx\n",fm_port[dev]); 189 190 } else { 190 __fm_error: 191 if (pdev) { 192 pnp_release_card_device(pdev); 193 snd_printk(KERN_ERR PFX "DT-019X OPL3 pnp configure failure, skipping\n"); 194 } 191 __fm_error: 195 192 acard->devopl = NULL; 196 193 fm_port[dev] = -1; -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_main.c
r210 r250 115 115 if (gus->gf1.res_port2 == NULL) 116 116 goto __hw_end; 117 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)117 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 118 118 if (gus->seq_dev) { 119 119 snd_device_free(gus->card, gus->seq_dev); … … 443 443 if ((err = snd_gus_init_dma_irq(gus, 1)) < 0) 444 444 return err; 445 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)445 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 446 446 if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS, 447 447 sizeof(snd_gus_card_t*), &gus->seq_dev) >= 0) { -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_synth.c
r224 r250 193 193 &callbacks, 194 194 SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE, 195 SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |196 SNDRV_SEQ_PORT_TYPE_MIDI_GM |197 SNDRV_SEQ_PORT_TYPE_MIDI_GS |198 195 SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE | 199 196 SNDRV_SEQ_PORT_TYPE_SYNTH, -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c
r246 r250 770 770 if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { 771 771 snd_card_free(card); 772 snd_printk("unable to grab IRQ %d\n", irq);772 snd_printk("unable to grab IRQ %d\n", xirq); 773 773 return -EBUSY; 774 774 } -
GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c
r246 r250 612 612 if (sb_port[dev] != SNDRV_AUTO_PORT) 613 613 pnp_resource_change(&cfg->port_resource[0], sb_port[dev], 16); 614 if (wss_port[dev] != SNDRV_AUTO_PORT) 614 615 pnp_resource_change(&cfg->port_resource[1], wss_port[dev], 8); 615 616 if (fm_port[dev] != SNDRV_AUTO_PORT) … … 631 632 if (err < 0) { 632 633 kfree(cfg); 633 snd_printk(KERN_ERR "PnP configure failure (out of resources?) \n");634 snd_printk(KERN_ERR "PnP configure failure (out of resources?) err = %d\n", err); 634 635 return -EBUSY; 635 636 } -
GPL/branches/alsa-resync1/alsa-kernel/isa/opti9xx/opti92x-ad1848.c
r246 r250 44 44 #include <sound/mpu401.h> 45 45 #include <sound/opl3.h> 46 #ifdef USE_OPL447 46 #ifndef OPTi93X 48 #include "opl4.h" /* <sound/opl4.h> */ 49 #endif 47 #include <sound/opl4.h> 50 48 #endif 51 49 #define SNDRV_LEGACY_FIND_FREE_IRQ … … 280 278 #ifdef CONFIG_PNP 281 279 282 #define ISAPNP_OPTI9XX(_va, _vb, _vc, _device, _fa, _fb, _fc, _audio, _mpu401) \283 { \284 ISAPNP_CARD_ID(_va, _vb, _vc, _device), \285 .devs = { ISAPNP_DEVICE_ID(_fa, _fb, _fc, _audio), \286 ISAPNP_DEVICE_ID(_fa, _fb, _fc, _mpu401), } \287 }288 289 280 static struct pnp_card_device_id snd_opti9xx_pnpids[] = { 290 281 #ifndef OPTi93X … … 2113 2104 if (chip->fm_port > 0) { 2114 2105 opl3_t *opl3 = NULL; 2115 #ifdef USE_OPL42116 2106 #ifndef OPTi93X 2117 2107 if (chip->hardware == OPTi9XX_HW_82C928 || … … 2132 2122 } 2133 2123 #endif /* !OPTi93X */ 2134 #endif2135 2124 if (!opl3 && snd_opl3_create(card, 2136 2125 chip->fm_port, … … 2203 2192 int cards, error; 2204 2193 2194 #ifdef CONFIG_PNP 2205 2195 cards = pnp_register_card_driver(&opti9xx_pnpc_driver); 2196 #else 2197 cards = 0; 2198 #endif 2206 2199 if (cards == 0 && (error = snd_card_opti9xx_probe(NULL, NULL)) < 0) { 2207 2200 #ifdef CONFIG_PNP -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/emu8000.c
r224 r250 1139 1139 return err; 1140 1140 } 1141 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)1141 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 1142 1142 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000, 1143 1143 sizeof(emu8000_t*), &awe) >= 0) { … … 1145 1145 *(emu8000_t**)SNDRV_SEQ_DEVICE_ARGPTR(awe) = hw; 1146 1146 } 1147 #else 1148 awe = NULL; 1147 1149 #endif 1148 1150 if (awe_ret) -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c
r246 r250 122 122 if (err < 0) { 123 123 snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 124 kfree(cfg); 124 125 return err; 125 126 } -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c
r246 r250 67 67 #endif 68 68 69 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE))69 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))) 70 70 #define SNDRV_SBAWE_EMU8000 71 71 #endif … … 275 275 #endif 276 276 277 #ifdef CONFIG_PNP 278 277 279 static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, 278 280 struct pnp_card_link *card, … … 365 367 } 366 368 369 #endif /* CONFIG_PNP */ 370 367 371 static int __init snd_sb16_probe(int dev, 368 372 struct pnp_card_link *pcard, … … 389 393 return -ENOMEM; 390 394 acard = (struct snd_card_sb16 *) card->private_data; 395 #ifdef CONFIG_PNP 391 396 if (isapnp[dev]) { 392 397 if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) { … … 395 400 } 396 401 } 402 #endif 397 403 398 404 xirq = irq[dev]; -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_csp.c
r224 r250 392 392 393 393 /* fill in codec header */ 394 strncpy(p->codec_name, info.codec_name, sizeof(p->codec_name) - 1); 395 p->codec_name[sizeof(p->codec_name) - 1] = 0; 394 strlcpy(p->codec_name, info.codec_name, sizeof(p->codec_name)); 396 395 p->func_nr = func_nr; 397 396 p->mode = LE_SHORT(funcdesc_h.flags_play_rec); -
GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8_midi.c
r246 r250 22 22 * Fixed typo in snd_sb8dsp_midi_new_device which prevented midi from 23 23 * working. 24 * 25 * Sun May 11 12:34:56 UTC 2003 Clemens Ladisch <clemens@ladisch.de> 26 * Added full duplex UART mode for DSP version 2.0 and later. 24 27 */ 25 28 … … 41 44 42 45 if (chip == NULL || (rmidi = chip->rmidi) == NULL) { 43 inb(SBP(chip, READ)); /* ack interrupt */46 inb(SBP(chip, DATA_AVAIL)); /* ack interrupt */ 44 47 return IRQ_NONE; 45 48 } … … 48 51 if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { 49 52 byte = inb(SBP(chip, READ)); 53 if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) { 50 54 spin_unlock(&chip->midi_input_lock); 51 55 snd_rawmidi_receive(chip->midi_substream_input, &byte, 1); … … 53 57 spin_unlock(&chip->midi_input_lock); 54 58 } 59 } else { 60 spin_unlock(&chip->midi_input_lock); 61 } 55 62 } 56 63 return IRQ_HANDLED; … … 65 72 unsigned long flags; 66 73 sb_t *chip; 67 68 chip = snd_magic_cast(sb_t, substream->rmidi->private_data, return -ENXIO); 69 spin_lock_irqsave(&chip->open_lock, flags); 70 if (chip->open) { 74 unsigned int valid_open_flags; 75 76 chip = snd_magic_cast(sb_t, substream->rmidi->private_data, return -ENXIO); 77 valid_open_flags = chip->hardware >= SB_HW_20 78 ? SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER : 0; 79 spin_lock_irqsave(&chip->open_lock, flags); 80 if (chip->open & ~valid_open_flags) { 71 81 spin_unlock_irqrestore(&chip->open_lock, flags); 72 82 return -EAGAIN; … … 77 87 spin_unlock_irqrestore(&chip->open_lock, flags); 78 88 snd_sbdsp_reset(chip); /* reset DSP */ 89 if (chip->hardware >= SB_HW_20) 90 snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ); 79 91 } else { 80 92 spin_unlock_irqrestore(&chip->open_lock, flags); … … 87 99 unsigned long flags; 88 100 sb_t *chip; 89 90 chip = substream->rmidi->private_data; 91 spin_lock_irqsave(&chip->open_lock, flags); 92 if (chip->open) { 101 unsigned int valid_open_flags; 102 103 chip = substream->rmidi->private_data; 104 valid_open_flags = chip->hardware >= SB_HW_20 105 ? SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_INPUT_TRIGGER : 0; 106 spin_lock_irqsave(&chip->open_lock, flags); 107 if (chip->open & ~valid_open_flags) { 93 108 spin_unlock_irqrestore(&chip->open_lock, flags); 94 109 return -EAGAIN; … … 99 114 spin_unlock_irqrestore(&chip->open_lock, flags); 100 115 snd_sbdsp_reset(chip); /* reset DSP */ 116 if (chip->hardware >= SB_HW_20) 117 snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ); 101 118 } else { 102 119 spin_unlock_irqrestore(&chip->open_lock, flags); … … 112 129 chip = substream->rmidi->private_data; 113 130 spin_lock_irqsave(&chip->open_lock, flags); 114 chip->open &= ~(SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_TRIGGER);131 chip->open &= ~(SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_INPUT_TRIGGER); 115 132 chip->midi_substream_input = NULL; 116 133 if (!(chip->open & SB_OPEN_MIDI_OUTPUT)) { … … 130 147 chip = substream->rmidi->private_data; 131 148 spin_lock_irqsave(&chip->open_lock, flags); 132 chip->open &= ~SB_OPEN_MIDI_OUTPUT;149 chip->open &= ~(SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER); 133 150 chip->midi_substream_output = NULL; 134 151 if (!(chip->open & SB_OPEN_MIDI_INPUT)) { … … 149 166 spin_lock_irqsave(&chip->open_lock, flags); 150 167 if (up) { 151 if (!(chip->open & SB_OPEN_MIDI_TRIGGER)) { 168 if (!(chip->open & SB_OPEN_MIDI_INPUT_TRIGGER)) { 169 if (chip->hardware < SB_HW_20) 152 170 snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ); 153 chip->open |= SB_OPEN_MIDI_TRIGGER; 154 } 155 } else { 156 if (chip->open & SB_OPEN_MIDI_TRIGGER) { 171 chip->open |= SB_OPEN_MIDI_INPUT_TRIGGER; 172 } 173 } else { 174 if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) { 175 if (chip->hardware < SB_HW_20) 157 176 snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ); 158 chip->open &= ~SB_OPEN_MIDI_TRIGGER;177 chip->open &= ~SB_OPEN_MIDI_INPUT_TRIGGER; 159 178 } 160 179 } … … 173 192 while (max-- > 0) { 174 193 spin_lock_irqsave(&chip->open_lock, flags); 175 if (snd_rawmidi_transmit(substream, &byte, 1) != 1) {176 chip->open &= ~SB_OPEN_MIDI_TRIGGER;194 if (snd_rawmidi_transmit_peek(substream, &byte, 1) != 1) { 195 chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER; 177 196 del_timer(&chip->midi_timer); 178 197 spin_unlock_irqrestore(&chip->open_lock, flags); 179 return; 180 } 198 break; 199 } 200 if (chip->hardware >= SB_HW_20) { 201 int timeout = 8; 202 while ((inb(SBP(chip, STATUS)) & 0x80) != 0 && --timeout > 0) 203 ; 204 if (timeout == 0) { 205 /* Tx FIFO full - try again later */ 206 spin_unlock_irqrestore(&chip->open_lock, flags); 207 break; 208 } 209 outb(byte, SBP(chip, WRITE)); 210 } else { 181 211 snd_sbdsp_command(chip, SB_DSP_MIDI_OUTPUT); 182 212 snd_sbdsp_command(chip, byte); 213 } 214 snd_rawmidi_transmit_ack(substream, 1); 183 215 spin_unlock_irqrestore(&chip->open_lock, flags); 184 216 } … … 206 238 spin_lock_irqsave(&chip->open_lock, flags); 207 239 if (up) { 208 if (!(chip->open & SB_OPEN_MIDI_TRIGGER)) {240 if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) { 209 241 init_timer(&chip->midi_timer); 210 242 chip->midi_timer.function = snd_sb8dsp_midi_output_timer; … … 212 244 chip->midi_timer.expires = 1 + jiffies; 213 245 add_timer(&chip->midi_timer); 214 chip->open |= SB_OPEN_MIDI_TRIGGER;215 216 217 if (chip->open & SB_OPEN_MIDI_TRIGGER) {218 chip->open &= ~SB_OPEN_MIDI_TRIGGER;246 chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER; 247 } 248 } else { 249 if (chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER) { 250 chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER; 219 251 } 220 252 } … … 255 287 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_sb8dsp_midi_output); 256 288 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_sb8dsp_midi_input); 257 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; 289 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT; 290 if (chip->hardware >= SB_HW_20) 291 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX; 258 292 rmidi->private_data = chip; 259 293 chip->rmidi = rmidi; -
GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c
r246 r250 180 180 181 181 if (cs4232_pcm_port[dev] != SNDRV_AUTO_PORT) 182 pnp_resource_change(&cfg->port_resource[0], cs4232_pcm_port[dev], 4); 182 183 if (fm_port[dev] != SNDRV_AUTO_PORT) 183 184 pnp_resource_change(&cfg->port_resource[1], fm_port[dev], 4); -
GPL/branches/alsa-resync1/alsa-kernel/pci/cs4281.c
r212 r250 27 27 #include <linux/pci.h> 28 28 #include <linux/slab.h> 29 #ifndef TARGET_OS2 //TODO: Implement linux/gameport.h 30 #include <linux/gameport.h> 31 #endif /* TARGET_OS2 */ 29 32 #include <sound/core.h> 30 33 #include <sound/control.h> … … 36 39 #include <sound/initval.h> 37 40 38 #ifndef LINUX_2_239 #include <linux/gameport.h>40 #endif41 41 42 42 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 1247 1247 */ 1248 1248 1249 #if ndef LINUX_2_21249 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1250 1250 1251 1251 typedef struct snd_cs4281_gameport { … … 1342 1342 static int snd_cs4281_free(cs4281_t *chip) 1343 1343 { 1344 #if ndef LINUX_2_21344 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1345 1345 if (chip->gameport) { 1346 1346 gameport_unregister_port(&chip->gameport->info); … … 1730 1730 chip->uartm |= CS4281_MODE_OUTPUT; 1731 1731 chip->midcr |= BA0_MIDCR_TXE; 1732 chip->midi_input = substream;1732 chip->midi_output = substream; 1733 1733 if (!(chip->uartm & CS4281_MODE_INPUT)) { 1734 1734 snd_cs4281_midi_reset(chip); … … 1913 1913 /* EOI to the PCI part... reenables interrupts */ 1914 1914 snd_cs4281_pokeBA0(chip, BA0_HICR, BA0_HICR_EOI); 1915 1915 1916 return IRQ_HANDLED; 1916 1917 … … 1991 1992 return err; 1992 1993 } 1993 #ifndef LINUX_2_21994 #ifndef TARGET_OS2 1994 1995 snd_cs4281_gameport(chip); 1995 #endif 1996 #endif /* !TARGET_OS2 */ 1996 1997 strcpy(card->driver, "CS4281"); 1997 1998 strcpy(card->shortname, "Cirrus Logic CS4281"); -
GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c
r212 r250 667 667 } 668 668 669 #define big_mdelay(msec) do {\ 670 set_current_state(TASK_UNINTERRUPTIBLE);\ 671 schedule_timeout(((msec) * HZ + 999) / 1000);\ 672 } while (0) 673 669 674 /* Wait for the codec bus to be free */ 670 675 static int snd_es1968_ac97_wait(es1968_t *chip) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ak4xxx.c
r246 r250 28 28 #include <linux/init.h> 29 29 #include <sound/core.h> 30 #include <sound/initval.h> 30 31 #include "ice1712.h" 32 33 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 34 MODULE_DESCRIPTION("ICEnsemble ICE17xx <-> AK4xxx AD/DA chip interface"); 35 MODULE_LICENSE("GPL"); 36 MODULE_CLASSES("{sound}"); 31 37 32 38 static void snd_ice1712_akm4xxx_lock(akm4xxx_t *ak, int chip) … … 98 104 } 99 105 100 /* save the data */101 if (ak->type == SND_AK4524 || ak->type == SND_AK4528) {102 if ((addr != 0x04 && addr != 0x05) || (data & 0x80) == 0)103 ak->images[chip][addr] = data;104 else105 ak->ipga_gain[chip][addr-4] = data;106 } else {107 /* AK4529, or else */108 ak->images[chip][addr] = data;109 }110 111 106 if (priv->cs_mask == priv->cs_addr) { 112 107 if (priv->cif) { … … 180 175 return 0; 181 176 } 177 178 EXPORT_SYMBOL(snd_ice1712_akm4xxx_init); 179 EXPORT_SYMBOL(snd_ice1712_akm4xxx_free); 180 EXPORT_SYMBOL(snd_ice1712_akm4xxx_build_controls); -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ews.c
r246 r250 390 390 */ 391 391 392 /* 6fire specific */ 393 #define PCF9554_REG_INPUT 0 394 #define PCF9554_REG_OUTPUT 1 395 #define PCF9554_REG_POLARITY 2 396 #define PCF9554_REG_CONFIG 3 397 398 static int snd_ice1712_6fire_write_pca(ice1712_t *ice, unsigned char reg, unsigned char data); 399 392 400 static int __devinit snd_ice1712_ews_init(ice1712_t *ice) 393 401 { … … 426 434 return err; 427 435 } 436 snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); 428 437 break; 429 438 case ICE1712_SUBDEVICE_EWS88MT: … … 450 459 if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0) 451 460 return err; 461 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); 452 462 break; 453 463 case ICE1712_SUBDEVICE_DMX6FIRE: 454 464 if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0) 455 465 return err; 466 snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR); 456 467 break; 457 468 case ICE1712_SUBDEVICE_EWS88MT: … … 750 761 * DMX 6Fire specific controls 751 762 */ 752 753 #define PCF9554_REG_INPUT 0754 #define PCF9554_REG_OUTPUT 1755 #define PCF9554_REG_POLARITY 2756 #define PCF9554_REG_CONFIG 3757 763 758 764 static int snd_ice1712_6fire_read_pca(ice1712_t *ice, unsigned char reg) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c
r246 r250 119 119 120 120 /* 121 * AK4xxx stuff122 */123 124 #include "ak4xxx.c"125 126 /*127 121 * Basic I/O 128 122 */ … … 305 299 { 306 300 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, data); 301 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 307 302 } 308 303 … … 310 305 { 311 306 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, data); 307 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 312 308 } 313 309 … … 320 316 { 321 317 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, val); 318 inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ 322 319 } 323 320 … … 667 664 return 0; 668 665 ptr = runtime->buffer_size - inw(ice->ddma_port + 4); 666 if (ptr == runtime->buffer_size) 667 ptr = 0; 669 668 return bytes_to_frames(substream->runtime, ptr); 670 669 } … … 684 683 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - 685 684 ice->playback_con_virt_addr[substream->number]; 685 if (ptr == substream->runtime->buffer_size) 686 ptr = 0; 686 687 return bytes_to_frames(substream->runtime, ptr); 687 688 } … … 695 696 return 0; 696 697 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; 698 if (ptr == substream->runtime->buffer_size) 699 ptr = 0; 697 700 return bytes_to_frames(substream->runtime, ptr); 698 701 } … … 1105 1108 return 0; 1106 1109 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); 1110 if (ptr == substream->runtime->buffer_size) 1111 ptr = 0; 1107 1112 return bytes_to_frames(substream->runtime, ptr); 1108 1113 } … … 1116 1121 return 0; 1117 1122 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); 1123 if (ptr == substream->runtime->buffer_size) 1124 ptr = 0; 1118 1125 return bytes_to_frames(substream->runtime, ptr); 1119 1126 } … … 2152 2159 { 2153 2160 int dev = 0xa0; /* EEPROM device address */ 2154 unsigned int i ;2161 unsigned int i, size; 2155 2162 2156 2163 if ((inb(ICEREG(ice, I2C_CTRL)) & ICE1712_I2C_EEPROM) == 0) { … … 2163 2170 (snd_ice1712_read_i2c(ice, dev, 0x03) << 24); 2164 2171 ice->eeprom.size = snd_ice1712_read_i2c(ice, dev, 0x04); 2165 if (ice->eeprom.size > 32) { 2172 if (ice->eeprom.size < 6) 2173 ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ 2174 else if (ice->eeprom.size > 32) { 2166 2175 snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); 2167 2176 return -EIO; … … 2172 2181 /* return -EIO; */ 2173 2182 } 2174 for (i = 0; i < ice->eeprom.size; i++) 2183 size = ice->eeprom.size - 6; 2184 for (i = 0; i < size; i++) 2175 2185 ice->eeprom.data[i] = snd_ice1712_read_i2c(ice, dev, i + 6); 2176 2186 -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h
r246 r250 457 457 int (*build_controls)(ice1712_t *); 458 458 int no_mpu401: 1; 459 unsigned int eeprom_size; 460 unsigned char *eeprom_data; 459 461 }; 460 462 -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c
r246 r250 43 43 #include "amp.h" 44 44 #include "revo.h" 45 #include "aureon.h" 45 46 46 47 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); … … 51 52 REVO_DEVICE_DESC 52 53 AMP_AUDIO2000_DEVICE_DESC 54 AUREON_DEVICE_DESC 53 55 "{VIA,VT1724}," 54 56 "{ICEnsemble,Generic ICE1724}," … … 89 91 90 92 /* 91 * AK4xxx stuff92 */93 94 #include "ak4xxx.c"95 96 /*97 93 * Basic I/O 98 94 */ … … 123 119 if (!(old_cmd & VT1724_AC97_READY)) 124 120 continue; 125 return 0; 126 } 121 return old_cmd; 122 } 123 snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n"); 127 124 return old_cmd; 128 125 } … … 134 131 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0) 135 132 return 0; 133 snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n"); 136 134 return -EIO; 137 135 } … … 145 143 146 144 old_cmd = snd_vt1724_ac97_ready(ice); 145 old_cmd &= ~VT1724_AC97_ID_MASK; 146 old_cmd |= ac97->num; 147 147 outb(reg, ICEMT1724(ice, AC97_INDEX)); 148 148 outw(val, ICEMT1724(ice, AC97_DATA)); 149 old_cmd &= ~(VT1724_AC97_PBK_VSR | VT1724_AC97_CAP_VSR);150 149 outb(old_cmd | VT1724_AC97_WRITE, ICEMT1724(ice, AC97_CMD)); 151 150 snd_vt1724_ac97_wait_bit(ice, VT1724_AC97_WRITE); … … 158 157 159 158 old_cmd = snd_vt1724_ac97_ready(ice); 159 old_cmd &= ~VT1724_AC97_ID_MASK; 160 old_cmd |= ac97->num; 160 161 outb(reg, ICEMT1724(ice, AC97_INDEX)); 161 162 outb(old_cmd | VT1724_AC97_READ, ICEMT1724(ice, AC97_CMD)); … … 174 175 { 175 176 outl(data, ICEREG1724(ice, GPIO_DIRECTION)); 177 inw(ICEREG1724(ice, GPIO_DIRECTION)); /* dummy read for pci-posting */ 176 178 } 177 179 … … 181 183 outw(data, ICEREG1724(ice, GPIO_WRITE_MASK)); 182 184 outb((data >> 16) & 0xff, ICEREG1724(ice, GPIO_WRITE_MASK_22)); 185 inw(ICEREG1724(ice, GPIO_WRITE_MASK)); /* dummy read for pci-posting */ 183 186 } 184 187 … … 187 190 outw(data, ICEREG1724(ice, GPIO_DATA)); 188 191 outb(data >> 16, ICEREG1724(ice, GPIO_DATA_22)); 192 inw(ICEREG1724(ice, GPIO_DATA)); /* dummy read for pci-posting */ 189 193 } 190 194 … … 417 421 if (val != old) { 418 422 outb(val, ICEMT1724(ice, I2S_FORMAT)); 419 /* FIXME: is this revo only? */ 420 /* assert PRST# to converters; MT05 bit 7 */ 421 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 422 spin_unlock_irqrestore(&ice->reg_lock, flags); 423 mdelay(5); 424 spin_lock_irqsave(&ice->reg_lock, flags); 425 /* deassert PRST# */ 426 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 423 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_REVOLUTION71) { 424 /* FIXME: is this revo only? */ 425 /* assert PRST# to converters; MT05 bit 7 */ 426 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 427 spin_unlock_irqrestore(&ice->reg_lock, flags); 428 mdelay(5); 429 spin_lock_irqsave(&ice->reg_lock, flags); 430 /* deassert PRST# */ 431 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 432 } 427 433 } 428 434 } … … 885 891 if (! (ice->eeprom.data[ICE_EEP2_ACLINK] & VT1724_CFG_PRO_I2S)) { 886 892 ac97_t ac97; 893 /* cold reset */ 894 outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD)); 895 mdelay(5); /* FIXME */ 896 outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD)); 897 887 898 memset(&ac97, 0, sizeof(ac97)); 888 899 ac97.write = snd_vt1724_ac97_write; … … 1541 1552 */ 1542 1553 1554 static struct snd_ice1712_card_info no_matched __devinitdata; 1555 1556 static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 1557 snd_vt1724_revo_cards, 1558 snd_vt1724_amp_cards, 1559 snd_vt1724_aureon_cards, 1560 0, 1561 }; 1562 1563 1564 /* 1565 */ 1566 1543 1567 static unsigned char __devinit snd_vt1724_read_i2c(ice1712_t *ice, 1544 1568 unsigned char dev, … … 1556 1580 { 1557 1581 int dev = 0xa0; /* EEPROM device address */ 1558 unsigned int i; 1582 unsigned int i, size; 1583 struct snd_ice1712_card_info **tbl, *c; 1559 1584 1560 1585 if ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_EEPROM) == 0) { … … 1566 1591 (snd_vt1724_read_i2c(ice, dev, 0x02) << 16) | 1567 1592 (snd_vt1724_read_i2c(ice, dev, 0x03) << 24); 1593 1594 /* if the EEPROM is given by the driver, use it */ 1595 for (tbl = card_tables; *tbl; tbl++) { 1596 for (c = *tbl; c->subvendor; c++) { 1597 if (c->subvendor == ice->eeprom.subvendor) { 1598 if (! c->eeprom_size || ! c->eeprom_data) 1599 goto found; 1600 snd_printdd("using the defined eeprom..\n"); 1601 ice->eeprom.version = 2; 1602 ice->eeprom.size = c->eeprom_size + 6; 1603 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); 1604 goto read_skipped; 1605 } 1606 } 1607 } 1608 1609 found: 1568 1610 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); 1569 if (ice->eeprom.size > 32) { 1611 if (ice->eeprom.size < 6) 1612 ice->eeprom.size = 32; 1613 else if (ice->eeprom.size > 32) { 1570 1614 snd_printk("invalid EEPROM (size = %i)\n", ice->eeprom.size); 1571 1615 return -EIO; … … 1576 1620 // return -EIO; 1577 1621 } 1578 for (i = 0; i < ice->eeprom.size; i++) 1622 size = ice->eeprom.size - 6; 1623 for (i = 0; i < size; i++) 1579 1624 ice->eeprom.data[i] = snd_vt1724_read_i2c(ice, dev, i + 6); 1580 1625 1626 read_skipped: 1581 1627 ice->eeprom.gpiomask = eeprom_triple(ice, ICE_EEP2_GPIO_MASK); 1582 1628 ice->eeprom.gpiostate = eeprom_triple(ice, ICE_EEP2_GPIO_STATE); … … 1804 1850 */ 1805 1851 1806 static struct snd_ice1712_card_info no_matched __devinitdata;1807 1808 static struct snd_ice1712_card_info *card_tables[] __devinitdata = {1809 snd_vt1724_revo_cards,1810 snd_vt1724_amp_cards,1811 0,1812 };1813 1814 1815 1852 static int __devinit snd_vt1724_probe(struct pci_dev *pci, 1816 1853 const struct pci_device_id *pci_id) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/makefile.os2
r246 r250 15 15 FILE1 = ak4xxx.obj delta.obj ews.obj hoontech.obj ice1712.obj 16 16 FILE2 = ice1724.obj revo.obj 17 FILE3 = 17 FILE3 = aureon.obj 18 18 FILE4 = 19 19 FILE5 = -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/revo.c
r246 r250 60 60 shift = 3; 61 61 } 62 tmp = ak->images[0][reg];62 tmp = snd_akm4xxx_get(ak, 0, reg); 63 63 old = (tmp >> shift) & 0x03; 64 64 if (old == dfs) … … 67 67 /* reset DFS */ 68 68 snd_akm4xxx_reset(ak, 1); 69 tmp = ak->images[0][reg];69 tmp = snd_akm4xxx_get(ak, 0, reg); 70 70 tmp &= ~(0x03 << shift); 71 71 tmp |= dfs << shift; … … 122 122 { 123 123 akm4xxx_t *ak; 124 int err; 124 125 125 126 /* determine I2C, DACs and ADCs */ … … 140 141 switch (ice->eeprom.subvendor) { 141 142 case VT1724_SUBDEVICE_REVOLUTION71: 142 snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice); 143 snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice); 143 if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0) 144 return err; 145 if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0) 146 return err; 144 147 /* unmute all codecs */ 145 148 snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE); -
GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c
r246 r250 1145 1145 1146 1146 if (!doorbellValue) 1147 return IRQ_ HANDLED;1147 return IRQ_NONE; 1148 1148 1149 1149 spin_lock(&korg1212->lock); … … 1219 1219 1220 1220 spin_unlock(&korg1212->lock); 1221 1221 1222 return IRQ_HANDLED; 1222 1223 } -
GPL/branches/alsa-resync1/alsa-kernel/pci/maestro3.c
r212 r250 44 44 #include <sound/control.h> 45 45 #include <sound/pcm.h> 46 #include <sound/mpu401.h> 46 47 #include <sound/ac97_codec.h> 47 48 #define SNDRV_GET_ID … … 1055 1056 */ 1056 1057 1058 #define big_mdelay(msec) do {\ 1059 set_current_state(TASK_UNINTERRUPTIBLE);\ 1060 schedule_timeout(((msec) * HZ) / 1000);\ 1061 } while (0) 1062 1057 1063 inline static void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg) 1058 1064 { -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c
r246 r250 807 807 switch (mode) { 808 808 case RME96_CLOCKMODE_SLAVE: 809 /* AutoSync */ 809 810 rme96->wcreg &= ~RME96_WCR_MASTER; 810 811 rme96->areg &= ~RME96_AR_WSEL; 811 812 break; 812 813 case RME96_CLOCKMODE_MASTER: 814 /* Internal */ 813 815 rme96->wcreg |= RME96_WCR_MASTER; 814 816 rme96->areg &= ~RME96_AR_WSEL; … … 1319 1321 1320 1322 runtime->hw = snd_rme96_capture_adat_info; 1321 if (snd_rme96_getinputtype(rme96) != RME96_INPUT_ANALOG) {1323 if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) { 1322 1324 /* makes no sense to use analog input. Note that analog 1323 1325 expension cards AEB4/8-I are RME96_INPUT_INTERNAL */ … … 1863 1865 } 1864 1866 if (rme96->areg & RME96_AR_WSEL) { 1865 snd_iprintf(buffer, " clock mode: word clock\n");1867 snd_iprintf(buffer, " sample clock source: word clock\n"); 1866 1868 } else if (rme96->wcreg & RME96_WCR_MASTER) { 1867 snd_iprintf(buffer, " clock mode: master\n");1869 snd_iprintf(buffer, " sample clock source: internal\n"); 1868 1870 } else if (snd_rme96_getinputtype(rme96) == RME96_INPUT_ANALOG) { 1869 snd_iprintf(buffer, " clock mode: slave (masteranyway due to analog input setting)\n");1871 snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to analog input setting)\n"); 1870 1872 } else if (snd_rme96_capture_getrate(rme96, &n) < 0) { 1871 snd_iprintf(buffer, " clock mode: slave (masteranyway due to no valid signal)\n");1873 snd_iprintf(buffer, " sample clock source: autosync (internal anyway due to no valid signal)\n"); 1872 1874 } else { 1873 snd_iprintf(buffer, " clock mode: slave\n");1875 snd_iprintf(buffer, " sample clock source: autosync\n"); 1874 1876 } 1875 1877 if (rme96->wcreg & RME96_WCR_PRO) { … … 2102 2104 snd_rme96_info_clockmode_control(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2103 2105 { 2104 static char *texts[3] = { " Slave", "Master", "Wordclock" };2106 static char *texts[3] = { "AutoSync", "Internal", "Word" }; 2105 2107 2106 2108 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; … … 2425 2427 { 2426 2428 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2427 .name = " Clock Mode",2429 .name = "Sample Clock Source", 2428 2430 .info = snd_rme96_info_clockmode_control, 2429 2431 .get = snd_rme96_get_clockmode_control, -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c
r246 r250 23 23 24 24 #include <sound/driver.h> 25 #include <linux/init.h> 25 26 #include <linux/delay.h> 26 27 #include <linux/interrupt.h> … … 76 77 #define MULTIFACE_SS_CHANNELS 18 77 78 #define MULTIFACE_DS_CHANNELS 14 79 #define H9652_DS_CHANNELS 26 80 #define H9652_SS_CHANNELS 14 78 81 79 82 /* Write registers. These are defined as byte-offsets from the iobase value. … … 85 88 #define HDSP_interruptConfirmation 96 86 89 #define HDSP_outputEnable 128 87 #define HDSP_ jtagReg25690 #define HDSP_control2Reg 256 88 91 #define HDSP_midiDataOut0 352 89 92 #define HDSP_midiDataOut1 356 … … 121 124 #define HDSP_IO_EXTENT 5192 122 125 123 /* jtagregister bits */126 /* control2 register bits */ 124 127 125 128 #define HDSP_TMS 0x01 … … 134 137 #define HDSP_BIGENDIAN_MODE 0x200 135 138 #define HDSP_RD_MULTIPLE 0x400 139 #define HDSP_9652_ENABLE_MIXER 0x800 136 140 137 141 #define HDSP_S_PROGRAM (HDSP_PROGRAM|HDSP_CONFIG_MODE_0) … … 359 363 struct tasklet_struct midi_tasklet; 360 364 int precise_ptr; 361 u32 control_register; /* cached value */ 365 u32 control_register; /* cached value */ 366 u32 control2_register; /* cached value */ 362 367 u32 creg_spdif; 363 368 u32 creg_spdif_stream; 364 char *card_name; 369 char *card_name; /* digiface/multiface */ 365 370 HDSP_IO_Type io_type; /* ditto, but for code use */ 366 371 unsigned short firmware_rev; 367 372 unsigned short state; /* stores state bits */ 368 373 u32 firmware_cache[24413]; /* this helps recover from accidental iobox power failure */ 369 size_t period_bytes; /* guess what this is */374 size_t period_bytes; /* guess what this is */ 370 375 unsigned char ds_channels; 371 376 unsigned char ss_channels; /* different for multiface/digiface */ … … 434 439 435 440 #ifdef HDSP_PREALLOCATE_MEMORY 436 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr); 437 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr); 441 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 442 { 443 struct snd_dma_device pdev; 444 struct snd_dma_buffer dmbuf; 445 446 snd_dma_device_pci(&pdev, pci, capture); 447 dmbuf.bytes = 0; 448 if (! snd_dma_get_reserved(&pdev, &dmbuf)) { 449 if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0) 450 return NULL; 451 snd_dma_set_reserved(&pdev, &dmbuf); 452 } 453 *addrp = dmbuf.addr; 454 return dmbuf.area; 455 } 456 457 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 458 { 459 struct snd_dma_device dev; 460 snd_dma_device_pci(&dev, pci, capture); 461 snd_dma_free_reserved(&dev); 462 } 463 464 #else 465 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 466 { 467 return snd_malloc_pci_pages(pci, size, addrp); 468 } 469 470 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 471 { 472 snd_free_pci_pages(pci, size, ptr, addr); 473 } 438 474 #endif 439 475 … … 453 489 static int __devinit snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp); 454 490 static int __devinit snd_hdsp_create_pcm(snd_card_t *card, hdsp_t *hdsp); 455 static inline int snd_hdsp_ initialize_input_enable(hdsp_t *hdsp);491 static inline int snd_hdsp_enable_io (hdsp_t *hdsp); 456 492 static inline void snd_hdsp_initialize_midi_flush (hdsp_t *hdsp); 457 493 static inline void snd_hdsp_initialize_channels (hdsp_t *hdsp); … … 461 497 static int snd_hdsp_set_defaults(hdsp_t *hdsp); 462 498 463 static inline int hdsp_is_9652 (hdsp_t *hdsp)464 {465 switch (hdsp->firmware_rev) {466 case 0x64:467 case 0x65:468 case 0x68:469 return 1;470 default:471 return 0;472 }473 }474 475 499 static inline int hdsp_playback_to_output_key (hdsp_t *hdsp, int in, int out) 476 500 { … … 505 529 static inline int hdsp_check_for_iobox (hdsp_t *hdsp) 506 530 { 531 532 if (hdsp->io_type == H9652) return 0; 507 533 if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { 508 534 snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); … … 511 537 } 512 538 return 0; 539 513 540 } 514 541 … … 522 549 snd_printk ("loading firmware\n"); 523 550 524 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_PROGRAM);551 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); 525 552 hdsp_write (hdsp, HDSP_fifoData, 0); 526 553 … … 530 557 } 531 558 532 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);559 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 533 560 534 561 for (i = 0; i < 24413; ++i) { … … 545 572 } 546 573 547 hdsp_write (hdsp, HDSP_jtagReg, 0); 574 #ifdef SNDRV_BIG_ENDIAN 575 hdsp->control2_register = HDSP_BIGENDIAN_MODE; 576 #else 577 hdsp->control2_register = 0; 578 #endif 579 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 548 580 snd_printk ("finished firmware loading\n"); 549 581 … … 575 607 } 576 608 577 if ((err = snd_hdsp_ initialize_input_enable(hdsp)) < 0) {609 if ((err = snd_hdsp_enable_io(hdsp)) < 0) { 578 610 return err; 579 611 } … … 581 613 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 582 614 583 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_PROGRAM);615 hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); 584 616 hdsp_write (hdsp, HDSP_fifoData, 0); 585 617 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) { … … 587 619 } 588 620 589 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);621 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 590 622 hdsp_write (hdsp, HDSP_fifoData, 0); 591 623 592 624 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT)) { 593 625 hdsp->io_type = Multiface; 594 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_VERSION_BIT);595 hdsp_write (hdsp, HDSP_ jtagReg, HDSP_S_LOAD);626 hdsp_write (hdsp, HDSP_control2Reg, HDSP_VERSION_BIT); 627 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 596 628 hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); 597 629 } else { … … 658 690 unsigned int ad; 659 691 660 if (hdsp_is_9652 (hdsp)) { 661 662 if ((ad = addr/2) < 676) { 663 664 /* from martin björnsen: 665 666 "You can only write dwords to the 667 mixer memory which contain two 668 mixer values in the low and high 669 word. So if you want to change 670 value 0 you have to read value 1 671 from the cache and write both to 672 the first dword in the mixer 673 memory." 674 */ 675 676 hdsp->mixer_matrix[addr] = data; 677 hdsp_write (hdsp, 1024 + ad, 678 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 679 hdsp->mixer_matrix[addr&0x7fe]); 680 return 0; 681 } else { 682 return -1; 683 } 692 if (addr >= HDSP_MATRIX_MIXER_SIZE) 693 return -1; 684 694 695 if (hdsp->io_type == H9652) { 696 697 /* from martin björnsen: 698 699 "You can only write dwords to the 700 mixer memory which contain two 701 mixer values in the low and high 702 word. So if you want to change 703 value 0 you have to read value 1 704 from the cache and write both to 705 the first dword in the mixer 706 memory." 707 */ 708 709 hdsp->mixer_matrix[addr] = data; 710 711 /* `addr' addresses a 16-bit wide address, but 712 the address space accessed via hdsp_write 713 uses byte offsets. put another way, addr 714 varies from 0 to 1351, but to access the 715 corresponding memory location, we need 716 to access 0 to 2703 ... 717 */ 718 719 hdsp_write (hdsp, 4096 + (addr*2), 720 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 721 hdsp->mixer_matrix[addr&0x7fe]); 722 723 return 0; 685 724 686 725 } else { 687 if (addr >= HDSP_MATRIX_MIXER_SIZE) 688 return -1; 689 726 690 727 ad = (addr << 16) + data; 691 728 … … 830 867 int rate_bits; 831 868 869 /* ASSUMPTION: hdsp->lock is either help, or 870 there is no need for it (e.g. during module 871 initialization). 872 */ 873 832 874 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 833 875 if (called_internally) { … … 861 903 is to flag rate changes in the read/write routines. */ 862 904 863 spin_lock_irq(&hdsp->lock);864 865 905 switch (rate) { 866 906 case 32000: … … 901 941 break; 902 942 default: 903 spin_unlock_irq(&hdsp->lock);904 943 return -EINVAL; 905 944 } … … 909 948 hdsp->capture_pid, 910 949 hdsp->playback_pid); 911 spin_unlock_irq(&hdsp->lock);912 950 return -EBUSY; 913 951 } … … 925 963 break; 926 964 case Digiface: 965 case H9652: 927 966 hdsp->channel_map = channel_map_df_ss; 928 967 break; … … 939 978 } 940 979 941 spin_unlock_irq(&hdsp->lock);942 980 return 0; 943 981 } … … 1132 1170 hdsp_midi_t *hmidi; 1133 1171 unsigned long flags; 1172 u32 ie; 1134 1173 1135 1174 hmidi = (hdsp_midi_t *) substream->rmidi->private_data; 1136 1175 hdsp = hmidi->hdsp; 1176 ie = hmidi->id ? HDSP_Midi1InterruptEnable : HDSP_Midi0InterruptEnable; 1137 1177 spin_lock_irqsave (&hdsp->lock, flags); 1138 1178 if (up) { 1139 snd_hdsp_flush_midi_input (hdsp, hmidi->id); 1140 if (hmidi->id) 1141 hdsp->control_register |= HDSP_Midi1InterruptEnable; 1142 else 1143 hdsp->control_register |= HDSP_Midi0InterruptEnable; 1179 if (!(hdsp->control_register & ie)) { 1180 snd_hdsp_flush_midi_input (hdsp, hmidi->id); 1181 hdsp->control_register |= ie; 1182 } 1144 1183 } else { 1145 if (hmidi->id) 1146 hdsp->control_register &= ~HDSP_Midi1InterruptEnable; 1147 else 1148 hdsp->control_register &= ~HDSP_Midi0InterruptEnable; 1184 hdsp->control_register &= ~ie; 1149 1185 } 1150 1186 … … 2005 2041 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2006 2042 uinfo->count = 1; 2007 uinfo->value.enumerated.items = (hdsp->io_type == Digiface) ? 6 : 4; 2043 2044 switch (hdsp->io_type) { 2045 case Digiface: 2046 case H9652: 2047 uinfo->value.enumerated.items = 6; 2048 break; 2049 case Multiface: 2050 uinfo->value.enumerated.items = 4; 2051 default: 2052 uinfo->value.enumerated.items = 0; 2053 break; 2054 } 2055 2008 2056 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2009 2057 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; … … 2029 2077 if (!snd_hdsp_use_is_exclusive(hdsp)) 2030 2078 return -EBUSY; 2031 max = (hdsp->io_type == Digiface) ? 6 : 4; 2079 2080 switch (hdsp->io_type) { 2081 case Digiface: 2082 case H9652: 2083 max = 6; 2084 break; 2085 case Multiface: 2086 max = 4; 2087 break; 2088 default: 2089 return -EIO; 2090 } 2091 2032 2092 val = ucontrol->value.enumerated.item[0] % max; 2033 2093 spin_lock_irqsave(&hdsp->lock, flags); … … 2497 2557 2498 2558 offset = ucontrol->id.index - 1; 2499 snd_assert(offset >= 0 || offset < ((hdsp->io_type == Digiface) ? 3 : 1), return -EINVAL); 2559 snd_assert(offset >= 0); 2560 2561 switch (hdsp->io_type) { 2562 case Digiface: 2563 case H9652: 2564 if (offset >= 3) 2565 return -EINVAL; 2566 break; 2567 case Multiface: 2568 if (offset >= 1) 2569 return -EINVAL; 2570 break; 2571 default: 2572 return -EIO; 2573 } 2574 2500 2575 ucontrol->value.enumerated.item[0] = hdsp_adat_sync_check(hdsp, offset); 2501 2576 return 0; … … 2594 2669 2595 2670 for (idx = 0; idx < HDSP_CONTROLS; idx++) { 2596 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) 2671 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) { 2597 2672 return err; 2673 } 2598 2674 if (idx == 1) /* IEC958 (S/PDIF) Stream */ 2599 2675 hdsp->spdif_ctl = kctl; … … 2603 2679 snd_hdsp_adat_sync_check.name = "ADAT Lock Status"; 2604 2680 2605 if (hdsp->io_type == Digiface) { 2681 switch (hdsp->io_type) { 2682 case Digiface: 2606 2683 limit = DIGIFACE_SS_CHANNELS; 2607 } else { 2684 break; 2685 case H9652: 2686 limit = H9652_SS_CHANNELS; 2687 break; 2688 case Multiface: 2608 2689 limit = MULTIFACE_SS_CHANNELS; 2690 break; 2691 default: 2692 return -EIO; 2609 2693 } 2610 2694 … … 2628 2712 return err; 2629 2713 } 2630 if (hdsp->io_type == Digiface ) {2714 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { 2631 2715 for (idx = 1; idx < 3; ++idx) { 2632 2716 snd_hdsp_adat_sync_check.index = idx+1; … … 2682 2766 hdsp->irq, hdsp->port, hdsp->iobase); 2683 2767 snd_iprintf(buffer, "Control register: 0x%x\n", hdsp->control_register); 2768 snd_iprintf(buffer, "Control2 register: 0x%x\n", hdsp->control2_register); 2684 2769 snd_iprintf(buffer, "Status register: 0x%x\n", status); 2685 2770 snd_iprintf(buffer, "Status2 register: 0x%x\n", status2); … … 2855 2940 switch (hdsp->io_type) { 2856 2941 case Digiface: 2942 case H9652: 2857 2943 x = status & HDSP_Sync1; 2858 2944 if (status & HDSP_Lock1) { … … 2914 3000 { 2915 3001 if (hdsp->capture_buffer_unaligned) { 2916 #ifndef HDSP_PREALLOCATE_MEMORY 2917 snd_free_pci_pages(hdsp->pci, 2918 HDSP_DMA_AREA_BYTES, 2919 hdsp->capture_buffer_unaligned, 2920 hdsp->capture_buffer_addr); 2921 #else 2922 snd_hammerfall_free_buffer(hdsp->pci, hdsp->capture_buffer_unaligned); 2923 #endif 3002 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, 3003 hdsp->capture_buffer_unaligned, 3004 hdsp->capture_buffer_addr, 1); 2924 3005 } 2925 3006 2926 3007 if (hdsp->playback_buffer_unaligned) { 2927 #ifndef HDSP_PREALLOCATE_MEMORY 2928 snd_free_pci_pages(hdsp->pci, 2929 HDSP_DMA_AREA_BYTES, 2930 hdsp->playback_buffer_unaligned, 2931 hdsp->playback_buffer_addr); 2932 #else 2933 snd_hammerfall_free_buffer(hdsp->pci, hdsp->playback_buffer_unaligned); 2934 #endif 3008 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, 3009 hdsp->playback_buffer_unaligned, 3010 hdsp->playback_buffer_addr, 0); 2935 3011 } 2936 3012 } … … 2942 3018 unsigned long pb_bus, cb_bus; 2943 3019 2944 #ifndef HDSP_PREALLOCATE_MEMORY 2945 cb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr); 2946 pb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr); 2947 #else 2948 cb = snd_hammerfall_get_buffer(hdsp->pci, &cb_addr); 2949 pb = snd_hammerfall_get_buffer(hdsp->pci, &pb_addr); 2950 #endif 3020 cb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr, 1); 3021 pb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr, 0); 2951 3022 2952 3023 if (cb == 0 || pb == 0) { 2953 3024 if (cb) { 2954 #ifdef HDSP_PREALLOCATE_MEMORY 2955 snd_hammerfall_free_buffer(hdsp->pci, cb); 2956 #else 2957 snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr); 2958 #endif 3025 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr, 1); 2959 3026 } 2960 3027 if (pb) { 2961 #ifdef HDSP_PREALLOCATE_MEMORY 2962 snd_hammerfall_free_buffer(hdsp->pci, pb); 2963 #else 2964 snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr); 2965 #endif 3028 snd_hammerfall_free_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr, 0); 2966 3029 } 2967 3030 … … 3026 3089 } 3027 3090 3028 for (i = 0; i < (hdsp _is_9652(hdsp)? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) {3091 for (i = 0; i < (hdsp->io_type == H9652 ? 1352 : HDSP_MATRIX_MIXER_SIZE); i++) { 3029 3092 if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) { 3030 3093 return -EIO; … … 3032 3095 } 3033 3096 3034 if ( !hdsp_is_9652(hdsp) && line_outs_monitor[hdsp->dev]) {3097 if ((hdsp->io_type != H9652) && line_outs_monitor[hdsp->dev]) { 3035 3098 3036 3099 snd_printk ("sending all inputs and playback streams to line outs.\n"); … … 3292 3355 */ 3293 3356 3357 spin_lock_irq(&hdsp->lock); 3294 3358 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { 3359 spin_unlock_irq(&hdsp->lock); 3295 3360 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); 3296 3361 return err; 3362 } else { 3363 spin_unlock_irq(&hdsp->lock); 3297 3364 } 3298 3365 … … 3784 3851 break; 3785 3852 case SNDRV_HDSP_IOCTL_GET_VERSION: 3786 if (hdsp _is_9652(hdsp)) return -EINVAL;3853 if (hdsp->io_type == H9652) return -EINVAL; 3787 3854 if (hdsp->io_type == Undefined) { 3788 3855 if ((err = hdsp_get_iobox_version(hdsp)) < 0) { … … 3797 3864 break; 3798 3865 case SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE: 3799 if (hdsp _is_9652(hdsp)) return -EINVAL;3866 if (hdsp->io_type == H9652) return -EINVAL; 3800 3867 /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ 3801 3868 if (hdsp->io_type == Undefined) return -EINVAL; … … 3905 3972 } 3906 3973 3907 static inline int snd_hdsp_initialize_input_enable (hdsp_t *hdsp) 3974 static inline void snd_hdsp_9652_enable_mixer (hdsp_t *hdsp) 3975 { 3976 hdsp->control2_register |= HDSP_9652_ENABLE_MIXER; 3977 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 3978 } 3979 3980 static inline void snd_hdsp_9652_disable_mixer (hdsp_t *hdsp) 3981 { 3982 hdsp->control2_register &= ~HDSP_9652_ENABLE_MIXER; 3983 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 3984 } 3985 3986 static inline int snd_hdsp_enable_io (hdsp_t *hdsp) 3908 3987 { 3909 3988 int i; … … 3923 4002 static inline void snd_hdsp_initialize_channels(hdsp_t *hdsp) 3924 4003 { 3925 if (hdsp->io_type == Digiface) { 4004 switch (hdsp->io_type) { 4005 case Digiface: 3926 4006 hdsp->card_name = "RME Hammerfall DSP + Digiface"; 3927 4007 hdsp->ss_channels = DIGIFACE_SS_CHANNELS; 3928 4008 hdsp->ds_channels = DIGIFACE_DS_CHANNELS; 3929 } else { 4009 break; 4010 4011 case H9652: 4012 hdsp->card_name = "RME Hammerfall HDSP 9652"; 4013 hdsp->ss_channels = H9652_SS_CHANNELS; 4014 hdsp->ds_channels = H9652_DS_CHANNELS; 4015 break; 4016 4017 case Multiface: 3930 4018 hdsp->card_name = "RME Hammerfall DSP + Multiface"; 3931 4019 hdsp->ss_channels = MULTIFACE_SS_CHANNELS; 3932 4020 hdsp->ds_channels = MULTIFACE_DS_CHANNELS; 4021 4022 default: 4023 /* should never get here */ 4024 break; 3933 4025 } 3934 4026 } … … 3938 4030 snd_hdsp_flush_midi_input (hdsp, 0); 3939 4031 snd_hdsp_flush_midi_input (hdsp, 1); 3940 3941 #ifdef SNDRV_BIG_ENDIAN3942 hdsp_write(hdsp, HDSP_jtagReg, HDSP_BIGENDIAN_MODE);3943 #endif3944 4032 } 3945 4033 … … 4002 4090 int err; 4003 4091 int i; 4092 int is_9652 = 0; 4004 4093 4005 4094 hdsp->irq = -1; … … 4028 4117 strcpy(card->driver, "H-DSP"); 4029 4118 strcpy(card->mixername, "Xilinx FPGA"); 4030 4119 4031 4120 switch (hdsp->firmware_rev & 0xff) { 4032 4121 case 0xa: … … 4034 4123 hdsp->card_name = "RME Hammerfall DSP"; 4035 4124 break; 4125 4036 4126 case 0x64: 4037 4127 case 0x65: 4038 4128 case 0x68: 4039 4129 hdsp->card_name = "RME HDSP 9652"; 4040 break; 4130 is_9652 = 1; 4131 break; 4132 4041 4133 default: 4042 4134 return -ENODEV; 4043 4135 } 4044 4136 4045 if ((err = pci_enable_device(pci)) < 0) 4137 if ((err = pci_enable_device(pci)) < 0) { 4046 4138 return err; 4139 } 4047 4140 4048 4141 pci_set_master(hdsp->pci); … … 4072 4165 } 4073 4166 4074 if (hdsp_is_9652(hdsp)) { 4075 4076 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) { 4077 return err; 4078 } 4079 4080 hdsp->io_type = Digiface; 4081 4082 hdsp->ss_channels = DIGIFACE_SS_CHANNELS; 4083 hdsp->ds_channels = DIGIFACE_DS_CHANNELS; 4084 4085 snd_hdsp_initialize_midi_flush(hdsp); 4086 4167 if (!is_9652 && hdsp_check_for_iobox (hdsp)) { 4168 /* no iobox connected, we defer initialization */ 4169 snd_printk("card initialization pending : waiting for firmware\n"); 4087 4170 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4088 4171 return err; 4089 4172 } 4090 4091 } else {4092 4093 if (hdsp_check_for_iobox (hdsp)) {4094 /* no iobox connected, we defer initialization */4095 snd_printk("card initialization pending : waiting for firmware\n");4096 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {4097 return err;4098 }4099 return 0;4100 }4101 4102 if ((err = snd_hdsp_initialize_input_enable(hdsp)) != 0) {4103 return err;4104 }4105 4106 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {4107 snd_printk("card initialization pending : waiting for firmware\n");4108 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) {4109 return err;4110 }4111 4173 return 0; 4112 } 4113 4114 snd_printk("Firmware already loaded, initializing card.\n"); 4115 4116 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { 4117 hdsp->io_type = Multiface; 4118 } else { 4119 hdsp->io_type = Digiface; 4120 } 4121 4174 } 4175 4176 if ((err = snd_hdsp_enable_io(hdsp)) != 0) { 4177 return err; 4178 } 4179 4180 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 4181 snd_printk("card initialization pending : waiting for firmware\n"); 4122 4182 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4123 4183 return err; 4124 4184 } 4125 4126 snd_hdsp_initialize_channels(hdsp); 4127 4128 snd_hdsp_initialize_midi_flush(hdsp); 4129 4130 } 4131 4185 return 0; 4186 } 4187 4188 snd_printk("Firmware already loaded, initializing card.\n"); 4189 4190 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) { 4191 hdsp->io_type = Multiface; 4192 } else { 4193 hdsp->io_type = Digiface; 4194 } 4195 4196 if (is_9652) { 4197 hdsp->io_type = H9652; 4198 snd_hdsp_9652_enable_mixer (hdsp); 4199 } 4200 4201 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) { 4202 return err; 4203 } 4204 4205 snd_hdsp_initialize_channels(hdsp); 4206 snd_hdsp_initialize_midi_flush(hdsp); 4207 4132 4208 hdsp->state |= HDSP_FirmwareLoaded; 4133 4209 4134 4210 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) { 4135 4211 return err; 4136 4212 } 4137 4213 4138 4214 return 0; 4139 4215 } … … 4202 4278 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 4203 4279 hdsp->port, hdsp->irq); 4204 4280 4205 4281 if ((err = snd_card_register(card)) < 0) { 4206 4282 snd_card_free(card); -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/makefile.os2
r207 r250 13 13 # 14 14 #=================================================================== 15 FILE1 = hammerfall_mem.objrme9652.obj hdsp.obj15 FILE1 = rme9652.obj hdsp.obj 16 16 FILE2 = 17 17 FILE3 = -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c
r246 r250 310 310 311 311 #ifdef RME9652_PREALLOCATE_MEMORY 312 extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr); 313 extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr); 312 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 313 { 314 struct snd_dma_device pdev; 315 struct snd_dma_buffer dmbuf; 316 317 snd_dma_device_pci(&pdev, pci, capture); 318 dmbuf.bytes = 0; 319 if (! snd_dma_get_reserved(&pdev, &dmbuf)) { 320 if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0) 321 return NULL; 322 snd_dma_set_reserved(&pdev, &dmbuf); 323 } 324 *addrp = dmbuf.addr; 325 return dmbuf.area; 326 } 327 328 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 329 { 330 struct snd_dma_device dev; 331 snd_dma_device_pci(&dev, pci, capture); 332 snd_dma_free_reserved(&dev); 333 } 334 335 #else 336 static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture) 337 { 338 return snd_malloc_pci_pages(pci, size, addrp); 339 } 340 341 static void snd_hammerfall_free_buffer(struct pci_dev *pci, size_t size, void *ptr, dma_addr_t addr, int capture) 342 { 343 snd_free_pci_pages(pci, size, ptr, addr); 344 } 314 345 #endif 346 315 347 316 348 static struct pci_device_id snd_rme9652_ids[] __devinitdata = { … … 1810 1842 { 1811 1843 if (rme9652->capture_buffer_unaligned) { 1812 #ifndef RME9652_PREALLOCATE_MEMORY 1813 snd_free_pci_pages(rme9652->pci, 1814 RME9652_DMA_AREA_BYTES, 1815 rme9652->capture_buffer_unaligned, 1816 rme9652->capture_buffer_addr); 1817 #else 1818 snd_hammerfall_free_buffer(rme9652->pci, rme9652->capture_buffer_unaligned); 1819 #endif 1844 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, 1845 rme9652->capture_buffer_unaligned, 1846 rme9652->capture_buffer_addr, 1); 1820 1847 } 1821 1848 1822 1849 if (rme9652->playback_buffer_unaligned) { 1823 #ifndef RME9652_PREALLOCATE_MEMORY 1824 snd_free_pci_pages(rme9652->pci, 1825 RME9652_DMA_AREA_BYTES, 1826 rme9652->playback_buffer_unaligned, 1827 rme9652->playback_buffer_addr); 1828 #else 1829 snd_hammerfall_free_buffer(rme9652->pci, rme9652->playback_buffer_unaligned); 1830 #endif 1850 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, 1851 rme9652->playback_buffer_unaligned, 1852 rme9652->playback_buffer_addr, 0); 1831 1853 } 1832 1854 } … … 1855 1877 unsigned long pb_bus, cb_bus; 1856 1878 1857 #ifndef RME9652_PREALLOCATE_MEMORY 1858 cb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr); 1859 pb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr); 1860 #else 1861 cb = snd_hammerfall_get_buffer(rme9652->pci, &cb_addr); 1862 pb = snd_hammerfall_get_buffer(rme9652->pci, &pb_addr); 1863 #endif 1879 cb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr, 1); 1880 pb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr, 0); 1864 1881 1865 1882 if (cb == 0 || pb == 0) { 1866 1883 if (cb) { 1867 #ifdef RME9652_PREALLOCATE_MEMORY 1868 snd_hammerfall_free_buffer(rme9652->pci, cb); 1869 #else 1870 snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr); 1871 #endif 1884 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr, 1); 1872 1885 } 1873 1886 if (pb) { 1874 #ifdef RME9652_PREALLOCATE_MEMORY 1875 snd_hammerfall_free_buffer(rme9652->pci, pb); 1876 #else 1877 snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr); 1878 #endif 1887 snd_hammerfall_free_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr, 0); 1879 1888 } 1880 1889 -
GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c
r246 r250 260 260 snd_kcontrol_t *master_volume; 261 261 262 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)262 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 263 263 struct gameport gameport; 264 264 #endif … … 1194 1194 static int snd_sonicvibes_free(sonicvibes_t *sonic) 1195 1195 { 1196 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)1196 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1197 1197 if (sonic->gameport.io) 1198 1198 gameport_unregister_port(&sonic->gameport); … … 1498 1498 return err; 1499 1499 } 1500 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)1500 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 1501 1501 sonic->gameport.io = sonic->game_port; 1502 1502 gameport_register_port(&sonic->gameport); -
GPL/branches/alsa-resync1/alsa-kernel/pci/ymfpci/ymfpci_main.c
r246 r250 2316 2316 init_waitqueue_head(&chip->interrupt_sleep); 2317 2317 atomic_set(&chip->interrupt_sleep_count, 0); 2318 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 2319 init_MUTEX(&chip->joystick_mutex); 2320 #endif 2318 2321 chip->card = card; 2319 2322 chip->pci = pci;
Note:
See TracChangeset
for help on using the changeset viewer.