[v4,2/3] Input: edt-ft5x06 - Set wake/reset values on resume/suspend

Message ID 20180725073410.730-3-mylene.josserand@bootlin.com
State New
Headers show
Series
  • sun8i-a83t: Add touchscreen support on TBS A711
Related show

Commit Message

Mylène Josserand July 25, 2018, 7:34 a.m.
On resume and suspend, set the value of wake and reset gpios
to be sure that we are in a know state after suspending/resuming.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Dmitry Torokhov July 26, 2018, 12:52 a.m. | #1
Hi Mylène,

On Wed, Jul 25, 2018 at 09:34:09AM +0200, Mylène Josserand wrote:
> On resume and suspend, set the value of wake and reset gpios
> to be sure that we are in a know state after suspending/resuming.
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index dcde719094f7..dad2f1f8bf89 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -1158,6 +1158,12 @@ static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
>  	else
>  		regulator_disable(tsdata->vcc);
>  
> +	if (tsdata->wake_gpio)
> +		gpiod_set_value(tsdata->wake_gpio, 0);
> +
> +	if (tsdata->reset_gpio)
> +		gpiod_set_value(tsdata->reset_gpio, 1);

Ondřej mentioned in previous review that if you power off the controller
it will not be able to wake up the system, and you had to move call to
regulator_disable() into "else" branch of check whether the controller
is a wakeup device. Guess what happens if you unconditionally put the
device into reset state?

Thanks.

Patch

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index dcde719094f7..dad2f1f8bf89 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -1158,6 +1158,12 @@  static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 	else
 		regulator_disable(tsdata->vcc);
 
+	if (tsdata->wake_gpio)
+		gpiod_set_value(tsdata->wake_gpio, 0);
+
+	if (tsdata->reset_gpio)
+		gpiod_set_value(tsdata->reset_gpio, 1);
+
 	return 0;
 }
 
@@ -1177,6 +1183,12 @@  static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
 		}
 	}
 
+	if (tsdata->wake_gpio)
+		gpiod_set_value(tsdata->wake_gpio, 1);
+
+	if (tsdata->reset_gpio)
+		gpiod_set_value(tsdata->reset_gpio, 0);
+
 	return 0;
 }