aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-20 12:38:58 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-01-20 12:38:58 -0500
commit65f2e753f1eb09d3a7e2a0d16408a5433b4097b2 (patch)
tree100066fa2d26930a490ee10bb191957f3b3e2df3 /drivers
parent216f63c41cac9f9f8f181fc19be399293c8c934e (diff)
Revert "ARM: sa11x0: Implement autoloading of codec and codec pdata for mcp bus."
This reverts commit 5dd7bf59e0e8563265b3e5b33276099ef628fcc7. Conflicts: scripts/mod/file2alias.c This change is wrong on many levels. First and foremost, it causes a regression. On boot on Assabet, which this patch gives a codec id of 'ucb1x00', it gives: ucb1x00 ID not found: 1005 0x1005 is a valid ID for the UCB1300 device. Secondly, this patch is way over the top in terms of complexity. The only device which has been seen to be connected with this MCP code is the UCB1x00 (UCB1200, UCB1300 etc) devices, and they all use the same driver. Adding a match table, requiring the codec string to match the hardware ID read out of the ID register, etc is completely over the top when we can just read the hardware ID register.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/mcp-core.c44
-rw-r--r--drivers/mfd/mcp-sa11x0.c7
-rw-r--r--drivers/mfd/ucb1x00-core.c48
-rw-r--r--drivers/mfd/ucb1x00-ts.c2
4 files changed, 16 insertions, 85 deletions
diff --git a/drivers/mfd/mcp-core.c b/drivers/mfd/mcp-core.c
index 63be60bc3455..84815f9ef636 100644
--- a/drivers/mfd/mcp-core.c
+++ b/drivers/mfd/mcp-core.c
@@ -26,35 +26,9 @@
26#define to_mcp(d) container_of(d, struct mcp, attached_device) 26#define to_mcp(d) container_of(d, struct mcp, attached_device)
27#define to_mcp_driver(d) container_of(d, struct mcp_driver, drv) 27#define to_mcp_driver(d) container_of(d, struct mcp_driver, drv)
28 28
29static const struct mcp_device_id *mcp_match_id(const struct mcp_device_id *id,
30 const char *codec)
31{
32 while (id->name[0]) {
33 if (strcmp(codec, id->name) == 0)
34 return id;
35 id++;
36 }
37 return NULL;
38}
39
40const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp)
41{
42 const struct mcp_driver *driver =
43 to_mcp_driver(mcp->attached_device.driver);
44
45 return mcp_match_id(driver->id_table, mcp->codec);
46}
47EXPORT_SYMBOL(mcp_get_device_id);
48
49static int mcp_bus_match(struct device *dev, struct device_driver *drv) 29static int mcp_bus_match(struct device *dev, struct device_driver *drv)
50{ 30{
51 const struct mcp *mcp = to_mcp(dev); 31 return 1;
52 const struct mcp_driver *driver = to_mcp_driver(drv);
53
54 if (driver->id_table)
55 return !!mcp_match_id(driver->id_table, mcp->codec);
56
57 return 0;
58} 32}
59 33
60static int mcp_bus_probe(struct device *dev) 34static int mcp_bus_probe(struct device *dev)
@@ -100,18 +74,9 @@ static int mcp_bus_resume(struct device *dev)
100 return ret; 74 return ret;
101} 75}
102 76
103static int mcp_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
104{
105 struct mcp *mcp = to_mcp(dev);
106
107 add_uevent_var(env, "MODALIAS=%s%s", MCP_MODULE_PREFIX, mcp->codec);
108 return 0;
109}
110
111static struct bus_type mcp_bus_type = { 77static struct bus_type mcp_bus_type = {
112 .name = "mcp", 78 .name = "mcp",
113 .match = mcp_bus_match, 79 .match = mcp_bus_match,
114 .uevent = mcp_bus_uevent,
115 .probe = mcp_bus_probe, 80 .probe = mcp_bus_probe,
116 .remove = mcp_bus_remove, 81 .remove = mcp_bus_remove,
117 .suspend = mcp_bus_suspend, 82 .suspend = mcp_bus_suspend,
@@ -247,14 +212,9 @@ struct mcp *mcp_host_alloc(struct device *parent, size_t size)
247} 212}
248EXPORT_SYMBOL(mcp_host_alloc); 213EXPORT_SYMBOL(mcp_host_alloc);
249 214
250int mcp_host_register(struct mcp *mcp, void *pdata) 215int mcp_host_register(struct mcp *mcp)
251{ 216{
252 if (!mcp->codec)
253 return -EINVAL;
254
255 mcp->attached_device.platform_data = pdata;
256 dev_set_name(&mcp->attached_device, "mcp0"); 217 dev_set_name(&mcp->attached_device, "mcp0");
257 request_module("%s%s", MCP_MODULE_PREFIX, mcp->codec);
258 return device_register(&mcp->attached_device); 218 return device_register(&mcp->attached_device);
259} 219}
260EXPORT_SYMBOL(mcp_host_register); 220EXPORT_SYMBOL(mcp_host_register);
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c
index da4e077a1bee..02c53a0766c4 100644
--- a/drivers/mfd/mcp-sa11x0.c
+++ b/drivers/mfd/mcp-sa11x0.c
@@ -146,9 +146,6 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
146 if (!data) 146 if (!data)
147 return -ENODEV; 147 return -ENODEV;
148 148
149 if (!data->codec)
150 return -ENODEV;
151
152 if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp")) 149 if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp"))
153 return -EBUSY; 150 return -EBUSY;
154 151
@@ -165,7 +162,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
165 mcp->dma_audio_wr = DMA_Ser4MCP0Wr; 162 mcp->dma_audio_wr = DMA_Ser4MCP0Wr;
166 mcp->dma_telco_rd = DMA_Ser4MCP1Rd; 163 mcp->dma_telco_rd = DMA_Ser4MCP1Rd;
167 mcp->dma_telco_wr = DMA_Ser4MCP1Wr; 164 mcp->dma_telco_wr = DMA_Ser4MCP1Wr;
168 mcp->codec = data->codec; 165 mcp->gpio_base = data->gpio_base;
169 166
170 platform_set_drvdata(pdev, mcp); 167 platform_set_drvdata(pdev, mcp);
171 168
@@ -198,7 +195,7 @@ static int mcp_sa11x0_probe(struct platform_device *pdev)
198 mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) / 195 mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) /
199 mcp->sclk_rate; 196 mcp->sclk_rate;
200 197
201 ret = mcp_host_register(mcp, data->codec_pdata); 198 ret = mcp_host_register(mcp);
202 if (ret == 0) 199 if (ret == 0)
203 goto out; 200 goto out;
204 201
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)
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index 40ec3c118868..38ffbd50a0d2 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -382,7 +382,7 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
382 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 382 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
383 383
384 idev->name = "Touchscreen panel"; 384 idev->name = "Touchscreen panel";
385 idev->id.product = ts->ucb->id->driver_data; 385 idev->id.product = ts->ucb->id;
386 idev->open = ucb1x00_ts_open; 386 idev->open = ucb1x00_ts_open;
387 idev->close = ucb1x00_ts_close; 387 idev->close = ucb1x00_ts_close;
388 388