linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "russianneuromancer @ ya . ru" <russianneuromancer@ya.ru>,
	Gregor Riepl <onitake@gmail.com>,
	linux-input@vger.kernel.org
Subject: Re: [PATCH v2] Input: silead - Do not try to directly access the GPIO when using ACPI pm
Date: Sun, 22 Jan 2017 14:20:15 -0800	[thread overview]
Message-ID: <20170122222015.GA31009@dtor-ws> (raw)
In-Reply-To: <20170122200008.27027-1-hdegoede@redhat.com>

On Sun, Jan 22, 2017 at 09:00:08PM +0100, Hans de Goede wrote:
> On some x86 tablets we cannot directly access the GPIOs as they are
> claimed by the ACPI tables, so check it the i2c client is not being
> power-managed by ACPI before trying to get the power pin GPIO.

Why do we even get this GPIO if driver is not supposed to be using it?
I'd much rather gpio provider hid it from the driver instead of every
driver having this check.

Thanks.

> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Check acpi_bus_power_manageable() instead of trying to directly
>  control the acpi power level ourselves
> ---
>  drivers/input/touchscreen/silead.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
> index 404830a..2fbcd7f 100644
> --- a/drivers/input/touchscreen/silead.c
> +++ b/drivers/input/touchscreen/silead.c
> @@ -31,6 +31,7 @@
>  #include <linux/irq.h>
>  #include <linux/regulator/consumer.h>
>  
> +#include <acpi/acpi_bus.h>
>  #include <asm/unaligned.h>
>  
>  #define SILEAD_TS_NAME		"silead_ts"
> @@ -494,12 +495,21 @@ static int silead_ts_probe(struct i2c_client *client,
>  	if (error)
>  		return error;
>  
> -	/* Power GPIO pin */
> -	data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
> -	if (IS_ERR(data->gpio_power)) {
> -		if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
> -			dev_err(dev, "Shutdown GPIO request failed\n");
> -		return PTR_ERR(data->gpio_power);
> +	/*
> +	 * If device power is not managed by ACPI, get the power_gpio
> +	 * and manage it ourselves.
> +	 */
> +#ifdef CONFIG_ACPI
> +	if (!acpi_bus_power_manageable(ACPI_HANDLE(dev)))
> +#endif
> +	{
> +		data->gpio_power = devm_gpiod_get_optional(dev, "power",
> +							   GPIOD_OUT_LOW);
> +		if (IS_ERR(data->gpio_power)) {
> +			if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
> +				dev_err(dev, "Power GPIO request failed\n");
> +			return PTR_ERR(data->gpio_power);
> +		}
>  	}
>  
>  	error = silead_ts_setup(client);
> -- 
> 2.9.3
> 

-- 
Dmitry

  reply	other threads:[~2017-01-22 22:20 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22 20:00 [PATCH v2] Input: silead - Do not try to directly access the GPIO when using ACPI pm Hans de Goede
2017-01-22 22:20 ` Dmitry Torokhov [this message]
2017-01-23 10:05   ` Hans de Goede
2017-02-01 17:42     ` Dmitry Torokhov
2017-02-02 10:41       ` Mika Westerberg
2017-02-02 11:57         ` Hans de Goede
2017-02-02 12:10           ` Mika Westerberg
2017-02-02 12:32             ` Mika Westerberg
2017-02-02 12:50               ` Hans de Goede
2017-02-02 13:12                 ` Mika Westerberg
2017-02-02 13:27                   ` Hans de Goede
2017-02-02 13:44                     ` Mika Westerberg
2017-02-02 13:55                       ` Hans de Goede
2017-02-02 14:18                         ` Mika Westerberg
2017-02-02 14:24                           ` Gregor Riepl
2017-03-14 10:21                             ` Linus Walleij
2017-03-14 11:07                               ` Hans de Goede
2017-03-14 13:09                               ` Andy Shevchenko
2017-03-14 18:12                               ` Gregor Riepl
2017-02-10 11:52                   ` Hans de Goede
2017-02-10 13:02                     ` Mika Westerberg
2017-02-12 10:40                     ` Hans de Goede
2017-02-13 11:00                       ` Andy Shevchenko
2017-02-22 15:52                       ` Andy Shevchenko
2017-02-23 14:19                         ` Hans de Goede
2017-03-02 11:38                           ` Andy Shevchenko
2017-03-02 15:34                             ` Hans de Goede
2017-03-03 14:57                               ` Andy Shevchenko
2017-03-03 15:19                                 ` Hans de Goede
2017-03-03 15:23                                   ` Andy Shevchenko
2017-03-06  9:31                                     ` Hans de Goede
2017-03-07 11:51                                       ` Andy Shevchenko
2017-03-07 13:55                                         ` Hans de Goede
2017-03-08  9:08                                           ` Hans de Goede
2017-03-08 10:30                                             ` Andy Shevchenko
2017-03-08 11:27                                               ` Hans de Goede
2017-03-08 11:46                                                 ` Andy Shevchenko
2017-03-08 17:01                                                   ` Andy Shevchenko
2017-03-08 17:08                                                     ` Hans de Goede
2017-03-08 17:14                                                     ` Andy Shevchenko
2017-03-08 17:05                                                   ` Hans de Goede
2017-03-08 18:25                                                     ` Andy Shevchenko
2017-03-09 13:57                                                       ` Hans de Goede
2017-03-09 14:03                                                         ` Andy Shevchenko
2017-03-09 14:45                                                           ` Hans de Goede
2017-03-09 15:03                                                             ` Andy Shevchenko
2017-03-09 15:40                                                               ` Hans de Goede
2017-03-09 18:48                                                             ` Hans de Goede
2017-03-09 21:32                                                               ` Dmitry Torokhov
2017-03-10 10:35                                                                 ` Mika Westerberg
2017-03-10 11:33                                                               ` Andy Shevchenko
2017-03-10 11:58                                                                 ` Andy Shevchenko
2017-03-10 20:49                                                                 ` 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=20170122222015.GA31009@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=onitake@gmail.com \
    --cc=russianneuromancer@ya.ru \
    /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).