diff --git a/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c b/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c index ce64fd045948..f700fd5f7c27 100755 --- a/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c +++ b/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c @@ -1820,10 +1820,20 @@ static u8 fts_event_handler_type_b(struct fts_ts_info *info) if (p_event_status->stype == FTS_EVENT_STATUSTYPE_VENDORINFO) { if (info->board->support_ear_detect) { if (p_event_status->status_id == 0x6A) { - p_event_status->status_data_1 = p_event_status->status_data_1 == 5 || !p_event_status->status_data_1; - info->hover_event = p_event_status->status_data_1; - input_report_abs(info->input_dev_proximity, ABS_MT_CUSTOM, p_event_status->status_data_1); - input_sync(info->input_dev_proximity); + if (info->fts_power_state == FTS_POWER_STATE_LOWPOWER || info->finger[TouchID].y < 700 && info->finger[TouchID].x > 900 + && info->finger[TouchID].x < 3000) { + // Report actual range when either the area around the sensor is touched or if panel is in LPM state + p_event_status->status_data_1 = p_event_status->status_data_1 == 5 || !p_event_status->status_data_1; + info->hover_event = p_event_status->status_data_1; + input_report_abs(info->input_dev_proximity, ABS_MT_CUSTOM, p_event_status->status_data_1); + input_sync(info->input_dev_proximity); + } else { + // Properly reset to 1cm + p_event_status->status_data_1 = 1; + info->hover_event = p_event_status->status_data_1; + input_report_abs(info->input_dev_proximity, ABS_MT_CUSTOM, p_event_status->status_data_1); + input_sync(info->input_dev_proximity); + } input_info(true, &info->client->dev, "%s: proximity: %d\n", __func__, p_event_status->status_data_1); } }