sm7125: input: stm: force enable hover proximity sensor

The sensors HAL passes ear_detect_enable,1 to /sys/class/sec/tsp/cmd, which leads to the proximity sensor being enabled.

So far it seems like 1 enables touch proximity, whereas 3 enables both hover proximity and touch proximity. It is yet to figure out if and what 2 does, but for now force enable the hover feature by altering the value passed by the HAL to 3.

Only enable hovering when the screen is not in LPM because turning on the hover feature breaks proximity when in LPM. While in LPM touch proximity will be used, otherwise touch proximity will be disabled.

Additionally we need to reset fod_pressed to 0 once we're entering LPM because enabling hovering sometimes prevents the driver from running into FTS_SPONGE_EVENT_GESTURE_ID_FOD_RELEASE, leaving fod_pressed sysf>

Change-Id: I7d77a79772d4661c5d1dc7dc64e144299c8f26d5
Signed-off-by: Simon1511 <me@simon1511.de>
fourteen
Simon1511 1 month ago committed by Jenna
parent fa0f035c02
commit fc5d1262f3
  1. 5
      drivers/input/touchscreen/stm/fts5cu56a/fts_sec.c
  2. 16
      drivers/input/touchscreen/stm/fts5cu56a/fts_ts.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;

@ -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);

Loading…
Cancel
Save