sec_mmi: enhance class support

This change adds the following features:
1) generic gesture report via sensors mechanism
2) forced powerup calibration duplicated in vendor code

Change-Id: I4595d880728defc223e8e4a36eba906058ad3944
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1471837
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jialei Hao <haojl2@motorola.com>
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2019-12-13 09:51:36 -06:00 • committed by Konstantin Makariev
commit 899302cf9e
5 changed files with 47 additions and 46 deletions

View file

@ -64,7 +64,6 @@ struct sec_mmi_data {
};
int sec_mmi_data_init(struct sec_ts_data *ts, bool enable);
void sec_mmi_gesture_handler(void *data);
#ifndef CONFIG_INPUT_TOUCHSCREEN_MMI
#define DEV_MMI (&data->i2c_client->dev)

View file

@ -555,7 +555,7 @@ static void sec_ts_read_event(struct sec_ts_data *ts)
u8 read_event_buff[MAX_EVENT_COUNT][SEC_TS_EVENT_BUFF_SIZE] = { { 0 } };
u8 *event_buff;
struct sec_ts_event_coordinate *p_event_coord;
struct sec_ts_gesture_status *p_gesture_status;
struct sec_ts_gesture_status *gs;
struct sec_ts_event_status *p_event_status;
int curr_pos;
int remain_event_count = 0;
@ -876,19 +876,38 @@ static void sec_ts_read_event(struct sec_ts_data *ts)
break;
case SEC_TS_GESTURE_EVENT:
p_gesture_status = (struct sec_ts_gesture_status *)event_buff;
switch (p_gesture_status->stype) {
gs = (struct sec_ts_gesture_status *)event_buff;
input_info(true, &ts->client->dev, "%s: GESTURE %x %x %x %x %x %x %x %x\n", __func__,
gs->eid | (gs->stype << 4) | (gs->sf << 6),
gs->gesture_id, gs->gesture_data_1, gs->gesture_data_2,
gs->gesture_data_3, gs->gesture_data_4, gs->reserved_1,
gs->left_event_5_0 | (gs->reserved_2 << 6));
switch (gs->stype) {
case SEC_TS_GESTURE_CODE_SPAY:
/* */
/* */
/* Gesture event handling */
/* */
sec_mmi_gesture_handler((void *)event_buff);
/* */
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
if (ts->imports && ts->imports->report_gesture) {
struct gesture_event_data event;
input_dbg(true, &ts->client->dev,
"%s: invoke imported report gesture function\n", __func__);
/* extract X and Y coordinates */
event.evcode = gs->gesture_id;
event.evdata.x = gs->gesture_data_1 + ((gs->gesture_data_3 & 0x0f) << 8);
event.evdata.y = gs->gesture_data_2 + ((gs->gesture_data_3 & 0xf0) << 4);
/* call class method */
ret = ts->imports->report_gesture(&event);
if (!ret)
__pm_wakeup_event(&ts->wakelock, 5000);
}
#endif
break;
case SEC_TS_GESTURE_CODE_DOUBLE_TAP:
/* */
/* */
/* Gesture event handling */
/* */
/* */
break;
}
@ -1300,6 +1319,8 @@ static int sec_ts_parse_dt(struct i2c_client *client)
pdata->support_sidegesture = of_property_read_bool(np, "sec,support_sidegesture");
pdata->support_dex = of_property_read_bool(np, "support_dex_mode");
pdata->poweron_calibration = of_property_read_bool(np, "sec,poweron-calibration");
#ifdef CONFIG_SEC_FACTORY
pdata->support_mt_pressure = true;
#endif
@ -1598,7 +1619,11 @@ int sec_ts_integrity_check(struct sec_ts_data *ts)
return -EIO;
}
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
if (ts->plat_data->poweron_calibration) {
#else
if (ts->force_calibration) {
#endif
sec_ts_irq_enable(ts, false);
ret = sec_ts_execute_force_calibration(ts, OFFSET_CAL_SET);
if (ret < 0)

View file

@ -37,6 +37,10 @@
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
#include <linux/touchscreen_mmi.h>
#endif
#include "sec_cmd.h"
#ifdef CONFIG_INPUT_BOOSTER
@ -722,6 +726,10 @@ struct sec_ts_data {
struct sec_mmi_data *mmi_ptr;
bool fw_invalid;
bool irq_enabled;
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI)
struct ts_mmi_class_methods *imports;
#endif
};
struct sec_ts_plat_data {
@ -761,6 +769,7 @@ struct sec_ts_plat_data {
bool support_mt_pressure;
bool support_dex;
bool support_sidegesture;
bool poweron_calibration;
};
typedef struct {

View file

@ -861,42 +861,6 @@ static int sec_mmi_register_notifiers(
return rc;
}
void sec_mmi_gesture_handler(void *data)
{
struct sec_ts_gesture_status *gs =
(struct sec_ts_gesture_status *)data;
if (gs->eid != SEC_TS_GESTURE_EVENT) {
pr_info("%s: invalid gesture ID\n", __func__);
return;
}
pr_info("%s: GESTURE %x %x %x %x %x %x %x %x\n", __func__,
gs->eid | (gs->stype << 4) | (gs->sf << 6),
gs->gesture_id,
gs->gesture_data_1,
gs->gesture_data_2,
gs->gesture_data_3,
gs->gesture_data_4,
gs->reserved_1,
gs->left_event_5_0 | (gs->reserved_2 << 6));
switch (gs->gesture_id) {
case 1:
pr_info("%s: single tap\n", __func__);
break;
case 2:
pr_info("%s: zero tap; x=%x, y=%x, w=%x, p=%x\n", __func__,
gs->gesture_data_1+((gs->gesture_data_3 & 0x0f) << 8),
gs->gesture_data_2+((gs->gesture_data_3 & 0xf0) << 4),
gs->gesture_data_4,
gs->reserved_1);
break;
default:
pr_info("%s: unknown id=%x\n", __func__, gs->gesture_id);
}
}
static ssize_t sec_mmi_panel_supplier_show(struct device *dev,
struct device_attribute *attr, char *buf)
{

View file

@ -688,6 +688,10 @@ int sec_mmi_data_init(struct sec_ts_data *ts, bool enable)
dev_err(&ts->client->dev, "Failed to register ts mmi\n");
return ret;
}
/* initialize class imported methods */
ts->imports = &sec_ts_mmi_methods.exports;
if (ts->fw_invalid == false) {
sec_mmi_enable_touch(ts);
} else /* stuck in BL mode, update productinfo to report 'se77c' */