diff options
author | Daniel Mack <zonque@gmail.com> | 2011-05-18 05:28:44 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-18 05:44:44 -0400 |
commit | 3bc6fbc7439a88969de97d979795ce7847950668 (patch) | |
tree | 756903989b70548ea2110919a038b3198d8347f5 /sound/usb | |
parent | 0ef283247a0cf0fd2e8370ee467030292eb3129e (diff) |
ALSA: usb-audio: assume valid clock
If the interface can't report a clock's validity, assume that it's
valid.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Vicente Joel <vicentejoel@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/clock.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 7754a1034545..075195e8661a 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c | |||
@@ -104,6 +104,15 @@ static bool uac_clock_source_is_valid(struct snd_usb_audio *chip, int source_id) | |||
104 | int err; | 104 | int err; |
105 | unsigned char data; | 105 | unsigned char data; |
106 | struct usb_device *dev = chip->dev; | 106 | struct usb_device *dev = chip->dev; |
107 | struct uac_clock_source_descriptor *cs_desc = | ||
108 | snd_usb_find_clock_source(chip->ctrl_intf, source_id); | ||
109 | |||
110 | if (!cs_desc) | ||
111 | return 0; | ||
112 | |||
113 | /* If a clock source can't tell us whether it's valid, we assume it is */ | ||
114 | if (!uac2_control_is_readable(cs_desc->bmControls, UAC2_CS_CONTROL_CLOCK_VALID)) | ||
115 | return 1; | ||
107 | 116 | ||
108 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, | 117 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, |
109 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, | 118 | 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 | if (err < 0) { | 123 | if (err < 0) { |
115 | snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", | 124 | snd_printk(KERN_WARNING "%s(): cannot get clock validity for id %d\n", |
116 | __func__, source_id); | 125 | __func__, source_id); |
117 | return err; | 126 | return 0; |
118 | } | 127 | } |
119 | 128 | ||
120 | return !!data; | 129 | return !!data; |