diff options
-rw-r--r-- | goodix_brl_hw.c | 27 | ||||
-rw-r--r-- | goodix_ts_core.c | 8 | ||||
-rw-r--r-- | goodix_ts_core.h | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c index d6e2fbf..acfd294 100644 --- a/goodix_brl_hw.c +++ b/goodix_brl_hw.c @@ -1875,6 +1875,32 @@ static int brl_get_coord_filter_enabled( return ret; } +#define GOODIX_CMD_SET_REPORT_RATE 0x9D +#define GOODIX_REPORT_RATE_240HZ 0 +#define GOODIX_REPORT_RATE_120HZ 2 +static int brl_set_report_rate( + struct goodix_ts_core *cd, u32 rate) +{ + struct goodix_ts_cmd cmd = { 0 }; + int ret = 0; + + ts_info("set report rate %d", rate); + if ((rate != 120) && (rate != 240)) { + ts_info("Report Rate: %dHz is not support", rate); + return -EOPNOTSUPP; + } + + cmd.cmd = GOODIX_CMD_SET_REPORT_RATE; + cmd.len = 5; + cmd.data[0] = rate == 240 ? + GOODIX_REPORT_RATE_240HZ : GOODIX_REPORT_RATE_120HZ; + + ret = cd->hw_ops->send_cmd(cd, &cmd); + if (ret != 0) + ts_err("failed to set report rate"); + return ret; +} + static struct goodix_ts_hw_ops brl_hw_ops = { .power_on = brl_power_on, .resume = brl_resume, @@ -1912,6 +1938,7 @@ static struct goodix_ts_hw_ops brl_hw_ops = { .get_self_sensing_data = brl_get_self_sensing_data, .set_coord_filter_enabled = brl_set_coord_filter_enabled, .get_coord_filter_enabled = brl_get_coord_filter_enabled, + .set_report_rate = brl_set_report_rate, }; struct goodix_ts_hw_ops *goodix_get_hw_ops(void) diff --git a/goodix_ts_core.c b/goodix_ts_core.c index df5dc51..120c4f5 100644 --- a/goodix_ts_core.c +++ b/goodix_ts_core.c @@ -1199,6 +1199,13 @@ static int gti_get_context_driver(void *private_data, return 0; } +static int gti_set_report_rate(void *private_data, + struct gti_report_rate_cmd *cmd) +{ + struct goodix_ts_core *cd = private_data; + return cd->hw_ops->set_report_rate(cd, cmd->setting); +} + #endif /* prosfs create */ @@ -2941,6 +2948,7 @@ int goodix_ts_stage2_init(struct goodix_ts_core *cd) options->ping = gti_ping; options->selftest = gti_selftest; options->get_context_driver = gti_get_context_driver; + options->set_report_rate = gti_set_report_rate; cd->gti = goog_touch_interface_probe( cd, cd->bus->dev, cd->input_dev, gti_default_handler, options); diff --git a/goodix_ts_core.h b/goodix_ts_core.h index ceba3e5..33a59ee 100644 --- a/goodix_ts_core.h +++ b/goodix_ts_core.h @@ -690,6 +690,7 @@ struct goodix_ts_hw_ops { struct goodix_ts_core *cd, bool enabled); int (*get_coord_filter_enabled)( struct goodix_ts_core *cd, bool* enabled); + int (*set_report_rate)(struct goodix_ts_core *cd, u32 rate); }; /* |