pcm.c (825e587af2e90e9b953849f3347a01d8f383d577) | pcm.c (0ba41d917eeb87f608cf147f870ff2f4c1056bab) |
---|---|
1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 152 unchanged lines hidden (view full) --- 161 162 ep = get_endpoint(alts, 0)->bEndpointAddress; 163 164 data[0] = 1; 165 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, 166 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 167 UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, 168 data, sizeof(data))) < 0) { | 1/* 2 * This program is free software; you can redistribute it and/or modify 3 * it under the terms of the GNU General Public License as published by 4 * the Free Software Foundation; either version 2 of the License, or 5 * (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of --- 152 unchanged lines hidden (view full) --- 161 162 ep = get_endpoint(alts, 0)->bEndpointAddress; 163 164 data[0] = 1; 165 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, 166 USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 167 UAC_EP_CS_ATTR_PITCH_CONTROL << 8, ep, 168 data, sizeof(data))) < 0) { |
169 snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH\n", 170 dev->devnum, iface, ep); | 169 usb_audio_err(chip, "%d:%d: cannot set enable PITCH\n", 170 iface, ep); |
171 return err; 172 } 173 174 return 0; 175} 176 177static int init_pitch_v2(struct snd_usb_audio *chip, int iface, 178 struct usb_host_interface *alts, 179 struct audioformat *fmt) 180{ 181 struct usb_device *dev = chip->dev; 182 unsigned char data[1]; 183 int err; 184 185 data[0] = 1; 186 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, 187 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 188 UAC2_EP_CS_PITCH << 8, 0, 189 data, sizeof(data))) < 0) { | 171 return err; 172 } 173 174 return 0; 175} 176 177static int init_pitch_v2(struct snd_usb_audio *chip, int iface, 178 struct usb_host_interface *alts, 179 struct audioformat *fmt) 180{ 181 struct usb_device *dev = chip->dev; 182 unsigned char data[1]; 183 int err; 184 185 data[0] = 1; 186 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, 187 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 188 UAC2_EP_CS_PITCH << 8, 0, 189 data, sizeof(data))) < 0) { |
190 snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", 191 dev->devnum, iface, fmt->altsetting); | 190 usb_audio_err(chip, "%d:%d: cannot set enable PITCH (v2)\n", 191 iface, fmt->altsetting); |
192 return err; 193 } 194 195 return 0; 196} 197 198/* 199 * initialize the pitch control and sample rate --- 21 unchanged lines hidden (view full) --- 221 int err; 222 223 if (!subs->data_endpoint) 224 return -EINVAL; 225 226 if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) { 227 struct snd_usb_endpoint *ep = subs->data_endpoint; 228 | 192 return err; 193 } 194 195 return 0; 196} 197 198/* 199 * initialize the pitch control and sample rate --- 21 unchanged lines hidden (view full) --- 221 int err; 222 223 if (!subs->data_endpoint) 224 return -EINVAL; 225 226 if (!test_and_set_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) { 227 struct snd_usb_endpoint *ep = subs->data_endpoint; 228 |
229 snd_printdd(KERN_DEBUG "Starting data EP @%p\n", ep); | 229 dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep); |
230 231 ep->data_subs = subs; 232 err = snd_usb_endpoint_start(ep, can_sleep); 233 if (err < 0) { 234 clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); 235 return err; 236 } 237 } --- 4 unchanged lines hidden (view full) --- 242 243 if (subs->data_endpoint->iface != subs->sync_endpoint->iface || 244 subs->data_endpoint->altsetting != subs->sync_endpoint->altsetting) { 245 err = usb_set_interface(subs->dev, 246 subs->sync_endpoint->iface, 247 subs->sync_endpoint->altsetting); 248 if (err < 0) { 249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); | 230 231 ep->data_subs = subs; 232 err = snd_usb_endpoint_start(ep, can_sleep); 233 if (err < 0) { 234 clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags); 235 return err; 236 } 237 } --- 4 unchanged lines hidden (view full) --- 242 243 if (subs->data_endpoint->iface != subs->sync_endpoint->iface || 244 subs->data_endpoint->altsetting != subs->sync_endpoint->altsetting) { 245 err = usb_set_interface(subs->dev, 246 subs->sync_endpoint->iface, 247 subs->sync_endpoint->altsetting); 248 if (err < 0) { 249 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); |
250 snd_printk(KERN_ERR 251 "%d:%d:%d: cannot set interface (%d)\n", 252 subs->dev->devnum, | 250 dev_err(&subs->dev->dev, 251 "%d:%d: cannot set interface (%d)\n", |
253 subs->sync_endpoint->iface, 254 subs->sync_endpoint->altsetting, err); 255 return -EIO; 256 } 257 } 258 | 252 subs->sync_endpoint->iface, 253 subs->sync_endpoint->altsetting, err); 254 return -EIO; 255 } 256 } 257 |
259 snd_printdd(KERN_DEBUG "Starting sync EP @%p\n", ep); | 258 dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep); |
260 261 ep->sync_slave = subs->data_endpoint; 262 err = snd_usb_endpoint_start(ep, can_sleep); 263 if (err < 0) { 264 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); 265 return err; 266 } 267 } --- 137 unchanged lines hidden (view full) --- 405 406 /* check sync-pipe endpoint */ 407 /* ... and check descriptor size before accessing bSynchAddress 408 because there is a version of the SB Audigy 2 NX firmware lacking 409 the audio fields in the endpoint descriptors */ 410 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC || 411 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 412 get_endpoint(alts, 1)->bSynchAddress != 0)) { | 259 260 ep->sync_slave = subs->data_endpoint; 261 err = snd_usb_endpoint_start(ep, can_sleep); 262 if (err < 0) { 263 clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags); 264 return err; 265 } 266 } --- 137 unchanged lines hidden (view full) --- 404 405 /* check sync-pipe endpoint */ 406 /* ... and check descriptor size before accessing bSynchAddress 407 because there is a version of the SB Audigy 2 NX firmware lacking 408 the audio fields in the endpoint descriptors */ 409 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC || 410 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 411 get_endpoint(alts, 1)->bSynchAddress != 0)) { |
413 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", 414 dev->devnum, fmt->iface, fmt->altsetting, | 412 dev_err(&dev->dev, 413 "%d:%d : invalid sync pipe. bmAttributes %02x, bLength %d, bSynchAddress %02x\n", 414 fmt->iface, fmt->altsetting, |
415 get_endpoint(alts, 1)->bmAttributes, 416 get_endpoint(alts, 1)->bLength, 417 get_endpoint(alts, 1)->bSynchAddress); 418 return -EINVAL; 419 } 420 ep = get_endpoint(alts, 1)->bEndpointAddress; 421 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 422 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 423 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { | 415 get_endpoint(alts, 1)->bmAttributes, 416 get_endpoint(alts, 1)->bLength, 417 get_endpoint(alts, 1)->bSynchAddress); 418 return -EINVAL; 419 } 420 ep = get_endpoint(alts, 1)->bEndpointAddress; 421 if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 422 ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) || 423 (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) { |
424 snd_printk(KERN_ERR "%d:%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", 425 dev->devnum, fmt->iface, fmt->altsetting, | 424 dev_err(&dev->dev, 425 "%d:%d : invalid sync pipe. is_playback %d, ep %02x, bSynchAddress %02x\n", 426 fmt->iface, fmt->altsetting, |
426 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); 427 return -EINVAL; 428 } 429 430 implicit_fb = (get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_USAGE_MASK) 431 == USB_ENDPOINT_USAGE_IMPLICIT_FB; 432 433 subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip, --- 30 unchanged lines hidden (view full) --- 464 465 if (fmt == subs->cur_audiofmt) 466 return 0; 467 468 /* close the old interface */ 469 if (subs->interface >= 0 && subs->interface != fmt->iface) { 470 err = usb_set_interface(subs->dev, subs->interface, 0); 471 if (err < 0) { | 427 is_playback, ep, get_endpoint(alts, 0)->bSynchAddress); 428 return -EINVAL; 429 } 430 431 implicit_fb = (get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_USAGE_MASK) 432 == USB_ENDPOINT_USAGE_IMPLICIT_FB; 433 434 subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip, --- 30 unchanged lines hidden (view full) --- 465 466 if (fmt == subs->cur_audiofmt) 467 return 0; 468 469 /* close the old interface */ 470 if (subs->interface >= 0 && subs->interface != fmt->iface) { 471 err = usb_set_interface(subs->dev, subs->interface, 0); 472 if (err < 0) { |
472 snd_printk(KERN_ERR "%d:%d:%d: return to setting 0 failed (%d)\n", 473 dev->devnum, fmt->iface, fmt->altsetting, err); | 473 dev_err(&dev->dev, 474 "%d:%d: return to setting 0 failed (%d)\n", 475 fmt->iface, fmt->altsetting, err); |
474 return -EIO; 475 } 476 subs->interface = -1; 477 subs->altset_idx = 0; 478 } 479 480 /* set interface */ 481 if (subs->interface != fmt->iface || 482 subs->altset_idx != fmt->altset_idx) { 483 err = usb_set_interface(dev, fmt->iface, fmt->altsetting); 484 if (err < 0) { | 476 return -EIO; 477 } 478 subs->interface = -1; 479 subs->altset_idx = 0; 480 } 481 482 /* set interface */ 483 if (subs->interface != fmt->iface || 484 subs->altset_idx != fmt->altset_idx) { 485 err = usb_set_interface(dev, fmt->iface, fmt->altsetting); 486 if (err < 0) { |
485 snd_printk(KERN_ERR "%d:%d:%d: usb_set_interface failed (%d)\n", 486 dev->devnum, fmt->iface, fmt->altsetting, err); | 487 dev_err(&dev->dev, 488 "%d:%d: usb_set_interface failed (%d)\n", 489 fmt->iface, fmt->altsetting, err); |
487 return -EIO; 488 } | 490 return -EIO; 491 } |
489 snd_printdd(KERN_INFO "setting usb interface %d:%d\n", 490 fmt->iface, fmt->altsetting); | 492 dev_dbg(&dev->dev, "setting usb interface %d:%d\n", 493 fmt->iface, fmt->altsetting); |
491 subs->interface = fmt->iface; 492 subs->altset_idx = fmt->altset_idx; 493 494 snd_usb_set_interface_quirk(dev); 495 } 496 497 subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip, 498 alts, fmt->endpoint, subs->direction, --- 19 unchanged lines hidden (view full) --- 518 519/* 520 * Return the score of matching two audioformats. 521 * Veto the audioformat if: 522 * - It has no channels for some reason. 523 * - Requested PCM format is not supported. 524 * - Requested sample rate is not supported. 525 */ | 494 subs->interface = fmt->iface; 495 subs->altset_idx = fmt->altset_idx; 496 497 snd_usb_set_interface_quirk(dev); 498 } 499 500 subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip, 501 alts, fmt->endpoint, subs->direction, --- 19 unchanged lines hidden (view full) --- 521 522/* 523 * Return the score of matching two audioformats. 524 * Veto the audioformat if: 525 * - It has no channels for some reason. 526 * - Requested PCM format is not supported. 527 * - Requested sample rate is not supported. 528 */ |
526static int match_endpoint_audioformats(struct audioformat *fp, 527 struct audioformat *match, int rate, 528 snd_pcm_format_t pcm_format) | 529static int match_endpoint_audioformats(struct snd_usb_substream *subs, 530 struct audioformat *fp, 531 struct audioformat *match, int rate, 532 snd_pcm_format_t pcm_format) |
529{ 530 int i; 531 int score = 0; 532 533 if (fp->channels < 1) { | 533{ 534 int i; 535 int score = 0; 536 537 if (fp->channels < 1) { |
534 snd_printdd("%s: (fmt @%p) no channels\n", __func__, fp); | 538 dev_dbg(&subs->dev->dev, 539 "%s: (fmt @%p) no channels\n", __func__, fp); |
535 return 0; 536 } 537 538 if (!(fp->formats & pcm_format_to_bits(pcm_format))) { | 540 return 0; 541 } 542 543 if (!(fp->formats & pcm_format_to_bits(pcm_format))) { |
539 snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__, | 544 dev_dbg(&subs->dev->dev, 545 "%s: (fmt @%p) no match for format %d\n", __func__, |
540 fp, pcm_format); 541 return 0; 542 } 543 544 for (i = 0; i < fp->nr_rates; i++) { 545 if (fp->rate_table[i] == rate) { 546 score++; 547 break; 548 } 549 } 550 if (!score) { | 546 fp, pcm_format); 547 return 0; 548 } 549 550 for (i = 0; i < fp->nr_rates; i++) { 551 if (fp->rate_table[i] == rate) { 552 score++; 553 break; 554 } 555 } 556 if (!score) { |
551 snd_printdd("%s: (fmt @%p) no match for rate %d\n", __func__, | 557 dev_dbg(&subs->dev->dev, 558 "%s: (fmt @%p) no match for rate %d\n", __func__, |
552 fp, rate); 553 return 0; 554 } 555 556 if (fp->channels == match->channels) 557 score++; 558 | 559 fp, rate); 560 return 0; 561 } 562 563 if (fp->channels == match->channels) 564 score++; 565 |
559 snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score); | 566 dev_dbg(&subs->dev->dev, 567 "%s: (fmt @%p) score %d\n", __func__, fp, score); |
560 561 return score; 562} 563 564/* 565 * Configure the sync ep using the rate and pcm format of the data ep. 566 */ 567static int configure_sync_endpoint(struct snd_usb_substream *subs) --- 14 unchanged lines hidden (view full) --- 582 subs->period_bytes, 583 0, 0, 584 subs->cur_rate, 585 subs->cur_audiofmt, 586 NULL); 587 588 /* Try to find the best matching audioformat. */ 589 list_for_each_entry(fp, &sync_subs->fmt_list, list) { | 568 569 return score; 570} 571 572/* 573 * Configure the sync ep using the rate and pcm format of the data ep. 574 */ 575static int configure_sync_endpoint(struct snd_usb_substream *subs) --- 14 unchanged lines hidden (view full) --- 590 subs->period_bytes, 591 0, 0, 592 subs->cur_rate, 593 subs->cur_audiofmt, 594 NULL); 595 596 /* Try to find the best matching audioformat. */ 597 list_for_each_entry(fp, &sync_subs->fmt_list, list) { |
590 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, | 598 int score = match_endpoint_audioformats(subs, 599 fp, subs->cur_audiofmt, |
591 subs->cur_rate, subs->pcm_format); 592 593 if (score > cur_score) { 594 sync_fp = fp; 595 cur_score = score; 596 } 597 } 598 599 if (unlikely(sync_fp == NULL)) { | 600 subs->cur_rate, subs->pcm_format); 601 602 if (score > cur_score) { 603 sync_fp = fp; 604 cur_score = score; 605 } 606 } 607 608 if (unlikely(sync_fp == NULL)) { |
600 snd_printk(KERN_ERR "%s: no valid audioformat for sync ep %x found\n", | 609 dev_err(&subs->dev->dev, 610 "%s: no valid audioformat for sync ep %x found\n", |
601 __func__, sync_subs->ep_num); 602 return -EINVAL; 603 } 604 605 /* 606 * Recalculate the period bytes if channel number differ between 607 * data and sync ep audioformat. 608 */ 609 if (sync_fp->channels != subs->channels) { 610 sync_period_bytes = (subs->period_bytes / subs->channels) * 611 sync_fp->channels; | 611 __func__, sync_subs->ep_num); 612 return -EINVAL; 613 } 614 615 /* 616 * Recalculate the period bytes if channel number differ between 617 * data and sync ep audioformat. 618 */ 619 if (sync_fp->channels != subs->channels) { 620 sync_period_bytes = (subs->period_bytes / subs->channels) * 621 sync_fp->channels; |
612 snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n", | 622 dev_dbg(&subs->dev->dev, 623 "%s: adjusted sync ep period bytes (%d -> %d)\n", |
613 __func__, subs->period_bytes, sync_period_bytes); 614 } 615 616 ret = snd_usb_endpoint_set_params(subs->sync_endpoint, 617 subs->pcm_format, 618 sync_fp->channels, 619 sync_period_bytes, 620 0, 0, --- 59 unchanged lines hidden (view full) --- 680 subs->period_bytes = params_period_bytes(hw_params); 681 subs->period_frames = params_period_size(hw_params); 682 subs->buffer_periods = params_periods(hw_params); 683 subs->channels = params_channels(hw_params); 684 subs->cur_rate = params_rate(hw_params); 685 686 fmt = find_format(subs); 687 if (!fmt) { | 624 __func__, subs->period_bytes, sync_period_bytes); 625 } 626 627 ret = snd_usb_endpoint_set_params(subs->sync_endpoint, 628 subs->pcm_format, 629 sync_fp->channels, 630 sync_period_bytes, 631 0, 0, --- 59 unchanged lines hidden (view full) --- 691 subs->period_bytes = params_period_bytes(hw_params); 692 subs->period_frames = params_period_size(hw_params); 693 subs->buffer_periods = params_periods(hw_params); 694 subs->channels = params_channels(hw_params); 695 subs->cur_rate = params_rate(hw_params); 696 697 fmt = find_format(subs); 698 if (!fmt) { |
688 snd_printd(KERN_DEBUG "cannot set format: format = %#x, rate = %d, channels = %d\n", | 699 dev_dbg(&subs->dev->dev, 700 "cannot set format: format = %#x, rate = %d, channels = %d\n", |
689 subs->pcm_format, subs->cur_rate, subs->channels); 690 return -EINVAL; 691 } 692 693 down_read(&subs->stream->chip->shutdown_rwsem); 694 if (subs->stream->chip->shutdown) 695 ret = -ENODEV; 696 else --- 40 unchanged lines hidden (view full) --- 737{ 738 struct snd_pcm_runtime *runtime = substream->runtime; 739 struct snd_usb_substream *subs = runtime->private_data; 740 struct usb_host_interface *alts; 741 struct usb_interface *iface; 742 int ret; 743 744 if (! subs->cur_audiofmt) { | 701 subs->pcm_format, subs->cur_rate, subs->channels); 702 return -EINVAL; 703 } 704 705 down_read(&subs->stream->chip->shutdown_rwsem); 706 if (subs->stream->chip->shutdown) 707 ret = -ENODEV; 708 else --- 40 unchanged lines hidden (view full) --- 749{ 750 struct snd_pcm_runtime *runtime = substream->runtime; 751 struct snd_usb_substream *subs = runtime->private_data; 752 struct usb_host_interface *alts; 753 struct usb_interface *iface; 754 int ret; 755 756 if (! subs->cur_audiofmt) { |
745 snd_printk(KERN_ERR "usbaudio: no format is specified!\n"); | 757 dev_err(&subs->dev->dev, "no format is specified!\n"); |
746 return -ENXIO; 747 } 748 749 down_read(&subs->stream->chip->shutdown_rwsem); 750 if (subs->stream->chip->shutdown) { 751 ret = -ENODEV; 752 goto unlock; 753 } --- 476 unchanged lines hidden (view full) --- 1230 /* read frame number here, update pointer in critical section */ 1231 current_frame_number = usb_get_current_frame_number(subs->dev); 1232 1233 stride = runtime->frame_bits >> 3; 1234 1235 for (i = 0; i < urb->number_of_packets; i++) { 1236 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj; 1237 if (urb->iso_frame_desc[i].status && printk_ratelimit()) { | 758 return -ENXIO; 759 } 760 761 down_read(&subs->stream->chip->shutdown_rwsem); 762 if (subs->stream->chip->shutdown) { 763 ret = -ENODEV; 764 goto unlock; 765 } --- 476 unchanged lines hidden (view full) --- 1242 /* read frame number here, update pointer in critical section */ 1243 current_frame_number = usb_get_current_frame_number(subs->dev); 1244 1245 stride = runtime->frame_bits >> 3; 1246 1247 for (i = 0; i < urb->number_of_packets; i++) { 1248 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj; 1249 if (urb->iso_frame_desc[i].status && printk_ratelimit()) { |
1238 snd_printdd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); | 1250 dev_dbg(&subs->dev->dev, "frame %d active: %d\n", 1251 i, urb->iso_frame_desc[i].status); |
1239 // continue; 1240 } 1241 bytes = urb->iso_frame_desc[i].actual_length; 1242 frames = bytes / stride; 1243 if (!subs->txfr_quirk) 1244 bytes = frames * stride; 1245 if (bytes % (runtime->sample_bits >> 3) != 0) { 1246 int oldbytes = bytes; 1247 bytes = frames * stride; | 1252 // continue; 1253 } 1254 bytes = urb->iso_frame_desc[i].actual_length; 1255 frames = bytes / stride; 1256 if (!subs->txfr_quirk) 1257 bytes = frames * stride; 1258 if (bytes % (runtime->sample_bits >> 3) != 0) { 1259 int oldbytes = bytes; 1260 bytes = frames * stride; |
1248 snd_printdd(KERN_ERR "Corrected urb data len. %d->%d\n", | 1261 dev_warn(&subs->dev->dev, 1262 "Corrected urb data len. %d->%d\n", |
1249 oldbytes, bytes); 1250 } 1251 /* update the current pointer */ 1252 spin_lock_irqsave(&subs->lock, flags); 1253 oldptr = subs->hwptr_done; 1254 subs->hwptr_done += bytes; 1255 if (subs->hwptr_done >= runtime->buffer_size * stride) 1256 subs->hwptr_done -= runtime->buffer_size * stride; --- 226 unchanged lines hidden (view full) --- 1483 runtime->delay = subs->last_delay; 1484 1485 /* 1486 * Report when delay estimate is off by more than 2ms. 1487 * The error should be lower than 2ms since the estimate relies 1488 * on two reads of a counter updated every ms. 1489 */ 1490 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) | 1263 oldbytes, bytes); 1264 } 1265 /* update the current pointer */ 1266 spin_lock_irqsave(&subs->lock, flags); 1267 oldptr = subs->hwptr_done; 1268 subs->hwptr_done += bytes; 1269 if (subs->hwptr_done >= runtime->buffer_size * stride) 1270 subs->hwptr_done -= runtime->buffer_size * stride; --- 226 unchanged lines hidden (view full) --- 1497 runtime->delay = subs->last_delay; 1498 1499 /* 1500 * Report when delay estimate is off by more than 2ms. 1501 * The error should be lower than 2ms since the estimate relies 1502 * on two reads of a counter updated every ms. 1503 */ 1504 if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) |
1491 snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", | 1505 dev_dbg(&subs->dev->dev, 1506 "delay: estimated %d, actual %d\n", |
1492 est_delay, subs->last_delay); 1493 1494 if (!subs->running) { 1495 /* update last_frame_number for delay counting here since 1496 * prepare_playback_urb won't be called during pause 1497 */ 1498 subs->last_frame_number = 1499 usb_get_current_frame_number(subs->dev) & 0xff; --- 117 unchanged lines hidden --- | 1507 est_delay, subs->last_delay); 1508 1509 if (!subs->running) { 1510 /* update last_frame_number for delay counting here since 1511 * prepare_playback_urb won't be called during pause 1512 */ 1513 subs->last_frame_number = 1514 usb_get_current_frame_number(subs->dev) & 0xff; --- 117 unchanged lines hidden --- |