From 08dbfb3e64c8fcaaad73b510cae3705a405a6fa1 Mon Sep 17 00:00:00 2001 From: Konstantin Makariev Date: Tue, 27 Aug 2019 12:44:49 -0500 Subject: [PATCH] sec_mmi: control reset gpio state Driver cannot set RST gpio direction and state explicitly in pictrl config dur to compatibility reason. Thus adding the code setting RST gpio high every time pin control switches from Off to On state Change-Id: I4217b7546f48ec20204bf93b12a15baf95905475 Signed-off-by: Konstantin Makariev Reviewed-on: https://gerrit.mot.com/1411555 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Ryan Lattrel Reviewed-by: Konstantin Makariev Submit-Approved: Jira Key --- drivers/input/touchscreen/sec_mmi/sec_ts.c | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/sec_mmi/sec_ts.c b/drivers/input/touchscreen/sec_mmi/sec_ts.c index 3d912db2232f..3c03b678fe1d 100644 --- a/drivers/input/touchscreen/sec_mmi/sec_ts.c +++ b/drivers/input/touchscreen/sec_mmi/sec_ts.c @@ -1079,6 +1079,7 @@ void sec_ts_set_grip_type(struct sec_ts_data *ts, u8 set_type) int sec_ts_pinctrl_configure(struct sec_ts_data *ts, bool enable) { + int rc = 0; struct pinctrl_state *state; input_info(true, &ts->client->dev, "%s: %s\n", __func__, enable ? "ACTIVE" : "SUSPEND"); @@ -1087,21 +1088,23 @@ int sec_ts_pinctrl_configure(struct sec_ts_data *ts, bool enable) state = pinctrl_lookup_state(ts->plat_data->pinctrl, "on_state"); if (IS_ERR(ts->plat_data->pinctrl)) input_err(true, &ts->client->dev, "%s: could not get active pinstate\n", __func__); - if (gpio_is_valid(ts->plat_data->rst_gpio)) { - /* pinctrl is not setting RESET gpio high by default */ - /* due to compatibility issues with Synaptics driver */ - gpio_set_value(ts->plat_data->rst_gpio, 1); - } } else { state = pinctrl_lookup_state(ts->plat_data->pinctrl, "off_state"); if (IS_ERR(ts->plat_data->pinctrl)) input_err(true, &ts->client->dev, "%s: could not get suspend pinstate\n", __func__); } - if (!IS_ERR_OR_NULL(state)) - return pinctrl_select_state(ts->plat_data->pinctrl, state); + if (!IS_ERR_OR_NULL(state)) { + rc = pinctrl_select_state(ts->plat_data->pinctrl, state); + if (enable && gpio_is_valid(ts->plat_data->rst_gpio)) { + /* pinctrl is not setting RESET gpio high by default */ + /* due to compatibility issues with Synaptics driver */ + gpio_set_value(ts->plat_data->rst_gpio, 1); + input_dbg(true, &ts->client->dev, "%s: rst gpio is %d\n", __func__, gpio_get_value(ts->plat_data->rst_gpio)); + } + } - return 0; + return rc; } @@ -1201,6 +1204,12 @@ static int sec_ts_parse_dt(struct i2c_client *client) input_err(true, &client->dev, "%s: Unable to request tsp_rst [%d]\n", __func__, pdata->rst_gpio); return -EINVAL; } + if (gpio_is_valid(pdata->rst_gpio)) { + /* pinctrl is not setting RESET gpio high by default */ + /* due to compatibility issues with Synaptics driver */ + gpio_set_value(pdata->rst_gpio, 1); + input_dbg(true, &client->dev, "%s: rst gpio is %d\n", __func__, gpio_get_value(pdata->rst_gpio)); + } } else input_info(true, &client->dev, "%s: has no rst gpio\n", __func__);