mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Grant Likely <grant.likely@linaro.org>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH RESEND] net: rfkill: gpio: Add ACPI default GPIO driver mappings
Date: Tue, 28 Oct 2014 23:18:44 +0100	[thread overview]
Message-ID: <1726782.TCzbPOGKzX@vostro.rjw.lan> (raw)
In-Reply-To: <1414490628-107823-1-git-send-email-mika.westerberg@linux.intel.com>

On Tuesday, October 28, 2014 12:03:48 PM Mika Westerberg wrote:
> The driver uses devm_gpiod_get_index(..., index) so that the index refers
> directly to the GpioIo resource under the ACPI device. The problem with
> this is that if the ordering changes we get wrong GPIOs.
> 
> With ACPI 5.1 _DSD we can now use names instead to reference GPIOs
> analogous to Device Tree. However, we still have systems out there that do
> not provide _DSD at all. These systems must be supported as well.
> 
> Luckily we now have acpi_dev_add_driver_gpios() that can be used to provide
> mappings for systems where _DSD is not provided and still take advantage of
> _DSD if it exists.
> 
> This patch converts the rfkill-gpio.c driver to create default GPIO
> mappings to the two GPIOs in case we are running on ACPI system.
> 
> While there we can drop the indices completely.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
> Acked-by: John W. Linville <linville@tuxdriver.com>

Applied, thanks!

> ---
> Resending with linux-acpi included. I also added ACKs from Johannes and
> John. The patch itself is intact.
> 
>  net/rfkill/rfkill-gpio.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> index 0f62326c0f5e..2a4717967502 100644
> --- a/net/rfkill/rfkill-gpio.c
> +++ b/net/rfkill/rfkill-gpio.c
> @@ -63,6 +63,15 @@ static const struct rfkill_ops rfkill_gpio_ops = {
>  	.set_block = rfkill_gpio_set_power,
>  };
>  
> +static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
> +static const struct acpi_gpio_params shutdown_gpios = { 1, 0, false };
> +
> +static const struct acpi_gpio_mapping acpi_rfkill_default_gpios[] = {
> +	{ "reset-gpios", &reset_gpios, 1 },
> +	{ "shutdown-gpios", &shutdown_gpios, 1 },
> +	{ },
> +};
> +
>  static int rfkill_gpio_acpi_probe(struct device *dev,
>  				  struct rfkill_gpio_data *rfkill)
>  {
> @@ -75,7 +84,8 @@ static int rfkill_gpio_acpi_probe(struct device *dev,
>  	rfkill->name = dev_name(dev);
>  	rfkill->type = (unsigned)id->driver_data;
>  
> -	return 0;
> +	return acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
> +					 acpi_rfkill_default_gpios);
>  }
>  
>  static int rfkill_gpio_probe(struct platform_device *pdev)
> @@ -102,7 +112,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>  
>  	rfkill->clk = devm_clk_get(&pdev->dev, NULL);
>  
> -	gpio = devm_gpiod_get_index(&pdev->dev, "reset", 0);
> +	gpio = devm_gpiod_get(&pdev->dev, "reset");
>  	if (!IS_ERR(gpio)) {
>  		ret = gpiod_direction_output(gpio, 0);
>  		if (ret)
> @@ -110,7 +120,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
>  		rfkill->reset_gpio = gpio;
>  	}
>  
> -	gpio = devm_gpiod_get_index(&pdev->dev, "shutdown", 1);
> +	gpio = devm_gpiod_get(&pdev->dev, "shutdown");
>  	if (!IS_ERR(gpio)) {
>  		ret = gpiod_direction_output(gpio, 0);
>  		if (ret)
> @@ -150,6 +160,8 @@ static int rfkill_gpio_remove(struct platform_device *pdev)
>  	rfkill_unregister(rfkill->rfkill_dev);
>  	rfkill_destroy(rfkill->rfkill_dev);
>  
> +	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
> +
>  	return 0;
>  }
>  
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2014-10-28 21:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-28 10:03 Mika Westerberg
2014-10-28 22:18 ` Rafael J. Wysocki [this message]

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=1726782.TCzbPOGKzX@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=arnd@arndb.de \
    --cc=gnurou@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --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

all inboxes | Powered by JetHome®