diff --git a/drivers/input/touchscreen/stm/fts5cu56a/fts_sec.c b/drivers/input/touchscreen/stm/fts5cu56a/fts_sec.c index b6d836bb6bed..da356e94ea46 100755 --- a/drivers/input/touchscreen/stm/fts5cu56a/fts_sec.c +++ b/drivers/input/touchscreen/stm/fts5cu56a/fts_sec.c @@ -7447,7 +7447,10 @@ static void ear_detect_enable(void *device_data) snprintf(buff, sizeof(buff), "NG"); sec->cmd_state = SEC_CMD_STATUS_FAIL; } else { - info->ed_enable = sec->cmd_param[0]; + if (info->fts_power_state == FTS_POWER_STATE_LOWPOWER) + info->ed_enable = sec->cmd_param[0]; + else + info->ed_enable = sec->cmd_param[0] != 0 ? 3 : 0; snprintf(buff, sizeof(buff), "OK"); data[0] = FTS_CMD_SET_EAR_DETECT; diff --git a/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c b/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c index f8a69b1d416b..513d62dcee2f 100755 --- a/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c +++ b/drivers/input/touchscreen/stm/fts5cu56a/fts_ts.c @@ -1820,21 +1820,15 @@ 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) { - 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 + if (info->fts_power_state == FTS_POWER_STATE_LOWPOWER || !info->touch_count) { + // Report actual range when the area around the sensor is touched, + // when panel is in LPM state or when the screen isn't touched 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); } - input_info(true, &info->client->dev, "%s: proximity: %d\n", __func__, p_event_status->status_data_1); } } } @@ -4152,6 +4146,8 @@ int fts_set_lowpowermode(struct fts_ts_info *info, u8 mode) } if (mode == TO_LOWPOWER_MODE) { + info->fod_pressed = 0; + if (device_may_wakeup(&info->client->dev)) enable_irq_wake(info->irq);