From 74da8008e5a24bbf396748c1072c1824d3227286 Mon Sep 17 00:00:00 2001 From: Michal Koziel Date: Tue, 4 May 2021 15:44:07 +0200 Subject: [PATCH] touch: pt: skipping polling for boot mode exit if already out of boot Function _pt_poll_for_fw_exit_boot_mode() is not needed to be called if the controller is already out of boot mode. This function was delaying resume from wakeup unnecessarly for modes other that boot. --- drivers/input/touchscreen/pt_core.c | 49 +++++++++++++++-------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/input/touchscreen/pt_core.c b/drivers/input/touchscreen/pt_core.c index 4aff6baa2bc6..0b604cc5aa0c 100755 --- a/drivers/input/touchscreen/pt_core.c +++ b/drivers/input/touchscreen/pt_core.c @@ -9213,35 +9213,36 @@ reset: goto reset; goto exit; } - } - cd->startup_status |= STARTUP_STATUS_GET_DESC; - /* FW cannot handle most PIP cmds when it is still in BOOT mode */ - rc = _pt_poll_for_fw_exit_boot_mode(cd, 500, &wait_time); - if (!rc) { - cd->startup_status |= STARTUP_STATUS_FW_OUT_OF_BOOT; - pt_debug(cd->dev, DL_WARN, - "%s: Exit FW BOOT Mode after %dms\n", - __func__, wait_time); - } else { - pt_debug(cd->dev, DL_WARN, - "%s: FW stuck in BOOT Mode after %dms\n", - __func__, wait_time); - goto exit; - } + cd->startup_status |= STARTUP_STATUS_GET_DESC; - if (!cd->sysinfo.ready) { - rc = pt_hid_output_get_sysinfo_(cd); - if (rc) { - pt_debug(cd->dev, DL_ERROR, - "%s: Error on getting sysinfo r=%d\n", - __func__, rc); - if (retry--) - goto reset; + /* FW cannot handle most PIP cmds when it is still in BOOT mode */ + rc = _pt_poll_for_fw_exit_boot_mode(cd, 500, &wait_time); + if (!rc) { + cd->startup_status |= STARTUP_STATUS_FW_OUT_OF_BOOT; + pt_debug(cd->dev, DL_WARN, + "%s: Exit FW BOOT Mode after %dms\n", + __func__, wait_time); + } else { + pt_debug(cd->dev, DL_WARN, + "%s: FW stuck in BOOT Mode after %dms\n", + __func__, wait_time); goto exit; } + + if (!cd->sysinfo.ready) { + rc = pt_hid_output_get_sysinfo_(cd); + if (rc) { + pt_debug(cd->dev, DL_ERROR, + "%s: Error on getting sysinfo r=%d\n", + __func__, rc); + if (retry--) + goto reset; + goto exit; + } + } + cd->startup_status |= STARTUP_STATUS_GET_SYS_INFO; } - cd->startup_status |= STARTUP_STATUS_GET_SYS_INFO; } rc = pt_restore_parameters_(cd);