format.c (d07140ba7fe1b41713627c6dc3f169a00019fb0e) format.c (11bcbc443a17653c65bc20029172fae76f4bcca4)
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

--- 213 unchanged lines hidden (view full) ---

222 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",
223 __func__, clock);
224 goto err;
225 }
226
227 /* get the number of sample rates first by only fetching 2 bytes */
228 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
229 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
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

--- 213 unchanged lines hidden (view full) ---

222 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",
223 __func__, clock);
224 goto err;
225 }
226
227 /* get the number of sample rates first by only fetching 2 bytes */
228 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
229 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
230 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
230 UAC2_CS_CONTROL_SAM_FREQ << 8,
231 snd_usb_ctrl_intf(chip) | (clock << 8),
231 tmp, sizeof(tmp), 1000);
232
233 if (ret < 0) {
234 snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n",
235 __func__, clock);
236 goto err;
237 }
238
239 nr_rates = (tmp[1] << 8) | tmp[0];
240 data_size = 2 + 12 * nr_rates;
241 data = kzalloc(data_size, GFP_KERNEL);
242 if (!data) {
243 ret = -ENOMEM;
244 goto err;
245 }
246
247 /* now get the full information */
248 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
249 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
232 tmp, sizeof(tmp), 1000);
233
234 if (ret < 0) {
235 snd_printk(KERN_ERR "%s(): unable to retrieve number of sample rates (clock %d)\n",
236 __func__, clock);
237 goto err;
238 }
239
240 nr_rates = (tmp[1] << 8) | tmp[0];
241 data_size = 2 + 12 * nr_rates;
242 data = kzalloc(data_size, GFP_KERNEL);
243 if (!data) {
244 ret = -ENOMEM;
245 goto err;
246 }
247
248 /* now get the full information */
249 ret = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_RANGE,
250 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
250 UAC2_CS_CONTROL_SAM_FREQ << 8, clock << 8,
251 UAC2_CS_CONTROL_SAM_FREQ << 8,
252 snd_usb_ctrl_intf(chip) | (clock << 8),
251 data, data_size, 1000);
252
253 if (ret < 0) {
254 snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n",
255 __func__, clock);
256 ret = -EINVAL;
257 goto err_free;
258 }

--- 184 unchanged lines hidden ---
253 data, data_size, 1000);
254
255 if (ret < 0) {
256 snd_printk(KERN_ERR "%s(): unable to retrieve sample rate range (clock %d)\n",
257 __func__, clock);
258 ret = -EINVAL;
259 goto err_free;
260 }

--- 184 unchanged lines hidden ---