From: yan Date: Mon, 20 Jul 2020 02:53:37 +0000 (+0800) Subject: Add HUAWEI ME906s LTE Module support X-Git-Tag: khadas-vims-v0.9.6-release~22^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=928a90964277e80a77bfb3b3520dc1589b5ee9b7;p=platform%2Fkernel%2Flinux-amlogic.git Add HUAWEI ME906s LTE Module support Signed-off-by: yan --- diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 07aab4b4ad4c..27be746cb651 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -971,6 +971,7 @@ static const struct usb_device_id option_ids[] = { { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7B) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7C) }, /* Motorola devices */ { USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x2a70, 0xff, 0xff, 0xff) }, /* mdm6600 */ @@ -2113,6 +2114,12 @@ static int option_attach(struct usb_serial *serial) struct usb_wwan_intf_private *data; unsigned long device_flags; + if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID) { + if ( 0 != (serial->dev->config->desc.bmAttributes & 0x20)){ + usb_enable_autosuspend(serial->dev); + } + } + data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL); if (!data) return -ENOMEM; diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 4569a8a66c41..10c5e5597790 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -36,6 +36,9 @@ #include #include "usb-wwan.h" +#define HW_bcdUSB 0x0110 +#define HUAWEI_VENDOR_ID 0x12d1 + /* * Generate DTR/RTS signals on the port using the SET_CONTROL_LINE_STATE request * in CDC ACM. @@ -217,6 +220,7 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, { struct usb_wwan_port_private *portdata; struct usb_wwan_intf_private *intfdata; + struct usb_host_endpoint *ep; int i; int left, todo; struct urb *this_urb = NULL; /* spurious */ @@ -256,6 +260,15 @@ int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, memcpy(this_urb->transfer_buffer, buf, todo); this_urb->transfer_buffer_length = todo; + if((HUAWEI_VENDOR_ID == port->serial->dev->descriptor.idVendor) + && (HW_bcdUSB != port->serial->dev->descriptor.bcdUSB)){ + ep = usb_pipe_endpoint(this_urb->dev, this_urb->pipe); + if(ep && (0 != this_urb->transfer_buffer_length) + && (0 == this_urb->transfer_buffer_length % ep->desc.wMaxPacketSize)){ + this_urb->transfer_flags |= URB_ZERO_PACKET; + } + } + spin_lock_irqsave(&intfdata->susp_lock, flags); if (intfdata->suspended) { usb_anchor_urb(this_urb, &portdata->delayed);