mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 15:11:48 -04:00
Support touchscreen class in the parade drvier code.
TP: Add initial support for touchscreen class in the parade drvier code. Change-Id: I6c994978ba6ff41abbb8b572825d2a85dd3a8e73 Signed-off-by: zhuwg1 <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2182089 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: litong <litong20@motorola.com> Reviewed-by: Jichao Zou <zoujc@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
7f4f72e425
commit
3e3487b5e2
9 changed files with 289 additions and 0 deletions
|
|
@ -30,11 +30,23 @@ ifeq ($(TOUCHSCREEN_CYPRESS_CYTTSP5_PROXIMITY),true)
|
|||
KBUILD_OPTIONS += CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_PROXIMITY=y
|
||||
endif
|
||||
|
||||
ifeq ($(DRM_PANEL_EVENT_NOTIFICATIONS),true)
|
||||
KBUILD_OPTIONS += CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS=y
|
||||
endif
|
||||
|
||||
ifeq ($(DRM_PANEL_NOTIFICATIONS),true)
|
||||
KBUILD_OPTIONS += CONFIG_DRM_PANEL_NOTIFICATIONS=y
|
||||
endif
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := parade_tma5xx_mmi_core.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
ifneq ($(findstring touchscreen_mmi.ko,$(BOARD_VENDOR_KERNEL_MODULES)),)
|
||||
KBUILD_OPTIONS += CONFIG_INPUT_TOUCHSCREEN_MMI=y
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES += $(KERNEL_MODULES_OUT)/touchscreen_mmi.ko
|
||||
endif
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
|
|
|||
|
|
@ -60,3 +60,18 @@ ifneq ($(filter m y, $(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS_API)),)
|
|||
EXTRA_CFLAGS += -DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP5_DEVICE_ACCESS_API
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_INPUT_TOUCHSCREEN_MMI
|
||||
parade_tma5xx_mmi_core-objs += cyttsp5_ts_mmi.o
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_EVENT_NOTIFICATIONS
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y,$(CONFIG_DRM_PANEL_NOTIFICATIONS)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_NOTIFICATIONS
|
||||
endif
|
||||
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../touchscreen_mmi/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
|
|
@ -12,3 +12,5 @@ modules_install:
|
|||
clean:
|
||||
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
|
||||
rm -rf .tmp_versions
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(M)/../touchscreen_mmi/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
#include "cyttsp5_regs.h"
|
||||
#include "cyttsp5_ts_mmi.h"
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
|
|
@ -6513,6 +6514,15 @@ int cyttsp5_probe(const struct cyttsp5_bus_ops *ops, struct device *dev,
|
|||
/* Probe registered modules */
|
||||
cyttsp5_probe_modules(cd);
|
||||
|
||||
#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI
|
||||
dev_info(dev, "%s:cyttsp5_ts_mmi_dev_register",__func__);
|
||||
rc = cyttsp5_ts_mmi_dev_register(dev);
|
||||
if (rc) {
|
||||
dev_info(dev, "Failed register touchscreen mmi.");
|
||||
goto error_startup_btn;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
cyttsp5_setup_early_suspend(cd);
|
||||
#elif defined(CONFIG_FB)
|
||||
|
|
@ -6590,6 +6600,11 @@ int cyttsp5_release(struct cyttsp5_core_data *cd)
|
|||
|
||||
cyttsp5_stop_wd_timer(cd);
|
||||
|
||||
#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI
|
||||
dev_info(dev, "%s:cyttsp5_ts_mmi_dev_register", __func__);
|
||||
cyttsp5_ts_mmi_dev_unregister(dev);
|
||||
#endif
|
||||
|
||||
#if (KERNEL_VERSION(3, 16, 0) > LINUX_VERSION_CODE)
|
||||
device_wakeup_disable(dev);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -600,6 +600,11 @@ static struct cyttsp5_core_platform_data *create_and_get_core_pdata(
|
|||
if (!rc)
|
||||
pdata->easy_wakeup_gesture = (u8)value;
|
||||
|
||||
rc = of_property_read_string(core_node, "cy,class-entry-name",
|
||||
&pdata->class_entry_name);
|
||||
if (!rc)
|
||||
pr_notice("%s, class entry name '%s'\n", __func__, pdata->class_entry_name);
|
||||
|
||||
for (i = 0; (unsigned int)i < ARRAY_SIZE(touch_setting_names); i++) {
|
||||
if (touch_setting_names[i] == NULL)
|
||||
continue;
|
||||
|
|
@ -656,6 +661,7 @@ int cyttsp5_devtree_create_and_get_pdata(struct device *adap_dev)
|
|||
enum cyttsp5_device_type type;
|
||||
int count = 0;
|
||||
int rc = 0;
|
||||
const char *name_tmp;
|
||||
|
||||
if (!adap_dev->of_node)
|
||||
return 0;
|
||||
|
|
@ -667,6 +673,16 @@ int cyttsp5_devtree_create_and_get_pdata(struct device *adap_dev)
|
|||
adap_dev->platform_data = pdata;
|
||||
set_pdata_ptr(pdata);
|
||||
|
||||
/* get ic name */
|
||||
rc = of_property_read_string(adap_dev->of_node, "ic_name", &name_tmp);
|
||||
if (rc) {
|
||||
pr_err("%s, get ic_name failed", __func__);
|
||||
return rc;
|
||||
} else {
|
||||
pr_info("%s, ic_name form dt: %s", __func__, name_tmp);
|
||||
strncpy(pdata->ic_name, name_tmp, sizeof(pdata->ic_name));
|
||||
}
|
||||
|
||||
/* There should be only one core node */
|
||||
for_each_child_of_node(adap_dev->of_node, core_node) {
|
||||
const char *name;
|
||||
|
|
|
|||
|
|
@ -1028,6 +1028,9 @@ struct cyttsp5_core_data {
|
|||
u32 watchdog_interval;
|
||||
u8 show_timestamp;
|
||||
u8 mfg_data[MFG_DATA_NUM];
|
||||
|
||||
/* touchscreen_mmi */
|
||||
struct ts_mmi_class_methods *imports;
|
||||
};
|
||||
struct gd_sensor {
|
||||
int32_t cm_min;
|
||||
|
|
|
|||
192
drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_ts_mmi.c
Normal file
192
drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_ts_mmi.c
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
/*
|
||||
* Parade tma5xx touchscreen driver MMI class extention
|
||||
*
|
||||
* Copyright (C) 2022 Motorola Mobility
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
|
||||
#include "cyttsp5_ts_mmi.h"
|
||||
#include "cyttsp5_regs.h"
|
||||
|
||||
#define ASSERT_PTR(p) if (p == NULL) { \
|
||||
dev_err(dev, "Failed to get driver data"); \
|
||||
return -ENODEV; \
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_vendor(struct device *dev, void *cdata) {
|
||||
return scnprintf(TO_CHARP(cdata), TS_MMI_MAX_VENDOR_LEN, "%s", "parade");
|
||||
}
|
||||
|
||||
static int cyttsp5_mmi_get_class_entry_name(struct device *dev, void *cdata) {
|
||||
struct cyttsp5_platform_data *pdata = dev_get_platdata(dev);
|
||||
ASSERT_PTR(pdata);
|
||||
return scnprintf(TO_CHARP(cdata), TS_MMI_MAX_VENDOR_LEN, "%s", pdata->core_pdata->class_entry_name);
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_productinfo(struct device *dev, void *cdata) {
|
||||
char* ic_info;
|
||||
struct cyttsp5_platform_data *pdata = dev_get_platdata(dev);
|
||||
ASSERT_PTR(pdata);
|
||||
|
||||
ic_info = strstr(pdata->ic_name, ",");
|
||||
ic_info++;
|
||||
|
||||
return scnprintf(TO_CHARP(cdata), TS_MMI_MAX_VENDOR_LEN, "%s", ic_info);
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_build_id(struct device *dev, void *cdata) {
|
||||
u32 fw_ver_img;
|
||||
u32 fw_revctrl_img;
|
||||
u16 fw_config_ver_img;
|
||||
struct cyttsp5_sysinfo *si;
|
||||
|
||||
struct cyttsp5_core_commands *cmd = cyttsp5_get_commands();
|
||||
if (!cmd)
|
||||
return -EINVAL;
|
||||
|
||||
si = cmd->request_sysinfo(dev);
|
||||
if (!si)
|
||||
dev_err(dev, "%s: Fail get sysinfo pointer from core\n", __func__);
|
||||
|
||||
fw_ver_img = si->cydata.fw_ver_major << 8;
|
||||
fw_ver_img += si->cydata.fw_ver_minor;
|
||||
fw_revctrl_img = si->cydata.revctrl;
|
||||
fw_config_ver_img = si->cydata.fw_ver_conf;
|
||||
|
||||
parade_debug(dev, DEBUG_LEVEL_1,
|
||||
"%s: img vers:0x%04X ,revctrl vers:0x%04X, fw_config vers:0x%04X\n", __func__,
|
||||
fw_ver_img, fw_revctrl_img, fw_config_ver_img);
|
||||
|
||||
return snprintf(TO_CHARP(cdata), TS_MMI_MAX_ID_LEN, "%04x", le32_to_cpu(fw_config_ver_img));
|
||||
}
|
||||
|
||||
/*return firmware version*/
|
||||
static int cyttsp5_ts_mmi_methods_get_config_id(struct device *dev, void *cdata) {
|
||||
u32 fw_ver_img;
|
||||
u32 fw_revctrl_img;
|
||||
struct cyttsp5_sysinfo *si;
|
||||
|
||||
struct cyttsp5_core_commands *cmd = cyttsp5_get_commands();
|
||||
if (!cmd)
|
||||
return -EINVAL;
|
||||
|
||||
si = cmd->request_sysinfo(dev);
|
||||
if (!si)
|
||||
dev_err(dev, "%s: Fail get sysinfo pointer from core\n", __func__);
|
||||
|
||||
fw_ver_img = si->cydata.fw_ver_major << 8;
|
||||
fw_ver_img += si->cydata.fw_ver_minor;
|
||||
fw_revctrl_img = si->cydata.revctrl;
|
||||
|
||||
parade_debug(dev, DEBUG_LEVEL_1,
|
||||
"%s: img vers:0x%04X ,revctrl vers:0x%04X\n", __func__,
|
||||
fw_ver_img, fw_revctrl_img);
|
||||
|
||||
return snprintf(TO_CHARP(cdata), TS_MMI_MAX_ID_LEN, "%04x", le32_to_cpu(fw_revctrl_img));
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_bus_type(struct device *dev, void *idata) {
|
||||
struct cyttsp5_core_data *cd = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(cd);
|
||||
|
||||
TO_INT(idata) = cd->bus_ops->bustype == BUS_I2C ?
|
||||
TOUCHSCREEN_MMI_BUS_TYPE_I2C : TOUCHSCREEN_MMI_BUS_TYPE_SPI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_irq_status(struct device *dev, void *idata) {
|
||||
struct cyttsp5_platform_data *pdata = dev_get_platdata(dev);
|
||||
ASSERT_PTR(pdata);
|
||||
|
||||
TO_INT(idata) = gpio_get_value(pdata->core_pdata->irq_gpio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_drv_irq(struct device *dev, void *idata) {
|
||||
struct cyttsp5_core_data *cd = dev_get_drvdata(dev);
|
||||
ASSERT_PTR(cd);
|
||||
|
||||
TO_INT(idata) = cd ->irq_enabled;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_poweron(struct device *dev, void *idata)
|
||||
{
|
||||
TO_INT(idata) = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_get_flashprog(struct device *dev, void *idata) {
|
||||
int rc;
|
||||
u8 mode;
|
||||
struct cyttsp5_core_commands *cmd = cyttsp5_get_commands();
|
||||
if (!cmd)
|
||||
return -EINVAL;
|
||||
|
||||
rc = cmd->request_get_mode(dev, 0, &mode);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
TO_INT(idata) = mode == CY_MODE_BOOTLOADER ? 1 : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cyttsp5_ts_mmi_methods_reset(struct device *dev, int type) {
|
||||
struct cyttsp5_core_commands *cmd = cyttsp5_get_commands();
|
||||
if (!cmd)
|
||||
return -EINVAL;
|
||||
|
||||
cmd->request_reset(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ts_mmi_methods cyttsp5_ts_mmi_methods = {
|
||||
.get_vendor = cyttsp5_ts_mmi_methods_get_vendor,
|
||||
.get_class_entry_name = cyttsp5_mmi_get_class_entry_name,
|
||||
.get_productinfo = cyttsp5_ts_mmi_methods_get_productinfo,
|
||||
.get_build_id = cyttsp5_ts_mmi_methods_get_build_id,
|
||||
.get_config_id = cyttsp5_ts_mmi_methods_get_config_id,
|
||||
.get_bus_type = cyttsp5_ts_mmi_methods_get_bus_type,
|
||||
.get_irq_status = cyttsp5_ts_mmi_methods_get_irq_status,
|
||||
.get_drv_irq = cyttsp5_ts_mmi_methods_get_drv_irq,
|
||||
.get_poweron = cyttsp5_ts_mmi_methods_get_poweron,
|
||||
.get_flashprog = cyttsp5_ts_mmi_methods_get_flashprog,
|
||||
/* SET methods */
|
||||
.reset = cyttsp5_ts_mmi_methods_reset,
|
||||
};
|
||||
|
||||
int cyttsp5_ts_mmi_dev_register(struct device *dev) {
|
||||
int ret;
|
||||
struct cyttsp5_core_data *cd = dev_get_drvdata(dev);
|
||||
|
||||
ret = ts_mmi_dev_register(dev, &cyttsp5_ts_mmi_methods);
|
||||
if (ret) {
|
||||
dev_err(dev, "%s, Failed to register ts mmi\n", __func__);
|
||||
return ret;
|
||||
}
|
||||
dev_info(dev, "%s, Register ts mmi success\n", __func__);
|
||||
|
||||
cd->imports = &cyttsp5_ts_mmi_methods.exports;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cyttsp5_ts_mmi_dev_unregister(struct device *dev) {
|
||||
struct cyttsp5_core_data *cd = dev_get_drvdata(dev);
|
||||
|
||||
if (!cd)
|
||||
dev_err(dev ,"Failed to get driver data");
|
||||
ts_mmi_dev_unregister(dev);
|
||||
}
|
||||
|
||||
30
drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_ts_mmi.h
Normal file
30
drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_ts_mmi.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Motorola Mobility LLC
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
#ifndef __CYTTSP5_TS_MMI_H__
|
||||
#define __CYTTSP5_TS_MMI_H__
|
||||
|
||||
#include <linux/touchscreen_mmi.h>
|
||||
|
||||
#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI
|
||||
int cyttsp5_ts_mmi_dev_register(struct device *dev);
|
||||
void cyttsp5_ts_mmi_dev_unregister(struct device *dev);
|
||||
#else
|
||||
static int inline cyttsp5_ts_mmi_dev_register(struct device *dev) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
static void inline cyttsp5_ts_mmi_dev_unregister(struct device *dev) {
|
||||
return ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -56,6 +56,8 @@ __stringify(CY_DRIVER_NAME) \
|
|||
/* abs settings */
|
||||
#define CY_IGNORE_VALUE -1
|
||||
|
||||
#define CYTTSP5_MAX_STR_LABLE_LEN 64
|
||||
|
||||
enum cyttsp5_core_platform_flags {
|
||||
CY_CORE_FLAG_NONE,
|
||||
CY_CORE_FLAG_POWEROFF_ON_SLEEP = 0x02,
|
||||
|
|
@ -119,6 +121,7 @@ struct cyttsp5_core_platform_data {
|
|||
u16 hid_desc_register;
|
||||
u16 vendor_id;
|
||||
u16 product_id;
|
||||
const char *class_entry_name;
|
||||
|
||||
int (*xres)(struct cyttsp5_core_platform_data *pdata,
|
||||
struct device *dev);
|
||||
|
|
@ -169,6 +172,7 @@ struct cyttsp5_proximity_platform_data {
|
|||
};
|
||||
|
||||
struct cyttsp5_platform_data {
|
||||
char ic_name[CYTTSP5_MAX_STR_LABLE_LEN];
|
||||
struct cyttsp5_core_platform_data *core_pdata;
|
||||
struct cyttsp5_mt_platform_data *mt_pdata;
|
||||
struct cyttsp5_btn_platform_data *btn_pdata;
|
||||
|
|
|
|||
Loading…
Reference in a new issue