linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Guohua Zhong <ghzhong@yifangdigital.com>
Cc: Jiri Kosina <jikos@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Dmitry Torokhov <dtor@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	Andrew Duggan <aduggan@synaptics.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: i2c-hid: set power sleep before shutdown
Date: Mon, 20 Jun 2016 11:34:57 +0200	[thread overview]
Message-ID: <20160620093457.GM24234@mail.corp.redhat.com> (raw)
In-Reply-To: <1466247030-23047-1-git-send-email-ghzhong@yifangdigital.com>

On Jun 18 2016 or thereabouts, Guohua Zhong wrote:
> Add i2c_hid_shutdown for i2c-hid driver to send suspend cmd &
> disable irq before device shutdown.
> 
> Some HW design is that the power to i2c hid device won't down
> after device shutdown. Also the i2c-hid driver do not send suspend
> cmd to the hid i2c device and disable its irq before shutdown.So
> if We touch the touchscreen or some other i2c hid device ,the power
> consumtion will be go up even when the device is in shutdown state.

Wow, that's a new one! Could you tell us which device board is behaving
that way (if not under NDA or such)?

> 
> Though the root cause maybe a HW issue. But it seems that it is a
> good pratice to set power sleep for i2c-hid device before shutdown.

Works for me:
Acked-By: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> 
> Signed-off-by: Guohua Zhong <ghzhong@yifangdigital.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> index 2e021ba..d6ea97b 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -1106,6 +1106,12 @@ static int i2c_hid_remove(struct i2c_client *client)
>  	return 0;
>  }
>  
> +static void i2c_hid_shutdown(struct i2c_client *client)
> +{
> +	i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
> +	disable_irq(client->irq);
> +}
> +
>  #ifdef CONFIG_PM_SLEEP
>  static int i2c_hid_suspend(struct device *dev)
>  {
> @@ -1230,7 +1236,7 @@ static struct i2c_driver i2c_hid_driver = {
>  
>  	.probe		= i2c_hid_probe,
>  	.remove		= i2c_hid_remove,
> -
> +	.shutdown	= i2c_hid_shutdown,
>  	.id_table	= i2c_hid_id_table,
>  };
>  
> -- 
> 1.9.1
> 
> 

  reply	other threads:[~2016-06-20  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-18 10:50 [PATCH] HID: i2c-hid: set power sleep before shutdown Guohua Zhong
2016-06-20  9:34 ` Benjamin Tissoires [this message]
2016-06-21  7:35   ` ghzhong
2016-06-21  9:49     ` Jiri Kosina
2016-06-20 10:39 ` Mika Westerberg
2016-06-21  7:37   ` ghzhong

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=20160620093457.GM24234@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=aduggan@synaptics.com \
    --cc=bleung@chromium.org \
    --cc=dtor@chromium.org \
    --cc=ghzhong@yifangdigital.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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).