aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-lynxpoint.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 12:40:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 13:09:12 -0500
commit8e5096607280d4e103389bfe8f8b7decbf538ff6 (patch)
tree60352a466e96c7b36d41263d7590ee79e0aaff35 /drivers/gpio/gpio-lynxpoint.c
parent02d0a752460ea5dab34ce36c9ddc9c682e846a0d (diff)
parentde755c330512364d3396c7da0c20b1c20b3b08b2 (diff)
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 'drivers/gpio/gpio-lynxpoint.c')
-rw-r--r--drivers/gpio/gpio-lynxpoint.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
index a0804740a0b7..66b18535b5ae 100644
--- a/drivers/gpio/gpio-lynxpoint.c
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -301,6 +301,26 @@ static void lp_irq_disable(struct irq_data *d)
301 spin_unlock_irqrestore(&lg->lock, flags); 301 spin_unlock_irqrestore(&lg->lock, flags);
302} 302}
303 303
304static unsigned int lp_irq_startup(struct irq_data *d)
305{
306 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
307
308 if (gpio_lock_as_irq(&lg->chip, irqd_to_hwirq(d)))
309 dev_err(lg->chip.dev,
310 "unable to lock HW IRQ %lu for IRQ\n",
311 irqd_to_hwirq(d));
312 lp_irq_enable(d);
313 return 0;
314}
315
316static void lp_irq_shutdown(struct irq_data *d)
317{
318 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
319
320 lp_irq_disable(d);
321 gpio_unlock_as_irq(&lg->chip, irqd_to_hwirq(d));
322}
323
304static struct irq_chip lp_irqchip = { 324static struct irq_chip lp_irqchip = {
305 .name = "LP-GPIO", 325 .name = "LP-GPIO",
306 .irq_mask = lp_irq_mask, 326 .irq_mask = lp_irq_mask,
@@ -308,6 +328,8 @@ static struct irq_chip lp_irqchip = {
308 .irq_enable = lp_irq_enable, 328 .irq_enable = lp_irq_enable,
309 .irq_disable = lp_irq_disable, 329 .irq_disable = lp_irq_disable,
310 .irq_set_type = lp_irq_type, 330 .irq_set_type = lp_irq_type,
331 .irq_startup = lp_irq_startup,
332 .irq_shutdown = lp_irq_shutdown,
311 .flags = IRQCHIP_SKIP_SET_WAKE, 333 .flags = IRQCHIP_SKIP_SET_WAKE,
312}; 334};
313 335
@@ -331,8 +353,7 @@ static int lp_gpio_irq_map(struct irq_domain *d, unsigned int irq,
331{ 353{
332 struct lp_gpio *lg = d->host_data; 354 struct lp_gpio *lg = d->host_data;
333 355
334 irq_set_chip_and_handler_name(irq, &lp_irqchip, handle_simple_irq, 356 irq_set_chip_and_handler(irq, &lp_irqchip, handle_simple_irq);
335 "demux");
336 irq_set_chip_data(irq, lg); 357 irq_set_chip_data(irq, lg);
337 irq_set_irq_type(irq, IRQ_TYPE_NONE); 358 irq_set_irq_type(irq, IRQ_TYPE_NONE);
338 359
@@ -392,7 +413,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
392 gc->set = lp_gpio_set; 413 gc->set = lp_gpio_set;
393 gc->base = -1; 414 gc->base = -1;
394 gc->ngpio = LP_NUM_GPIO; 415 gc->ngpio = LP_NUM_GPIO;
395 gc->can_sleep = 0; 416 gc->can_sleep = false;
396 gc->dev = dev; 417 gc->dev = dev;
397 418
398 /* set up interrupts */ 419 /* set up interrupts */
@@ -438,6 +459,7 @@ static const struct dev_pm_ops lp_gpio_pm_ops = {
438 459
439static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = { 460static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
440 { "INT33C7", 0 }, 461 { "INT33C7", 0 },
462 { "INT3437", 0 },
441 { } 463 { }
442}; 464};
443MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match); 465MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match);
@@ -469,4 +491,15 @@ static int __init lp_gpio_init(void)
469 return platform_driver_register(&lp_gpio_driver); 491 return platform_driver_register(&lp_gpio_driver);
470} 492}
471 493
494static void __exit lp_gpio_exit(void)
495{
496 platform_driver_unregister(&lp_gpio_driver);
497}
498
472subsys_initcall(lp_gpio_init); 499subsys_initcall(lp_gpio_init);
500module_exit(lp_gpio_exit);
501
502MODULE_AUTHOR("Mathias Nyman (Intel)");
503MODULE_DESCRIPTION("GPIO interface for Intel Lynxpoint");
504MODULE_LICENSE("GPL");
505MODULE_ALIAS("platform:lp_gpio");