usb: serial: Add flow control between wwan and tty drivers

wwan driver is dropping the data if tty is throttled or unable to
accept more data. Add flow control between wwan and tty to fix
random data dropping.

CRs-Fixed: 373449
Change-Id: I524ee5e505e2e7e88df8fd669ae65bada4b235bf
Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org>
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index 9811a82..98b399f 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -24,6 +24,8 @@
 extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
 			  const unsigned char *buf, int count);
 extern int usb_wwan_chars_in_buffer(struct tty_struct *tty);
+extern void usb_wwan_throttle(struct tty_struct *tty);
+extern void usb_wwan_unthrottle(struct tty_struct *tty);
 #ifdef CONFIG_PM
 extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
 extern int usb_wwan_resume(struct usb_serial *serial);
@@ -33,7 +35,7 @@
 
 #define N_IN_URB 5
 #define N_OUT_URB 5
-#define IN_BUFLEN 65536
+#define IN_BUFLEN 16384
 #define OUT_BUFLEN 65536
 
 struct usb_wwan_intf_private {
@@ -55,6 +57,10 @@
 	int opened;
 	struct usb_anchor submitted;
 	struct usb_anchor delayed;
+	struct list_head in_urb_list;
+	spinlock_t in_lock;
+	ssize_t n_read;
+	struct work_struct in_work;
 
 	/* Settings for the port */
 	int rts_state;		/* Handshaking pins (outputs) */