blob: f1e7791358997bd05e891891c68f3392f304d24e [file] [log] [blame]
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001/*
2 * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no>
3 *
Bjørn Mork230718b2012-06-19 00:42:01 +00004 * 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 *
Bjørn Mork423ce8c2012-01-19 15:37:22 +00008 * 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
13#include <linux/module.h>
14#include <linux/netdevice.h>
15#include <linux/ethtool.h>
16#include <linux/mii.h>
17#include <linux/usb.h>
18#include <linux/usb/cdc.h>
19#include <linux/usb/usbnet.h>
Bjørn Morkc3ecb082012-03-09 12:35:05 +010020#include <linux/usb/cdc-wdm.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000021
Bjørn Mork230718b2012-06-19 00:42:01 +000022/* This driver supports wwan (3G/LTE/?) devices using a vendor
Bjørn Mork423ce8c2012-01-19 15:37:22 +000023 * specific management protocol called Qualcomm MSM Interface (QMI) -
24 * in addition to the more common AT commands over serial interface
25 * management
26 *
27 * QMI is wrapped in CDC, using CDC encapsulated commands on the
28 * control ("master") interface of a two-interface CDC Union
29 * resembling standard CDC ECM. The devices do not use the control
30 * interface for any other CDC messages. Most likely because the
31 * management protocol is used in place of the standard CDC
32 * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
33 *
Bjørn Mork230718b2012-06-19 00:42:01 +000034 * Alternatively, control and data functions can be combined in a
35 * single USB interface.
36 *
Bjørn Mork423ce8c2012-01-19 15:37:22 +000037 * Handling a protocol like QMI is out of the scope for any driver.
Bjørn Mork230718b2012-06-19 00:42:01 +000038 * It is exported as a character device using the cdc-wdm driver as
39 * a subdriver, enabling userspace applications ("modem managers") to
40 * handle it.
Bjørn Mork423ce8c2012-01-19 15:37:22 +000041 *
42 * These devices may alternatively/additionally be configured using AT
Bjørn Mork230718b2012-06-19 00:42:01 +000043 * commands on a serial interface
Bjørn Mork423ce8c2012-01-19 15:37:22 +000044 */
45
Bjørn Mork853c24f2012-06-19 00:41:59 +000046/* driver specific data */
47struct qmi_wwan_state {
48 struct usb_driver *subdriver;
49 atomic_t pmcount;
Bjørn Morkf47cd132012-06-19 00:42:00 +000050 unsigned long unused;
51 struct usb_interface *control;
52 struct usb_interface *data;
Bjørn Mork853c24f2012-06-19 00:41:59 +000053};
54
Bjørn Morkf47cd132012-06-19 00:42:00 +000055/* using a counter to merge subdriver requests with our own into a combined state */
56static int qmi_wwan_manage_power(struct usbnet *dev, int on)
57{
58 struct qmi_wwan_state *info = (void *)&dev->data;
59 int rv = 0;
60
61 dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
62
63 if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) {
64 /* need autopm_get/put here to ensure the usbcore sees the new value */
65 rv = usb_autopm_get_interface(dev->intf);
66 if (rv < 0)
67 goto err;
68 dev->intf->needs_remote_wakeup = on;
69 usb_autopm_put_interface(dev->intf);
70 }
71err:
72 return rv;
73}
74
75static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
76{
77 struct usbnet *dev = usb_get_intfdata(intf);
78 return qmi_wwan_manage_power(dev, on);
79}
80
81/* collect all three endpoints and register subdriver */
82static int qmi_wwan_register_subdriver(struct usbnet *dev)
83{
84 int rv;
85 struct usb_driver *subdriver = NULL;
86 struct qmi_wwan_state *info = (void *)&dev->data;
87
88 /* collect bulk endpoints */
89 rv = usbnet_get_endpoints(dev, info->data);
90 if (rv < 0)
91 goto err;
92
93 /* update status endpoint if separate control interface */
94 if (info->control != info->data)
95 dev->status = &info->control->cur_altsetting->endpoint[0];
96
97 /* require interrupt endpoint for subdriver */
98 if (!dev->status) {
99 rv = -EINVAL;
100 goto err;
101 }
102
103 /* for subdriver power management */
104 atomic_set(&info->pmcount, 0);
105
106 /* register subdriver */
107 subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power);
108 if (IS_ERR(subdriver)) {
109 dev_err(&info->control->dev, "subdriver registration failed\n");
110 rv = PTR_ERR(subdriver);
111 goto err;
112 }
113
114 /* prevent usbnet from using status endpoint */
115 dev->status = NULL;
116
117 /* save subdriver struct for suspend/resume wrappers */
118 info->subdriver = subdriver;
119
120err:
121 return rv;
122}
123
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000124static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
125{
126 int status = -1;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000127 u8 *buf = intf->cur_altsetting->extra;
128 int len = intf->cur_altsetting->extralen;
129 struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
130 struct usb_cdc_union_desc *cdc_union = NULL;
131 struct usb_cdc_ether_desc *cdc_ether = NULL;
132 u32 required = 1 << USB_CDC_HEADER_TYPE | 1 << USB_CDC_UNION_TYPE;
133 u32 found = 0;
Bjørn Mork230718b2012-06-19 00:42:01 +0000134 struct usb_driver *driver = driver_of(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000135 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100136
Bjørn Mork853c24f2012-06-19 00:41:59 +0000137 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state)));
138
Bjørn Mork230718b2012-06-19 00:42:01 +0000139 /* require a single interrupt status endpoint for subdriver */
140 if (intf->cur_altsetting->desc.bNumEndpoints != 1)
141 goto err;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000142
143 while (len > 3) {
144 struct usb_descriptor_header *h = (void *)buf;
145
146 /* ignore any misplaced descriptors */
147 if (h->bDescriptorType != USB_DT_CS_INTERFACE)
148 goto next_desc;
149
150 /* buf[2] is CDC descriptor subtype */
151 switch (buf[2]) {
152 case USB_CDC_HEADER_TYPE:
153 if (found & 1 << USB_CDC_HEADER_TYPE) {
154 dev_dbg(&intf->dev, "extra CDC header\n");
155 goto err;
156 }
157 if (h->bLength != sizeof(struct usb_cdc_header_desc)) {
158 dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength);
159 goto err;
160 }
161 break;
162 case USB_CDC_UNION_TYPE:
163 if (found & 1 << USB_CDC_UNION_TYPE) {
164 dev_dbg(&intf->dev, "extra CDC union\n");
165 goto err;
166 }
167 if (h->bLength != sizeof(struct usb_cdc_union_desc)) {
168 dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength);
169 goto err;
170 }
171 cdc_union = (struct usb_cdc_union_desc *)buf;
172 break;
173 case USB_CDC_ETHERNET_TYPE:
174 if (found & 1 << USB_CDC_ETHERNET_TYPE) {
175 dev_dbg(&intf->dev, "extra CDC ether\n");
176 goto err;
177 }
178 if (h->bLength != sizeof(struct usb_cdc_ether_desc)) {
179 dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength);
180 goto err;
181 }
182 cdc_ether = (struct usb_cdc_ether_desc *)buf;
183 break;
184 }
185
186 /*
187 * Remember which CDC functional descriptors we've seen. Works
188 * for all types we care about, of which USB_CDC_ETHERNET_TYPE
189 * (0x0f) is the highest numbered
190 */
191 if (buf[2] < 32)
192 found |= 1 << buf[2];
193
194next_desc:
195 len -= h->bLength;
196 buf += h->bLength;
197 }
198
199 /* did we find all the required ones? */
200 if ((found & required) != required) {
201 dev_err(&intf->dev, "CDC functional descriptors missing\n");
202 goto err;
203 }
204
Bjørn Mork230718b2012-06-19 00:42:01 +0000205 /* verify CDC Union */
206 if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) {
207 dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0);
208 goto err;
209 }
210
211 /* need to save these for unbind */
212 info->control = intf;
213 info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0);
214 if (!info->data) {
215 dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0);
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000216 goto err;
217 }
218
219 /* errors aren't fatal - we can live with the dynamic address */
220 if (cdc_ether) {
221 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
222 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
223 }
224
Bjørn Mork230718b2012-06-19 00:42:01 +0000225 /* claim data interface and set it up */
226 status = usb_driver_claim_interface(driver, info->data, dev);
227 if (status < 0)
228 goto err;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000229
Bjørn Mork230718b2012-06-19 00:42:01 +0000230 status = qmi_wwan_register_subdriver(dev);
231 if (status < 0) {
232 usb_set_intfdata(info->data, NULL);
233 usb_driver_release_interface(driver, info->data);
234 }
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000235
236err:
237 return status;
238}
239
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100240/* Some devices combine the "control" and "data" functions into a
241 * single interface with all three endpoints: interrupt + bulk in and
242 * out
Bjørn Mork230718b2012-06-19 00:42:01 +0000243 */
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100244static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf)
245{
246 int rv;
Bjørn Mork853c24f2012-06-19 00:41:59 +0000247 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100248
Bjørn Mork11207b62012-03-16 15:41:27 +0100249 /* ZTE makes devices where the interface descriptors and endpoint
250 * configurations of two or more interfaces are identical, even
251 * though the functions are completely different. If set, then
252 * driver_info->data is a bitmap of acceptable interface numbers
253 * allowing us to bind to one such interface without binding to
254 * all of them
255 */
256 if (dev->driver_info->data &&
257 !test_bit(intf->cur_altsetting->desc.bInterfaceNumber, &dev->driver_info->data)) {
258 dev_info(&intf->dev, "not on our whitelist - ignored");
259 rv = -ENODEV;
260 goto err;
261 }
262
Bjørn Morkf47cd132012-06-19 00:42:00 +0000263 /* control and data is shared */
264 info->control = intf;
265 info->data = intf;
266 rv = qmi_wwan_register_subdriver(dev);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100267
268err:
269 return rv;
270}
271
Bjørn Morkb086cf02012-03-09 12:35:06 +0100272/* Gobi devices uses identical class/protocol codes for all interfaces regardless
273 * of function. Some of these are CDC ACM like and have the exact same endpoints
274 * we are looking for. This leaves two possible strategies for identifying the
275 * correct interface:
276 * a) hardcoding interface number, or
277 * b) use the fact that the wwan interface is the only one lacking additional
278 * (CDC functional) descriptors
279 *
280 * Let's see if we can get away with the generic b) solution.
281 */
282static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf)
283{
284 int rv = -EINVAL;
285
286 /* ignore any interface with additional descriptors */
287 if (intf->cur_altsetting->extralen)
288 goto err;
289
290 rv = qmi_wwan_bind_shared(dev, intf);
291err:
292 return rv;
293}
294
Bjørn Mork230718b2012-06-19 00:42:01 +0000295static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100296{
Bjørn Mork853c24f2012-06-19 00:41:59 +0000297 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Mork230718b2012-06-19 00:42:01 +0000298 struct usb_driver *driver = driver_of(intf);
299 struct usb_interface *other;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100300
Bjørn Mork853c24f2012-06-19 00:41:59 +0000301 if (info->subdriver && info->subdriver->disconnect)
Bjørn Mork230718b2012-06-19 00:42:01 +0000302 info->subdriver->disconnect(info->control);
303
304 /* allow user to unbind using either control or data */
305 if (intf == info->control)
306 other = info->data;
307 else
308 other = info->control;
309
310 /* only if not shared */
311 if (other && intf != other) {
312 usb_set_intfdata(other, NULL);
313 usb_driver_release_interface(driver, other);
314 }
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100315
Bjørn Mork853c24f2012-06-19 00:41:59 +0000316 info->subdriver = NULL;
Bjørn Mork230718b2012-06-19 00:42:01 +0000317 info->data = NULL;
318 info->control = NULL;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100319}
320
321/* suspend/resume wrappers calling both usbnet and the cdc-wdm
322 * subdriver if present.
323 *
324 * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
325 * wrappers for those without adding usbnet reset support first.
326 */
327static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
328{
329 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000330 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100331 int ret;
332
333 ret = usbnet_suspend(intf, message);
334 if (ret < 0)
335 goto err;
336
Bjørn Mork853c24f2012-06-19 00:41:59 +0000337 if (info->subdriver && info->subdriver->suspend)
338 ret = info->subdriver->suspend(intf, message);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100339 if (ret < 0)
340 usbnet_resume(intf);
341err:
342 return ret;
343}
344
345static int qmi_wwan_resume(struct usb_interface *intf)
346{
347 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000348 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100349 int ret = 0;
350
Bjørn Mork853c24f2012-06-19 00:41:59 +0000351 if (info->subdriver && info->subdriver->resume)
352 ret = info->subdriver->resume(intf);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100353 if (ret < 0)
354 goto err;
355 ret = usbnet_resume(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000356 if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend)
357 info->subdriver->suspend(intf, PMSG_SUSPEND);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100358err:
359 return ret;
360}
361
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000362static const struct driver_info qmi_wwan_info = {
Bjørn Morka40345b2012-06-19 00:42:02 +0000363 .description = "WWAN/QMI device",
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000364 .flags = FLAG_WWAN,
365 .bind = qmi_wwan_bind,
Bjørn Mork230718b2012-06-19 00:42:01 +0000366 .unbind = qmi_wwan_unbind,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000367 .manage_power = qmi_wwan_manage_power,
368};
369
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100370static const struct driver_info qmi_wwan_shared = {
Bjørn Morka40345b2012-06-19 00:42:02 +0000371 .description = "WWAN/QMI device",
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100372 .flags = FLAG_WWAN,
373 .bind = qmi_wwan_bind_shared,
Bjørn Mork230718b2012-06-19 00:42:01 +0000374 .unbind = qmi_wwan_unbind,
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100375 .manage_power = qmi_wwan_manage_power,
376};
377
Bjørn Morkb086cf02012-03-09 12:35:06 +0100378static const struct driver_info qmi_wwan_gobi = {
379 .description = "Qualcomm Gobi wwan/QMI device",
380 .flags = FLAG_WWAN,
381 .bind = qmi_wwan_bind_gobi,
Bjørn Mork230718b2012-06-19 00:42:01 +0000382 .unbind = qmi_wwan_unbind,
Bjørn Morkb086cf02012-03-09 12:35:06 +0100383 .manage_power = qmi_wwan_manage_power,
384};
385
Bjørn Mork11207b62012-03-16 15:41:27 +0100386/* ZTE suck at making USB descriptors */
Andrew Bird (Sphere Systems)f7142e62012-05-19 22:28:38 +0000387static const struct driver_info qmi_wwan_force_int1 = {
388 .description = "Qualcomm WWAN/QMI device",
389 .flags = FLAG_WWAN,
390 .bind = qmi_wwan_bind_shared,
Bjørn Mork230718b2012-06-19 00:42:01 +0000391 .unbind = qmi_wwan_unbind,
Andrew Bird (Sphere Systems)f7142e62012-05-19 22:28:38 +0000392 .manage_power = qmi_wwan_manage_power,
393 .data = BIT(1), /* interface whitelist bitmap */
394};
395
Bjørn Mork11207b62012-03-16 15:41:27 +0100396static const struct driver_info qmi_wwan_force_int4 = {
Andrew Bird (Sphere Systems)00001882012-05-19 22:28:36 +0000397 .description = "Qualcomm WWAN/QMI device",
Bjørn Mork11207b62012-03-16 15:41:27 +0100398 .flags = FLAG_WWAN,
Andrew Bird (Sphere Systems)00001882012-05-19 22:28:36 +0000399 .bind = qmi_wwan_bind_shared,
Bjørn Mork230718b2012-06-19 00:42:01 +0000400 .unbind = qmi_wwan_unbind,
Bjørn Mork11207b62012-03-16 15:41:27 +0100401 .manage_power = qmi_wwan_manage_power,
402 .data = BIT(4), /* interface whitelist bitmap */
403};
404
Bjørn Mork3bc17d12012-04-17 09:38:23 +0000405/* Sierra Wireless provide equally useless interface descriptors
406 * Devices in QMI mode can be switched between two different
407 * configurations:
408 * a) USB interface #8 is QMI/wwan
409 * b) USB interfaces #8, #19 and #20 are QMI/wwan
410 *
411 * Both configurations provide a number of other interfaces (serial++),
412 * some of which have the same endpoint configuration as we expect, so
413 * a whitelist or blacklist is necessary.
414 *
415 * FIXME: The below whitelist should include BIT(20). It does not
416 * because I cannot get it to work...
417 */
418static const struct driver_info qmi_wwan_sierra = {
419 .description = "Sierra Wireless wwan/QMI device",
420 .flags = FLAG_WWAN,
421 .bind = qmi_wwan_bind_gobi,
Bjørn Mork230718b2012-06-19 00:42:01 +0000422 .unbind = qmi_wwan_unbind,
Bjørn Mork3bc17d12012-04-17 09:38:23 +0000423 .manage_power = qmi_wwan_manage_power,
424 .data = BIT(8) | BIT(19), /* interface whitelist bitmap */
425};
Bjørn Mork11207b62012-03-16 15:41:27 +0100426
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000427#define HUAWEI_VENDOR_ID 0x12D1
Bjørn Morkb086cf02012-03-09 12:35:06 +0100428#define QMI_GOBI_DEVICE(vend, prod) \
429 USB_DEVICE(vend, prod), \
430 .driver_info = (unsigned long)&qmi_wwan_gobi
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000431
432static const struct usb_device_id products[] = {
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100433 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
434 .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
435 .idVendor = HUAWEI_VENDOR_ID,
436 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
437 .bInterfaceSubClass = 1,
Bjørn Mork230718b2012-06-19 00:42:01 +0000438 .bInterfaceProtocol = 9, /* CDC Ethernet *control* interface */
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100439 .driver_info = (unsigned long)&qmi_wwan_info,
440 },
Bjørn Mork88c16dc2012-05-19 07:20:31 +0000441 { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
442 .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
443 .idVendor = HUAWEI_VENDOR_ID,
444 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
445 .bInterfaceSubClass = 1,
Bjørn Mork230718b2012-06-19 00:42:01 +0000446 .bInterfaceProtocol = 57, /* CDC Ethernet *control* interface */
Bjørn Mork88c16dc2012-05-19 07:20:31 +0000447 .driver_info = (unsigned long)&qmi_wwan_info,
448 },
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100449 { /* Huawei E392, E398 and possibly others in "Windows mode"
450 * using a combined control and data interface without any CDC
451 * functional descriptors
452 */
453 .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO,
454 .idVendor = HUAWEI_VENDOR_ID,
455 .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
456 .bInterfaceSubClass = 1,
457 .bInterfaceProtocol = 17,
458 .driver_info = (unsigned long)&qmi_wwan_shared,
459 },
Bjørn Morkb086cf02012-03-09 12:35:06 +0100460 { /* Pantech UML290 */
461 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
462 .idVendor = 0x106c,
463 .idProduct = 0x3718,
464 .bInterfaceClass = 0xff,
465 .bInterfaceSubClass = 0xf0,
466 .bInterfaceProtocol = 0xff,
467 .driver_info = (unsigned long)&qmi_wwan_shared,
468 },
Bjørn Mork11207b62012-03-16 15:41:27 +0100469 { /* ZTE MF820D */
470 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
471 .idVendor = 0x19d2,
472 .idProduct = 0x0167,
473 .bInterfaceClass = 0xff,
474 .bInterfaceSubClass = 0xff,
475 .bInterfaceProtocol = 0xff,
476 .driver_info = (unsigned long)&qmi_wwan_force_int4,
477 },
Andrew Bird (Sphere Systems)f7142e62012-05-19 22:28:38 +0000478 { /* ZTE (Vodafone) K3520-Z */
479 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
480 .idVendor = 0x19d2,
481 .idProduct = 0x0055,
482 .bInterfaceClass = 0xff,
483 .bInterfaceSubClass = 0xff,
484 .bInterfaceProtocol = 0xff,
485 .driver_info = (unsigned long)&qmi_wwan_force_int1,
486 },
Andrew Bird (Sphere Systems)1aa35a22012-03-25 00:10:27 +0000487 { /* ZTE (Vodafone) K3565-Z */
488 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
489 .idVendor = 0x19d2,
490 .idProduct = 0x0063,
491 .bInterfaceClass = 0xff,
492 .bInterfaceSubClass = 0xff,
493 .bInterfaceProtocol = 0xff,
494 .driver_info = (unsigned long)&qmi_wwan_force_int4,
495 },
Andrew Bird (Sphere Systems)dbb6d092012-03-25 00:10:29 +0000496 { /* ZTE (Vodafone) K3570-Z */
497 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
498 .idVendor = 0x19d2,
499 .idProduct = 0x1008,
500 .bInterfaceClass = 0xff,
501 .bInterfaceSubClass = 0xff,
502 .bInterfaceProtocol = 0xff,
503 .driver_info = (unsigned long)&qmi_wwan_force_int4,
504 },
505 { /* ZTE (Vodafone) K3571-Z */
506 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
507 .idVendor = 0x19d2,
508 .idProduct = 0x1010,
509 .bInterfaceClass = 0xff,
510 .bInterfaceSubClass = 0xff,
511 .bInterfaceProtocol = 0xff,
512 .driver_info = (unsigned long)&qmi_wwan_force_int4,
513 },
Andrew Bird (Sphere Systems)8965c982012-05-19 22:28:37 +0000514 { /* ZTE (Vodafone) K3765-Z */
515 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
516 .idVendor = 0x19d2,
517 .idProduct = 0x2002,
518 .bInterfaceClass = 0xff,
519 .bInterfaceSubClass = 0xff,
520 .bInterfaceProtocol = 0xff,
521 .driver_info = (unsigned long)&qmi_wwan_force_int4,
522 },
Andrew Bird (Sphere Systems)1aa35a22012-03-25 00:10:27 +0000523 { /* ZTE (Vodafone) K4505-Z */
524 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
525 .idVendor = 0x19d2,
526 .idProduct = 0x0104,
527 .bInterfaceClass = 0xff,
528 .bInterfaceSubClass = 0xff,
529 .bInterfaceProtocol = 0xff,
530 .driver_info = (unsigned long)&qmi_wwan_force_int4,
531 },
Bjørn Mork3bc17d12012-04-17 09:38:23 +0000532 { /* Sierra Wireless MC77xx in QMI mode */
533 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,
534 .idVendor = 0x1199,
535 .idProduct = 0x68a2,
536 .bInterfaceClass = 0xff,
537 .bInterfaceSubClass = 0xff,
538 .bInterfaceProtocol = 0xff,
539 .driver_info = (unsigned long)&qmi_wwan_sierra,
540 },
Bjørn Morkb086cf02012-03-09 12:35:06 +0100541 {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
542 {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
543 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
544 {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
545 {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
546 {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
547 {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
548 {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
549 {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
550 {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
551 {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
552 {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
553 {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
554 {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
555 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
556 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
557 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
558 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
559 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
560 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
561 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
562 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
563 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
564 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
565 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
566 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
567 {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
568 {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
569 {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
570 {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
571 {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
572 {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
573 {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
574 {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
575 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
576 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
577 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
Bjørn Mork5e071b52012-05-23 23:19:32 +0000578 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
579 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100580 { } /* END */
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000581};
582MODULE_DEVICE_TABLE(usb, products);
583
584static struct usb_driver qmi_wwan_driver = {
585 .name = "qmi_wwan",
586 .id_table = products,
587 .probe = usbnet_probe,
588 .disconnect = usbnet_disconnect,
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100589 .suspend = qmi_wwan_suspend,
590 .resume = qmi_wwan_resume,
591 .reset_resume = qmi_wwan_resume,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000592 .supports_autosuspend = 1,
Sarah Sharpe1f12eb2012-04-23 10:08:51 -0700593 .disable_hub_initiated_lpm = 1,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000594};
595
Bjørn Mork677a3d62012-06-19 00:42:03 +0000596module_usb_driver(qmi_wwan_driver);
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000597
598MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
599MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
600MODULE_LICENSE("GPL");