mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
Fix FocalTech driver build error when use GKI2.0
GKI2.0 doens't allow to export kernel_read and kernel_write api, so we get the firmware and ini config file via request_firmware() and write test result via procfs node. Change-Id: I7fdfa40f454a6fcb9ce69d0e4a9cd1b7caf9a62b Signed-off-by: Wenge Zhu <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2375413 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou <zoujc@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
ef350cb89f
commit
4fb1fad5ba
7 changed files with 182 additions and 3 deletions
|
|
@ -33,6 +33,10 @@ ifeq ($(FTS_NOISE_TEST_P2P),true)
|
|||
KBUILD_OPTIONS += CONFIG_FTS_NOISE_TEST_P2P=y
|
||||
endif
|
||||
|
||||
ifeq ($(FTS_COMPATIBLE_WITH_GKI),true)
|
||||
KBUILD_OPTIONS += CONFIG_FTS_COMPATIBLE_WITH_GKI=y
|
||||
endif
|
||||
|
||||
else
|
||||
ifneq ($(FOCALTECH_TOUCH_IC_NAME),)
|
||||
KERNEL_CFLAGS += CONFIG_INPUT_FOCALTECH_V3_MMI_IC_NAME=$(FOCALTECH_TOUCH_IC_NAME)
|
||||
|
|
|
|||
|
|
@ -51,5 +51,9 @@ ifneq ($(filter m y, $(CONFIG_FTS_NOISE_TEST_P2P)),)
|
|||
EXTRA_CFLAGS += -DCONFIG_FTS_NOISE_TEST_P2P
|
||||
endif
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_FTS_NOISE_TEST_P2P)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
endif
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/../../kernel/msm-$(MODULE_KERNEL_VERSION)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../mmi_info/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ struct fts_ts_data {
|
|||
wait_queue_head_t ts_waitqueue;
|
||||
struct ftxxxx_proc proc;
|
||||
struct ftxxxx_proc proc_ta;
|
||||
struct ftxxxx_proc proc_raw;
|
||||
spinlock_t irq_lock;
|
||||
struct mutex report_mutex;
|
||||
struct mutex bus_lock;
|
||||
|
|
|
|||
|
|
@ -1133,7 +1133,7 @@ read_flash_err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fts_read_file_default(char *file_name, u8 **file_buf)
|
||||
static int __maybe_unused fts_read_file_default(char *file_name, u8 **file_buf)
|
||||
{
|
||||
int ret = 0;
|
||||
char file_path[FILE_NAME_LENGTH] = { 0 };
|
||||
|
|
@ -1234,7 +1234,11 @@ static int fts_read_file(char *file_name, u8 **file_buf)
|
|||
|
||||
ret = fts_read_file_request_firmware(file_name, file_buf);
|
||||
if (ret < 0) {
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
ret = fts_read_file_request_firmware(file_name, file_buf);
|
||||
#else
|
||||
ret = fts_read_file_default(file_name, file_buf);
|
||||
#endif
|
||||
if (ret < 0) {
|
||||
FTS_ERROR("get fw file(default) fail");
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -1206,6 +1206,7 @@ void show_data_mc_sc(int *data)
|
|||
/* mc_sc end*/
|
||||
|
||||
#if CSV_SUPPORT || TXT_SUPPORT
|
||||
#ifndef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
static int fts_test_save_test_data(char *file_name, char *data_buf, int len)
|
||||
{
|
||||
struct file *pfile = NULL;
|
||||
|
|
@ -1245,6 +1246,12 @@ static int fts_test_save_test_data(char *file_name, char *data_buf, int len)
|
|||
FTS_TEST_FUNC_EXIT();
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static int fts_test_save_test_data(char *file_name, char *data_buf, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TEST_SAVE_FAIL_RESULT) && TEST_SAVE_FAIL_RESULT
|
||||
void fts_test_save_fail_result(
|
||||
|
|
@ -1507,16 +1514,27 @@ static void fts_test_save_data_csv_private(struct fts_test *tdata)
|
|||
int csv_length = 0;
|
||||
|
||||
FTS_TEST_INFO("save data in csv format");
|
||||
|
||||
#ifndef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
csv_buffer = vmalloc(CSV_BUFFER_LEN);
|
||||
if (!csv_buffer) {
|
||||
FTS_TEST_ERROR("csv_buffer malloc fail\n");
|
||||
return ;
|
||||
}
|
||||
#else
|
||||
if(!fts_ftest->csv_buffer)
|
||||
return;
|
||||
|
||||
csv_buffer = fts_ftest->csv_buffer;
|
||||
#endif
|
||||
|
||||
if (tdata->func && tdata->func->save_data_private)
|
||||
tdata->func->save_data_private(csv_buffer, &csv_length);
|
||||
|
||||
FTS_TEST_INFO("csv length:%d", csv_length);
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
fts_ftest->csv_result_len = csv_length;
|
||||
#endif
|
||||
fts_test_save_test_data(FTS_CSV_FILE_NAME, csv_buffer, csv_length);
|
||||
|
||||
#if defined(TEST_SAVE_FAIL_RESULT) && TEST_SAVE_FAIL_RESULT
|
||||
|
|
@ -1524,11 +1542,13 @@ static void fts_test_save_data_csv_private(struct fts_test *tdata)
|
|||
csv_buffer, csv_length);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
if (csv_buffer) {
|
||||
vfree(csv_buffer);
|
||||
csv_buffer = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static void fts_test_save_result_txt(struct fts_test *tdata)
|
||||
|
|
@ -1539,6 +1559,14 @@ static void fts_test_save_result_txt(struct fts_test *tdata)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
if(!fts_ftest->txt_buffer)
|
||||
return;
|
||||
|
||||
memcpy(fts_ftest->txt_buffer, tdata->testresult, tdata->testresult_len);
|
||||
fts_ftest->txt_result_len = tdata->testresult_len;
|
||||
#endif
|
||||
|
||||
FTS_TEST_INFO("test result length in txt:%d", tdata->testresult_len);
|
||||
fts_test_save_test_data(FTS_TXT_FILE_NAME, tdata->testresult,
|
||||
tdata->testresult_len);
|
||||
|
|
@ -2247,6 +2275,97 @@ static struct attribute_group fts_test_attribute_group = {
|
|||
.attrs = fts_test_attributes
|
||||
};
|
||||
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
static int fts_test_proc_show(struct seq_file *file, void *v)
|
||||
{
|
||||
struct ftxxxx_proc *proc = NULL;
|
||||
struct fts_ts_data * fts_data = (struct fts_ts_data *)file->private;
|
||||
if (!fts_data) {
|
||||
FTS_ERROR("no fts_ts_data set");
|
||||
return -EIO;
|
||||
}
|
||||
proc = &fts_data->proc_raw;
|
||||
|
||||
switch (proc->opmode) {
|
||||
case PROC_READ_CSV_DATA:
|
||||
FTS_INFO("fts test read csv");
|
||||
seq_printf(file, "%s", fts_ftest->csv_buffer);
|
||||
break;
|
||||
|
||||
case PROC_READ_TXT_DATA:
|
||||
FTS_INFO("fts test read txt");
|
||||
seq_printf(file, "%s", fts_ftest->txt_buffer);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fts_test_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open_size(file, fts_test_proc_show, PDE_DATA(inode), PAGE_SIZE * 10);
|
||||
}
|
||||
|
||||
static ssize_t fts_test_proc_write(
|
||||
struct file *filp, const char __user *buff, size_t count, loff_t *ppos)
|
||||
{
|
||||
u8 *writebuf = NULL;
|
||||
u8 tmpbuf[PROC_BUF_SIZE] = { 0 };
|
||||
int buflen = count;
|
||||
int ret = 0;
|
||||
struct fts_ts_data *ts_data = fts_data;
|
||||
struct ftxxxx_proc *proc = &ts_data->proc_raw;
|
||||
|
||||
if (buflen < 1) {
|
||||
FTS_ERROR("fts test proc wirte count(%d) fail", buflen);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buflen > PROC_BUF_SIZE) {
|
||||
writebuf = (u8 *)kzalloc(buflen * sizeof(u8), GFP_KERNEL);
|
||||
if (NULL == writebuf) {
|
||||
FTS_ERROR("fts test proc wirte buf zalloc fail");
|
||||
return -ENOMEM;
|
||||
}
|
||||
} else {
|
||||
writebuf = tmpbuf;
|
||||
}
|
||||
|
||||
if (copy_from_user(writebuf, buff, buflen)) {
|
||||
FTS_ERROR("fts test copy from user error!!");
|
||||
ret = -EFAULT;
|
||||
goto proc_write_err;
|
||||
}
|
||||
|
||||
proc->opmode = writebuf[0];
|
||||
FTS_INFO("proc->opmode = %d", proc->opmode);
|
||||
if (buflen == 1) {
|
||||
ret = buflen;
|
||||
goto proc_write_err;
|
||||
}
|
||||
|
||||
proc_write_err:
|
||||
if ((buflen > PROC_BUF_SIZE) && writebuf) {
|
||||
kfree(writebuf);
|
||||
writebuf = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct proc_ops tp_test_proc_fops =
|
||||
{
|
||||
.proc_open = fts_test_proc_open,
|
||||
.proc_read = seq_read,
|
||||
.proc_write = fts_test_proc_write,
|
||||
.proc_lseek = seq_lseek,
|
||||
.proc_release = single_release,
|
||||
};
|
||||
#endif
|
||||
|
||||
static int fts_test_func_init(struct fts_ts_data *ts_data)
|
||||
{
|
||||
int i = 0;
|
||||
|
|
@ -2254,6 +2373,9 @@ static int fts_test_func_init(struct fts_ts_data *ts_data)
|
|||
u16 ic_stype = ts_data->ic_info.ids.type;
|
||||
struct test_funcs *func = test_func_list[0];
|
||||
int func_count = sizeof(test_func_list) / sizeof(test_func_list[0]);
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
struct ftxxxx_proc *proc = NULL;
|
||||
#endif
|
||||
|
||||
FTS_TEST_INFO("init test function");
|
||||
if (0 == func_count) {
|
||||
|
|
@ -2261,6 +2383,16 @@ static int fts_test_func_init(struct fts_ts_data *ts_data)
|
|||
return -ENODATA;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
proc = &ts_data->proc_raw;
|
||||
proc->proc_entry = proc_create_data(FTS_PROC_TP_DIFFER, 0444, NULL, &tp_test_proc_fops,
|
||||
ts_data);
|
||||
if (proc->proc_entry == NULL) {
|
||||
FTS_TEST_ERROR("[focal] %s() - ERROR: create fts_tp_differ proc() failed.", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
fts_ftest = (struct fts_test *)kzalloc(sizeof(*fts_ftest), GFP_KERNEL);
|
||||
if (NULL == fts_ftest) {
|
||||
FTS_TEST_ERROR("malloc memory for test fail");
|
||||
|
|
@ -2306,6 +2438,19 @@ int fts_test_init(struct fts_ts_data *ts_data)
|
|||
} else {
|
||||
FTS_TEST_DBG("sysfs(test) create successfully");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
fts_ftest->csv_buffer = vmalloc(CSV_BUFFER_LEN);
|
||||
if (!fts_ftest->csv_buffer) {
|
||||
FTS_TEST_ERROR("csv_buffer malloc fail\n");
|
||||
}
|
||||
|
||||
fts_ftest->txt_buffer = vmalloc(TXT_BUFFER_LEN);
|
||||
if (!fts_ftest->txt_buffer) {
|
||||
FTS_TEST_ERROR("txt_buffer malloc fail\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
|
||||
return ret;
|
||||
|
|
@ -2316,6 +2461,10 @@ int fts_test_exit(struct fts_ts_data *ts_data)
|
|||
FTS_TEST_FUNC_ENTER();
|
||||
|
||||
sysfs_remove_group(&ts_data->dev->kobj, &fts_test_attribute_group);
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
fts_free(fts_ftest->csv_buffer);
|
||||
fts_free(fts_ftest->txt_buffer);
|
||||
#endif
|
||||
fts_free(fts_ftest);
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -194,6 +194,13 @@ Test Status
|
|||
#define FTS_MAX_SORT_SC 32768
|
||||
#define FTS_MIN_SORT_SC 0
|
||||
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
#define FTS_PROC_TP_DIFFER "fts_tp_test"
|
||||
#define PROC_READ_CSV_DATA 1
|
||||
#define PROC_READ_TXT_DATA 2
|
||||
#define PROC_BUF_SIZE 256
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* enumerations, structures and unions
|
||||
*****************************************************************************/
|
||||
|
|
@ -489,6 +496,12 @@ struct fts_test {
|
|||
u8 normalize;
|
||||
u8 fre_num;
|
||||
int test_num;
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
char *csv_buffer;
|
||||
int csv_result_len;
|
||||
char *txt_buffer;
|
||||
int txt_result_len;
|
||||
#endif
|
||||
int *item1_data;
|
||||
int *item2_data;
|
||||
int *item3_data;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
/*****************************************************************************
|
||||
* Private constant and macro definitions using #define
|
||||
*****************************************************************************/
|
||||
#define FTS_INI_REQUEST_SUPPORT 0
|
||||
#define FTS_INI_REQUEST_SUPPORT 1
|
||||
|
||||
struct ini_ic_type ic_types[] = {
|
||||
{"FT5X46", 0x54000002},
|
||||
|
|
@ -309,7 +309,7 @@ static int fts_test_read_ini_data(char *config_name, char *config_buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int fts_test_get_ini_default(struct ini_data *ini, char *fwname)
|
||||
static int __maybe_unused fts_test_get_ini_default(struct ini_data *ini, char *fwname)
|
||||
{
|
||||
int ret = 0;
|
||||
int inisize = 0;
|
||||
|
|
@ -1395,7 +1395,11 @@ int fts_test_get_testparam_from_ini(char *config_name)
|
|||
|
||||
ret = fts_test_get_ini_via_request_firmware(ini, config_name);
|
||||
if (ret != 0) {
|
||||
#ifdef CONFIG_FTS_COMPATIBLE_WITH_GKI
|
||||
ret = fts_test_get_ini_via_request_firmware(ini, config_name);
|
||||
#else
|
||||
ret = fts_test_get_ini_default(ini, config_name);
|
||||
#endif
|
||||
if (ret < 0) {
|
||||
FTS_TEST_ERROR("get ini(default) fail");
|
||||
goto get_ini_err;
|
||||
|
|
|
|||
Loading…
Reference in a new issue