blob: 156f7f85e4860d682d679df68bfe8cfe2a3d4b3b [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>
Ingo Molnar174cd4b2017-02-02 19:15:33 +010014#include <linux/sched/signal.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000015#include <linux/netdevice.h>
16#include <linux/ethtool.h>
Bjørn Mork6ff509a2013-04-18 12:57:09 +000017#include <linux/etherdevice.h>
Bjørn Mork32f7adf2015-12-03 19:24:21 +010018#include <linux/if_arp.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000019#include <linux/mii.h>
Bjørn Mork6c730082015-12-06 21:25:50 +010020#include <linux/rtnetlink.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000021#include <linux/usb.h>
22#include <linux/usb/cdc.h>
23#include <linux/usb/usbnet.h>
Bjørn Morkc3ecb082012-03-09 12:35:05 +010024#include <linux/usb/cdc-wdm.h>
Bjørn Mork423ce8c2012-01-19 15:37:22 +000025
Bjørn Mork230718b2012-06-19 00:42:01 +000026/* This driver supports wwan (3G/LTE/?) devices using a vendor
Bjørn Mork423ce8c2012-01-19 15:37:22 +000027 * specific management protocol called Qualcomm MSM Interface (QMI) -
28 * in addition to the more common AT commands over serial interface
29 * management
30 *
31 * QMI is wrapped in CDC, using CDC encapsulated commands on the
32 * control ("master") interface of a two-interface CDC Union
33 * resembling standard CDC ECM. The devices do not use the control
34 * interface for any other CDC messages. Most likely because the
35 * management protocol is used in place of the standard CDC
36 * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE
37 *
Bjørn Mork230718b2012-06-19 00:42:01 +000038 * Alternatively, control and data functions can be combined in a
39 * single USB interface.
40 *
Bjørn Mork423ce8c2012-01-19 15:37:22 +000041 * Handling a protocol like QMI is out of the scope for any driver.
Bjørn Mork230718b2012-06-19 00:42:01 +000042 * It is exported as a character device using the cdc-wdm driver as
43 * a subdriver, enabling userspace applications ("modem managers") to
44 * handle it.
Bjørn Mork423ce8c2012-01-19 15:37:22 +000045 *
46 * These devices may alternatively/additionally be configured using AT
Bjørn Mork230718b2012-06-19 00:42:01 +000047 * commands on a serial interface
Bjørn Mork423ce8c2012-01-19 15:37:22 +000048 */
49
Bjørn Mork853c24f2012-06-19 00:41:59 +000050/* driver specific data */
51struct qmi_wwan_state {
52 struct usb_driver *subdriver;
53 atomic_t pmcount;
Bjørn Mork32f7adf2015-12-03 19:24:21 +010054 unsigned long flags;
Bjørn Morkf47cd132012-06-19 00:42:00 +000055 struct usb_interface *control;
56 struct usb_interface *data;
Bjørn Mork853c24f2012-06-19 00:41:59 +000057};
58
Bjørn Mork32f7adf2015-12-03 19:24:21 +010059enum qmi_wwan_flags {
60 QMI_WWAN_FLAG_RAWIP = 1 << 0,
61};
62
Bjørn Mork9a765882016-10-10 21:12:49 +020063enum qmi_wwan_quirks {
64 QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */
65};
66
Bjørn Mork32f7adf2015-12-03 19:24:21 +010067static void qmi_wwan_netdev_setup(struct net_device *net)
68{
69 struct usbnet *dev = netdev_priv(net);
70 struct qmi_wwan_state *info = (void *)&dev->data;
71
72 if (info->flags & QMI_WWAN_FLAG_RAWIP) {
73 net->header_ops = NULL; /* No header */
74 net->type = ARPHRD_NONE;
75 net->hard_header_len = 0;
76 net->addr_len = 0;
77 net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
78 netdev_dbg(net, "mode: raw IP\n");
79 } else if (!net->header_ops) { /* don't bother if already set */
80 ether_setup(net);
81 netdev_dbg(net, "mode: Ethernet\n");
82 }
83
84 /* recalculate buffers after changing hard_header_len */
85 usbnet_change_mtu(net, net->mtu);
86}
87
88static ssize_t raw_ip_show(struct device *d, struct device_attribute *attr, char *buf)
89{
90 struct usbnet *dev = netdev_priv(to_net_dev(d));
91 struct qmi_wwan_state *info = (void *)&dev->data;
92
93 return sprintf(buf, "%c\n", info->flags & QMI_WWAN_FLAG_RAWIP ? 'Y' : 'N');
94}
95
96static ssize_t raw_ip_store(struct device *d, struct device_attribute *attr, const char *buf, size_t len)
97{
98 struct usbnet *dev = netdev_priv(to_net_dev(d));
99 struct qmi_wwan_state *info = (void *)&dev->data;
100 bool enable;
Bjørn Mork6c730082015-12-06 21:25:50 +0100101 int ret;
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100102
103 if (strtobool(buf, &enable))
104 return -EINVAL;
105
106 /* no change? */
107 if (enable == (info->flags & QMI_WWAN_FLAG_RAWIP))
108 return len;
109
Bjørn Mork6c730082015-12-06 21:25:50 +0100110 if (!rtnl_trylock())
111 return restart_syscall();
112
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100113 /* we don't want to modify a running netdev */
114 if (netif_running(dev->net)) {
115 netdev_err(dev->net, "Cannot change a running device\n");
Bjørn Mork6c730082015-12-06 21:25:50 +0100116 ret = -EBUSY;
117 goto err;
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100118 }
119
120 /* let other drivers deny the change */
Bjørn Mork6c730082015-12-06 21:25:50 +0100121 ret = call_netdevice_notifiers(NETDEV_PRE_TYPE_CHANGE, dev->net);
122 ret = notifier_to_errno(ret);
123 if (ret) {
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100124 netdev_err(dev->net, "Type change was refused\n");
Bjørn Mork6c730082015-12-06 21:25:50 +0100125 goto err;
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100126 }
127
128 if (enable)
129 info->flags |= QMI_WWAN_FLAG_RAWIP;
130 else
131 info->flags &= ~QMI_WWAN_FLAG_RAWIP;
132 qmi_wwan_netdev_setup(dev->net);
133 call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev->net);
Bjørn Mork6c730082015-12-06 21:25:50 +0100134 ret = len;
135err:
136 rtnl_unlock();
137 return ret;
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100138}
139
140static DEVICE_ATTR_RW(raw_ip);
141
142static struct attribute *qmi_wwan_sysfs_attrs[] = {
143 &dev_attr_raw_ip.attr,
144 NULL,
145};
146
147static struct attribute_group qmi_wwan_sysfs_attr_group = {
148 .name = "qmi",
149 .attrs = qmi_wwan_sysfs_attrs,
150};
151
Bjørn Morkcc6ba5f2013-04-18 12:57:11 +0000152/* default ethernet address used by the modem */
153static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3};
154
Kristian Evensen531ad422015-01-02 16:21:45 +0100155static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00};
156
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000157/* Make up an ethernet header if the packet doesn't have one.
158 *
159 * A firmware bug common among several devices cause them to send raw
160 * IP packets under some circumstances. There is no way for the
161 * driver/host to know when this will happen. And even when the bug
162 * hits, some packets will still arrive with an intact header.
163 *
164 * The supported devices are only capably of sending IPv4, IPv6 and
165 * ARP packets on a point-to-point link. Any packet with an ethernet
166 * header will have either our address or a broadcast/multicast
167 * address as destination. ARP packets will always have a header.
168 *
169 * This means that this function will reliably add the appropriate
170 * header iff necessary, provided our hardware address does not start
171 * with 4 or 6.
Bjørn Mork6483bdc2013-04-18 12:57:10 +0000172 *
173 * Another common firmware bug results in all packets being addressed
174 * to 00:a0:c6:00:00:00 despite the host address being different.
175 * This function will also fixup such packets.
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000176 */
177static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
178{
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100179 struct qmi_wwan_state *info = (void *)&dev->data;
180 bool rawip = info->flags & QMI_WWAN_FLAG_RAWIP;
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000181 __be16 proto;
182
Emil Goodeeb855692014-02-13 17:50:19 +0100183 /* This check is no longer done by usbnet */
184 if (skb->len < dev->net->hard_header_len)
185 return 0;
186
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000187 switch (skb->data[0] & 0xf0) {
188 case 0x40:
189 proto = htons(ETH_P_IP);
190 break;
191 case 0x60:
192 proto = htons(ETH_P_IPV6);
193 break;
Bjørn Mork6483bdc2013-04-18 12:57:10 +0000194 case 0x00:
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100195 if (rawip)
196 return 0;
Bjørn Mork6483bdc2013-04-18 12:57:10 +0000197 if (is_multicast_ether_addr(skb->data))
198 return 1;
199 /* possibly bogus destination - rewrite just in case */
200 skb_reset_mac_header(skb);
201 goto fix_dest;
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000202 default:
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100203 if (rawip)
204 return 0;
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000205 /* pass along other packets without modifications */
206 return 1;
207 }
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100208 if (rawip) {
209 skb->dev = dev->net; /* normally set by eth_type_trans */
210 skb->protocol = proto;
211 return 1;
212 }
213
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000214 if (skb_headroom(skb) < ETH_HLEN)
215 return 0;
216 skb_push(skb, ETH_HLEN);
217 skb_reset_mac_header(skb);
218 eth_hdr(skb)->h_proto = proto;
Joe Perches519983b2015-03-02 19:54:48 -0800219 eth_zero_addr(eth_hdr(skb)->h_source);
Bjørn Mork6483bdc2013-04-18 12:57:10 +0000220fix_dest:
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000221 memcpy(eth_hdr(skb)->h_dest, dev->net->dev_addr, ETH_ALEN);
222 return 1;
223}
224
225/* very simplistic detection of IPv4 or IPv6 headers */
226static bool possibly_iphdr(const char *data)
227{
228 return (data[0] & 0xd0) == 0x40;
229}
230
231/* disallow addresses which may be confused with IP headers */
232static int qmi_wwan_mac_addr(struct net_device *dev, void *p)
233{
234 int ret;
235 struct sockaddr *addr = p;
236
237 ret = eth_prepare_mac_addr_change(dev, p);
238 if (ret < 0)
239 return ret;
240 if (possibly_iphdr(addr->sa_data))
241 return -EADDRNOTAVAIL;
242 eth_commit_mac_addr_change(dev, p);
243 return 0;
244}
245
246static const struct net_device_ops qmi_wwan_netdev_ops = {
247 .ndo_open = usbnet_open,
248 .ndo_stop = usbnet_stop,
249 .ndo_start_xmit = usbnet_start_xmit,
250 .ndo_tx_timeout = usbnet_tx_timeout,
251 .ndo_change_mtu = usbnet_change_mtu,
252 .ndo_set_mac_address = qmi_wwan_mac_addr,
253 .ndo_validate_addr = eth_validate_addr,
254};
255
Fabio Porceddae0584952013-09-25 11:21:26 +0200256/* using a counter to merge subdriver requests with our own into a
257 * combined state
258 */
Bjørn Morkf47cd132012-06-19 00:42:00 +0000259static int qmi_wwan_manage_power(struct usbnet *dev, int on)
260{
261 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Mork79d9b622013-11-01 14:18:53 +0100262 int rv;
Bjørn Morkf47cd132012-06-19 00:42:00 +0000263
Fabio Porceddae0584952013-09-25 11:21:26 +0200264 dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__,
265 atomic_read(&info->pmcount), on);
Bjørn Morkf47cd132012-06-19 00:42:00 +0000266
Fabio Porceddae0584952013-09-25 11:21:26 +0200267 if ((on && atomic_add_return(1, &info->pmcount) == 1) ||
268 (!on && atomic_dec_and_test(&info->pmcount))) {
269 /* need autopm_get/put here to ensure the usbcore sees
270 * the new value
271 */
Bjørn Morkf47cd132012-06-19 00:42:00 +0000272 rv = usb_autopm_get_interface(dev->intf);
Bjørn Morkf47cd132012-06-19 00:42:00 +0000273 dev->intf->needs_remote_wakeup = on;
Bjørn Mork79d9b622013-11-01 14:18:53 +0100274 if (!rv)
275 usb_autopm_put_interface(dev->intf);
Bjørn Morkf47cd132012-06-19 00:42:00 +0000276 }
Bjørn Mork79d9b622013-11-01 14:18:53 +0100277 return 0;
Bjørn Morkf47cd132012-06-19 00:42:00 +0000278}
279
280static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on)
281{
282 struct usbnet *dev = usb_get_intfdata(intf);
David S. Millerb26d3442012-06-28 17:37:00 -0700283
284 /* can be called while disconnecting */
285 if (!dev)
286 return 0;
Bjørn Morkf47cd132012-06-19 00:42:00 +0000287 return qmi_wwan_manage_power(dev, on);
288}
289
290/* collect all three endpoints and register subdriver */
291static int qmi_wwan_register_subdriver(struct usbnet *dev)
292{
293 int rv;
294 struct usb_driver *subdriver = NULL;
295 struct qmi_wwan_state *info = (void *)&dev->data;
296
297 /* collect bulk endpoints */
298 rv = usbnet_get_endpoints(dev, info->data);
299 if (rv < 0)
300 goto err;
301
302 /* update status endpoint if separate control interface */
303 if (info->control != info->data)
304 dev->status = &info->control->cur_altsetting->endpoint[0];
305
306 /* require interrupt endpoint for subdriver */
307 if (!dev->status) {
308 rv = -EINVAL;
309 goto err;
310 }
311
312 /* for subdriver power management */
313 atomic_set(&info->pmcount, 0);
314
315 /* register subdriver */
Fabio Porceddae0584952013-09-25 11:21:26 +0200316 subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc,
317 4096, &qmi_wwan_cdc_wdm_manage_power);
Bjørn Morkf47cd132012-06-19 00:42:00 +0000318 if (IS_ERR(subdriver)) {
319 dev_err(&info->control->dev, "subdriver registration failed\n");
320 rv = PTR_ERR(subdriver);
321 goto err;
322 }
323
324 /* prevent usbnet from using status endpoint */
325 dev->status = NULL;
326
327 /* save subdriver struct for suspend/resume wrappers */
328 info->subdriver = subdriver;
329
330err:
331 return rv;
332}
333
Bjørn Mork93725142015-12-03 19:24:18 +0100334/* Send CDC SetControlLineState request, setting or clearing the DTR.
335 * "Required for Autoconnect and 9x30 to wake up" according to the
336 * GobiNet driver. The requirement has been verified on an MDM9230
337 * based Sierra Wireless MC7455
338 */
339static int qmi_wwan_change_dtr(struct usbnet *dev, bool on)
340{
341 u8 intf = dev->intf->cur_altsetting->desc.bInterfaceNumber;
342
343 return usbnet_write_cmd(dev, USB_CDC_REQ_SET_CONTROL_LINE_STATE,
344 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
345 on ? 0x01 : 0x00, intf, NULL, 0);
346}
347
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000348static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
349{
350 int status = -1;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000351 u8 *buf = intf->cur_altsetting->extra;
352 int len = intf->cur_altsetting->extralen;
353 struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
Oliver Neukum8492ed42015-09-07 16:05:41 +0200354 struct usb_cdc_union_desc *cdc_union;
355 struct usb_cdc_ether_desc *cdc_ether;
Bjørn Mork230718b2012-06-19 00:42:01 +0000356 struct usb_driver *driver = driver_of(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000357 struct qmi_wwan_state *info = (void *)&dev->data;
Oliver Neukum8492ed42015-09-07 16:05:41 +0200358 struct usb_cdc_parsed_header hdr;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100359
Fabio Porceddae0584952013-09-25 11:21:26 +0200360 BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) <
361 sizeof(struct qmi_wwan_state)));
Bjørn Mork853c24f2012-06-19 00:41:59 +0000362
Bjørn Morkb701f162013-03-13 02:25:17 +0000363 /* set up initial state */
364 info->control = intf;
365 info->data = intf;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000366
Bjørn Morkbd877e482012-09-07 07:36:07 +0000367 /* and a number of CDC descriptors */
Oliver Neukum8492ed42015-09-07 16:05:41 +0200368 cdc_parse_cdc_header(&hdr, intf, buf, len);
369 cdc_union = hdr.usb_cdc_union_desc;
370 cdc_ether = hdr.usb_cdc_ether_desc;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000371
Bjørn Morkb701f162013-03-13 02:25:17 +0000372 /* Use separate control and data interfaces if we found a CDC Union */
373 if (cdc_union) {
Fabio Porceddae0584952013-09-25 11:21:26 +0200374 info->data = usb_ifnum_to_if(dev->udev,
375 cdc_union->bSlaveInterface0);
376 if (desc->bInterfaceNumber != cdc_union->bMasterInterface0 ||
377 !info->data) {
378 dev_err(&intf->dev,
379 "bogus CDC Union: master=%u, slave=%u\n",
380 cdc_union->bMasterInterface0,
381 cdc_union->bSlaveInterface0);
Bjørn Mork34a55d52015-12-17 12:44:04 +0100382
383 /* ignore and continue... */
384 cdc_union = NULL;
385 info->data = intf;
Bjørn Morkb701f162013-03-13 02:25:17 +0000386 }
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000387 }
388
389 /* errors aren't fatal - we can live with the dynamic address */
390 if (cdc_ether) {
391 dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize);
392 usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress);
393 }
394
Bjørn Mork230718b2012-06-19 00:42:01 +0000395 /* claim data interface and set it up */
Bjørn Morkb701f162013-03-13 02:25:17 +0000396 if (info->control != info->data) {
397 status = usb_driver_claim_interface(driver, info->data, dev);
398 if (status < 0)
399 goto err;
400 }
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000401
Bjørn Mork230718b2012-06-19 00:42:01 +0000402 status = qmi_wwan_register_subdriver(dev);
Bjørn Morkbd877e482012-09-07 07:36:07 +0000403 if (status < 0 && info->control != info->data) {
Bjørn Mork230718b2012-06-19 00:42:01 +0000404 usb_set_intfdata(info->data, NULL);
405 usb_driver_release_interface(driver, info->data);
406 }
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000407
Bjørn Mork93725142015-12-03 19:24:18 +0100408 /* disabling remote wakeup on MDM9x30 devices has the same
409 * effect as clearing DTR. The device will not respond to QMI
410 * requests until we set DTR again. This is similar to a
411 * QMI_CTL SYNC request, clearing a lot of firmware state
412 * including the client ID allocations.
413 *
414 * Our usage model allows a session to span multiple
415 * open/close events, so we must prevent the firmware from
416 * clearing out state the clients might need.
417 *
418 * MDM9x30 is the first QMI chipset with USB3 support. Abuse
Bjørn Mork9a765882016-10-10 21:12:49 +0200419 * this fact to enable the quirk for all USB3 devices.
420 *
421 * There are also chipsets with the same "set DTR" requirement
422 * but without USB3 support. Devices based on these chips
423 * need a quirk flag in the device ID table.
Bjørn Mork93725142015-12-03 19:24:18 +0100424 */
Bjørn Mork9a765882016-10-10 21:12:49 +0200425 if (dev->driver_info->data & QMI_WWAN_QUIRK_DTR ||
426 le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
Bjørn Mork93725142015-12-03 19:24:18 +0100427 qmi_wwan_manage_power(dev, 1);
428 qmi_wwan_change_dtr(dev, true);
429 }
430
Kristian Evensen531ad422015-01-02 16:21:45 +0100431 /* Never use the same address on both ends of the link, even if the
432 * buggy firmware told us to. Or, if device is assigned the well-known
433 * buggy firmware MAC address, replace it with a random address,
Bjørn Morkcc6ba5f2013-04-18 12:57:11 +0000434 */
Kristian Evensen531ad422015-01-02 16:21:45 +0100435 if (ether_addr_equal(dev->net->dev_addr, default_modem_addr) ||
436 ether_addr_equal(dev->net->dev_addr, buggy_fw_addr))
Bjørn Morkcc6ba5f2013-04-18 12:57:11 +0000437 eth_hw_addr_random(dev->net);
438
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000439 /* make MAC addr easily distinguishable from an IP header */
440 if (possibly_iphdr(dev->net->dev_addr)) {
441 dev->net->dev_addr[0] |= 0x02; /* set local assignment bit */
442 dev->net->dev_addr[0] &= 0xbf; /* clear "IP" bit */
443 }
444 dev->net->netdev_ops = &qmi_wwan_netdev_ops;
Bjørn Mork32f7adf2015-12-03 19:24:21 +0100445 dev->net->sysfs_groups[0] = &qmi_wwan_sysfs_attr_group;
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000446err:
447 return status;
448}
449
Bjørn Mork230718b2012-06-19 00:42:01 +0000450static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf)
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100451{
Bjørn Mork853c24f2012-06-19 00:41:59 +0000452 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Mork230718b2012-06-19 00:42:01 +0000453 struct usb_driver *driver = driver_of(intf);
454 struct usb_interface *other;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100455
Bjørn Mork853c24f2012-06-19 00:41:59 +0000456 if (info->subdriver && info->subdriver->disconnect)
Bjørn Mork230718b2012-06-19 00:42:01 +0000457 info->subdriver->disconnect(info->control);
458
Bjørn Mork93725142015-12-03 19:24:18 +0100459 /* disable MDM9x30 quirk */
460 if (le16_to_cpu(dev->udev->descriptor.bcdUSB) >= 0x0201) {
461 qmi_wwan_change_dtr(dev, false);
462 qmi_wwan_manage_power(dev, 0);
463 }
464
Bjørn Mork230718b2012-06-19 00:42:01 +0000465 /* allow user to unbind using either control or data */
466 if (intf == info->control)
467 other = info->data;
468 else
469 other = info->control;
470
471 /* only if not shared */
472 if (other && intf != other) {
473 usb_set_intfdata(other, NULL);
474 usb_driver_release_interface(driver, other);
475 }
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100476
Bjørn Mork853c24f2012-06-19 00:41:59 +0000477 info->subdriver = NULL;
Bjørn Mork230718b2012-06-19 00:42:01 +0000478 info->data = NULL;
479 info->control = NULL;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100480}
481
482/* suspend/resume wrappers calling both usbnet and the cdc-wdm
483 * subdriver if present.
484 *
485 * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide
486 * wrappers for those without adding usbnet reset support first.
487 */
488static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message)
489{
490 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000491 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100492 int ret;
493
Fabio Porceddae0584952013-09-25 11:21:26 +0200494 /* Both usbnet_suspend() and subdriver->suspend() MUST return 0
Ming Lei81b50be2013-03-15 12:08:57 +0800495 * in system sleep context, otherwise, the resume callback has
496 * to recover device from previous suspend failure.
497 */
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100498 ret = usbnet_suspend(intf, message);
499 if (ret < 0)
500 goto err;
501
Fabio Porceddae0584952013-09-25 11:21:26 +0200502 if (intf == info->control && info->subdriver &&
503 info->subdriver->suspend)
Bjørn Mork853c24f2012-06-19 00:41:59 +0000504 ret = info->subdriver->suspend(intf, message);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100505 if (ret < 0)
506 usbnet_resume(intf);
507err:
508 return ret;
509}
510
511static int qmi_wwan_resume(struct usb_interface *intf)
512{
513 struct usbnet *dev = usb_get_intfdata(intf);
Bjørn Mork853c24f2012-06-19 00:41:59 +0000514 struct qmi_wwan_state *info = (void *)&dev->data;
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100515 int ret = 0;
Fabio Porceddae0584952013-09-25 11:21:26 +0200516 bool callsub = (intf == info->control && info->subdriver &&
517 info->subdriver->resume);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100518
Bjørn Mork8624dd22012-09-12 20:44:35 +0000519 if (callsub)
Bjørn Mork853c24f2012-06-19 00:41:59 +0000520 ret = info->subdriver->resume(intf);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100521 if (ret < 0)
522 goto err;
523 ret = usbnet_resume(intf);
Bjørn Morka2988072013-11-01 14:18:54 +0100524 if (ret < 0 && callsub)
Bjørn Mork853c24f2012-06-19 00:41:59 +0000525 info->subdriver->suspend(intf, PMSG_SUSPEND);
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100526err:
527 return ret;
528}
529
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000530static const struct driver_info qmi_wwan_info = {
Bjørn Morka40345b2012-06-19 00:42:02 +0000531 .description = "WWAN/QMI device",
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000532 .flags = FLAG_WWAN,
533 .bind = qmi_wwan_bind,
Bjørn Mork230718b2012-06-19 00:42:01 +0000534 .unbind = qmi_wwan_unbind,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000535 .manage_power = qmi_wwan_manage_power,
Bjørn Mork6ff509a2013-04-18 12:57:09 +0000536 .rx_fixup = qmi_wwan_rx_fixup,
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000537};
538
Bjørn Mork9a765882016-10-10 21:12:49 +0200539static const struct driver_info qmi_wwan_info_quirk_dtr = {
540 .description = "WWAN/QMI device",
541 .flags = FLAG_WWAN,
542 .bind = qmi_wwan_bind,
543 .unbind = qmi_wwan_unbind,
544 .manage_power = qmi_wwan_manage_power,
545 .rx_fixup = qmi_wwan_rx_fixup,
546 .data = QMI_WWAN_QUIRK_DTR,
547};
548
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000549#define HUAWEI_VENDOR_ID 0x12D1
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000550
Bjørn Mork03304bc2012-08-12 09:16:30 +0000551/* map QMI/wwan function by a fixed interface number */
552#define QMI_FIXED_INTF(vend, prod, num) \
553 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
Bjørn Morkbd877e482012-09-07 07:36:07 +0000554 .driver_info = (unsigned long)&qmi_wwan_info
Bjørn Mork03304bc2012-08-12 09:16:30 +0000555
Bjørn Mork9a765882016-10-10 21:12:49 +0200556/* devices requiring "set DTR" quirk */
557#define QMI_QUIRK_SET_DTR(vend, prod, num) \
558 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
559 .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr
560
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000561/* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */
562#define QMI_GOBI1K_DEVICE(vend, prod) \
Bjørn Mork03304bc2012-08-12 09:16:30 +0000563 QMI_FIXED_INTF(vend, prod, 3)
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000564
Bjørn Mork03304bc2012-08-12 09:16:30 +0000565/* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100566#define QMI_GOBI_DEVICE(vend, prod) \
Bjørn Mork03304bc2012-08-12 09:16:30 +0000567 QMI_FIXED_INTF(vend, prod, 0)
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000568
569static const struct usb_device_id products[] = {
Bjørn Mork03304bc2012-08-12 09:16:30 +0000570 /* 1. CDC ECM like devices match on the control interface */
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100571 { /* Huawei E392, E398 and possibly others sharing both device id and more... */
Bjørn Mork5ea42962012-08-12 09:16:32 +0000572 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9),
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100573 .driver_info = (unsigned long)&qmi_wwan_info,
574 },
Bjørn Mork88c16dc2012-05-19 07:20:31 +0000575 { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */
Bjørn Mork5ea42962012-08-12 09:16:32 +0000576 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57),
Bjørn Mork88c16dc2012-05-19 07:20:31 +0000577 .driver_info = (unsigned long)&qmi_wwan_info,
578 },
Bjørn Morke21b9d02013-02-06 05:22:08 +0000579 { /* HUAWEI_INTERFACE_NDIS_CONTROL_QUALCOMM */
580 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x69),
581 .driver_info = (unsigned long)&qmi_wwan_info,
582 },
Tony Lindgren40718982017-03-19 09:19:57 -0700583 { /* Motorola Mapphone devices with MDM6600 */
584 USB_VENDOR_AND_INTERFACE_INFO(0x22b8, USB_CLASS_VENDOR_SPEC, 0xfb, 0xff),
585 .driver_info = (unsigned long)&qmi_wwan_info,
586 },
Bjørn Mork03304bc2012-08-12 09:16:30 +0000587
588 /* 2. Combined interface devices matching on class+protocol */
Bjørn Mork9db273f2012-09-19 10:03:36 +0000589 { /* Huawei E367 and possibly others in "Windows mode" */
Bjørn Mork42d94dc2012-09-19 21:18:05 +0000590 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7),
591 .driver_info = (unsigned long)&qmi_wwan_info,
592 },
Bjørn Mork03304bc2012-08-12 09:16:30 +0000593 { /* Huawei E392, E398 and possibly others in "Windows mode" */
Bjørn Mork5ea42962012-08-12 09:16:32 +0000594 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17),
Bjørn Morkbd877e482012-09-07 07:36:07 +0000595 .driver_info = (unsigned long)&qmi_wwan_info,
Bjørn Morkc3ecb082012-03-09 12:35:05 +0100596 },
Bjørn Morke21b9d02013-02-06 05:22:08 +0000597 { /* HUAWEI_NDIS_SINGLE_INTERFACE_VDF */
598 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x37),
599 .driver_info = (unsigned long)&qmi_wwan_info,
600 },
601 { /* HUAWEI_INTERFACE_NDIS_HW_QUALCOMM */
602 USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 0x01, 0x67),
603 .driver_info = (unsigned long)&qmi_wwan_info,
604 },
Bjørn Mork9db273f2012-09-19 10:03:36 +0000605 { /* Pantech UML290, P4200 and more */
Bjørn Mork42d94dc2012-09-19 21:18:05 +0000606 USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff),
Bjørn Morkbd877e482012-09-07 07:36:07 +0000607 .driver_info = (unsigned long)&qmi_wwan_info,
Bjørn Morkb086cf02012-03-09 12:35:06 +0100608 },
Bjørn Mork10cbc1d2012-08-15 03:42:57 +0000609 { /* Pantech UML290 - newer firmware */
Bjørn Mork42d94dc2012-09-19 21:18:05 +0000610 USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff),
Bjørn Morkbd877e482012-09-07 07:36:07 +0000611 .driver_info = (unsigned long)&qmi_wwan_info,
Bjørn Mork10cbc1d2012-08-15 03:42:57 +0000612 },
Dan Williamsf8295ec2012-10-24 12:10:34 +0000613 { /* Novatel USB551L and MC551 */
614 USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001,
615 USB_CLASS_COMM,
616 USB_CDC_SUBCLASS_ETHERNET,
617 USB_CDC_PROTO_NONE),
618 .driver_info = (unsigned long)&qmi_wwan_info,
619 },
620 { /* Novatel E362 */
621 USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010,
622 USB_CLASS_COMM,
623 USB_CDC_SUBCLASS_ETHERNET,
624 USB_CDC_PROTO_NONE),
625 .driver_info = (unsigned long)&qmi_wwan_info,
626 },
Yegor Yefremov7b5939b2014-03-28 12:07:18 +0100627 { /* Novatel Expedite E371 */
628 USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9011,
629 USB_CLASS_COMM,
630 USB_CDC_SUBCLASS_ETHERNET,
631 USB_CDC_PROTO_NONE),
632 .driver_info = (unsigned long)&qmi_wwan_info,
633 },
Dan Williams0370acd2012-12-17 08:17:41 +0000634 { /* Dell Wireless 5800 (Novatel E362) */
635 USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8195,
636 USB_CLASS_COMM,
637 USB_CDC_SUBCLASS_ETHERNET,
638 USB_CDC_PROTO_NONE),
639 .driver_info = (unsigned long)&qmi_wwan_info,
640 },
641 { /* Dell Wireless 5800 V2 (Novatel E362) */
642 USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8196,
643 USB_CLASS_COMM,
644 USB_CDC_SUBCLASS_ETHERNET,
645 USB_CDC_PROTO_NONE),
646 .driver_info = (unsigned long)&qmi_wwan_info,
647 },
Dan Williams7fdb7842013-05-06 11:17:37 +0000648 { /* Dell Wireless 5804 (Novatel E371) */
649 USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x819b,
650 USB_CLASS_COMM,
651 USB_CDC_SUBCLASS_ETHERNET,
652 USB_CDC_PROTO_NONE),
653 .driver_info = (unsigned long)&qmi_wwan_info,
654 },
Dan Williams45d213f2013-02-18 17:25:09 +0000655 { /* ADU960S */
656 USB_DEVICE_AND_INTERFACE_INFO(0x16d5, 0x650a,
657 USB_CLASS_COMM,
658 USB_CDC_SUBCLASS_ETHERNET,
659 USB_CDC_PROTO_NONE),
660 .driver_info = (unsigned long)&qmi_wwan_info,
661 },
Bjørn Mork5b9f5752017-01-24 10:45:38 +0100662 { /* HP lt2523 (Novatel E371) */
663 USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x421d,
664 USB_CLASS_COMM,
665 USB_CDC_SUBCLASS_ETHERNET,
666 USB_CDC_PROTO_NONE),
667 .driver_info = (unsigned long)&qmi_wwan_info,
668 },
Bjørn Mork70910792015-11-01 01:34:50 +0100669 { /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
670 USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7),
671 .driver_info = (unsigned long)&qmi_wwan_info,
672 },
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000673
Bjørn Mork03304bc2012-08-12 09:16:30 +0000674 /* 3. Combined interface devices matching on interface number */
Bjørn Mork1bf014e2013-02-12 02:42:50 +0000675 {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
Bjørn Morkaac8d3c2016-02-12 16:42:14 +0100676 {QMI_FIXED_INTF(0x05c6, 0x6001, 3)}, /* 4G LTE usb-modem U901 */
Bjørn Mork04706672013-09-10 15:06:20 +0200677 {QMI_FIXED_INTF(0x05c6, 0x7000, 0)},
678 {QMI_FIXED_INTF(0x05c6, 0x7001, 1)},
679 {QMI_FIXED_INTF(0x05c6, 0x7002, 1)},
680 {QMI_FIXED_INTF(0x05c6, 0x7101, 1)},
681 {QMI_FIXED_INTF(0x05c6, 0x7101, 2)},
682 {QMI_FIXED_INTF(0x05c6, 0x7101, 3)},
683 {QMI_FIXED_INTF(0x05c6, 0x7102, 1)},
684 {QMI_FIXED_INTF(0x05c6, 0x7102, 2)},
685 {QMI_FIXED_INTF(0x05c6, 0x7102, 3)},
686 {QMI_FIXED_INTF(0x05c6, 0x8000, 7)},
687 {QMI_FIXED_INTF(0x05c6, 0x8001, 6)},
688 {QMI_FIXED_INTF(0x05c6, 0x9000, 4)},
689 {QMI_FIXED_INTF(0x05c6, 0x9003, 4)},
690 {QMI_FIXED_INTF(0x05c6, 0x9005, 2)},
691 {QMI_FIXED_INTF(0x05c6, 0x900a, 4)},
692 {QMI_FIXED_INTF(0x05c6, 0x900b, 2)},
693 {QMI_FIXED_INTF(0x05c6, 0x900c, 4)},
694 {QMI_FIXED_INTF(0x05c6, 0x900c, 5)},
695 {QMI_FIXED_INTF(0x05c6, 0x900c, 6)},
696 {QMI_FIXED_INTF(0x05c6, 0x900d, 5)},
697 {QMI_FIXED_INTF(0x05c6, 0x900f, 3)},
698 {QMI_FIXED_INTF(0x05c6, 0x900f, 4)},
699 {QMI_FIXED_INTF(0x05c6, 0x900f, 5)},
700 {QMI_FIXED_INTF(0x05c6, 0x9010, 4)},
701 {QMI_FIXED_INTF(0x05c6, 0x9010, 5)},
702 {QMI_FIXED_INTF(0x05c6, 0x9011, 3)},
703 {QMI_FIXED_INTF(0x05c6, 0x9011, 4)},
704 {QMI_FIXED_INTF(0x05c6, 0x9021, 1)},
705 {QMI_FIXED_INTF(0x05c6, 0x9022, 2)},
706 {QMI_FIXED_INTF(0x05c6, 0x9025, 4)}, /* Alcatel-sbell ASB TL131 TDD LTE (China Mobile) */
707 {QMI_FIXED_INTF(0x05c6, 0x9026, 3)},
708 {QMI_FIXED_INTF(0x05c6, 0x902e, 5)},
709 {QMI_FIXED_INTF(0x05c6, 0x9031, 5)},
710 {QMI_FIXED_INTF(0x05c6, 0x9032, 4)},
711 {QMI_FIXED_INTF(0x05c6, 0x9033, 3)},
712 {QMI_FIXED_INTF(0x05c6, 0x9033, 4)},
713 {QMI_FIXED_INTF(0x05c6, 0x9033, 5)},
714 {QMI_FIXED_INTF(0x05c6, 0x9033, 6)},
715 {QMI_FIXED_INTF(0x05c6, 0x9034, 3)},
716 {QMI_FIXED_INTF(0x05c6, 0x9034, 4)},
717 {QMI_FIXED_INTF(0x05c6, 0x9034, 5)},
718 {QMI_FIXED_INTF(0x05c6, 0x9034, 6)},
719 {QMI_FIXED_INTF(0x05c6, 0x9034, 7)},
720 {QMI_FIXED_INTF(0x05c6, 0x9035, 4)},
721 {QMI_FIXED_INTF(0x05c6, 0x9036, 3)},
722 {QMI_FIXED_INTF(0x05c6, 0x9037, 5)},
723 {QMI_FIXED_INTF(0x05c6, 0x9038, 4)},
724 {QMI_FIXED_INTF(0x05c6, 0x903b, 7)},
725 {QMI_FIXED_INTF(0x05c6, 0x903c, 6)},
726 {QMI_FIXED_INTF(0x05c6, 0x903d, 6)},
727 {QMI_FIXED_INTF(0x05c6, 0x903e, 5)},
728 {QMI_FIXED_INTF(0x05c6, 0x9043, 3)},
729 {QMI_FIXED_INTF(0x05c6, 0x9046, 3)},
730 {QMI_FIXED_INTF(0x05c6, 0x9046, 4)},
731 {QMI_FIXED_INTF(0x05c6, 0x9046, 5)},
732 {QMI_FIXED_INTF(0x05c6, 0x9047, 2)},
733 {QMI_FIXED_INTF(0x05c6, 0x9047, 3)},
734 {QMI_FIXED_INTF(0x05c6, 0x9047, 4)},
735 {QMI_FIXED_INTF(0x05c6, 0x9048, 4)},
736 {QMI_FIXED_INTF(0x05c6, 0x9048, 5)},
737 {QMI_FIXED_INTF(0x05c6, 0x9048, 6)},
738 {QMI_FIXED_INTF(0x05c6, 0x9048, 7)},
739 {QMI_FIXED_INTF(0x05c6, 0x9048, 8)},
740 {QMI_FIXED_INTF(0x05c6, 0x904c, 5)},
741 {QMI_FIXED_INTF(0x05c6, 0x904c, 6)},
742 {QMI_FIXED_INTF(0x05c6, 0x904c, 7)},
743 {QMI_FIXED_INTF(0x05c6, 0x904c, 8)},
744 {QMI_FIXED_INTF(0x05c6, 0x9050, 3)},
745 {QMI_FIXED_INTF(0x05c6, 0x9052, 4)},
746 {QMI_FIXED_INTF(0x05c6, 0x9053, 6)},
747 {QMI_FIXED_INTF(0x05c6, 0x9053, 7)},
748 {QMI_FIXED_INTF(0x05c6, 0x9054, 5)},
749 {QMI_FIXED_INTF(0x05c6, 0x9054, 6)},
750 {QMI_FIXED_INTF(0x05c6, 0x9055, 3)},
751 {QMI_FIXED_INTF(0x05c6, 0x9055, 4)},
752 {QMI_FIXED_INTF(0x05c6, 0x9055, 5)},
753 {QMI_FIXED_INTF(0x05c6, 0x9055, 6)},
754 {QMI_FIXED_INTF(0x05c6, 0x9055, 7)},
755 {QMI_FIXED_INTF(0x05c6, 0x9056, 3)},
756 {QMI_FIXED_INTF(0x05c6, 0x9062, 2)},
757 {QMI_FIXED_INTF(0x05c6, 0x9062, 3)},
758 {QMI_FIXED_INTF(0x05c6, 0x9062, 4)},
759 {QMI_FIXED_INTF(0x05c6, 0x9062, 5)},
760 {QMI_FIXED_INTF(0x05c6, 0x9062, 6)},
761 {QMI_FIXED_INTF(0x05c6, 0x9062, 7)},
762 {QMI_FIXED_INTF(0x05c6, 0x9062, 8)},
763 {QMI_FIXED_INTF(0x05c6, 0x9062, 9)},
764 {QMI_FIXED_INTF(0x05c6, 0x9064, 3)},
765 {QMI_FIXED_INTF(0x05c6, 0x9065, 6)},
766 {QMI_FIXED_INTF(0x05c6, 0x9065, 7)},
767 {QMI_FIXED_INTF(0x05c6, 0x9066, 5)},
768 {QMI_FIXED_INTF(0x05c6, 0x9066, 6)},
769 {QMI_FIXED_INTF(0x05c6, 0x9067, 1)},
770 {QMI_FIXED_INTF(0x05c6, 0x9068, 2)},
771 {QMI_FIXED_INTF(0x05c6, 0x9068, 3)},
772 {QMI_FIXED_INTF(0x05c6, 0x9068, 4)},
773 {QMI_FIXED_INTF(0x05c6, 0x9068, 5)},
774 {QMI_FIXED_INTF(0x05c6, 0x9068, 6)},
775 {QMI_FIXED_INTF(0x05c6, 0x9068, 7)},
776 {QMI_FIXED_INTF(0x05c6, 0x9069, 5)},
777 {QMI_FIXED_INTF(0x05c6, 0x9069, 6)},
778 {QMI_FIXED_INTF(0x05c6, 0x9069, 7)},
779 {QMI_FIXED_INTF(0x05c6, 0x9069, 8)},
780 {QMI_FIXED_INTF(0x05c6, 0x9070, 4)},
781 {QMI_FIXED_INTF(0x05c6, 0x9070, 5)},
782 {QMI_FIXED_INTF(0x05c6, 0x9075, 5)},
783 {QMI_FIXED_INTF(0x05c6, 0x9076, 4)},
784 {QMI_FIXED_INTF(0x05c6, 0x9076, 5)},
785 {QMI_FIXED_INTF(0x05c6, 0x9076, 6)},
786 {QMI_FIXED_INTF(0x05c6, 0x9076, 7)},
787 {QMI_FIXED_INTF(0x05c6, 0x9076, 8)},
788 {QMI_FIXED_INTF(0x05c6, 0x9077, 3)},
789 {QMI_FIXED_INTF(0x05c6, 0x9077, 4)},
790 {QMI_FIXED_INTF(0x05c6, 0x9077, 5)},
791 {QMI_FIXED_INTF(0x05c6, 0x9077, 6)},
792 {QMI_FIXED_INTF(0x05c6, 0x9078, 3)},
793 {QMI_FIXED_INTF(0x05c6, 0x9079, 4)},
794 {QMI_FIXED_INTF(0x05c6, 0x9079, 5)},
795 {QMI_FIXED_INTF(0x05c6, 0x9079, 6)},
796 {QMI_FIXED_INTF(0x05c6, 0x9079, 7)},
797 {QMI_FIXED_INTF(0x05c6, 0x9079, 8)},
798 {QMI_FIXED_INTF(0x05c6, 0x9080, 5)},
799 {QMI_FIXED_INTF(0x05c6, 0x9080, 6)},
800 {QMI_FIXED_INTF(0x05c6, 0x9080, 7)},
801 {QMI_FIXED_INTF(0x05c6, 0x9080, 8)},
802 {QMI_FIXED_INTF(0x05c6, 0x9083, 3)},
803 {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
804 {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
805 {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
Bjørn Mork53433302014-07-17 13:33:51 +0200806 {QMI_FIXED_INTF(0x0846, 0x68a2, 8)},
Bjørn Morkba695af2012-11-25 06:03:59 +0000807 {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */
Bjørn Morkc2020be2013-06-06 12:57:02 +0200808 {QMI_FIXED_INTF(0x12d1, 0x14ac, 1)}, /* Huawei E1820 */
Bjørn Mork41be7d92014-04-25 19:00:33 +0200809 {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */
810 {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */
811 {QMI_FIXED_INTF(0x16d8, 0x6008, 0)}, /* CMOTech CMU-301 */
812 {QMI_FIXED_INTF(0x16d8, 0x6280, 0)}, /* CMOTech CHU-628 */
813 {QMI_FIXED_INTF(0x16d8, 0x7001, 0)}, /* CMOTech CHU-720S */
814 {QMI_FIXED_INTF(0x16d8, 0x7002, 0)}, /* CMOTech 7002 */
815 {QMI_FIXED_INTF(0x16d8, 0x7003, 4)}, /* CMOTech CHU-629K */
816 {QMI_FIXED_INTF(0x16d8, 0x7004, 3)}, /* CMOTech 7004 */
817 {QMI_FIXED_INTF(0x16d8, 0x7006, 5)}, /* CMOTech CGU-629 */
818 {QMI_FIXED_INTF(0x16d8, 0x700a, 4)}, /* CMOTech CHU-629S */
819 {QMI_FIXED_INTF(0x16d8, 0x7211, 0)}, /* CMOTech CHU-720I */
820 {QMI_FIXED_INTF(0x16d8, 0x7212, 0)}, /* CMOTech 7212 */
821 {QMI_FIXED_INTF(0x16d8, 0x7213, 0)}, /* CMOTech 7213 */
822 {QMI_FIXED_INTF(0x16d8, 0x7251, 1)}, /* CMOTech 7251 */
823 {QMI_FIXED_INTF(0x16d8, 0x7252, 1)}, /* CMOTech 7252 */
824 {QMI_FIXED_INTF(0x16d8, 0x7253, 1)}, /* CMOTech 7253 */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000825 {QMI_FIXED_INTF(0x19d2, 0x0002, 1)},
826 {QMI_FIXED_INTF(0x19d2, 0x0012, 1)},
827 {QMI_FIXED_INTF(0x19d2, 0x0017, 3)},
Enrico Miosod8eb8f92013-06-29 15:39:19 +0200828 {QMI_FIXED_INTF(0x19d2, 0x0019, 3)}, /* ONDA MT689DC */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000829 {QMI_FIXED_INTF(0x19d2, 0x0021, 4)},
830 {QMI_FIXED_INTF(0x19d2, 0x0025, 1)},
831 {QMI_FIXED_INTF(0x19d2, 0x0031, 4)},
832 {QMI_FIXED_INTF(0x19d2, 0x0042, 4)},
833 {QMI_FIXED_INTF(0x19d2, 0x0049, 5)},
834 {QMI_FIXED_INTF(0x19d2, 0x0052, 4)},
Bjørn Mork03304bc2012-08-12 09:16:30 +0000835 {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000836 {QMI_FIXED_INTF(0x19d2, 0x0058, 4)},
Bjørn Mork03304bc2012-08-12 09:16:30 +0000837 {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */
838 {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000839 {QMI_FIXED_INTF(0x19d2, 0x0113, 5)},
840 {QMI_FIXED_INTF(0x19d2, 0x0118, 5)},
841 {QMI_FIXED_INTF(0x19d2, 0x0121, 5)},
842 {QMI_FIXED_INTF(0x19d2, 0x0123, 4)},
843 {QMI_FIXED_INTF(0x19d2, 0x0124, 5)},
844 {QMI_FIXED_INTF(0x19d2, 0x0125, 6)},
845 {QMI_FIXED_INTF(0x19d2, 0x0126, 5)},
846 {QMI_FIXED_INTF(0x19d2, 0x0130, 1)},
847 {QMI_FIXED_INTF(0x19d2, 0x0133, 3)},
848 {QMI_FIXED_INTF(0x19d2, 0x0141, 5)},
Bjørn Mork42d94dc2012-09-19 21:18:05 +0000849 {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000850 {QMI_FIXED_INTF(0x19d2, 0x0158, 3)},
Bjørn Mork03304bc2012-08-12 09:16:30 +0000851 {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000852 {QMI_FIXED_INTF(0x19d2, 0x0168, 4)},
853 {QMI_FIXED_INTF(0x19d2, 0x0176, 3)},
854 {QMI_FIXED_INTF(0x19d2, 0x0178, 3)},
855 {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */
856 {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */
857 {QMI_FIXED_INTF(0x19d2, 0x0200, 1)},
858 {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */
Bjørn Morkc1acd702013-01-18 04:26:34 +0000859 {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */
Bjørn Morkf8b84032012-12-19 04:15:51 +0000860 {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */
Bjørn Mork03304bc2012-08-12 09:16:30 +0000861 {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */
Teppo Kotilainen0decc642013-05-02 23:05:13 +0000862 {QMI_FIXED_INTF(0x19d2, 0x0412, 4)}, /* Telewell TW-LTE 4G */
Bjørn Mork03304bc2012-08-12 09:16:30 +0000863 {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */
864 {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000865 {QMI_FIXED_INTF(0x19d2, 0x1012, 4)},
Bjørn Mork10cbc1d2012-08-15 03:42:57 +0000866 {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000867 {QMI_FIXED_INTF(0x19d2, 0x1021, 2)},
868 {QMI_FIXED_INTF(0x19d2, 0x1245, 4)},
869 {QMI_FIXED_INTF(0x19d2, 0x1247, 4)},
870 {QMI_FIXED_INTF(0x19d2, 0x1252, 4)},
871 {QMI_FIXED_INTF(0x19d2, 0x1254, 4)},
872 {QMI_FIXED_INTF(0x19d2, 0x1255, 3)},
873 {QMI_FIXED_INTF(0x19d2, 0x1255, 4)},
874 {QMI_FIXED_INTF(0x19d2, 0x1256, 4)},
Raymond Wanyoike7653aab2014-02-09 00:01:02 +0300875 {QMI_FIXED_INTF(0x19d2, 0x1270, 5)}, /* ZTE MF667 */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000876 {QMI_FIXED_INTF(0x19d2, 0x1401, 2)},
Bjørn Mork03304bc2012-08-12 09:16:30 +0000877 {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */
Bjørn Morkc6846ee2012-10-18 05:11:29 +0000878 {QMI_FIXED_INTF(0x19d2, 0x1424, 2)},
879 {QMI_FIXED_INTF(0x19d2, 0x1425, 2)},
880 {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */
Bernd Wachter8dcb4b12014-07-01 22:01:09 +0300881 {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */
Bjørn Mork03304bc2012-08-12 09:16:30 +0000882 {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */
Bjørn Morke84810c2016-03-28 22:38:16 +0200883 {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */
Bjørn Mork9b469a62012-08-12 09:16:31 +0000884 {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */
885 {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
Bjørn Mork03304bc2012-08-12 09:16:30 +0000886 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
887 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
David Warde7040592015-08-31 14:15:14 -0400888 {QMI_FIXED_INTF(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354 */
889 {QMI_FIXED_INTF(0x1199, 0x68c0, 10)}, /* Sierra Wireless MC7304/MC7354 */
Bjørn Mork9b469a62012-08-12 09:16:31 +0000890 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
Bjørn Morkb85f5de2014-04-25 19:00:28 +0200891 {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
Bjørn Mork9214224e2014-04-25 19:00:30 +0200892 {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
Reinhard Speyerere3426ca2015-07-16 23:28:14 +0200893 {QMI_FIXED_INTF(0x1199, 0x9041, 10)}, /* Sierra Wireless MC7305/MC7355 */
Bjørn Morkfbd3a772014-02-04 13:04:33 +0100894 {QMI_FIXED_INTF(0x1199, 0x9051, 8)}, /* Netgear AirCard 340U */
Aleksander Morgado9a793e72014-05-29 13:44:45 +0200895 {QMI_FIXED_INTF(0x1199, 0x9053, 8)}, /* Sierra Wireless Modem */
896 {QMI_FIXED_INTF(0x1199, 0x9054, 8)}, /* Sierra Wireless Modem */
Aleksander Morgado4324be12014-05-28 21:05:03 +0200897 {QMI_FIXED_INTF(0x1199, 0x9055, 8)}, /* Netgear AirCard 341U */
Aleksander Morgado9a793e72014-05-29 13:44:45 +0200898 {QMI_FIXED_INTF(0x1199, 0x9056, 8)}, /* Sierra Wireless Modem */
Bjørn Mork53433302014-07-17 13:33:51 +0200899 {QMI_FIXED_INTF(0x1199, 0x9057, 8)},
Aleksander Morgado9a793e72014-05-29 13:44:45 +0200900 {QMI_FIXED_INTF(0x1199, 0x9061, 8)}, /* Sierra Wireless Modem */
Bjørn Morkbf13c942016-03-01 14:31:02 +0100901 {QMI_FIXED_INTF(0x1199, 0x9071, 8)}, /* Sierra Wireless MC74xx */
902 {QMI_FIXED_INTF(0x1199, 0x9071, 10)}, /* Sierra Wireless MC74xx */
903 {QMI_FIXED_INTF(0x1199, 0x9079, 8)}, /* Sierra Wireless EM74xx */
904 {QMI_FIXED_INTF(0x1199, 0x9079, 10)}, /* Sierra Wireless EM74xx */
Bjørn Mork68172662012-12-28 06:30:55 +0000905 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
Bjørn Mork75573662014-04-25 19:00:32 +0200906 {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */
Bjørn Mork30225512013-01-14 23:19:50 +0000907 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
Bjørn Morkd0b5e512013-06-28 17:17:51 +0200908 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
Daniele Palmas9bd813d2016-12-01 16:52:05 +0100909 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
Daniele Palmas3d6d7ab2013-01-30 02:47:06 +0000910 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
Fabio Porcedda905468f2013-09-25 11:21:25 +0200911 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
Bjørn Mork68242a52015-11-18 21:13:07 +0100912 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
Bjørn Morkba6de0f2014-06-06 17:27:59 +0200913 {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */
914 {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */
915 {QMI_FIXED_INTF(0x0b3c, 0xc002, 4)}, /* Olivetti Olicard 140 */
916 {QMI_FIXED_INTF(0x0b3c, 0xc004, 6)}, /* Olivetti Olicard 155 */
917 {QMI_FIXED_INTF(0x0b3c, 0xc005, 6)}, /* Olivetti Olicard 200 */
918 {QMI_FIXED_INTF(0x0b3c, 0xc00a, 6)}, /* Olivetti Olicard 160 */
Bjørn Morkefc0b252014-04-25 19:00:31 +0200919 {QMI_FIXED_INTF(0x0b3c, 0xc00b, 4)}, /* Olivetti Olicard 500 */
Aleksander Morgado2d77f342013-09-25 17:02:36 +0200920 {QMI_FIXED_INTF(0x1e2d, 0x0060, 4)}, /* Cinterion PLxx */
Aleksander Morgado9b2b6a22014-02-12 15:55:14 +0100921 {QMI_FIXED_INTF(0x1e2d, 0x0053, 4)}, /* Cinterion PHxx,PXxx */
Schemmel Hans-Christophbd9e3352016-03-17 10:07:56 +0000922 {QMI_FIXED_INTF(0x1e2d, 0x0082, 4)}, /* Cinterion PHxx,PXxx (2 RmNet) */
923 {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */
924 {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/
Bjørn Mork6f10c5d2014-04-25 19:00:34 +0200925 {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
926 {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
927 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
928 {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
929 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
Pieter Hollants2070c482015-07-20 10:14:13 +0200930 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
Patrik Halfarfb5eb24c2016-02-20 18:49:40 +0100931 {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
Bjørn Mork6bd845d2017-03-17 17:20:48 +0100932 {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
933 {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
David Warda8079092015-08-15 20:12:30 -0400934 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
Kristian Evensene439bd42016-01-06 14:15:50 +0100935 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
Kristian Evensen18715b22016-01-07 16:41:33 +0100936 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
Bjørn Mork9a765882016-10-10 21:12:49 +0200937 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */
938 {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */
Bjørn Mork03304bc2012-08-12 09:16:30 +0000939
940 /* 4. Gobi 1000 devices */
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000941 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
942 {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000943 {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */
944 {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */
Dan Williams8afe3dc2013-06-20 16:10:59 -0500945 {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel/Verizon USB-1000 */
946 {QMI_GOBI1K_DEVICE(0x1410, 0xa002)}, /* Novatel Gobi Modem device */
947 {QMI_GOBI1K_DEVICE(0x1410, 0xa003)}, /* Novatel Gobi Modem device */
948 {QMI_GOBI1K_DEVICE(0x1410, 0xa004)}, /* Novatel Gobi Modem device */
949 {QMI_GOBI1K_DEVICE(0x1410, 0xa005)}, /* Novatel Gobi Modem device */
950 {QMI_GOBI1K_DEVICE(0x1410, 0xa006)}, /* Novatel Gobi Modem device */
951 {QMI_GOBI1K_DEVICE(0x1410, 0xa007)}, /* Novatel Gobi Modem device */
Bjørn Morkb9f90eb2012-06-21 02:45:58 +0000952 {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
953 {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */
954 {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */
955 {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */
956 {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */
957 {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */
958 {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */
959 {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */
960
Bjørn Mork03304bc2012-08-12 09:16:30 +0000961 /* 5. Gobi 2000 and 3000 devices */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100962 {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
Bjørn Mork500220052012-09-01 03:47:26 +0000963 {QMI_GOBI_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100964 {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
965 {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
966 {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */
967 {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */
968 {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
Petr Štetiarb3d8cf02015-11-05 12:55:01 +0100969 {QMI_FIXED_INTF(0x05c6, 0x9215, 4)}, /* Quectel EC20 Mini PCIe */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100970 {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */
971 {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */
972 {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */
Bjørn Morkaa3aba12013-06-28 17:17:50 +0200973 {QMI_GOBI_DEVICE(0x0af0, 0x8120)}, /* Option GTM681W */
Bjørn Mork9b469a62012-08-12 09:16:31 +0000974 {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */
975 {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */
Bjørn Morkb086cf02012-03-09 12:35:06 +0100976 {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
977 {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
978 {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
979 {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
980 {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
981 {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
982 {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
983 {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
984 {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
985 {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */
986 {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */
987 {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */
988 {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */
989 {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */
Pierre Sauterb48d6f82012-09-10 07:02:59 +0000990 {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */
Bjørn Mork5e071b52012-05-23 23:19:32 +0000991 {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */
992 {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */
Bjørn Mork9b469a62012-08-12 09:16:31 +0000993 {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */
Bjørn Mork500220052012-09-01 03:47:26 +0000994 {QMI_GOBI_DEVICE(0x12d1, 0x14f1)}, /* Sony Gobi 3000 Composite */
Aleksander Morgadofa026e22012-08-28 02:30:32 +0000995 {QMI_GOBI_DEVICE(0x1410, 0xa021)}, /* Foxconn Gobi 3000 Modem device (Novatel E396) */
Bjørn Mork9b469a62012-08-12 09:16:31 +0000996
Bjørn Morkb086cf02012-03-09 12:35:06 +0100997 { } /* END */
Bjørn Mork423ce8c2012-01-19 15:37:22 +0000998};
999MODULE_DEVICE_TABLE(usb, products);
1000
Petr Štetiarb3d8cf02015-11-05 12:55:01 +01001001static bool quectel_ec20_detected(struct usb_interface *intf)
1002{
1003 struct usb_device *dev = interface_to_usbdev(intf);
1004
1005 if (dev->actconfig &&
1006 le16_to_cpu(dev->descriptor.idVendor) == 0x05c6 &&
1007 le16_to_cpu(dev->descriptor.idProduct) == 0x9215 &&
1008 dev->actconfig->desc.bNumInterfaces == 5)
1009 return true;
1010
1011 return false;
1012}
1013
Fabio Porceddae0584952013-09-25 11:21:26 +02001014static int qmi_wwan_probe(struct usb_interface *intf,
1015 const struct usb_device_id *prod)
Bjørn Mork1817e832012-07-17 11:14:32 +00001016{
1017 struct usb_device_id *id = (struct usb_device_id *)prod;
Petr Štetiarb3d8cf02015-11-05 12:55:01 +01001018 struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc;
Bjørn Mork1817e832012-07-17 11:14:32 +00001019
1020 /* Workaround to enable dynamic IDs. This disables usbnet
1021 * blacklisting functionality. Which, if required, can be
1022 * reimplemented here by using a magic "blacklist" value
1023 * instead of 0 in the static device id table
1024 */
1025 if (!id->driver_info) {
1026 dev_dbg(&intf->dev, "setting defaults for dynamic device id\n");
Bjørn Morkbd877e482012-09-07 07:36:07 +00001027 id->driver_info = (unsigned long)&qmi_wwan_info;
Bjørn Mork1817e832012-07-17 11:14:32 +00001028 }
1029
Petr Štetiarb3d8cf02015-11-05 12:55:01 +01001030 /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */
1031 if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) {
1032 dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n");
1033 return -ENODEV;
1034 }
1035
Bjørn Mork1817e832012-07-17 11:14:32 +00001036 return usbnet_probe(intf, id);
1037}
1038
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001039static struct usb_driver qmi_wwan_driver = {
1040 .name = "qmi_wwan",
1041 .id_table = products,
Bjørn Mork1817e832012-07-17 11:14:32 +00001042 .probe = qmi_wwan_probe,
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001043 .disconnect = usbnet_disconnect,
Bjørn Morkc3ecb082012-03-09 12:35:05 +01001044 .suspend = qmi_wwan_suspend,
1045 .resume = qmi_wwan_resume,
1046 .reset_resume = qmi_wwan_resume,
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001047 .supports_autosuspend = 1,
Sarah Sharpe1f12eb2012-04-23 10:08:51 -07001048 .disable_hub_initiated_lpm = 1,
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001049};
1050
Bjørn Mork677a3d62012-06-19 00:42:03 +00001051module_usb_driver(qmi_wwan_driver);
Bjørn Mork423ce8c2012-01-19 15:37:22 +00001052
1053MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
1054MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver");
1055MODULE_LICENSE("GPL");