From f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 31 Jan 2024 01:04:47 +0000 Subject: [PATCH] add driver 5G --- kernel/drivers/usb/serial/usb_wwan.c | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/kernel/drivers/usb/serial/usb_wwan.c b/kernel/drivers/usb/serial/usb_wwan.c index 628a75d..c845b1c 100644 --- a/kernel/drivers/usb/serial/usb_wwan.c +++ b/kernel/drivers/usb/serial/usb_wwan.c @@ -140,10 +140,10 @@ ss->line = port->minor; ss->port = port->port_number; ss->baud_base = tty_get_baud_rate(port->port.tty); - ss->close_delay = jiffies_to_msecs(port->port.close_delay) / 10; + ss->close_delay = port->port.close_delay / 10; ss->closing_wait = port->port.closing_wait == ASYNC_CLOSING_WAIT_NONE ? ASYNC_CLOSING_WAIT_NONE : - jiffies_to_msecs(port->port.closing_wait) / 10; + port->port.closing_wait / 10; return 0; } EXPORT_SYMBOL(usb_wwan_get_serial_info); @@ -155,10 +155,9 @@ unsigned int closing_wait, close_delay; int retval = 0; - close_delay = msecs_to_jiffies(ss->close_delay * 10); + close_delay = ss->close_delay * 10; closing_wait = ss->closing_wait == ASYNC_CLOSING_WAIT_NONE ? - ASYNC_CLOSING_WAIT_NONE : - msecs_to_jiffies(ss->closing_wait * 10); + ASYNC_CLOSING_WAIT_NONE : ss->closing_wait * 10; mutex_lock(&port->port.mutex); @@ -271,9 +270,7 @@ if (status) { dev_dbg(dev, "%s: nonzero status: %d on endpoint %02x.\n", __func__, status, endpoint); - - /* don't resubmit on fatal errors */ - if (status == -ESHUTDOWN || status == -ENOENT) + if (status == -ESHUTDOWN || status == -ENOENT || status == -EPROTO) return; } else { if (urb->actual_length) { @@ -435,8 +432,7 @@ /* * Need to take susp_lock to make sure port is not already being - * resumed, but no need to hold it due to the tty-port initialized - * flag. + * resumed, but no need to hold it due to initialized */ spin_lock_irq(&intfdata->susp_lock); if (--intfdata->open_ports == 0) @@ -467,7 +463,6 @@ void (*callback) (struct urb *)) { struct usb_serial *serial = port->serial; - struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); struct urb *urb; urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ @@ -478,8 +473,18 @@ usb_sndbulkpipe(serial->dev, endpoint) | dir, buf, len, callback, ctx); - if (intfdata->use_zlp && dir == USB_DIR_OUT) - urb->transfer_flags |= URB_ZERO_PACKET; +#if 1 //Added by Quectel for Zero Packet + if (dir == USB_DIR_OUT) { + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9090)) + urb->transfer_flags |= URB_ZERO_PACKET; + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)) + urb->transfer_flags |= URB_ZERO_PACKET; + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)) + urb->transfer_flags |= URB_ZERO_PACKET; + if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) + urb->transfer_flags |= URB_ZERO_PACKET; + } +#endif return urb; } -- Gitblit v1.6.2