mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
Optimize high report rate feature
Support config different touch report rate by product, search corresponding report rate command in config struct according to refresh/interpolation config and then send it to IC. Change-Id: Ieff127e4b1e6dbb18fdda5deca91972326ebbb9c Signed-off-by: zhuwg1 <zhuwg1@motorola.com> Reviewed-on: https://gerrit.mot.com/2258273 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jun Weng <wengjun1@motorola.com> Reviewed-by: litong <litong20@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
7737ad1aa5
commit
210f570c86
5 changed files with 233 additions and 35 deletions
|
|
@ -13,7 +13,8 @@ goodix_brl_mmi-objs := \
|
|||
goodix_ts_utils.o \
|
||||
goodix_brl_fwupdate.o \
|
||||
goodix_ts_inspect.o \
|
||||
goodix_ts_tools.o
|
||||
goodix_ts_tools.o \
|
||||
goodix_ts_config.o
|
||||
|
||||
ifneq ($(filter m y, $(CONFIG_DRM_PANEL_EVENT_NOTIFICATIONS)),)
|
||||
EXTRA_CFLAGS += -DCONFIG_DRM_PANEL_EVENT_NOTIFICATIONS
|
||||
|
|
@ -64,5 +65,24 @@ ifneq ($(filter m y,$(CONFIG_INPUT_TOUCHSCREEN_MMI)),)
|
|||
goodix_brl_mmi-objs += goodix_ts_mmi.o
|
||||
endif
|
||||
|
||||
ifneq ($(findstring _factory,$(TARGET_PRODUCT)),)
|
||||
USE_TARGET_PRODUCT := $(strip $(subst _factory,, $(TARGET_PRODUCT)))
|
||||
else
|
||||
USE_TARGET_PRODUCT := $(TARGET_PRODUCT)
|
||||
endif
|
||||
|
||||
ifneq ($(filter oneli, $(USE_TARGET_PRODUCT)), )
|
||||
EXTRA_CFLAGS += -DPRODUCT_ONELI
|
||||
else ifneq ($(filter hiphi, $(USE_TARGET_PRODUCT)), )
|
||||
EXTRA_CFLAGS += -DPRODUCT_HIPHI
|
||||
else ifneq ($(filter hiphic, $(USE_TARGET_PRODUCT)), )
|
||||
EXTRA_CFLAGS += -DPRODUCT_HIPHIC
|
||||
else ifneq ($(filter li, $(USE_TARGET_PRODUCT)), )
|
||||
EXTRA_CFLAGS += -DPRODUCT_LI
|
||||
else ifneq ($(filter eqs, $(USE_TARGET_PRODUCT)), )
|
||||
EXTRA_CFLAGS += -DPRODUCT_EQS
|
||||
endif
|
||||
$(warning "william EXTRA_CFLAGS = $(EXTRA_CFLAGS)")
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../touchscreen_mmi/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../mmi_info/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
128
drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_config.c
Normal file
128
drivers/input/touchscreen/goodix_berlin_mmi/goodix_ts_config.c
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#include "goodix_ts_config.h"
|
||||
|
||||
struct goodix_ic_report_rate_config report_rate_config_info = {
|
||||
#if defined(PRODUCT_LI) || defined(PRODUCT_ONELI)
|
||||
.rate_config_count = 2,
|
||||
.refresh_rate_ctrl = 0,
|
||||
.interpolation_ctrl = 1,
|
||||
{
|
||||
{
|
||||
.interpolation_flag = 0,
|
||||
.report_rate = 240,
|
||||
.command = 0x9D01,
|
||||
},
|
||||
{
|
||||
.interpolation_flag = 1,
|
||||
.report_rate = 360,
|
||||
.command = 0x9D02,
|
||||
},
|
||||
}
|
||||
#elif defined(PRODUCT_HIPHIC)
|
||||
.rate_config_count = 3,
|
||||
.refresh_rate_ctrl = 1,
|
||||
.interpolation_ctrl = 1,
|
||||
{
|
||||
{
|
||||
.interpolation_flag = 0,
|
||||
.refresh_rate = {48, 144},
|
||||
.report_rate = 240,
|
||||
.command = 0x9D01,
|
||||
},
|
||||
{
|
||||
.interpolation_flag = 1,
|
||||
.refresh_rate = {144, 144},
|
||||
.report_rate = 576,
|
||||
.command = 0xC103,
|
||||
},
|
||||
{
|
||||
.interpolation_flag = 1,
|
||||
.refresh_rate = {48, 120},
|
||||
.report_rate = 480,
|
||||
.command = 0xC102,
|
||||
},
|
||||
}
|
||||
#elif defined(PRODUCT_HIPHI)
|
||||
.rate_config_count = 2,
|
||||
.refresh_rate_ctrl = 0,
|
||||
.interpolation_ctrl = 1,
|
||||
{
|
||||
{
|
||||
.interpolation_flag = 0,
|
||||
.report_rate = 360,
|
||||
.command = 0x9D02,
|
||||
},
|
||||
{
|
||||
.interpolation_flag = 1,
|
||||
.report_rate = 720,
|
||||
.command = 0xC101,
|
||||
},
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
int goodix_ts_mmi_get_report_rate(struct goodix_ts_core *core_data)
|
||||
{
|
||||
int refresh_rate_ctrl = 0;
|
||||
int interpolation_ctrl = 0;
|
||||
int interpolation_flag = 0;
|
||||
int refresh_rate = 0;
|
||||
int i = 0;
|
||||
|
||||
refresh_rate_ctrl = core_data->board_data.report_rate_ctrl;
|
||||
interpolation_ctrl = core_data->board_data.interpolation_ctrl;
|
||||
|
||||
interpolation_flag = core_data->get_mode.interpolation;
|
||||
refresh_rate = core_data->refresh_rate;
|
||||
|
||||
ts_debug("refresh_rate_ctrl: %d, interpolation_ctrl: %d, interpolation_flag: %d, refresh_rate: %d",
|
||||
refresh_rate_ctrl, interpolation_ctrl, interpolation_flag, refresh_rate);
|
||||
|
||||
if (refresh_rate_ctrl == 0 && interpolation_ctrl == 1) {
|
||||
for (i = 0; i < report_rate_config_info.rate_config_count; i++) {
|
||||
if (interpolation_flag == report_rate_config_info.report_rate_info[i].interpolation_flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (refresh_rate_ctrl == 1 && interpolation_ctrl == 1) {
|
||||
for (i = 0; i < report_rate_config_info.rate_config_count; i++) {
|
||||
if ((interpolation_flag == report_rate_config_info.report_rate_info[i].interpolation_flag) &&
|
||||
((refresh_rate >= report_rate_config_info.report_rate_info[i].refresh_rate[0]) &&
|
||||
(refresh_rate <= report_rate_config_info.report_rate_info[i].refresh_rate[1]))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (refresh_rate_ctrl == 1 && interpolation_ctrl == 0) {
|
||||
for (i = 0; i < report_rate_config_info.rate_config_count; i++) {
|
||||
if ((refresh_rate >= report_rate_config_info.report_rate_info[i].refresh_rate[0]) &&
|
||||
(refresh_rate <= report_rate_config_info.report_rate_info[i].refresh_rate[1])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//refresh_rate_ctrl = 0, interpolation_ctrl = 0
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (i == report_rate_config_info.rate_config_count) {
|
||||
ts_err("Get config report rate fail");
|
||||
return -1;
|
||||
} else {
|
||||
ts_debug("Get config report rate %dHZ, command : 0x%02x ",
|
||||
report_rate_config_info.report_rate_info[i].report_rate,
|
||||
report_rate_config_info.report_rate_info[i].command);
|
||||
return report_rate_config_info.report_rate_info[i].command;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 __GOODIX_TS_CONFIG_H__
|
||||
#define __GOODIX_TS_CONFIG_H__
|
||||
|
||||
#include <linux/touchscreen_mmi.h>
|
||||
#include "goodix_ts_core.h"
|
||||
|
||||
#define MAX_REPORT_RATE_CONFIG 12
|
||||
#define REPORT_RATE_CMD_180HZ 0x9D00
|
||||
#define REPORT_RATE_CMD_240HZ 0x9D01
|
||||
#define REPORT_RATE_CMD_360HZ 0x9D02
|
||||
#define REPORT_RATE_CMD_LOW 0x9D
|
||||
#define REPORT_RATE_CMD_480HZ 0xC102
|
||||
#define REPORT_RATE_CMD_576HZ 0xC103
|
||||
#define REPORT_RATE_CMD_720HZ 0xC101
|
||||
#define REPORT_RATE_CMD_HIGH 0xC1
|
||||
|
||||
struct report_rate_config {
|
||||
bool interpolation_flag; //if enable interpolation report rate
|
||||
u16 refresh_rate[2]; //display refresh rate
|
||||
u16 report_rate; //touch report rate
|
||||
u16 command; //report rate switch command
|
||||
};
|
||||
|
||||
struct goodix_ic_report_rate_config {
|
||||
u8 rate_config_count; //the count of report rate combination
|
||||
bool refresh_rate_ctrl; //if support report rate change according to refresh rate
|
||||
bool interpolation_ctrl; //if support interpolation report rate
|
||||
struct report_rate_config report_rate_info[MAX_REPORT_RATE_CONFIG];
|
||||
};
|
||||
|
||||
int goodix_ts_mmi_get_report_rate(struct goodix_ts_core *core_data);
|
||||
|
||||
#endif
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
#include "goodix_ts_core.h"
|
||||
#include <linux/delay.h>
|
||||
#include <linux/input/mt.h>
|
||||
#include "goodix_ts_config.h"
|
||||
|
||||
#define GET_GOODIX_DATA(dev) { \
|
||||
pdev = dev_get_drvdata(dev); \
|
||||
|
|
@ -388,26 +389,16 @@ static ssize_t goodix_ts_stylus_mode_show(struct device *dev,
|
|||
return scnprintf(buf, PAGE_SIZE, "0x%02x", core_data->set_mode.stylus_mode);
|
||||
}
|
||||
|
||||
#define DSI_REFRESH_RATE_144 144
|
||||
static int goodix_ts_mmi_set_report_rate(struct goodix_ts_core *core_data)
|
||||
{
|
||||
int ret = 0;
|
||||
int mode = 0;
|
||||
|
||||
if (core_data->get_mode.interpolation == 0x00) {
|
||||
mode = REPORT_RATE_DEFAULT;
|
||||
goto ts_send_cmd;
|
||||
mode = goodix_ts_mmi_get_report_rate(core_data);
|
||||
if (mode == -1) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (core_data->board_data.report_rate_ctrl) {
|
||||
if (core_data->refresh_rate == DSI_REFRESH_RATE_144)
|
||||
mode = REPORT_RATE_576HZ;
|
||||
else
|
||||
mode = REPORT_RATE_480HZ;
|
||||
} else
|
||||
mode = REPORT_RATE_720HZ;
|
||||
|
||||
ts_send_cmd:
|
||||
core_data->get_mode.report_rate_mode = mode;
|
||||
if (core_data->set_mode.report_rate_mode == mode) {
|
||||
ts_debug("The value = %d is same, so not to write", mode);
|
||||
|
|
@ -419,20 +410,36 @@ ts_send_cmd:
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = goodix_ts_send_cmd(core_data, INTERPOLATION_SWITCH_CMD, 5,
|
||||
core_data->get_mode.report_rate_mode, 0x00);
|
||||
//if now on high report rate and need switch to low report rate
|
||||
if ((((core_data->set_mode.report_rate_mode >> 8) & 0xFF) == REPORT_RATE_CMD_HIGH) &&
|
||||
(((mode >> 8) & 0xFF) == REPORT_RATE_CMD_LOW)) {
|
||||
ts_info("exit high report rate");
|
||||
ret = goodix_ts_send_cmd(core_data, EXIT_HIGH_REPORT_RATE_CMD >> 8, 5,
|
||||
EXIT_HIGH_REPORT_RATE_CMD & 0xFF, 0x00);
|
||||
if (ret < 0) {
|
||||
ts_err("failed to exit high report rate");
|
||||
return -EINVAL;
|
||||
}
|
||||
msleep(20);
|
||||
}
|
||||
|
||||
//send switch command
|
||||
ret = goodix_ts_send_cmd(core_data, mode >> 8, 5,
|
||||
mode & 0xFF, 0x00);
|
||||
if (ret < 0) {
|
||||
ts_err("failed to set report rate, mode = %d", mode);
|
||||
return -EINVAL;
|
||||
}
|
||||
msleep(20);
|
||||
|
||||
core_data->set_mode.report_rate_mode = mode;
|
||||
msleep(20);
|
||||
ts_info("Success to set %s\n", mode == 0x00 ? "Default" :
|
||||
(mode == 0x01 ? "REPORT_RATE_720HZ" :
|
||||
(mode == 0x02 ? "REPORT_RATE_480HZ" :
|
||||
(mode == 0x03 ? "REPORT_RATE_576HZ" :
|
||||
"Unsupported"))));
|
||||
|
||||
ts_info("Success to set %s\n", mode == REPORT_RATE_CMD_240HZ ? "REPORT_RATE_240HZ" :
|
||||
(mode == REPORT_RATE_CMD_360HZ ? "REPORT_RATE_360HZ" :
|
||||
(mode == REPORT_RATE_CMD_480HZ ? "REPORT_RATE_480HZ" :
|
||||
(mode == REPORT_RATE_CMD_576HZ ? "REPORT_RATE_576HZ" :
|
||||
(mode == REPORT_RATE_CMD_720HZ ? "REPORT_RATE_720HZ" :
|
||||
"Unsupported")))));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -913,18 +920,21 @@ static int goodix_ts_mmi_post_resume(struct device *dev) {
|
|||
}
|
||||
|
||||
if (core_data->board_data.interpolation_ctrl && core_data->get_mode.interpolation) {
|
||||
ret = goodix_ts_send_cmd(core_data, INTERPOLATION_SWITCH_CMD, 5,
|
||||
core_data->get_mode.report_rate_mode, 0x00);
|
||||
//send switch command
|
||||
ret = goodix_ts_send_cmd(core_data, (core_data->get_mode.report_rate_mode) >> 8, 5,
|
||||
(core_data->get_mode.report_rate_mode) & 0xFF, 0x00);
|
||||
if (!ret) {
|
||||
core_data->set_mode.interpolation = core_data->get_mode.interpolation;
|
||||
core_data->set_mode.report_rate_mode = core_data->get_mode.report_rate_mode;
|
||||
msleep(20);
|
||||
|
||||
ts_info("Success to %s interpolation mode\n",
|
||||
core_data->get_mode.report_rate_mode == 0x00 ? "Default" :
|
||||
(core_data->get_mode.report_rate_mode == 0x01 ? "REPORT_RATE_720HZ" :
|
||||
(core_data->get_mode.report_rate_mode == 0x02 ? "REPORT_RATE_480HZ" :
|
||||
(core_data->get_mode.report_rate_mode == 0x03 ? "REPORT_RATE_576HZ" :
|
||||
"Unsupported"))));
|
||||
core_data->get_mode.report_rate_mode == REPORT_RATE_CMD_240HZ ? "REPORT_RATE_240HZ" :
|
||||
(core_data->get_mode.report_rate_mode == REPORT_RATE_CMD_360HZ ? "REPORT_RATE_360HZ" :
|
||||
(core_data->get_mode.report_rate_mode == REPORT_RATE_CMD_480HZ ? "REPORT_RATE_480HZ" :
|
||||
(core_data->get_mode.report_rate_mode == REPORT_RATE_CMD_576HZ ? "REPORT_RATE_576HZ" :
|
||||
(core_data->get_mode.report_rate_mode == REPORT_RATE_CMD_720HZ ? "REPORT_RATE_720HZ" :
|
||||
"Unsupported")))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,5 @@ static int inline goodix_ts_mmi_dev_unregister(struct platform_device *ts_device
|
|||
|
||||
#define STYLUS_MODE_SWITCH_CMD 0xA4
|
||||
|
||||
#define INTERPOLATION_SWITCH_CMD 0xC1
|
||||
#define REPORT_RATE_DEFAULT 0x00
|
||||
#define REPORT_RATE_720HZ 0x01
|
||||
#define REPORT_RATE_480HZ 0x02
|
||||
#define REPORT_RATE_576HZ 0x03
|
||||
|
||||
#define EXIT_HIGH_REPORT_RATE_CMD 0xC100
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue