aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ucb1x00-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/ucb1x00-core.c')
-rw-r--r--drivers/mfd/ucb1x00-core.c48
1 files changed, 11 insertions, 37 deletions
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 91c4f25e0e55..b281217334eb 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -36,15 +36,6 @@ static DEFINE_MUTEX(ucb1x00_mutex);
36static LIST_HEAD(ucb1x00_drivers); 36static LIST_HEAD(ucb1x00_drivers);
37static LIST_HEAD(ucb1x00_devices); 37static LIST_HEAD(ucb1x00_devices);
38 38
39static struct mcp_device_id ucb1x00_id[] = {
40 { "ucb1x00", 0 }, /* auto-detection */
41 { "ucb1200", UCB_ID_1200 },
42 { "ucb1300", UCB_ID_1300 },
43 { "tc35143", UCB_ID_TC35143 },
44 { }
45};
46MODULE_DEVICE_TABLE(mcp, ucb1x00_id);
47
48/** 39/**
49 * ucb1x00_io_set_dir - set IO direction 40 * ucb1x00_io_set_dir - set IO direction
50 * @ucb: UCB1x00 structure describing chip 41 * @ucb: UCB1x00 structure describing chip
@@ -536,33 +527,17 @@ static struct class ucb1x00_class = {
536 527
537static int ucb1x00_probe(struct mcp *mcp) 528static int ucb1x00_probe(struct mcp *mcp)
538{ 529{
539 const struct mcp_device_id *mid;
540 struct ucb1x00 *ucb; 530 struct ucb1x00 *ucb;
541 struct ucb1x00_driver *drv; 531 struct ucb1x00_driver *drv;
542 struct ucb1x00_plat_data *pdata;
543 unsigned int id; 532 unsigned int id;
544 int ret = -ENODEV; 533 int ret = -ENODEV;
545 int temp; 534 int temp;
546 535
547 mcp_enable(mcp); 536 mcp_enable(mcp);
548 id = mcp_reg_read(mcp, UCB_ID); 537 id = mcp_reg_read(mcp, UCB_ID);
549 mid = mcp_get_device_id(mcp);
550 538
551 if (mid && mid->driver_data) { 539 if (id != UCB_ID_1200 && id != UCB_ID_1300 && id != UCB_ID_TC35143) {
552 if (id != mid->driver_data) { 540 printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id);
553 printk(KERN_WARNING "%s wrong ID %04x found: %04x\n",
554 mid->name, (unsigned int) mid->driver_data, id);
555 goto err_disable;
556 }
557 } else {
558 mid = &ucb1x00_id[1];
559 while (mid->driver_data) {
560 if (id == mid->driver_data)
561 break;
562 mid++;
563 }
564 printk(KERN_WARNING "%s ID not found: %04x\n",
565 ucb1x00_id[0].name, id);
566 goto err_disable; 541 goto err_disable;
567 } 542 }
568 543
@@ -571,28 +546,28 @@ static int ucb1x00_probe(struct mcp *mcp)
571 if (!ucb) 546 if (!ucb)
572 goto err_disable; 547 goto err_disable;
573 548
574 pdata = mcp->attached_device.platform_data; 549
575 ucb->dev.class = &ucb1x00_class; 550 ucb->dev.class = &ucb1x00_class;
576 ucb->dev.parent = &mcp->attached_device; 551 ucb->dev.parent = &mcp->attached_device;
577 dev_set_name(&ucb->dev, mid->name); 552 dev_set_name(&ucb->dev, "ucb1x00");
578 553
579 spin_lock_init(&ucb->lock); 554 spin_lock_init(&ucb->lock);
580 spin_lock_init(&ucb->io_lock); 555 spin_lock_init(&ucb->io_lock);
581 sema_init(&ucb->adc_sem, 1); 556 sema_init(&ucb->adc_sem, 1);
582 557
583 ucb->id = mid; 558 ucb->id = id;
584 ucb->mcp = mcp; 559 ucb->mcp = mcp;
585 ucb->irq = ucb1x00_detect_irq(ucb); 560 ucb->irq = ucb1x00_detect_irq(ucb);
586 if (ucb->irq == NO_IRQ) { 561 if (ucb->irq == NO_IRQ) {
587 printk(KERN_ERR "%s: IRQ probe failed\n", mid->name); 562 printk(KERN_ERR "UCB1x00: IRQ probe failed\n");
588 ret = -ENODEV; 563 ret = -ENODEV;
589 goto err_free; 564 goto err_free;
590 } 565 }
591 566
592 ucb->gpio.base = -1; 567 ucb->gpio.base = -1;
593 if (pdata && (pdata->gpio_base >= 0)) { 568 if (mcp->gpio_base != 0) {
594 ucb->gpio.label = dev_name(&ucb->dev); 569 ucb->gpio.label = dev_name(&ucb->dev);
595 ucb->gpio.base = pdata->gpio_base; 570 ucb->gpio.base = mcp->gpio_base;
596 ucb->gpio.ngpio = 10; 571 ucb->gpio.ngpio = 10;
597 ucb->gpio.set = ucb1x00_gpio_set; 572 ucb->gpio.set = ucb1x00_gpio_set;
598 ucb->gpio.get = ucb1x00_gpio_get; 573 ucb->gpio.get = ucb1x00_gpio_get;
@@ -605,10 +580,10 @@ static int ucb1x00_probe(struct mcp *mcp)
605 dev_info(&ucb->dev, "gpio_base not set so no gpiolib support"); 580 dev_info(&ucb->dev, "gpio_base not set so no gpiolib support");
606 581
607 ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING, 582 ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING,
608 mid->name, ucb); 583 "UCB1x00", ucb);
609 if (ret) { 584 if (ret) {
610 printk(KERN_ERR "%s: unable to grab irq%d: %d\n", 585 printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n",
611 mid->name, ucb->irq, ret); 586 ucb->irq, ret);
612 goto err_gpio; 587 goto err_gpio;
613 } 588 }
614 589
@@ -730,7 +705,6 @@ static struct mcp_driver ucb1x00_driver = {
730 .remove = ucb1x00_remove, 705 .remove = ucb1x00_remove,
731 .suspend = ucb1x00_suspend, 706 .suspend = ucb1x00_suspend,
732 .resume = ucb1x00_resume, 707 .resume = ucb1x00_resume,
733 .id_table = ucb1x00_id,
734}; 708};
735 709
736static int __init ucb1x00_init(void) 710static int __init ucb1x00_init(void)