mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 08:07:32 -04:00
sec_mmi: add hold distance register
Add store/show functions to the hold distance register at 0xAB. Change-Id: Ic697012de0ec22c4b4ebfbd6c39be159273be858 Signed-off-by: Ryan Lattrel <ryanl@motorola.com> Reviewed-on: https://gerrit.mot.com/1511303 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Igor Kovalenko <igork@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
8a49c2bd4f
commit
2856a99e4f
3 changed files with 65 additions and 3 deletions
|
|
@ -1341,6 +1341,7 @@ static int sec_ts_parse_dt(struct i2c_client *client)
|
|||
pdata->support_dex = of_property_read_bool(np, "support_dex_mode");
|
||||
pdata->suppression_ctrl = of_property_read_bool(np, "sec,suppression-control");
|
||||
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->poweron_calibration = of_property_read_bool(np, "sec,poweron-calibration");
|
||||
|
||||
#ifdef CONFIG_SEC_FACTORY
|
||||
|
|
|
|||
|
|
@ -210,10 +210,12 @@
|
|||
#define SEC_TS_CMD_MIS_CAL_CHECK 0xA7
|
||||
#define SEC_TS_CMD_MIS_CAL_READ 0xA8
|
||||
#define SEC_TS_CMD_MIS_CAL_SPEC 0xA9
|
||||
/* obsolete
|
||||
#define SEC_TS_CMD_DEADZONE_RANGE 0xAA
|
||||
#define SEC_TS_CMD_LONGPRESSZONE_RANGE 0xAB
|
||||
#define SEC_TS_CMD_LONGPRESS_DROP_AREA 0xAC
|
||||
#define SEC_TS_CMD_LONGPRESS_DROP_DIFF 0xAD
|
||||
*/
|
||||
#define SEC_TS_READ_TS_STATUS 0xAF
|
||||
#define SEC_TS_CMD_SELFTEST 0xAE
|
||||
#define SEC_TS_READ_FORCE_RECAL_COUNT 0xB0
|
||||
|
|
@ -342,9 +344,11 @@
|
|||
#define SEC_TS_STATUS_CALIBRATION_SEC 0xA2
|
||||
|
||||
#define SEC_TS_CMD_EDGE_HANDLER 0xAA
|
||||
#define SEC_TS_CMD_EDGE_AREA 0xAB
|
||||
#define SEC_TS_CMD_DEAD_ZONE 0xAC
|
||||
#define SEC_TS_CMD_LANDSCAPE_MODE 0xAD
|
||||
#define SEC_TS_CMD_EDGE_AREA 0xAB /* compiled off in our FW */
|
||||
#define SEC_TS_CMD_HOLD_DISTANCE 0xAB
|
||||
#define SEC_TS_CMD_DEAD_ZONE 0xAC /* compiled off in our FW */
|
||||
#define SEC_TS_CMD_GRIP_SUPP_AREA 0xAC
|
||||
#define SEC_TS_CMD_LANDSCAPE_MODE 0xAD /* compiled off in our FW */
|
||||
#define SEC_TS_CMD_PILL_REGION 0xAD
|
||||
|
||||
enum grip_write_mode {
|
||||
|
|
@ -779,6 +783,7 @@ struct sec_ts_plat_data {
|
|||
bool poweron_calibration;
|
||||
bool suppression_ctrl;
|
||||
bool pill_region_ctrl;
|
||||
bool hold_distance_ctrl;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ static ssize_t sec_mmi_pill_region_store(struct device *dev,
|
|||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_pill_region_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
static ssize_t sec_mmi_hold_distance_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_hold_distance_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
static ssize_t sec_mmi_address_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_mmi_size_store(struct device *dev,
|
||||
|
|
@ -67,6 +71,8 @@ static DEVICE_ATTR(suppression, (S_IRUGO | S_IWUSR | S_IWGRP),
|
|||
sec_mmi_suppression_show, sec_mmi_suppression_store);
|
||||
static DEVICE_ATTR(pill_region, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
sec_mmi_pill_region_show, sec_mmi_pill_region_store);
|
||||
static DEVICE_ATTR(hold_distance, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
sec_mmi_hold_distance_show, sec_mmi_hold_distance_store);
|
||||
|
||||
#define MAX_ATTRS_ENTRIES 10
|
||||
#define ADD_ATTR(name) { \
|
||||
|
|
@ -97,6 +103,9 @@ static int sec_mmi_extend_attribute_group(struct device *dev, struct attribute_g
|
|||
if (ts->plat_data->pill_region_ctrl)
|
||||
ADD_ATTR(pill_region);
|
||||
|
||||
if (ts->plat_data->hold_distance_ctrl)
|
||||
ADD_ATTR(hold_distance);
|
||||
|
||||
if (strncmp(bi_bootmode(), "mot-factory", strlen("mot-factory")) == 0) {
|
||||
ADD_ATTR(address);
|
||||
ADD_ATTR(size);
|
||||
|
|
@ -334,6 +343,53 @@ static ssize_t sec_mmi_pill_region_show(struct device *dev,
|
|||
return blen;
|
||||
}
|
||||
|
||||
static ssize_t sec_mmi_hold_distance_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct sec_ts_data *ts;
|
||||
unsigned char buffer;
|
||||
unsigned long value;
|
||||
int error;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
GET_TS_DATA(dev);
|
||||
|
||||
error = kstrtoul(buf, 0, &value);
|
||||
if (error)
|
||||
return -EINVAL;
|
||||
|
||||
buffer = (unsigned char)value;
|
||||
dev_dbg(dev, "%s: program value 0x%02x\n", __func__, (unsigned int)buffer);
|
||||
|
||||
error = ts->sec_ts_i2c_write(ts, SEC_TS_CMD_HOLD_DISTANCE, &buffer, sizeof(buffer));
|
||||
if (error < 0)
|
||||
dev_err(dev, "%s: failed to write hold distance (%d)\n",
|
||||
__func__, error);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t sec_mmi_hold_distance_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct sec_ts_data *ts;
|
||||
unsigned char buffer;
|
||||
ssize_t blen = 0;
|
||||
int error;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
GET_TS_DATA(dev);
|
||||
|
||||
error = ts->sec_ts_i2c_read(ts, SEC_TS_CMD_HOLD_DISTANCE, &buffer, sizeof(buffer));
|
||||
if (error < 0)
|
||||
dev_err(dev, "%s: failed to read hold distance info (%d)\n",
|
||||
__func__, error);
|
||||
else {
|
||||
blen += scnprintf(buf, PAGE_SIZE, "0x%02x", (unsigned int)buffer);
|
||||
}
|
||||
|
||||
return blen;
|
||||
}
|
||||
|
||||
#define MAX_DATA_SZ 1024
|
||||
static u8 reg_address;
|
||||
|
|
|
|||
Loading…
Reference in a new issue