Commit | Line | Data |
---|---|---|
423ce8ca BM |
1 | /* |
2 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> | |
3 | * | |
230718bd BM |
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 | * | |
423ce8ca BM |
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 | ||
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> | |
c3ecb08a | 20 | #include <linux/usb/cdc-wdm.h> |
423ce8ca | 21 | |
230718bd | 22 | /* This driver supports wwan (3G/LTE/?) devices using a vendor |
423ce8ca BM |
23 | * 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 | * | |
230718bd BM |
34 | * Alternatively, control and data functions can be combined in a |
35 | * single USB interface. | |
36 | * | |
423ce8ca | 37 | * Handling a protocol like QMI is out of the scope for any driver. |
230718bd BM |
38 | * 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. | |
423ce8ca BM |
41 | * |
42 | * These devices may alternatively/additionally be configured using AT | |
230718bd | 43 | * commands on a serial interface |
423ce8ca BM |
44 | */ |
45 | ||
853c24f7 BM |
46 | /* driver specific data */ |
47 | struct qmi_wwan_state { | |
48 | struct usb_driver *subdriver; | |
49 | atomic_t pmcount; | |
f47cd136 BM |
50 | unsigned long unused; |
51 | struct usb_interface *control; | |
52 | struct usb_interface *data; | |
853c24f7 BM |
53 | }; |
54 | ||
f47cd136 BM |
55 | /* using a counter to merge subdriver requests with our own into a combined state */ |
56 | static 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 | } | |
71 | err: | |
72 | return rv; | |
73 | } | |
74 | ||
75 | static 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 */ | |
82 | static 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 | ||
120 | err: | |
121 | return rv; | |
122 | } | |
123 | ||
423ce8ca BM |
124 | static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) |
125 | { | |
126 | int status = -1; | |
423ce8ca BM |
127 | 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; | |
423ce8ca | 132 | u32 found = 0; |
230718bd | 133 | struct usb_driver *driver = driver_of(intf); |
853c24f7 BM |
134 | struct qmi_wwan_state *info = (void *)&dev->data; |
135 | ||
136 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | |
c3ecb08a | 137 | |
230718bd BM |
138 | /* require a single interrupt status endpoint for subdriver */ |
139 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) | |
140 | goto err; | |
423ce8ca BM |
141 | |
142 | while (len > 3) { | |
143 | struct usb_descriptor_header *h = (void *)buf; | |
144 | ||
145 | /* ignore any misplaced descriptors */ | |
146 | if (h->bDescriptorType != USB_DT_CS_INTERFACE) | |
147 | goto next_desc; | |
148 | ||
149 | /* buf[2] is CDC descriptor subtype */ | |
150 | switch (buf[2]) { | |
151 | case USB_CDC_HEADER_TYPE: | |
152 | if (found & 1 << USB_CDC_HEADER_TYPE) { | |
153 | dev_dbg(&intf->dev, "extra CDC header\n"); | |
154 | goto err; | |
155 | } | |
156 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { | |
157 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); | |
158 | goto err; | |
159 | } | |
160 | break; | |
161 | case USB_CDC_UNION_TYPE: | |
162 | if (found & 1 << USB_CDC_UNION_TYPE) { | |
163 | dev_dbg(&intf->dev, "extra CDC union\n"); | |
164 | goto err; | |
165 | } | |
166 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { | |
167 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); | |
168 | goto err; | |
169 | } | |
170 | cdc_union = (struct usb_cdc_union_desc *)buf; | |
171 | break; | |
172 | case USB_CDC_ETHERNET_TYPE: | |
173 | if (found & 1 << USB_CDC_ETHERNET_TYPE) { | |
174 | dev_dbg(&intf->dev, "extra CDC ether\n"); | |
175 | goto err; | |
176 | } | |
177 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { | |
178 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); | |
179 | goto err; | |
180 | } | |
181 | cdc_ether = (struct usb_cdc_ether_desc *)buf; | |
182 | break; | |
183 | } | |
184 | ||
185 | /* | |
186 | * Remember which CDC functional descriptors we've seen. Works | |
187 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE | |
188 | * (0x0f) is the highest numbered | |
189 | */ | |
190 | if (buf[2] < 32) | |
191 | found |= 1 << buf[2]; | |
192 | ||
193 | next_desc: | |
194 | len -= h->bLength; | |
195 | buf += h->bLength; | |
196 | } | |
197 | ||
198 | /* did we find all the required ones? */ | |
5ac24979 DC |
199 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || |
200 | !(found & (1 << USB_CDC_UNION_TYPE))) { | |
423ce8ca BM |
201 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); |
202 | goto err; | |
203 | } | |
204 | ||
230718bd BM |
205 | /* 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); | |
423ce8ca BM |
216 | 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 | ||
230718bd BM |
225 | /* claim data interface and set it up */ |
226 | status = usb_driver_claim_interface(driver, info->data, dev); | |
227 | if (status < 0) | |
228 | goto err; | |
423ce8ca | 229 | |
230718bd BM |
230 | 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 | } | |
423ce8ca BM |
235 | |
236 | err: | |
237 | return status; | |
238 | } | |
239 | ||
c3ecb08a BM |
240 | /* Some devices combine the "control" and "data" functions into a |
241 | * single interface with all three endpoints: interrupt + bulk in and | |
242 | * out | |
230718bd | 243 | */ |
c3ecb08a BM |
244 | static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf) |
245 | { | |
246 | int rv; | |
853c24f7 | 247 | struct qmi_wwan_state *info = (void *)&dev->data; |
c3ecb08a | 248 | |
11207b6f BM |
249 | /* 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 | ||
f47cd136 BM |
263 | /* control and data is shared */ |
264 | info->control = intf; | |
265 | info->data = intf; | |
266 | rv = qmi_wwan_register_subdriver(dev); | |
c3ecb08a BM |
267 | |
268 | err: | |
269 | return rv; | |
270 | } | |
271 | ||
230718bd | 272 | static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) |
c3ecb08a | 273 | { |
853c24f7 | 274 | struct qmi_wwan_state *info = (void *)&dev->data; |
230718bd BM |
275 | struct usb_driver *driver = driver_of(intf); |
276 | struct usb_interface *other; | |
c3ecb08a | 277 | |
853c24f7 | 278 | if (info->subdriver && info->subdriver->disconnect) |
230718bd BM |
279 | info->subdriver->disconnect(info->control); |
280 | ||
281 | /* allow user to unbind using either control or data */ | |
282 | if (intf == info->control) | |
283 | other = info->data; | |
284 | else | |
285 | other = info->control; | |
286 | ||
287 | /* only if not shared */ | |
288 | if (other && intf != other) { | |
289 | usb_set_intfdata(other, NULL); | |
290 | usb_driver_release_interface(driver, other); | |
291 | } | |
c3ecb08a | 292 | |
853c24f7 | 293 | info->subdriver = NULL; |
230718bd BM |
294 | info->data = NULL; |
295 | info->control = NULL; | |
c3ecb08a BM |
296 | } |
297 | ||
298 | /* suspend/resume wrappers calling both usbnet and the cdc-wdm | |
299 | * subdriver if present. | |
300 | * | |
301 | * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide | |
302 | * wrappers for those without adding usbnet reset support first. | |
303 | */ | |
304 | static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | |
305 | { | |
306 | struct usbnet *dev = usb_get_intfdata(intf); | |
853c24f7 | 307 | struct qmi_wwan_state *info = (void *)&dev->data; |
c3ecb08a BM |
308 | int ret; |
309 | ||
310 | ret = usbnet_suspend(intf, message); | |
311 | if (ret < 0) | |
312 | goto err; | |
313 | ||
853c24f7 BM |
314 | if (info->subdriver && info->subdriver->suspend) |
315 | ret = info->subdriver->suspend(intf, message); | |
c3ecb08a BM |
316 | if (ret < 0) |
317 | usbnet_resume(intf); | |
318 | err: | |
319 | return ret; | |
320 | } | |
321 | ||
322 | static int qmi_wwan_resume(struct usb_interface *intf) | |
323 | { | |
324 | struct usbnet *dev = usb_get_intfdata(intf); | |
853c24f7 | 325 | struct qmi_wwan_state *info = (void *)&dev->data; |
c3ecb08a BM |
326 | int ret = 0; |
327 | ||
853c24f7 BM |
328 | if (info->subdriver && info->subdriver->resume) |
329 | ret = info->subdriver->resume(intf); | |
c3ecb08a BM |
330 | if (ret < 0) |
331 | goto err; | |
332 | ret = usbnet_resume(intf); | |
853c24f7 BM |
333 | if (ret < 0 && info->subdriver && info->subdriver->resume && info->subdriver->suspend) |
334 | info->subdriver->suspend(intf, PMSG_SUSPEND); | |
c3ecb08a BM |
335 | err: |
336 | return ret; | |
337 | } | |
338 | ||
423ce8ca | 339 | static const struct driver_info qmi_wwan_info = { |
a40345b5 | 340 | .description = "WWAN/QMI device", |
423ce8ca BM |
341 | .flags = FLAG_WWAN, |
342 | .bind = qmi_wwan_bind, | |
230718bd | 343 | .unbind = qmi_wwan_unbind, |
423ce8ca BM |
344 | .manage_power = qmi_wwan_manage_power, |
345 | }; | |
346 | ||
c3ecb08a | 347 | static const struct driver_info qmi_wwan_shared = { |
a40345b5 | 348 | .description = "WWAN/QMI device", |
c3ecb08a BM |
349 | .flags = FLAG_WWAN, |
350 | .bind = qmi_wwan_bind_shared, | |
230718bd | 351 | .unbind = qmi_wwan_unbind, |
c3ecb08a BM |
352 | .manage_power = qmi_wwan_manage_power, |
353 | }; | |
354 | ||
b9f90eb2 BM |
355 | static const struct driver_info qmi_wwan_force_int0 = { |
356 | .description = "Qualcomm WWAN/QMI device", | |
b086cf04 | 357 | .flags = FLAG_WWAN, |
b9f90eb2 | 358 | .bind = qmi_wwan_bind_shared, |
230718bd | 359 | .unbind = qmi_wwan_unbind, |
b086cf04 | 360 | .manage_power = qmi_wwan_manage_power, |
b9f90eb2 | 361 | .data = BIT(0), /* interface whitelist bitmap */ |
b086cf04 BM |
362 | }; |
363 | ||
f7142e6c ABSS |
364 | static const struct driver_info qmi_wwan_force_int1 = { |
365 | .description = "Qualcomm WWAN/QMI device", | |
366 | .flags = FLAG_WWAN, | |
367 | .bind = qmi_wwan_bind_shared, | |
230718bd | 368 | .unbind = qmi_wwan_unbind, |
f7142e6c ABSS |
369 | .manage_power = qmi_wwan_manage_power, |
370 | .data = BIT(1), /* interface whitelist bitmap */ | |
371 | }; | |
372 | ||
b9f90eb2 BM |
373 | static const struct driver_info qmi_wwan_force_int3 = { |
374 | .description = "Qualcomm WWAN/QMI device", | |
375 | .flags = FLAG_WWAN, | |
376 | .bind = qmi_wwan_bind_shared, | |
e486463e | 377 | .unbind = qmi_wwan_unbind, |
b9f90eb2 BM |
378 | .manage_power = qmi_wwan_manage_power, |
379 | .data = BIT(3), /* interface whitelist bitmap */ | |
380 | }; | |
381 | ||
11207b6f | 382 | static const struct driver_info qmi_wwan_force_int4 = { |
00001880 | 383 | .description = "Qualcomm WWAN/QMI device", |
11207b6f | 384 | .flags = FLAG_WWAN, |
00001880 | 385 | .bind = qmi_wwan_bind_shared, |
230718bd | 386 | .unbind = qmi_wwan_unbind, |
11207b6f BM |
387 | .manage_power = qmi_wwan_manage_power, |
388 | .data = BIT(4), /* interface whitelist bitmap */ | |
389 | }; | |
390 | ||
3bc17d10 BM |
391 | /* Sierra Wireless provide equally useless interface descriptors |
392 | * Devices in QMI mode can be switched between two different | |
393 | * configurations: | |
394 | * a) USB interface #8 is QMI/wwan | |
395 | * b) USB interfaces #8, #19 and #20 are QMI/wwan | |
396 | * | |
397 | * Both configurations provide a number of other interfaces (serial++), | |
398 | * some of which have the same endpoint configuration as we expect, so | |
399 | * a whitelist or blacklist is necessary. | |
400 | * | |
401 | * FIXME: The below whitelist should include BIT(20). It does not | |
402 | * because I cannot get it to work... | |
403 | */ | |
404 | static const struct driver_info qmi_wwan_sierra = { | |
405 | .description = "Sierra Wireless wwan/QMI device", | |
406 | .flags = FLAG_WWAN, | |
b9f90eb2 | 407 | .bind = qmi_wwan_bind_shared, |
230718bd | 408 | .unbind = qmi_wwan_unbind, |
3bc17d10 BM |
409 | .manage_power = qmi_wwan_manage_power, |
410 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | |
411 | }; | |
11207b6f | 412 | |
423ce8ca | 413 | #define HUAWEI_VENDOR_ID 0x12D1 |
b9f90eb2 BM |
414 | |
415 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ | |
416 | #define QMI_GOBI1K_DEVICE(vend, prod) \ | |
417 | USB_DEVICE(vend, prod), \ | |
418 | .driver_info = (unsigned long)&qmi_wwan_force_int3 | |
419 | ||
420 | /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */ | |
b086cf04 BM |
421 | #define QMI_GOBI_DEVICE(vend, prod) \ |
422 | USB_DEVICE(vend, prod), \ | |
b9f90eb2 | 423 | .driver_info = (unsigned long)&qmi_wwan_force_int0 |
423ce8ca BM |
424 | |
425 | static const struct usb_device_id products[] = { | |
c3ecb08a BM |
426 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
427 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, | |
428 | .idVendor = HUAWEI_VENDOR_ID, | |
429 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | |
430 | .bInterfaceSubClass = 1, | |
230718bd | 431 | .bInterfaceProtocol = 9, /* CDC Ethernet *control* interface */ |
c3ecb08a BM |
432 | .driver_info = (unsigned long)&qmi_wwan_info, |
433 | }, | |
88c16dc3 BM |
434 | { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ |
435 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, | |
436 | .idVendor = HUAWEI_VENDOR_ID, | |
437 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | |
438 | .bInterfaceSubClass = 1, | |
230718bd | 439 | .bInterfaceProtocol = 57, /* CDC Ethernet *control* interface */ |
88c16dc3 BM |
440 | .driver_info = (unsigned long)&qmi_wwan_info, |
441 | }, | |
c3ecb08a BM |
442 | { /* Huawei E392, E398 and possibly others in "Windows mode" |
443 | * using a combined control and data interface without any CDC | |
444 | * functional descriptors | |
445 | */ | |
446 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, | |
447 | .idVendor = HUAWEI_VENDOR_ID, | |
448 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | |
449 | .bInterfaceSubClass = 1, | |
450 | .bInterfaceProtocol = 17, | |
451 | .driver_info = (unsigned long)&qmi_wwan_shared, | |
452 | }, | |
b086cf04 BM |
453 | { /* Pantech UML290 */ |
454 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
455 | .idVendor = 0x106c, | |
456 | .idProduct = 0x3718, | |
457 | .bInterfaceClass = 0xff, | |
458 | .bInterfaceSubClass = 0xf0, | |
459 | .bInterfaceProtocol = 0xff, | |
460 | .driver_info = (unsigned long)&qmi_wwan_shared, | |
461 | }, | |
11207b6f BM |
462 | { /* ZTE MF820D */ |
463 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
464 | .idVendor = 0x19d2, | |
465 | .idProduct = 0x0167, | |
466 | .bInterfaceClass = 0xff, | |
467 | .bInterfaceSubClass = 0xff, | |
468 | .bInterfaceProtocol = 0xff, | |
469 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
470 | }, | |
f7142e6c ABSS |
471 | { /* ZTE (Vodafone) K3520-Z */ |
472 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
473 | .idVendor = 0x19d2, | |
474 | .idProduct = 0x0055, | |
475 | .bInterfaceClass = 0xff, | |
476 | .bInterfaceSubClass = 0xff, | |
477 | .bInterfaceProtocol = 0xff, | |
478 | .driver_info = (unsigned long)&qmi_wwan_force_int1, | |
479 | }, | |
1aa35a24 ABSS |
480 | { /* ZTE (Vodafone) K3565-Z */ |
481 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
482 | .idVendor = 0x19d2, | |
483 | .idProduct = 0x0063, | |
484 | .bInterfaceClass = 0xff, | |
dbb6d095 ABSS |
485 | .bInterfaceSubClass = 0xff, |
486 | .bInterfaceProtocol = 0xff, | |
487 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
488 | }, | |
489 | { /* ZTE (Vodafone) K3570-Z */ | |
490 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
491 | .idVendor = 0x19d2, | |
492 | .idProduct = 0x1008, | |
493 | .bInterfaceClass = 0xff, | |
494 | .bInterfaceSubClass = 0xff, | |
495 | .bInterfaceProtocol = 0xff, | |
496 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
497 | }, | |
498 | { /* ZTE (Vodafone) K3571-Z */ | |
499 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
500 | .idVendor = 0x19d2, | |
501 | .idProduct = 0x1010, | |
502 | .bInterfaceClass = 0xff, | |
1aa35a24 ABSS |
503 | .bInterfaceSubClass = 0xff, |
504 | .bInterfaceProtocol = 0xff, | |
505 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
506 | }, | |
8965c98f ABSS |
507 | { /* ZTE (Vodafone) K3765-Z */ |
508 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
509 | .idVendor = 0x19d2, | |
510 | .idProduct = 0x2002, | |
511 | .bInterfaceClass = 0xff, | |
512 | .bInterfaceSubClass = 0xff, | |
513 | .bInterfaceProtocol = 0xff, | |
514 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
515 | }, | |
1aa35a24 ABSS |
516 | { /* ZTE (Vodafone) K4505-Z */ |
517 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
518 | .idVendor = 0x19d2, | |
519 | .idProduct = 0x0104, | |
520 | .bInterfaceClass = 0xff, | |
521 | .bInterfaceSubClass = 0xff, | |
522 | .bInterfaceProtocol = 0xff, | |
523 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | |
524 | }, | |
3bc17d10 BM |
525 | { /* Sierra Wireless MC77xx in QMI mode */ |
526 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | |
527 | .idVendor = 0x1199, | |
528 | .idProduct = 0x68a2, | |
529 | .bInterfaceClass = 0xff, | |
530 | .bInterfaceSubClass = 0xff, | |
531 | .bInterfaceProtocol = 0xff, | |
532 | .driver_info = (unsigned long)&qmi_wwan_sierra, | |
533 | }, | |
b9f90eb2 BM |
534 | |
535 | /* Gobi 1000 devices */ | |
536 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | |
537 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | |
538 | {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | |
539 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ | |
540 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ | |
541 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ | |
542 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ | |
543 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ | |
544 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ | |
545 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ | |
546 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ | |
547 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ | |
548 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | |
549 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | |
550 | ||
551 | /* Gobi 2000 and 3000 devices */ | |
b086cf04 BM |
552 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
553 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | |
554 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | |
555 | {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ | |
556 | {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ | |
557 | {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ | |
558 | {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ | |
559 | {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ | |
560 | {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ | |
561 | {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
562 | {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
563 | {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
564 | {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
565 | {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
566 | {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
567 | {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
568 | {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
569 | {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
570 | {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | |
571 | {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */ | |
572 | {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ | |
573 | {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ | |
574 | {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ | |
5e071b5d BM |
575 | {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ |
576 | {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ | |
b086cf04 | 577 | { } /* END */ |
423ce8ca BM |
578 | }; |
579 | MODULE_DEVICE_TABLE(usb, products); | |
580 | ||
581 | static struct usb_driver qmi_wwan_driver = { | |
582 | .name = "qmi_wwan", | |
583 | .id_table = products, | |
584 | .probe = usbnet_probe, | |
585 | .disconnect = usbnet_disconnect, | |
c3ecb08a BM |
586 | .suspend = qmi_wwan_suspend, |
587 | .resume = qmi_wwan_resume, | |
588 | .reset_resume = qmi_wwan_resume, | |
423ce8ca | 589 | .supports_autosuspend = 1, |
e1f12eb6 | 590 | .disable_hub_initiated_lpm = 1, |
423ce8ca BM |
591 | }; |
592 | ||
677a3d60 | 593 | module_usb_driver(qmi_wwan_driver); |
423ce8ca BM |
594 | |
595 | MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>"); | |
596 | MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver"); | |
597 | MODULE_LICENSE("GPL"); |