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