input: nova_0flash_mmi: add timestamp for touchscreen mmi

nova_0flash_mmi:
Add timestamp node for touchscreen mmi.

Change-Id: I11b9bcf010e5e939ad1c885c39eeaf767d335afb
Signed-off-by: wangyq13 <wangyq13@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2417921
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jing Hu <hujing3@lenovo.com>
Reviewed-by: Jun Weng <wengjun1@motorola.com>
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wangyq13 2022-11-01 17:32:10 +08:00 • committed by Yeqing Wang
commit b7a4c6e377
2 changed files with 30 additions and 1 deletions

View file

@ -12,7 +12,7 @@ ifneq ($(BOARD_USES_DOUBLE_TAP),)
endif
ifeq ($(TOUCHSCREEN_LAST_TIME),true)
KERNEL_CFLAGS += CONFIG_NOVA_TOUCH_LAST_TIME=y
KBUILD_OPTIONS += CONFIG_NOVA_TOUCH_LAST_TIME=y
endif
ifneq ($(MOTO_PANEL_CHECK_TOUCH_STATE),)

View file

@ -41,6 +41,10 @@ static ssize_t nvt_mmi_edge_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t size);
static ssize_t nvt_mmi_edge_show(struct device *dev,
struct device_attribute *attr, char *buf);
#ifdef NVT_TOUCH_LAST_TIME
static ssize_t nvt_mmi_timestamp_show(struct device *dev,
struct device_attribute *attr, char *buf);
#endif
static DEVICE_ATTR(interpolation, (S_IRUGO | S_IWUSR | S_IWGRP),
nvt_mmi_interpolation_show, nvt_mmi_interpolation_store);
@ -50,6 +54,9 @@ static DEVICE_ATTR(jitter, (S_IRUGO | S_IWUSR | S_IWGRP),
nvt_mmi_jitter_show, nvt_mmi_jitter_store);
static DEVICE_ATTR(edge, (S_IRUGO | S_IWUSR | S_IWGRP),
nvt_mmi_edge_show, nvt_mmi_edge_store);
#ifdef NVT_TOUCH_LAST_TIME
static DEVICE_ATTR(timestamp, S_IRUGO, nvt_mmi_timestamp_show, NULL);
#endif
#define MAX_ATTRS_ENTRIES 10
#define UI_FEATURE_ENABLE 1
@ -148,6 +155,10 @@ static int nvt_mmi_extend_attribute_group(struct device *dev, struct attribute_g
ADD_ATTR(palm_settings);
#endif
#ifdef NVT_TOUCH_LAST_TIME
ADD_ATTR(timestamp);
#endif
if (idx) {
ext_attributes[idx] = NULL;
*group = &ext_attr_group;
@ -363,6 +374,24 @@ static ssize_t nvt_mmi_edge_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "0x%02x 0x%02x\n", ts->edge_cmd[2], ts->rotate_cmd);
}
#ifdef NVT_TOUCH_LAST_TIME
static ssize_t nvt_mmi_timestamp_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
ktime_t last_ktime;
struct timespec64 last_ts;
mutex_lock(&ts->lock);
last_ktime = ts->last_event_time;
ts->last_event_time = 0;
mutex_unlock(&ts->lock);
last_ts = ktime_to_timespec64(last_ktime);
return scnprintf(buf, PAGE_SIZE, "%lld.%ld\n", last_ts.tv_sec, last_ts.tv_nsec);
}
#endif
static int nvt_mmi_methods_get_vendor(struct device *dev, void *cdata)
{
return scnprintf(TO_CHARP(cdata), TS_MMI_MAX_VENDOR_LEN, "%s", "novatek_ts");