aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/usb/qmi_wwan.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 7156bc7..58c83d0 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -15,6 +15,9 @@
#include <linux/usb/usbnet.h>
#include <linux/usb/cdc-wdm.h>
+#include <linux/mdm_hsic_pm.h>
+static const char qmi_pm_dev[] = "mdm_hsic_pm0";
+
/* The name of the CDC Device Management driver */
#define DM_DRIVER "cdc_wdm"
@@ -54,6 +57,48 @@
* corresponding management interface
*/
+int qmi_wwan_probe(struct usb_interface *intf, const struct usb_device_id *prod)
+{
+ struct usb_device *udev;
+ int status;
+
+ udev = interface_to_usbdev(intf);
+
+ status = usbnet_probe(intf, prod);
+ if (status < 0) {
+ dev_err(&udev->dev, "usbnet_probe failed %d\n", status);
+ return -1;
+ }
+
+ pr_info("%s: send DTR high to modem\n", __func__);
+ status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+ USB_CDC_REQ_SET_CONTROL_LINE_STATE,
+ (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE),
+ 0x01,
+ intf->cur_altsetting->desc.bInterfaceNumber,
+ NULL, 0, USB_CTRL_SET_TIMEOUT);
+ if (status < 0) {
+ dev_err(&udev->dev, "sending DTR high to modem failed %d\n", status);
+ return -1;
+ }
+
+#ifdef CONFIG_MDM_HSIC_PM
+ register_udev_to_pm_dev(qmi_pm_dev, udev);
+ if (status) {
+ dev_err(&udev->dev,
+ "%s: fail to register to hsic pm device\n", __func__);
+ return -1;
+ }
+ dev_info(&udev->dev,
+ "%s: registered udev to pm\n", __func__);
+#endif
+
+ /* allow modem to wake up suspended system */
+ device_set_wakeup_enable(&udev->dev, 1);
+
+ return 0;
+}
+
static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)
{
int status = -1;
@@ -454,7 +499,7 @@ MODULE_DEVICE_TABLE(usb, products);
static struct usb_driver qmi_wwan_driver = {
.name = "qmi_wwan",
.id_table = products,
- .probe = usbnet_probe,
+ .probe = qmi_wwan_probe,
.disconnect = usbnet_disconnect,
.suspend = qmi_wwan_suspend,
.resume = qmi_wwan_resume,