aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index a1bd8040dea4..d5013383fad7 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -478,22 +478,38 @@ static int retire_playback_sync_urb_hs(struct snd_usb_substream *subs,
478/* 478/*
479 * Prepare urb for streaming before playback starts. 479 * Prepare urb for streaming before playback starts.
480 * 480 *
481 * We don't care about (or have) any data, so we just send a transfer delimiter. 481 * We don't yet have data, so we send a frame of silence.
482 */ 482 */
483static int prepare_startup_playback_urb(struct snd_usb_substream *subs, 483static int prepare_startup_playback_urb(struct snd_usb_substream *subs,
484 struct snd_pcm_runtime *runtime, 484 struct snd_pcm_runtime *runtime,
485 struct urb *urb) 485 struct urb *urb)
486{ 486{
487 unsigned int i; 487 unsigned int i, offs, counts;
488 struct snd_urb_ctx *ctx = urb->context; 488 struct snd_urb_ctx *ctx = urb->context;
489 int stride = runtime->frame_bits >> 3;
489 490
491 offs = 0;
490 urb->dev = ctx->subs->dev; 492 urb->dev = ctx->subs->dev;
491 urb->number_of_packets = subs->packs_per_ms; 493 urb->number_of_packets = subs->packs_per_ms;
492 for (i = 0; i < subs->packs_per_ms; ++i) { 494 for (i = 0; i < subs->packs_per_ms; ++i) {
493 urb->iso_frame_desc[i].offset = 0; 495 /* calculate the size of a packet */
494 urb->iso_frame_desc[i].length = 0; 496 if (subs->fill_max)
497 counts = subs->maxframesize; /* fixed */
498 else {
499 subs->phase = (subs->phase & 0xffff)
500 + (subs->freqm << subs->datainterval);
501 counts = subs->phase >> 16;
502 if (counts > subs->maxframesize)
503 counts = subs->maxframesize;
504 }
505 urb->iso_frame_desc[i].offset = offs * stride;
506 urb->iso_frame_desc[i].length = counts * stride;
507 offs += counts;
495 } 508 }
496 urb->transfer_buffer_length = 0; 509 urb->transfer_buffer_length = offs * stride;
510 memset(urb->transfer_buffer,
511 subs->cur_audiofmt->format == SNDRV_PCM_FORMAT_U8 ? 0x80 : 0,
512 offs * stride);
497 return 0; 513 return 0;
498} 514}
499 515
@@ -2477,12 +2493,13 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp
2477 if (err < 0) 2493 if (err < 0)
2478 return err; 2494 return err;
2479#if 1 2495#if 1
2480 /* FIXME: temporary hack for extigy/audigy 2 nx */ 2496 /* FIXME: temporary hack for extigy/audigy 2 nx/zs */
2481 /* extigy apparently supports sample rates other than 48k 2497 /* extigy apparently supports sample rates other than 48k
2482 * but not in ordinary way. so we enable only 48k atm. 2498 * but not in ordinary way. so we enable only 48k atm.
2483 */ 2499 */
2484 if (chip->usb_id == USB_ID(0x041e, 0x3000) || 2500 if (chip->usb_id == USB_ID(0x041e, 0x3000) ||
2485 chip->usb_id == USB_ID(0x041e, 0x3020)) { 2501 chip->usb_id == USB_ID(0x041e, 0x3020) ||
2502 chip->usb_id == USB_ID(0x041e, 0x3061)) {
2486 if (fmt[3] == USB_FORMAT_TYPE_I && 2503 if (fmt[3] == USB_FORMAT_TYPE_I &&
2487 fp->rates != SNDRV_PCM_RATE_48000 && 2504 fp->rates != SNDRV_PCM_RATE_48000 &&
2488 fp->rates != SNDRV_PCM_RATE_96000) 2505 fp->rates != SNDRV_PCM_RATE_96000)