mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
Merge "input: touchscreen: st: enable aoi_set"
This commit is contained in:
commit
2b00b2adc4
3 changed files with 91 additions and 14 deletions
|
|
@ -2774,12 +2774,11 @@ static void fts_enter_pointer_event_handler(struct fts_ts_info *info,
|
|||
unsigned char touchId, touchcount;
|
||||
int x, y;
|
||||
int minor;
|
||||
int major, distance;
|
||||
int major, distance = 0;
|
||||
u8 touchsize;
|
||||
|
||||
distance = 0;
|
||||
if (!info->resume_bit)
|
||||
goto no_report;
|
||||
if (!info->resume_bit && !info->aoi_notify_enabled)
|
||||
return;
|
||||
|
||||
touchId = event[1] & 0x0F;
|
||||
touchcount = (event[1] & 0xF0) >> 4;
|
||||
|
|
@ -2803,6 +2802,13 @@ static void fts_enter_pointer_event_handler(struct fts_ts_info *info,
|
|||
if (y == Y_AXIS_MAX)
|
||||
y--;
|
||||
|
||||
if (info->sensor_sleep && info->aoi_notify_enabled)
|
||||
if ((x < info->aoi_left || x > info->aoi_right)
|
||||
|| (y < info->aoi_top || y > info->aoi_bottom)) {
|
||||
x = -x;
|
||||
y = -y;
|
||||
}
|
||||
|
||||
input_mt_slot(info->input_dev, touchId);
|
||||
input_mt_report_slot_state(info->input_dev, MT_TOOL_FINGER, 1);
|
||||
|
||||
|
|
@ -2816,9 +2822,7 @@ static void fts_enter_pointer_event_handler(struct fts_ts_info *info,
|
|||
input_report_abs(info->input_dev, ABS_MT_TOUCH_MINOR, minor);
|
||||
input_report_abs(info->input_dev, ABS_MT_DISTANCE, distance);
|
||||
|
||||
no_report:
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* EventId : 0x04 */
|
||||
|
|
@ -4795,10 +4799,10 @@ static int fts_probe_internal(struct i2c_client *client,
|
|||
goto ProbeErrorExit_7;
|
||||
}
|
||||
|
||||
#ifdef SCRIPTLESS
|
||||
/* I2C cmd */
|
||||
if (fts_cmd_class == NULL)
|
||||
fts_cmd_class = class_create(THIS_MODULE, FTS_TS_DRV_NAME);
|
||||
fts_cmd_class = class_create(THIS_MODULE, FTS_TS_DRV_NAME);
|
||||
|
||||
#ifdef SCRIPTLESS
|
||||
info->i2c_cmd_dev = device_create(fts_cmd_class,
|
||||
NULL, DCHIP_ID_0, info, "fts_i2c");
|
||||
if (IS_ERR(info->i2c_cmd_dev)) {
|
||||
|
|
@ -4819,8 +4823,6 @@ static int fts_probe_internal(struct i2c_client *client,
|
|||
#endif
|
||||
|
||||
#ifdef DRIVER_TEST
|
||||
if (fts_cmd_class == NULL)
|
||||
fts_cmd_class = class_create(THIS_MODULE, FTS_TS_DRV_NAME);
|
||||
info->test_cmd_dev = device_create(fts_cmd_class,
|
||||
NULL, DCHIP_ID_0, info, "fts_driver_test");
|
||||
if (IS_ERR(info->test_cmd_dev)) {
|
||||
|
|
@ -4840,8 +4842,6 @@ static int fts_probe_internal(struct i2c_client *client,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (fts_cmd_class == NULL)
|
||||
fts_cmd_class = class_create(THIS_MODULE, FTS_TS_DRV_NAME);
|
||||
info->aoi_cmd_dev = device_create(fts_cmd_class,
|
||||
NULL, DCHIP_ID_0, info, "touch_aoi");
|
||||
if (IS_ERR(info->aoi_cmd_dev)) {
|
||||
|
|
@ -4860,6 +4860,18 @@ static int fts_probe_internal(struct i2c_client *client,
|
|||
goto ProbeErrorExit_11;
|
||||
}
|
||||
|
||||
info->aoi_class = class_create(THIS_MODULE, "android_touch");
|
||||
if (info->aoi_class) {
|
||||
info->aoi_dev = device_create(info->aoi_class,
|
||||
NULL, DCHIP_ID_0, info, "touch");
|
||||
if (!IS_ERR(info->aoi_dev)) {
|
||||
dev_set_drvdata(info->aoi_dev, info);
|
||||
|
||||
error = sysfs_create_group(&info->aoi_dev->kobj,
|
||||
&aoi_enable_attr_group);
|
||||
}
|
||||
}
|
||||
|
||||
queue_delayed_work(info->fwu_workqueue, &info->fwu_work,
|
||||
msecs_to_jiffies(EXP_FN_WORK_DELAY_MS));
|
||||
logError(1, "%s Probe Finished!\n", tag);
|
||||
|
|
@ -4960,6 +4972,17 @@ static int fts_remove(struct i2c_client *client)
|
|||
{
|
||||
struct fts_ts_info *info = i2c_get_clientdata(client);
|
||||
|
||||
if (info->aoi_dev) {
|
||||
sysfs_remove_group(&info->aoi_dev->kobj,
|
||||
&aoi_enable_attr_group);
|
||||
info->aoi_dev = NULL;
|
||||
}
|
||||
|
||||
if (info->aoi_class) {
|
||||
device_destroy(info->aoi_class, DCHIP_ID_0);
|
||||
info->aoi_class = NULL;
|
||||
}
|
||||
|
||||
#ifdef DRIVER_TEST
|
||||
sysfs_remove_group(&info->test_cmd_dev->kobj,
|
||||
&test_cmd_attr_group);
|
||||
|
|
|
|||
|
|
@ -319,6 +319,8 @@ struct fts_ts_info {
|
|||
bool aoi_wake_on_suspend;
|
||||
|
||||
/* aoi region */
|
||||
struct class *aoi_class;
|
||||
struct device *aoi_dev;
|
||||
int aoi_left;
|
||||
int aoi_top;
|
||||
int aoi_bottom;
|
||||
|
|
@ -336,6 +338,7 @@ extern int input_register_notifier_client(struct notifier_block *nb);
|
|||
extern int input_unregister_notifier_client(struct notifier_block *nb);
|
||||
|
||||
extern struct attribute_group aoi_cmd_attr_group;
|
||||
extern struct attribute_group aoi_enable_attr_group;
|
||||
|
||||
#ifdef SCRIPTLESS
|
||||
extern struct attribute_group i2c_cmd_attr_group;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
|
@ -100,3 +100,54 @@ static struct attribute *aoi_cmd_attributes[] = {
|
|||
struct attribute_group aoi_cmd_attr_group = {
|
||||
.attrs = aoi_cmd_attributes,
|
||||
};
|
||||
|
||||
static ssize_t enable_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct fts_ts_info *info = dev_get_drvdata(dev);
|
||||
int enable;
|
||||
|
||||
if (kstrtoint(buf, 10, &enable))
|
||||
return -EINVAL;
|
||||
|
||||
if (!enable && info->aoi_notify_enabled) {
|
||||
info->aoi_left = 0;
|
||||
info->aoi_top = 0;
|
||||
info->aoi_right = 0;
|
||||
info->aoi_bottom = 0;
|
||||
info->aoi_notify_enabled = false;
|
||||
} else {
|
||||
info->aoi_left = 0;
|
||||
info->aoi_top = 0;
|
||||
info->aoi_right = X_AXIS_MAX;
|
||||
info->aoi_bottom = Y_AXIS_MAX;
|
||||
info->aoi_notify_enabled = true;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t enable_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct fts_ts_info *info = dev_get_drvdata(dev);
|
||||
size_t len = 0;
|
||||
|
||||
len = scnprintf(buf, PAGE_SIZE,
|
||||
"%d",
|
||||
info->aoi_notify_enabled);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR_RW(enable);
|
||||
|
||||
static struct attribute *aoi_enable_attributes[] = {
|
||||
&dev_attr_aoi_set.attr,
|
||||
&dev_attr_enable.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct attribute_group aoi_enable_attr_group = {
|
||||
.attrs = aoi_enable_attributes,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue