diff options
Diffstat (limited to 'sound/usb/clock.c')
-rw-r--r-- | sound/usb/clock.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 0b030d8fe3fa..c79749613fa6 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c | |||
@@ -443,10 +443,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, | |||
443 | data[0] = rate; | 443 | data[0] = rate; |
444 | data[1] = rate >> 8; | 444 | data[1] = rate >> 8; |
445 | data[2] = rate >> 16; | 445 | data[2] = rate >> 16; |
446 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, | 446 | err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, |
447 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, | 447 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, |
448 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, | 448 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, |
449 | data, sizeof(data))) < 0) { | 449 | data, sizeof(data)); |
450 | if (err < 0) { | ||
450 | dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n", | 451 | dev_err(&dev->dev, "%d:%d: cannot set freq %d to ep %#x\n", |
451 | iface, fmt->altsetting, rate, ep); | 452 | iface, fmt->altsetting, rate, ep); |
452 | return err; | 453 | return err; |
@@ -460,10 +461,11 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, | |||
460 | if (chip->sample_rate_read_error > 2) | 461 | if (chip->sample_rate_read_error > 2) |
461 | return 0; | 462 | return 0; |
462 | 463 | ||
463 | if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, | 464 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, |
464 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, | 465 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, |
465 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, | 466 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, |
466 | data, sizeof(data))) < 0) { | 467 | data, sizeof(data)); |
468 | if (err < 0) { | ||
467 | dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n", | 469 | dev_err(&dev->dev, "%d:%d: cannot get freq at ep %#x\n", |
468 | iface, fmt->altsetting, ep); | 470 | iface, fmt->altsetting, ep); |
469 | chip->sample_rate_read_error++; | 471 | chip->sample_rate_read_error++; |
@@ -587,8 +589,15 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface, | |||
587 | default: | 589 | default: |
588 | return set_sample_rate_v1(chip, iface, alts, fmt, rate); | 590 | return set_sample_rate_v1(chip, iface, alts, fmt, rate); |
589 | 591 | ||
590 | case UAC_VERSION_2: | ||
591 | case UAC_VERSION_3: | 592 | case UAC_VERSION_3: |
593 | if (chip->badd_profile >= UAC3_FUNCTION_SUBCLASS_GENERIC_IO) { | ||
594 | if (rate != UAC3_BADD_SAMPLING_RATE) | ||
595 | return -ENXIO; | ||
596 | else | ||
597 | return 0; | ||
598 | } | ||
599 | /* fall through */ | ||
600 | case UAC_VERSION_2: | ||
592 | return set_sample_rate_v2v3(chip, iface, alts, fmt, rate); | 601 | return set_sample_rate_v2v3(chip, iface, alts, fmt, rate); |
593 | } | 602 | } |
594 | } | 603 | } |