Commit 9db273f45686218e055a3738f3311048cbb54fee
Committed by
David S. Miller
1 parent
bc26ccd8fc
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
net: qmi_wwan: adding Huawei E367, ZTE MF683 and Pantech P4200
One of the modes of Huawei E367 has this QMI/wwan interface: I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=07 Driver=(none) E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms Huawei use subclass and protocol to identify vendor specific functions, so adding a new vendor rule for this combination. The Pantech devices UML290 (106c:3718) and P4200 (106c:3721) use the same subclass to identify the QMI/wwan function. Replace the existing device specific UML290 entries with generic vendor matching, adding support for the Pantech P4200. The ZTE MF683 has 6 vendor specific interfaces, all using ff/ff/ff for cls/sub/prot. Adding a match on interface #5 which is a QMI/wwan interface. Cc: Fangxiaozhi (Franko) <fangxiaozhi@huawei.com> Cc: Thomas Schäfer <tschaefer@t-online.de> Cc: Dan Williams <dcbw@redhat.com> Cc: Shawn J. Goff <shawn7400@gmail.com> Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 8 additions and 3 deletions Inline Diff
drivers/net/usb/qmi_wwan.c
1 | /* | 1 | /* |
2 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> | 2 | * Copyright (c) 2012 Bjørn Mork <bjorn@mork.no> |
3 | * | 3 | * |
4 | * The probing code is heavily inspired by cdc_ether, which is: | 4 | * The probing code is heavily inspired by cdc_ether, which is: |
5 | * Copyright (C) 2003-2005 by David Brownell | 5 | * Copyright (C) 2003-2005 by David Brownell |
6 | * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync) | 6 | * Copyright (C) 2006 by Ole Andre Vadla Ravnas (ActiveSync) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 9 | * modify it under the terms of the GNU General Public License |
10 | * version 2 as published by the Free Software Foundation. | 10 | * version 2 as published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/ethtool.h> | 15 | #include <linux/ethtool.h> |
16 | #include <linux/mii.h> | 16 | #include <linux/mii.h> |
17 | #include <linux/usb.h> | 17 | #include <linux/usb.h> |
18 | #include <linux/usb/cdc.h> | 18 | #include <linux/usb/cdc.h> |
19 | #include <linux/usb/usbnet.h> | 19 | #include <linux/usb/usbnet.h> |
20 | #include <linux/usb/cdc-wdm.h> | 20 | #include <linux/usb/cdc-wdm.h> |
21 | 21 | ||
22 | /* This driver supports wwan (3G/LTE/?) devices using a vendor | 22 | /* This driver supports wwan (3G/LTE/?) devices using a vendor |
23 | * specific management protocol called Qualcomm MSM Interface (QMI) - | 23 | * specific management protocol called Qualcomm MSM Interface (QMI) - |
24 | * in addition to the more common AT commands over serial interface | 24 | * in addition to the more common AT commands over serial interface |
25 | * management | 25 | * management |
26 | * | 26 | * |
27 | * QMI is wrapped in CDC, using CDC encapsulated commands on the | 27 | * QMI is wrapped in CDC, using CDC encapsulated commands on the |
28 | * control ("master") interface of a two-interface CDC Union | 28 | * control ("master") interface of a two-interface CDC Union |
29 | * resembling standard CDC ECM. The devices do not use the control | 29 | * resembling standard CDC ECM. The devices do not use the control |
30 | * interface for any other CDC messages. Most likely because the | 30 | * interface for any other CDC messages. Most likely because the |
31 | * management protocol is used in place of the standard CDC | 31 | * management protocol is used in place of the standard CDC |
32 | * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE | 32 | * notifications NOTIFY_NETWORK_CONNECTION and NOTIFY_SPEED_CHANGE |
33 | * | 33 | * |
34 | * Alternatively, control and data functions can be combined in a | 34 | * Alternatively, control and data functions can be combined in a |
35 | * single USB interface. | 35 | * single USB interface. |
36 | * | 36 | * |
37 | * Handling a protocol like QMI is out of the scope for any driver. | 37 | * Handling a protocol like QMI is out of the scope for any driver. |
38 | * It is exported as a character device using the cdc-wdm driver as | 38 | * It is exported as a character device using the cdc-wdm driver as |
39 | * a subdriver, enabling userspace applications ("modem managers") to | 39 | * a subdriver, enabling userspace applications ("modem managers") to |
40 | * handle it. | 40 | * handle it. |
41 | * | 41 | * |
42 | * These devices may alternatively/additionally be configured using AT | 42 | * These devices may alternatively/additionally be configured using AT |
43 | * commands on a serial interface | 43 | * commands on a serial interface |
44 | */ | 44 | */ |
45 | 45 | ||
46 | /* driver specific data */ | 46 | /* driver specific data */ |
47 | struct qmi_wwan_state { | 47 | struct qmi_wwan_state { |
48 | struct usb_driver *subdriver; | 48 | struct usb_driver *subdriver; |
49 | atomic_t pmcount; | 49 | atomic_t pmcount; |
50 | unsigned long unused; | 50 | unsigned long unused; |
51 | struct usb_interface *control; | 51 | struct usb_interface *control; |
52 | struct usb_interface *data; | 52 | struct usb_interface *data; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | /* using a counter to merge subdriver requests with our own into a combined state */ | 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) | 56 | static int qmi_wwan_manage_power(struct usbnet *dev, int on) |
57 | { | 57 | { |
58 | struct qmi_wwan_state *info = (void *)&dev->data; | 58 | struct qmi_wwan_state *info = (void *)&dev->data; |
59 | int rv = 0; | 59 | int rv = 0; |
60 | 60 | ||
61 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on); | 61 | dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on); |
62 | 62 | ||
63 | if ((on && atomic_add_return(1, &info->pmcount) == 1) || (!on && atomic_dec_and_test(&info->pmcount))) { | 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 */ | 64 | /* need autopm_get/put here to ensure the usbcore sees the new value */ |
65 | rv = usb_autopm_get_interface(dev->intf); | 65 | rv = usb_autopm_get_interface(dev->intf); |
66 | if (rv < 0) | 66 | if (rv < 0) |
67 | goto err; | 67 | goto err; |
68 | dev->intf->needs_remote_wakeup = on; | 68 | dev->intf->needs_remote_wakeup = on; |
69 | usb_autopm_put_interface(dev->intf); | 69 | usb_autopm_put_interface(dev->intf); |
70 | } | 70 | } |
71 | err: | 71 | err: |
72 | return rv; | 72 | return rv; |
73 | } | 73 | } |
74 | 74 | ||
75 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) | 75 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) |
76 | { | 76 | { |
77 | struct usbnet *dev = usb_get_intfdata(intf); | 77 | struct usbnet *dev = usb_get_intfdata(intf); |
78 | 78 | ||
79 | /* can be called while disconnecting */ | 79 | /* can be called while disconnecting */ |
80 | if (!dev) | 80 | if (!dev) |
81 | return 0; | 81 | return 0; |
82 | return qmi_wwan_manage_power(dev, on); | 82 | return qmi_wwan_manage_power(dev, on); |
83 | } | 83 | } |
84 | 84 | ||
85 | /* collect all three endpoints and register subdriver */ | 85 | /* collect all three endpoints and register subdriver */ |
86 | static int qmi_wwan_register_subdriver(struct usbnet *dev) | 86 | static int qmi_wwan_register_subdriver(struct usbnet *dev) |
87 | { | 87 | { |
88 | int rv; | 88 | int rv; |
89 | struct usb_driver *subdriver = NULL; | 89 | struct usb_driver *subdriver = NULL; |
90 | struct qmi_wwan_state *info = (void *)&dev->data; | 90 | struct qmi_wwan_state *info = (void *)&dev->data; |
91 | 91 | ||
92 | /* collect bulk endpoints */ | 92 | /* collect bulk endpoints */ |
93 | rv = usbnet_get_endpoints(dev, info->data); | 93 | rv = usbnet_get_endpoints(dev, info->data); |
94 | if (rv < 0) | 94 | if (rv < 0) |
95 | goto err; | 95 | goto err; |
96 | 96 | ||
97 | /* update status endpoint if separate control interface */ | 97 | /* update status endpoint if separate control interface */ |
98 | if (info->control != info->data) | 98 | if (info->control != info->data) |
99 | dev->status = &info->control->cur_altsetting->endpoint[0]; | 99 | dev->status = &info->control->cur_altsetting->endpoint[0]; |
100 | 100 | ||
101 | /* require interrupt endpoint for subdriver */ | 101 | /* require interrupt endpoint for subdriver */ |
102 | if (!dev->status) { | 102 | if (!dev->status) { |
103 | rv = -EINVAL; | 103 | rv = -EINVAL; |
104 | goto err; | 104 | goto err; |
105 | } | 105 | } |
106 | 106 | ||
107 | /* for subdriver power management */ | 107 | /* for subdriver power management */ |
108 | atomic_set(&info->pmcount, 0); | 108 | atomic_set(&info->pmcount, 0); |
109 | 109 | ||
110 | /* register subdriver */ | 110 | /* register subdriver */ |
111 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power); | 111 | subdriver = usb_cdc_wdm_register(info->control, &dev->status->desc, 512, &qmi_wwan_cdc_wdm_manage_power); |
112 | if (IS_ERR(subdriver)) { | 112 | if (IS_ERR(subdriver)) { |
113 | dev_err(&info->control->dev, "subdriver registration failed\n"); | 113 | dev_err(&info->control->dev, "subdriver registration failed\n"); |
114 | rv = PTR_ERR(subdriver); | 114 | rv = PTR_ERR(subdriver); |
115 | goto err; | 115 | goto err; |
116 | } | 116 | } |
117 | 117 | ||
118 | /* prevent usbnet from using status endpoint */ | 118 | /* prevent usbnet from using status endpoint */ |
119 | dev->status = NULL; | 119 | dev->status = NULL; |
120 | 120 | ||
121 | /* save subdriver struct for suspend/resume wrappers */ | 121 | /* save subdriver struct for suspend/resume wrappers */ |
122 | info->subdriver = subdriver; | 122 | info->subdriver = subdriver; |
123 | 123 | ||
124 | err: | 124 | err: |
125 | return rv; | 125 | return rv; |
126 | } | 126 | } |
127 | 127 | ||
128 | static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) | 128 | static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) |
129 | { | 129 | { |
130 | int status = -1; | 130 | int status = -1; |
131 | u8 *buf = intf->cur_altsetting->extra; | 131 | u8 *buf = intf->cur_altsetting->extra; |
132 | int len = intf->cur_altsetting->extralen; | 132 | int len = intf->cur_altsetting->extralen; |
133 | struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; | 133 | struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; |
134 | struct usb_cdc_union_desc *cdc_union = NULL; | 134 | struct usb_cdc_union_desc *cdc_union = NULL; |
135 | struct usb_cdc_ether_desc *cdc_ether = NULL; | 135 | struct usb_cdc_ether_desc *cdc_ether = NULL; |
136 | u32 found = 0; | 136 | u32 found = 0; |
137 | struct usb_driver *driver = driver_of(intf); | 137 | struct usb_driver *driver = driver_of(intf); |
138 | struct qmi_wwan_state *info = (void *)&dev->data; | 138 | struct qmi_wwan_state *info = (void *)&dev->data; |
139 | 139 | ||
140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); | 140 | BUILD_BUG_ON((sizeof(((struct usbnet *)0)->data) < sizeof(struct qmi_wwan_state))); |
141 | 141 | ||
142 | /* require a single interrupt status endpoint for subdriver */ | 142 | /* require a single interrupt status endpoint for subdriver */ |
143 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) | 143 | if (intf->cur_altsetting->desc.bNumEndpoints != 1) |
144 | goto err; | 144 | goto err; |
145 | 145 | ||
146 | while (len > 3) { | 146 | while (len > 3) { |
147 | struct usb_descriptor_header *h = (void *)buf; | 147 | struct usb_descriptor_header *h = (void *)buf; |
148 | 148 | ||
149 | /* ignore any misplaced descriptors */ | 149 | /* ignore any misplaced descriptors */ |
150 | if (h->bDescriptorType != USB_DT_CS_INTERFACE) | 150 | if (h->bDescriptorType != USB_DT_CS_INTERFACE) |
151 | goto next_desc; | 151 | goto next_desc; |
152 | 152 | ||
153 | /* buf[2] is CDC descriptor subtype */ | 153 | /* buf[2] is CDC descriptor subtype */ |
154 | switch (buf[2]) { | 154 | switch (buf[2]) { |
155 | case USB_CDC_HEADER_TYPE: | 155 | case USB_CDC_HEADER_TYPE: |
156 | if (found & 1 << USB_CDC_HEADER_TYPE) { | 156 | if (found & 1 << USB_CDC_HEADER_TYPE) { |
157 | dev_dbg(&intf->dev, "extra CDC header\n"); | 157 | dev_dbg(&intf->dev, "extra CDC header\n"); |
158 | goto err; | 158 | goto err; |
159 | } | 159 | } |
160 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { | 160 | if (h->bLength != sizeof(struct usb_cdc_header_desc)) { |
161 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); | 161 | dev_dbg(&intf->dev, "CDC header len %u\n", h->bLength); |
162 | goto err; | 162 | goto err; |
163 | } | 163 | } |
164 | break; | 164 | break; |
165 | case USB_CDC_UNION_TYPE: | 165 | case USB_CDC_UNION_TYPE: |
166 | if (found & 1 << USB_CDC_UNION_TYPE) { | 166 | if (found & 1 << USB_CDC_UNION_TYPE) { |
167 | dev_dbg(&intf->dev, "extra CDC union\n"); | 167 | dev_dbg(&intf->dev, "extra CDC union\n"); |
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { | 170 | if (h->bLength != sizeof(struct usb_cdc_union_desc)) { |
171 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); | 171 | dev_dbg(&intf->dev, "CDC union len %u\n", h->bLength); |
172 | goto err; | 172 | goto err; |
173 | } | 173 | } |
174 | cdc_union = (struct usb_cdc_union_desc *)buf; | 174 | cdc_union = (struct usb_cdc_union_desc *)buf; |
175 | break; | 175 | break; |
176 | case USB_CDC_ETHERNET_TYPE: | 176 | case USB_CDC_ETHERNET_TYPE: |
177 | if (found & 1 << USB_CDC_ETHERNET_TYPE) { | 177 | if (found & 1 << USB_CDC_ETHERNET_TYPE) { |
178 | dev_dbg(&intf->dev, "extra CDC ether\n"); | 178 | dev_dbg(&intf->dev, "extra CDC ether\n"); |
179 | goto err; | 179 | goto err; |
180 | } | 180 | } |
181 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { | 181 | if (h->bLength != sizeof(struct usb_cdc_ether_desc)) { |
182 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); | 182 | dev_dbg(&intf->dev, "CDC ether len %u\n", h->bLength); |
183 | goto err; | 183 | goto err; |
184 | } | 184 | } |
185 | cdc_ether = (struct usb_cdc_ether_desc *)buf; | 185 | cdc_ether = (struct usb_cdc_ether_desc *)buf; |
186 | break; | 186 | break; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* | 189 | /* |
190 | * Remember which CDC functional descriptors we've seen. Works | 190 | * Remember which CDC functional descriptors we've seen. Works |
191 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE | 191 | * for all types we care about, of which USB_CDC_ETHERNET_TYPE |
192 | * (0x0f) is the highest numbered | 192 | * (0x0f) is the highest numbered |
193 | */ | 193 | */ |
194 | if (buf[2] < 32) | 194 | if (buf[2] < 32) |
195 | found |= 1 << buf[2]; | 195 | found |= 1 << buf[2]; |
196 | 196 | ||
197 | next_desc: | 197 | next_desc: |
198 | len -= h->bLength; | 198 | len -= h->bLength; |
199 | buf += h->bLength; | 199 | buf += h->bLength; |
200 | } | 200 | } |
201 | 201 | ||
202 | /* did we find all the required ones? */ | 202 | /* did we find all the required ones? */ |
203 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || | 203 | if (!(found & (1 << USB_CDC_HEADER_TYPE)) || |
204 | !(found & (1 << USB_CDC_UNION_TYPE))) { | 204 | !(found & (1 << USB_CDC_UNION_TYPE))) { |
205 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); | 205 | dev_err(&intf->dev, "CDC functional descriptors missing\n"); |
206 | goto err; | 206 | goto err; |
207 | } | 207 | } |
208 | 208 | ||
209 | /* verify CDC Union */ | 209 | /* verify CDC Union */ |
210 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { | 210 | if (desc->bInterfaceNumber != cdc_union->bMasterInterface0) { |
211 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); | 211 | dev_err(&intf->dev, "bogus CDC Union: master=%u\n", cdc_union->bMasterInterface0); |
212 | goto err; | 212 | goto err; |
213 | } | 213 | } |
214 | 214 | ||
215 | /* need to save these for unbind */ | 215 | /* need to save these for unbind */ |
216 | info->control = intf; | 216 | info->control = intf; |
217 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); | 217 | info->data = usb_ifnum_to_if(dev->udev, cdc_union->bSlaveInterface0); |
218 | if (!info->data) { | 218 | if (!info->data) { |
219 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); | 219 | dev_err(&intf->dev, "bogus CDC Union: slave=%u\n", cdc_union->bSlaveInterface0); |
220 | goto err; | 220 | goto err; |
221 | } | 221 | } |
222 | 222 | ||
223 | /* errors aren't fatal - we can live with the dynamic address */ | 223 | /* errors aren't fatal - we can live with the dynamic address */ |
224 | if (cdc_ether) { | 224 | if (cdc_ether) { |
225 | dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize); | 225 | dev->hard_mtu = le16_to_cpu(cdc_ether->wMaxSegmentSize); |
226 | usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress); | 226 | usbnet_get_ethernet_addr(dev, cdc_ether->iMACAddress); |
227 | } | 227 | } |
228 | 228 | ||
229 | /* claim data interface and set it up */ | 229 | /* claim data interface and set it up */ |
230 | status = usb_driver_claim_interface(driver, info->data, dev); | 230 | status = usb_driver_claim_interface(driver, info->data, dev); |
231 | if (status < 0) | 231 | if (status < 0) |
232 | goto err; | 232 | goto err; |
233 | 233 | ||
234 | status = qmi_wwan_register_subdriver(dev); | 234 | status = qmi_wwan_register_subdriver(dev); |
235 | if (status < 0) { | 235 | if (status < 0) { |
236 | usb_set_intfdata(info->data, NULL); | 236 | usb_set_intfdata(info->data, NULL); |
237 | usb_driver_release_interface(driver, info->data); | 237 | usb_driver_release_interface(driver, info->data); |
238 | } | 238 | } |
239 | 239 | ||
240 | err: | 240 | err: |
241 | return status; | 241 | return status; |
242 | } | 242 | } |
243 | 243 | ||
244 | /* Some devices combine the "control" and "data" functions into a | 244 | /* Some devices combine the "control" and "data" functions into a |
245 | * single interface with all three endpoints: interrupt + bulk in and | 245 | * single interface with all three endpoints: interrupt + bulk in and |
246 | * out | 246 | * out |
247 | */ | 247 | */ |
248 | static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf) | 248 | static int qmi_wwan_bind_shared(struct usbnet *dev, struct usb_interface *intf) |
249 | { | 249 | { |
250 | struct qmi_wwan_state *info = (void *)&dev->data; | 250 | struct qmi_wwan_state *info = (void *)&dev->data; |
251 | 251 | ||
252 | /* control and data is shared */ | 252 | /* control and data is shared */ |
253 | info->control = intf; | 253 | info->control = intf; |
254 | info->data = intf; | 254 | info->data = intf; |
255 | return qmi_wwan_register_subdriver(dev); | 255 | return qmi_wwan_register_subdriver(dev); |
256 | } | 256 | } |
257 | 257 | ||
258 | static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) | 258 | static void qmi_wwan_unbind(struct usbnet *dev, struct usb_interface *intf) |
259 | { | 259 | { |
260 | struct qmi_wwan_state *info = (void *)&dev->data; | 260 | struct qmi_wwan_state *info = (void *)&dev->data; |
261 | struct usb_driver *driver = driver_of(intf); | 261 | struct usb_driver *driver = driver_of(intf); |
262 | struct usb_interface *other; | 262 | struct usb_interface *other; |
263 | 263 | ||
264 | if (info->subdriver && info->subdriver->disconnect) | 264 | if (info->subdriver && info->subdriver->disconnect) |
265 | info->subdriver->disconnect(info->control); | 265 | info->subdriver->disconnect(info->control); |
266 | 266 | ||
267 | /* allow user to unbind using either control or data */ | 267 | /* allow user to unbind using either control or data */ |
268 | if (intf == info->control) | 268 | if (intf == info->control) |
269 | other = info->data; | 269 | other = info->data; |
270 | else | 270 | else |
271 | other = info->control; | 271 | other = info->control; |
272 | 272 | ||
273 | /* only if not shared */ | 273 | /* only if not shared */ |
274 | if (other && intf != other) { | 274 | if (other && intf != other) { |
275 | usb_set_intfdata(other, NULL); | 275 | usb_set_intfdata(other, NULL); |
276 | usb_driver_release_interface(driver, other); | 276 | usb_driver_release_interface(driver, other); |
277 | } | 277 | } |
278 | 278 | ||
279 | info->subdriver = NULL; | 279 | info->subdriver = NULL; |
280 | info->data = NULL; | 280 | info->data = NULL; |
281 | info->control = NULL; | 281 | info->control = NULL; |
282 | } | 282 | } |
283 | 283 | ||
284 | /* suspend/resume wrappers calling both usbnet and the cdc-wdm | 284 | /* suspend/resume wrappers calling both usbnet and the cdc-wdm |
285 | * subdriver if present. | 285 | * subdriver if present. |
286 | * | 286 | * |
287 | * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide | 287 | * NOTE: cdc-wdm also supports pre/post_reset, but we cannot provide |
288 | * wrappers for those without adding usbnet reset support first. | 288 | * wrappers for those without adding usbnet reset support first. |
289 | */ | 289 | */ |
290 | static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) | 290 | static int qmi_wwan_suspend(struct usb_interface *intf, pm_message_t message) |
291 | { | 291 | { |
292 | struct usbnet *dev = usb_get_intfdata(intf); | 292 | struct usbnet *dev = usb_get_intfdata(intf); |
293 | struct qmi_wwan_state *info = (void *)&dev->data; | 293 | struct qmi_wwan_state *info = (void *)&dev->data; |
294 | int ret; | 294 | int ret; |
295 | 295 | ||
296 | ret = usbnet_suspend(intf, message); | 296 | ret = usbnet_suspend(intf, message); |
297 | if (ret < 0) | 297 | if (ret < 0) |
298 | goto err; | 298 | goto err; |
299 | 299 | ||
300 | if (intf == info->control && info->subdriver && info->subdriver->suspend) | 300 | if (intf == info->control && info->subdriver && info->subdriver->suspend) |
301 | ret = info->subdriver->suspend(intf, message); | 301 | ret = info->subdriver->suspend(intf, message); |
302 | if (ret < 0) | 302 | if (ret < 0) |
303 | usbnet_resume(intf); | 303 | usbnet_resume(intf); |
304 | err: | 304 | err: |
305 | return ret; | 305 | return ret; |
306 | } | 306 | } |
307 | 307 | ||
308 | static int qmi_wwan_resume(struct usb_interface *intf) | 308 | static int qmi_wwan_resume(struct usb_interface *intf) |
309 | { | 309 | { |
310 | struct usbnet *dev = usb_get_intfdata(intf); | 310 | struct usbnet *dev = usb_get_intfdata(intf); |
311 | struct qmi_wwan_state *info = (void *)&dev->data; | 311 | struct qmi_wwan_state *info = (void *)&dev->data; |
312 | int ret = 0; | 312 | int ret = 0; |
313 | bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume); | 313 | bool callsub = (intf == info->control && info->subdriver && info->subdriver->resume); |
314 | 314 | ||
315 | if (callsub) | 315 | if (callsub) |
316 | ret = info->subdriver->resume(intf); | 316 | ret = info->subdriver->resume(intf); |
317 | if (ret < 0) | 317 | if (ret < 0) |
318 | goto err; | 318 | goto err; |
319 | ret = usbnet_resume(intf); | 319 | ret = usbnet_resume(intf); |
320 | if (ret < 0 && callsub && info->subdriver->suspend) | 320 | if (ret < 0 && callsub && info->subdriver->suspend) |
321 | info->subdriver->suspend(intf, PMSG_SUSPEND); | 321 | info->subdriver->suspend(intf, PMSG_SUSPEND); |
322 | err: | 322 | err: |
323 | return ret; | 323 | return ret; |
324 | } | 324 | } |
325 | 325 | ||
326 | static const struct driver_info qmi_wwan_info = { | 326 | static const struct driver_info qmi_wwan_info = { |
327 | .description = "WWAN/QMI device", | 327 | .description = "WWAN/QMI device", |
328 | .flags = FLAG_WWAN, | 328 | .flags = FLAG_WWAN, |
329 | .bind = qmi_wwan_bind, | 329 | .bind = qmi_wwan_bind, |
330 | .unbind = qmi_wwan_unbind, | 330 | .unbind = qmi_wwan_unbind, |
331 | .manage_power = qmi_wwan_manage_power, | 331 | .manage_power = qmi_wwan_manage_power, |
332 | }; | 332 | }; |
333 | 333 | ||
334 | static const struct driver_info qmi_wwan_shared = { | 334 | static const struct driver_info qmi_wwan_shared = { |
335 | .description = "WWAN/QMI device", | 335 | .description = "WWAN/QMI device", |
336 | .flags = FLAG_WWAN, | 336 | .flags = FLAG_WWAN, |
337 | .bind = qmi_wwan_bind_shared, | 337 | .bind = qmi_wwan_bind_shared, |
338 | .unbind = qmi_wwan_unbind, | 338 | .unbind = qmi_wwan_unbind, |
339 | .manage_power = qmi_wwan_manage_power, | 339 | .manage_power = qmi_wwan_manage_power, |
340 | }; | 340 | }; |
341 | 341 | ||
342 | #define HUAWEI_VENDOR_ID 0x12D1 | 342 | #define HUAWEI_VENDOR_ID 0x12D1 |
343 | 343 | ||
344 | /* map QMI/wwan function by a fixed interface number */ | 344 | /* map QMI/wwan function by a fixed interface number */ |
345 | #define QMI_FIXED_INTF(vend, prod, num) \ | 345 | #define QMI_FIXED_INTF(vend, prod, num) \ |
346 | USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ | 346 | USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \ |
347 | .driver_info = (unsigned long)&qmi_wwan_shared | 347 | .driver_info = (unsigned long)&qmi_wwan_shared |
348 | 348 | ||
349 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ | 349 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ |
350 | #define QMI_GOBI1K_DEVICE(vend, prod) \ | 350 | #define QMI_GOBI1K_DEVICE(vend, prod) \ |
351 | QMI_FIXED_INTF(vend, prod, 3) | 351 | QMI_FIXED_INTF(vend, prod, 3) |
352 | 352 | ||
353 | /* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */ | 353 | /* Gobi 2000/3000 QMI/wwan interface number is 0 according to qcserial */ |
354 | #define QMI_GOBI_DEVICE(vend, prod) \ | 354 | #define QMI_GOBI_DEVICE(vend, prod) \ |
355 | QMI_FIXED_INTF(vend, prod, 0) | 355 | QMI_FIXED_INTF(vend, prod, 0) |
356 | 356 | ||
357 | static const struct usb_device_id products[] = { | 357 | static const struct usb_device_id products[] = { |
358 | /* 1. CDC ECM like devices match on the control interface */ | 358 | /* 1. CDC ECM like devices match on the control interface */ |
359 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ | 359 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
360 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9), | 360 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 9), |
361 | .driver_info = (unsigned long)&qmi_wwan_info, | 361 | .driver_info = (unsigned long)&qmi_wwan_info, |
362 | }, | 362 | }, |
363 | { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ | 363 | { /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ |
364 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), | 364 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57), |
365 | .driver_info = (unsigned long)&qmi_wwan_info, | 365 | .driver_info = (unsigned long)&qmi_wwan_info, |
366 | }, | 366 | }, |
367 | 367 | ||
368 | /* 2. Combined interface devices matching on class+protocol */ | 368 | /* 2. Combined interface devices matching on class+protocol */ |
369 | { /* Huawei E367 and possibly others in "Windows mode" */ | ||
370 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 7), | ||
371 | .driver_info = (unsigned long)&qmi_wwan_info, | ||
372 | }, | ||
369 | { /* Huawei E392, E398 and possibly others in "Windows mode" */ | 373 | { /* Huawei E392, E398 and possibly others in "Windows mode" */ |
370 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), | 374 | USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 17), |
371 | .driver_info = (unsigned long)&qmi_wwan_shared, | 375 | .driver_info = (unsigned long)&qmi_wwan_shared, |
372 | }, | 376 | }, |
373 | { /* Pantech UML290 */ | 377 | { /* Pantech UML290, P4200 and more */ |
374 | USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), | 378 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf0, 0xff), |
375 | .driver_info = (unsigned long)&qmi_wwan_shared, | 379 | .driver_info = (unsigned long)&qmi_wwan_shared, |
376 | }, | 380 | }, |
377 | { /* Pantech UML290 - newer firmware */ | 381 | { /* Pantech UML290 - newer firmware */ |
378 | USB_DEVICE_AND_INTERFACE_INFO(0x106c, 0x3718, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), | 382 | USB_VENDOR_AND_INTERFACE_INFO(0x106c, USB_CLASS_VENDOR_SPEC, 0xf1, 0xff), |
379 | .driver_info = (unsigned long)&qmi_wwan_shared, | 383 | .driver_info = (unsigned long)&qmi_wwan_shared, |
380 | }, | 384 | }, |
381 | 385 | ||
382 | /* 3. Combined interface devices matching on interface number */ | 386 | /* 3. Combined interface devices matching on interface number */ |
383 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ | 387 | {QMI_FIXED_INTF(0x19d2, 0x0055, 1)}, /* ZTE (Vodafone) K3520-Z */ |
384 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ | 388 | {QMI_FIXED_INTF(0x19d2, 0x0063, 4)}, /* ZTE (Vodafone) K3565-Z */ |
385 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ | 389 | {QMI_FIXED_INTF(0x19d2, 0x0104, 4)}, /* ZTE (Vodafone) K4505-Z */ |
390 | {QMI_FIXED_INTF(0x19d2, 0x0157, 5)}, /* ZTE MF683 */ | ||
386 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ | 391 | {QMI_FIXED_INTF(0x19d2, 0x0167, 4)}, /* ZTE MF820D */ |
387 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ | 392 | {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ |
388 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ | 393 | {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ |
389 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ | 394 | {QMI_FIXED_INTF(0x19d2, 0x1010, 4)}, /* ZTE (Vodafone) K3571-Z */ |
390 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ | 395 | {QMI_FIXED_INTF(0x19d2, 0x1018, 3)}, /* ZTE (Vodafone) K5006-Z */ |
391 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ | 396 | {QMI_FIXED_INTF(0x19d2, 0x1402, 2)}, /* ZTE MF60 */ |
392 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ | 397 | {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ |
393 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ | 398 | {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ |
394 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ | 399 | {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ |
395 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ | 400 | {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ |
396 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ | 401 | {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ |
397 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ | 402 | {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ |
398 | 403 | ||
399 | /* 4. Gobi 1000 devices */ | 404 | /* 4. Gobi 1000 devices */ |
400 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 405 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
401 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 406 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
402 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ | 407 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
403 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ | 408 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
404 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ | 409 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
405 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ | 410 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
406 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ | 411 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
407 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ | 412 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
408 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ | 413 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
409 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ | 414 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
410 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ | 415 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
411 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | 416 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ |
412 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | 417 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ |
413 | 418 | ||
414 | /* 5. Gobi 2000 and 3000 devices */ | 419 | /* 5. Gobi 2000 and 3000 devices */ |
415 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ | 420 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
416 | {QMI_GOBI_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ | 421 | {QMI_GOBI_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ |
417 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | 422 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ |
418 | {QMI_GOBI_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */ | 423 | {QMI_GOBI_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */ |
419 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | 424 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
420 | {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ | 425 | {QMI_GOBI_DEVICE(0x05c6, 0x9245)}, /* Samsung Gobi 2000 Modem device (VL176) */ |
421 | {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ | 426 | {QMI_GOBI_DEVICE(0x03f0, 0x251d)}, /* HP Gobi 2000 Modem device (VP412) */ |
422 | {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ | 427 | {QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */ |
423 | {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ | 428 | {QMI_GOBI_DEVICE(0x05c6, 0x9265)}, /* Asus Gobi 2000 Modem device (VR305) */ |
424 | {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ | 429 | {QMI_GOBI_DEVICE(0x05c6, 0x9235)}, /* Top Global Gobi 2000 Modem device (VR306) */ |
425 | {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ | 430 | {QMI_GOBI_DEVICE(0x05c6, 0x9275)}, /* iRex Technologies Gobi 2000 Modem device (VR307) */ |
426 | {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ | 431 | {QMI_GOBI_DEVICE(0x1199, 0x68a5)}, /* Sierra Wireless Modem */ |
427 | {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ | 432 | {QMI_GOBI_DEVICE(0x1199, 0x68a9)}, /* Sierra Wireless Modem */ |
428 | {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 433 | {QMI_GOBI_DEVICE(0x1199, 0x9001)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
429 | {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 434 | {QMI_GOBI_DEVICE(0x1199, 0x9002)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
430 | {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 435 | {QMI_GOBI_DEVICE(0x1199, 0x9003)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
431 | {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 436 | {QMI_GOBI_DEVICE(0x1199, 0x9004)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
432 | {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 437 | {QMI_GOBI_DEVICE(0x1199, 0x9005)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
433 | {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 438 | {QMI_GOBI_DEVICE(0x1199, 0x9006)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
434 | {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 439 | {QMI_GOBI_DEVICE(0x1199, 0x9007)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
435 | {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 440 | {QMI_GOBI_DEVICE(0x1199, 0x9008)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
436 | {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 441 | {QMI_GOBI_DEVICE(0x1199, 0x9009)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
437 | {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ | 442 | {QMI_GOBI_DEVICE(0x1199, 0x900a)}, /* Sierra Wireless Gobi 2000 Modem device (VT773) */ |
438 | {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */ | 443 | {QMI_GOBI_DEVICE(0x1199, 0x9011)}, /* Sierra Wireless Gobi 2000 Modem device (MC8305) */ |
439 | {QMI_FIXED_INTF(0x1199, 0x9011, 5)}, /* alternate interface number!? */ | 444 | {QMI_FIXED_INTF(0x1199, 0x9011, 5)}, /* alternate interface number!? */ |
440 | {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ | 445 | {QMI_GOBI_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ |
441 | {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ | 446 | {QMI_GOBI_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ |
442 | {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ | 447 | {QMI_GOBI_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ |
443 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 448 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
444 | {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ | 449 | {QMI_GOBI_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ |
445 | {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ | 450 | {QMI_GOBI_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ |
446 | {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ | 451 | {QMI_GOBI_DEVICE(0x1199, 0x901b)}, /* Sierra Wireless MC7770 */ |
447 | {QMI_GOBI_DEVICE(0x12d1, 0x14f1)}, /* Sony Gobi 3000 Composite */ | 452 | {QMI_GOBI_DEVICE(0x12d1, 0x14f1)}, /* Sony Gobi 3000 Composite */ |
448 | {QMI_GOBI_DEVICE(0x1410, 0xa021)}, /* Foxconn Gobi 3000 Modem device (Novatel E396) */ | 453 | {QMI_GOBI_DEVICE(0x1410, 0xa021)}, /* Foxconn Gobi 3000 Modem device (Novatel E396) */ |
449 | 454 | ||
450 | { } /* END */ | 455 | { } /* END */ |
451 | }; | 456 | }; |
452 | MODULE_DEVICE_TABLE(usb, products); | 457 | MODULE_DEVICE_TABLE(usb, products); |
453 | 458 | ||
454 | static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) | 459 | static int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod) |
455 | { | 460 | { |
456 | struct usb_device_id *id = (struct usb_device_id *)prod; | 461 | struct usb_device_id *id = (struct usb_device_id *)prod; |
457 | 462 | ||
458 | /* Workaround to enable dynamic IDs. This disables usbnet | 463 | /* Workaround to enable dynamic IDs. This disables usbnet |
459 | * blacklisting functionality. Which, if required, can be | 464 | * blacklisting functionality. Which, if required, can be |
460 | * reimplemented here by using a magic "blacklist" value | 465 | * reimplemented here by using a magic "blacklist" value |
461 | * instead of 0 in the static device id table | 466 | * instead of 0 in the static device id table |
462 | */ | 467 | */ |
463 | if (!id->driver_info) { | 468 | if (!id->driver_info) { |
464 | dev_dbg(&intf->dev, "setting defaults for dynamic device id\n"); | 469 | dev_dbg(&intf->dev, "setting defaults for dynamic device id\n"); |
465 | id->driver_info = (unsigned long)&qmi_wwan_shared; | 470 | id->driver_info = (unsigned long)&qmi_wwan_shared; |
466 | } | 471 | } |
467 | 472 | ||
468 | return usbnet_probe(intf, id); | 473 | return usbnet_probe(intf, id); |
469 | } | 474 | } |
470 | 475 | ||
471 | static struct usb_driver qmi_wwan_driver = { | 476 | static struct usb_driver qmi_wwan_driver = { |
472 | .name = "qmi_wwan", | 477 | .name = "qmi_wwan", |
473 | .id_table = products, | 478 | .id_table = products, |
474 | .probe = qmi_wwan_probe, | 479 | .probe = qmi_wwan_probe, |
475 | .disconnect = usbnet_disconnect, | 480 | .disconnect = usbnet_disconnect, |
476 | .suspend = qmi_wwan_suspend, | 481 | .suspend = qmi_wwan_suspend, |
477 | .resume = qmi_wwan_resume, | 482 | .resume = qmi_wwan_resume, |
478 | .reset_resume = qmi_wwan_resume, | 483 | .reset_resume = qmi_wwan_resume, |
479 | .supports_autosuspend = 1, | 484 | .supports_autosuspend = 1, |
480 | .disable_hub_initiated_lpm = 1, | 485 | .disable_hub_initiated_lpm = 1, |
481 | }; | 486 | }; |
482 | 487 | ||
483 | module_usb_driver(qmi_wwan_driver); | 488 | module_usb_driver(qmi_wwan_driver); |
484 | 489 | ||
485 | MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>"); | 490 | MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>"); |
486 | MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver"); | 491 | MODULE_DESCRIPTION("Qualcomm MSM Interface (QMI) WWAN driver"); |
487 | MODULE_LICENSE("GPL"); | 492 | MODULE_LICENSE("GPL"); |
488 | 493 |