podhd.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Line 6 Pod HD
  4. *
  5. * Copyright (C) 2011 Stefan Hajnoczi <stefanha@gmail.com>
  6. * Copyright (C) 2015 Andrej Krutak <dev@andree.sk>
  7. * Copyright (C) 2017 Hans P. Moller <hmoller@uc.cl>
  8. */
  9. #include <linux/usb.h>
  10. #include <linux/slab.h>
  11. #include <linux/module.h>
  12. #include <sound/core.h>
  13. #include <sound/control.h>
  14. #include <sound/pcm.h>
  15. #include "driver.h"
  16. #include "pcm.h"
  17. #define PODHD_STARTUP_DELAY 500
  18. enum {
  19. LINE6_PODHD300,
  20. LINE6_PODHD400,
  21. LINE6_PODHD500,
  22. LINE6_PODX3,
  23. LINE6_PODX3LIVE,
  24. LINE6_PODHD500X,
  25. LINE6_PODHDDESKTOP,
  26. LINE6_PODHDPROX,
  27. };
  28. struct usb_line6_podhd {
  29. /* Generic Line 6 USB data */
  30. struct usb_line6 line6;
  31. /* Serial number of device */
  32. u32 serial_number;
  33. /* Firmware version */
  34. int firmware_version;
  35. /* Monitor level */
  36. int monitor_level;
  37. };
  38. #define line6_to_podhd(x) container_of(x, struct usb_line6_podhd, line6)
  39. static const struct snd_ratden podhd_ratden = {
  40. .num_min = 48000,
  41. .num_max = 48000,
  42. .num_step = 1,
  43. .den = 1,
  44. };
  45. static struct line6_pcm_properties podhd_pcm_properties = {
  46. .playback_hw = {
  47. .info = (SNDRV_PCM_INFO_MMAP |
  48. SNDRV_PCM_INFO_INTERLEAVED |
  49. SNDRV_PCM_INFO_BLOCK_TRANSFER |
  50. SNDRV_PCM_INFO_MMAP_VALID |
  51. SNDRV_PCM_INFO_PAUSE |
  52. SNDRV_PCM_INFO_SYNC_START),
  53. .formats = SNDRV_PCM_FMTBIT_S24_3LE,
  54. .rates = SNDRV_PCM_RATE_48000,
  55. .rate_min = 48000,
  56. .rate_max = 48000,
  57. .channels_min = 2,
  58. .channels_max = 2,
  59. .buffer_bytes_max = 60000,
  60. .period_bytes_min = 64,
  61. .period_bytes_max = 8192,
  62. .periods_min = 1,
  63. .periods_max = 1024},
  64. .capture_hw = {
  65. .info = (SNDRV_PCM_INFO_MMAP |
  66. SNDRV_PCM_INFO_INTERLEAVED |
  67. SNDRV_PCM_INFO_BLOCK_TRANSFER |
  68. SNDRV_PCM_INFO_MMAP_VALID |
  69. SNDRV_PCM_INFO_SYNC_START),
  70. .formats = SNDRV_PCM_FMTBIT_S24_3LE,
  71. .rates = SNDRV_PCM_RATE_48000,
  72. .rate_min = 48000,
  73. .rate_max = 48000,
  74. .channels_min = 2,
  75. .channels_max = 2,
  76. .buffer_bytes_max = 60000,
  77. .period_bytes_min = 64,
  78. .period_bytes_max = 8192,
  79. .periods_min = 1,
  80. .periods_max = 1024},
  81. .rates = {
  82. .nrats = 1,
  83. .rats = &podhd_ratden},
  84. .bytes_per_channel = 3 /* SNDRV_PCM_FMTBIT_S24_3LE */
  85. };
  86. static struct line6_pcm_properties podx3_pcm_properties = {
  87. .playback_hw = {
  88. .info = (SNDRV_PCM_INFO_MMAP |
  89. SNDRV_PCM_INFO_INTERLEAVED |
  90. SNDRV_PCM_INFO_BLOCK_TRANSFER |
  91. SNDRV_PCM_INFO_MMAP_VALID |
  92. SNDRV_PCM_INFO_PAUSE |
  93. SNDRV_PCM_INFO_SYNC_START),
  94. .formats = SNDRV_PCM_FMTBIT_S24_3LE,
  95. .rates = SNDRV_PCM_RATE_48000,
  96. .rate_min = 48000,
  97. .rate_max = 48000,
  98. .channels_min = 2,
  99. .channels_max = 2,
  100. .buffer_bytes_max = 60000,
  101. .period_bytes_min = 64,
  102. .period_bytes_max = 8192,
  103. .periods_min = 1,
  104. .periods_max = 1024},
  105. .capture_hw = {
  106. .info = (SNDRV_PCM_INFO_MMAP |
  107. SNDRV_PCM_INFO_INTERLEAVED |
  108. SNDRV_PCM_INFO_BLOCK_TRANSFER |
  109. SNDRV_PCM_INFO_MMAP_VALID |
  110. SNDRV_PCM_INFO_SYNC_START),
  111. .formats = SNDRV_PCM_FMTBIT_S24_3LE,
  112. .rates = SNDRV_PCM_RATE_48000,
  113. .rate_min = 48000,
  114. .rate_max = 48000,
  115. /* 1+2: Main signal (out), 3+4: Tone 1,
  116. * 5+6: Tone 2, 7+8: raw
  117. */
  118. .channels_min = 8,
  119. .channels_max = 8,
  120. .buffer_bytes_max = 60000,
  121. .period_bytes_min = 64,
  122. .period_bytes_max = 8192,
  123. .periods_min = 1,
  124. .periods_max = 1024},
  125. .rates = {
  126. .nrats = 1,
  127. .rats = &podhd_ratden},
  128. .bytes_per_channel = 3 /* SNDRV_PCM_FMTBIT_S24_3LE */
  129. };
  130. static struct usb_driver podhd_driver;
  131. static ssize_t serial_number_show(struct device *dev,
  132. struct device_attribute *attr, char *buf)
  133. {
  134. struct snd_card *card = dev_to_snd_card(dev);
  135. struct usb_line6_podhd *pod = card->private_data;
  136. return sysfs_emit(buf, "%u\n", pod->serial_number);
  137. }
  138. static ssize_t firmware_version_show(struct device *dev,
  139. struct device_attribute *attr, char *buf)
  140. {
  141. struct snd_card *card = dev_to_snd_card(dev);
  142. struct usb_line6_podhd *pod = card->private_data;
  143. return sysfs_emit(buf, "%06x\n", pod->firmware_version);
  144. }
  145. static DEVICE_ATTR_RO(firmware_version);
  146. static DEVICE_ATTR_RO(serial_number);
  147. static struct attribute *podhd_dev_attrs[] = {
  148. &dev_attr_firmware_version.attr,
  149. &dev_attr_serial_number.attr,
  150. NULL
  151. };
  152. static const struct attribute_group podhd_dev_attr_group = {
  153. .name = "podhd",
  154. .attrs = podhd_dev_attrs,
  155. };
  156. /*
  157. * POD X3 startup procedure.
  158. *
  159. * May be compatible with other POD HD's, since it's also similar to the
  160. * previous POD setup. In any case, it doesn't seem to be required for the
  161. * audio nor bulk interfaces to work.
  162. */
  163. static int podhd_dev_start(struct usb_line6_podhd *pod)
  164. {
  165. int ret;
  166. u8 init_bytes[8];
  167. int i;
  168. struct usb_device *usbdev = pod->line6.usbdev;
  169. ret = usb_control_msg_send(usbdev, 0,
  170. 0x67, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
  171. 0x11, 0,
  172. NULL, 0, LINE6_TIMEOUT, GFP_KERNEL);
  173. if (ret) {
  174. dev_err(pod->line6.ifcdev, "read request failed (error %d)\n", ret);
  175. goto exit;
  176. }
  177. /* NOTE: looks like some kind of ping message */
  178. ret = usb_control_msg_recv(usbdev, 0, 0x67,
  179. USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
  180. 0x11, 0x0,
  181. init_bytes, 3, LINE6_TIMEOUT, GFP_KERNEL);
  182. if (ret) {
  183. dev_err(pod->line6.ifcdev,
  184. "receive length failed (error %d)\n", ret);
  185. goto exit;
  186. }
  187. pod->firmware_version =
  188. (init_bytes[0] << 16) | (init_bytes[1] << 8) | (init_bytes[2] << 0);
  189. for (i = 0; i <= 16; i++) {
  190. ret = line6_read_data(&pod->line6, 0xf000 + 0x08 * i, init_bytes, 8);
  191. if (ret < 0)
  192. goto exit;
  193. }
  194. ret = usb_control_msg_send(usbdev, 0,
  195. USB_REQ_SET_FEATURE,
  196. USB_TYPE_STANDARD | USB_RECIP_DEVICE | USB_DIR_OUT,
  197. 1, 0,
  198. NULL, 0, LINE6_TIMEOUT, GFP_KERNEL);
  199. exit:
  200. return ret;
  201. }
  202. static void podhd_startup(struct usb_line6 *line6)
  203. {
  204. struct usb_line6_podhd *pod = line6_to_podhd(line6);
  205. podhd_dev_start(pod);
  206. line6_read_serial_number(&pod->line6, &pod->serial_number);
  207. if (snd_card_register(line6->card))
  208. dev_err(line6->ifcdev, "Failed to register POD HD card.\n");
  209. }
  210. static void podhd_disconnect(struct usb_line6 *line6)
  211. {
  212. struct usb_line6_podhd *pod = line6_to_podhd(line6);
  213. if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL_INFO) {
  214. struct usb_interface *intf;
  215. intf = usb_ifnum_to_if(line6->usbdev,
  216. pod->line6.properties->ctrl_if);
  217. if (intf)
  218. usb_driver_release_interface(&podhd_driver, intf);
  219. }
  220. }
  221. static const unsigned int float_zero_to_one_lookup[] = {
  222. 0x00000000, 0x3c23d70a, 0x3ca3d70a, 0x3cf5c28f, 0x3d23d70a, 0x3d4ccccd,
  223. 0x3d75c28f, 0x3d8f5c29, 0x3da3d70a, 0x3db851ec, 0x3dcccccd, 0x3de147ae,
  224. 0x3df5c28f, 0x3e051eb8, 0x3e0f5c29, 0x3e19999a, 0x3e23d70a, 0x3e2e147b,
  225. 0x3e3851ec, 0x3e428f5c, 0x3e4ccccd, 0x3e570a3d, 0x3e6147ae, 0x3e6b851f,
  226. 0x3e75c28f, 0x3e800000, 0x3e851eb8, 0x3e8a3d71, 0x3e8f5c29, 0x3e947ae1,
  227. 0x3e99999a, 0x3e9eb852, 0x3ea3d70a, 0x3ea8f5c3, 0x3eae147b, 0x3eb33333,
  228. 0x3eb851ec, 0x3ebd70a4, 0x3ec28f5c, 0x3ec7ae14, 0x3ecccccd, 0x3ed1eb85,
  229. 0x3ed70a3d, 0x3edc28f6, 0x3ee147ae, 0x3ee66666, 0x3eeb851f, 0x3ef0a3d7,
  230. 0x3ef5c28f, 0x3efae148, 0x3f000000, 0x3f028f5c, 0x3f051eb8, 0x3f07ae14,
  231. 0x3f0a3d71, 0x3f0ccccd, 0x3f0f5c29, 0x3f11eb85, 0x3f147ae1, 0x3f170a3d,
  232. 0x3f19999a, 0x3f1c28f6, 0x3f1eb852, 0x3f2147ae, 0x3f23d70a, 0x3f266666,
  233. 0x3f28f5c3, 0x3f2b851f, 0x3f2e147b, 0x3f30a3d7, 0x3f333333, 0x3f35c28f,
  234. 0x3f3851ec, 0x3f3ae148, 0x3f3d70a4, 0x3f400000, 0x3f428f5c, 0x3f451eb8,
  235. 0x3f47ae14, 0x3f4a3d71, 0x3f4ccccd, 0x3f4f5c29, 0x3f51eb85, 0x3f547ae1,
  236. 0x3f570a3d, 0x3f59999a, 0x3f5c28f6, 0x3f5eb852, 0x3f6147ae, 0x3f63d70a,
  237. 0x3f666666, 0x3f68f5c3, 0x3f6b851f, 0x3f6e147b, 0x3f70a3d7, 0x3f733333,
  238. 0x3f75c28f, 0x3f7851ec, 0x3f7ae148, 0x3f7d70a4, 0x3f800000
  239. };
  240. static void podhd_set_monitor_level(struct usb_line6_podhd *podhd, int value)
  241. {
  242. unsigned int fl;
  243. static const unsigned char msg[16] = {
  244. /* Chunk is 0xc bytes (without first word) */
  245. 0x0c, 0x00,
  246. /* First chunk in the message */
  247. 0x01, 0x00,
  248. /* Message size is 2 4-byte words */
  249. 0x02, 0x00,
  250. /* Unknown */
  251. 0x04, 0x41,
  252. /* Unknown */
  253. 0x04, 0x00, 0x13, 0x00,
  254. /* Volume, LE float32, 0.0 - 1.0 */
  255. 0x00, 0x00, 0x00, 0x00
  256. };
  257. unsigned char *buf;
  258. buf = kmemdup(msg, sizeof(msg), GFP_KERNEL);
  259. if (!buf)
  260. return;
  261. if (value < 0)
  262. value = 0;
  263. if (value >= ARRAY_SIZE(float_zero_to_one_lookup))
  264. value = ARRAY_SIZE(float_zero_to_one_lookup) - 1;
  265. fl = float_zero_to_one_lookup[value];
  266. buf[12] = (fl >> 0) & 0xff;
  267. buf[13] = (fl >> 8) & 0xff;
  268. buf[14] = (fl >> 16) & 0xff;
  269. buf[15] = (fl >> 24) & 0xff;
  270. line6_send_raw_message(&podhd->line6, buf, sizeof(msg));
  271. kfree(buf);
  272. podhd->monitor_level = value;
  273. }
  274. /* control info callback */
  275. static int snd_podhd_control_monitor_info(struct snd_kcontrol *kcontrol,
  276. struct snd_ctl_elem_info *uinfo)
  277. {
  278. uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
  279. uinfo->count = 1;
  280. uinfo->value.integer.min = 0;
  281. uinfo->value.integer.max = 100;
  282. uinfo->value.integer.step = 1;
  283. return 0;
  284. }
  285. /* control get callback */
  286. static int snd_podhd_control_monitor_get(struct snd_kcontrol *kcontrol,
  287. struct snd_ctl_elem_value *ucontrol)
  288. {
  289. struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
  290. struct usb_line6_podhd *podhd = line6_to_podhd(line6pcm->line6);
  291. ucontrol->value.integer.value[0] = podhd->monitor_level;
  292. return 0;
  293. }
  294. /* control put callback */
  295. static int snd_podhd_control_monitor_put(struct snd_kcontrol *kcontrol,
  296. struct snd_ctl_elem_value *ucontrol)
  297. {
  298. struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
  299. struct usb_line6_podhd *podhd = line6_to_podhd(line6pcm->line6);
  300. if (ucontrol->value.integer.value[0] == podhd->monitor_level)
  301. return 0;
  302. podhd_set_monitor_level(podhd, ucontrol->value.integer.value[0]);
  303. return 1;
  304. }
  305. /* control definition */
  306. static const struct snd_kcontrol_new podhd_control_monitor = {
  307. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  308. .name = "Monitor Playback Volume",
  309. .index = 0,
  310. .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
  311. .info = snd_podhd_control_monitor_info,
  312. .get = snd_podhd_control_monitor_get,
  313. .put = snd_podhd_control_monitor_put
  314. };
  315. /*
  316. Try to init POD HD device.
  317. */
  318. static int podhd_init(struct usb_line6 *line6,
  319. const struct usb_device_id *id)
  320. {
  321. int err;
  322. struct usb_line6_podhd *pod = line6_to_podhd(line6);
  323. struct usb_interface *intf;
  324. line6->disconnect = podhd_disconnect;
  325. line6->startup = podhd_startup;
  326. if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
  327. /* claim the data interface */
  328. intf = usb_ifnum_to_if(line6->usbdev,
  329. pod->line6.properties->ctrl_if);
  330. if (!intf) {
  331. dev_err(pod->line6.ifcdev, "interface %d not found\n",
  332. pod->line6.properties->ctrl_if);
  333. return -ENODEV;
  334. }
  335. err = usb_driver_claim_interface(&podhd_driver, intf, NULL);
  336. if (err != 0) {
  337. dev_err(pod->line6.ifcdev, "can't claim interface %d, error %d\n",
  338. pod->line6.properties->ctrl_if, err);
  339. return err;
  340. }
  341. }
  342. if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL_INFO) {
  343. /* create sysfs entries: */
  344. err = snd_card_add_dev_attr(line6->card, &podhd_dev_attr_group);
  345. if (err < 0)
  346. return err;
  347. }
  348. if (pod->line6.properties->capabilities & LINE6_CAP_PCM) {
  349. /* initialize PCM subsystem: */
  350. err = line6_init_pcm(line6,
  351. (id->driver_info == LINE6_PODX3 ||
  352. id->driver_info == LINE6_PODX3LIVE) ? &podx3_pcm_properties :
  353. &podhd_pcm_properties);
  354. if (err < 0)
  355. return err;
  356. }
  357. if (pod->line6.properties->capabilities & LINE6_CAP_HWMON_CTL) {
  358. podhd_set_monitor_level(pod, 100);
  359. err = snd_ctl_add(line6->card,
  360. snd_ctl_new1(&podhd_control_monitor,
  361. line6->line6pcm));
  362. if (err < 0)
  363. return err;
  364. }
  365. if (!(pod->line6.properties->capabilities & LINE6_CAP_CONTROL_INFO)) {
  366. /* register USB audio system directly */
  367. return snd_card_register(line6->card);
  368. }
  369. /* init device and delay registering */
  370. schedule_delayed_work(&line6->startup_work,
  371. msecs_to_jiffies(PODHD_STARTUP_DELAY));
  372. return 0;
  373. }
  374. #define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
  375. #define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
  376. /* table of devices that work with this driver */
  377. static const struct usb_device_id podhd_id_table[] = {
  378. /* TODO: no need to alloc data interfaces when only audio is used */
  379. { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
  380. { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
  381. { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500 },
  382. { LINE6_IF_NUM(0x414A, 0), .driver_info = LINE6_PODX3 },
  383. { LINE6_IF_NUM(0x414B, 0), .driver_info = LINE6_PODX3LIVE },
  384. { LINE6_IF_NUM(0x4159, 0), .driver_info = LINE6_PODHD500X },
  385. { LINE6_IF_NUM(0x4156, 0), .driver_info = LINE6_PODHDDESKTOP },
  386. { LINE6_IF_NUM(0x415A, 0), .driver_info = LINE6_PODHDPROX },
  387. {}
  388. };
  389. MODULE_DEVICE_TABLE(usb, podhd_id_table);
  390. static const struct line6_properties podhd_properties_table[] = {
  391. [LINE6_PODHD300] = {
  392. .id = "PODHD300",
  393. .name = "POD HD300",
  394. .capabilities = LINE6_CAP_PCM
  395. | LINE6_CAP_HWMON,
  396. .altsetting = 5,
  397. .ep_ctrl_r = 0x84,
  398. .ep_ctrl_w = 0x03,
  399. .ep_audio_r = 0x82,
  400. .ep_audio_w = 0x01,
  401. },
  402. [LINE6_PODHD400] = {
  403. .id = "PODHD400",
  404. .name = "POD HD400",
  405. .capabilities = LINE6_CAP_PCM
  406. | LINE6_CAP_HWMON,
  407. .altsetting = 5,
  408. .ep_ctrl_r = 0x84,
  409. .ep_ctrl_w = 0x03,
  410. .ep_audio_r = 0x82,
  411. .ep_audio_w = 0x01,
  412. },
  413. [LINE6_PODHD500] = {
  414. .id = "PODHD500",
  415. .name = "POD HD500",
  416. .capabilities = LINE6_CAP_PCM | LINE6_CAP_CONTROL
  417. | LINE6_CAP_HWMON | LINE6_CAP_HWMON_CTL,
  418. .altsetting = 1,
  419. .ctrl_if = 1,
  420. .ep_ctrl_r = 0x81,
  421. .ep_ctrl_w = 0x01,
  422. .ep_audio_r = 0x86,
  423. .ep_audio_w = 0x02,
  424. },
  425. [LINE6_PODX3] = {
  426. .id = "PODX3",
  427. .name = "POD X3",
  428. .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_CONTROL_INFO
  429. | LINE6_CAP_PCM | LINE6_CAP_HWMON | LINE6_CAP_IN_NEEDS_OUT,
  430. .altsetting = 1,
  431. .ep_ctrl_r = 0x81,
  432. .ep_ctrl_w = 0x01,
  433. .ctrl_if = 1,
  434. .ep_audio_r = 0x86,
  435. .ep_audio_w = 0x02,
  436. },
  437. [LINE6_PODX3LIVE] = {
  438. .id = "PODX3LIVE",
  439. .name = "POD X3 LIVE",
  440. .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_CONTROL_INFO
  441. | LINE6_CAP_PCM | LINE6_CAP_HWMON | LINE6_CAP_IN_NEEDS_OUT,
  442. .altsetting = 1,
  443. .ep_ctrl_r = 0x81,
  444. .ep_ctrl_w = 0x01,
  445. .ctrl_if = 1,
  446. .ep_audio_r = 0x86,
  447. .ep_audio_w = 0x02,
  448. },
  449. [LINE6_PODHD500X] = {
  450. .id = "PODHD500X",
  451. .name = "POD HD500X",
  452. .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_HWMON_CTL
  453. | LINE6_CAP_PCM | LINE6_CAP_HWMON,
  454. .altsetting = 1,
  455. .ep_ctrl_r = 0x81,
  456. .ep_ctrl_w = 0x01,
  457. .ctrl_if = 1,
  458. .ep_audio_r = 0x86,
  459. .ep_audio_w = 0x02,
  460. },
  461. [LINE6_PODHDDESKTOP] = {
  462. .id = "PODHDDESKTOP",
  463. .name = "POD HDDESKTOP",
  464. .capabilities = LINE6_CAP_CONTROL
  465. | LINE6_CAP_PCM | LINE6_CAP_HWMON,
  466. .altsetting = 1,
  467. .ep_ctrl_r = 0x81,
  468. .ep_ctrl_w = 0x01,
  469. .ctrl_if = 1,
  470. .ep_audio_r = 0x86,
  471. .ep_audio_w = 0x02,
  472. },
  473. [LINE6_PODHDPROX] = {
  474. .id = "PODHDPROX",
  475. .name = "POD HD Pro X",
  476. .capabilities = LINE6_CAP_CONTROL | LINE6_CAP_CONTROL_INFO
  477. | LINE6_CAP_PCM | LINE6_CAP_HWMON | LINE6_CAP_IN_NEEDS_OUT,
  478. .altsetting = 1,
  479. .ctrl_if = 1,
  480. .ep_ctrl_r = 0x81,
  481. .ep_ctrl_w = 0x01,
  482. .ep_audio_r = 0x86,
  483. .ep_audio_w = 0x02,
  484. },
  485. };
  486. /*
  487. Probe USB device.
  488. */
  489. static int podhd_probe(struct usb_interface *interface,
  490. const struct usb_device_id *id)
  491. {
  492. return line6_probe(interface, id, "Line6-PODHD",
  493. &podhd_properties_table[id->driver_info],
  494. podhd_init, sizeof(struct usb_line6_podhd));
  495. }
  496. static struct usb_driver podhd_driver = {
  497. .name = KBUILD_MODNAME,
  498. .probe = podhd_probe,
  499. .disconnect = line6_disconnect,
  500. #ifdef CONFIG_PM
  501. .suspend = line6_suspend,
  502. .resume = line6_resume,
  503. .reset_resume = line6_resume,
  504. #endif
  505. .id_table = podhd_id_table,
  506. };
  507. module_usb_driver(podhd_driver);
  508. MODULE_DESCRIPTION("Line 6 PODHD USB driver");
  509. MODULE_LICENSE("GPL");