qmi_wwan.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * version 2 as published by the Free Software Foundation.
  7. */
  8. #include <linux/module.h>
  9. #include <linux/netdevice.h>
  10. #include <linux/ethtool.h>
  11. #include <linux/mii.h>
  12. #include <linux/usb.h>
  13. #include <linux/usb/cdc.h>
  14. #include <linux/usb/usbnet.h>
  15. #include <linux/usb/cdc-wdm.h>
  16. /* The name of the CDC Device Management driver */
  17. #define DM_DRIVER "cdc_wdm"
  18. /*
  19. * This driver supports wwan (3G/LTE/?) devices using a vendor
  20. * specific management protocol called Qualcomm MSM Interface (QMI) -
  21. * in addition to the more common AT commands over serial interface
  22. * management
  23. *
  24. * QMI is wrapped in CDC, using CDC encapsulated commands on the
  25. * control ("master") interface of a two-interface CDC Union
  26. * resembling standard CDC ECM. The devices do not use the control
  27. * interface for any other CDC messages. Most likely because the
  28. * management protocol is used in place of the standard CDC
  29. * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
  30. *
  31. * Handling a protocol like QMI is out of the scope for any driver.
  32. * It can be exported as a character device using the cdc-wdm driver,
  33. * which will enable userspace applications ("modem managers") to
  34. * handle it. This may be required to use the network interface
  35. * provided by the driver.
  36. *
  37. * These devices may alternatively/additionally be configured using AT
  38. * commands on any of the serial interfaces driven by the option driver
  39. *
  40. * This driver binds only to the data ("slave") interface to enable
  41. * the cdc-wdm driver to bind to the control interface. It still
  42. * parses the CDC functional descriptors on the control interface to
  43. * a) verify that this is indeed a handled interface (CDC Union
  44. * header lists it as slave)
  45. * b) get MAC address and other ethernet config from the CDC Ethernet
  46. * header
  47. * c) enable user bind requests against the control interface, which
  48. * is the common way to bind to CDC Ethernet Control Model type
  49. * interfaces
  50. * d) provide a hint to the user about which interface is the
  51. * corresponding management interface
  52. */
  53. static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
  54. {
  55. int status = -1;
  56. struct usb_interface *control = NULL;
  57. u8 *buf = intf->cur_altsetting->extra;
  58. int len = intf->cur_altsetting->extralen;
  59. struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
  60. struct usb_cdc_union_desc *cdc_union = NULL;
  61. struct usb_cdc_ether_desc *cdc_ether = NULL;
  62. u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
  63. u32 found = 0;
  64. atomic_t *pmcount = (void *)&dev->data[1];
  65. atomic_set(pmcount, 0);
  66. /*
  67. * assume a data interface has no additional descriptors and
  68. * that the control and data interface are numbered
  69. * consecutively - this holds for the Huawei device at least
  70. */
  71. if (len == 0 && desc->bInterfaceNumber > 0) {
  72. control = usb_ifnum_to_if(dev->udev, desc->bInterfaceNumber - 1);
  73. if (!control)
  74. goto err;
  75. buf = control->cur_altsetting->extra;
  76. len = control->cur_altsetting->extralen;
  77. dev_dbg(&intf->dev, "guessing \"control\" => %s, \"data\" => this\n",
  78. dev_name(&control->dev));
  79. }
  80. while (len > 3) {
  81. struct usb_descriptor_header *h = (void *)buf;
  82. /* ignore any misplaced descriptors */
  83. if (h->bDescriptorType != USB_DT_CS_INTERFACE)
  84. goto next_desc;
  85. /* buf[2] is CDC descriptor subtype */
  86. switch (buf[2]) {
  87. case USB_CDC_HEADER_TYPE:
  88. if (found & 1 << USB_CDC_HEADER_TYPE) {
  89. dev_dbg(&intf->dev, "extra CDC header\n");
  90. goto err;
  91. }
  92. if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
  93. dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
  94. goto err;
  95. }
  96. break;
  97. case USB_CDC_UNION_TYPE:
  98. if (found & 1 << USB_CDC_UNION_TYPE) {
  99. dev_dbg(&intf->dev, "extra CDC union\n");
  100. goto err;
  101. }
  102. if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
  103. dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
  104. goto err;
  105. }
  106. cdc_union = (struct usb_cdc_union_desc *)buf;
  107. break;
  108. case USB_CDC_ETHERNET_TYPE:
  109. if (found & 1 << USB_CDC_ETHERNET_TYPE) {
  110. dev_dbg(&intf->dev, "extra CDC ether\n");
  111. goto err;
  112. }
  113. if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
  114. dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength);
  115. goto err;
  116. }
  117. cdc_ether = (struct usb_cdc_ether_desc *)buf;
  118. break;
  119. }
  120. /*
  121. * Remember which CDC functional descriptors we've seen. Works
  122. * for all types we care about, of which USB_CDC_ETHERNET_TYPE
  123. * (0x0f) is the highest numbered
  124. */
  125. if (buf[2] < 32)
  126. found |= 1 << buf[2];
  127. next_desc:
  128. len -= h->bLength;
  129. buf += h->bLength;
  130. }
  131. /* did we find all the required ones? */
  132. if ((found & required) != required) {
  133. dev_err(&intf->dev, "CDC functional descriptors missing\n");
  134. goto err;
  135. }
  136. /* give the user a helpful hint if trying to bind to the wrong interface */
  137. if (cdc_union && desc->bInterfaceNumber == cdc_union->bMasterInterface0) {
  138. dev_err(&intf->dev, "leaving \"control\" interface for " DM_DRIVER " - try binding to %s instead!\n",
  139. dev_name(&usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0)->dev));
  140. goto err;
  141. }
  142. /* errors aren't fatal - we can live with the dynamic address */
  143. if (cdc_ether) {
  144. dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
  145. usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
  146. }
  147. /* success! point the user to the management interface */
  148. if (control)
  149. dev_info(&intf->dev, "Use \"" DM_DRIVER "\" for QMI interface %s\n",
  150. dev_name(&control->dev));
  151. /* XXX: add a sysfs symlink somewhere to help management applications find it? */
  152. /* collect bulk endpoints now that we know intf == "data" interface */
  153. status = usbnet_get_endpoints(dev, intf);
  154. err:
  155. return status;
  156. }
  157. /* using a counter to merge subdriver requests with our own into a combined state */
  158. static int qmi_wwan_manage_power(struct usbnet *dev, int on)
  159. {
  160. atomic_t *pmcount = (void *)&dev->data[1];
  161. int rv = 0;
  162. dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(pmcount), on);
  163. if ((on && atomic_add_return(1, pmcount) == 1) || (!on && atomic_dec_and_test(pmcount))) {
  164. /* need autopm_get/put here to ensure the usbcore sees the new value */
  165. rv = usb_autopm_get_interface(dev->intf);
  166. if (rv < 0)
  167. goto err;
  168. dev->intf->needs_remote_wakeup = on;
  169. usb_autopm_put_interface(dev->intf);
  170. }
  171. err:
  172. return rv;
  173. }
  174. static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
  175. {
  176. struct usbnet *dev = usb_get_intfdata(intf);
  177. /* can be called while disconnecting */
  178. if (!dev)
  179. return 0;
  180. return qmi_wwan_manage_power(dev, on);
  181. }
  182. /* Some devices combine the "control" and "data" functions into a
  183. * single interface with all three endpoints: interrupt + bulk in and
  184. * out
  185. *
  186. * Setting up cdc-wdm as a subdriver owning the interrupt endpoint
  187. * will let it provide userspace access to the encapsulated QMI
  188. * protocol without interfering with the usbnet operations.
  189. */
  190. static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
  191. {
  192. int rv;
  193. struct usb_driver *subdriver = NULL;
  194. atomic_t *pmcount = (void *)&dev->data[1];
  195. /* ZTE makes devices where the interface descriptors and endpoint
  196. * configurations of two or more interfaces are identical, even
  197. * though the functions are completely different. If set, then
  198. * driver_info->data is a bitmap of acceptable interface numbers
  199. * allowing us to bind to one such interface without binding to
  200. * all of them
  201. */
  202. if (dev->driver_info->data &&
  203. !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) {
  204. dev_info(&intf->dev, "not on our whitelist - ignored");
  205. rv = -ENODEV;
  206. goto err;
  207. }
  208. atomic_set(pmcount, 0);
  209. /* collect all three endpoints */
  210. rv = usbnet_get_endpoints(dev, intf);
  211. if (rv < 0)
  212. goto err;
  213. /* require interrupt endpoint for subdriver */
  214. if (!dev->status) {
  215. rv = -EINVAL;
  216. goto err;
  217. }
  218. subdriver = usb_cdc_wdm_register(intf, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
  219. if (IS_ERR(subdriver)) {
  220. rv = PTR_ERR(subdriver);
  221. goto err;
  222. }
  223. /* can't let usbnet use the interrupt endpoint */
  224. dev->status = NULL;
  225. /* save subdriver struct for suspend/resume wrappers */
  226. dev->data[0] = (unsigned long)subdriver;
  227. err:
  228. return rv;
  229. }
  230. static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf)
  231. {
  232. struct usb_driver *subdriver = (void *)dev->data[0];
  233. if (subdriver && subdriver->disconnect)
  234. subdriver->disconnect(intf);
  235. dev->data[0] = (unsigned long)NULL;
  236. }
  237. /* suspend/resume wrappers calling both usbnet and the cdc-wdm
  238. * subdriver if present.
  239. *
  240. * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
  241. * wrappers for those without adding usbnet reset support first.
  242. */
  243. static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
  244. {
  245. struct usbnet *dev = usb_get_intfdata(intf);
  246. struct usb_driver *subdriver = (void *)dev->data[0];
  247. int ret;
  248. ret = usbnet_suspend(intf, message);
  249. if (ret < 0)
  250. goto err;
  251. if (subdriver && subdriver->suspend)
  252. ret = subdriver->suspend(intf, message);
  253. if (ret < 0)
  254. usbnet_resume(intf);
  255. err:
  256. return ret;
  257. }
  258. static int qmi_wwan_resume(struct usb_interface *intf)
  259. {
  260. struct usbnet *dev = usb_get_intfdata(intf);
  261. struct usb_driver *subdriver = (void *)dev->data[0];
  262. int ret = 0;
  263. if (subdriver && subdriver->resume)
  264. ret = subdriver->resume(intf);
  265. if (ret < 0)
  266. goto err;
  267. ret = usbnet_resume(intf);
  268. if (ret < 0 && subdriver && subdriver->resume && subdriver->suspend)
  269. subdriver->suspend(intf, PMSG_SUSPEND);
  270. err:
  271. return ret;
  272. }
  273. static const struct driver_info qmi_wwan_info = {
  274. .description = "QMI speaking wwan device",
  275. .flags = FLAG_WWAN,
  276. .bind = qmi_wwan_bind,
  277. .manage_power = qmi_wwan_manage_power,
  278. };
  279. static const struct driver_info qmi_wwan_shared = {
  280. .description = "QMI speaking wwan device with combined interface",
  281. .flags = FLAG_WWAN,
  282. .bind = qmi_wwan_bind_shared,
  283. .unbind = qmi_wwan_unbind_shared,
  284. .manage_power = qmi_wwan_manage_power,
  285. };
  286. static const struct driver_info qmi_wwan_force_int0 = {
  287. .description = "Qualcomm WWAN/QMI device",
  288. .flags = FLAG_WWAN,
  289. .bind = qmi_wwan_bind_shared,
  290. .unbind = qmi_wwan_unbind_shared,
  291. .manage_power = qmi_wwan_manage_power,
  292. .data = BIT(0), /* interface whitelist bitmap */
  293. };
  294. static const struct driver_info qmi_wwan_force_int1 = {
  295. .description = "Qualcomm WWAN/QMI device",
  296. .flags = FLAG_WWAN,
  297. .bind = qmi_wwan_bind_shared,
  298. .unbind = qmi_wwan_unbind_shared,
  299. .manage_power = qmi_wwan_manage_power,
  300. .data = BIT(1), /* interface whitelist bitmap */
  301. };
  302. static const struct driver_info qmi_wwan_force_int2 = {
  303. .description = "Qualcomm WWAN/QMI device",
  304. .flags = FLAG_WWAN,
  305. .bind = qmi_wwan_bind_shared,
  306. .unbind = qmi_wwan_unbind_shared,
  307. .manage_power = qmi_wwan_manage_power,
  308. .data = BIT(2), /* interface whitelist bitmap */
  309. };
  310. static const struct driver_info qmi_wwan_force_int3 = {
  311. .description = "Qualcomm WWAN/QMI device",
  312. .flags = FLAG_WWAN,
  313. .bind = qmi_wwan_bind_shared,
  314. .unbind = qmi_wwan_unbind_shared,
  315. .manage_power = qmi_wwan_manage_power,
  316. .data = BIT(3), /* interface whitelist bitmap */
  317. };
  318. static const struct driver_info qmi_wwan_force_int4 = {
  319. .description = "Qualcomm WWAN/QMI device",
  320. .flags = FLAG_WWAN,
  321. .bind = qmi_wwan_bind_shared,
  322. .unbind = qmi_wwan_unbind_shared,
  323. .manage_power = qmi_wwan_manage_power,
  324. .data = BIT(4), /* interface whitelist bitmap */
  325. };
  326. /* Sierra Wireless provide equally useless interface descriptors
  327. * Devices in QMI mode can be switched between two different
  328. * configurations:
  329. * a) USB interface #8 is QMI/wwan
  330. * b) USB interfaces #8, #19 and #20 are QMI/wwan
  331. *
  332. * Both configurations provide a number of other interfaces (serial++),
  333. * some of which have the same endpoint configuration as we expect, so
  334. * a whitelist or blacklist is necessary.
  335. *
  336. * FIXME: The below whitelist should include BIT(20). It does not
  337. * because I cannot get it to work...
  338. */
  339. static const struct driver_info qmi_wwan_sierra = {
  340. .description = "Sierra Wireless wwan/QMI device",
  341. .flags = FLAG_WWAN,
  342. .bind = qmi_wwan_bind_shared,
  343. .unbind = qmi_wwan_unbind_shared,
  344. .manage_power = qmi_wwan_manage_power,
  345. .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
  346. };
  347. #define HUAWEI_VENDOR_ID 0x12D1
  348. /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
  349. #define QMI_GOBI1K_DEVICE(vend, prod) \
  350. USB_DEVICE(vend, prod), \
  351. .driver_info = (unsigned long)&qmi_wwan_force_int3
  352. /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */
  353. #define QMI_GOBI_DEVICE(vend, prod) \
  354. USB_DEVICE(vend, prod), \
  355. .driver_info = (unsigned long)&qmi_wwan_force_int0
  356. static const struct usb_device_id products[] = {
  357. { /* Huawei E392, E398 and possibly others sharing both device id and more... */
  358. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  359. .idVendor = HUAWEI_VENDOR_ID,
  360. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  361. .bInterfaceSubClass = 1,
  362. .bInterfaceProtocol = 8, /* NOTE: This is the *slave* interface of the CDC Union! */
  363. .driver_info = (unsigned long)&qmi_wwan_info,
  364. },
  365. { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
  366. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  367. .idVendor = HUAWEI_VENDOR_ID,
  368. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  369. .bInterfaceSubClass = 1,
  370. .bInterfaceProtocol = 56, /* NOTE: This is the *slave* interface of the CDC Union! */
  371. .driver_info = (unsigned long)&qmi_wwan_info,
  372. },
  373. { /* Huawei E392, E398 and possibly others in "Windows mode"
  374. * using a combined control and data interface without any CDC
  375. * functional descriptors
  376. */
  377. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  378. .idVendor = HUAWEI_VENDOR_ID,
  379. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  380. .bInterfaceSubClass = 1,
  381. .bInterfaceProtocol = 17,
  382. .driver_info = (unsigned long)&qmi_wwan_shared,
  383. },
  384. { /* Pantech UML290 */
  385. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  386. .idVendor = 0x106c,
  387. .idProduct = 0x3718,
  388. .bInterfaceClass = 0xff,
  389. .bInterfaceSubClass = 0xf0,
  390. .bInterfaceProtocol = 0xff,
  391. .driver_info = (unsigned long)&qmi_wwan_shared,
  392. },
  393. { /* ZTE MF820D */
  394. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  395. .idVendor = 0x19d2,
  396. .idProduct = 0x0167,
  397. .bInterfaceClass = 0xff,
  398. .bInterfaceSubClass = 0xff,
  399. .bInterfaceProtocol = 0xff,
  400. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  401. },
  402. { /* ZTE (Vodafone) K3520-Z */
  403. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  404. .idVendor = 0x19d2,
  405. .idProduct = 0x0055,
  406. .bInterfaceClass = 0xff,
  407. .bInterfaceSubClass = 0xff,
  408. .bInterfaceProtocol = 0xff,
  409. .driver_info = (unsigned long)&qmi_wwan_force_int1,
  410. },
  411. { /* ZTE (Vodafone) K3565-Z */
  412. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  413. .idVendor = 0x19d2,
  414. .idProduct = 0x0063,
  415. .bInterfaceClass = 0xff,
  416. .bInterfaceSubClass = 0xff,
  417. .bInterfaceProtocol = 0xff,
  418. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  419. },
  420. { /* ZTE (Vodafone) K3570-Z */
  421. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  422. .idVendor = 0x19d2,
  423. .idProduct = 0x1008,
  424. .bInterfaceClass = 0xff,
  425. .bInterfaceSubClass = 0xff,
  426. .bInterfaceProtocol = 0xff,
  427. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  428. },
  429. { /* ZTE (Vodafone) K3571-Z */
  430. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  431. .idVendor = 0x19d2,
  432. .idProduct = 0x1010,
  433. .bInterfaceClass = 0xff,
  434. .bInterfaceSubClass = 0xff,
  435. .bInterfaceProtocol = 0xff,
  436. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  437. },
  438. { /* ZTE (Vodafone) K3765-Z */
  439. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  440. .idVendor = 0x19d2,
  441. .idProduct = 0x2002,
  442. .bInterfaceClass = 0xff,
  443. .bInterfaceSubClass = 0xff,
  444. .bInterfaceProtocol = 0xff,
  445. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  446. },
  447. { /* ZTE (Vodafone) K4505-Z */
  448. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  449. .idVendor = 0x19d2,
  450. .idProduct = 0x0104,
  451. .bInterfaceClass = 0xff,
  452. .bInterfaceSubClass = 0xff,
  453. .bInterfaceProtocol = 0xff,
  454. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  455. },
  456. { /* ZTE MF60 */
  457. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  458. .idVendor = 0x19d2,
  459. .idProduct = 0x1402,
  460. .bInterfaceClass = 0xff,
  461. .bInterfaceSubClass = 0xff,
  462. .bInterfaceProtocol = 0xff,
  463. .driver_info = (unsigned long)&qmi_wwan_force_int2,
  464. },
  465. { /* Sierra Wireless MC77xx in QMI mode */
  466. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  467. .idVendor = 0x1199,
  468. .idProduct = 0x68a2,
  469. .bInterfaceClass = 0xff,
  470. .bInterfaceSubClass = 0xff,
  471. .bInterfaceProtocol = 0xff,
  472. .driver_info = (unsigned long)&qmi_wwan_sierra,
  473. },
  474. /* Gobi 1000 devices */
  475. {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
  476. {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
  477. {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
  478. {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
  479. {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
  480. {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
  481. {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
  482. {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
  483. {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
  484. {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
  485. {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
  486. {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
  487. {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
  488. {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
  489. /* Gobi 2000 and 3000 devices */
  490. {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
  491. {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
  492. {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
  493. {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
  494. {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
  495. {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
  496. {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
  497. {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
  498. {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
  499. {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  500. {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  501. {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  502. {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  503. {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  504. {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  505. {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  506. {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  507. {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  508. {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  509. {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
  510. {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
  511. {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
  512. {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
  513. {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
  514. {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
  515. { } /* END */
  516. };
  517. MODULE_DEVICE_TABLE(usb, products);
  518. static struct usb_driver qmi_wwan_driver = {
  519. .name = "qmi_wwan",
  520. .id_table = products,
  521. .probe = usbnet_probe,
  522. .disconnect = usbnet_disconnect,
  523. .suspend = qmi_wwan_suspend,
  524. .resume = qmi_wwan_resume,
  525. .reset_resume = qmi_wwan_resume,
  526. .supports_autosuspend = 1,
  527. .disable_hub_initiated_lpm = 1,
  528. };
  529. static int __init qmi_wwan_init(void)
  530. {
  531. return usb_register(&qmi_wwan_driver);
  532. }
  533. module_init(qmi_wwan_init);
  534. static void __exit qmi_wwan_exit(void)
  535. {
  536. usb_deregister(&qmi_wwan_driver);
  537. }
  538. module_exit(qmi_wwan_exit);
  539. MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
  540. MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
  541. MODULE_LICENSE("GPL");