Changeset 300
- Timestamp:
- Feb 24, 2008, 8:18:08 PM (17 years ago)
- Location:
- GPL/branches/alsa-resync1/alsa-kernel
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/core/info.c
r260 r300 105 105 return 0; 106 106 va_start(args, fmt); 107 res = vs nprintf(sbuffer, sizeof(sbuffer), fmt, args);107 res = vscnprintf(sbuffer, sizeof(sbuffer), fmt, args); 108 108 va_end(args); 109 109 if (buffer->size + res >= buffer->len) { -
GPL/branches/alsa-resync1/alsa-kernel/core/misc.c
r299 r300 46 46 } 47 47 48 #ifdef CONFIG_SND_VERBOSE_PRINTK 49 void snd_verbose_printk(const char *file, int line, const char *format, ...) 50 { 51 va_list args; 52 char tmpbuf[512]; 53 54 if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') { 55 char tmp[] = "<0>"; 56 tmp[1] = format[1]; 57 printk("%sALSA %s:%d: ", tmp, file, line); 58 format += 3; 59 } else { 60 printk("ALSA %s:%d: ", file, line); 61 } 62 va_start(args, format); 63 vsnprintf(tmpbuf, sizeof(tmpbuf), format, args); 64 va_end(args); 65 printk(tmpbuf); 66 } 67 #endif 68 69 #if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK) 70 void snd_verbose_printd(const char *file, int line, const char *format, ...) 71 { 72 va_list args; 73 char tmpbuf[512]; 74 75 if (format[0] == '<' && format[1] >= '0' && format[1] <= '9' && format[2] == '>') { 76 char tmp[] = "<0>"; 77 tmp[1] = format[1]; 78 printk("%sALSA %s:%d: ", tmp, file, line); 79 format += 3; 80 } else { 81 printk(KERN_DEBUG "ALSA %s:%d: ", file, line); 82 } 83 va_start(args, format); 84 vsnprintf(tmpbuf, sizeof(tmpbuf), format, args); 85 va_end(args); 86 printk(tmpbuf); 87 88 } 89 #endif 90 48 91 /** 49 92 * snd_pci_quirk_lookup - look up a PCI SSID quirk list -
GPL/branches/alsa-resync1/alsa-kernel/core/pcm.c
r92 r300 329 329 snd_iprintf(buffer, "OSS period bytes: %lu\n", (unsigned long)runtime->oss.period_bytes); 330 330 snd_iprintf(buffer, "OSS periods: %u\n", runtime->oss.periods); 331 snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames); 331 332 } 332 333 #endif -
GPL/branches/alsa-resync1/alsa-kernel/core/rawmidi.c
r262 r300 928 928 memcpy(buf + result, runtime->buffer + runtime->appl_ptr, count1); 929 929 } else { 930 if (copy_to_user(buf + result, runtime->buffer + runtime->appl_ptr, count1)) {931 930 spin_unlock_irqrestore(&runtime->lock, flags); 931 if (copy_to_user(buf + result, runtime->buffer + runtime->appl_ptr, count1)) { 932 932 return result > 0 ? result : -EFAULT; 933 933 } 934 spin_lock_irqsave(&runtime->lock, flags); 934 935 } 935 936 runtime->appl_ptr += count1; … … 1155 1156 memcpy(runtime->buffer + runtime->appl_ptr, buf, count1); 1156 1157 } else { 1158 spin_unlock_irqrestore(&runtime->lock, flags); 1157 1159 if (copy_from_user(runtime->buffer + runtime->appl_ptr, buf, count1)) { 1160 spin_lock_irqsave(&runtime->lock, flags); 1158 1161 result = result > 0 ? result : -EFAULT; 1159 1162 goto __end; 1160 1163 } 1164 spin_lock_irqsave(&runtime->lock, flags); 1161 1165 } 1162 1166 runtime->appl_ptr += count1; -
GPL/branches/alsa-resync1/alsa-kernel/core/seq/seq_clientmgr.c
r278 r300 567 567 568 568 /* 569 * expand a quoted event. 570 */ 571 static int expand_quoted_event(snd_seq_event_t *event) 572 { 573 snd_seq_event_t *quoted; 574 575 quoted = event->data.quote.event; 576 if (quoted == NULL) { 577 snd_printd("seq: quoted event is NULL\n"); 578 return -EINVAL; 579 } 580 581 event->type = quoted->type; 582 event->tag = quoted->tag; 583 event->source = quoted->source; 584 /* don't use quoted destination */ 585 event->data = quoted->data; 586 /* use quoted timestamp only if subscription/port didn't update it */ 587 if (event->queue == SNDRV_SEQ_QUEUE_DIRECT) { 588 event->flags = quoted->flags; 589 event->queue = quoted->queue; 590 event->time = quoted->time; 591 } else { 592 event->flags = (event->flags & SNDRV_SEQ_TIME_STAMP_MASK) 593 | (quoted->flags & ~SNDRV_SEQ_TIME_STAMP_MASK); 594 } 595 return 0; 596 } 597 598 /* 569 599 * deliver an event to the specified destination. 570 600 * if filter is non-zero, client filter bitmap is tested. -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h
r299 r300 195 195 #define vsnprintf(buf,size,fmt,args) snd_compat_vsnprintf(buf,size,fmt,args) 196 196 #endif 197 198 #ifndef TARGET_OS2 199 #ifndef CONFIG_HAVE_SCNPRINTF 200 #define scnprintf(buf,size,fmt,args...) snprintf(buf,size,fmt,##args) 201 #define vscnprintf(buf,size,fmt,args) vsnprintf(buf,size,fmt,args) 202 #endif 203 #endif /* !TARGET_OS2 */ 197 204 198 205 #if defined(__alpha__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 14) -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_oss.h
r281 r300 51 51 unsigned int subdivision; /* requested subdivision */ 52 52 size_t period_bytes; /* requested period size */ 53 size_t period_frames; /* period frames for poll */ 53 54 size_t period_ptr; /* actual write pointer to period */ 54 55 unsigned int periods; -
GPL/branches/alsa-resync1/alsa-kernel/include/sound/version.h
r290 r300 1 1 /* include/version.h. Generated by configure. */ 2 #define CONFIG_SND_VERSION "1.0. 2"2 #define CONFIG_SND_VERSION "1.0.3" 3 3 #define CONFIG_SND_DATE "" -
GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c
r290 r300 148 148 } 149 149 150 if (xmpu_irq >= 0 ) {150 if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { 151 151 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, 152 152 chip->mpu_port, 0, -
GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c
r290 r300 164 164 /* Panasonic PCA761AW Audio Card */ 165 165 { .id = "ADV55ff", .devs = { { .id = "ADV0010" } } }, 166 /* InterWave STB without TEA6330T */ 167 { .id = "ADV550a", .devs = { { .id = "ADV0010" } } }, 166 168 #else 167 169 /* InterWave STB with TEA6330T */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/ac97/ac97_pcm.c
r77 r300 230 230 } 231 231 ac97->spdif_status = sbits; 232 /* update the internal spdif bits */ 233 spin_lock(&ac97->reg_lock); 234 sbits = ac97->spdif_status; 235 if (sbits & IEC958_AES0_PROFESSIONAL) { 236 sbits &= ~IEC958_AES0_PRO_FS; 237 switch (rate) { 238 case 44100: sbits |= IEC958_AES0_PRO_FS_44100; break; 239 case 48000: sbits |= IEC958_AES0_PRO_FS_48000; break; 240 case 32000: sbits |= IEC958_AES0_PRO_FS_32000; break; 241 } 242 } else { 243 sbits &= ~(IEC958_AES3_CON_FS << 24); 244 switch (rate) { 245 case 44100: sbits |= IEC958_AES3_CON_FS_44100<<24; break; 246 case 48000: sbits |= IEC958_AES3_CON_FS_48000<<24; break; 247 case 32000: sbits |= IEC958_AES3_CON_FS_32000<<24; break; 248 } 249 } 250 ac97->spdif_status = sbits; 251 spin_unlock(&ac97->reg_lock); 232 252 } 233 253 snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); -
GPL/branches/alsa-resync1/alsa-kernel/pci/als4000.c
r290 r300 100 100 MODULE_PARM_DESC(enable, "Enable ALS4000 soundcard."); 101 101 MODULE_PARM_SYNTAX(enable, SNDRV_INDEX_DESC); 102 #ifdef SUPPORT_JOYSTICK 102 103 MODULE_PARM(joystick_port, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 103 104 MODULE_PARM_DESC(joystick_port, "Joystick port address for ALS4000 soundcard. (0 = disabled)"); 104 105 MODULE_PARM_SYNTAX(joystick_port, SNDRV_ENABLED); 106 #endif 105 107 106 108 typedef struct { -
GPL/branches/alsa-resync1/alsa-kernel/pci/cmipci.c
r290 r300 2984 2984 if (joystick_port[dev] > 0) { 2985 2985 if (joystick_port[dev] == 1) { /* auto-detect */ 2986 static int ports[] = { 0x20 0, 0x201, 0 };2986 static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ 2987 2987 int i; 2988 2988 for (i = 0; ports[i]; i++) { -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/aureon.h
r250 r300 34 34 35 35 /* GPIO bits */ 36 #define AUREON_CS8415_CS (1 << 2 3)37 #define AUREON_CS8415_CDTO (1 << 2 2)36 #define AUREON_CS8415_CS (1 << 22) 37 #define AUREON_CS8415_CDTO (1 << 21) 38 38 #define AUREON_WM_RESET (1 << 20) 39 39 #define AUREON_WM_CLK (1 << 19) -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.c
r281 r300 3 3 * 4 4 * Lowlevel functions for M-Audio Delta 1010, 44, 66, Dio2496, Audiophile 5 * Digigram VX442 5 6 * 6 7 * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> … … 84 85 unsigned char tmp; 85 86 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); 86 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010LT) { 87 switch (ice->eeprom.subvendor) { 88 case ICE1712_SUBDEVICE_DELTA1010LT: 87 89 tmp &= ~ICE1712_DELTA_1010LT_CS; 88 90 tmp |= ICE1712_DELTA_1010LT_CCLK | ICE1712_DELTA_1010LT_CS_CS8427; 89 } else { /* Audiophile */ 91 break; 92 case ICE1712_SUBDEVICE_AUDIOPHILE: 90 93 tmp |= ICE1712_DELTA_AP_CCLK | ICE1712_DELTA_AP_CS_CODEC; 91 94 tmp &= ~ICE1712_DELTA_AP_CS_DIGITAL; 95 break; 96 case ICE1712_SUBDEVICE_VX442: 97 tmp |= ICE1712_VX442_CCLK | ICE1712_VX442_CODEC_CHIP_A | ICE1712_VX442_CODEC_CHIP_B; 98 tmp &= ~ICE1712_VX442_CS_DIGITAL; 99 break; 92 100 } 93 101 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); … … 99 107 static void ap_cs8427_codec_deassert(ice1712_t *ice, unsigned char tmp) 100 108 { 101 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010LT) { 109 switch (ice->eeprom.subvendor) { 110 case ICE1712_SUBDEVICE_DELTA1010LT: 102 111 tmp &= ~ICE1712_DELTA_1010LT_CS; 103 112 tmp |= ICE1712_DELTA_1010LT_CS_NONE; 104 } else { /* Audiophile */ 113 break; 114 case ICE1712_SUBDEVICE_AUDIOPHILE: 105 115 tmp |= ICE1712_DELTA_AP_CS_DIGITAL; 116 break; 117 case ICE1712_SUBDEVICE_VX442: 118 tmp |= ICE1712_VX442_CS_DIGITAL; 119 break; 106 120 } 107 121 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); … … 258 272 259 273 /* 274 * AK4528 on VX442 to choose the chip mask 275 */ 276 static void vx442_ak4524_lock(akm4xxx_t *ak, int chip) 277 { 278 struct snd_ak4xxx_private *priv = (void *)ak->private_value[0]; 279 ice1712_t *ice = ak->private_data[0]; 280 281 snd_ice1712_save_gpio_status(ice); 282 priv->cs_mask = 283 priv->cs_addr = chip == 0 ? ICE1712_VX442_CODEC_CHIP_A : 284 ICE1712_VX442_CODEC_CHIP_B; 285 } 286 287 /* 260 288 * change the DFS bit according rate for Delta1010 261 289 */ … … 307 335 up(&ice->gpio_mutex); 308 336 snd_akm4xxx_reset(ak, 0); 337 } 338 339 /* 340 * change the rate of AK4524 on VX442 341 */ 342 static void vx442_ak4524_set_rate_val(akm4xxx_t *ak, unsigned int rate) 343 { 344 unsigned char val; 345 346 val = (rate > 48000) ? 0x65 : 0x60; 347 if (snd_akm4xxx_get(ak, 0, 0x02) != val || 348 snd_akm4xxx_get(ak, 1, 0x02) != val) { 349 snd_akm4xxx_reset(ak, 1); 350 snd_akm4xxx_write(ak, 0, 0x02, val); 351 snd_akm4xxx_write(ak, 1, 0x02, val); 352 snd_akm4xxx_reset(ak, 0); 353 } 309 354 } 310 355 … … 436 481 }; 437 482 483 static akm4xxx_t akm_vx442 __devinitdata = { 484 .type = SND_AK4524, 485 .num_adcs = 4, 486 .num_dacs = 4, 487 .ops = { 488 .lock = vx442_ak4524_lock, 489 .set_rate_val = vx442_ak4524_set_rate_val 490 } 491 }; 492 493 static struct snd_ak4xxx_private akm_vx442_priv __devinitdata = { 494 .caddr = 2, 495 .cif = 0, 496 .data_mask = ICE1712_VX442_DOUT, 497 .clk_mask = ICE1712_VX442_CCLK, 498 .cs_mask = 0, 499 .cs_addr = 0, /* set later */ 500 .cs_none = 0, 501 .add_flags = 0, 502 .mask_flags = 0, 503 }; 504 438 505 static int __devinit snd_ice1712_delta_init(ice1712_t *ice) 439 506 { … … 457 524 ice->num_total_dacs = 8; 458 525 break; 526 case ICE1712_SUBDEVICE_VX442: 527 ice->num_total_dacs = 4; 528 break; 459 529 } 460 530 … … 464 534 case ICE1712_SUBDEVICE_DELTA410: 465 535 case ICE1712_SUBDEVICE_DELTA1010LT: 536 case ICE1712_SUBDEVICE_VX442: 466 537 if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { 467 538 snd_printk("unable to create I2C bus\n"); … … 518 589 err = snd_ice1712_akm4xxx_init(ak, &akm_delta44, &akm_delta44_priv, ice); 519 590 break; 591 case ICE1712_SUBDEVICE_VX442: 592 err = snd_ice1712_akm4xxx_init(ak, &akm_vx442, &akm_vx442_priv, ice); 593 break; 520 594 default: 521 595 snd_BUG(); … … 598 672 case ICE1712_SUBDEVICE_DELTA44: 599 673 case ICE1712_SUBDEVICE_DELTA66: 674 case ICE1712_SUBDEVICE_VX442: 600 675 err = snd_ice1712_akm4xxx_build_controls(ice); 601 676 if (err < 0) … … 603 678 break; 604 679 } 680 605 681 return 0; 606 682 } … … 654 730 snd_ice1712_delta_add_controls, 655 731 }, 732 { 733 ICE1712_SUBDEVICE_VX442, 734 "Digigram VX442", 735 snd_ice1712_delta_init, 736 snd_ice1712_delta_add_controls, 737 1, /* NO MPU */ 738 }, 656 739 { } /* terminator */ 657 740 }; -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/delta.h
r215 r300 6 6 * 7 7 * Lowlevel functions for M-Audio Delta 1010, 44, 66, Dio2496, Audiophile 8 * Digigram VX442 8 9 * 9 10 * Copyright (c) 2000 Jaroslav Kysela <perex@suse.cz> … … 31 32 "{MidiMan M Audio,Delta 66},"\ 32 33 "{MidiMan M Audio,Delta 44},"\ 33 "{MidiMan M Audio,Audiophile 24/96}," 34 "{MidiMan M Audio,Audiophile 24/96},"\ 35 "{Digigram,VX442}," 34 36 35 37 #define ICE1712_SUBDEVICE_DELTA1010 0x121430d6 … … 40 42 #define ICE1712_SUBDEVICE_DELTA410 0x121438d6 41 43 #define ICE1712_SUBDEVICE_DELTA1010LT 0x12143bd6 44 #define ICE1712_SUBDEVICE_VX442 0x12143cd6 42 45 43 46 /* entry point */ … … 135 138 #define ICE1712_DELTA_1010LT_WORDCLOCK 0x80 /* sample clock source: 0 = Word Clock Input, 1 = S/PDIF Input ??? */ 136 139 140 /* Digigram VX442 definitions */ 141 #define ICE1712_VX442_CCLK 0x02 /* SPI clock */ 142 #define ICE1712_VX442_DIN 0x04 /* data input */ 143 #define ICE1712_VX442_DOUT 0x08 /* data output */ 144 #define ICE1712_VX442_CS_DIGITAL 0x10 /* chip select, low = CS8427 */ 145 #define ICE1712_VX442_CODEC_CHIP_A 0x20 /* select chip A */ 146 #define ICE1712_VX442_CODEC_CHIP_B 0x40 /* select chip B */ 147 137 148 #endif /* __SOUND_DELTA_H */ -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.c
r290 r300 2376 2376 spin_lock_init(&ice->reg_lock); 2377 2377 init_MUTEX(&ice->gpio_mutex); 2378 init_MUTEX(&ice->open_mutex); 2378 2379 ice->gpio.set_mask = snd_ice1712_set_gpio_mask; 2379 2380 ice->gpio.set_dir = snd_ice1712_set_gpio_dir; -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1712.h
r281 r300 336 336 unsigned int cur_rate; /* current rate */ 337 337 338 struct semaphore open_mutex; 339 snd_pcm_substream_t *pcm_reserved[4]; 340 338 341 unsigned int akm_codecs; 339 342 akm4xxx_t *akm; -
GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712/ice1724.c
r290 r300 238 238 snd_pcm_period_elapsed(ice->capture_pro_substream); 239 239 } 240 if (mtstat & VT1724_MULTI_PDMA1) { 241 if (ice->playback_con_substream_ds[0]) 242 snd_pcm_period_elapsed(ice->playback_con_substream_ds[0]); 243 } 244 if (mtstat & VT1724_MULTI_PDMA2) { 245 if (ice->playback_con_substream_ds[1]) 246 snd_pcm_period_elapsed(ice->playback_con_substream_ds[1]); 247 } 248 if (mtstat & VT1724_MULTI_PDMA3) { 249 if (ice->playback_con_substream_ds[2]) 250 snd_pcm_period_elapsed(ice->playback_con_substream_ds[2]); 251 } 240 252 if (mtstat & VT1724_MULTI_PDMA4) { 241 253 if (ice->playback_con_substream) … … 283 295 }; 284 296 285 static unsigned int hw_channels[] = {286 2, 4, 6, 8287 };288 289 static snd_pcm_hw_constraint_list_t hw_constraints_channels = {290 .count = ARRAY_SIZE(hw_channels),291 .list = hw_channels,292 .mask = 0,293 };294 295 297 static int snd_vt1724_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 296 298 { 297 299 ice1712_t *ice = snd_pcm_substream_chip(substream); 298 unsigned intwhat;299 unsigned intold;300 unsigned char what; 301 unsigned char old; 300 302 struct list_head *pos; 301 303 snd_pcm_substream_t *s; 304 305 what = 0; 306 snd_pcm_group_for_each(pos, substream) { 307 s = snd_pcm_group_substream_entry(pos); 308 what |= (unsigned long)(s->runtime->private_data); 309 snd_pcm_trigger_done(s, substream); 310 } 302 311 303 312 switch (cmd) { 304 313 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 305 314 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 306 what = 0;307 snd_pcm_group_for_each(pos, substream) {308 s = snd_pcm_group_substream_entry(pos);309 if (s == ice->playback_pro_substream)310 what |= VT1724_PDMA0_PAUSE;311 else if (s == ice->capture_pro_substream)312 what |= VT1724_RDMA0_PAUSE;313 else if (s == ice->playback_con_substream)314 what |= VT1724_PDMA4_PAUSE;315 else if (s == ice->capture_con_substream)316 what |= VT1724_RDMA1_PAUSE;317 }318 315 spin_lock(&ice->reg_lock); 319 old = in l(ICEMT1724(ice, DMA_PAUSE));316 old = inb(ICEMT1724(ice, DMA_PAUSE)); 320 317 if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH) 321 318 old |= what; 322 319 else 323 320 old &= ~what; 324 out l(old, ICEMT1724(ice, DMA_PAUSE));321 outb(old, ICEMT1724(ice, DMA_PAUSE)); 325 322 spin_unlock(&ice->reg_lock); 326 323 break; … … 328 325 case SNDRV_PCM_TRIGGER_START: 329 326 case SNDRV_PCM_TRIGGER_STOP: 330 what = 0;331 s = substream;332 snd_pcm_group_for_each(pos, substream) {333 s = snd_pcm_group_substream_entry(pos);334 if (s == ice->playback_pro_substream) {335 what |= VT1724_PDMA0_START;336 snd_pcm_trigger_done(s, substream);337 } else if (s == ice->capture_pro_substream) {338 what |= VT1724_RDMA0_START;339 snd_pcm_trigger_done(s, substream);340 } else if (s == ice->playback_con_substream) {341 what |= VT1724_PDMA4_START;342 snd_pcm_trigger_done(s, substream);343 } else if (s == ice->capture_con_substream) {344 what |= VT1724_RDMA1_START;345 snd_pcm_trigger_done(s, substream);346 }347 }348 327 spin_lock(&ice->reg_lock); 349 old = in l(ICEMT1724(ice, DMA_CONTROL));328 old = inb(ICEMT1724(ice, DMA_CONTROL)); 350 329 if (cmd == SNDRV_PCM_TRIGGER_START) 351 330 old |= what; 352 331 else 353 332 old &= ~what; 354 out l(old, ICEMT1724(ice, DMA_CONTROL));333 outb(old, ICEMT1724(ice, DMA_CONTROL)); 355 334 spin_unlock(&ice->reg_lock); 356 335 break; … … 365 344 */ 366 345 367 #define DMA_STARTS (VT1724_RDMA0_START|VT1724_PDMA0_START|VT1724_RDMA1_START|VT1724_PDMA4_START) 368 #define DMA_PAUSES (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|VT1724_PDMA4_PAUSE) 346 #define DMA_STARTS (VT1724_RDMA0_START|VT1724_PDMA0_START|VT1724_RDMA1_START|\ 347 VT1724_PDMA1_START|VT1724_PDMA2_START|VT1724_PDMA3_START|VT1724_PDMA4_START) 348 #define DMA_PAUSES (VT1724_RDMA0_PAUSE|VT1724_PDMA0_PAUSE|VT1724_RDMA1_PAUSE|\ 349 VT1724_PDMA1_PAUSE|VT1724_PDMA2_PAUSE|VT1724_PDMA3_PAUSE|VT1724_PDMA4_PAUSE) 369 350 370 351 static void snd_vt1724_set_pro_rate(ice1712_t *ice, unsigned int rate, int force) … … 449 430 { 450 431 ice1712_t *ice = snd_pcm_substream_chip(substream); 451 432 int i, chs; 433 434 chs = params_channels(hw_params); 435 down(&ice->open_mutex); 436 /* mark surround channels */ 437 if (substream == ice->playback_pro_substream) { 438 chs = chs / 2 - 1; 439 for (i = 0; i < chs; i++) { 440 if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) { 441 up(&ice->open_mutex); 442 return -EBUSY; 443 } 444 ice->pcm_reserved[i] = substream; 445 } 446 for (; i < 3; i++) { 447 if (ice->pcm_reserved[i] == substream) 448 ice->pcm_reserved[i] = NULL; 449 } 450 } else { 451 for (i = 0; i < 3; i++) { 452 if (ice->playback_con_substream_ds[i] == substream) { 453 if (ice->pcm_reserved[i] && ice->pcm_reserved[i] != substream) { 454 up(&ice->open_mutex); 455 return -EBUSY; 456 } 457 ice->pcm_reserved[i] = substream; 458 break; 459 } 460 } 461 } 462 up(&ice->open_mutex); 452 463 snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0); 453 464 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); … … 456 467 static int snd_vt1724_pcm_hw_free(snd_pcm_substream_t * substream) 457 468 { 469 ice1712_t *ice = snd_pcm_substream_chip(substream); 470 int i; 471 472 down(&ice->open_mutex); 473 /* unmark surround channels */ 474 for (i = 0; i < 3; i++) 475 if (ice->pcm_reserved[i] == substream) 476 ice->pcm_reserved[i] = NULL; 477 up(&ice->open_mutex); 458 478 return snd_pcm_lib_free_pages(substream); 459 479 } … … 594 614 .channels_min = 2, 595 615 .channels_max = 8, 596 .buffer_bytes_max = (1UL << 21), /* 1 8bits dword */616 .buffer_bytes_max = (1UL << 21), /* 19bits dword */ 597 617 .period_bytes_min = 8 * 4 * 2, /* FIXME: constraints needed */ 598 618 .period_bytes_max = (1UL << 21), 599 .periods_min = 1,619 .periods_min = 2, 600 620 .periods_max = 1024, 601 621 }; 602 622 603 static snd_pcm_hardware_t snd_vt1724_ capture_pro =623 static snd_pcm_hardware_t snd_vt1724_2ch_stereo = 604 624 { 605 625 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 613 633 .channels_min = 2, 614 634 .channels_max = 2, 615 .buffer_bytes_max = ( 256*1024),635 .buffer_bytes_max = (1UL << 18), /* 16bits dword */ 616 636 .period_bytes_min = 2 * 4 * 2, 617 .period_bytes_max = ( 256*1024),618 .periods_min = 1,637 .period_bytes_max = (1UL << 18), 638 .periods_min = 2, 619 639 .periods_max = 1024, 620 640 }; … … 629 649 snd_pcm_runtime_t *runtime = substream->runtime; 630 650 ice1712_t *ice = snd_pcm_substream_chip(substream); 631 651 int chs; 652 653 runtime->private_data = (void*)VT1724_PDMA0_START; /* irq/status/trigger bit */ 632 654 ice->playback_pro_substream = substream; 633 655 runtime->hw = snd_vt1724_playback_pro; … … 640 662 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_96); 641 663 642 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels); 664 down(&ice->open_mutex); 665 /* calculate the currently available channels */ 666 for (chs = 0; chs < 3; chs++) { 667 if (ice->pcm_reserved[chs]) 668 break; 669 } 670 chs = (chs + 1) * 2; 671 runtime->hw.channels_max = chs; 672 if (chs > 2) /* channels must be even */ 673 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2); 674 up(&ice->open_mutex); 643 675 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 644 676 VT1724_BUFFER_ALIGN); … … 653 685 snd_pcm_runtime_t *runtime = substream->runtime; 654 686 687 runtime->private_data = (void*)VT1724_RDMA0_START; /* irq/status/trigger bit */ 655 688 ice->capture_pro_substream = substream; 656 runtime->hw = snd_vt1724_ capture_pro;689 runtime->hw = snd_vt1724_2ch_stereo; 657 690 snd_pcm_set_sync(substream); 658 691 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); … … 736 769 */ 737 770 738 static snd_pcm_hardware_t snd_vt1724_playback_spdif =739 {740 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |741 SNDRV_PCM_INFO_BLOCK_TRANSFER |742 SNDRV_PCM_INFO_MMAP_VALID |743 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_SYNC_START),744 .formats = SNDRV_PCM_FMTBIT_S32_LE,745 .rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_192000,746 .rate_min = 4000,747 .rate_max = 192000,748 .channels_min = 2,749 .channels_max = 2,750 .buffer_bytes_max = (256*1024),751 .period_bytes_min = 2 * 4 * 2,752 .period_bytes_max = (256*1024),753 .periods_min = 1,754 .periods_max = 1024,755 };756 757 771 const static struct vt1724_pcm_reg vt1724_playback_spdif_reg = { 758 772 .addr = VT1724_MT_PDMA4_ADDR, … … 796 810 snd_pcm_runtime_t *runtime = substream->runtime; 797 811 812 runtime->private_data = (void*)VT1724_PDMA4_START; /* irq/status/trigger bit */ 798 813 ice->playback_con_substream = substream; 799 runtime->hw = snd_vt1724_ playback_spdif;814 runtime->hw = snd_vt1724_2ch_stereo; 800 815 snd_pcm_set_sync(substream); 801 816 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); … … 821 836 snd_pcm_runtime_t *runtime = substream->runtime; 822 837 838 runtime->private_data = (void*)VT1724_RDMA1_START; /* irq/status/trigger bit */ 823 839 ice->capture_con_substream = substream; 824 runtime->hw = snd_vt1724_ playback_spdif;840 runtime->hw = snd_vt1724_2ch_stereo; 825 841 snd_pcm_set_sync(substream); 826 842 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); … … 898 914 899 915 ice->pcm = pcm; 916 917 return 0; 918 } 919 920 921 /* 922 * independent surround PCMs 923 */ 924 925 const static struct vt1724_pcm_reg vt1724_playback_dma_regs[3] = { 926 { 927 .addr = VT1724_MT_PDMA1_ADDR, 928 .size = VT1724_MT_PDMA1_SIZE, 929 .count = VT1724_MT_PDMA1_COUNT, 930 .start = VT1724_PDMA1_START, 931 .pause = VT1724_PDMA1_PAUSE, 932 }, 933 { 934 .addr = VT1724_MT_PDMA2_ADDR, 935 .size = VT1724_MT_PDMA2_SIZE, 936 .count = VT1724_MT_PDMA2_COUNT, 937 .start = VT1724_PDMA2_START, 938 .pause = VT1724_PDMA2_PAUSE, 939 }, 940 { 941 .addr = VT1724_MT_PDMA3_ADDR, 942 .size = VT1724_MT_PDMA3_SIZE, 943 .count = VT1724_MT_PDMA3_COUNT, 944 .start = VT1724_PDMA3_START, 945 .pause = VT1724_PDMA3_PAUSE, 946 }, 947 }; 948 949 static int snd_vt1724_playback_indep_prepare(snd_pcm_substream_t * substream) 950 { 951 ice1712_t *ice = snd_pcm_substream_chip(substream); 952 unsigned char val; 953 954 spin_lock(&ice->reg_lock); 955 val = 3 - substream->number; 956 if (inb(ICEMT1724(ice, BURST)) < val) 957 outb(val, ICEMT1724(ice, BURST)); 958 spin_unlock(&ice->reg_lock); 959 return snd_vt1724_pcm_prepare(substream, &vt1724_playback_dma_regs[substream->number]); 960 } 961 962 static snd_pcm_uframes_t snd_vt1724_playback_indep_pointer(snd_pcm_substream_t * substream) 963 { 964 return snd_vt1724_pcm_pointer(substream, &vt1724_playback_dma_regs[substream->number]); 965 } 966 967 static int snd_vt1724_playback_indep_open(snd_pcm_substream_t *substream) 968 { 969 ice1712_t *ice = snd_pcm_substream_chip(substream); 970 snd_pcm_runtime_t *runtime = substream->runtime; 971 972 down(&ice->open_mutex); 973 /* already used by PDMA0? */ 974 if (ice->pcm_reserved[substream->number]) { 975 up(&ice->open_mutex); 976 return -EBUSY; /* FIXME: should handle blocking mode properly */ 977 } 978 up(&ice->open_mutex); 979 runtime->private_data = (void*)(1 << (substream->number + 4)); 980 ice->playback_con_substream_ds[substream->number] = substream; 981 runtime->hw = snd_vt1724_2ch_stereo; 982 snd_pcm_set_sync(substream); 983 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); 984 985 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates_192); 986 return 0; 987 } 988 989 static int snd_vt1724_playback_indep_close(snd_pcm_substream_t * substream) 990 { 991 ice1712_t *ice = snd_pcm_substream_chip(substream); 992 993 if (PRO_RATE_RESET) 994 snd_vt1724_set_pro_rate(ice, PRO_RATE_DEFAULT, 0); 995 ice->playback_con_substream_ds[substream->number] = NULL; 996 ice->pcm_reserved[substream->number] = NULL; 997 998 return 0; 999 } 1000 1001 static snd_pcm_ops_t snd_vt1724_playback_indep_ops = { 1002 .open = snd_vt1724_playback_indep_open, 1003 .close = snd_vt1724_playback_indep_close, 1004 .ioctl = snd_pcm_lib_ioctl, 1005 .hw_params = snd_vt1724_pcm_hw_params, 1006 .hw_free = snd_vt1724_pcm_hw_free, 1007 .prepare = snd_vt1724_playback_indep_prepare, 1008 .trigger = snd_vt1724_pcm_trigger, 1009 .pointer = snd_vt1724_playback_indep_pointer, 1010 }; 1011 1012 1013 static int __devinit snd_vt1724_pcm_indep(ice1712_t * ice, int device) 1014 { 1015 snd_pcm_t *pcm; 1016 int play; 1017 int err; 1018 1019 play = ice->num_total_dacs / 2 - 1; 1020 if (play <= 0) 1021 return 0; 1022 1023 err = snd_pcm_new(ice->card, "ICE1724 Surrounds", device, play, 0, &pcm); 1024 if (err < 0) 1025 return err; 1026 1027 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 1028 &snd_vt1724_playback_indep_ops); 1029 1030 pcm->private_data = ice; 1031 pcm->info_flags = 0; 1032 strcpy(pcm->name, "ICE1724 Surround PCM"); 1033 1034 snd_pcm_lib_preallocate_pci_pages_for_all(ice->pci, pcm, 64*1024, 64*1024); 1035 1036 ice->pcm_ds = pcm; 900 1037 901 1038 return 0; … … 1809 1946 spin_lock_init(&ice->reg_lock); 1810 1947 init_MUTEX(&ice->gpio_mutex); 1948 init_MUTEX(&ice->open_mutex); 1811 1949 ice->gpio.set_mask = snd_vt1724_set_gpio_mask; 1812 1950 ice->gpio.set_dir = snd_vt1724_set_gpio_dir; … … 1933 2071 } 1934 2072 2073 if ((err = snd_vt1724_pcm_indep(ice, pcm_dev++)) < 0) { 2074 snd_card_free(card); 2075 return err; 2076 } 2077 1935 2078 if ((err = snd_vt1724_ac97_mixer(ice)) < 0) { 1936 2079 snd_card_free(card); -
GPL/branches/alsa-resync1/alsa-kernel/pci/intel8x0.c
r290 r300 1187 1187 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1188 1188 snd_pcm_runtime_t *runtime = substream->runtime; 1189 static unsigned int i, rates[] = {1190 /* ATTENTION: these values depend on the definition in pcm.h! */1191 5512, 8000, 11025, 16000, 22050, 32000, 44100, 480001192 };1193 1189 int err; 1194 1190 … … 3352 3348 #ifndef MODULE 3353 3349 3354 /* format is: snd-intel8x0=enable,index,id,ac97_clock, mpu_port,joystick */3350 /* format is: snd-intel8x0=enable,index,id,ac97_clock,ac97_quirk,mpu_port,joystick */ 3355 3351 3356 3352 static int __init alsa_card_intel8x0_setup(char *str) -
GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/hdsp.c
r290 r300 3812 3812 int mapped_channel; 3813 3813 3814 snd_assert(channel >= 0 ||channel < hdsp->max_channels, return NULL);3814 snd_assert(channel >= 0 && channel < hdsp->max_channels, return NULL); 3815 3815 3816 3816 if ((mapped_channel = hdsp->channel_map[channel]) < 0) {
Note:
See TracChangeset
for help on using the changeset viewer.