[PATCH v1 09/19] hid-ft260: uart: wakeup device early to not lose rx data

From: Michael Zaidman
Date: Sat Feb 10 2024 - 16:55:35 EST


Waking up the ft260 device from power saving mode earlier reduces the
probability of incoming data loss.

Signed-off-by: Michael Zaidman <michael.zaidman@xxxxxxxxx>
---
drivers/hid/hid-ft260.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
index ccd20f590720..6266e4f1100d 100644
--- a/drivers/hid/hid-ft260.c
+++ b/drivers/hid/hid-ft260.c
@@ -1285,8 +1285,6 @@ static int ft260_uart_change_speed(struct ft260_device *port,
bool wakeup_workaraund = false;
int ret;

- ft260_uart_wakeup(port);
-
memset(&req, 0, sizeof(req));

req.report = FT260_SYSTEM_SETTINGS;
@@ -1529,6 +1527,9 @@ static int ft260_uart_activate(struct tty_port *tport, struct tty_struct *tty)
ft260_uart_change_speed(port, &tty->termios, NULL);
clear_bit(TTY_IO_ERROR, &tty->flags);

+ /* Wake up the chip as early as possible to not miss incoming data */
+ ft260_uart_wakeup(port);
+
if (port->reschedule_work) {
mod_timer(&port->wakeup_timer, jiffies +
msecs_to_jiffies(FT260_WAKEUP_NEEDED_AFTER_MS));
--
2.40.1