qmi_wwan.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /*
  2. * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
  3. *
  4. * The probing code is heavily inspired by cdc_ether, which is:
  5. * Copyright (C) 2003-2005 by David Brownell
  6. * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync)
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/netdevice.h>
  14. #include <linux/ethtool.h>
  15. #include <linux/mii.h>
  16. #include <linux/usb.h>
  17. #include <linux/usb/cdc.h>
  18. #include <linux/usb/usbnet.h>
  19. #include <linux/usb/cdc-wdm.h>
  20. /* This driver supports wwan (3G/LTE/?) devices using a vendor
  21. * specific management protocol called Qualcomm MSM Interface (QMI) -
  22. * in addition to the more common AT commands over serial interface
  23. * management
  24. *
  25. * QMI is wrapped in CDC, using CDC encapsulated commands on the
  26. * control ("master") interface of a two-interface CDC Union
  27. * resembling standard CDC ECM. The devices do not use the control
  28. * interface for any other CDC messages. Most likely because the
  29. * management protocol is used in place of the standard CDC
  30. * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
  31. *
  32. * Alternatively, control and data functions can be combined in a
  33. * single USB interface.
  34. *
  35. * Handling a protocol like QMI is out of the scope for any driver.
  36. * It is exported as a character device using the cdc-wdm driver as
  37. * a subdriver, enabling userspace applications ("modem managers") to
  38. * handle it.
  39. *
  40. * These devices may alternatively/additionally be configured using AT
  41. * commands on a serial interface
  42. */
  43. /* driver specific data */
  44. struct qmi_wwan_state {
  45. struct usb_driver *subdriver;
  46. atomic_t pmcount;
  47. unsigned long unused;
  48. struct usb_interface *control;
  49. struct usb_interface *data;
  50. };
  51. /* using a counter to merge subdriver requests with our own into a combined state */
  52. static int qmi_wwan_manage_power(struct usbnet *dev, int on)
  53. {
  54. struct qmi_wwan_state *info = (void *)&dev->data;
  55. int rv = 0;
  56. dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
  57. if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
  58. /* need autopm_get/put here to ensure the usbcore sees the new value */
  59. rv = usb_autopm_get_interface(dev->intf);
  60. if (rv < 0)
  61. goto err;
  62. dev->intf->needs_remote_wakeup = on;
  63. usb_autopm_put_interface(dev->intf);
  64. }
  65. err:
  66. return rv;
  67. }
  68. static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
  69. {
  70. struct usbnet *dev = usb_get_intfdata(intf);
  71. /* can be called while disconnecting */
  72. if (!dev)
  73. return 0;
  74. return qmi_wwan_manage_power(dev, on);
  75. }
  76. /* collect all three endpoints and register subdriver */
  77. static int qmi_wwan_register_subdriver(struct usbnet *dev)
  78. {
  79. int rv;
  80. struct usb_driver *subdriver = NULL;
  81. struct qmi_wwan_state *info = (void *)&dev->data;
  82. /* collect bulk endpoints */
  83. rv = usbnet_get_endpoints(dev, info->data);
  84. if (rv < 0)
  85. goto err;
  86. /* update status endpoint if separate control interface */
  87. if (info->control != info->data)
  88. dev->status = &info->control->cur_altsetting->endpoint[0];
  89. /* require interrupt endpoint for subdriver */
  90. if (!dev->status) {
  91. rv = -EINVAL;
  92. goto err;
  93. }
  94. /* for subdriver power management */
  95. atomic_set(&info->pmcount, 0);
  96. /* register subdriver */
  97. subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 4096, &qmi_wwan_cdc_wdm_manage_power);
  98. if (IS_ERR(subdriver)) {
  99. dev_err(&info->control->dev, "subdriver registration failed\n");
  100. rv = PTR_ERR(subdriver);
  101. goto err;
  102. }
  103. /* prevent usbnet from using status endpoint */
  104. dev->status = NULL;
  105. /* save subdriver struct for suspend/resume wrappers */
  106. info->subdriver = subdriver;
  107. err:
  108. return rv;
  109. }
  110. static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
  111. {
  112. int status = -1;
  113. u8 *buf = intf->cur_altsetting->extra;
  114. int len = intf->cur_altsetting->extralen;
  115. struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
  116. struct usb_cdc_union_desc *cdc_union = NULL;
  117. struct usb_cdc_ether_desc *cdc_ether = NULL;
  118. u32 found = 0;
  119. struct usb_driver *driver = driver_of(intf);
  120. struct qmi_wwan_state *info = (void *)&dev->data;
  121. BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
  122. /* set up initial state */
  123. info->control = intf;
  124. info->data = intf;
  125. /* and a number of CDC descriptors */
  126. while (len > 3) {
  127. struct usb_descriptor_header *h = (void *)buf;
  128. /* ignore any misplaced descriptors */
  129. if (h->bDescriptorType != USB_DT_CS_INTERFACE)
  130. goto next_desc;
  131. /* buf[2] is CDC descriptor subtype */
  132. switch (buf[2]) {
  133. case USB_CDC_HEADER_TYPE:
  134. if (found & 1 << USB_CDC_HEADER_TYPE) {
  135. dev_dbg(&intf->dev, "extra CDC header\n");
  136. goto err;
  137. }
  138. if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
  139. dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
  140. goto err;
  141. }
  142. break;
  143. case USB_CDC_UNION_TYPE:
  144. if (found & 1 << USB_CDC_UNION_TYPE) {
  145. dev_dbg(&intf->dev, "extra CDC union\n");
  146. goto err;
  147. }
  148. if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
  149. dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
  150. goto err;
  151. }
  152. cdc_union = (struct usb_cdc_union_desc *)buf;
  153. break;
  154. case USB_CDC_ETHERNET_TYPE:
  155. if (found & 1 << USB_CDC_ETHERNET_TYPE) {
  156. dev_dbg(&intf->dev, "extra CDC ether\n");
  157. goto err;
  158. }
  159. if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
  160. dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength);
  161. goto err;
  162. }
  163. cdc_ether = (struct usb_cdc_ether_desc *)buf;
  164. break;
  165. }
  166. /*
  167. * Remember which CDC functional descriptors we've seen. Works
  168. * for all types we care about, of which USB_CDC_ETHERNET_TYPE
  169. * (0x0f) is the highest numbered
  170. */
  171. if (buf[2] < 32)
  172. found |= 1 << buf[2];
  173. next_desc:
  174. len -= h->bLength;
  175. buf += h->bLength;
  176. }
  177. /* Use separate control and data interfaces if we found a CDC Union */
  178. if (cdc_union) {
  179. info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
  180. if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 || !info->data) {
  181. dev_err(&intf->dev, "bogus CDC Union: master=%u, slave=%u\n",
  182. cdc_union->bMasterInterface0, cdc_union->bSlaveInterface0);
  183. goto err;
  184. }
  185. }
  186. /* errors aren't fatal - we can live with the dynamic address */
  187. if (cdc_ether) {
  188. dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
  189. usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
  190. }
  191. /* claim data interface and set it up */
  192. if (info->control != info->data) {
  193. status = usb_driver_claim_interface(driver, info->data, dev);
  194. if (status < 0)
  195. goto err;
  196. }
  197. status = qmi_wwan_register_subdriver(dev);
  198. if (status < 0 && info->control != info->data) {
  199. usb_set_intfdata(info->data, NULL);
  200. usb_driver_release_interface(driver, info->data);
  201. }
  202. err:
  203. return status;
  204. }
  205. static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
  206. {
  207. struct qmi_wwan_state *info = (void *)&dev->data;
  208. struct usb_driver *driver = driver_of(intf);
  209. struct usb_interface *other;
  210. if (info->subdriver && info->subdriver->disconnect)
  211. info->subdriver->disconnect(info->control);
  212. /* allow user to unbind using either control or data */
  213. if (intf == info->control)
  214. other = info->data;
  215. else
  216. other = info->control;
  217. /* only if not shared */
  218. if (other && intf != other) {
  219. usb_set_intfdata(other, NULL);
  220. usb_driver_release_interface(driver, other);
  221. }
  222. info->subdriver = NULL;
  223. info->data = NULL;
  224. info->control = NULL;
  225. }
  226. /* suspend/resume wrappers calling both usbnet and the cdc-wdm
  227. * subdriver if present.
  228. *
  229. * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
  230. * wrappers for those without adding usbnet reset support first.
  231. */
  232. static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
  233. {
  234. struct usbnet *dev = usb_get_intfdata(intf);
  235. struct qmi_wwan_state *info = (void *)&dev->data;
  236. int ret;
  237. ret = usbnet_suspend(intf, message);
  238. if (ret < 0)
  239. goto err;
  240. if (intf == info->control && info->subdriver && info->subdriver->suspend)
  241. ret = info->subdriver->suspend(intf, message);
  242. if (ret < 0)
  243. usbnet_resume(intf);
  244. err:
  245. return ret;
  246. }
  247. static int qmi_wwan_resume(struct usb_interface *intf)
  248. {
  249. struct usbnet *dev = usb_get_intfdata(intf);
  250. struct qmi_wwan_state *info = (void *)&dev->data;
  251. int ret = 0;
  252. bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume);
  253. if (callsub)
  254. ret = info->subdriver->resume(intf);
  255. if (ret < 0)
  256. goto err;
  257. ret = usbnet_resume(intf);
  258. if (ret < 0 && callsub && info->subdriver->suspend)
  259. info->subdriver->suspend(intf, PMSG_SUSPEND);
  260. err:
  261. return ret;
  262. }
  263. static const struct driver_info qmi_wwan_info = {
  264. .description = "WWAN/QMI device",
  265. .flags = FLAG_WWAN,
  266. .bind = qmi_wwan_bind,
  267. .unbind = qmi_wwan_unbind,
  268. .manage_power = qmi_wwan_manage_power,
  269. };
  270. #define HUAWEI_VENDOR_ID 0x12D1
  271. /* map QMI/wwan function by a fixed interface number */
  272. #define QMI_FIXED_INTF(vend, prod, num) \
  273. USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
  274. .driver_info = (unsigned long)&qmi_wwan_info
  275. /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
  276. #define QMI_GOBI1K_DEVICE(vend, prod) \
  277. QMI_FIXED_INTF(vend, prod, 3)
  278. /* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */
  279. #define QMI_GOBI_DEVICE(vend, prod) \
  280. QMI_FIXED_INTF(vend, prod, 0)
  281. static const struct usb_device_id products[] = {
  282. /* 1. CDC ECM like devices match on the control interface */
  283. { /* Huawei E392, E398 and possibly others sharing both device id and more... */
  284. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9),
  285. .driver_info = (unsigned long)&qmi_wwan_info,
  286. },
  287. { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
  288. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57),
  289. .driver_info = (unsigned long)&qmi_wwan_info,
  290. },
  291. { /* HUAWEI_INTERFACE_NDIS_CONTROL_QUALCOMM */
  292. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x69),
  293. .driver_info = (unsigned long)&qmi_wwan_info,
  294. },
  295. /* 2. Combined interface devices matching on class+protocol */
  296. { /* Huawei E367 and possibly others in "Windows mode" */
  297. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7),
  298. .driver_info = (unsigned long)&qmi_wwan_info,
  299. },
  300. { /* Huawei E392, E398 and possibly others in "Windows mode" */
  301. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17),
  302. .driver_info = (unsigned long)&qmi_wwan_info,
  303. },
  304. { /* HUAWEI_NDIS_SINGLE_INTERFACE_VDF */
  305. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x37),
  306. .driver_info = (unsigned long)&qmi_wwan_info,
  307. },
  308. { /* HUAWEI_INTERFACE_NDIS_HW_QUALCOMM */
  309. USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x67),
  310. .driver_info = (unsigned long)&qmi_wwan_info,
  311. },
  312. { /* Pantech UML290, P4200 and more */
  313. USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff),
  314. .driver_info = (unsigned long)&qmi_wwan_info,
  315. },
  316. { /* Pantech UML290 - newer firmware */
  317. USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff),
  318. .driver_info = (unsigned long)&qmi_wwan_info,
  319. },
  320. { /* Novatel USB551L and MC551 */
  321. USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001,
  322. USB_CLASS_COMM,
  323. USB_CDC_SUBCLASS_ETHERNET,
  324. USB_CDC_PROTO_NONE),
  325. .driver_info = (unsigned long)&qmi_wwan_info,
  326. },
  327. { /* Novatel E362 */
  328. USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010,
  329. USB_CLASS_COMM,
  330. USB_CDC_SUBCLASS_ETHERNET,
  331. USB_CDC_PROTO_NONE),
  332. .driver_info = (unsigned long)&qmi_wwan_info,
  333. },
  334. { /* Dell Wireless 5800 (Novatel E362) */
  335. USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8195,
  336. USB_CLASS_COMM,
  337. USB_CDC_SUBCLASS_ETHERNET,
  338. USB_CDC_PROTO_NONE),
  339. .driver_info = (unsigned long)&qmi_wwan_info,
  340. },
  341. { /* Dell Wireless 5800 V2 (Novatel E362) */
  342. USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8196,
  343. USB_CLASS_COMM,
  344. USB_CDC_SUBCLASS_ETHERNET,
  345. USB_CDC_PROTO_NONE),
  346. .driver_info = (unsigned long)&qmi_wwan_info,
  347. },
  348. { /* ADU960S */
  349. USB_DEVICE_AND_INTERFACE_INFO(0x16d5, 0x650a,
  350. USB_CLASS_COMM,
  351. USB_CDC_SUBCLASS_ETHERNET,
  352. USB_CDC_PROTO_NONE),
  353. .driver_info = (unsigned long)&qmi_wwan_info,
  354. },
  355. /* 3. Combined interface devices matching on interface number */
  356. {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
  357. {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
  358. {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
  359. {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
  360. {QMI_FIXED_INTF(0x19d2, 0x0017, 3)},
  361. {QMI_FIXED_INTF(0x19d2, 0x0021, 4)},
  362. {QMI_FIXED_INTF(0x19d2, 0x0025, 1)},
  363. {QMI_FIXED_INTF(0x19d2, 0x0031, 4)},
  364. {QMI_FIXED_INTF(0x19d2, 0x0042, 4)},
  365. {QMI_FIXED_INTF(0x19d2, 0x0049, 5)},
  366. {QMI_FIXED_INTF(0x19d2, 0x0052, 4)},
  367. {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */
  368. {QMI_FIXED_INTF(0x19d2, 0x0058, 4)},
  369. {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */
  370. {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */
  371. {QMI_FIXED_INTF(0x19d2, 0x0113, 5)},
  372. {QMI_FIXED_INTF(0x19d2, 0x0118, 5)},
  373. {QMI_FIXED_INTF(0x19d2, 0x0121, 5)},
  374. {QMI_FIXED_INTF(0x19d2, 0x0123, 4)},
  375. {QMI_FIXED_INTF(0x19d2, 0x0124, 5)},
  376. {QMI_FIXED_INTF(0x19d2, 0x0125, 6)},
  377. {QMI_FIXED_INTF(0x19d2, 0x0126, 5)},
  378. {QMI_FIXED_INTF(0x19d2, 0x0130, 1)},
  379. {QMI_FIXED_INTF(0x19d2, 0x0133, 3)},
  380. {QMI_FIXED_INTF(0x19d2, 0x0141, 5)},
  381. {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */
  382. {QMI_FIXED_INTF(0x19d2, 0x0158, 3)},
  383. {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */
  384. {QMI_FIXED_INTF(0x19d2, 0x0168, 4)},
  385. {QMI_FIXED_INTF(0x19d2, 0x0176, 3)},
  386. {QMI_FIXED_INTF(0x19d2, 0x0178, 3)},
  387. {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */
  388. {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */
  389. {QMI_FIXED_INTF(0x19d2, 0x0200, 1)},
  390. {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */
  391. {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */
  392. {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */
  393. {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */
  394. {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */
  395. {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */
  396. {QMI_FIXED_INTF(0x19d2, 0x1012, 4)},
  397. {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */
  398. {QMI_FIXED_INTF(0x19d2, 0x1021, 2)},
  399. {QMI_FIXED_INTF(0x19d2, 0x1245, 4)},
  400. {QMI_FIXED_INTF(0x19d2, 0x1247, 4)},
  401. {QMI_FIXED_INTF(0x19d2, 0x1252, 4)},
  402. {QMI_FIXED_INTF(0x19d2, 0x1254, 4)},
  403. {QMI_FIXED_INTF(0x19d2, 0x1255, 3)},
  404. {QMI_FIXED_INTF(0x19d2, 0x1255, 4)},
  405. {QMI_FIXED_INTF(0x19d2, 0x1256, 4)},
  406. {QMI_FIXED_INTF(0x19d2, 0x1401, 2)},
  407. {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */
  408. {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
  409. {QMI_FIXED_INTF(0x19d2, 0x1425, 2)},
  410. {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */
  411. {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
  412. {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
  413. {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
  414. {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
  415. {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
  416. {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
  417. {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
  418. {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
  419. {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
  420. /* 4. Gobi 1000 devices */
  421. {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
  422. {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
  423. {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
  424. {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
  425. {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
  426. {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
  427. {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
  428. {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
  429. {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
  430. {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
  431. {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
  432. {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
  433. {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
  434. /* 5. Gobi 2000 and 3000 devices */
  435. {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
  436. {QMI_GOBI_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */
  437. {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
  438. {QMI_GOBI_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */
  439. {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
  440. {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
  441. {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
  442. {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
  443. {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
  444. {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
  445. {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
  446. {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
  447. {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */
  448. {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  449. {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  450. {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  451. {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  452. {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  453. {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  454. {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  455. {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  456. {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  457. {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  458. {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
  459. {QMI_FIXED_INTF(0x1199, 0x9011, 5)}, /* alternate interface number!? */
  460. {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
  461. {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
  462. {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
  463. {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
  464. {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
  465. {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
  466. {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
  467. {QMI_GOBI_DEVICE(0x12d1, 0x14f1)}, /* Sony Gobi 3000 Composite */
  468. {QMI_GOBI_DEVICE(0x1410, 0xa021)}, /* Foxconn Gobi 3000 Modem device (Novatel E396) */
  469. { } /* END */
  470. };
  471. MODULE_DEVICE_TABLE(usb, products);
  472. static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod)
  473. {
  474. struct usb_device_id *id = (struct usb_device_id *)prod;
  475. /* Workaround to enable dynamic IDs. This disables usbnet
  476. * blacklisting functionality. Which, if required, can be
  477. * reimplemented here by using a magic "blacklist" value
  478. * instead of 0 in the static device id table
  479. */
  480. if (!id->driver_info) {
  481. dev_dbg(&intf->dev, "setting defaults for dynamic device id\n");
  482. id->driver_info = (unsigned long)&qmi_wwan_info;
  483. }
  484. return usbnet_probe(intf, id);
  485. }
  486. static struct usb_driver qmi_wwan_driver = {
  487. .name = "qmi_wwan",
  488. .id_table = products,
  489. .probe = qmi_wwan_probe,
  490. .disconnect = usbnet_disconnect,
  491. .suspend = qmi_wwan_suspend,
  492. .resume = qmi_wwan_resume,
  493. .reset_resume = qmi_wwan_resume,
  494. .supports_autosuspend = 1,
  495. .disable_hub_initiated_lpm = 1,
  496. };
  497. module_usb_driver(qmi_wwan_driver);
  498. MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
  499. MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
  500. MODULE_LICENSE("GPL");