mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
stmicro: support touch film sensitivity switching
TP: support touch film sensitivity switching With phone film : C0 20 01 Without Phone film: C0 20 00 Change-Id: I5ef4ecfc3e3a7b40235350ec11236ce11fdf7fdb Reviewed-on: https://gerrit.mot.com/2098548 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
d7c429aa5d
commit
0d19c2eeb7
3 changed files with 76 additions and 0 deletions
|
|
@ -4018,6 +4018,12 @@ static int parse_dt(struct device *dev, struct fts_hw_platform_data *bdata)
|
|||
logError(1, "%s Support edge switching.\n", tag);
|
||||
}
|
||||
|
||||
if (of_property_read_u8_array(np, "st,sensitivity_cmd",
|
||||
bdata->sensitivity_cmd, 3) == 0) {
|
||||
bdata->sensitivity_ctrl = true;
|
||||
logError(1, "%s Support film sensitivity switching.\n", tag);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,6 +247,8 @@ struct fts_hw_platform_data {
|
|||
bool report_rate_ctrl; /* /< support report rate switching */
|
||||
u8 edge_cmd[4]; /* /< edge switching command */
|
||||
bool edge_ctrl; /* /< edge rate switching */
|
||||
u8 sensitivity_cmd[3]; /* /< sensitivity switching command */
|
||||
bool sensitivity_ctrl; /* /< sensitivity switching */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -378,6 +380,7 @@ struct fts_ts_info {
|
|||
unsigned int report_rate;
|
||||
unsigned int refresh_rate;
|
||||
unsigned int first_filter_val;
|
||||
unsigned int sensitivity_val;
|
||||
u8 jitter_val[8];
|
||||
u8 linearity_val[3];
|
||||
u8 edge_val[4];
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ static ssize_t fts_mmi_edge_store(struct device *dev,
|
|||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t fts_mmi_edge_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
static ssize_t fts_mmi_sensitivity_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t fts_mmi_sensitivity_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static DEVICE_ATTR(calibrate, (S_IWUSR | S_IWGRP), NULL, fts_mmi_calibrate_store);
|
||||
static DEVICE_ATTR(interpolation, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
|
|
@ -70,6 +74,8 @@ static DEVICE_ATTR(jitter, (S_IRUGO | S_IWUSR | S_IWGRP),
|
|||
fts_mmi_jitter_show, fts_mmi_jitter_store);
|
||||
static DEVICE_ATTR(edge, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
fts_mmi_edge_show, fts_mmi_edge_store);
|
||||
static DEVICE_ATTR(sensitivity, (S_IRUGO | S_IWUSR | S_IWGRP),
|
||||
fts_mmi_sensitivity_show, fts_mmi_sensitivity_store);
|
||||
|
||||
#define MAX_ATTRS_ENTRIES 10
|
||||
/* hal settings */
|
||||
|
|
@ -126,6 +132,9 @@ static int fts_mmi_extend_attribute_group(struct device *dev, struct attribute_g
|
|||
if (ts->board->edge_ctrl)
|
||||
ADD_ATTR(edge);
|
||||
|
||||
if (ts->board->sensitivity_ctrl)
|
||||
ADD_ATTR(sensitivity);
|
||||
|
||||
if (strncmp(bi_bootmode(), "mot-factory", strlen("mot-factory")) == 0) {
|
||||
ADD_ATTR(calibrate);
|
||||
}
|
||||
|
|
@ -286,6 +295,56 @@ static ssize_t fts_mmi_jitter_show(struct device *dev,
|
|||
(ts->jitter_val[6] << 8 | ts->jitter_val[7]));
|
||||
}
|
||||
|
||||
static ssize_t fts_mmi_sensitivity_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct fts_ts_info *ts;
|
||||
struct fts_hw_platform_data *board;
|
||||
int ret = 0;
|
||||
unsigned long mode = 0;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
ts = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(ts);
|
||||
board = ts->board;
|
||||
|
||||
ret = kstrtoul(buf, 16, &mode);
|
||||
if (ret < 0) {
|
||||
pr_info("Failed to convert value.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (ts->sensitivity_val == mode) {
|
||||
pr_debug("value is same, so not write.\n");
|
||||
return size;
|
||||
}
|
||||
|
||||
board->sensitivity_cmd[2] = mode;
|
||||
|
||||
ret = fts_write(board->sensitivity_cmd, ARRAY_SIZE(board->sensitivity_cmd));
|
||||
if (ret == OK) {
|
||||
pr_info("Successfully to %s sensitivity mode!\n", (!!mode ? "Enable" : "Disable"));
|
||||
ts->sensitivity_val = mode;
|
||||
} else
|
||||
pr_err("Failed to %s sensitivity mode!\n", (!!mode ? "Enable" : "Disable"));
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t fts_mmi_sensitivity_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct fts_ts_info *ts;
|
||||
|
||||
dev = MMI_DEV_TO_TS_DEV(dev);
|
||||
ts = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(ts);
|
||||
|
||||
pr_info("Sensitivity mode is %s!\n", (!!ts->sensitivity_val ? "Enable" : "Disable"));
|
||||
return scnprintf(buf, PAGE_SIZE, "0x%02x", ts->sensitivity_val);
|
||||
};
|
||||
|
||||
|
||||
static ssize_t fts_mmi_linearity_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
|
|
@ -716,6 +775,12 @@ static int fts_mmi_post_resume(struct device *dev)
|
|||
dev_dbg(dev, "%s: Successfully to restore edge mode!\n", __func__);
|
||||
}
|
||||
|
||||
if (ts->board->sensitivity_ctrl) {
|
||||
ret = fts_write(board->sensitivity_cmd, ARRAY_SIZE(board->sensitivity_cmd));
|
||||
if (ret == OK)
|
||||
dev_dbg(dev, "%s: Successfully to restore edge mode!\n", __func__);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -848,6 +913,8 @@ int fts_mmi_init(struct fts_ts_info *ts, bool enable)
|
|||
/* Disable first filter function */
|
||||
if (ts->board->first_filter_ctrl)
|
||||
ts->first_filter_val = 0x00;
|
||||
if (ts->board->sensitivity_ctrl)
|
||||
ts->sensitivity_val = 0x00;
|
||||
|
||||
} else
|
||||
ts_mmi_dev_unregister(ts->dev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue