All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rhyland Klein <rklein@nvidia.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Chris Ball <cjb@laptop.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alex Courbot <acourbot@nvidia.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	Rob Landley <rob@landley.net>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/5] net: rfkill: gpio: convert to descriptor-based GPIO interface
Date: Thu, 21 Nov 2013 12:05:34 -0500	[thread overview]
Message-ID: <528E3D5E.20907@nvidia.com> (raw)
In-Reply-To: <20131121152425.GA5557@xps8300>

On 11/21/2013 10:24 AM, Heikki Krogerus wrote:
> Hi Rhyland,
> 
> On Thu, Nov 21, 2013 at 04:45:49PM +0200, Mika Westerberg wrote:
>> +static int rfkill_gpio_convert_to_desc(struct platform_device *pdev,
>> +				       struct rfkill_gpio_data *rfkill)
>> +{
>> +	struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data;
>> +	int ret = 0;
>> +
>> +	if (gpio_is_valid(pdata->reset_gpio)) {
>> +		ret = devm_gpio_request_one(&pdev->dev, pdata->reset_gpio,
>> +					    0, rfkill->reset_name);
>> +		if (ret) {
>> +			pr_warn("%s: failed to get reset gpio.\n", __func__);
>> +			return ret;
>> +		}
>> +		rfkill->reset_gpio = gpio_to_desc(pdata->reset_gpio);
>> +	}
>> +
>> +	if (gpio_is_valid(pdata->shutdown_gpio)) {
>> +		ret = devm_gpio_request_one(&pdev->dev, pdata->shutdown_gpio,
>> +					    0, rfkill->shutdown_name);
>> +		if (ret) {
>> +			pr_warn("%s: failed to get shutdown gpio.\n", __func__);
>> +			return ret;
>> +		}
>> +		rfkill->shutdown_gpio = gpio_to_desc(pdata->shutdown_gpio);
>> +	}
>> +
>> +	return 0;
>> +}
> 
> We could drop this conversion if you guys added gpiod_lookup table to
> your platform code. I think something like this is enough. Please note
> that I have not even tried compile it but you get the idea from it.
> 
> diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
> index 06f0240..19bce88 100644
> --- a/arch/arm/mach-tegra/board-paz00.c
> +++ b/arch/arm/mach-tegra/board-paz00.c
> @@ -18,13 +18,12 @@
>   */
>  
>  #include <linux/platform_device.h>
> +#include <linux/gpio/driver.h>
>  #include <linux/rfkill-gpio.h>
>  #include "board.h"
>  
>  static struct rfkill_gpio_platform_data wifi_rfkill_platform_data = {
>         .name           = "wifi_rfkill",
> -       .reset_gpio     = 25, /* PD1 */
> -       .shutdown_gpio  = 85, /* PK5 */
>         .type   = RFKILL_TYPE_WLAN,
>  };
>  
> @@ -36,7 +35,13 @@ static struct platform_device wifi_rfkill_device = {
>         },
>  };
>  
> +static struct gpiod_lookup wifi_gpio_lookup[] = {
> +       GPIO_LOOKUP_IDX("tegra-gpio", 25, "rfkill_gpio", NULL, 0, NULL),
> +       GPIO_LOOKUP_IDX("tegra-gpio", 85, "rfkill_gpio", NULL, 1, NULL),
> +};
> +
>  void __init tegra_paz00_wifikill_init(void)
>  {
> +       gpiod_add_table(wifi_lookup, ARRAY_SIZE(wifi_gpio_lookup));
>         platform_device_register(&wifi_rfkill_device);
>  }
> 
> 

This seems like a reasonable patch, and likely a good way to go. I don't
have a AC100 to test this with though, so I can't verify this
personally. Also, would the paz00 patch become a dependency of this
patchset? Mika, maybe you can therefore include a patch for paz00 in
your patchset?

-rhyland

-- 
nvpublic

  reply	other threads:[~2013-11-21 17:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 14:45 [PATCH 0/5] gpio / ACPI: convert users to gpiod_* and drop acpi_gpio.h Mika Westerberg
2013-11-21 14:45 ` [PATCH 1/5] net: rfkill: gpio: convert to descriptor-based GPIO interface Mika Westerberg
2013-11-21 15:24   ` Heikki Krogerus
2013-11-21 17:05     ` Rhyland Klein [this message]
2013-11-21 17:22       ` Mika Westerberg
2013-11-21 21:46         ` Rafael J. Wysocki
2013-11-21 15:32   ` Andy Shevchenko
2013-11-22 10:50     ` Heikki Krogerus
2013-11-21 14:45 ` [PATCH 2/5] mmc: sdhci-acpi: covert to use GPIO descriptor API Mika Westerberg
2013-11-22  8:53   ` Adrian Hunter
2013-11-22 10:18     ` Mika Westerberg
2013-11-21 14:45 ` [PATCH 3/5] gpio / ACPI: register to ACPI events automatically Mika Westerberg
2013-11-21 14:45 ` [PATCH 4/5] gpio / ACPI: get rid of acpi_gpio.h Mika Westerberg
2013-11-21 14:45 ` [PATCH 5/5] Documentation / ACPI: update to GPIO descriptor API Mika Westerberg
2013-11-21 15:01 ` [PATCH 0/5] gpio / ACPI: convert users to gpiod_* and drop acpi_gpio.h Johannes Berg

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=528E3D5E.20907@nvidia.com \
    --to=rklein@nvidia.com \
    --cc=acourbot@nvidia.com \
    --cc=adrian.hunter@intel.com \
    --cc=cjb@laptop.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=rob@landley.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.