Commit 3bc6fbc7 authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

ALSA: usb-audio: assume valid clock

If the interface can't report a clock's validity, assume that it's
valid.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Reported-by: default avatarVicente Joel <vicentejoel@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0ef28324
...@@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) ...@@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
int err; int err;
unsigned char data; unsigned char data;
struct usb_device *dev = chip->dev; struct usb_device *dev = chip->dev;
struct uac_clock_source_descriptor *cs_desc =
snd_usb_find_clock_source(chip->ctrl_intf, source_id);
if (!cs_desc)
return 0;
/* If a clock source can't tell us whether it's valid, we assume it is */
if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID))
return 1;
err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
...@@ -114,7 +123,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) ...@@ -114,7 +123,7 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id)
if (err < 0) { if (err < 0) {
snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n",
__func__, source_id); __func__, source_id);
return err; return 0;
} }
return !!data; return !!data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment