mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
Use node to notify CLI touch gesture mode
Remove the way that when tap sensor register to notify touch enter gesture mode.Use node to notify CLI touch enable/disable gesture mode. Change-Id: Ib732a61289bcfed78b7ffecd3c6c2b27ae590bd1 Signed-off-by: Wenge Zhu <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2320662 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wei Deng <dengwei1@motorola.com> Reviewed-by: Jichao Zou <zoujc@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
896ff3dd7b
commit
cba2f1db13
4 changed files with 99 additions and 14 deletions
|
|
@ -6727,20 +6727,6 @@ static int cyttsp5_setup_irq_gpio(struct cyttsp5_core_data *cd)
|
|||
static int cyttsp5_sensor_set_enable(struct sensors_classdev *sensors_cdev,
|
||||
unsigned int enable)
|
||||
{
|
||||
struct cyttsp5_sensor_platform_data *sensor_pdata = container_of(
|
||||
sensors_cdev, struct cyttsp5_sensor_platform_data, ps_cdev);
|
||||
struct cyttsp5_core_data *cd = sensor_pdata->data;
|
||||
|
||||
pr_info("%s: Gesture set enable %d!", __func__, enable);
|
||||
mutex_lock(&cd->state_mutex);
|
||||
if (enable == 1) {
|
||||
cd->should_enable_gesture = true;
|
||||
} else if (enable == 0) {
|
||||
cd->should_enable_gesture = false;
|
||||
} else {
|
||||
pr_info("%s: unknown enable symbol\n", __func__);
|
||||
}
|
||||
mutex_unlock(&cd->state_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ struct cyttsp5_core_platform_data {
|
|||
struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
|
||||
u32 flags;
|
||||
u8 easy_wakeup_gesture;
|
||||
#ifdef CYTTSP5_SENSOR_EN
|
||||
int cli_gesture_type;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct touch_framework {
|
||||
|
|
|
|||
|
|
@ -629,6 +629,12 @@ static struct cyttsp5_core_platform_data *create_and_get_core_pdata(
|
|||
if (!rc)
|
||||
pdata->easy_wakeup_gesture = (u8)value;
|
||||
|
||||
#ifdef CYTTSP5_SENSOR_EN
|
||||
rc = of_property_read_u32(core_node, "cy,supported_gesture_type", &value);
|
||||
if (!rc)
|
||||
pdata->cli_gesture_type = value;
|
||||
#endif
|
||||
|
||||
rc = of_property_read_string(core_node, "cy,class-entry-name",
|
||||
&pdata->class_entry_name);
|
||||
if (!rc)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,22 @@
|
|||
dev_err(dev, "Failed to get driver data"); \
|
||||
return -ENODEV; \
|
||||
}
|
||||
#define MAX_ATTRS_ENTRIES 10
|
||||
|
||||
#define ADD_ATTR(name) { \
|
||||
if (idx < MAX_ATTRS_ENTRIES) { \
|
||||
dev_info(dev, "%s: [%d] adding %p\n", __func__, idx, &dev_attr_##name.attr); \
|
||||
ext_attributes[idx] = &dev_attr_##name.attr; \
|
||||
idx++; \
|
||||
} else { \
|
||||
dev_err(dev, "%s: cannot add attribute '%s'\n", __func__, #name); \
|
||||
} \
|
||||
}
|
||||
|
||||
static struct attribute *ext_attributes[MAX_ATTRS_ENTRIES];
|
||||
static struct attribute_group ext_attr_group = {
|
||||
.attrs = ext_attributes,
|
||||
};
|
||||
|
||||
extern int cyttsp5_core_suspend(struct device *dev);
|
||||
extern int cyttsp5_core_resume(struct device *dev);
|
||||
|
|
@ -282,6 +298,78 @@ static int cyttsp5_ts_mmi_post_resume(struct device *dev) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CYTTSP5_SENSOR_EN
|
||||
/*
|
||||
* cli_gesture value used to indicate which gesture mode type is enabled
|
||||
*/
|
||||
static ssize_t cyttsp5_ts_cli_gesture_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct cyttsp5_core_data *cd = NULL;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
cd = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(cd);
|
||||
return scnprintf(buf, PAGE_SIZE, "%02x\n", cd->pdata->core_pdata->cli_gesture_type);
|
||||
}
|
||||
|
||||
static ssize_t cyttsp5_ts_cli_gesture_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct cyttsp5_core_data *cd = NULL;
|
||||
unsigned int value = 0;
|
||||
int err = 0;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
cd = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(cd);
|
||||
|
||||
mutex_lock(&cd->state_mutex);
|
||||
err = sscanf(buf, "%d", &value);
|
||||
if (err < 0) {
|
||||
dev_err(dev, "%s: Failed to convert value\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (value) {
|
||||
case 0x20:
|
||||
dev_info(dev, "%s: cli single tap disable\n", __func__);
|
||||
cd->should_enable_gesture = 0;
|
||||
break;
|
||||
case 0x21:
|
||||
dev_info(dev, "%s: cli single tap enable\n", __func__);
|
||||
cd->should_enable_gesture = 1;
|
||||
break;
|
||||
default:
|
||||
dev_info(dev, "%s: unsupport gesture mode type\n", __func__);
|
||||
;
|
||||
}
|
||||
mutex_unlock(&cd->state_mutex);
|
||||
dev_info(dev, "%s: cli_gesture = 0x%02x \n", __func__, cd->should_enable_gesture);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(cli_gesture, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
cyttsp5_ts_cli_gesture_show, cyttsp5_ts_cli_gesture_store);
|
||||
#endif
|
||||
|
||||
static int cyttsp5_ts_mmi_extend_attribute_group(struct device *dev, struct attribute_group **group)
|
||||
{
|
||||
int idx = 0;
|
||||
|
||||
#ifdef CYTTSP5_SENSOR_EN
|
||||
ADD_ATTR(cli_gesture);
|
||||
#endif
|
||||
|
||||
if (idx) {
|
||||
ext_attributes[idx] = NULL;
|
||||
*group = &ext_attr_group;
|
||||
} else
|
||||
*group = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ts_mmi_methods cyttsp5_ts_mmi_methods = {
|
||||
.get_vendor = cyttsp5_ts_mmi_methods_get_vendor,
|
||||
.get_class_entry_name = cyttsp5_mmi_get_class_entry_name,
|
||||
|
|
@ -298,6 +386,8 @@ static struct ts_mmi_methods cyttsp5_ts_mmi_methods = {
|
|||
.power = cyttsp5_ts_mmi_methods_power,
|
||||
/* Firmware */
|
||||
.firmware_update = cyttsp5_ts_firmware_update,
|
||||
/* vendor specific attribute group */
|
||||
.extend_attribute_group = cyttsp5_ts_mmi_extend_attribute_group,
|
||||
/* PM callback */
|
||||
.post_resume = cyttsp5_ts_mmi_post_resume,
|
||||
.post_suspend = cyttsp5_ts_mmi_post_suspend,
|
||||
|
|
|
|||
Loading…
Reference in a new issue