drivers: nt36523: register game_mode into common touchpanel

Change-Id: I12213afefda3f8695dc3b0a308de21648d9bc9bb
This commit is contained in:
Fuutao
2026-01-03 16:00:27 +08:00
committed by stic-server-open
parent 7c8b9e64de
commit aa11f01121
3 changed files with 44 additions and 0 deletions

View File

@@ -153,6 +153,29 @@ static struct tp_common_ops double_tap_ops = {
#endif
#endif
#ifdef CONFIG_TOUCHSCREEN_COMMON
static ssize_t nvt_game_mode_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%d\n", ts->nvt_game_mode);
}
static ssize_t nvt_game_mode_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
int value;
kstrtoint(buf, 10, &value);
ts->nvt_game_mode = !!value;
return count;
}
static struct tp_common_ops game_mode_ops = {
.show = nvt_game_mode_show,
.store = nvt_game_mode_store,
};
#endif
#ifdef CONFIG_MTK_SPI
const struct mt_chip_conf spi_ctrdata = {
.setuptime = 25,
@@ -3417,6 +3440,10 @@ static int32_t nvt_ts_probe(struct spi_device *client)
xiaomitouch_register_modedata(&xiaomi_touch_interfaces);
#endif
#ifdef CONFIG_TOUCHSCREEN_COMMON
tp_common_set_game_mode_ops(&game_mode_ops);
#endif
bTouchIsAwake = 1;
NVT_LOG("end\n");

View File

@@ -224,6 +224,9 @@ struct nvt_ts_data {
void *testdata;
#endif
bool pen_gen2_force;
#ifdef CONFIG_TOUCHSCREEN_COMMON
bool nvt_game_mode;
#endif
};
#if NVT_TOUCH_PROC

View File

@@ -370,6 +370,20 @@ static int32_t update_firmware_request(const char *filename)
NVT_LOG("filename was changed to %s\n", filename);
}
#ifdef CONFIG_TOUCHSCREEN_COMMON
if (ts->nvt_game_mode) {
u8 *lockdown = ts->lockdown_info;
if (lockdown[1] == 0x42) {
pr_info("[touch]: cur csot Display panel use 0042 firmware\n");
filename = "novatek_nt36523_fw01_0042.bin";
} else if (lockdown[1] == 0x36) {
pr_info("[touch]: cur tianma Display panel use 0036 firmware\n");
filename = "novatek_nt36523_fw02_0036.bin";
}
}
#endif
if (NULL == filename) {
return -ENOENT;
}