aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-twl4030.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-09-16 18:35:06 -0400
committerTony Lindgren <tony@atomide.com>2012-09-16 18:35:06 -0400
commit6bfc82ff589a00e5fbc12b958c649d703d273c86 (patch)
tree9326c7213d5ccee556bff1831e8f88681a27e57c /drivers/gpio/gpio-twl4030.c
parent26638c667e645de368cd68cade716ed0faef6269 (diff)
parent68cb700c59fae6cd539c9dc1e9f2584f671935a0 (diff)
Merge tag 'omap-cleanup-sparseirq-for-v3.7' into devel-dt
This branch contains changes needed to make omap2+ work properly with sparse IRQ. It also removes dependencies to mach/hardware.h. These help moving things towards ARM single zImage support. This branch is based on a commit in tty-next branch with omap-devel-gpmc-fixed-for-v3.7 and cleanup-omap-tags-for-v3.7 merged in to keep things compiling and sort out some merge conflicts. Conflicts: arch/arm/mach-omap2/omap4-common.c drivers/gpio/gpio-twl4030.c
Diffstat (limited to 'drivers/gpio/gpio-twl4030.c')
-rw-r--r--drivers/gpio/gpio-twl4030.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index f923252da839..c5f8ca233e1f 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -51,6 +51,7 @@
51 51
52 52
53static struct gpio_chip twl_gpiochip; 53static struct gpio_chip twl_gpiochip;
54static int twl4030_gpio_base;
54static int twl4030_gpio_irq_base; 55static int twl4030_gpio_irq_base;
55 56
56/* genirq interfaces are not available to modules */ 57/* genirq interfaces are not available to modules */
@@ -403,8 +404,6 @@ static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
403 if (!omap_twl_info) 404 if (!omap_twl_info)
404 return NULL; 405 return NULL;
405 406
406 omap_twl_info->gpio_base = -1;
407
408 omap_twl_info->use_leds = of_property_read_bool(dev->of_node, 407 omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
409 "ti,use-leds"); 408 "ti,use-leds");
410 409
@@ -448,6 +447,7 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
448 twl4030_gpio_irq_base = irq_base; 447 twl4030_gpio_irq_base = irq_base;
449 448
450no_irqs: 449no_irqs:
450 twl_gpiochip.base = -1;
451 twl_gpiochip.ngpio = TWL4030_GPIO_MAX; 451 twl_gpiochip.ngpio = TWL4030_GPIO_MAX;
452 twl_gpiochip.dev = &pdev->dev; 452 twl_gpiochip.dev = &pdev->dev;
453 453
@@ -459,8 +459,6 @@ no_irqs:
459 return -ENXIO; 459 return -ENXIO;
460 } 460 }
461 461
462 twl_gpiochip.base = pdata->gpio_base;
463
464 /* 462 /*
465 * NOTE: boards may waste power if they don't set pullups 463 * NOTE: boards may waste power if they don't set pullups
466 * and pulldowns correctly ... default for non-ULPI pins is 464 * and pulldowns correctly ... default for non-ULPI pins is
@@ -489,15 +487,21 @@ no_irqs:
489 dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret); 487 dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
490 twl_gpiochip.ngpio = 0; 488 twl_gpiochip.ngpio = 0;
491 gpio_twl4030_remove(pdev); 489 gpio_twl4030_remove(pdev);
492 } else if (pdata && pdata->setup) { 490 goto out;
491 }
492
493 twl4030_gpio_base = twl_gpiochip.base;
494
495 if (pdata && pdata->setup) {
493 int status; 496 int status;
494 497
495 status = pdata->setup(&pdev->dev, 498 status = pdata->setup(&pdev->dev,
496 pdata->gpio_base, TWL4030_GPIO_MAX); 499 twl4030_gpio_base, TWL4030_GPIO_MAX);
497 if (status) 500 if (status)
498 dev_dbg(&pdev->dev, "setup --> %d\n", status); 501 dev_dbg(&pdev->dev, "setup --> %d\n", status);
499 } 502 }
500 503
504out:
501 return ret; 505 return ret;
502} 506}
503 507
@@ -509,7 +513,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
509 513
510 if (pdata && pdata->teardown) { 514 if (pdata && pdata->teardown) {
511 status = pdata->teardown(&pdev->dev, 515 status = pdata->teardown(&pdev->dev,
512 pdata->gpio_base, TWL4030_GPIO_MAX); 516 twl4030_gpio_base, TWL4030_GPIO_MAX);
513 if (status) { 517 if (status) {
514 dev_dbg(&pdev->dev, "teardown --> %d\n", status); 518 dev_dbg(&pdev->dev, "teardown --> %d\n", status);
515 return status; 519 return status;