tty: flush linux local echo buffer

Linux has a buffer just for local echoes. It seems to have been a
design decision that characters are discarded from this buffer if it
overflows. This results in dropped characters for large echoes of
inputted characters. This commit does not address that issue as it
only causes issues pasting large amounts of text.

The local echo buffer also has an issue if the tty driver buffer is
full, in our case okl4-pipes buffer is only 32 bytes, and no
characters are received it is not flushed. This results in an
infinite delay of the echoed characters if no further characters are
received. If further characters are received then they are outputted
in chunks of the length of your tty driver buffer, in okl4_pipes
case 32 bytes, as you continue to type.

This commit continues to flush the echo buffer until empty with
small delays between attempts after buffer full.

Change-Id: Iaad7e52fdb025a7a6c3707b95321e79af6867bdd
Signed-off-by: Carl van Schaik <carl@cog.systems>
Git-commit: 90ec5ea60ba36b7f8eeea7696a92ce22e78f1f3a
Git-repo: https://github.com/CogSystems/linux-msm.git
[mqi@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Minming Qi <mqi@codeaurora.org>
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 9510305..741e966 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -41,6 +41,9 @@
 	  If unsure, say Y, or else you won't be able to do much with your new
 	  shiny Linux system :-)
 
+config TTY_FLUSH_LOCAL_ECHO
+	bool
+
 config CONSOLE_TRANSLATIONS
 	depends on VT
 	default y