Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> |
| 3 | * |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 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 | * |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 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> |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 20 | #include <linux/usb/cdc-wdm.h> |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 21 | |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 22 | /* This driver supports wwan (3G/LTE/?) devices using a vendor |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 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 | * |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 34 | * Alternatively, control and data functions can be combined in a |
| 35 | * single USB interface. |
| 36 | * |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 37 | * Handling a protocol like QMI is out of the scope for any driver. |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 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. |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 41 | * |
| 42 | * These devices may alternatively/additionally be configured using AT |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 43 | * commands on a serial interface |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 44 | */ |
| 45 | |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 46 | /* driver specific data */ |
| 47 | struct qmi_wwan_state { |
| 48 | struct usb_driver *subdriver; |
| 49 | atomic_t pmcount; |
Bjørn Mork | f47cd13 | 2012-06-19 00:42:00 +0000 | [diff] [blame] | 50 | unsigned long unused; |
| 51 | struct usb_interface *control; |
| 52 | struct usb_interface *data; |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 53 | }; |
| 54 | |
Bjørn Mork | f47cd13 | 2012-06-19 00:42:00 +0000 | [diff] [blame] | 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); |
David S. Miller | b26d344 | 2012-06-28 17:37:00 -0700 | [diff] [blame] | 78 | |
| 79 | /* can be called while disconnecting */ |
| 80 | if (!dev) |
| 81 | return 0; |
Bjørn Mork | f47cd13 | 2012-06-19 00:42:00 +0000 | [diff] [blame] | 82 | return qmi_wwan_manage_power(dev, on); |
| 83 | } |
| 84 | |
| 85 | /* collect all three endpoints and register subdriver */ |
| 86 | static int qmi_wwan_register_subdriver(struct usbnet *dev) |
| 87 | { |
| 88 | int rv; |
| 89 | struct usb_driver *subdriver = NULL; |
| 90 | struct qmi_wwan_state *info = (void *)&dev->data; |
| 91 | |
| 92 | /* collect bulk endpoints */ |
| 93 | rv = usbnet_get_endpoints(dev, info->data); |
| 94 | if (rv < 0) |
| 95 | goto err; |
| 96 | |
| 97 | /* update status endpoint if separate control interface */ |
| 98 | if (info->control != info->data) |
| 99 | dev->status = &info->control->cur_altsetting->endpoint[0]; |
| 100 | |
| 101 | /* require interrupt endpoint for subdriver */ |
| 102 | if (!dev->status) { |
| 103 | rv = -EINVAL; |
| 104 | goto err; |
| 105 | } |
| 106 | |
| 107 | /* for subdriver power management */ |
| 108 | atomic_set(&info->pmcount, 0); |
| 109 | |
| 110 | /* register subdriver */ |
Bjørn Mork | 3ee2403 | 2012-09-07 07:36:06 +0000 | [diff] [blame] | 111 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 4096, &qmi_wwan_cdc_wdm_manage_power); |
Bjørn Mork | f47cd13 | 2012-06-19 00:42:00 +0000 | [diff] [blame] | 112 | if (IS_ERR(subdriver)) { |
| 113 | dev_err(&info->control->dev, "subdriver registration failed\n"); |
| 114 | rv = PTR_ERR(subdriver); |
| 115 | goto err; |
| 116 | } |
| 117 | |
| 118 | /* prevent usbnet from using status endpoint */ |
| 119 | dev->status = NULL; |
| 120 | |
| 121 | /* save subdriver struct for suspend/resume wrappers */ |
| 122 | info->subdriver = subdriver; |
| 123 | |
| 124 | err: |
| 125 | return rv; |
| 126 | } |
| 127 | |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 128 | static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) |
| 129 | { |
| 130 | int status = -1; |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 131 | u8 *buf = intf->cur_altsetting->extra; |
| 132 | int len = intf->cur_altsetting->extralen; |
| 133 | struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; |
| 134 | struct usb_cdc_union_desc *cdc_union = NULL; |
| 135 | struct usb_cdc_ether_desc *cdc_ether = NULL; |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 136 | u32 found = 0; |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 137 | struct usb_driver *driver = driver_of(intf); |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 138 | struct qmi_wwan_state *info = (void *)&dev->data; |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 139 | |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); |
| 141 | |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 142 | /* control and data is shared? */ |
| 143 | if (intf->cur_altsetting->desc.bNumEndpoints == 3) { |
| 144 | info->control = intf; |
| 145 | info->data = intf; |
| 146 | goto shared; |
| 147 | } |
| 148 | |
| 149 | /* else require a single interrupt status endpoint on control intf */ |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 150 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) |
| 151 | goto err; |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 152 | |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 153 | /* and a number of CDC descriptors */ |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 154 | while (len > 3) { |
| 155 | struct usb_descriptor_header *h = (void *)buf; |
| 156 | |
| 157 | /* ignore any misplaced descriptors */ |
| 158 | if (h->bDescriptorType != USB_DT_CS_INTERFACE) |
| 159 | goto next_desc; |
| 160 | |
| 161 | /* buf[2] is CDC descriptor subtype */ |
| 162 | switch (buf[2]) { |
| 163 | case USB_CDC_HEADER_TYPE: |
| 164 | if (found & 1 << USB_CDC_HEADER_TYPE) { |
| 165 | dev_dbg(&intf->dev, "extra CDC header\n"); |
| 166 | goto err; |
| 167 | } |
| 168 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { |
| 169 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); |
| 170 | goto err; |
| 171 | } |
| 172 | break; |
| 173 | case USB_CDC_UNION_TYPE: |
| 174 | if (found & 1 << USB_CDC_UNION_TYPE) { |
| 175 | dev_dbg(&intf->dev, "extra CDC union\n"); |
| 176 | goto err; |
| 177 | } |
| 178 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { |
| 179 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); |
| 180 | goto err; |
| 181 | } |
| 182 | cdc_union = (struct usb_cdc_union_desc *)buf; |
| 183 | break; |
| 184 | case USB_CDC_ETHERNET_TYPE: |
| 185 | if (found & 1 << USB_CDC_ETHERNET_TYPE) { |
| 186 | dev_dbg(&intf->dev, "extra CDC ether\n"); |
| 187 | goto err; |
| 188 | } |
| 189 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { |
| 190 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); |
| 191 | goto err; |
| 192 | } |
| 193 | cdc_ether = (struct usb_cdc_ether_desc *)buf; |
| 194 | break; |
| 195 | } |
| 196 | |
| 197 | /* |
| 198 | * Remember which CDC functional descriptors we've seen. Works |
| 199 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE |
| 200 | * (0x0f) is the highest numbered |
| 201 | */ |
| 202 | if (buf[2] < 32) |
| 203 | found |= 1 << buf[2]; |
| 204 | |
| 205 | next_desc: |
| 206 | len -= h->bLength; |
| 207 | buf += h->bLength; |
| 208 | } |
| 209 | |
| 210 | /* did we find all the required ones? */ |
Dan Carpenter | 5ac2497 | 2012-06-25 22:39:45 +0000 | [diff] [blame] | 211 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || |
| 212 | !(found & (1 << USB_CDC_UNION_TYPE))) { |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 213 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); |
| 214 | goto err; |
| 215 | } |
| 216 | |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 217 | /* verify CDC Union */ |
| 218 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { |
| 219 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); |
| 220 | goto err; |
| 221 | } |
| 222 | |
| 223 | /* need to save these for unbind */ |
| 224 | info->control = intf; |
| 225 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); |
| 226 | if (!info->data) { |
| 227 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 228 | goto err; |
| 229 | } |
| 230 | |
| 231 | /* errors aren't fatal - we can live with the dynamic address */ |
| 232 | if (cdc_ether) { |
| 233 | dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize); |
| 234 | usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress); |
| 235 | } |
| 236 | |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 237 | /* claim data interface and set it up */ |
| 238 | status = usb_driver_claim_interface(driver, info->data, dev); |
| 239 | if (status < 0) |
| 240 | goto err; |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 241 | |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 242 | shared: |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 243 | status = qmi_wwan_register_subdriver(dev); |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 244 | if (status < 0 && info->control != info->data) { |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 245 | usb_set_intfdata(info->data, NULL); |
| 246 | usb_driver_release_interface(driver, info->data); |
| 247 | } |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 248 | |
| 249 | err: |
| 250 | return status; |
| 251 | } |
| 252 | |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 253 | static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 254 | { |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 255 | struct qmi_wwan_state *info = (void *)&dev->data; |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 256 | struct usb_driver *driver = driver_of(intf); |
| 257 | struct usb_interface *other; |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 258 | |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 259 | if (info->subdriver && info->subdriver->disconnect) |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 260 | info->subdriver->disconnect(info->control); |
| 261 | |
| 262 | /* allow user to unbind using either control or data */ |
| 263 | if (intf == info->control) |
| 264 | other = info->data; |
| 265 | else |
| 266 | other = info->control; |
| 267 | |
| 268 | /* only if not shared */ |
| 269 | if (other && intf != other) { |
| 270 | usb_set_intfdata(other, NULL); |
| 271 | usb_driver_release_interface(driver, other); |
| 272 | } |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 273 | |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 274 | info->subdriver = NULL; |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 275 | info->data = NULL; |
| 276 | info->control = NULL; |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | /* suspend/resume wrappers calling both usbnet and the cdc-wdm |
| 280 | * subdriver if present. |
| 281 | * |
| 282 | * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide |
| 283 | * wrappers for those without adding usbnet reset support first. |
| 284 | */ |
| 285 | static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) |
| 286 | { |
| 287 | struct usbnet *dev = usb_get_intfdata(intf); |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 288 | struct qmi_wwan_state *info = (void *)&dev->data; |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 289 | int ret; |
| 290 | |
| 291 | ret = usbnet_suspend(intf, message); |
| 292 | if (ret < 0) |
| 293 | goto err; |
| 294 | |
Bjørn Mork | 8624dd2 | 2012-09-12 20:44:35 +0000 | [diff] [blame] | 295 | if (intf == info->control && info->subdriver && info->subdriver->suspend) |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 296 | ret = info->subdriver->suspend(intf, message); |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 297 | if (ret < 0) |
| 298 | usbnet_resume(intf); |
| 299 | err: |
| 300 | return ret; |
| 301 | } |
| 302 | |
| 303 | static int qmi_wwan_resume(struct usb_interface *intf) |
| 304 | { |
| 305 | struct usbnet *dev = usb_get_intfdata(intf); |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 306 | struct qmi_wwan_state *info = (void *)&dev->data; |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 307 | int ret = 0; |
Bjørn Mork | 8624dd2 | 2012-09-12 20:44:35 +0000 | [diff] [blame] | 308 | bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume); |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 309 | |
Bjørn Mork | 8624dd2 | 2012-09-12 20:44:35 +0000 | [diff] [blame] | 310 | if (callsub) |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 311 | ret = info->subdriver->resume(intf); |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 312 | if (ret < 0) |
| 313 | goto err; |
| 314 | ret = usbnet_resume(intf); |
Bjørn Mork | 8624dd2 | 2012-09-12 20:44:35 +0000 | [diff] [blame] | 315 | if (ret < 0 && callsub && info->subdriver->suspend) |
Bjørn Mork | 853c24f | 2012-06-19 00:41:59 +0000 | [diff] [blame] | 316 | info->subdriver->suspend(intf, PMSG_SUSPEND); |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 317 | err: |
| 318 | return ret; |
| 319 | } |
| 320 | |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 321 | static const struct driver_info qmi_wwan_info = { |
Bjørn Mork | a40345b | 2012-06-19 00:42:02 +0000 | [diff] [blame] | 322 | .description = "WWAN/QMI device", |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 323 | .flags = FLAG_WWAN, |
| 324 | .bind = qmi_wwan_bind, |
Bjørn Mork | 230718b | 2012-06-19 00:42:01 +0000 | [diff] [blame] | 325 | .unbind = qmi_wwan_unbind, |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 326 | .manage_power = qmi_wwan_manage_power, |
| 327 | }; |
| 328 | |
| 329 | #define HUAWEI_VENDOR_ID 0x12D1 |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 330 | |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 331 | /* map QMI/wwan function by a fixed interface number */ |
| 332 | #define QMI_FIXED_INTF(vend, prod, num) \ |
| 333 | USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 334 | .driver_info = (unsigned long)&qmi_wwan_info |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 335 | |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 336 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ |
| 337 | #define QMI_GOBI1K_DEVICE(vend, prod) \ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 338 | QMI_FIXED_INTF(vend, prod, 3) |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 339 | |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 340 | /* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 341 | #define QMI_GOBI_DEVICE(vend, prod) \ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 342 | QMI_FIXED_INTF(vend, prod, 0) |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 343 | |
| 344 | static const struct usb_device_id products[] = { |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 345 | /* 1. CDC ECM like devices match on the control interface */ |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 346 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
Bjørn Mork | 5ea4296 | 2012-08-12 09:16:32 +0000 | [diff] [blame] | 347 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9), |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 348 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 349 | }, |
Bjørn Mork | 88c16dc | 2012-05-19 07:20:31 +0000 | [diff] [blame] | 350 | { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ |
Bjørn Mork | 5ea4296 | 2012-08-12 09:16:32 +0000 | [diff] [blame] | 351 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), |
Bjørn Mork | 88c16dc | 2012-05-19 07:20:31 +0000 | [diff] [blame] | 352 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 353 | }, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 354 | |
| 355 | /* 2. Combined interface devices matching on class+protocol */ |
Bjørn Mork | 9db273f | 2012-09-19 10:03:36 +0000 | [diff] [blame] | 356 | { /* Huawei E367 and possibly others in "Windows mode" */ |
Bjørn Mork | 42d94dc | 2012-09-19 21:18:05 +0000 | [diff] [blame] | 357 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7), |
| 358 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 359 | }, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 360 | { /* Huawei E392, E398 and possibly others in "Windows mode" */ |
Bjørn Mork | 5ea4296 | 2012-08-12 09:16:32 +0000 | [diff] [blame] | 361 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 362 | .driver_info = (unsigned long)&qmi_wwan_info, |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 363 | }, |
Bjørn Mork | 9db273f | 2012-09-19 10:03:36 +0000 | [diff] [blame] | 364 | { /* Pantech UML290, P4200 and more */ |
Bjørn Mork | 42d94dc | 2012-09-19 21:18:05 +0000 | [diff] [blame] | 365 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 366 | .driver_info = (unsigned long)&qmi_wwan_info, |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 367 | }, |
Bjørn Mork | 10cbc1d | 2012-08-15 03:42:57 +0000 | [diff] [blame] | 368 | { /* Pantech UML290 - newer firmware */ |
Bjørn Mork | 42d94dc | 2012-09-19 21:18:05 +0000 | [diff] [blame] | 369 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 370 | .driver_info = (unsigned long)&qmi_wwan_info, |
Bjørn Mork | 10cbc1d | 2012-08-15 03:42:57 +0000 | [diff] [blame] | 371 | }, |
Dan Williams | f8295ec | 2012-10-24 12:10:34 +0000 | [diff] [blame] | 372 | { /* Novatel USB551L and MC551 */ |
| 373 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001, |
| 374 | USB_CLASS_COMM, |
| 375 | USB_CDC_SUBCLASS_ETHERNET, |
| 376 | USB_CDC_PROTO_NONE), |
| 377 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 378 | }, |
| 379 | { /* Novatel E362 */ |
| 380 | USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010, |
| 381 | USB_CLASS_COMM, |
| 382 | USB_CDC_SUBCLASS_ETHERNET, |
| 383 | USB_CDC_PROTO_NONE), |
| 384 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 385 | }, |
Dan Williams | 0370acd | 2012-12-17 08:17:41 +0000 | [diff] [blame^] | 386 | { /* Dell Wireless 5800 (Novatel E362) */ |
| 387 | USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8195, |
| 388 | USB_CLASS_COMM, |
| 389 | USB_CDC_SUBCLASS_ETHERNET, |
| 390 | USB_CDC_PROTO_NONE), |
| 391 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 392 | }, |
| 393 | { /* Dell Wireless 5800 V2 (Novatel E362) */ |
| 394 | USB_DEVICE_AND_INTERFACE_INFO(0x413C, 0x8196, |
| 395 | USB_CLASS_COMM, |
| 396 | USB_CDC_SUBCLASS_ETHERNET, |
| 397 | USB_CDC_PROTO_NONE), |
| 398 | .driver_info = (unsigned long)&qmi_wwan_info, |
| 399 | }, |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 400 | |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 401 | /* 3. Combined interface devices matching on interface number */ |
Bjørn Mork | ba695af | 2012-11-25 06:03:59 +0000 | [diff] [blame] | 402 | {QMI_FIXED_INTF(0x12d1, 0x140c, 1)}, /* Huawei E173 */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 403 | {QMI_FIXED_INTF(0x19d2, 0x0002, 1)}, |
| 404 | {QMI_FIXED_INTF(0x19d2, 0x0012, 1)}, |
| 405 | {QMI_FIXED_INTF(0x19d2, 0x0017, 3)}, |
| 406 | {QMI_FIXED_INTF(0x19d2, 0x0021, 4)}, |
| 407 | {QMI_FIXED_INTF(0x19d2, 0x0025, 1)}, |
| 408 | {QMI_FIXED_INTF(0x19d2, 0x0031, 4)}, |
| 409 | {QMI_FIXED_INTF(0x19d2, 0x0042, 4)}, |
| 410 | {QMI_FIXED_INTF(0x19d2, 0x0049, 5)}, |
| 411 | {QMI_FIXED_INTF(0x19d2, 0x0052, 4)}, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 412 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 413 | {QMI_FIXED_INTF(0x19d2, 0x0058, 4)}, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 414 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ |
| 415 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 416 | {QMI_FIXED_INTF(0x19d2, 0x0113, 5)}, |
| 417 | {QMI_FIXED_INTF(0x19d2, 0x0118, 5)}, |
| 418 | {QMI_FIXED_INTF(0x19d2, 0x0121, 5)}, |
| 419 | {QMI_FIXED_INTF(0x19d2, 0x0123, 4)}, |
| 420 | {QMI_FIXED_INTF(0x19d2, 0x0124, 5)}, |
| 421 | {QMI_FIXED_INTF(0x19d2, 0x0125, 6)}, |
| 422 | {QMI_FIXED_INTF(0x19d2, 0x0126, 5)}, |
| 423 | {QMI_FIXED_INTF(0x19d2, 0x0130, 1)}, |
| 424 | {QMI_FIXED_INTF(0x19d2, 0x0133, 3)}, |
| 425 | {QMI_FIXED_INTF(0x19d2, 0x0141, 5)}, |
Bjørn Mork | 42d94dc | 2012-09-19 21:18:05 +0000 | [diff] [blame] | 426 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 427 | {QMI_FIXED_INTF(0x19d2, 0x0158, 3)}, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 428 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 429 | {QMI_FIXED_INTF(0x19d2, 0x0168, 4)}, |
| 430 | {QMI_FIXED_INTF(0x19d2, 0x0176, 3)}, |
| 431 | {QMI_FIXED_INTF(0x19d2, 0x0178, 3)}, |
| 432 | {QMI_FIXED_INTF(0x19d2, 0x0191, 4)}, /* ZTE EuFi890 */ |
| 433 | {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ |
| 434 | {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, |
| 435 | {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 436 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
| 437 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
| 438 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 439 | {QMI_FIXED_INTF(0x19d2, 0x1012, 4)}, |
Bjørn Mork | 10cbc1d | 2012-08-15 03:42:57 +0000 | [diff] [blame] | 440 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 441 | {QMI_FIXED_INTF(0x19d2, 0x1021, 2)}, |
| 442 | {QMI_FIXED_INTF(0x19d2, 0x1245, 4)}, |
| 443 | {QMI_FIXED_INTF(0x19d2, 0x1247, 4)}, |
| 444 | {QMI_FIXED_INTF(0x19d2, 0x1252, 4)}, |
| 445 | {QMI_FIXED_INTF(0x19d2, 0x1254, 4)}, |
| 446 | {QMI_FIXED_INTF(0x19d2, 0x1255, 3)}, |
| 447 | {QMI_FIXED_INTF(0x19d2, 0x1255, 4)}, |
| 448 | {QMI_FIXED_INTF(0x19d2, 0x1256, 4)}, |
| 449 | {QMI_FIXED_INTF(0x19d2, 0x1401, 2)}, |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 450 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ |
Bjørn Mork | c6846ee | 2012-10-18 05:11:29 +0000 | [diff] [blame] | 451 | {QMI_FIXED_INTF(0x19d2, 0x1424, 2)}, |
| 452 | {QMI_FIXED_INTF(0x19d2, 0x1425, 2)}, |
| 453 | {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 454 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 455 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
| 456 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 457 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ |
| 458 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 459 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 460 | |
| 461 | /* 4. Gobi 1000 devices */ |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 462 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
| 463 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
Bjørn Mork | b9f90eb | 2012-06-21 02:45:58 +0000 | [diff] [blame] | 464 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
| 465 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
| 466 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
| 467 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
| 468 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
| 469 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
| 470 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
| 471 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
| 472 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
| 473 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ |
| 474 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ |
| 475 | |
Bjørn Mork | 03304bc | 2012-08-12 09:16:30 +0000 | [diff] [blame] | 476 | /* 5. Gobi 2000 and 3000 devices */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 477 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
Bjørn Mork | 50022005 | 2012-09-01 03:47:26 +0000 | [diff] [blame] | 478 | {QMI_GOBI_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 479 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ |
Bjørn Mork | 50022005 | 2012-09-01 03:47:26 +0000 | [diff] [blame] | 480 | {QMI_GOBI_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 481 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
| 482 | {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ |
| 483 | {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ |
| 484 | {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ |
| 485 | {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ |
| 486 | {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ |
| 487 | {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 488 | {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ |
| 489 | {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 490 | {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 491 | {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 492 | {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 493 | {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 494 | {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 495 | {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 496 | {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 497 | {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 498 | {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 499 | {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
| 500 | {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 501 | {QMI_FIXED_INTF(0x1199, 0x9011, 5)}, /* alternate interface number!? */ |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 502 | {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ |
| 503 | {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ |
| 504 | {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ |
Pierre Sauter | b48d6f8 | 2012-09-10 07:02:59 +0000 | [diff] [blame] | 505 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
Bjørn Mork | 5e071b5 | 2012-05-23 23:19:32 +0000 | [diff] [blame] | 506 | {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ |
| 507 | {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 508 | {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ |
Bjørn Mork | 50022005 | 2012-09-01 03:47:26 +0000 | [diff] [blame] | 509 | {QMI_GOBI_DEVICE(0x12d1, 0x14f1)}, /* Sony Gobi 3000 Composite */ |
Aleksander Morgado | fa026e2 | 2012-08-28 02:30:32 +0000 | [diff] [blame] | 510 | {QMI_GOBI_DEVICE(0x1410, 0xa021)}, /* Foxconn Gobi 3000 Modem device (Novatel E396) */ |
Bjørn Mork | 9b469a6 | 2012-08-12 09:16:31 +0000 | [diff] [blame] | 511 | |
Bjørn Mork | b086cf0 | 2012-03-09 12:35:06 +0100 | [diff] [blame] | 512 | { } /* END */ |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 513 | }; |
| 514 | MODULE_DEVICE_TABLE(usb, products); |
| 515 | |
Bjørn Mork | 1817e83 | 2012-07-17 11:14:32 +0000 | [diff] [blame] | 516 | static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) |
| 517 | { |
| 518 | struct usb_device_id *id = (struct usb_device_id *)prod; |
| 519 | |
| 520 | /* Workaround to enable dynamic IDs. This disables usbnet |
| 521 | * blacklisting functionality. Which, if required, can be |
| 522 | * reimplemented here by using a magic "blacklist" value |
| 523 | * instead of 0 in the static device id table |
| 524 | */ |
| 525 | if (!id->driver_info) { |
| 526 | dev_dbg(&intf->dev, "setting defaults for dynamic device id\n"); |
Bjørn Mork | bd877e48 | 2012-09-07 07:36:07 +0000 | [diff] [blame] | 527 | id->driver_info = (unsigned long)&qmi_wwan_info; |
Bjørn Mork | 1817e83 | 2012-07-17 11:14:32 +0000 | [diff] [blame] | 528 | } |
| 529 | |
| 530 | return usbnet_probe(intf, id); |
| 531 | } |
| 532 | |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 533 | static struct usb_driver qmi_wwan_driver = { |
| 534 | .name = "qmi_wwan", |
| 535 | .id_table = products, |
Bjørn Mork | 1817e83 | 2012-07-17 11:14:32 +0000 | [diff] [blame] | 536 | .probe = qmi_wwan_probe, |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 537 | .disconnect = usbnet_disconnect, |
Bjørn Mork | c3ecb08 | 2012-03-09 12:35:05 +0100 | [diff] [blame] | 538 | .suspend = qmi_wwan_suspend, |
| 539 | .resume = qmi_wwan_resume, |
| 540 | .reset_resume = qmi_wwan_resume, |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 541 | .supports_autosuspend = 1, |
Sarah Sharp | e1f12eb | 2012-04-23 10:08:51 -0700 | [diff] [blame] | 542 | .disable_hub_initiated_lpm = 1, |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 543 | }; |
| 544 | |
Bjørn Mork | 677a3d6 | 2012-06-19 00:42:03 +0000 | [diff] [blame] | 545 | module_usb_driver(qmi_wwan_driver); |
Bjørn Mork | 423ce8c | 2012-01-19 15:37:22 +0000 | [diff] [blame] | 546 | |
| 547 | MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>"); |
| 548 | MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver"); |
| 549 | MODULE_LICENSE("GPL"); |