From 481f8e6325e04e8352b1db2ecb0c8cb62c765c0e Mon Sep 17 00:00:00 2001 From: yh Date: Fri, 16 Dec 2022 17:11:02 +0800 Subject: [PATCH] focaltech_0flash_v2_mmi:improve charger detection focaltech_0flash_v2_mmi: improve charger notification callback to set usb state to TP FW ontime Change-Id: I1921e3d8e8ed6cdaf338980993f0ab81f399e970 Reviewed-on: https://gerrit.mot.com/2463579 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jing Hu Reviewed-by: Wei Deng Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- .../focaltech_0flash_v2_mmi/focaltech_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c index d09765ad9bed..e8639498029e 100644 --- a/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_v2_mmi/focaltech_core.c @@ -1896,6 +1896,17 @@ static int fts_charger_notifier_callback(struct notifier_block *nb, } else { ts->usb_detect_flag = prop.intval; //FTS_ERROR("usb prop.intval =%d\n", prop.intval); + if(ts->usb_detect_flag != ts->usb_connected){ + if (ts->usb_detect_flag) { + ts->usb_connected = 0x01; + } else { + ts->usb_connected = 0x00; + } + if(!ts->suspended){ + fts_mcu_usb_detect_set(ts->usb_connected); + FTS_INFO("%s: Cable status change: 0x%2.2X\n", __func__, ts->usb_connected); + } + } } } }