13 #include <linux/module.h>
14 #include <linux/netdevice.h>
15 #include <linux/ethtool.h>
16 #include <linux/mii.h>
56 static int qmi_wwan_manage_power(
struct usbnet *
dev,
int on)
65 rv = usb_autopm_get_interface(dev->
intf);
68 dev->
intf->needs_remote_wakeup = on;
69 usb_autopm_put_interface(dev->
intf);
77 struct usbnet *
dev = usb_get_intfdata(intf);
82 return qmi_wwan_manage_power(dev, on);
86 static int qmi_wwan_register_subdriver(
struct usbnet *dev)
89 struct usb_driver *subdriver =
NULL;
112 if (IS_ERR(subdriver)) {
114 rv = PTR_ERR(subdriver);
131 u8 *
buf = intf->cur_altsetting->extra;
132 int len = intf->cur_altsetting->extralen;
137 struct usb_driver *
driver = driver_of(intf);
143 if (intf->cur_altsetting->desc.bNumEndpoints == 3) {
150 if (intf->cur_altsetting->desc.bNumEndpoints != 1)
165 dev_dbg(&intf->dev,
"extra CDC header\n");
175 dev_dbg(&intf->dev,
"extra CDC union\n");
186 dev_dbg(&intf->dev,
"extra CDC ether\n");
203 found |= 1 << buf[2];
213 dev_err(&intf->dev,
"CDC functional descriptors missing\n");
243 status = qmi_wwan_register_subdriver(dev);
256 struct usb_driver *driver = driver_of(intf);
269 if (other && intf != other) {
270 usb_set_intfdata(other,
NULL);
287 struct usbnet *dev = usb_get_intfdata(intf);
305 struct usbnet *dev = usb_get_intfdata(intf);
315 if (ret < 0 && callsub && info->subdriver->suspend)
322 .description =
"WWAN/QMI device",
324 .bind = qmi_wwan_bind,
325 .unbind = qmi_wwan_unbind,
326 .manage_power = qmi_wwan_manage_power,
329 #define HUAWEI_VENDOR_ID 0x12D1
332 #define QMI_FIXED_INTF(vend, prod, num) \
333 USB_DEVICE_INTERFACE_NUMBER(vend, prod, num), \
334 .driver_info = (unsigned long)&qmi_wwan_info
337 #define QMI_GOBI1K_DEVICE(vend, prod) \
338 QMI_FIXED_INTF(vend, prod, 3)
341 #define QMI_GOBI_DEVICE(vend, prod) \
342 QMI_FIXED_INTF(vend, prod, 0)
348 .driver_info = (
unsigned long)&qmi_wwan_info,
352 .driver_info = (
unsigned long)&qmi_wwan_info,
358 .driver_info = (
unsigned long)&qmi_wwan_info,
362 .driver_info = (
unsigned long)&qmi_wwan_info,
366 .driver_info = (
unsigned long)&qmi_wwan_info,
370 .driver_info = (
unsigned long)&qmi_wwan_info,
373 USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001,
377 .driver_info = (
unsigned long)&qmi_wwan_info,
380 USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010,
384 .driver_info = (
unsigned long)&qmi_wwan_info,
511 if (!id->driver_info) {
512 dev_dbg(&intf->dev,
"setting defaults for dynamic device id\n");
513 id->driver_info = (
unsigned long)&qmi_wwan_info;
519 static struct usb_driver qmi_wwan_driver = {
521 .id_table = products,
522 .probe = qmi_wwan_probe,
524 .suspend = qmi_wwan_suspend,
525 .resume = qmi_wwan_resume,
526 .reset_resume = qmi_wwan_resume,
527 .supports_autosuspend = 1,
528 .disable_hub_initiated_lpm = 1,