mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
goodix: support film sensitivity function.
TP: Support film sensitivity function in RoguePRC project. Change-Id: I830adb55e9b9b93aef6dc90d757ef9eaf206a2cb Reviewed-on: https://gerrit.mot.com/2134201 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou <zoujc@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
dae8b800e2
commit
b75bcbf8cf
4 changed files with 56 additions and 1 deletions
|
|
@ -1107,6 +1107,11 @@ static int goodix_parse_dt(struct device_node *node,
|
|||
if (board_data->leather_mode_ctrl)
|
||||
ts_info("support goodix leather mode");
|
||||
|
||||
board_data->film_mode_ctrl = of_property_read_bool(node,
|
||||
"goodix,film_mode-ctrl");
|
||||
if (board_data->film_mode_ctrl)
|
||||
ts_info("support goodix film mode");
|
||||
|
||||
board_data->interpolation_ctrl = of_property_read_bool(node,
|
||||
"goodix,interpolation-ctrl");
|
||||
if (board_data->interpolation_ctrl)
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ struct goodix_ts_board_data {
|
|||
|
||||
bool sensitivity_ctrl;
|
||||
bool stylus_mode_ctrl;
|
||||
bool film_mode_ctrl;
|
||||
bool leather_mode_ctrl;
|
||||
bool interpolation_ctrl;
|
||||
bool report_rate_ctrl;
|
||||
|
|
@ -511,6 +512,7 @@ struct goodix_ts_core {
|
|||
struct notifier_block fb_notifier;
|
||||
#endif
|
||||
|
||||
int film_mode;
|
||||
int leather_mode;
|
||||
int stylus_mode;
|
||||
int interpolation;
|
||||
|
|
|
|||
|
|
@ -122,6 +122,33 @@ static int goodix_ts_send_cmd(struct goodix_ts_core *core_data,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int goodix_ts_film_mode(struct goodix_ts_core *core_data, int mode)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (core_data->film_mode == mode) {
|
||||
ts_debug("value is same,so not write.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (core_data->power_on == 0) {
|
||||
core_data->film_mode = mode;
|
||||
ts_debug("The touch is in sleep state, restore the value when resume\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = goodix_ts_send_cmd(core_data, FILM_MODE_SWITCH_CMD, 5, mode, 0x00);
|
||||
if (ret < 0) {
|
||||
ts_err("failed to send leather mode cmd");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
msleep(20);
|
||||
core_data->film_mode = mode;
|
||||
ts_info("Success to %s film mode", mode ? "Enable" : "Disable");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int goodix_ts_leather_mode(struct goodix_ts_core *core_data, int mode)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -145,7 +172,7 @@ static int goodix_ts_leather_mode(struct goodix_ts_core *core_data, int mode)
|
|||
|
||||
msleep(20);
|
||||
core_data->leather_mode = mode;
|
||||
ts_info("Success to %s lather mode", mode ? "Enable" : "Disable");
|
||||
ts_info("Success to %s leather mode", mode ? "Enable" : "Disable");
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
|
|
@ -171,6 +198,14 @@ static ssize_t goodix_ts_sensitivity_store(struct device *dev,
|
|||
}
|
||||
|
||||
switch (mode) {
|
||||
case 0x00:
|
||||
if (core_data->board_data.film_mode_ctrl)
|
||||
ret = goodix_ts_film_mode(core_data, EXIT_FILM_MODE);
|
||||
break;
|
||||
case 0x01:
|
||||
if (core_data->board_data.film_mode_ctrl)
|
||||
ret = goodix_ts_film_mode(core_data, ENTER_FILM_MODE);
|
||||
break;
|
||||
case 0x10:
|
||||
if (core_data->board_data.leather_mode_ctrl)
|
||||
ret = goodix_ts_leather_mode(core_data, EXIT_LEATHER_MODE);
|
||||
|
|
@ -799,6 +834,15 @@ static int goodix_ts_mmi_post_resume(struct device *dev) {
|
|||
}
|
||||
}
|
||||
|
||||
if (core_data->board_data.film_mode_ctrl && core_data->film_mode) {
|
||||
ret = goodix_ts_send_cmd(core_data, FILM_MODE_SWITCH_CMD, 5,
|
||||
core_data->film_mode, 0x00);
|
||||
if (!ret) {
|
||||
ts_info("Success to %s film mode", core_data->film_mode ? "Enable" : "Disable");
|
||||
msleep(20);
|
||||
}
|
||||
}
|
||||
|
||||
if (core_data->board_data.interpolation_ctrl && core_data->interpolation) {
|
||||
ret = goodix_ts_send_cmd(core_data, INTERPOLATION_SWITCH_CMD, 5,
|
||||
core_data->report_rate_mode, 0x00);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ static void inline goodix_ts_mmi_dev_unregister(struct platform_device *ts_devic
|
|||
#define ENTER_LEATHER_MODE 0x01
|
||||
#define EXIT_LEATHER_MODE 0x00
|
||||
|
||||
#define FILM_MODE_SWITCH_CMD 0x27
|
||||
#define ENTER_FILM_MODE 0x01
|
||||
#define EXIT_FILM_MODE 0x00
|
||||
|
||||
#define EDGE_SWITCH_CMD 0x17
|
||||
#define ROTATE_DEFAULT_0 0x00
|
||||
#define ROTATE_LEFT_90 0X40
|
||||
|
|
|
|||
Loading…
Reference in a new issue