mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
sec_mmi: support holding grip detection
Driver provides access to holding grip info reported by firmware via sysfs entry. Driver notifies HAL about holding grip info changes. Change-Id: Ifff66d0a06b904e43dc88432b930e51478c4fa59 Signed-off-by: Konstantin Makariev <hcv867@motorola.com> Reviewed-on: https://gerrit.mot.com/1517457 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
3e7c7ab6a3
commit
32c34e9aff
4 changed files with 67 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ struct sec_mmi_data {
|
|||
};
|
||||
|
||||
int sec_mmi_data_init(struct sec_ts_data *ts, bool enable);
|
||||
int sec_mmi_sysfs_notify(struct sec_ts_data *ts, unsigned char state);
|
||||
|
||||
#ifndef CONFIG_INPUT_TOUCHSCREEN_MMI
|
||||
#define DEV_MMI (&data->i2c_client->dev)
|
||||
|
|
|
|||
|
|
@ -545,6 +545,7 @@ void sec_ts_reinit(struct sec_ts_data *ts)
|
|||
return;
|
||||
}
|
||||
|
||||
#define STATUS_ID_HOLD_GRIP 0x69
|
||||
#define MAX_EVENT_COUNT 32
|
||||
static void sec_ts_read_event(struct sec_ts_data *ts)
|
||||
{
|
||||
|
|
@ -645,6 +646,14 @@ static void sec_ts_read_event(struct sec_ts_data *ts)
|
|||
event_buff[3], event_buff[4], event_buff[5],
|
||||
event_buff[6], event_buff[7]);
|
||||
|
||||
/* hold grip change status event */
|
||||
if ((p_event_status->status_id == STATUS_ID_HOLD_GRIP) &&
|
||||
ts->plat_data->hold_grip_ctrl) {
|
||||
sec_mmi_sysfs_notify(ts, p_event_status->status_data_1);
|
||||
/* no further processing needed */
|
||||
break;
|
||||
}
|
||||
|
||||
/* watchdog reset -> send SENSEON command */
|
||||
if ((p_event_status->stype == TYPE_STATUS_EVENT_INFO) &&
|
||||
(p_event_status->status_id == SEC_TS_ACK_BOOT_COMPLETE) &&
|
||||
|
|
@ -1343,6 +1352,7 @@ static int sec_ts_parse_dt(struct i2c_client *client)
|
|||
pdata->pill_region_ctrl = of_property_read_bool(np, "sec,pill-region-control");
|
||||
pdata->hold_distance_ctrl = of_property_read_bool(np, "sec,hold-distance-control");
|
||||
pdata->gs_distance_ctrl = of_property_read_bool(np, "sec,gs-distance-control");
|
||||
pdata->hold_grip_ctrl = of_property_read_bool(np, "sec,hold-grip-control");
|
||||
pdata->poweron_calibration = of_property_read_bool(np, "sec,poweron-calibration");
|
||||
|
||||
#ifdef CONFIG_SEC_FACTORY
|
||||
|
|
|
|||
|
|
@ -473,6 +473,13 @@ enum tsp_hw_parameter {
|
|||
TSP_MODULE_ID = 6,
|
||||
};
|
||||
|
||||
enum hold_grip_states {
|
||||
SEC_HOLD_GRIP_NOGRIP,
|
||||
SEC_HOLD_GRIP_UNCERTAIN,
|
||||
SEC_HOLD_GRIP_LEFT,
|
||||
SEC_HOLD_GRIP_RUGHT,
|
||||
};
|
||||
|
||||
#define TEST_MODE_MIN_MAX false
|
||||
#define TEST_MODE_ALL_NODE true
|
||||
#define TEST_MODE_READ_FRAME false
|
||||
|
|
@ -715,6 +722,7 @@ struct sec_ts_data {
|
|||
unsigned char pill_region_data[5];
|
||||
unsigned char hold_distance_data;
|
||||
unsigned char gs_distance_data;
|
||||
unsigned char hold_grip_data;
|
||||
|
||||
/* for factory - factory_cmd_result_all() */
|
||||
short cm_raw_set_p2p_min; //CM_RAW_SET_P2P
|
||||
|
|
@ -789,6 +797,7 @@ struct sec_ts_plat_data {
|
|||
bool pill_region_ctrl;
|
||||
bool hold_distance_ctrl;
|
||||
bool gs_distance_ctrl;
|
||||
bool hold_grip_ctrl;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ static ssize_t sec_mmi_gs_distance_store(struct device *dev,
|
|||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_gs_distance_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
static ssize_t sec_mmi_hold_grip_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_hold_grip_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static DEVICE_ATTR(address, (S_IWUSR | S_IWGRP), NULL, sec_mmi_address_store);
|
||||
static DEVICE_ATTR(size, (S_IWUSR | S_IWGRP), NULL, sec_mmi_size_store);
|
||||
|
|
@ -79,6 +83,8 @@ static DEVICE_ATTR(hold_distance, (S_IRUGO | S_IWUSR | S_IWGRP),
|
|||
sec_mmi_hold_distance_show, sec_mmi_hold_distance_store);
|
||||
static DEVICE_ATTR(gs_distance, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
sec_mmi_gs_distance_show, sec_mmi_gs_distance_store);
|
||||
static DEVICE_ATTR(hold_grip, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
sec_mmi_hold_grip_show, sec_mmi_hold_grip_store);
|
||||
|
||||
#define MAX_ATTRS_ENTRIES 10
|
||||
#define ADD_ATTR(name) { \
|
||||
|
|
@ -115,6 +121,9 @@ static int sec_mmi_extend_attribute_group(struct device *dev, struct attribute_g
|
|||
if (ts->plat_data->gs_distance_ctrl)
|
||||
ADD_ATTR(gs_distance);
|
||||
|
||||
if (ts->plat_data->hold_grip_ctrl)
|
||||
ADD_ATTR(hold_grip);
|
||||
|
||||
if (strncmp(bi_bootmode(), "mot-factory", strlen("mot-factory")) == 0) {
|
||||
ADD_ATTR(address);
|
||||
ADD_ATTR(size);
|
||||
|
|
@ -288,6 +297,41 @@ static ssize_t sec_mmi_suppression_show(struct device *dev,
|
|||
return blen;
|
||||
}
|
||||
|
||||
int sec_mmi_sysfs_notify(struct sec_ts_data *ts, unsigned char state)
|
||||
{
|
||||
if (state != 0xff)
|
||||
ts->hold_grip_data = state;
|
||||
|
||||
sysfs_notify(ts->imports->kobj_notify, NULL, "hold_grip");
|
||||
dev_dbg(&ts->client->dev, "%s: triggered HAL with 0x%02x\n", __func__, state);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t sec_mmi_hold_grip_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct sec_ts_data *ts;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
GET_TS_DATA(dev);
|
||||
|
||||
sec_mmi_sysfs_notify(ts, 0xff);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t sec_mmi_hold_grip_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct sec_ts_data *ts;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
GET_TS_DATA(dev);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "0x%02x", (unsigned int)(ts->hold_grip_data));
|
||||
}
|
||||
|
||||
#define REQ_ARGS_NUM 3
|
||||
|
||||
static ssize_t sec_mmi_pill_region_store(struct device *dev,
|
||||
|
|
@ -1156,6 +1200,9 @@ int sec_mmi_data_init(struct sec_ts_data *ts, bool enable)
|
|||
dev_err(&ts->client->dev, "%s: failed to write grip supp distance (%d)\n",
|
||||
__func__, ret);
|
||||
}
|
||||
|
||||
if (ts->plat_data->hold_grip_ctrl)
|
||||
ts->hold_grip_data = SEC_HOLD_GRIP_NOGRIP;
|
||||
} else
|
||||
ts_mmi_dev_unregister(&ts->client->dev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue