mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
focaltech_0_flash_mmi: Add ft8756 support
Add FT8756 IC support for defender Fix some build warning on Android Q test function. Change-Id: I6514f149045e605d5fd5d0adde1c22b12f13824d Signed-off-by: haojl2 <haojl2@motorola.com> Reviewed-on: https://gerrit.mot.com/1361859 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou <zoujc@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1369643 Reviewed-by: Jianqi Yang <yangj@motorola.com> Reviewed-on: https://gerrit.mot.com/1371910
This commit is contained in:
parent
359208a01a
commit
c8155b8f80
6 changed files with 605 additions and 1 deletions
|
|
@ -21,3 +21,7 @@ ifneq ($(filter ft8719,$(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME)),)
|
|||
EXTRA_CFLAGS += -DCONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8719
|
||||
focaltech_0flash_mmi-objs += focaltech_test/supported_ic/focaltech_test_ft8719.o
|
||||
endif
|
||||
ifneq ($(filter ft8756,$(CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8756
|
||||
focaltech_0flash_mmi-objs += focaltech_test/supported_ic/focaltech_test_ft8756.o
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ int fts_fw_update_vendor_name(const char* name) {
|
|||
char* pos;
|
||||
int len;
|
||||
|
||||
if (!upg || !upg->module_info || !upg->module_info->vendor_name) {
|
||||
if (!upg || !upg->module_info) {
|
||||
FTS_ERROR("upgrade struct not init");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,12 @@
|
|||
struct fts_test *fts_ftest;
|
||||
|
||||
struct test_funcs *test_func_list[] = {
|
||||
#ifdef CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8719
|
||||
&test_func_ft8719,
|
||||
#endif
|
||||
#ifdef CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8756
|
||||
&test_func_ft8756,
|
||||
#endif
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ Test Status
|
|||
#define FACTORY_REG_LCD_NOISE_START 0x11
|
||||
#define FACTORY_REG_LCD_NOISE_FRAME 0x12
|
||||
#define FACTORY_REG_LCD_NOISE_NUMBER 0x13
|
||||
#define FACTORY_REG_LCD_NOISE_TEST_STATE 0x13
|
||||
#define FACTORY_REG_LCD_NOISE_TTHR 0x14
|
||||
#define FACTORY_REG_OPEN_START 0x15
|
||||
#define FACTORY_REG_OPEN_STATE 0x16
|
||||
|
|
@ -101,6 +102,8 @@ Test Status
|
|||
#define FACTORY_REG_OPEN_BUSY 0x01
|
||||
#define FACTORY_REG_CB_ADDR_H 0x18
|
||||
#define FACTORY_REG_CB_ADDR_L 0x19
|
||||
#define FACTORY_REG_ORDER_ADDR_H 0x1A
|
||||
#define FACTORY_REG_ORDER_ADDR_L 0x1B
|
||||
#define FACTORY_REG_LCD_NOISE_STATE 0x1E
|
||||
#define FACTORY_REG_KEYSHORT_EN 0x2E
|
||||
#define FACTORY_REG_KEYSHORT_STATE 0x2F
|
||||
|
|
@ -111,10 +114,12 @@ Test Status
|
|||
#define FACTORY_REG_OPEN_REG21 0x21
|
||||
#define FACTORY_REG_OPEN_REG22 0x22
|
||||
#define FACTORY_REG_OPEN_REG23 0x23
|
||||
#define FACTORY_REG_OPEN_REG2E 0x2E
|
||||
#define FACTORY_REG_OPEN_REG86 0x86
|
||||
#define FACTORY_REG_K1 0x31
|
||||
#define FACTORY_REG_K2 0x32
|
||||
#define FACTORY_REG_RAWDATA_ADDR 0x6A
|
||||
#define FACTORY_REG_ORDER_ADDR 0x6C
|
||||
#define FACTORY_REG_CB_ADDR 0x6E
|
||||
#define FACTORY_REG_SHORT_ADDR 0x89
|
||||
#define FACTORY_REG_RAWDATA_TEST_EN 0x9E
|
||||
|
|
@ -183,6 +188,7 @@ struct incell_testitem {
|
|||
u32 rawdata_test : 1;
|
||||
u32 lcdnoise_test : 1;
|
||||
u32 keyshort_test : 1;
|
||||
u32 mux_open_test : 1;
|
||||
};
|
||||
|
||||
struct incell_threshold_b {
|
||||
|
|
@ -211,6 +217,7 @@ struct incell_threshold_b {
|
|||
int keyshort_cb_max;
|
||||
int rawdata2_min;
|
||||
int rawdata2_max;
|
||||
int mux_open_cb_min;
|
||||
};
|
||||
|
||||
struct incell_threshold {
|
||||
|
|
@ -313,6 +320,7 @@ struct sc_testitem {
|
|||
u32 rawdata_test : 1;
|
||||
u32 cb_test : 1;
|
||||
u32 delta_cb_test : 1;
|
||||
u32 short_test : 1;
|
||||
};
|
||||
|
||||
struct sc_threshold_b {
|
||||
|
|
@ -337,6 +345,7 @@ struct sc_threshold_b {
|
|||
int dcb_cs4;
|
||||
int dcb_cs5;
|
||||
int dcb_cs6;
|
||||
int short_min;
|
||||
};
|
||||
|
||||
struct sc_threshold {
|
||||
|
|
@ -469,6 +478,7 @@ enum csv_itemcode_incell {
|
|||
CODE_SHORT_TEST = 15,
|
||||
CODE_OPEN_TEST = 25,
|
||||
CODE_LCD_NOISE_TEST = 27,
|
||||
CODE_MUX_OPEN_TEST = 41,
|
||||
};
|
||||
|
||||
enum csv_itemcode_mc_sc {
|
||||
|
|
@ -489,7 +499,12 @@ enum csv_itemcode_sc {
|
|||
/*****************************************************************************
|
||||
* Global variable or extern global variabls/functions
|
||||
*****************************************************************************/
|
||||
#ifdef CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8719
|
||||
extern struct test_funcs test_func_ft8719;
|
||||
#endif
|
||||
#ifdef CONFIG_INPUT_FOCALTECH_0FLASH_MMI_IC_NAME_FT8756
|
||||
extern struct test_funcs test_func_ft8756;
|
||||
#endif
|
||||
|
||||
extern struct fts_test *fts_ftest;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ struct ini_ic_type ic_types[] = {
|
|||
{"FT7252", 0x92000013},
|
||||
|
||||
{"FT8613S", 0x94000014},
|
||||
|
||||
{"FT8756", 0x95000015},
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
|||
|
|
@ -0,0 +1,578 @@
|
|||
/************************************************************************
|
||||
* Copyright (C) 2012-2019, Focaltech Systems (R), All Rights Reserved.
|
||||
*
|
||||
* File Name: Focaltech_test_ft8756.c
|
||||
*
|
||||
* Author: Focaltech Driver Team
|
||||
*
|
||||
* Created: 2019-03-02
|
||||
*
|
||||
* Abstract:
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Included header files
|
||||
*****************************************************************************/
|
||||
#include "../focaltech_test.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Private constant and macro definitions using #define
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Private constant and macro definitions using #define
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Private enumerations, structures and unions using typedef
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Static variables
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Global variable or extern global variabls/functions
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Static function prototypes
|
||||
*****************************************************************************/
|
||||
static int ft8756_short_test(struct fts_test *tdata, bool *test_result)
|
||||
{
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
bool tmp_result = false;
|
||||
int byte_num = 0;
|
||||
int ch_num = 0;
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
int tmp_adc = 0;
|
||||
int *adcdata = NULL;
|
||||
struct incell_threshold *thr = &tdata->ic.incell.thr;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_SAVE_INFO("\n============ Test Item: Short Circuit Test\n");
|
||||
memset(tdata->buffer, 0, tdata->buffer_length);
|
||||
adcdata = tdata->buffer;
|
||||
|
||||
ret = enter_factory_mode();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("enter factory mode fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
byte_num = tdata->node.node_num * 2;
|
||||
ch_num = tdata->node.rx_num;
|
||||
ret = short_get_adcdata_incell(TEST_RETVAL_AA, ch_num, byte_num, adcdata);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("get adc data fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* calculate resistor */
|
||||
for (i = 0; i < tdata->node.node_num; i++) {
|
||||
tmp_adc = adcdata[i];
|
||||
if (tmp_adc > 3500) {
|
||||
tmp_adc = 3500;
|
||||
}
|
||||
adcdata[i] = (5160960 + 555 * 32 * tmp_adc) / (1146880 - 320 * tmp_adc);
|
||||
}
|
||||
|
||||
/* save */
|
||||
show_data(adcdata, false);
|
||||
|
||||
/* compare */
|
||||
min = thr->basic.short_res_min;
|
||||
max = TEST_SHORT_RES_MAX;
|
||||
tmp_result = compare_data(adcdata, min, max, min, max, false);
|
||||
|
||||
ret = 0;
|
||||
test_err:
|
||||
ret = fts_test_write_reg(FACTORY_REG_SHORT_TEST_STATE, 0x03);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write idle to short test state fail\n");
|
||||
}
|
||||
|
||||
if (tmp_result) {
|
||||
*test_result = true;
|
||||
FTS_TEST_SAVE_INFO("------ Short Circuit Test PASS\n");
|
||||
} else {
|
||||
*test_result = false;
|
||||
FTS_TEST_SAVE_INFO("------ Short Circuit Test NG\n");
|
||||
}
|
||||
|
||||
/* save test data */
|
||||
fts_test_save_data("Short Circuit Test", CODE_SHORT_TEST,
|
||||
adcdata, 0, false, false, *test_result);
|
||||
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ft8756_open_test(struct fts_test *tdata, bool *test_result)
|
||||
{
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
bool tmp_result = false;
|
||||
u8 state = 0;
|
||||
int byte_num = 0;
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
u8 k1 = 0;
|
||||
u8 k2 = 0;
|
||||
int *opendata = NULL;
|
||||
struct incell_threshold *thr = &tdata->ic.incell.thr;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_SAVE_INFO("\n============ Test Item: Open Test\n");
|
||||
memset(tdata->buffer, 0, tdata->buffer_length);
|
||||
opendata = tdata->buffer;
|
||||
|
||||
ret = enter_factory_mode();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("enter factory mode fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
if (thr->basic.open_k1_check) {
|
||||
ret = fts_test_read_reg(FACTORY_REG_K1, &k1);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("read k1 fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
}
|
||||
if (thr->basic.open_k2_check) {
|
||||
ret = fts_test_read_reg(FACTORY_REG_K2, &k2);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("read k2 fail\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
}
|
||||
|
||||
if (thr->basic.open_k1_check) {
|
||||
ret = fts_test_write_reg(FACTORY_REG_K1, thr->basic.open_k1_value);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write reg k1 fail\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
}
|
||||
|
||||
if (thr->basic.open_k2_check) {
|
||||
ret = fts_test_write_reg(FACTORY_REG_K2, thr->basic.open_k2_value);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write reg k2 fail\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
}
|
||||
|
||||
ret = fts_test_write_reg(FACTORY_REG_OPEN_START, 0x01);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("start open test fail\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
|
||||
/* check test status */
|
||||
for (i = 0; i < FACTORY_TEST_RETRY; i++) {
|
||||
sys_delay(FACTORY_TEST_RETRY_DELAY);
|
||||
ret = fts_test_read_reg(FACTORY_REG_OPEN_STATE, &state);
|
||||
if ((ret >= 0) && (TEST_RETVAL_AA == state)) {
|
||||
break;
|
||||
} else {
|
||||
FTS_TEST_DBG("reg%x=%x,retry:%d\n",
|
||||
FACTORY_REG_OPEN_STATE, state, i);
|
||||
}
|
||||
}
|
||||
if (i >= FACTORY_TEST_RETRY) {
|
||||
FTS_TEST_SAVE_ERR("open test timeout\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
|
||||
/* get cb data */
|
||||
byte_num = tdata->node.node_num;
|
||||
ret = get_cb_incell(0, byte_num, opendata);
|
||||
if (ret) {
|
||||
FTS_TEST_SAVE_ERR("get CB fail\n");
|
||||
goto restore_reg;
|
||||
}
|
||||
|
||||
/* save */
|
||||
show_data(opendata, false);
|
||||
|
||||
/* compare */
|
||||
min = thr->basic.open_cb_min;
|
||||
max = TEST_OPEN_MAX_VALUE;
|
||||
tmp_result = compare_data(opendata, min, max, 0, 0, false);
|
||||
|
||||
restore_reg:
|
||||
/* Restore reg */
|
||||
if (thr->basic.open_k1_check) {
|
||||
ret = fts_test_write_reg(FACTORY_REG_K1, k1);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("restore reg k1 fail\n");
|
||||
}
|
||||
}
|
||||
if (thr->basic.open_k2_check) {
|
||||
ret = fts_test_write_reg(FACTORY_REG_K2, k2);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("restore reg k2 fail\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* auto clb */
|
||||
ret = chip_clb();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("auto clb fail\n");
|
||||
}
|
||||
|
||||
test_err:
|
||||
ret = fts_test_write_reg(FACTORY_REG_OPEN_STATE, 0x03);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write idle to open test state fail\n");
|
||||
}
|
||||
|
||||
if (tmp_result) {
|
||||
*test_result = true;
|
||||
FTS_TEST_SAVE_INFO("------ Open Test PASS\n");
|
||||
} else {
|
||||
*test_result = false;
|
||||
FTS_TEST_SAVE_INFO("------ Open Test NG\n");
|
||||
}
|
||||
|
||||
/*save test data*/
|
||||
fts_test_save_data("Open Test", CODE_OPEN_TEST,
|
||||
opendata, 0, false, false, *test_result);
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ft8756_cb_test(struct fts_test *tdata, bool *test_result)
|
||||
{
|
||||
int ret = 0;
|
||||
bool tmp_result = false;
|
||||
int byte_num = 0;
|
||||
int *cbdata = NULL;
|
||||
struct incell_threshold *thr = &tdata->ic.incell.thr;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_SAVE_INFO("\n============ Test Item: CB Test\n");
|
||||
memset(tdata->buffer, 0, tdata->buffer_length);
|
||||
cbdata = tdata->buffer;
|
||||
|
||||
if (!thr->cb_min || !thr->cb_max || !test_result) {
|
||||
FTS_TEST_SAVE_ERR("cb_min/max test_result is null\n");
|
||||
ret = -EINVAL;
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
ret = enter_factory_mode();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("enter factory mode fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* cb test enable */
|
||||
ret = fts_test_write_reg(FACTORY_REG_CB_TEST_EN, 0x01);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("cb test enable fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* auto clb */
|
||||
ret = chip_clb();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("auto clb fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
byte_num = tdata->node.node_num;
|
||||
ret = get_cb_incell(0, byte_num, cbdata);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("get cb fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* save */
|
||||
show_data(cbdata, false);
|
||||
|
||||
/* compare */
|
||||
tmp_result = compare_array(cbdata, thr->cb_min, thr->cb_max, false);
|
||||
|
||||
test_err:
|
||||
/* cb test disable */
|
||||
ret = fts_test_write_reg(FACTORY_REG_CB_TEST_EN, 0x00);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("cb test disable fail\n");
|
||||
}
|
||||
|
||||
if (tmp_result) {
|
||||
*test_result = true;
|
||||
FTS_TEST_SAVE_INFO("------ CB Test PASS\n");
|
||||
} else {
|
||||
*test_result = false;
|
||||
FTS_TEST_SAVE_INFO("------ CB Test NG\n");
|
||||
}
|
||||
|
||||
/*save test data*/
|
||||
fts_test_save_data("CB Test", CODE_CB_TEST,
|
||||
cbdata, 0, false, false, *test_result);
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ft8756_rawdata_test(struct fts_test *tdata, bool *test_result)
|
||||
{
|
||||
int ret = 0;
|
||||
bool tmp_result = false;
|
||||
int *rawdata = NULL;
|
||||
struct incell_threshold *thr = &tdata->ic.incell.thr;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_SAVE_INFO("\n============ Test Item: RawData Test\n");
|
||||
memset(tdata->buffer, 0, tdata->buffer_length);
|
||||
rawdata = tdata->buffer;
|
||||
|
||||
if (!thr->rawdata_min || !thr->rawdata_max || !test_result) {
|
||||
FTS_TEST_SAVE_ERR("rawdata_min/max test_result is null\n");
|
||||
ret = -EINVAL;
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
ret = enter_factory_mode();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("enter factory mode fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* rawdata test enable */
|
||||
ret = fts_test_write_reg(FACTORY_REG_RAWDATA_TEST_EN, 0x01);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("rawdata test enable fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* read rawdata */
|
||||
ret = get_rawdata(rawdata);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("get RawData fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* save */
|
||||
show_data(rawdata, false);
|
||||
|
||||
/* compare */
|
||||
tmp_result = compare_array(rawdata,
|
||||
thr->rawdata_min,
|
||||
thr->rawdata_max,
|
||||
false);
|
||||
ret = 0;
|
||||
|
||||
test_err:
|
||||
/* rawdata test disble */
|
||||
ret = fts_test_write_reg(FACTORY_REG_RAWDATA_TEST_EN, 0x00);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("rawdata test disable fail\n");
|
||||
}
|
||||
|
||||
if (tmp_result) {
|
||||
*test_result = true;
|
||||
FTS_TEST_SAVE_INFO("------ RawData Test PASS\n");
|
||||
} else {
|
||||
*test_result = false;
|
||||
FTS_TEST_SAVE_INFO("------ RawData Test NG\n");
|
||||
}
|
||||
|
||||
/*save test data*/
|
||||
fts_test_save_data("RawData Test", CODE_RAWDATA_TEST,
|
||||
rawdata, 0, false, false, *test_result);
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ft8756_lcdnoise_test(struct fts_test *tdata, bool *test_result)
|
||||
{
|
||||
int ret = 0;
|
||||
int i = 0;
|
||||
bool tmp_result = false;
|
||||
u8 old_mode = 0;
|
||||
u8 status = 0;
|
||||
int byte_num = 0;
|
||||
int frame_num = 0;
|
||||
int max = 0;
|
||||
int *lcdnoise = NULL;
|
||||
struct incell_threshold *thr = &tdata->ic.incell.thr;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_SAVE_INFO("\n============ Test Item: LCD Noise Test\n");
|
||||
memset(tdata->buffer, 0, tdata->buffer_length);
|
||||
lcdnoise = tdata->buffer;
|
||||
|
||||
ret = enter_factory_mode();
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("enter factory mode fail,ret=%d\n", ret);
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
ret = fts_test_read_reg(FACTORY_REG_DATA_SELECT, &old_mode);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("read reg06 fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
ret = fts_test_write_reg(FACTORY_REG_DATA_SELECT, 0x01);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write 1 to reg06 fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
ret = fts_test_write_reg(FACTORY_REG_LINE_ADDR, 0xAD);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write reg01 fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
frame_num = thr->basic.lcdnoise_frame;
|
||||
ret = fts_test_write_reg(FACTORY_REG_LCD_NOISE_FRAME, frame_num / 4);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_INFO("write frame num fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* start test */
|
||||
ret = fts_test_write_reg(FACTORY_REG_LCD_NOISE_START, 0x01);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_INFO("start lcdnoise test fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* check test status */
|
||||
sys_delay(frame_num * FACTORY_TEST_DELAY / 2);
|
||||
for (i = 0; i < FACTORY_TEST_RETRY; i++) {
|
||||
status = 0xFF;
|
||||
ret = fts_test_read_reg(FACTORY_REG_LCD_NOISE_TEST_STATE, &status);
|
||||
if ((ret >= 0) && (TEST_RETVAL_AA == status)) {
|
||||
break;
|
||||
} else {
|
||||
FTS_TEST_DBG("reg%x=%x,retry:%d\n",
|
||||
FACTORY_REG_LCD_NOISE_TEST_STATE, status, i);
|
||||
}
|
||||
sys_delay(FACTORY_TEST_RETRY_DELAY);
|
||||
}
|
||||
if (i >= FACTORY_TEST_RETRY) {
|
||||
FTS_TEST_SAVE_ERR("lcdnoise test timeout\n");
|
||||
goto test_err;
|
||||
}
|
||||
/* read lcdnoise */
|
||||
byte_num = tdata->node.node_num * 2;
|
||||
ret = read_mass_data(FACTORY_REG_RAWDATA_ADDR, byte_num, lcdnoise);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("read rawdata fail\n");
|
||||
goto test_err;
|
||||
}
|
||||
|
||||
/* save */
|
||||
show_data(lcdnoise, false);
|
||||
|
||||
/* compare */
|
||||
max = thr->basic.lcdnoise_coefficient * tdata->va_touch_thr * 32 / 100;
|
||||
FTS_TEST_DBG("touch thr:%d, max:%d", tdata->va_touch_thr, max);
|
||||
tmp_result = compare_data(lcdnoise, 0, max, 0, 0, false);
|
||||
|
||||
test_err:
|
||||
ret = fts_test_write_reg(FACTORY_REG_LCD_NOISE_START, 0x00);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write 0 to reg11 fail\n");
|
||||
}
|
||||
|
||||
ret = fts_test_write_reg(FACTORY_REG_DATA_SELECT, old_mode);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("restore reg06 fail\n");
|
||||
}
|
||||
|
||||
ret = fts_test_write_reg(FACTORY_REG_LCD_NOISE_TEST_STATE, 0x03);
|
||||
if (ret < 0) {
|
||||
FTS_TEST_SAVE_ERR("write idle to lcdnoise test state fail\n");
|
||||
}
|
||||
|
||||
if (tmp_result) {
|
||||
*test_result = true;
|
||||
FTS_TEST_SAVE_INFO("------ LCD Noise Test PASS\n");
|
||||
} else {
|
||||
*test_result = false;
|
||||
FTS_TEST_SAVE_INFO("------ LCD Noise Test NG\n");
|
||||
}
|
||||
|
||||
/*save test data*/
|
||||
fts_test_save_data("LCD Noise Test", CODE_LCD_NOISE_TEST,
|
||||
lcdnoise, 0, false, false, *test_result);
|
||||
FTS_TEST_FUNC_EXIT();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int start_test_ft8756(void)
|
||||
{
|
||||
int ret = 0;
|
||||
struct fts_test *tdata = fts_ftest;
|
||||
struct incell_testitem *test_item = &tdata->ic.incell.u.item;
|
||||
bool temp_result = false;
|
||||
bool test_result = true;
|
||||
|
||||
FTS_TEST_FUNC_ENTER();
|
||||
FTS_TEST_INFO("test item:0x%x", fts_ftest->ic.incell.u.tmp);
|
||||
|
||||
if (!tdata || !tdata->testresult || !tdata->buffer) {
|
||||
FTS_TEST_ERROR("tdata is null");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* short test */
|
||||
if (true == test_item->short_test) {
|
||||
ret = ft8756_short_test(tdata, &temp_result);
|
||||
if ((ret < 0) || (false == temp_result)) {
|
||||
test_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* open test */
|
||||
if (true == test_item->open_test) {
|
||||
ret = ft8756_open_test(tdata, &temp_result);
|
||||
if ((ret < 0) || (false == temp_result)) {
|
||||
test_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* cb test */
|
||||
if (true == test_item->cb_test) {
|
||||
ret = ft8756_cb_test(tdata, &temp_result);
|
||||
if ((ret < 0) || (false == temp_result)) {
|
||||
test_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* rawdata test */
|
||||
if (true == test_item->rawdata_test) {
|
||||
ret = ft8756_rawdata_test(tdata, &temp_result);
|
||||
if ((ret < 0) || (false == temp_result)) {
|
||||
test_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* lcd noise test */
|
||||
if (true == test_item->lcdnoise_test) {
|
||||
ret = ft8756_lcdnoise_test(tdata, &temp_result);
|
||||
if ((ret < 0) || (false == temp_result)) {
|
||||
test_result = false;
|
||||
}
|
||||
}
|
||||
|
||||
return test_result;
|
||||
}
|
||||
|
||||
struct test_funcs test_func_ft8756 = {
|
||||
.ctype = {0x15, 0x18},
|
||||
.hwtype = IC_HW_INCELL,
|
||||
.key_num_total = 0,
|
||||
.start_test = start_test_ft8756,
|
||||
};
|
||||
Loading…
Reference in a new issue