qmi_wwan.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  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. return qmi_wwan_manage_power(dev, on);
  72. }
  73. /* collect all three endpoints and register subdriver */
  74. static int qmi_wwan_register_subdriver(struct usbnet *dev)
  75. {
  76. int rv;
  77. struct usb_driver *subdriver = NULL;
  78. struct qmi_wwan_state *info = (void *)&dev->data;
  79. /* collect bulk endpoints */
  80. rv = usbnet_get_endpoints(dev, info->data);
  81. if (rv < 0)
  82. goto err;
  83. /* update status endpoint if separate control interface */
  84. if (info->control != info->data)
  85. dev->status = &info->control->cur_altsetting->endpoint[0];
  86. /* require interrupt endpoint for subdriver */
  87. if (!dev->status) {
  88. rv = -EINVAL;
  89. goto err;
  90. }
  91. /* for subdriver power management */
  92. atomic_set(&info->pmcount, 0);
  93. /* register subdriver */
  94. subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
  95. if (IS_ERR(subdriver)) {
  96. dev_err(&info->control->dev, "subdriver registration failed\n");
  97. rv = PTR_ERR(subdriver);
  98. goto err;
  99. }
  100. /* prevent usbnet from using status endpoint */
  101. dev->status = NULL;
  102. /* save subdriver struct for suspend/resume wrappers */
  103. info->subdriver = subdriver;
  104. err:
  105. return rv;
  106. }
  107. static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
  108. {
  109. int status = -1;
  110. u8 *buf = intf->cur_altsetting->extra;
  111. int len = intf->cur_altsetting->extralen;
  112. struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
  113. struct usb_cdc_union_desc *cdc_union = NULL;
  114. struct usb_cdc_ether_desc *cdc_ether = NULL;
  115. u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
  116. u32 found = 0;
  117. struct usb_driver *driver = driver_of(intf);
  118. struct qmi_wwan_state *info = (void *)&dev->data;
  119. BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
  120. /* require a single interrupt status endpoint for subdriver */
  121. if (intf->cur_altsetting->desc.bNumEndpoints != 1)
  122. goto err;
  123. while (len > 3) {
  124. struct usb_descriptor_header *h = (void *)buf;
  125. /* ignore any misplaced descriptors */
  126. if (h->bDescriptorType != USB_DT_CS_INTERFACE)
  127. goto next_desc;
  128. /* buf[2] is CDC descriptor subtype */
  129. switch (buf[2]) {
  130. case USB_CDC_HEADER_TYPE:
  131. if (found & 1 << USB_CDC_HEADER_TYPE) {
  132. dev_dbg(&intf->dev, "extra CDC header\n");
  133. goto err;
  134. }
  135. if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
  136. dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
  137. goto err;
  138. }
  139. break;
  140. case USB_CDC_UNION_TYPE:
  141. if (found & 1 << USB_CDC_UNION_TYPE) {
  142. dev_dbg(&intf->dev, "extra CDC union\n");
  143. goto err;
  144. }
  145. if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
  146. dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
  147. goto err;
  148. }
  149. cdc_union = (struct usb_cdc_union_desc *)buf;
  150. break;
  151. case USB_CDC_ETHERNET_TYPE:
  152. if (found & 1 << USB_CDC_ETHERNET_TYPE) {
  153. dev_dbg(&intf->dev, "extra CDC ether\n");
  154. goto err;
  155. }
  156. if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
  157. dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength);
  158. goto err;
  159. }
  160. cdc_ether = (struct usb_cdc_ether_desc *)buf;
  161. break;
  162. }
  163. /*
  164. * Remember which CDC functional descriptors we've seen. Works
  165. * for all types we care about, of which USB_CDC_ETHERNET_TYPE
  166. * (0x0f) is the highest numbered
  167. */
  168. if (buf[2] < 32)
  169. found |= 1 << buf[2];
  170. next_desc:
  171. len -= h->bLength;
  172. buf += h->bLength;
  173. }
  174. /* did we find all the required ones? */
  175. if ((found & required) != required) {
  176. dev_err(&intf->dev, "CDC functional descriptors missing\n");
  177. goto err;
  178. }
  179. /* verify CDC Union */
  180. if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) {
  181. dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0);
  182. goto err;
  183. }
  184. /* need to save these for unbind */
  185. info->control = intf;
  186. info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
  187. if (!info->data) {
  188. dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0);
  189. goto err;
  190. }
  191. /* errors aren't fatal - we can live with the dynamic address */
  192. if (cdc_ether) {
  193. dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
  194. usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
  195. }
  196. /* claim data interface and set it up */
  197. status = usb_driver_claim_interface(driver, info->data, dev);
  198. if (status < 0)
  199. goto err;
  200. status = qmi_wwan_register_subdriver(dev);
  201. if (status < 0) {
  202. usb_set_intfdata(info->data, NULL);
  203. usb_driver_release_interface(driver, info->data);
  204. }
  205. err:
  206. return status;
  207. }
  208. /* Some devices combine the "control" and "data" functions into a
  209. * single interface with all three endpoints: interrupt + bulk in and
  210. * out
  211. */
  212. static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
  213. {
  214. int rv;
  215. struct qmi_wwan_state *info = (void *)&dev->data;
  216. /* ZTE makes devices where the interface descriptors and endpoint
  217. * configurations of two or more interfaces are identical, even
  218. * though the functions are completely different. If set, then
  219. * driver_info->data is a bitmap of acceptable interface numbers
  220. * allowing us to bind to one such interface without binding to
  221. * all of them
  222. */
  223. if (dev->driver_info->data &&
  224. !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) {
  225. dev_info(&intf->dev, "not on our whitelist - ignored");
  226. rv = -ENODEV;
  227. goto err;
  228. }
  229. /* control and data is shared */
  230. info->control = intf;
  231. info->data = intf;
  232. rv = qmi_wwan_register_subdriver(dev);
  233. err:
  234. return rv;
  235. }
  236. /* Gobi devices uses identical class/protocol codes for all interfaces regardless
  237. * of function. Some of these are CDC ACM like and have the exact same endpoints
  238. * we are looking for. This leaves two possible strategies for identifying the
  239. * correct interface:
  240. * a) hardcoding interface number, or
  241. * b) use the fact that the wwan interface is the only one lacking additional
  242. * (CDC functional) descriptors
  243. *
  244. * Let's see if we can get away with the generic b) solution.
  245. */
  246. static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
  247. {
  248. int rv = -EINVAL;
  249. /* ignore any interface with additional descriptors */
  250. if (intf->cur_altsetting->extralen)
  251. goto err;
  252. rv = qmi_wwan_bind_shared(dev, intf);
  253. err:
  254. return rv;
  255. }
  256. static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
  257. {
  258. struct qmi_wwan_state *info = (void *)&dev->data;
  259. struct usb_driver *driver = driver_of(intf);
  260. struct usb_interface *other;
  261. if (info->subdriver && info->subdriver->disconnect)
  262. info->subdriver->disconnect(info->control);
  263. /* allow user to unbind using either control or data */
  264. if (intf == info->control)
  265. other = info->data;
  266. else
  267. other = info->control;
  268. /* only if not shared */
  269. if (other && intf != other) {
  270. usb_set_intfdata(other, NULL);
  271. usb_driver_release_interface(driver, other);
  272. }
  273. info->subdriver = NULL;
  274. info->data = NULL;
  275. info->control = NULL;
  276. }
  277. /* suspend/resume wrappers calling both usbnet and the cdc-wdm
  278. * subdriver if present.
  279. *
  280. * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
  281. * wrappers for those without adding usbnet reset support first.
  282. */
  283. static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
  284. {
  285. struct usbnet *dev = usb_get_intfdata(intf);
  286. struct qmi_wwan_state *info = (void *)&dev->data;
  287. int ret;
  288. ret = usbnet_suspend(intf, message);
  289. if (ret < 0)
  290. goto err;
  291. if (info->subdriver && info->subdriver->suspend)
  292. ret = info->subdriver->suspend(intf, message);
  293. if (ret < 0)
  294. usbnet_resume(intf);
  295. err:
  296. return ret;
  297. }
  298. static int qmi_wwan_resume(struct usb_interface *intf)
  299. {
  300. struct usbnet *dev = usb_get_intfdata(intf);
  301. struct qmi_wwan_state *info = (void *)&dev->data;
  302. int ret = 0;
  303. if (info->subdriver && info->subdriver->resume)
  304. ret = info->subdriver->resume(intf);
  305. if (ret < 0)
  306. goto err;
  307. ret = usbnet_resume(intf);
  308. if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend)
  309. info->subdriver->suspend(intf, PMSG_SUSPEND);
  310. err:
  311. return ret;
  312. }
  313. static const struct driver_info qmi_wwan_info = {
  314. .description = "QMI speaking wwan device",
  315. .flags = FLAG_WWAN,
  316. .bind = qmi_wwan_bind,
  317. .unbind = qmi_wwan_unbind,
  318. .manage_power = qmi_wwan_manage_power,
  319. };
  320. static const struct driver_info qmi_wwan_shared = {
  321. .description = "QMI speaking wwan device with combined interface",
  322. .flags = FLAG_WWAN,
  323. .bind = qmi_wwan_bind_shared,
  324. .unbind = qmi_wwan_unbind,
  325. .manage_power = qmi_wwan_manage_power,
  326. };
  327. static const struct driver_info qmi_wwan_gobi = {
  328. .description = "Qualcomm Gobi wwan/QMI device",
  329. .flags = FLAG_WWAN,
  330. .bind = qmi_wwan_bind_gobi,
  331. .unbind = qmi_wwan_unbind,
  332. .manage_power = qmi_wwan_manage_power,
  333. };
  334. /* ZTE suck at making USB descriptors */
  335. static const struct driver_info qmi_wwan_force_int1 = {
  336. .description = "Qualcomm WWAN/QMI device",
  337. .flags = FLAG_WWAN,
  338. .bind = qmi_wwan_bind_shared,
  339. .unbind = qmi_wwan_unbind,
  340. .manage_power = qmi_wwan_manage_power,
  341. .data = BIT(1), /* interface whitelist bitmap */
  342. };
  343. static const struct driver_info qmi_wwan_force_int4 = {
  344. .description = "Qualcomm WWAN/QMI device",
  345. .flags = FLAG_WWAN,
  346. .bind = qmi_wwan_bind_shared,
  347. .unbind = qmi_wwan_unbind,
  348. .manage_power = qmi_wwan_manage_power,
  349. .data = BIT(4), /* interface whitelist bitmap */
  350. };
  351. /* Sierra Wireless provide equally useless interface descriptors
  352. * Devices in QMI mode can be switched between two different
  353. * configurations:
  354. * a) USB interface #8 is QMI/wwan
  355. * b) USB interfaces #8, #19 and #20 are QMI/wwan
  356. *
  357. * Both configurations provide a number of other interfaces (serial++),
  358. * some of which have the same endpoint configuration as we expect, so
  359. * a whitelist or blacklist is necessary.
  360. *
  361. * FIXME: The below whitelist should include BIT(20). It does not
  362. * because I cannot get it to work...
  363. */
  364. static const struct driver_info qmi_wwan_sierra = {
  365. .description = "Sierra Wireless wwan/QMI device",
  366. .flags = FLAG_WWAN,
  367. .bind = qmi_wwan_bind_gobi,
  368. .unbind = qmi_wwan_unbind,
  369. .manage_power = qmi_wwan_manage_power,
  370. .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
  371. };
  372. #define HUAWEI_VENDOR_ID 0x12D1
  373. #define QMI_GOBI_DEVICE(vend, prod) \
  374. USB_DEVICE(vend, prod), \
  375. .driver_info = (unsigned long)&qmi_wwan_gobi
  376. static const struct usb_device_id products[] = {
  377. { /* Huawei E392, E398 and possibly others sharing both device id and more... */
  378. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  379. .idVendor = HUAWEI_VENDOR_ID,
  380. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  381. .bInterfaceSubClass = 1,
  382. .bInterfaceProtocol = 9, /* CDC Ethernet *control* interface */
  383. .driver_info = (unsigned long)&qmi_wwan_info,
  384. },
  385. { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
  386. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  387. .idVendor = HUAWEI_VENDOR_ID,
  388. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  389. .bInterfaceSubClass = 1,
  390. .bInterfaceProtocol = 57, /* CDC Ethernet *control* interface */
  391. .driver_info = (unsigned long)&qmi_wwan_info,
  392. },
  393. { /* Huawei E392, E398 and possibly others in "Windows mode"
  394. * using a combined control and data interface without any CDC
  395. * functional descriptors
  396. */
  397. .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
  398. .idVendor = HUAWEI_VENDOR_ID,
  399. .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
  400. .bInterfaceSubClass = 1,
  401. .bInterfaceProtocol = 17,
  402. .driver_info = (unsigned long)&qmi_wwan_shared,
  403. },
  404. { /* Pantech UML290 */
  405. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  406. .idVendor = 0x106c,
  407. .idProduct = 0x3718,
  408. .bInterfaceClass = 0xff,
  409. .bInterfaceSubClass = 0xf0,
  410. .bInterfaceProtocol = 0xff,
  411. .driver_info = (unsigned long)&qmi_wwan_shared,
  412. },
  413. { /* ZTE MF820D */
  414. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  415. .idVendor = 0x19d2,
  416. .idProduct = 0x0167,
  417. .bInterfaceClass = 0xff,
  418. .bInterfaceSubClass = 0xff,
  419. .bInterfaceProtocol = 0xff,
  420. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  421. },
  422. { /* ZTE (Vodafone) K3520-Z */
  423. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  424. .idVendor = 0x19d2,
  425. .idProduct = 0x0055,
  426. .bInterfaceClass = 0xff,
  427. .bInterfaceSubClass = 0xff,
  428. .bInterfaceProtocol = 0xff,
  429. .driver_info = (unsigned long)&qmi_wwan_force_int1,
  430. },
  431. { /* ZTE (Vodafone) K3565-Z */
  432. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  433. .idVendor = 0x19d2,
  434. .idProduct = 0x0063,
  435. .bInterfaceClass = 0xff,
  436. .bInterfaceSubClass = 0xff,
  437. .bInterfaceProtocol = 0xff,
  438. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  439. },
  440. { /* ZTE (Vodafone) K3570-Z */
  441. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  442. .idVendor = 0x19d2,
  443. .idProduct = 0x1008,
  444. .bInterfaceClass = 0xff,
  445. .bInterfaceSubClass = 0xff,
  446. .bInterfaceProtocol = 0xff,
  447. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  448. },
  449. { /* ZTE (Vodafone) K3571-Z */
  450. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  451. .idVendor = 0x19d2,
  452. .idProduct = 0x1010,
  453. .bInterfaceClass = 0xff,
  454. .bInterfaceSubClass = 0xff,
  455. .bInterfaceProtocol = 0xff,
  456. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  457. },
  458. { /* ZTE (Vodafone) K3765-Z */
  459. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  460. .idVendor = 0x19d2,
  461. .idProduct = 0x2002,
  462. .bInterfaceClass = 0xff,
  463. .bInterfaceSubClass = 0xff,
  464. .bInterfaceProtocol = 0xff,
  465. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  466. },
  467. { /* ZTE (Vodafone) K4505-Z */
  468. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  469. .idVendor = 0x19d2,
  470. .idProduct = 0x0104,
  471. .bInterfaceClass = 0xff,
  472. .bInterfaceSubClass = 0xff,
  473. .bInterfaceProtocol = 0xff,
  474. .driver_info = (unsigned long)&qmi_wwan_force_int4,
  475. },
  476. { /* Sierra Wireless MC77xx in QMI mode */
  477. .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
  478. .idVendor = 0x1199,
  479. .idProduct = 0x68a2,
  480. .bInterfaceClass = 0xff,
  481. .bInterfaceSubClass = 0xff,
  482. .bInterfaceProtocol = 0xff,
  483. .driver_info = (unsigned long)&qmi_wwan_sierra,
  484. },
  485. {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
  486. {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
  487. {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
  488. {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
  489. {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
  490. {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
  491. {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
  492. {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
  493. {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
  494. {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
  495. {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
  496. {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
  497. {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
  498. {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
  499. {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
  500. {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
  501. {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
  502. {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
  503. {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
  504. {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
  505. {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
  506. {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
  507. {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
  508. {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  509. {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  510. {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  511. {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  512. {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  513. {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  514. {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  515. {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  516. {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  517. {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
  518. {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
  519. {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
  520. {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
  521. {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
  522. {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
  523. {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
  524. { } /* END */
  525. };
  526. MODULE_DEVICE_TABLE(usb, products);
  527. static struct usb_driver qmi_wwan_driver = {
  528. .name = "qmi_wwan",
  529. .id_table = products,
  530. .probe = usbnet_probe,
  531. .disconnect = usbnet_disconnect,
  532. .suspend = qmi_wwan_suspend,
  533. .resume = qmi_wwan_resume,
  534. .reset_resume = qmi_wwan_resume,
  535. .supports_autosuspend = 1,
  536. .disable_hub_initiated_lpm = 1,
  537. };
  538. static int __init qmi_wwan_init(void)
  539. {
  540. return usb_register(&qmi_wwan_driver);
  541. }
  542. module_init(qmi_wwan_init);
  543. static void __exit qmi_wwan_exit(void)
  544. {
  545. usb_deregister(&qmi_wwan_driver);
  546. }
  547. module_exit(qmi_wwan_exit);
  548. MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
  549. MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
  550. MODULE_LICENSE("GPL");