linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: Hans de Goede <hdegoede@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH v2] Input: goodix - disable IRQs while suspended
Date: Thu, 11 Jan 2018 16:52:34 +0100	[thread overview]
Message-ID: <1515685954.3261.3.camel@hadess.net> (raw)
In-Reply-To: <20180111141211.16888-1-hdegoede@redhat.com>

On Thu, 2018-01-11 at 15:12 +0100, Hans de Goede wrote:
> We should not try to do any i2c transfers before the controller is
> resumed (which happens before our resume method gets called).
> 
> So we need to disable our IRQ while suspended to enforce this. The
> code paths for devices with GPIOs for the int and reset pins already
> disable the IRQ the through goodix_free_irq().
> 
> This commit also disables the IRQ while suspended for devices without
> GPIOs for the int and reset pins.
> 
> This fixes the i2c bus sometimes getting stuck after a suspend/resume
> causing the touchscreen to sometimes not work after a suspend/resume.
> This has been tested on a GPD pocked device.

pocket?

Reviewed-by: Bastien Nocera <hadess@hadess.net>

> BugLink: https://github.com/nexus511/gpd-ubuntu-packages/issues/10
> BugLink: https://www.reddit.com/r/GPDPocket/comments/7niut2/fix_for_b
> roken_touch_after_resume_all_linux/
> Tested-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Mention the problems this fix + devices tested on in commit msg
> -Add BugLinks and Tested-by to commit msg
> ---
>  drivers/input/touchscreen/goodix.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/goodix.c
> b/drivers/input/touchscreen/goodix.c
> index 69d0b8cbc71f..ecec8eb17f28 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -878,8 +878,10 @@ static int __maybe_unused goodix_suspend(struct
> device *dev)
>  	int error;
>  
>  	/* We need gpio pins to suspend/resume */
> -	if (!ts->gpiod_int || !ts->gpiod_rst)
> +	if (!ts->gpiod_int || !ts->gpiod_rst) {
> +		disable_irq(client->irq);
>  		return 0;
> +	}
>  
>  	wait_for_completion(&ts->firmware_loading_complete);
>  
> @@ -919,8 +921,10 @@ static int __maybe_unused goodix_resume(struct
> device *dev)
>  	struct goodix_ts_data *ts = i2c_get_clientdata(client);
>  	int error;
>  
> -	if (!ts->gpiod_int || !ts->gpiod_rst)
> +	if (!ts->gpiod_int || !ts->gpiod_rst) {
> +		enable_irq(client->irq);
>  		return 0;
> +	}
>  
>  	/*
>  	 * Exit sleep mode by outputting HIGH level to INT pin

  reply	other threads:[~2018-01-11 15:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 14:12 [PATCH v2] Input: goodix - disable IRQs while suspended Hans de Goede
2018-01-11 15:52 ` Bastien Nocera [this message]
2018-01-11 17:23   ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515685954.3261.3.camel@hadess.net \
    --to=hadess@hadess.net \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).