diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 21:05:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 21:05:32 -0700 |
commit | 1a46712aa99594eabe1e9aeedf115dfff0db1dfd (patch) | |
tree | 61240865e6b55e2f2b2c174b333c2a097bd4f31e /drivers/gpio/gpio-omap.c | |
parent | 82b666eee71618b7ca812ee529af116582617dec (diff) | |
parent | ccbd805aa934dd1b863ef115a9c55f119b2388cf (diff) | |
download | kernel_replicant_linux-1a46712aa99594eabe1e9aeedf115dfff0db1dfd.tar.gz kernel_replicant_linux-1a46712aa99594eabe1e9aeedf115dfff0db1dfd.tar.bz2 kernel_replicant_linux-1a46712aa99594eabe1e9aeedf115dfff0db1dfd.zip |
Merge tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij:
"This is the bulk of GPIO changes for kernel v4.6. There is quite a
lot of interesting stuff going on.
The patches to other subsystems and arch-wide are ACKed as far as
possible, though I consider things like per-arch <asm/gpio.h> as
essentially a part of the GPIO subsystem so it should not be needed.
Core changes:
- The gpio_chip is now a *real device*. Until now the gpio chips
were just piggybacking the parent device or (gasp) floating in
space outside of the device model.
We now finally make GPIO chips devices. The gpio_chip will create
a gpio_device which contains a struct device, and this gpio_device
struct is kept private. Anything that needs to be kept private
from the rest of the kernel will gradually be moved over to the
gpio_device.
- As a result of making the gpio_device a real device, we have added
resource management, so devm_gpiochip_add_data() will cut down on
overhead and reduce code lines. A huge slew of patches convert
almost all drivers in the subsystem to use this.
- Building on making the GPIO a real device, we add the first step of
a new userspace ABI: the GPIO character device. We take small
steps here, so we first add a pure *information* ABI and the tool
"lsgpio" that will list all GPIO devices on the system and all
lines on these devices.
We can now discover GPIOs properly from userspace. We still have
not come up with a way to actually *use* GPIOs from userspace.
- To encourage people to use the character device for the future, we
have it always-enabled when using GPIO. The old sysfs ABI is still
opt-in (and can be used in parallel), but is marked as deprecated.
We will keep it around for the foreseeable future, but it will not
be extended to cover ever more use cases.
Cleanup:
- Bjorn Helgaas removed a whole slew of per-architecture <asm/gpio.h>
includes.
This dates back to when GPIO was an opt-in feature and no shared
library even existed: just a header file with proper prototypes was
provided and all semantics were up to the arch to implement. These
patches make the GPIO chip even more a proper device and cleans out
leftovers of the old in-kernel API here and there.
Still some cruft is left but it's very little now.
- There is still some clamping of return values for .get() going on,
but we now return sane values in the vast majority of drivers and
the errorpath is sanitized. Some patches for powerpc, blackfin and
unicore still drop in.
- We continue to switch the ARM, MIPS, blackfin, m68k local GPIO
implementations to use gpiochip_add_data() and cut down on code
lines.
- MPC8xxx is converted to use the generic GPIO helpers.
- ATH79 is converted to use the generic GPIO helpers.
New drivers:
- WinSystems WS16C48
- Acces 104-DIO-48E
- F81866 (a F7188x variant)
- Qoric (a MPC8xxx variant)
- TS-4800
- SPI serializers (pisosr): simple 74xx shift registers connected to
SPI to obtain a dirt-cheap output-only GPIO expander.
- Texas Instruments TPIC2810
- Texas Instruments TPS65218
- Texas Instruments TPS65912
- X-Gene (ARM64) standby GPIO controller"
* tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (194 commits)
Revert "Share upstreaming patches"
gpio: mcp23s08: Fix clearing of interrupt.
gpiolib: Fix comment referring to gpio_*() in gpiod_*()
gpio: pca953x: Fix pca953x_gpio_set_multiple() on 64-bit
gpio: xgene: Fix kconfig for standby GIPO contoller
gpio: Add generic serializer DT binding
gpio: uapi: use 0xB4 as ioctl() major
gpio: tps65912: fix bad merge
Revert "gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free"
gpio: omap: drop dev field from gpio_bank structure
gpio: mpc8xxx: Slightly update the code for better readability
gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip
gpio: mpc8xxx: Fixup setting gpio direction output
gpio: mcp23s08: Add support for mcp23s18
dt-bindings: gpio: altera: Fix altr,interrupt-type property
gpio: add driver for MEN 16Z127 GPIO controller
gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free
gpio: timberdale: Switch to devm_ioremap_resource()
gpio: ts4800: Add IMX51 dependency
gpiolib: rewrite gpiodev_add_to_list
...
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 189f672bebc1..551dfa9d97ab 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -66,7 +66,6 @@ struct gpio_bank { u32 irq_usage; u32 dbck_enable_mask; bool dbck_enabled; - struct device *dev; bool is_mpuio; bool dbck_flag; bool loses_context; @@ -627,7 +626,7 @@ static int omap_set_gpio_wakeup(struct gpio_bank *bank, unsigned offset, unsigned long flags; if (bank->non_wakeup_gpios & gpio_bit) { - dev_err(bank->dev, + dev_err(bank->chip.parent, "Unable to modify wakeup on non-wakeup GPIO%d\n", offset); return -EINVAL; @@ -669,7 +668,7 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) * enable the bank module. */ if (!BANK_USED(bank)) - pm_runtime_get_sync(bank->dev); + pm_runtime_get_sync(chip->parent); raw_spin_lock_irqsave(&bank->lock, flags); omap_enable_gpio_module(bank, offset); @@ -698,7 +697,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) * disable the bank module. */ if (!BANK_USED(bank)) - pm_runtime_put(bank->dev); + pm_runtime_put(chip->parent); } /* @@ -723,7 +722,7 @@ static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) if (WARN_ON(!isr_reg)) goto exit; - pm_runtime_get_sync(bank->dev); + pm_runtime_get_sync(bank->chip.parent); while (1) { u32 isr_saved, level_mask = 0; @@ -776,7 +775,7 @@ static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) } } exit: - pm_runtime_put(bank->dev); + pm_runtime_put(bank->chip.parent); return IRQ_HANDLED; } @@ -826,7 +825,7 @@ static void omap_gpio_irq_bus_lock(struct irq_data *data) struct gpio_bank *bank = omap_irq_data_get_bank(data); if (!BANK_USED(bank)) - pm_runtime_get_sync(bank->dev); + pm_runtime_get_sync(bank->chip.parent); } static void gpio_irq_bus_sync_unlock(struct irq_data *data) @@ -838,7 +837,7 @@ static void gpio_irq_bus_sync_unlock(struct irq_data *data) * disable the bank module. */ if (!BANK_USED(bank)) - pm_runtime_put(bank->dev); + pm_runtime_put(bank->chip.parent); } static void omap_gpio_ack_irq(struct irq_data *d) @@ -1100,7 +1099,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) ret = gpiochip_add_data(&bank->chip, bank); if (ret) { - dev_err(bank->dev, "Could not register gpio chip %d\n", ret); + dev_err(bank->chip.parent, + "Could not register gpio chip %d\n", ret); return ret; } @@ -1114,7 +1114,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) */ irq_base = irq_alloc_descs(-1, 0, bank->width, 0); if (irq_base < 0) { - dev_err(bank->dev, "Couldn't allocate IRQ numbers\n"); + dev_err(bank->chip.parent, "Couldn't allocate IRQ numbers\n"); return -ENODEV; } #endif @@ -1131,15 +1131,17 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) IRQ_TYPE_NONE); if (ret) { - dev_err(bank->dev, "Couldn't add irqchip to gpiochip %d\n", ret); + dev_err(bank->chip.parent, + "Couldn't add irqchip to gpiochip %d\n", ret); gpiochip_remove(&bank->chip); return -ENODEV; } gpiochip_set_chained_irqchip(&bank->chip, irqc, bank->irq, NULL); - ret = devm_request_irq(bank->dev, bank->irq, omap_gpio_irq_handler, - 0, dev_name(bank->dev), bank); + ret = devm_request_irq(bank->chip.parent, bank->irq, + omap_gpio_irq_handler, + 0, dev_name(bank->chip.parent), bank); if (ret) gpiochip_remove(&bank->chip); @@ -1196,7 +1198,6 @@ static int omap_gpio_probe(struct platform_device *pdev) return bank->irq; } - bank->dev = dev; bank->chip.parent = dev; bank->chip.owner = THIS_MODULE; bank->dbck_flag = pdata->dbck_flag; @@ -1235,9 +1236,9 @@ static int omap_gpio_probe(struct platform_device *pdev) } if (bank->dbck_flag) { - bank->dbck = devm_clk_get(bank->dev, "dbclk"); + bank->dbck = devm_clk_get(dev, "dbclk"); if (IS_ERR(bank->dbck)) { - dev_err(bank->dev, + dev_err(dev, "Could not get gpio dbck. Disable debounce\n"); bank->dbck_flag = false; } else { @@ -1247,9 +1248,9 @@ static int omap_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bank); - pm_runtime_enable(bank->dev); - pm_runtime_irq_safe(bank->dev); - pm_runtime_get_sync(bank->dev); + pm_runtime_enable(dev); + pm_runtime_irq_safe(dev); + pm_runtime_get_sync(dev); if (bank->is_mpuio) omap_mpuio_init(bank); @@ -1258,14 +1259,14 @@ static int omap_gpio_probe(struct platform_device *pdev) ret = omap_gpio_chip_init(bank, irqc); if (ret) { - pm_runtime_put_sync(bank->dev); - pm_runtime_disable(bank->dev); + pm_runtime_put_sync(dev); + pm_runtime_disable(dev); return ret; } omap_gpio_show_rev(bank); - pm_runtime_put(bank->dev); + pm_runtime_put(dev); list_add_tail(&bank->node, &omap_gpio_list); @@ -1278,7 +1279,7 @@ static int omap_gpio_remove(struct platform_device *pdev) list_del(&bank->node); gpiochip_remove(&bank->chip); - pm_runtime_disable(bank->dev); + pm_runtime_disable(&pdev->dev); if (bank->dbck_flag) clk_unprepare(bank->dbck); @@ -1348,7 +1349,7 @@ static int omap_gpio_runtime_suspend(struct device *dev) update_gpio_context_count: if (bank->get_context_loss_count) bank->context_loss_count = - bank->get_context_loss_count(bank->dev); + bank->get_context_loss_count(dev); omap_gpio_dbck_disable(bank); raw_spin_unlock_irqrestore(&bank->lock, flags); @@ -1378,7 +1379,7 @@ static int omap_gpio_runtime_resume(struct device *dev) if (bank->get_context_loss_count) bank->context_loss_count = - bank->get_context_loss_count(bank->dev); + bank->get_context_loss_count(dev); } omap_gpio_dbck_enable(bank); @@ -1398,7 +1399,7 @@ static int omap_gpio_runtime_resume(struct device *dev) if (!bank->get_context_loss_count) { omap_gpio_restore_context(bank); } else { - c = bank->get_context_loss_count(bank->dev); + c = bank->get_context_loss_count(dev); if (c != bank->context_loss_count) { omap_gpio_restore_context(bank); } else { @@ -1481,7 +1482,7 @@ void omap2_gpio_prepare_for_idle(int pwr_mode) bank->power_mode = pwr_mode; - pm_runtime_put_sync_suspend(bank->dev); + pm_runtime_put_sync_suspend(bank->chip.parent); } } @@ -1493,7 +1494,7 @@ void omap2_gpio_resume_after_idle(void) if (!BANK_USED(bank) || !bank->loses_context) continue; - pm_runtime_get_sync(bank->dev); + pm_runtime_get_sync(bank->chip.parent); } } #endif |