summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2021-10-26 18:11:58 +0800
committerdavidycchen <davidycchen@google.com>2021-11-29 13:43:19 +0800
commit5985a3a19ebc1cd38a0eb67cc998acc343cb07b3 (patch)
tree6171fdabd4183aa12521f4dae3ee55f22844e6ab
parent8d731b8cfb5a2733598b04ea7e69ccddcbee9416 (diff)
downloadsynaptics_touch-5985a3a19ebc1cd38a0eb67cc998acc343cb07b3.tar.gz
synaptics: update driver version to 0113
Support heatmap report type. Bug: 199104316 Test: Successfully get heatmap from touch. Signed-off-by: davidycchen <davidycchen@google.com> Change-Id: I7bd82cac345d753a0f5b182057fd68c3fb045333
-rw-r--r--syna_tcm2.c15
-rw-r--r--syna_tcm2.h9
-rw-r--r--syna_tcm2_sysfs.c52
-rw-r--r--tcm/synaptics_touchcom_core_dev.h3
4 files changed, 55 insertions, 24 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c
index d70803c..c43027e 100644
--- a/syna_tcm2.c
+++ b/syna_tcm2.c
@@ -704,6 +704,20 @@ static irqreturn_t syna_dev_interrupt_thread(int irq, void *data)
}
}
+ /* handling the particular report data */
+ switch (code) {
+ case REPORT_HEAT_MAP:
+ /* for 'heat map' ($c1) report,
+ * report data has been stored at tcm->event_data.buf;
+ * while, tcm->event_data.data_length is the size of data
+ */
+ LOGD("Heat map data received, size:%d\n",
+ tcm->event_data.data_length);
+ break;
+ default:
+ break;
+ }
+
exit:
syna_set_bus_ref(tcm, SYNA_BUS_REF_IRQ, false);
return IRQ_HANDLED;
@@ -958,7 +972,6 @@ static void syna_dev_reflash_startup_work(struct work_struct *work)
LOGE("Fail to register input device\n");
goto exit;
}
-
exit:
syna_set_bus_ref(tcm, SYNA_BUS_REF_FW_UPDATE, false);
pm_relax(&tcm->pdev->dev);
diff --git a/syna_tcm2.h b/syna_tcm2.h
index 23647d2..6dd568e 100644
--- a/syna_tcm2.h
+++ b/syna_tcm2.h
@@ -54,7 +54,7 @@
#define SYNAPTICS_TCM_DRIVER_ID (1 << 0)
#define SYNAPTICS_TCM_DRIVER_VERSION 1
-#define SYNAPTICS_TCM_DRIVER_SUBVER "2.0"
+#define SYNAPTICS_TCM_DRIVER_SUBVER "2.2"
/**
* @section: Driver Configurations
@@ -279,6 +279,13 @@ enum {
};
/**
+ * @brief: Custom Commands, Reports, or Events
+ */
+enum custom_report_type {
+ REPORT_HEAT_MAP = 0xc1,
+};
+
+/**
* @brief: context of the synaptics linux-based driver
*
* The structure defines the kernel specific data in linux-based driver
diff --git a/syna_tcm2_sysfs.c b/syna_tcm2_sysfs.c
index 8755654..6bcf757 100644
--- a/syna_tcm2_sysfs.c
+++ b/syna_tcm2_sysfs.c
@@ -45,6 +45,19 @@
#include "syna_tcm2_testing.h"
#endif
+#if (KERNEL_VERSION(5, 9, 0) <= LINUX_VERSION_CODE) || \
+ defined(HAVE_UNLOCKED_IOCTL)
+#define USE_UNLOCKED_IOCTL
+#endif
+
+#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+#define USE_COMPAT_IOCTL
+#endif
+
+#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
+#define REPLACE_KTIME
+#endif
+
/* #define ENABLE_PID_TASK */
@@ -58,7 +71,7 @@ struct syna_ioctl_data {
unsigned char __user *buf;
};
-#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+#ifdef USE_COMPAT_IOCTL
struct syna_tcm_ioctl_data_compat {
unsigned int data_length;
unsigned int buf_size;
@@ -159,7 +172,7 @@ struct fifo_queue {
struct list_head next;
unsigned char *fifo_data;
unsigned int data_length;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0))
+#ifdef REPLACE_KTIME
struct timespec64 timestamp;
#else
struct timeval timestamp;
@@ -201,12 +214,6 @@ static ssize_t syna_sysfs_info_show(struct kobject *kobj,
count = 0;
- if (!tcm->is_connected) {
- retval = scnprintf(buf, PAGE_SIZE - count,
- "Device is NOT connected\n");
- goto exit;
- }
-
retval = scnprintf(buf, PAGE_SIZE - count,
"Driver version: %d.%s\n",
SYNAPTICS_TCM_DRIVER_VERSION,
@@ -227,6 +234,12 @@ static ssize_t syna_sysfs_info_show(struct kobject *kobj,
buf += retval;
count += retval;
+ if (!tcm->is_connected) {
+ retval = scnprintf(buf, PAGE_SIZE - count,
+ "Device is NOT connected\n");
+ goto exit;
+ }
+
retval = scnprintf(buf, PAGE_SIZE - count,
"TouchComm version: %d\n", tcm_dev->id_info.version);
if (retval < 0)
@@ -1007,7 +1020,7 @@ static int syna_cdev_insert_fifo(struct syna_tcm *tcm,
pfifo_data->data_length = length;
memcpy((void *)pfifo_data->fifo_data, (void *)buf_ptr, length);
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0))
+#ifdef REPLACE_KTIME
ktime_get_real_ts64(&(pfifo_data->timestamp));
#else
do_gettimeofday(&(pfifo_data->timestamp));
@@ -1248,6 +1261,10 @@ static int syna_cdev_ioctl_get_frame(struct syna_tcm *tcm,
pfifo_data->fifo_data[2], pfifo_data->fifo_data[3]);
list_del(&pfifo_data->next);
+
+ if (retval >= 0)
+ retval = pfifo_data->data_length;
+
kfree(pfifo_data->fifo_data);
kfree(pfifo_data);
if (tcm->fifo_remaining_frame != 0)
@@ -1255,9 +1272,6 @@ static int syna_cdev_ioctl_get_frame(struct syna_tcm *tcm,
syna_pal_mutex_unlock(&g_fifo_queue_mutex);
- if (retval >= 0)
- retval = pfifo_data->data_length;
-
exit:
return retval;
}
@@ -1769,8 +1783,8 @@ static int syna_cdev_ioctl_raw_write(struct syna_tcm *tcm,
goto exit;
}
- LOGD("Write command: 0x%02x, legnth: 0x%02x, 0x%02x\n",
- data[0], data[1], data[2]);
+ LOGD("Write command: 0x%02x, legnth: 0x%02x, 0x%02x (size:%d)\n",
+ data[0], data[1], data[2], wr_size);
retval = syna_tcm_write(tcm->tcm_dev,
data,
@@ -1933,8 +1947,7 @@ static int syna_cdev_ioctl_old_dispatch(struct syna_tcm *tcm,
* @return
* on success, 0; otherwise, negative value on error.
*/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) || \
- defined (HAVE_UNLOCKED_IOCTL)
+#ifdef USE_UNLOCKED_IOCTL
static long syna_cdev_ioctls(struct file *filp, unsigned int cmd,
unsigned long arg)
#else
@@ -2004,7 +2017,7 @@ exit:
return retval;
}
-#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+#ifdef USE_COMPAT_IOCTL
/**
* syna_cdev_compat_ioctls()
*
@@ -2283,10 +2296,9 @@ static int syna_cdev_release(struct inode *inp, struct file *filp)
*/
static const struct file_operations device_fops = {
.owner = THIS_MODULE,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0)) || \
- defined (HAVE_UNLOCKED_IOCTL)
+#ifdef USE_UNLOCKED_IOCTL
.unlocked_ioctl = syna_cdev_ioctls,
-#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+#ifdef USE_COMPAT_IOCTL
.compat_ioctl = syna_cdev_compat_ioctls,
#endif
#else
diff --git a/tcm/synaptics_touchcom_core_dev.h b/tcm/synaptics_touchcom_core_dev.h
index ab462e1..f877af1 100644
--- a/tcm/synaptics_touchcom_core_dev.h
+++ b/tcm/synaptics_touchcom_core_dev.h
@@ -44,7 +44,7 @@
#include "syna_tcm2_platform.h"
-#define SYNA_TCM_CORE_LIB_VERSION 0x0112
+#define SYNA_TCM_CORE_LIB_VERSION 0x0113
/**
@@ -728,7 +728,6 @@ struct tcm_dev {
void *cbdata_touch_data_parse;
tcm_gesture_parse_callback_t custom_gesture_parse_func;
void *cbdata_gesture_parse;
-
};
/* end of structure syna_tcm_dev */