diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 21:40:46 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-21 22:09:12 +0400 |
commit | 8e5096607280d4e103389bfe8f8b7decbf538ff6 (patch) | |
tree | 60352a466e96c7b36d41263d7590ee79e0aaff35 /net | |
parent | 02d0a752460ea5dab34ce36c9ddc9c682e846a0d (diff) | |
parent | de755c330512364d3396c7da0c20b1c20b3b08b2 (diff) | |
download | linux-8e5096607280d4e103389bfe8f8b7decbf538ff6.tar.xz |
Merge tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO tree bulk changes from Linus Walleij:
"A big set this merge window, as we have much going on in this
subsystem. The changes to other subsystems (notably a slew of ARM
machines as I am doing away with their custom APIs) have all been
ACKed to the extent possible.
Major changes this time:
- Some core improvements and cleanups to the new GPIO descriptor API.
This seems to be working now so we can start the exodus to this
API, moving gradually away from the global GPIO numberspace.
- Incremental improvements to the ACPI GPIO core, and move the few
GPIO ACPI clients we have to the GPIO descriptor API right *now*
before we go any further. We actually managed to contain this
*before* we started to litter the kernel with yet another hackish
global numberspace for the ACPI GPIOs, which is a big win.
- The RFkill GPIO driver and all platforms using it have been
migrated to use the GPIO descriptors rather than fixed number
assignments. Tegra machine has been migrated as part of this.
- New drivers for MOXA ART, Xtensa GPIO32 and SMSC SCH311x. Those
should be really good examples of how I expect a nice GPIO driver
to look these days.
- Do away with custom GPIO implementations on a major part of the ARM
machines: ks8695, lpc32xx, mv78xx0. Make a first step towards the
same in the horribly convoluted Samsung S3C include forest. We
expect to continue to clean this up as we move forward.
- Flag GPIO lines used for IRQ on adnp, bcm-kona, em, intel-mid and
lynxpoint.
This makes the GPIOlib core aware that a certain GPIO line is used
for IRQs and can then enforce some semantics such as disallowing a
GPIO line marked as in use for IRQ to be switched to output mode.
- Drop all use of irq_set_chip_and_handler_name(). The name provided
in these cases were just unhelpful tags like "mux" or "demux".
- Extend the MCP23s08 driver to handle interrupts.
- Minor incremental improvements for rcar, lynxpoint, em 74x164 and
msm drivers.
- Some non-urgent bug fixes here and there, duplicate #includes and
that usual kind of cleanups"
Fix up broken Kconfig file manually to make this all compile.
* tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (71 commits)
gpio: mcp23s08: fix casting caused build warning
gpio: mcp23s08: depend on OF_GPIO
gpio: mcp23s08: Add irq functionality for i2c chips
ARM: S5P[v210|c100|64x0]: Fix build error
gpio: pxa: clamp gpio get value to [0,1]
ARM: s3c24xx: explicit dependency on <plat/gpio-cfg.h>
ARM: S3C[24|64]xx: move includes back under <mach/> scope
Documentation / ACPI: update to GPIO descriptor API
gpio / ACPI: get rid of acpi_gpio.h
gpio / ACPI: register to ACPI events automatically
mmc: sdhci-acpi: convert to use GPIO descriptor API
ARM: s3c24xx: fix build error
gpio: f7188x: set can_sleep attribute
gpio: samsung: Update documentation
gpio: samsung: Remove hardware.h inclusion
gpio: xtensa: depend on HAVE_XTENSA_GPIO32
gpio: clps711x: Enable driver compilation with COMPILE_TEST
gpio: clps711x: Use of_match_ptr()
net: rfkill: gpio: convert to descriptor-based GPIO interface
leds: s3c24xx: Fix build failure
...
Diffstat (limited to 'net')
-rw-r--r-- | net/rfkill/rfkill-gpio.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 5620d3c07479..bd2a5b90400c 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -25,15 +25,15 @@ #include <linux/clk.h> #include <linux/slab.h> #include <linux/acpi.h> -#include <linux/acpi_gpio.h> +#include <linux/gpio/consumer.h> #include <linux/rfkill-gpio.h> struct rfkill_gpio_data { const char *name; enum rfkill_type type; - int reset_gpio; - int shutdown_gpio; + struct gpio_desc *reset_gpio; + struct gpio_desc *shutdown_gpio; struct rfkill *rfkill_dev; char *reset_name; @@ -48,19 +48,15 @@ static int rfkill_gpio_set_power(void *data, bool blocked) struct rfkill_gpio_data *rfkill = data; if (blocked) { - if (gpio_is_valid(rfkill->shutdown_gpio)) - gpio_set_value(rfkill->shutdown_gpio, 0); - if (gpio_is_valid(rfkill->reset_gpio)) - gpio_set_value(rfkill->reset_gpio, 0); + gpiod_set_value(rfkill->shutdown_gpio, 0); + gpiod_set_value(rfkill->reset_gpio, 0); if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled) clk_disable(rfkill->clk); } else { if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled) clk_enable(rfkill->clk); - if (gpio_is_valid(rfkill->reset_gpio)) - gpio_set_value(rfkill->reset_gpio, 1); - if (gpio_is_valid(rfkill->shutdown_gpio)) - gpio_set_value(rfkill->shutdown_gpio, 1); + gpiod_set_value(rfkill->reset_gpio, 1); + gpiod_set_value(rfkill->shutdown_gpio, 1); } rfkill->clk_enabled = blocked; @@ -83,8 +79,6 @@ static int rfkill_gpio_acpi_probe(struct device *dev, rfkill->name = dev_name(dev); rfkill->type = (unsigned)id->driver_data; - rfkill->reset_gpio = acpi_get_gpio_by_index(dev, 0, NULL); - rfkill->shutdown_gpio = acpi_get_gpio_by_index(dev, 1, NULL); return 0; } @@ -94,8 +88,9 @@ static int rfkill_gpio_probe(struct platform_device *pdev) struct rfkill_gpio_platform_data *pdata = pdev->dev.platform_data; struct rfkill_gpio_data *rfkill; const char *clk_name = NULL; - int ret = 0; - int len = 0; + struct gpio_desc *gpio; + int ret; + int len; rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); if (!rfkill) @@ -109,28 +104,10 @@ static int rfkill_gpio_probe(struct platform_device *pdev) clk_name = pdata->power_clk_name; rfkill->name = pdata->name; rfkill->type = pdata->type; - rfkill->reset_gpio = pdata->reset_gpio; - rfkill->shutdown_gpio = pdata->shutdown_gpio; } else { return -ENODEV; } - /* make sure at-least one of the GPIO is defined and that - * a name is specified for this instance */ - if ((!gpio_is_valid(rfkill->reset_gpio) && - !gpio_is_valid(rfkill->shutdown_gpio)) || !rfkill->name) { - pr_warn("%s: invalid platform data\n", __func__); - return -EINVAL; - } - - if (pdata && pdata->gpio_runtime_setup) { - ret = pdata->gpio_runtime_setup(pdev); - if (ret) { - pr_warn("%s: can't set up gpio\n", __func__); - return ret; - } - } - len = strlen(rfkill->name); rfkill->reset_name = devm_kzalloc(&pdev->dev, len + 7, GFP_KERNEL); if (!rfkill->reset_name) @@ -145,20 +122,34 @@ static int rfkill_gpio_probe(struct platform_device *pdev) rfkill->clk = devm_clk_get(&pdev->dev, clk_name); - if (gpio_is_valid(rfkill->reset_gpio)) { - ret = devm_gpio_request_one(&pdev->dev, rfkill->reset_gpio, - 0, rfkill->reset_name); - if (ret) { - pr_warn("%s: failed to get reset gpio.\n", __func__); + gpio = devm_gpiod_get_index(&pdev->dev, rfkill->reset_name, 0); + if (!IS_ERR(gpio)) { + ret = gpiod_direction_output(gpio, 0); + if (ret) return ret; - } + rfkill->reset_gpio = gpio; + } + + gpio = devm_gpiod_get_index(&pdev->dev, rfkill->shutdown_name, 1); + if (!IS_ERR(gpio)) { + ret = gpiod_direction_output(gpio, 0); + if (ret) + return ret; + rfkill->shutdown_gpio = gpio; } - if (gpio_is_valid(rfkill->shutdown_gpio)) { - ret = devm_gpio_request_one(&pdev->dev, rfkill->shutdown_gpio, - 0, rfkill->shutdown_name); + /* Make sure at-least one of the GPIO is defined and that + * a name is specified for this instance + */ + if ((!rfkill->reset_gpio && !rfkill->shutdown_gpio) || !rfkill->name) { + dev_err(&pdev->dev, "invalid platform data\n"); + return -EINVAL; + } + + if (pdata && pdata->gpio_runtime_setup) { + ret = pdata->gpio_runtime_setup(pdev); if (ret) { - pr_warn("%s: failed to get shutdown gpio.\n", __func__); + dev_err(&pdev->dev, "can't set up gpio\n"); return ret; } } |