summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMason Wang <masonwang@google.com>2022-04-20 00:33:51 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2022-04-20 00:33:51 +0000
commit522ee2c12c4797cf5f310d7692e1e55db942d315 (patch)
tree58165ef334fe5c778ae3743ba8156aee65c70827
parenta5ca60116433a337fa60f5b8851dc260217a9a21 (diff)
parent5455dd88d6849658de4cbf1d7cad09bee4c01aa5 (diff)
downloadfocaltech_touch-522ee2c12c4797cf5f310d7692e1e55db942d315.tar.gz
Merge "touch/focaltech: Using a flag instead of accessing work-mode register." into android13-gs-pixel-5.10
-rw-r--r--ft3658/focaltech_core.c16
-rw-r--r--ft3658/focaltech_core.h1
-rw-r--r--ft3658/focaltech_test/focaltech_test.c8
3 files changed, 9 insertions, 16 deletions
diff --git a/ft3658/focaltech_core.c b/ft3658/focaltech_core.c
index 7fd13e9..5a2d60b 100644
--- a/ft3658/focaltech_core.c
+++ b/ft3658/focaltech_core.c
@@ -790,17 +790,6 @@ static int fts_read_touchdata(struct fts_ts_data *data)
return 0;
}
-#if GOOGLE_REPORT_MODE
-static int get_work_mode(void) {
- int ret = 0;
- u8 mode = 0;
- ret = fts_read_reg(FTS_REG_WORKMODE, &mode);
- if (ret == 0)
- return mode;
- return ret;
-}
-#endif
-
static int fts_read_parse_touchdata(struct fts_ts_data *data)
{
int ret = 0;
@@ -813,7 +802,6 @@ static int fts_read_parse_touchdata(struct fts_ts_data *data)
#if GOOGLE_REPORT_MODE
u8 get_regB2_status = 0;
u8 check_regB2_status = 0;
- u8 work_mode;
u8 current_hopping = 0;
u8 new_hopping = 0;
#endif
@@ -830,8 +818,7 @@ static int fts_read_parse_touchdata(struct fts_ts_data *data)
#endif
#if GOOGLE_REPORT_MODE
- work_mode = get_work_mode();
- if (work_mode >= 0 && work_mode == FTS_REG_WORKMODE_WORK_VALUE ) {
+ if (data->work_mode == FTS_REG_WORKMODE_WORK_VALUE) {
fts_read_reg(FTS_REG_CUSTOMER_STATUS, &get_regB2_status);
check_regB2_status = get_regB2_status ^ current_host_status ;
if (check_regB2_status) { // current_status is different with previous_status
@@ -2886,6 +2873,7 @@ static int fts_ts_probe_entry(struct fts_ts_data *ts_data)
register_early_suspend(&ts_data->early_suspend);
#endif
+ ts_data->work_mode = FTS_REG_WORKMODE_WORK_VALUE;
#if GOOGLE_REPORT_MODE
fts_read_reg(FTS_REG_CUSTOMER_STATUS, &current_host_status);
if ((current_host_status & 0x03) < 3) {
diff --git a/ft3658/focaltech_core.h b/ft3658/focaltech_core.h
index b084b7f..826a083 100644
--- a/ft3658/focaltech_core.h
+++ b/ft3658/focaltech_core.h
@@ -271,6 +271,7 @@ struct fts_ts_data {
*/
ktime_t mf_downtime;
ktime_t bugreport_ktime_start;
+ u8 work_mode;
#if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP)
bool enable_fw_heatmap;
diff --git a/ft3658/focaltech_test/focaltech_test.c b/ft3658/focaltech_test/focaltech_test.c
index f025174..182b185 100644
--- a/ft3658/focaltech_test/focaltech_test.c
+++ b/ft3658/focaltech_test/focaltech_test.c
@@ -262,6 +262,7 @@ int fts_test_write(u8 addr, u8 *writebuf, int writelen)
*******************************************************************/
int enter_work_mode(void)
{
+ struct fts_ts_data *ts_data = fts_data;
int ret = 0;
u8 mode = 0;
int i = 0;
@@ -279,8 +280,9 @@ int enter_work_mode(void)
sys_delay(FACTORY_TEST_DELAY);
for (j = 0; j < 20; j++) {
ret = fts_test_read_reg(DIVIDE_MODE_ADDR, &mode);
- if ((ret >= 0) && (0x00 == mode)) {
+ if ((ret >= 0) && (mode == FTS_REG_WORKMODE_WORK_VALUE)) {
FTS_TEST_INFO("enter work mode success");
+ ts_data->work_mode = mode;
return 0;
} else {
sys_delay(FACTORY_TEST_DELAY);
@@ -302,6 +304,7 @@ int enter_work_mode(void)
int enter_factory_mode(void)
{
+ struct fts_ts_data *ts_data = fts_data;
int ret = 0;
u8 mode = 0;
int i = 0;
@@ -317,9 +320,10 @@ int enter_factory_mode(void)
sys_delay(FACTORY_TEST_DELAY);
for (j = 0; j < 20; j++) {
ret = fts_test_read_reg(DIVIDE_MODE_ADDR, &mode);
- if ((ret >= 0) && (0x40 == mode)) {
+ if ((ret >= 0) && (mode == FTS_REG_WORKMODE_FACTORY_VALUE)) {
FTS_TEST_INFO("enter factory mode success");
sys_delay(200);
+ ts_data->work_mode = mode;
return 0;
} else {
sys_delay(FACTORY_TEST_DELAY);