diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-09-24 17:36:23 -0400 |
---|---|---|
committer | Samuel Ortiz <samuel@sortiz.org> | 2008-10-19 16:54:09 -0400 |
commit | 1c1b6ffce5737d764cc474b9bd6677bb9a344094 (patch) | |
tree | b637110fe6282769104b72d08b3864ed1538bf96 /drivers/mfd | |
parent | 80e74a805f0a6662b9b8de519439afd06ac35427 (diff) |
mfd: provide and use setup hook for tc6393xb
Instead of using bitfields for initial gpio setup,
provide generic setup/teardown hooks that can be used
to set the gpio states, register child devices, etc.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/tc6393xb.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index e4c1c788b5f8..83dc703f3767 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -460,13 +460,6 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
460 | 460 | ||
461 | tc6393xb->suspend_state.fer = 0; | 461 | tc6393xb->suspend_state.fer = 0; |
462 | 462 | ||
463 | for (i = 0; i < 3; i++) { | ||
464 | tc6393xb->suspend_state.gpo_dsr[i] = | ||
465 | (tcpd->scr_gpo_dsr >> (8 * i)) & 0xff; | ||
466 | tc6393xb->suspend_state.gpo_doecr[i] = | ||
467 | (tcpd->scr_gpo_doecr >> (8 * i)) & 0xff; | ||
468 | } | ||
469 | |||
470 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | | 463 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | |
471 | SCR_CCR_HCLK_48; | 464 | SCR_CCR_HCLK_48; |
472 | 465 | ||
@@ -488,6 +481,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
488 | 481 | ||
489 | tc6393xb_attach_irq(dev); | 482 | tc6393xb_attach_irq(dev); |
490 | 483 | ||
484 | if (tcpd->setup) { | ||
485 | ret = tcpd->setup(dev); | ||
486 | if (ret) | ||
487 | goto err_setup; | ||
488 | } | ||
489 | |||
491 | tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; | 490 | tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; |
492 | tc6393xb_cells[TC6393XB_CELL_NAND].platform_data = | 491 | tc6393xb_cells[TC6393XB_CELL_NAND].platform_data = |
493 | &tc6393xb_cells[TC6393XB_CELL_NAND]; | 492 | &tc6393xb_cells[TC6393XB_CELL_NAND]; |
@@ -506,6 +505,10 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
506 | if (!ret) | 505 | if (!ret) |
507 | return 0; | 506 | return 0; |
508 | 507 | ||
508 | if (tcpd->teardown) | ||
509 | tcpd->teardown(dev); | ||
510 | |||
511 | err_setup: | ||
509 | tc6393xb_detach_irq(dev); | 512 | tc6393xb_detach_irq(dev); |
510 | 513 | ||
511 | err_gpio_add: | 514 | err_gpio_add: |
@@ -535,6 +538,10 @@ static int __devexit tc6393xb_remove(struct platform_device *dev) | |||
535 | int ret; | 538 | int ret; |
536 | 539 | ||
537 | mfd_remove_devices(&dev->dev); | 540 | mfd_remove_devices(&dev->dev); |
541 | |||
542 | if (tcpd->teardown) | ||
543 | tcpd->teardown(dev); | ||
544 | |||
538 | tc6393xb_detach_irq(dev); | 545 | tc6393xb_detach_irq(dev); |
539 | 546 | ||
540 | if (tc6393xb->gpio.base != -1) { | 547 | if (tc6393xb->gpio.base != -1) { |