diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-29 18:31:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-29 18:31:57 -0400 |
commit | 52b0ace7dfe8f70350218017a95d7cab1eb41fbb (patch) | |
tree | e474f8e2c5ac1712e1e1155b879420dde4aa3922 /sound/usb | |
parent | 24010e460454ec0d2f4f0213b667b4349cbdb8e1 (diff) | |
parent | d6695f09ea30de712662fcf8dd0e8c4d4306a15a (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (26 commits)
ALSA: snd-usb-caiaq: Bump version number to 1.3.21
ALSA: Revert "ALSA: snd-usb-caiaq: Set default input mode of A4DJ"
ALSA: snd-usb-caiaq: Simplify single case to an 'if'
ALSA: snd-usb-caiaq: Restore 'Control vinyl' input mode on A4DJ
ALSA: hda: Use LPIB for a Shuttle device
ALSA: hda: Add support for another Lenovo ThinkPad Edge in conexant codec
ALSA: hda: Use LPIB for Sony VPCS11V9E
ALSA: usb-audio: fix feature unit parser for UAC2
ALSA: asihpi - Minor code cleanup
ALSA: asihpi - Add support for new ASI8800 family
ALSA: asihpi - Fix bug preventing outstream_write preload from happening
ALSA: asihpi - Fix imbalanced lock path in hw_message
ALSA: asihpi - Remove support for old ASI8800 family
ALSA: asihpi - Add hd radio blend functions
ALSA: asihpi - Remove unused io map functions
ALSA: usb-audio: add support for UAC2 pitch control
ALSA: usb-audio: parse UAC2 endpoint descriptors correctly
ALSA: usb-audio: fix return values
ALSA: usb-audio: parse more format descriptors with structs
sound: Add missing spin_unlock
...
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/caiaq/control.c | 36 | ||||
-rw-r--r-- | sound/usb/caiaq/device.c | 8 | ||||
-rw-r--r-- | sound/usb/endpoint.c | 64 | ||||
-rw-r--r-- | sound/usb/format.c | 24 | ||||
-rw-r--r-- | sound/usb/format.h | 7 | ||||
-rw-r--r-- | sound/usb/mixer.c | 2 | ||||
-rw-r--r-- | sound/usb/pcm.c | 37 |
7 files changed, 100 insertions, 78 deletions
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c index 36ed703a7416..91c804cd2782 100644 --- a/sound/usb/caiaq/control.c +++ b/sound/usb/caiaq/control.c | |||
@@ -42,21 +42,12 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
42 | 42 | ||
43 | switch (dev->chip.usb_id) { | 43 | switch (dev->chip.usb_id) { |
44 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 44 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
45 | if (pos == 0) { | ||
46 | /* current input mode of A8DJ */ | ||
47 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
48 | uinfo->value.integer.min = 0; | ||
49 | uinfo->value.integer.max = 2; | ||
50 | return 0; | ||
51 | } | ||
52 | break; | ||
53 | |||
54 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | 45 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
55 | if (pos == 0) { | 46 | if (pos == 0) { |
56 | /* current input mode of A4DJ */ | 47 | /* current input mode of A8DJ and A4DJ */ |
57 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 48 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
58 | uinfo->value.integer.min = 0; | 49 | uinfo->value.integer.min = 0; |
59 | uinfo->value.integer.max = 1; | 50 | uinfo->value.integer.max = 2; |
60 | return 0; | 51 | return 0; |
61 | } | 52 | } |
62 | break; | 53 | break; |
@@ -86,14 +77,6 @@ static int control_get(struct snd_kcontrol *kcontrol, | |||
86 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 77 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
87 | int pos = kcontrol->private_value; | 78 | int pos = kcontrol->private_value; |
88 | 79 | ||
89 | if (dev->chip.usb_id == | ||
90 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { | ||
91 | /* A4DJ has only one control */ | ||
92 | /* do not expose hardware input mode 0 */ | ||
93 | ucontrol->value.integer.value[0] = dev->control_state[0] - 1; | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | if (pos & CNT_INTVAL) | 80 | if (pos & CNT_INTVAL) |
98 | ucontrol->value.integer.value[0] | 81 | ucontrol->value.integer.value[0] |
99 | = dev->control_state[pos & ~CNT_INTVAL]; | 82 | = dev->control_state[pos & ~CNT_INTVAL]; |
@@ -112,20 +95,9 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
112 | int pos = kcontrol->private_value; | 95 | int pos = kcontrol->private_value; |
113 | unsigned char cmd = EP1_CMD_WRITE_IO; | 96 | unsigned char cmd = EP1_CMD_WRITE_IO; |
114 | 97 | ||
115 | switch (dev->chip.usb_id) { | 98 | if (dev->chip.usb_id == |
116 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): { | 99 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) |
117 | /* A4DJ has only one control */ | ||
118 | /* do not expose hardware input mode 0 */ | ||
119 | dev->control_state[0] = ucontrol->value.integer.value[0] + 1; | ||
120 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | ||
121 | dev->control_state, sizeof(dev->control_state)); | ||
122 | return 1; | ||
123 | } | ||
124 | |||
125 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | ||
126 | cmd = EP1_CMD_DIMM_LEDS; | 100 | cmd = EP1_CMD_DIMM_LEDS; |
127 | break; | ||
128 | } | ||
129 | 101 | ||
130 | if (pos & CNT_INTVAL) { | 102 | if (pos & CNT_INTVAL) { |
131 | dev->control_state[pos & ~CNT_INTVAL] | 103 | dev->control_state[pos & ~CNT_INTVAL] |
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 805271827675..cdfb856bddd2 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include "input.h" | 36 | #include "input.h" |
37 | 37 | ||
38 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); | 38 | MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); |
39 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20"); | 39 | MODULE_DESCRIPTION("caiaq USB audio, version 1.3.21"); |
40 | MODULE_LICENSE("GPL"); | 40 | MODULE_LICENSE("GPL"); |
41 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," | 41 | MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," |
42 | "{Native Instruments, RigKontrol3}," | 42 | "{Native Instruments, RigKontrol3}," |
@@ -320,12 +320,6 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) | |||
320 | } | 320 | } |
321 | 321 | ||
322 | break; | 322 | break; |
323 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | ||
324 | /* Audio 4 DJ - default input mode to phono */ | ||
325 | dev->control_state[0] = 2; | ||
326 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | ||
327 | dev->control_state, 1); | ||
328 | break; | ||
329 | } | 323 | } |
330 | 324 | ||
331 | if (dev->spec.num_analog_audio_out + | 325 | if (dev->spec.num_analog_audio_out + |
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index ef07a6d0dd5f..28ee1ce3971a 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c | |||
@@ -149,6 +149,47 @@ int snd_usb_add_audio_endpoint(struct snd_usb_audio *chip, int stream, struct au | |||
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | 151 | ||
152 | static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, | ||
153 | struct usb_host_interface *alts, | ||
154 | int protocol, int iface_no) | ||
155 | { | ||
156 | /* parsed with a v1 header here. that's ok as we only look at the | ||
157 | * header first which is the same for both versions */ | ||
158 | struct uac_iso_endpoint_descriptor *csep; | ||
159 | struct usb_interface_descriptor *altsd = get_iface_desc(alts); | ||
160 | int attributes = 0; | ||
161 | |||
162 | csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); | ||
163 | |||
164 | /* Creamware Noah has this descriptor after the 2nd endpoint */ | ||
165 | if (!csep && altsd->bNumEndpoints >= 2) | ||
166 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); | ||
167 | |||
168 | if (!csep || csep->bLength < 7 || | ||
169 | csep->bDescriptorSubtype != UAC_EP_GENERAL) { | ||
170 | snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" | ||
171 | " class specific endpoint descriptor\n", | ||
172 | chip->dev->devnum, iface_no, | ||
173 | altsd->bAlternateSetting); | ||
174 | return 0; | ||
175 | } | ||
176 | |||
177 | if (protocol == UAC_VERSION_1) { | ||
178 | attributes = csep->bmAttributes; | ||
179 | } else { | ||
180 | struct uac2_iso_endpoint_descriptor *csep2 = | ||
181 | (struct uac2_iso_endpoint_descriptor *) csep; | ||
182 | |||
183 | attributes = csep->bmAttributes & UAC_EP_CS_ATTR_FILL_MAX; | ||
184 | |||
185 | /* emulate the endpoint attributes of a v1 device */ | ||
186 | if (csep2->bmControls & UAC2_CONTROL_PITCH) | ||
187 | attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL; | ||
188 | } | ||
189 | |||
190 | return attributes; | ||
191 | } | ||
192 | |||
152 | int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | 193 | int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) |
153 | { | 194 | { |
154 | struct usb_device *dev; | 195 | struct usb_device *dev; |
@@ -158,8 +199,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
158 | int i, altno, err, stream; | 199 | int i, altno, err, stream; |
159 | int format = 0, num_channels = 0; | 200 | int format = 0, num_channels = 0; |
160 | struct audioformat *fp = NULL; | 201 | struct audioformat *fp = NULL; |
161 | unsigned char *fmt, *csep; | ||
162 | int num, protocol; | 202 | int num, protocol; |
203 | struct uac_format_type_i_continuous_descriptor *fmt; | ||
163 | 204 | ||
164 | dev = chip->dev; | 205 | dev = chip->dev; |
165 | 206 | ||
@@ -256,8 +297,8 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
256 | dev->devnum, iface_no, altno); | 297 | dev->devnum, iface_no, altno); |
257 | continue; | 298 | continue; |
258 | } | 299 | } |
259 | if (((protocol == UAC_VERSION_1) && (fmt[0] < 8)) || | 300 | if (((protocol == UAC_VERSION_1) && (fmt->bLength < 8)) || |
260 | ((protocol == UAC_VERSION_2) && (fmt[0] != 6))) { | 301 | ((protocol == UAC_VERSION_2) && (fmt->bLength != 6))) { |
261 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", | 302 | snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", |
262 | dev->devnum, iface_no, altno); | 303 | dev->devnum, iface_no, altno); |
263 | continue; | 304 | continue; |
@@ -268,7 +309,9 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
268 | * with the previous one, except for a larger packet size, but | 309 | * with the previous one, except for a larger packet size, but |
269 | * is actually a mislabeled two-channel setting; ignore it. | 310 | * is actually a mislabeled two-channel setting; ignore it. |
270 | */ | 311 | */ |
271 | if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && | 312 | if (fmt->bNrChannels == 1 && |
313 | fmt->bSubframeSize == 2 && | ||
314 | altno == 2 && num == 3 && | ||
272 | fp && fp->altsetting == 1 && fp->channels == 1 && | 315 | fp && fp->altsetting == 1 && fp->channels == 1 && |
273 | fp->formats == SNDRV_PCM_FMTBIT_S16_LE && | 316 | fp->formats == SNDRV_PCM_FMTBIT_S16_LE && |
274 | protocol == UAC_VERSION_1 && | 317 | protocol == UAC_VERSION_1 && |
@@ -276,17 +319,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
276 | fp->maxpacksize * 2) | 319 | fp->maxpacksize * 2) |
277 | continue; | 320 | continue; |
278 | 321 | ||
279 | csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); | ||
280 | /* Creamware Noah has this descriptor after the 2nd endpoint */ | ||
281 | if (!csep && altsd->bNumEndpoints >= 2) | ||
282 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); | ||
283 | if (!csep || csep[0] < 7 || csep[2] != UAC_EP_GENERAL) { | ||
284 | snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" | ||
285 | " class specific endpoint descriptor\n", | ||
286 | dev->devnum, iface_no, altno); | ||
287 | csep = NULL; | ||
288 | } | ||
289 | |||
290 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); | 322 | fp = kzalloc(sizeof(*fp), GFP_KERNEL); |
291 | if (! fp) { | 323 | if (! fp) { |
292 | snd_printk(KERN_ERR "cannot malloc\n"); | 324 | snd_printk(KERN_ERR "cannot malloc\n"); |
@@ -305,7 +337,7 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
305 | if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) | 337 | if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) |
306 | fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) | 338 | fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) |
307 | * (fp->maxpacksize & 0x7ff); | 339 | * (fp->maxpacksize & 0x7ff); |
308 | fp->attributes = csep ? csep[3] : 0; | 340 | fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); |
309 | 341 | ||
310 | /* some quirks for attributes here */ | 342 | /* some quirks for attributes here */ |
311 | 343 | ||
diff --git a/sound/usb/format.c b/sound/usb/format.c index b87cf87c4e7b..fe29d61de19b 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -278,12 +278,11 @@ err: | |||
278 | * parse the format type I and III descriptors | 278 | * parse the format type I and III descriptors |
279 | */ | 279 | */ |
280 | static int parse_audio_format_i(struct snd_usb_audio *chip, | 280 | static int parse_audio_format_i(struct snd_usb_audio *chip, |
281 | struct audioformat *fp, | 281 | struct audioformat *fp, int format, |
282 | int format, void *_fmt, | 282 | struct uac_format_type_i_continuous_descriptor *fmt, |
283 | struct usb_host_interface *iface) | 283 | struct usb_host_interface *iface) |
284 | { | 284 | { |
285 | struct usb_interface_descriptor *altsd = get_iface_desc(iface); | 285 | struct usb_interface_descriptor *altsd = get_iface_desc(iface); |
286 | struct uac_format_type_i_discrete_descriptor *fmt = _fmt; | ||
287 | int protocol = altsd->bInterfaceProtocol; | 286 | int protocol = altsd->bInterfaceProtocol; |
288 | int pcm_format, ret; | 287 | int pcm_format, ret; |
289 | 288 | ||
@@ -320,7 +319,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, | |||
320 | switch (protocol) { | 319 | switch (protocol) { |
321 | case UAC_VERSION_1: | 320 | case UAC_VERSION_1: |
322 | fp->channels = fmt->bNrChannels; | 321 | fp->channels = fmt->bNrChannels; |
323 | ret = parse_audio_format_rates_v1(chip, fp, _fmt, 7); | 322 | ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); |
324 | break; | 323 | break; |
325 | case UAC_VERSION_2: | 324 | case UAC_VERSION_2: |
326 | /* fp->channels is already set in this case */ | 325 | /* fp->channels is already set in this case */ |
@@ -392,12 +391,12 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, | |||
392 | } | 391 | } |
393 | 392 | ||
394 | int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, | 393 | int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, |
395 | int format, unsigned char *fmt, int stream, | 394 | int format, struct uac_format_type_i_continuous_descriptor *fmt, |
396 | struct usb_host_interface *iface) | 395 | int stream, struct usb_host_interface *iface) |
397 | { | 396 | { |
398 | int err; | 397 | int err; |
399 | 398 | ||
400 | switch (fmt[3]) { | 399 | switch (fmt->bFormatType) { |
401 | case UAC_FORMAT_TYPE_I: | 400 | case UAC_FORMAT_TYPE_I: |
402 | case UAC_FORMAT_TYPE_III: | 401 | case UAC_FORMAT_TYPE_III: |
403 | err = parse_audio_format_i(chip, fp, format, fmt, iface); | 402 | err = parse_audio_format_i(chip, fp, format, fmt, iface); |
@@ -407,10 +406,11 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f | |||
407 | break; | 406 | break; |
408 | default: | 407 | default: |
409 | snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", | 408 | snd_printd(KERN_INFO "%d:%u:%d : format type %d is not supported yet\n", |
410 | chip->dev->devnum, fp->iface, fp->altsetting, fmt[3]); | 409 | chip->dev->devnum, fp->iface, fp->altsetting, |
411 | return -1; | 410 | fmt->bFormatType); |
411 | return -ENOTSUPP; | ||
412 | } | 412 | } |
413 | fp->fmt_type = fmt[3]; | 413 | fp->fmt_type = fmt->bFormatType; |
414 | if (err < 0) | 414 | if (err < 0) |
415 | return err; | 415 | return err; |
416 | #if 1 | 416 | #if 1 |
@@ -421,10 +421,10 @@ int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *f | |||
421 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || | 421 | if (chip->usb_id == USB_ID(0x041e, 0x3000) || |
422 | chip->usb_id == USB_ID(0x041e, 0x3020) || | 422 | chip->usb_id == USB_ID(0x041e, 0x3020) || |
423 | chip->usb_id == USB_ID(0x041e, 0x3061)) { | 423 | chip->usb_id == USB_ID(0x041e, 0x3061)) { |
424 | if (fmt[3] == UAC_FORMAT_TYPE_I && | 424 | if (fmt->bFormatType == UAC_FORMAT_TYPE_I && |
425 | fp->rates != SNDRV_PCM_RATE_48000 && | 425 | fp->rates != SNDRV_PCM_RATE_48000 && |
426 | fp->rates != SNDRV_PCM_RATE_96000) | 426 | fp->rates != SNDRV_PCM_RATE_96000) |
427 | return -1; | 427 | return -ENOTSUPP; |
428 | } | 428 | } |
429 | #endif | 429 | #endif |
430 | return 0; | 430 | return 0; |
diff --git a/sound/usb/format.h b/sound/usb/format.h index 8298c4e8ddfa..387924f0af85 100644 --- a/sound/usb/format.h +++ b/sound/usb/format.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef __USBAUDIO_FORMAT_H | 1 | #ifndef __USBAUDIO_FORMAT_H |
2 | #define __USBAUDIO_FORMAT_H | 2 | #define __USBAUDIO_FORMAT_H |
3 | 3 | ||
4 | int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp, | 4 | int snd_usb_parse_audio_format(struct snd_usb_audio *chip, |
5 | int format, unsigned char *fmt, int stream, | 5 | struct audioformat *fp, int format, |
6 | struct usb_host_interface *iface); | 6 | struct uac_format_type_i_continuous_descriptor *fmt, |
7 | int stream, struct usb_host_interface *iface); | ||
7 | 8 | ||
8 | #endif /* __USBAUDIO_FORMAT_H */ | 9 | #endif /* __USBAUDIO_FORMAT_H */ |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 97dd17655104..03ce971e0027 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -1126,7 +1126,7 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void | |||
1126 | } else { | 1126 | } else { |
1127 | struct uac2_feature_unit_descriptor *ftr = _ftr; | 1127 | struct uac2_feature_unit_descriptor *ftr = _ftr; |
1128 | csize = 4; | 1128 | csize = 4; |
1129 | channels = (hdr->bLength - 6) / 4; | 1129 | channels = (hdr->bLength - 6) / 4 - 1; |
1130 | bmaControls = ftr->bmaControls; | 1130 | bmaControls = ftr->bmaControls; |
1131 | } | 1131 | } |
1132 | 1132 | ||
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 2bf0d77d1768..056587de7be4 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -120,10 +120,6 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, | |||
120 | 120 | ||
121 | ep = get_endpoint(alts, 0)->bEndpointAddress; | 121 | ep = get_endpoint(alts, 0)->bEndpointAddress; |
122 | 122 | ||
123 | /* if endpoint doesn't have pitch control, bail out */ | ||
124 | if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL)) | ||
125 | return 0; | ||
126 | |||
127 | data[0] = 1; | 123 | data[0] = 1; |
128 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, | 124 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR, |
129 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, | 125 | USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, |
@@ -137,8 +133,32 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface, | |||
137 | return 0; | 133 | return 0; |
138 | } | 134 | } |
139 | 135 | ||
136 | static int init_pitch_v2(struct snd_usb_audio *chip, int iface, | ||
137 | struct usb_host_interface *alts, | ||
138 | struct audioformat *fmt) | ||
139 | { | ||
140 | struct usb_device *dev = chip->dev; | ||
141 | unsigned char data[1]; | ||
142 | unsigned int ep; | ||
143 | int err; | ||
144 | |||
145 | ep = get_endpoint(alts, 0)->bEndpointAddress; | ||
146 | |||
147 | data[0] = 1; | ||
148 | if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, | ||
149 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, | ||
150 | UAC2_EP_CS_PITCH << 8, 0, | ||
151 | data, sizeof(data), 1000)) < 0) { | ||
152 | snd_printk(KERN_ERR "%d:%d:%d: cannot set enable PITCH (v2)\n", | ||
153 | dev->devnum, iface, fmt->altsetting); | ||
154 | return err; | ||
155 | } | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
140 | /* | 160 | /* |
141 | * initialize the picth control and sample rate | 161 | * initialize the pitch control and sample rate |
142 | */ | 162 | */ |
143 | int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | 163 | int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, |
144 | struct usb_host_interface *alts, | 164 | struct usb_host_interface *alts, |
@@ -146,13 +166,16 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface, | |||
146 | { | 166 | { |
147 | struct usb_interface_descriptor *altsd = get_iface_desc(alts); | 167 | struct usb_interface_descriptor *altsd = get_iface_desc(alts); |
148 | 168 | ||
169 | /* if endpoint doesn't have pitch control, bail out */ | ||
170 | if (!(fmt->attributes & UAC_EP_CS_ATTR_PITCH_CONTROL)) | ||
171 | return 0; | ||
172 | |||
149 | switch (altsd->bInterfaceProtocol) { | 173 | switch (altsd->bInterfaceProtocol) { |
150 | case UAC_VERSION_1: | 174 | case UAC_VERSION_1: |
151 | return init_pitch_v1(chip, iface, alts, fmt); | 175 | return init_pitch_v1(chip, iface, alts, fmt); |
152 | 176 | ||
153 | case UAC_VERSION_2: | 177 | case UAC_VERSION_2: |
154 | /* not implemented yet */ | 178 | return init_pitch_v2(chip, iface, alts, fmt); |
155 | return 0; | ||
156 | } | 179 | } |
157 | 180 | ||
158 | return -EINVAL; | 181 | return -EINVAL; |