Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

+21 -135
-1
arch/arm/mach-sa1100/assabet.c
··· 202 202 static struct mcp_plat_data assabet_mcp_data = { 203 203 .mccr0 = MCCR0_ADM, 204 204 .sclk_rate = 11981000, 205 - .codec = "ucb1x00", 206 205 }; 207 206 208 207 static void __init assabet_init(void)
-1
arch/arm/mach-sa1100/cerf.c
··· 124 124 static struct mcp_plat_data cerf_mcp_data = { 125 125 .mccr0 = MCCR0_ADM, 126 126 .sclk_rate = 11981000, 127 - .codec = "ucb1x00", 128 127 }; 129 128 130 129 static void __init cerf_init(void)
+1 -7
arch/arm/mach-sa1100/collie.c
··· 27 27 #include <linux/timer.h> 28 28 #include <linux/gpio.h> 29 29 #include <linux/pda_power.h> 30 - #include <linux/mfd/ucb1x00.h> 31 30 32 31 #include <mach/hardware.h> 33 32 #include <asm/mach-types.h> ··· 85 86 .num_devs = 1, 86 87 }; 87 88 88 - static struct ucb1x00_plat_data collie_ucb1x00_data = { 89 - .gpio_base = COLLIE_TC35143_GPIO_BASE, 90 - }; 91 - 92 89 static struct mcp_plat_data collie_mcp_data = { 93 90 .mccr0 = MCCR0_ADM | MCCR0_ExtClk, 94 91 .sclk_rate = 9216000, 95 - .codec = "ucb1x00", 96 - .codec_pdata = &collie_ucb1x00_data, 92 + .gpio_base = COLLIE_TC35143_GPIO_BASE, 97 93 }; 98 94 99 95 /*
-2
arch/arm/mach-sa1100/include/mach/mcp.h
··· 17 17 u32 mccr1; 18 18 unsigned int sclk_rate; 19 19 int gpio_base; 20 - const char *codec; 21 - void *codec_pdata; 22 20 }; 23 21 24 22 #endif
-1
arch/arm/mach-sa1100/lart.c
··· 24 24 static struct mcp_plat_data lart_mcp_data = { 25 25 .mccr0 = MCCR0_ADM, 26 26 .sclk_rate = 11981000, 27 - .codec = "ucb1x00", 28 27 }; 29 28 30 29 static void __init lart_init(void)
-1
arch/arm/mach-sa1100/shannon.c
··· 55 55 static struct mcp_plat_data shannon_mcp_data = { 56 56 .mccr0 = MCCR0_ADM, 57 57 .sclk_rate = 11981000, 58 - .codec = "ucb1x00", 59 58 }; 60 59 61 60 static void __init shannon_init(void)
+1 -7
arch/arm/mach-sa1100/simpad.c
··· 14 14 #include <linux/mtd/partitions.h> 15 15 #include <linux/io.h> 16 16 #include <linux/gpio.h> 17 - #include <linux/mfd/ucb1x00.h> 18 17 19 18 #include <asm/irq.h> 20 19 #include <mach/hardware.h> ··· 187 188 } 188 189 }; 189 190 190 - static struct ucb1x00_plat_data simpad_ucb1x00_data = { 191 - .gpio_base = SIMPAD_UCB1X00_GPIO_BASE, 192 - }; 193 - 194 191 static struct mcp_plat_data simpad_mcp_data = { 195 192 .mccr0 = MCCR0_ADM, 196 193 .sclk_rate = 11981000, 197 - .codec = "ucb1300", 198 - .codec_pdata = &simpad_ucb1x00_data, 194 + .gpio_base = SIMPAD_UCB1X00_GPIO_BASE, 199 195 }; 200 196 201 197
+2 -42
drivers/mfd/mcp-core.c
··· 26 26 #define to_mcp(d) container_of(d, struct mcp, attached_device) 27 27 #define to_mcp_driver(d) container_of(d, struct mcp_driver, drv) 28 28 29 - static 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 - 40 - const 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 - } 47 - EXPORT_SYMBOL(mcp_get_device_id); 48 - 49 29 static int mcp_bus_match(struct device *dev, struct device_driver *drv) 50 30 { 51 - const struct mcp *mcp = to_mcp(dev); 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; 31 + return 1; 58 32 } 59 33 60 34 static int mcp_bus_probe(struct device *dev) ··· 74 100 return ret; 75 101 } 76 102 77 - static int mcp_bus_uevent(struct device *dev, struct kobj_uevent_env *env) 78 - { 79 - struct mcp *mcp = to_mcp(dev); 80 - 81 - add_uevent_var(env, "MODALIAS=%s%s", MCP_MODULE_PREFIX, mcp->codec); 82 - return 0; 83 - } 84 - 85 103 static struct bus_type mcp_bus_type = { 86 104 .name = "mcp", 87 105 .match = mcp_bus_match, 88 - .uevent = mcp_bus_uevent, 89 106 .probe = mcp_bus_probe, 90 107 .remove = mcp_bus_remove, 91 108 .suspend = mcp_bus_suspend, ··· 212 247 } 213 248 EXPORT_SYMBOL(mcp_host_alloc); 214 249 215 - int mcp_host_register(struct mcp *mcp, void *pdata) 250 + int mcp_host_register(struct mcp *mcp) 216 251 { 217 - if (!mcp->codec) 218 - return -EINVAL; 219 - 220 - mcp->attached_device.platform_data = pdata; 221 252 dev_set_name(&mcp->attached_device, "mcp0"); 222 - request_module("%s%s", MCP_MODULE_PREFIX, mcp->codec); 223 253 return device_register(&mcp->attached_device); 224 254 } 225 255 EXPORT_SYMBOL(mcp_host_register);
+2 -5
drivers/mfd/mcp-sa11x0.c
··· 146 146 if (!data) 147 147 return -ENODEV; 148 148 149 - if (!data->codec) 150 - return -ENODEV; 151 - 152 149 if (!request_mem_region(0x80060000, 0x60, "sa11x0-mcp")) 153 150 return -EBUSY; 154 151 ··· 162 165 mcp->dma_audio_wr = DMA_Ser4MCP0Wr; 163 166 mcp->dma_telco_rd = DMA_Ser4MCP1Rd; 164 167 mcp->dma_telco_wr = DMA_Ser4MCP1Wr; 165 - mcp->codec = data->codec; 168 + mcp->gpio_base = data->gpio_base; 166 169 167 170 platform_set_drvdata(pdev, mcp); 168 171 ··· 195 198 mcp->rw_timeout = (64 * 3 * 1000000 + mcp->sclk_rate - 1) / 196 199 mcp->sclk_rate; 197 200 198 - ret = mcp_host_register(mcp, data->codec_pdata); 201 + ret = mcp_host_register(mcp); 199 202 if (ret == 0) 200 203 goto out; 201 204
+11 -37
drivers/mfd/ucb1x00-core.c
··· 36 36 static LIST_HEAD(ucb1x00_drivers); 37 37 static LIST_HEAD(ucb1x00_devices); 38 38 39 - static 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 - }; 46 - MODULE_DEVICE_TABLE(mcp, ucb1x00_id); 47 - 48 39 /** 49 40 * ucb1x00_io_set_dir - set IO direction 50 41 * @ucb: UCB1x00 structure describing chip ··· 527 536 528 537 static int ucb1x00_probe(struct mcp *mcp) 529 538 { 530 - const struct mcp_device_id *mid; 531 539 struct ucb1x00 *ucb; 532 540 struct ucb1x00_driver *drv; 533 - struct ucb1x00_plat_data *pdata; 534 541 unsigned int id; 535 542 int ret = -ENODEV; 536 543 int temp; 537 544 538 545 mcp_enable(mcp); 539 546 id = mcp_reg_read(mcp, UCB_ID); 540 - mid = mcp_get_device_id(mcp); 541 547 542 - if (mid && mid->driver_data) { 543 - if (id != mid->driver_data) { 544 - printk(KERN_WARNING "%s wrong ID %04x found: %04x\n", 545 - mid->name, (unsigned int) mid->driver_data, id); 546 - goto err_disable; 547 - } 548 - } else { 549 - mid = &ucb1x00_id[1]; 550 - while (mid->driver_data) { 551 - if (id == mid->driver_data) 552 - break; 553 - mid++; 554 - } 555 - printk(KERN_WARNING "%s ID not found: %04x\n", 556 - ucb1x00_id[0].name, id); 548 + if (id != UCB_ID_1200 && id != UCB_ID_1300 && id != UCB_ID_TC35143) { 549 + printk(KERN_WARNING "UCB1x00 ID not found: %04x\n", id); 557 550 goto err_disable; 558 551 } 559 552 ··· 546 571 if (!ucb) 547 572 goto err_disable; 548 573 549 - pdata = mcp->attached_device.platform_data; 574 + 550 575 ucb->dev.class = &ucb1x00_class; 551 576 ucb->dev.parent = &mcp->attached_device; 552 - dev_set_name(&ucb->dev, mid->name); 577 + dev_set_name(&ucb->dev, "ucb1x00"); 553 578 554 579 spin_lock_init(&ucb->lock); 555 580 spin_lock_init(&ucb->io_lock); 556 581 sema_init(&ucb->adc_sem, 1); 557 582 558 - ucb->id = mid; 583 + ucb->id = id; 559 584 ucb->mcp = mcp; 560 585 ucb->irq = ucb1x00_detect_irq(ucb); 561 586 if (ucb->irq == NO_IRQ) { 562 - printk(KERN_ERR "%s: IRQ probe failed\n", mid->name); 587 + printk(KERN_ERR "UCB1x00: IRQ probe failed\n"); 563 588 ret = -ENODEV; 564 589 goto err_free; 565 590 } 566 591 567 592 ucb->gpio.base = -1; 568 - if (pdata && (pdata->gpio_base >= 0)) { 593 + if (mcp->gpio_base != 0) { 569 594 ucb->gpio.label = dev_name(&ucb->dev); 570 - ucb->gpio.base = pdata->gpio_base; 595 + ucb->gpio.base = mcp->gpio_base; 571 596 ucb->gpio.ngpio = 10; 572 597 ucb->gpio.set = ucb1x00_gpio_set; 573 598 ucb->gpio.get = ucb1x00_gpio_get; ··· 580 605 dev_info(&ucb->dev, "gpio_base not set so no gpiolib support"); 581 606 582 607 ret = request_irq(ucb->irq, ucb1x00_irq, IRQF_TRIGGER_RISING, 583 - mid->name, ucb); 608 + "UCB1x00", ucb); 584 609 if (ret) { 585 - printk(KERN_ERR "%s: unable to grab irq%d: %d\n", 586 - mid->name, ucb->irq, ret); 610 + printk(KERN_ERR "ucb1x00: unable to grab irq%d: %d\n", 611 + ucb->irq, ret); 587 612 goto err_gpio; 588 613 } 589 614 ··· 705 730 .remove = ucb1x00_remove, 706 731 .suspend = ucb1x00_suspend, 707 732 .resume = ucb1x00_resume, 708 - .id_table = ucb1x00_id, 709 733 }; 710 734 711 735 static int __init ucb1x00_init(void)
+1 -1
drivers/mfd/ucb1x00-ts.c
··· 382 382 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 383 383 384 384 idev->name = "Touchscreen panel"; 385 - idev->id.product = ts->ucb->id->driver_data; 385 + idev->id.product = ts->ucb->id; 386 386 idev->open = ucb1x00_ts_open; 387 387 idev->close = ucb1x00_ts_close; 388 388
+2 -5
include/linux/mfd/mcp.h
··· 10 10 #ifndef MCP_H 11 11 #define MCP_H 12 12 13 - #include <linux/mod_devicetable.h> 14 13 #include <mach/dma.h> 15 14 16 15 struct mcp_ops; ··· 26 27 dma_device_t dma_telco_rd; 27 28 dma_device_t dma_telco_wr; 28 29 struct device attached_device; 29 - const char *codec; 30 + int gpio_base; 30 31 }; 31 32 32 33 struct mcp_ops { ··· 44 45 unsigned int mcp_reg_read(struct mcp *, unsigned int); 45 46 void mcp_enable(struct mcp *); 46 47 void mcp_disable(struct mcp *); 47 - const struct mcp_device_id *mcp_get_device_id(const struct mcp *mcp); 48 48 #define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate) 49 49 50 50 struct mcp *mcp_host_alloc(struct device *, size_t); 51 - int mcp_host_register(struct mcp *, void *); 51 + int mcp_host_register(struct mcp *); 52 52 void mcp_host_unregister(struct mcp *); 53 53 54 54 struct mcp_driver { ··· 56 58 void (*remove)(struct mcp *); 57 59 int (*suspend)(struct mcp *, pm_message_t); 58 60 int (*resume)(struct mcp *); 59 - const struct mcp_device_id *id_table; 60 61 }; 61 62 62 63 int mcp_driver_register(struct mcp_driver *);
+1 -4
include/linux/mfd/ucb1x00.h
··· 104 104 #define UCB_MODE_DYN_VFLAG_ENA (1 << 12) 105 105 #define UCB_MODE_AUD_OFF_CAN (1 << 13) 106 106 107 - struct ucb1x00_plat_data { 108 - int gpio_base; 109 - }; 110 107 111 108 struct ucb1x00_irq { 112 109 void *devid; ··· 116 119 unsigned int irq; 117 120 struct semaphore adc_sem; 118 121 spinlock_t io_lock; 119 - const struct mcp_device_id *id; 122 + u16 id; 120 123 u16 io_dir; 121 124 u16 io_out; 122 125 u16 adc_cr;
-11
include/linux/mod_devicetable.h
··· 436 436 __attribute__((aligned(sizeof(kernel_ulong_t)))); 437 437 }; 438 438 439 - /* mcp */ 440 - 441 - #define MCP_NAME_SIZE 20 442 - #define MCP_MODULE_PREFIX "mcp:" 443 - 444 - struct mcp_device_id { 445 - char name[MCP_NAME_SIZE]; 446 - kernel_ulong_t driver_data /* Data private to the driver */ 447 - __attribute__((aligned(sizeof(kernel_ulong_t)))); 448 - }; 449 - 450 439 /* dmi */ 451 440 enum dmi_field { 452 441 DMI_NONE,
-10
scripts/mod/file2alias.c
··· 823 823 } 824 824 ADD_TO_DEVTABLE("spi", struct spi_device_id, do_spi_entry); 825 825 826 - /* Looks like: mcp:S */ 827 - static int do_mcp_entry(const char *filename, struct mcp_device_id *id, 828 - char *alias) 829 - { 830 - sprintf(alias, MCP_MODULE_PREFIX "%s", id->name); 831 - 832 - return 1; 833 - } 834 - ADD_TO_DEVTABLE("mcp", struct mcp_device_id, do_mcp_entry); 835 - 836 826 static const struct dmifield { 837 827 const char *prefix; 838 828 int field;