quirks.c (c0f00d270eba3cba688dd62a7b1a742ad289b879) quirks.c (8dc5efe3d17cd572328ac4f1ebde629c83317f54)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>

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

1108
1109 dev_info(&dev->dev, "MOTU MicroBook II ready\n");
1110
1111free_buf:
1112 kfree(buf);
1113 return err;
1114}
1115
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 */
4
5#include <linux/init.h>
6#include <linux/slab.h>
7#include <linux/usb.h>
8#include <linux/usb/audio.h>

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

1108
1109 dev_info(&dev->dev, "MOTU MicroBook II ready\n");
1110
1111free_buf:
1112 kfree(buf);
1113 return err;
1114}
1115
1116static int snd_usb_motu_m_series_boot_quirk(struct usb_device *dev)
1117{
1118 int ret;
1119
1120 if (snd_usb_pipe_sanity_check(dev, usb_sndctrlpipe(dev, 0)))
1121 return -EINVAL;
1122 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1123 1, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1124 0x0, 0, NULL, 0, 1000);
1125
1126 if (ret < 0)
1127 return ret;
1128
1129 msleep(2000);
1130
1131 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1132 1, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1133 0x20, 0, NULL, 0, 1000);
1134
1135 if (ret < 0)
1136 return ret;
1137
1138 return 0;
1139}
1140
1116/*
1117 * Setup quirks
1118 */
1119#define MAUDIO_SET 0x01 /* parse device_setup */
1120#define MAUDIO_SET_COMPATIBLE 0x80 /* use only "win-compatible" interfaces */
1121#define MAUDIO_SET_DTS 0x02 /* enable DTS Digital Output */
1122#define MAUDIO_SET_96K 0x04 /* 48-96KHz rate if set, 8-48KHz otherwise */
1123#define MAUDIO_SET_24B 0x08 /* 24bits sample if set, 16bits otherwise */

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

1222 }
1223
1224 usb_audio_dbg(chip,
1225 "using altsetting %d for interface %d config %d\n",
1226 altno, iface, chip->setup);
1227 return 0; /* keep this altsetting */
1228}
1229
1141/*
1142 * Setup quirks
1143 */
1144#define MAUDIO_SET 0x01 /* parse device_setup */
1145#define MAUDIO_SET_COMPATIBLE 0x80 /* use only "win-compatible" interfaces */
1146#define MAUDIO_SET_DTS 0x02 /* enable DTS Digital Output */
1147#define MAUDIO_SET_96K 0x04 /* 48-96KHz rate if set, 8-48KHz otherwise */
1148#define MAUDIO_SET_24B 0x08 /* 24bits sample if set, 16bits otherwise */

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

1247 }
1248
1249 usb_audio_dbg(chip,
1250 "using altsetting %d for interface %d config %d\n",
1251 altno, iface, chip->setup);
1252 return 0; /* keep this altsetting */
1253}
1254
1255static int s1810c_skip_setting_quirk(struct snd_usb_audio *chip,
1256 int iface, int altno)
1257{
1258 /*
1259 * Altno settings:
1260 *
1261 * Playback (Interface 1):
1262 * 1: 6 Analog + 2 S/PDIF
1263 * 2: 6 Analog + 2 S/PDIF
1264 * 3: 6 Analog
1265 *
1266 * Capture (Interface 2):
1267 * 1: 8 Analog + 2 S/PDIF + 8 ADAT
1268 * 2: 8 Analog + 2 S/PDIF + 4 ADAT
1269 * 3: 8 Analog
1270 */
1271
1272 /*
1273 * I'll leave 2 as the default one and
1274 * use device_setup to switch to the
1275 * other two.
1276 */
1277 if ((chip->setup == 0 || chip->setup > 2) && altno != 2)
1278 return 1;
1279 else if (chip->setup == 1 && altno != 1)
1280 return 1;
1281 else if (chip->setup == 2 && altno != 3)
1282 return 1;
1283
1284 return 0;
1285}
1286
1230int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
1231 int iface,
1232 int altno)
1233{
1234 /* audiophile usb: skip altsets incompatible with device_setup */
1235 if (chip->usb_id == USB_ID(0x0763, 0x2003))
1236 return audiophile_skip_setting_quirk(chip, iface, altno);
1237 /* quattro usb: skip altsets incompatible with device_setup */
1238 if (chip->usb_id == USB_ID(0x0763, 0x2001))
1239 return quattro_skip_setting_quirk(chip, iface, altno);
1240 /* fasttrackpro usb: skip altsets incompatible with device_setup */
1241 if (chip->usb_id == USB_ID(0x0763, 0x2012))
1242 return fasttrackpro_skip_setting_quirk(chip, iface, altno);
1287int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,
1288 int iface,
1289 int altno)
1290{
1291 /* audiophile usb: skip altsets incompatible with device_setup */
1292 if (chip->usb_id == USB_ID(0x0763, 0x2003))
1293 return audiophile_skip_setting_quirk(chip, iface, altno);
1294 /* quattro usb: skip altsets incompatible with device_setup */
1295 if (chip->usb_id == USB_ID(0x0763, 0x2001))
1296 return quattro_skip_setting_quirk(chip, iface, altno);
1297 /* fasttrackpro usb: skip altsets incompatible with device_setup */
1298 if (chip->usb_id == USB_ID(0x0763, 0x2012))
1299 return fasttrackpro_skip_setting_quirk(chip, iface, altno);
1300 /* presonus studio 1810c: skip altsets incompatible with device_setup */
1301 if (chip->usb_id == USB_ID(0x0194f, 0x010c))
1302 return s1810c_skip_setting_quirk(chip, iface, altno);
1243
1303
1304
1244 return 0;
1245}
1246
1247int snd_usb_apply_boot_quirk(struct usb_device *dev,
1248 struct usb_interface *intf,
1249 const struct snd_usb_audio_quirk *quirk,
1250 unsigned int id)
1251{

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

1292 return snd_usb_axefx3_boot_quirk(dev);
1293 case USB_ID(0x07fd, 0x0004): /* MOTU MicroBook II */
1294 return snd_usb_motu_microbookii_boot_quirk(dev);
1295 }
1296
1297 return 0;
1298}
1299
1305 return 0;
1306}
1307
1308int snd_usb_apply_boot_quirk(struct usb_device *dev,
1309 struct usb_interface *intf,
1310 const struct snd_usb_audio_quirk *quirk,
1311 unsigned int id)
1312{

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

1353 return snd_usb_axefx3_boot_quirk(dev);
1354 case USB_ID(0x07fd, 0x0004): /* MOTU MicroBook II */
1355 return snd_usb_motu_microbookii_boot_quirk(dev);
1356 }
1357
1358 return 0;
1359}
1360
1361int snd_usb_apply_boot_quirk_once(struct usb_device *dev,
1362 struct usb_interface *intf,
1363 const struct snd_usb_audio_quirk *quirk,
1364 unsigned int id)
1365{
1366 switch (id) {
1367 case USB_ID(0x07fd, 0x0008): /* MOTU M Series */
1368 return snd_usb_motu_m_series_boot_quirk(dev);
1369 }
1370
1371 return 0;
1372}
1373
1300/*
1301 * check if the device uses big-endian samples
1302 */
1303int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp)
1304{
1305 /* it depends on altsetting whether the device is big-endian or not */
1306 switch (chip->usb_id) {
1307 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */

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

1388 break;
1389 }
1390}
1391
1392bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1393{
1394 /* devices which do not support reading the sample rate. */
1395 switch (chip->usb_id) {
1374/*
1375 * check if the device uses big-endian samples
1376 */
1377int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp)
1378{
1379 /* it depends on altsetting whether the device is big-endian or not */
1380 switch (chip->usb_id) {
1381 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */

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

1462 break;
1463 }
1464}
1465
1466bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1467{
1468 /* devices which do not support reading the sample rate. */
1469 switch (chip->usb_id) {
1396 case USB_ID(0x041E, 0x4080): /* Creative Live Cam VF0610 */
1397 case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */
1470 case USB_ID(0x041e, 0x4080): /* Creative Live Cam VF0610 */
1471 case USB_ID(0x04d8, 0xfeea): /* Benchmark DAC1 Pre */
1398 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
1472 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
1399 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */
1473 case USB_ID(0x05a3, 0x9420): /* ELP HD USB Camera */
1400 case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */
1474 case USB_ID(0x05a7, 0x1020): /* Bose Companion 5 */
1401 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
1475 case USB_ID(0x074d, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
1402 case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
1403 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
1476 case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
1477 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
1404 case USB_ID(0x21B4, 0x0081): /* AudioQuest DragonFly */
1478 case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */
1405 return true;
1406 }
1407
1408 /* devices of these vendors don't support reading rate, either */
1409 switch (USB_ID_VENDOR(chip->usb_id)) {
1479 return true;
1480 }
1481
1482 /* devices of these vendors don't support reading rate, either */
1483 switch (USB_ID_VENDOR(chip->usb_id)) {
1410 case 0x045E: /* MS Lifecam */
1411 case 0x047F: /* Plantronics */
1484 case 0x045e: /* MS Lifecam */
1485 case 0x047f: /* Plantronics */
1412 case 0x1de7: /* Phoenix Audio */
1413 return true;
1414 }
1415
1416 return false;
1417}
1418
1419/* ITF-USB DSD based DACs need a vendor cmd to switch

--- 300 unchanged lines hidden ---
1486 case 0x1de7: /* Phoenix Audio */
1487 return true;
1488 }
1489
1490 return false;
1491}
1492
1493/* ITF-USB DSD based DACs need a vendor cmd to switch

--- 300 unchanged lines hidden ---