diff mbox series

[SRU,B,2/4] UBUNTU: SAUCE: xr-usb-serial: re-initialise baudrate after resume from S3/S4

Message ID 20200219043805.11093-3-shrirang.bagul@canonical.com
State New
Headers show
Series UBUNTU: SAUCE: Updates to Exar USB serial driver | expand

Commit Message

Shrirang Bagul Feb. 19, 2020, 4:38 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1863834

The XR21V1412 ports were using the hardware power-on default of 9600bps
after resume from S3/S4. This patch re-initialises the baud rate and
fixes the re-connection issues after S3/S4.

Changelog:
Version 1B, 11/6/2015
Fixed Bug: The conditional logic to support kernel 3.9 was incorrect(line 396 in xr_usb_serial_common.c).

Version 1A, 1/9/2015
This driver will work with any USB UART function in these Exar devices:
        XR21V1410/1412/1414
        XR21B1411
        XR21B1420/1422/1424
        XR22801/802/804

The source code has been tested on various Linux kernels from 3.6.x to 3.17.x.
This may also work with newer kernels as well.

linux-oem buglink: http://bugs.launchpad.net/bugs/1690362

Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
(cherry picked from commit 39f69345fca1f14e1e27875b83f87a6067c36fbb)
(source tag: Ubuntu-oem-4.15.0-1073.83)
Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
---
 ubuntu/xr-usb-serial/Makefile               |  3 ++-
 ubuntu/xr-usb-serial/xr_usb_serial_common.c | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/ubuntu/xr-usb-serial/Makefile b/ubuntu/xr-usb-serial/Makefile
index 1a323a62b348..533988cede12 100644
--- a/ubuntu/xr-usb-serial/Makefile
+++ b/ubuntu/xr-usb-serial/Makefile
@@ -1,6 +1,7 @@ 
 obj-m := xr_usb_serial_common.o
 
-KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+#KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+KERNELDIR ?=$(shell pwd)/../parts/kernel/build
 PWD       := $(shell pwd)
 
 EXTRA_CFLAGS	:= -DDEBUG=0
diff --git a/ubuntu/xr-usb-serial/xr_usb_serial_common.c b/ubuntu/xr-usb-serial/xr_usb_serial_common.c
index 5d049855fb1a..09d21e63606e 100644
--- a/ubuntu/xr-usb-serial/xr_usb_serial_common.c
+++ b/ubuntu/xr-usb-serial/xr_usb_serial_common.c
@@ -1146,7 +1146,7 @@  static void xr_usb_serial_tty_set_termios(struct tty_struct *tty,
     }
 
 		
-	if (memcmp(&xr_usb_serial->line, &newline, sizeof newline))
+	//if (memcmp(&xr_usb_serial->line, &newline, sizeof newline))
 	{
 		memcpy(&xr_usb_serial->line, &newline, sizeof newline);
 		/*
@@ -1819,11 +1819,21 @@  static int xr_usb_serial_resume(struct usb_interface *intf)
 {
 	struct xr_usb_serial *xr_usb_serial = usb_get_intfdata(intf);
 	struct xr_usb_serial_wb *wb;
+#if 0	
+	struct tty_struct *tty = xr_usb_serial->port.tty;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)	
+	struct ktermios *termios = tty->termios;
+#else
+    struct ktermios *termios = &tty->termios;
+#endif
+#endif
 	int rv = 0;
 	int cnt;
 	     
 	xr_usb_serial_pre_setup(xr_usb_serial);
-	
+	xr_usb_serial_disable(xr_usb_serial);
+	xr_usb_serial_set_line(xr_usb_serial, &xr_usb_serial->line);
+	xr_usb_serial_enable(xr_usb_serial);	
 	spin_lock_irq(&xr_usb_serial->read_lock);
 	xr_usb_serial->susp_count -= 1;
 	cnt = xr_usb_serial->susp_count;