goodix: support factory tcmd test.

TP:
1. support matching limit files of multiple panels.
2. save the test results, and the file name contains the test time
and panel name.

Change-Id: Ife15047d24b39680a1c0c94f9c405796c35be47d
Reviewed-on: https://gerrit.mot.com/2068602
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:
litong20 2021-09-16 21:43:53 +08:00 • committed by litong
commit 4094cad855
7 changed files with 66 additions and 22 deletions

View file

@ -9,6 +9,10 @@ ifeq ($(GTP_LIMIT_USE_SUPPLIER),true)
KBUILD_OPTIONS += CONFIG_GTP_LIMIT_USE_SUPPLIER=y
endif
ifneq (,$(findstring gki, $(KERNEL_DEFCONFIG)))
KBUILD_OPTIONS += CONFIG_TS_KERNEL_USE_GKI=y
endif
include $(CLEAR_VARS)
LOCAL_MODULE := goodix_brl_mmi.ko
LOCAL_MODULE_TAGS := optional

View file

@ -24,6 +24,10 @@ ifneq ($(filter m y,$(CONFIG_GTP_LIMIT_USE_SUPPLIER)),)
EXTRA_CFLAGS += -DCONFIG_GTP_LIMIT_USE_SUPPLIER
endif
ifeq ($(filter m y,$(CONFIG_TS_KERNEL_USE_GKI)),)
EXTRA_CFLAGS += -DGTP_SAVE_IN_CSV
endif
ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),)
EXTRA_CFLAGS += -DCONFIG_INPUT_TOUCHSCREEN_MMI
goodix_brl_mmi-objs += goodix_ts_mmi.o

View file

@ -21,7 +21,7 @@
#include "goodix_ts_core.h"
#include <linux/mmi_device.h>
#define TS_DRIVER_NAME "gtx8_i2c"
#define TS_DRIVER_NAME "goodix_ts"
#define I2C_MAX_TRANSFER_SIZE 60
#define GOODIX_BUS_RETRY_TIMES 3
#define GOODIX_REG_ADDR_SIZE 4

View file

@ -325,13 +325,9 @@ err_out:
int goodix_get_config_proc(struct goodix_ts_core *cd)
{
#if defined(CONFIG_INPUT_TOUCHSCREEN_MMI) && defined(CONFIG_GTP_LIMIT_USE_SUPPLIER)
int ret;
const char* supplier = NULL;
if (cd->imports && cd->imports->get_supplier) {
ret = cd->imports->get_supplier(cd->bus->dev, &supplier);
if (!ret)
snprintf(cd->board_data.cfg_bin_name, GOODIX_MAX_STR_LABLE_LEN, "%s_%s",
supplier, TS_DEFAULT_CFG_BIN);
if (cd->supplier) {
snprintf(cd->board_data.cfg_bin_name, GOODIX_MAX_STR_LABLE_LEN, "%s_%s",
cd->supplier, TS_DEFAULT_CFG_BIN);
}
#endif

View file

@ -492,6 +492,7 @@ struct goodix_ts_core {
int (*set_fw_name)(char* fw_name);
int update_status;
int gesture_enabled;
const char *supplier;
};
/* external module structures */

View file

@ -26,9 +26,8 @@
/* test config */
#define TOTAL_FRAME_NUM 1 /* rawdata test frames */
#define NOISEDATA_TEST_TIMES 1 /* noise test frames */
#define SAVE_IN_CSV
#define GOODIX_RESULT_SAVE_PATH "/vendor/etc/Test_Data.csv"
#define GOODIX_RESULT_SAVE_PATH "/data/vendor/touchrec"
#define GOODIX_TEST_FILE_NAME "goodix"
#define MAX_DATA_BUFFER 28000
#define MAX_SHORT_NUM 15
@ -580,8 +579,12 @@ static int goodix_init_testlimits(struct goodix_ts_test *ts_test)
u32 tx = test_params->drv_num;
u32 rx = test_params->sen_num;
sprintf(limit_file, "%s_test_limits_%d.csv", GOODIX_TEST_FILE_NAME,
ts_core->fw_version.sensor_id);
if (ts_core->supplier)
snprintf(limit_file, sizeof(limit_file), "%s_%s_test_limits_%d.csv",
ts_core->supplier, GOODIX_TEST_FILE_NAME, ts_core->fw_version.sensor_id);
else
snprintf(limit_file, sizeof(limit_file), "%s_test_limits_%d.csv",
GOODIX_TEST_FILE_NAME, ts_core->fw_version.sensor_id);
ts_info("limit_file_name:%s", limit_file);
ret = request_firmware(&firmware, limit_file, dev);
@ -614,7 +617,7 @@ static int goodix_init_testlimits(struct goodix_ts_test *ts_test)
ts_test->test_config.data[i] = (u8)test_params->cfg_buf[i];
ts_test->test_config.len = ret;
}
/* obtain mutual_raw min */
ret = parse_csvfile(temp_buf, firmware->size, CSV_TP_SPECIAL_RAW_MIN,
test_params->min_limits, rx, tx);
@ -1046,17 +1049,17 @@ static int gdix_check_rx_rx_shortcircut(struct goodix_ts_test *ts_test,
}
kfree(data_buf);
return err;
return err;
}
static int gdix_check_tx_rx_shortcircut(struct goodix_ts_test *ts_test,
u8 short_ch_num)
{
int ret = 0, err = 0;
u32 r_threshold = 0, short_r = 0;
u32 r_threshold = 0, short_r = 0;
int size = 0, i = 0, j = 0;
u16 adc_signal = 0;
u8 master_pin_num, slave_pin_num;
u8 master_pin_num, slave_pin_num;
u8 *data_buf = NULL;
u32 data_reg;
struct ts_test_params *test_params = &ts_test->test_params;
@ -1130,7 +1133,7 @@ static int gdix_check_tx_rx_shortcircut(struct goodix_ts_test *ts_test,
}
kfree(data_buf);
return err;
return err;
}
#define SHORT_TYPE_FLAG ((uint16_t)1 << 15)
@ -1214,7 +1217,7 @@ static int gdix_check_gndvdd_shortcircut(struct goodix_ts_test *ts_test)
if (checksum_cmp(data_buf, size, CHECKSUM_MODE_U8_LE)) {
ts_err("diff code checksum error");
err = -EINVAL;
goto err_out;
goto err_out;
}
for (i = 0; i < max_drv_num + max_sen_num; i++) {
@ -1990,7 +1993,7 @@ static void goodix_data_statistics(s16 *data, size_t data_size,
return;
}
#ifdef SAVE_IN_CSV
#ifdef GTP_SAVE_IN_CSV
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
static ssize_t fs_write(const void* buf, size_t size, struct file* fp)
{
@ -2631,14 +2634,44 @@ static int goodix_save_tail(struct goodix_ts_test *ts_test,
return ret;
}
static char *get_date_time_str(void)
{
struct timespec64 now_time;
struct rtc_time rtc_now_time;
static char time_data_buf[128] = { 0 };
ktime_get_real_ts64(&now_time);
rtc_time64_to_tm(now_time.tv_sec, &rtc_now_time);
snprintf(time_data_buf, sizeof(time_data_buf), "%04d%02d%02d-%02d%02d%02d",
(rtc_now_time.tm_year + 1900), rtc_now_time.tm_mon + 1,
rtc_now_time.tm_mday, rtc_now_time.tm_hour, rtc_now_time.tm_min,
rtc_now_time.tm_sec);
return time_data_buf;
}
static void goodix_save_result_data(struct goodix_ts_test *ts_test)
{
int ret = 0;
char save_path[100];
struct file *fp = NULL;
struct goodix_ts_core *ts_core = ts_test->ts;
/* format result file */
sprintf(save_path, GOODIX_RESULT_SAVE_PATH);
if (ts_core->supplier) {
if (strstr(ts_test->test_info, "PASS"))
snprintf(save_path, sizeof(save_path), "%s/%s-%s-%s-pass.csv",
GOODIX_RESULT_SAVE_PATH, ts_core->supplier,
GOODIX_TEST_FILE_NAME, get_date_time_str());
else
snprintf(save_path, sizeof(save_path), "%s/%s-%s-%s-fail.csv",
GOODIX_RESULT_SAVE_PATH, ts_core->supplier,
GOODIX_TEST_FILE_NAME, get_date_time_str());
} else
snprintf(save_path, sizeof(save_path), "%s/%s_mp_test.csv",
GOODIX_RESULT_SAVE_PATH, GOODIX_TEST_FILE_NAME);
ts_info("save result IN, file_name:%s", save_path);
fp = filp_open(save_path, O_CREAT | O_WRONLY | O_TRUNC, 0666);
@ -2671,7 +2704,7 @@ static void goodix_save_result_data(struct goodix_ts_test *ts_test)
save_end:
filp_close(fp, NULL);
}
#endif // SAVE_IN_CSV
#endif // GTP_SAVE_IN_CSV
static void goodix_put_test_result(struct goodix_ts_test *ts_test,
struct ts_rawdata_info *info)
@ -2819,7 +2852,7 @@ static void goodix_put_test_result(struct goodix_ts_test *ts_test,
TS_RAWDATA_RESULT_MAX);
strncpy(info->result, ts_test->test_info, TS_RAWDATA_RESULT_MAX - 1);
#ifdef SAVE_IN_CSV
#ifdef GTP_SAVE_IN_CSV
/* save result to file */
goodix_save_result_data(ts_test);
#endif

View file

@ -322,6 +322,12 @@ int goodix_ts_mmi_dev_register(struct platform_device *pdev) {
}
core_data->imports = &goodix_ts_mmi_methods.exports;
#if defined(CONFIG_GTP_LIMIT_USE_SUPPLIER)
if (core_data->imports && core_data->imports->get_supplier) {
ret = core_data->imports->get_supplier(core_data->bus->dev, &core_data->supplier);
}
#endif
return 0;
}