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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mfd-for-linus-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull MFD fixes from Samuel Ortiz:
"We have 3 build fixes, a OMAP USB host PHY reset fix and the twl6040
conversion to an i2c driver. The latter may not sound like a fix but
the twl6040 MFD driver won't probe without it, triggering an OMAP4
audio regression."

* tag 'mfd-for-linus-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
mfd: Fix modular builds of rc5t583 regulator support
mfd: Fix asic3_gpio_to_irq
ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue
mfd: Convert twl6040 to i2c driver, and separate it from twl core
mfd : Fix dbx500 compilation error

+292 -254
+6 -6
arch/arm/mach-omap2/board-4430sdp.c
··· 20 20 #include <linux/usb/otg.h> 21 21 #include <linux/spi/spi.h> 22 22 #include <linux/i2c/twl.h> 23 + #include <linux/mfd/twl6040.h> 23 24 #include <linux/gpio_keys.h> 24 25 #include <linux/regulator/machine.h> 25 26 #include <linux/regulator/fixed.h> ··· 561 560 }, 562 561 }; 563 562 564 - static struct twl4030_codec_data twl6040_codec = { 563 + static struct twl6040_codec_data twl6040_codec = { 565 564 /* single-step ramp for headset and handsfree */ 566 565 .hs_left_step = 0x0f, 567 566 .hs_right_step = 0x0f, ··· 569 568 .hf_right_step = 0x1d, 570 569 }; 571 570 572 - static struct twl4030_vibra_data twl6040_vibra = { 571 + static struct twl6040_vibra_data twl6040_vibra = { 573 572 .vibldrv_res = 8, 574 573 .vibrdrv_res = 3, 575 574 .viblmotor_res = 10, ··· 578 577 .vddvibr_uV = 0, /* fixed volt supply - VBAT */ 579 578 }; 580 579 581 - static struct twl4030_audio_data twl6040_audio = { 580 + static struct twl6040_platform_data twl6040_data = { 582 581 .codec = &twl6040_codec, 583 582 .vibra = &twl6040_vibra, 584 583 .audpwron_gpio = 127, 585 - .naudint_irq = OMAP44XX_IRQ_SYS_2N, 586 584 .irq_base = TWL6040_CODEC_IRQ_BASE, 587 585 }; 588 586 589 587 static struct twl4030_platform_data sdp4430_twldata = { 590 - .audio = &twl6040_audio, 591 588 /* Regulators */ 592 589 .vusim = &sdp4430_vusim, 593 590 .vaux1 = &sdp4430_vaux1, ··· 616 617 TWL_COMMON_REGULATOR_VCXIO | 617 618 TWL_COMMON_REGULATOR_VUSB | 618 619 TWL_COMMON_REGULATOR_CLK32KG); 619 - omap4_pmic_init("twl6030", &sdp4430_twldata); 620 + omap4_pmic_init("twl6030", &sdp4430_twldata, 621 + &twl6040_data, OMAP44XX_IRQ_SYS_2N); 620 622 omap_register_i2c_bus(2, 400, NULL, 0); 621 623 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 622 624 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
+1 -1
arch/arm/mach-omap2/board-generic.c
··· 137 137 138 138 static void __init omap4_i2c_init(void) 139 139 { 140 - omap4_pmic_init("twl6030", &sdp4430_twldata); 140 + omap4_pmic_init("twl6030", &sdp4430_twldata, NULL, 0); 141 141 } 142 142 143 143 static void __init omap4_init(void)
+6 -7
arch/arm/mach-omap2/board-omap4panda.c
··· 25 25 #include <linux/gpio.h> 26 26 #include <linux/usb/otg.h> 27 27 #include <linux/i2c/twl.h> 28 + #include <linux/mfd/twl6040.h> 28 29 #include <linux/regulator/machine.h> 29 30 #include <linux/regulator/fixed.h> 30 31 #include <linux/wl12xx.h> ··· 285 284 return 0; 286 285 } 287 286 288 - static struct twl4030_codec_data twl6040_codec = { 287 + static struct twl6040_codec_data twl6040_codec = { 289 288 /* single-step ramp for headset and handsfree */ 290 289 .hs_left_step = 0x0f, 291 290 .hs_right_step = 0x0f, ··· 293 292 .hf_right_step = 0x1d, 294 293 }; 295 294 296 - static struct twl4030_audio_data twl6040_audio = { 295 + static struct twl6040_platform_data twl6040_data = { 297 296 .codec = &twl6040_codec, 298 297 .audpwron_gpio = 127, 299 - .naudint_irq = OMAP44XX_IRQ_SYS_2N, 300 298 .irq_base = TWL6040_CODEC_IRQ_BASE, 301 299 }; 302 300 303 301 /* Panda board uses the common PMIC configuration */ 304 - static struct twl4030_platform_data omap4_panda_twldata = { 305 - .audio = &twl6040_audio, 306 - }; 302 + static struct twl4030_platform_data omap4_panda_twldata; 307 303 308 304 /* 309 305 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM ··· 324 326 TWL_COMMON_REGULATOR_VCXIO | 325 327 TWL_COMMON_REGULATOR_VUSB | 326 328 TWL_COMMON_REGULATOR_CLK32KG); 327 - omap4_pmic_init("twl6030", &omap4_panda_twldata); 329 + omap4_pmic_init("twl6030", &omap4_panda_twldata, 330 + &twl6040_data, OMAP44XX_IRQ_SYS_2N); 328 331 omap_register_i2c_bus(2, 400, NULL, 0); 329 332 /* 330 333 * Bus 3 is attached to the DVI port where devices like the pico DLP
+32 -5
arch/arm/mach-omap2/twl-common.c
··· 37 37 .flags = I2C_CLIENT_WAKE, 38 38 }; 39 39 40 + static struct i2c_board_info __initdata omap4_i2c1_board_info[] = { 41 + { 42 + .addr = 0x48, 43 + .flags = I2C_CLIENT_WAKE, 44 + }, 45 + { 46 + I2C_BOARD_INFO("twl6040", 0x4b), 47 + }, 48 + }; 49 + 40 50 void __init omap_pmic_init(int bus, u32 clkrate, 41 51 const char *pmic_type, int pmic_irq, 42 52 struct twl4030_platform_data *pmic_data) ··· 59 49 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 60 50 } 61 51 52 + void __init omap4_pmic_init(const char *pmic_type, 53 + struct twl4030_platform_data *pmic_data, 54 + struct twl6040_platform_data *twl6040_data, int twl6040_irq) 55 + { 56 + /* PMIC part*/ 57 + strncpy(omap4_i2c1_board_info[0].type, pmic_type, 58 + sizeof(omap4_i2c1_board_info[0].type)); 59 + omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N; 60 + omap4_i2c1_board_info[0].platform_data = pmic_data; 61 + 62 + /* TWL6040 audio IC part */ 63 + omap4_i2c1_board_info[1].irq = twl6040_irq; 64 + omap4_i2c1_board_info[1].platform_data = twl6040_data; 65 + 66 + omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2); 67 + 68 + } 69 + 62 70 void __init omap_pmic_late_init(void) 63 71 { 64 72 /* Init the OMAP TWL parameters (if PMIC has been registerd) */ 65 - if (!pmic_i2c_board_info.irq) 66 - return; 67 - 68 - omap3_twl_init(); 69 - omap4_twl_init(); 73 + if (pmic_i2c_board_info.irq) 74 + omap3_twl_init(); 75 + if (omap4_i2c1_board_info[0].irq) 76 + omap4_twl_init(); 70 77 } 71 78 72 79 #if defined(CONFIG_ARCH_OMAP3)
+4 -6
arch/arm/mach-omap2/twl-common.h
··· 29 29 30 30 31 31 struct twl4030_platform_data; 32 + struct twl6040_platform_data; 32 33 33 34 void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, 34 35 struct twl4030_platform_data *pmic_data); ··· 47 46 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); 48 47 } 49 48 50 - static inline void omap4_pmic_init(const char *pmic_type, 51 - struct twl4030_platform_data *pmic_data) 52 - { 53 - /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ 54 - omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); 55 - } 49 + void omap4_pmic_init(const char *pmic_type, 50 + struct twl4030_platform_data *pmic_data, 51 + struct twl6040_platform_data *audio_data, int twl6040_irq); 56 52 57 53 void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 58 54 u32 pdata_flags, u32 regulators_flags);
+1 -2
drivers/input/misc/Kconfig
··· 380 380 381 381 config INPUT_TWL6040_VIBRA 382 382 tristate "Support for TWL6040 Vibrator" 383 - depends on TWL4030_CORE 384 - select TWL6040_CORE 383 + depends on TWL6040_CORE 385 384 select INPUT_FF_MEMLESS 386 385 help 387 386 This option enables support for TWL6040 Vibrator Driver.
+2 -2
drivers/input/misc/twl6040-vibra.c
··· 28 28 #include <linux/module.h> 29 29 #include <linux/platform_device.h> 30 30 #include <linux/workqueue.h> 31 - #include <linux/i2c/twl.h> 31 + #include <linux/input.h> 32 32 #include <linux/mfd/twl6040.h> 33 33 #include <linux/slab.h> 34 34 #include <linux/delay.h> ··· 257 257 258 258 static int __devinit twl6040_vibra_probe(struct platform_device *pdev) 259 259 { 260 - struct twl4030_vibra_data *pdata = pdev->dev.platform_data; 260 + struct twl6040_vibra_data *pdata = pdev->dev.platform_data; 261 261 struct vibra_info *info; 262 262 int ret; 263 263
+9 -2
drivers/mfd/Kconfig
··· 268 268 This is used to control charging LED brightness. 269 269 270 270 config TWL6040_CORE 271 - bool 272 - depends on TWL4030_CORE && GENERIC_HARDIRQS 271 + bool "Support for TWL6040 audio codec" 272 + depends on I2C=y && GENERIC_HARDIRQS 273 273 select MFD_CORE 274 + select REGMAP_I2C 274 275 default n 276 + help 277 + Say yes here if you want support for Texas Instruments TWL6040 audio 278 + codec. 279 + This driver provides common support for accessing the device, 280 + additional drivers must be enabled in order to use the 281 + functionality of the device (audio, vibra). 275 282 276 283 config MFD_STMPE 277 284 bool "Support STMicroelectronics STMPE"
+3 -1
drivers/mfd/asic3.c
··· 527 527 528 528 static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 529 529 { 530 - return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; 530 + struct asic3 *asic = container_of(chip, struct asic3, gpio); 531 + 532 + return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO; 531 533 } 532 534 533 535 static __init int asic3_gpio_probe(struct platform_device *pdev,
-44
drivers/mfd/omap-usb-host.c
··· 25 25 #include <linux/clk.h> 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/spinlock.h> 28 - #include <linux/gpio.h> 29 28 #include <plat/usb.h> 30 29 #include <linux/pm_runtime.h> 31 30 ··· 501 502 pm_runtime_get_sync(dev); 502 503 spin_lock_irqsave(&omap->lock, flags); 503 504 504 - if (pdata->ehci_data->phy_reset) { 505 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 506 - gpio_request_one(pdata->ehci_data->reset_gpio_port[0], 507 - GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); 508 - 509 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 510 - gpio_request_one(pdata->ehci_data->reset_gpio_port[1], 511 - GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); 512 - 513 - /* Hold the PHY in RESET for enough time till DIR is high */ 514 - udelay(10); 515 - } 516 - 517 505 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 518 506 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 519 507 ··· 579 593 usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); 580 594 } 581 595 582 - if (pdata->ehci_data->phy_reset) { 583 - /* Hold the PHY in RESET for enough time till 584 - * PHY is settled and ready 585 - */ 586 - udelay(10); 587 - 588 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 589 - gpio_set_value 590 - (pdata->ehci_data->reset_gpio_port[0], 1); 591 - 592 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 593 - gpio_set_value 594 - (pdata->ehci_data->reset_gpio_port[1], 1); 595 - } 596 - 597 596 spin_unlock_irqrestore(&omap->lock, flags); 598 597 pm_runtime_put_sync(dev); 599 - } 600 - 601 - static void omap_usbhs_deinit(struct device *dev) 602 - { 603 - struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); 604 - struct usbhs_omap_platform_data *pdata = &omap->platdata; 605 - 606 - if (pdata->ehci_data->phy_reset) { 607 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) 608 - gpio_free(pdata->ehci_data->reset_gpio_port[0]); 609 - 610 - if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) 611 - gpio_free(pdata->ehci_data->reset_gpio_port[1]); 612 - } 613 598 } 614 599 615 600 ··· 817 860 { 818 861 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); 819 862 820 - omap_usbhs_deinit(&pdev->dev); 821 863 iounmap(omap->tll_base); 822 864 iounmap(omap->uhh_base); 823 865 clk_put(omap->init_60m_fclk);
+1 -38
drivers/mfd/rc5t583.c
··· 80 80 {.name = "rc5t583-key", } 81 81 }; 82 82 83 - int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 84 - { 85 - struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 86 - return regmap_write(rc5t583->regmap, reg, val); 87 - } 88 - 89 - int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) 90 - { 91 - struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 92 - unsigned int ival; 93 - int ret; 94 - ret = regmap_read(rc5t583->regmap, reg, &ival); 95 - if (!ret) 96 - *val = (uint8_t)ival; 97 - return ret; 98 - } 99 - 100 - int rc5t583_set_bits(struct device *dev, unsigned int reg, 101 - unsigned int bit_mask) 102 - { 103 - struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 104 - return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); 105 - } 106 - 107 - int rc5t583_clear_bits(struct device *dev, unsigned int reg, 108 - unsigned int bit_mask) 109 - { 110 - struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 111 - return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); 112 - } 113 - 114 - int rc5t583_update(struct device *dev, unsigned int reg, 115 - unsigned int val, unsigned int mask) 116 - { 117 - struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 118 - return regmap_update_bits(rc5t583->regmap, reg, mask, val); 119 - } 120 - 121 83 static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, 122 84 int id, int ext_pwr, int slots) 123 85 { ··· 159 197 ds_id, ext_pwr_req); 160 198 return 0; 161 199 } 200 + EXPORT_SYMBOL(rc5t583_ext_power_req_config); 162 201 163 202 static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, 164 203 struct rc5t583_platform_data *pdata)
+68 -46
drivers/mfd/twl6040-core.c
··· 30 30 #include <linux/platform_device.h> 31 31 #include <linux/gpio.h> 32 32 #include <linux/delay.h> 33 - #include <linux/i2c/twl.h> 33 + #include <linux/i2c.h> 34 + #include <linux/regmap.h> 35 + #include <linux/err.h> 34 36 #include <linux/mfd/core.h> 35 37 #include <linux/mfd/twl6040.h> 36 38 ··· 41 39 int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) 42 40 { 43 41 int ret; 44 - u8 val = 0; 42 + unsigned int val; 45 43 46 44 mutex_lock(&twl6040->io_mutex); 47 45 /* Vibra control registers from cache */ ··· 49 47 reg == TWL6040_REG_VIBCTLR)) { 50 48 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; 51 49 } else { 52 - ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 50 + ret = regmap_read(twl6040->regmap, reg, &val); 53 51 if (ret < 0) { 54 52 mutex_unlock(&twl6040->io_mutex); 55 53 return ret; ··· 66 64 int ret; 67 65 68 66 mutex_lock(&twl6040->io_mutex); 69 - ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); 67 + ret = regmap_write(twl6040->regmap, reg, val); 70 68 /* Cache the vibra control registers */ 71 69 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) 72 70 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; ··· 79 77 int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 80 78 { 81 79 int ret; 82 - u8 val; 83 80 84 81 mutex_lock(&twl6040->io_mutex); 85 - ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 86 - if (ret) 87 - goto out; 88 - 89 - val |= mask; 90 - ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); 91 - out: 82 + ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); 92 83 mutex_unlock(&twl6040->io_mutex); 93 84 return ret; 94 85 } ··· 90 95 int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 91 96 { 92 97 int ret; 93 - u8 val; 94 98 95 99 mutex_lock(&twl6040->io_mutex); 96 - ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 97 - if (ret) 98 - goto out; 99 - 100 - val &= ~mask; 101 - ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); 102 - out: 100 + ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); 103 101 mutex_unlock(&twl6040->io_mutex); 104 102 return ret; 105 103 } ··· 482 494 }, 483 495 }; 484 496 485 - static int __devinit twl6040_probe(struct platform_device *pdev) 497 + static bool twl6040_readable_reg(struct device *dev, unsigned int reg) 486 498 { 487 - struct twl4030_audio_data *pdata = pdev->dev.platform_data; 499 + /* Register 0 is not readable */ 500 + if (!reg) 501 + return false; 502 + return true; 503 + } 504 + 505 + static struct regmap_config twl6040_regmap_config = { 506 + .reg_bits = 8, 507 + .val_bits = 8, 508 + .max_register = TWL6040_REG_STATUS, /* 0x2e */ 509 + 510 + .readable_reg = twl6040_readable_reg, 511 + }; 512 + 513 + static int __devinit twl6040_probe(struct i2c_client *client, 514 + const struct i2c_device_id *id) 515 + { 516 + struct twl6040_platform_data *pdata = client->dev.platform_data; 488 517 struct twl6040 *twl6040; 489 518 struct mfd_cell *cell = NULL; 490 519 int ret, children = 0; 491 520 492 521 if (!pdata) { 493 - dev_err(&pdev->dev, "Platform data is missing\n"); 522 + dev_err(&client->dev, "Platform data is missing\n"); 494 523 return -EINVAL; 495 524 } 496 525 497 526 /* In order to operate correctly we need valid interrupt config */ 498 - if (!pdata->naudint_irq || !pdata->irq_base) { 499 - dev_err(&pdev->dev, "Invalid IRQ configuration\n"); 527 + if (!client->irq || !pdata->irq_base) { 528 + dev_err(&client->dev, "Invalid IRQ configuration\n"); 500 529 return -EINVAL; 501 530 } 502 531 503 - twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); 504 - if (!twl6040) 505 - return -ENOMEM; 532 + twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), 533 + GFP_KERNEL); 534 + if (!twl6040) { 535 + ret = -ENOMEM; 536 + goto err; 537 + } 506 538 507 - platform_set_drvdata(pdev, twl6040); 539 + twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config); 540 + if (IS_ERR(twl6040->regmap)) { 541 + ret = PTR_ERR(twl6040->regmap); 542 + goto err; 543 + } 508 544 509 - twl6040->dev = &pdev->dev; 510 - twl6040->irq = pdata->naudint_irq; 545 + i2c_set_clientdata(client, twl6040); 546 + 547 + twl6040->dev = &client->dev; 548 + twl6040->irq = client->irq; 511 549 twl6040->irq_base = pdata->irq_base; 512 550 513 551 mutex_init(&twl6040->mutex); ··· 602 588 } 603 589 604 590 if (children) { 605 - ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, 591 + ret = mfd_add_devices(&client->dev, -1, twl6040->cells, 606 592 children, NULL, 0); 607 593 if (ret) 608 594 goto mfd_err; 609 595 } else { 610 - dev_err(&pdev->dev, "No platform data found for children\n"); 596 + dev_err(&client->dev, "No platform data found for children\n"); 611 597 ret = -ENODEV; 612 598 goto mfd_err; 613 599 } ··· 622 608 if (gpio_is_valid(twl6040->audpwron)) 623 609 gpio_free(twl6040->audpwron); 624 610 gpio1_err: 625 - platform_set_drvdata(pdev, NULL); 626 - kfree(twl6040); 611 + i2c_set_clientdata(client, NULL); 612 + regmap_exit(twl6040->regmap); 613 + err: 627 614 return ret; 628 615 } 629 616 630 - static int __devexit twl6040_remove(struct platform_device *pdev) 617 + static int __devexit twl6040_remove(struct i2c_client *client) 631 618 { 632 - struct twl6040 *twl6040 = platform_get_drvdata(pdev); 619 + struct twl6040 *twl6040 = i2c_get_clientdata(client); 633 620 634 621 if (twl6040->power_count) 635 622 twl6040_power(twl6040, 0); ··· 641 626 free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); 642 627 twl6040_irq_exit(twl6040); 643 628 644 - mfd_remove_devices(&pdev->dev); 645 - platform_set_drvdata(pdev, NULL); 646 - kfree(twl6040); 629 + mfd_remove_devices(&client->dev); 630 + i2c_set_clientdata(client, NULL); 631 + regmap_exit(twl6040->regmap); 647 632 648 633 return 0; 649 634 } 650 635 651 - static struct platform_driver twl6040_driver = { 636 + static const struct i2c_device_id twl6040_i2c_id[] = { 637 + { "twl6040", 0, }, 638 + { }, 639 + }; 640 + MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); 641 + 642 + static struct i2c_driver twl6040_driver = { 643 + .driver = { 644 + .name = "twl6040", 645 + .owner = THIS_MODULE, 646 + }, 652 647 .probe = twl6040_probe, 653 648 .remove = __devexit_p(twl6040_remove), 654 - .driver = { 655 - .owner = THIS_MODULE, 656 - .name = "twl6040", 657 - }, 649 + .id_table = twl6040_i2c_id, 658 650 }; 659 651 660 - module_platform_driver(twl6040_driver); 652 + module_i2c_driver(twl6040_driver); 661 653 662 654 MODULE_DESCRIPTION("TWL6040 MFD"); 663 655 MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
+37 -2
drivers/usb/host/ehci-omap.c
··· 42 42 #include <plat/usb.h> 43 43 #include <linux/regulator/consumer.h> 44 44 #include <linux/pm_runtime.h> 45 + #include <linux/gpio.h> 45 46 46 47 /* EHCI Register Set */ 47 48 #define EHCI_INSNREG04 (0xA0) ··· 192 191 } 193 192 } 194 193 194 + if (pdata->phy_reset) { 195 + if (gpio_is_valid(pdata->reset_gpio_port[0])) 196 + gpio_request_one(pdata->reset_gpio_port[0], 197 + GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); 198 + 199 + if (gpio_is_valid(pdata->reset_gpio_port[1])) 200 + gpio_request_one(pdata->reset_gpio_port[1], 201 + GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); 202 + 203 + /* Hold the PHY in RESET for enough time till DIR is high */ 204 + udelay(10); 205 + } 206 + 195 207 pm_runtime_enable(dev); 196 208 pm_runtime_get_sync(dev); 197 209 ··· 251 237 /* root ports should always stay powered */ 252 238 ehci_port_power(omap_ehci, 1); 253 239 240 + if (pdata->phy_reset) { 241 + /* Hold the PHY in RESET for enough time till 242 + * PHY is settled and ready 243 + */ 244 + udelay(10); 245 + 246 + if (gpio_is_valid(pdata->reset_gpio_port[0])) 247 + gpio_set_value(pdata->reset_gpio_port[0], 1); 248 + 249 + if (gpio_is_valid(pdata->reset_gpio_port[1])) 250 + gpio_set_value(pdata->reset_gpio_port[1], 1); 251 + } 252 + 254 253 return 0; 255 254 256 255 err_add_hcd: ··· 286 259 */ 287 260 static int ehci_hcd_omap_remove(struct platform_device *pdev) 288 261 { 289 - struct device *dev = &pdev->dev; 290 - struct usb_hcd *hcd = dev_get_drvdata(dev); 262 + struct device *dev = &pdev->dev; 263 + struct usb_hcd *hcd = dev_get_drvdata(dev); 264 + struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; 291 265 292 266 usb_remove_hcd(hcd); 293 267 disable_put_regulator(dev->platform_data); ··· 297 269 pm_runtime_put_sync(dev); 298 270 pm_runtime_disable(dev); 299 271 272 + if (pdata->phy_reset) { 273 + if (gpio_is_valid(pdata->reset_gpio_port[0])) 274 + gpio_free(pdata->reset_gpio_port[0]); 275 + 276 + if (gpio_is_valid(pdata->reset_gpio_port[1])) 277 + gpio_free(pdata->reset_gpio_port[1]); 278 + } 300 279 return 0; 301 280 } 302 281
-12
include/linux/i2c/twl.h
··· 666 666 unsigned int check_defaults:1; 667 667 unsigned int reset_registers:1; 668 668 unsigned int hs_extmute:1; 669 - u16 hs_left_step; 670 - u16 hs_right_step; 671 - u16 hf_left_step; 672 - u16 hf_right_step; 673 669 void (*set_hs_extmute)(int mute); 674 670 }; 675 671 676 672 struct twl4030_vibra_data { 677 673 unsigned int coexist; 678 - 679 - /* twl6040 */ 680 - unsigned int vibldrv_res; /* left driver resistance */ 681 - unsigned int vibrdrv_res; /* right driver resistance */ 682 - unsigned int viblmotor_res; /* left motor resistance */ 683 - unsigned int vibrmotor_res; /* right motor resistance */ 684 - int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ 685 - int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ 686 674 }; 687 675 688 676 struct twl4030_audio_data {
+53 -67
include/linux/mfd/db5500-prcmu.h
··· 8 8 #ifndef __MFD_DB5500_PRCMU_H 9 9 #define __MFD_DB5500_PRCMU_H 10 10 11 - #ifdef CONFIG_MFD_DB5500_PRCMU 12 - 13 - void db5500_prcmu_early_init(void); 14 - int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state); 15 - int db5500_prcmu_set_display_clocks(void); 16 - int db5500_prcmu_disable_dsipll(void); 17 - int db5500_prcmu_enable_dsipll(void); 18 - int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 19 - int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 20 - void db5500_prcmu_enable_wakeups(u32 wakeups); 21 - int db5500_prcmu_request_clock(u8 clock, bool enable); 22 - void db5500_prcmu_config_abb_event_readout(u32 abb_events); 23 - void db5500_prcmu_get_abb_event_buffer(void __iomem **buf); 24 - int prcmu_resetout(u8 resoutn, u8 state); 25 - int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, 26 - bool keep_ap_pll); 27 - int db5500_prcmu_config_esram0_deep_sleep(u8 state); 28 - void db5500_prcmu_system_reset(u16 reset_code); 29 - u16 db5500_prcmu_get_reset_code(void); 30 - bool db5500_prcmu_is_ac_wake_requested(void); 31 - int db5500_prcmu_set_arm_opp(u8 opp); 32 - int db5500_prcmu_get_arm_opp(void); 33 - 34 - #else /* !CONFIG_UX500_SOC_DB5500 */ 35 - 36 - static inline void db5500_prcmu_early_init(void) {} 37 - 38 - static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) 39 - { 40 - return -ENOSYS; 41 - } 42 - 43 - static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) 44 - { 45 - return -ENOSYS; 46 - } 47 - 48 - static inline int db5500_prcmu_request_clock(u8 clock, bool enable) 49 - { 50 - return 0; 51 - } 52 - 53 - static inline int db5500_prcmu_set_display_clocks(void) 54 - { 55 - return 0; 56 - } 57 - 58 - static inline int db5500_prcmu_disable_dsipll(void) 59 - { 60 - return 0; 61 - } 62 - 63 - static inline int db5500_prcmu_enable_dsipll(void) 64 - { 65 - return 0; 66 - } 67 - 68 - static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) 69 - { 70 - return 0; 71 - } 72 - 73 - static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} 74 - 75 11 static inline int prcmu_resetout(u8 resoutn, u8 state) 76 12 { 77 13 return 0; ··· 18 82 return 0; 19 83 } 20 84 21 - static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} 22 - static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} 85 + static inline int db5500_prcmu_request_clock(u8 clock, bool enable) 86 + { 87 + return 0; 88 + } 23 89 24 90 static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, 25 91 bool keep_ap_pll) ··· 29 91 return 0; 30 92 } 31 93 32 - static inline void db5500_prcmu_system_reset(u16 reset_code) {} 94 + static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) 95 + { 96 + return 0; 97 + } 33 98 34 99 static inline u16 db5500_prcmu_get_reset_code(void) 35 100 { ··· 54 113 return 0; 55 114 } 56 115 116 + static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} 117 + 118 + static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {} 119 + 120 + static inline void db5500_prcmu_system_reset(u16 reset_code) {} 121 + 122 + static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} 123 + 124 + #ifdef CONFIG_MFD_DB5500_PRCMU 125 + 126 + void db5500_prcmu_early_init(void); 127 + int db5500_prcmu_set_display_clocks(void); 128 + int db5500_prcmu_disable_dsipll(void); 129 + int db5500_prcmu_enable_dsipll(void); 130 + int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 131 + int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); 132 + 133 + #else /* !CONFIG_UX500_SOC_DB5500 */ 134 + 135 + static inline void db5500_prcmu_early_init(void) {} 136 + 137 + static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) 138 + { 139 + return -ENOSYS; 140 + } 141 + 142 + static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) 143 + { 144 + return -ENOSYS; 145 + } 146 + 147 + static inline int db5500_prcmu_set_display_clocks(void) 148 + { 149 + return 0; 150 + } 151 + 152 + static inline int db5500_prcmu_disable_dsipll(void) 153 + { 154 + return 0; 155 + } 156 + 157 + static inline int db5500_prcmu_enable_dsipll(void) 158 + { 159 + return 0; 160 + } 57 161 58 162 #endif /* CONFIG_MFD_DB5500_PRCMU */ 59 163
+39 -8
include/linux/mfd/rc5t583.h
··· 26 26 27 27 #include <linux/mutex.h> 28 28 #include <linux/types.h> 29 + #include <linux/regmap.h> 29 30 30 31 #define RC5T583_MAX_REGS 0xF8 31 32 ··· 280 279 bool enable_shutdown; 281 280 }; 282 281 283 - int rc5t583_write(struct device *dev, u8 reg, uint8_t val); 284 - int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); 285 - int rc5t583_set_bits(struct device *dev, unsigned int reg, 286 - unsigned int bit_mask); 287 - int rc5t583_clear_bits(struct device *dev, unsigned int reg, 288 - unsigned int bit_mask); 289 - int rc5t583_update(struct device *dev, unsigned int reg, 290 - unsigned int val, unsigned int mask); 282 + static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 283 + { 284 + struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 285 + return regmap_write(rc5t583->regmap, reg, val); 286 + } 287 + 288 + static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) 289 + { 290 + struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 291 + unsigned int ival; 292 + int ret; 293 + ret = regmap_read(rc5t583->regmap, reg, &ival); 294 + if (!ret) 295 + *val = (uint8_t)ival; 296 + return ret; 297 + } 298 + 299 + static inline int rc5t583_set_bits(struct device *dev, unsigned int reg, 300 + unsigned int bit_mask) 301 + { 302 + struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 303 + return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); 304 + } 305 + 306 + static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg, 307 + unsigned int bit_mask) 308 + { 309 + struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 310 + return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); 311 + } 312 + 313 + static inline int rc5t583_update(struct device *dev, unsigned int reg, 314 + unsigned int val, unsigned int mask) 315 + { 316 + struct rc5t583 *rc5t583 = dev_get_drvdata(dev); 317 + return regmap_update_bits(rc5t583->regmap, reg, mask, val); 318 + } 319 + 291 320 int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, 292 321 int ext_pwr_req, int deepsleep_slot_nr); 293 322 int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
+27
include/linux/mfd/twl6040.h
··· 174 174 #define TWL6040_SYSCLK_SEL_LPPLL 0 175 175 #define TWL6040_SYSCLK_SEL_HPPLL 1 176 176 177 + struct twl6040_codec_data { 178 + u16 hs_left_step; 179 + u16 hs_right_step; 180 + u16 hf_left_step; 181 + u16 hf_right_step; 182 + }; 183 + 184 + struct twl6040_vibra_data { 185 + unsigned int vibldrv_res; /* left driver resistance */ 186 + unsigned int vibrdrv_res; /* right driver resistance */ 187 + unsigned int viblmotor_res; /* left motor resistance */ 188 + unsigned int vibrmotor_res; /* right motor resistance */ 189 + int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ 190 + int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ 191 + }; 192 + 193 + struct twl6040_platform_data { 194 + int audpwron_gpio; /* audio power-on gpio */ 195 + unsigned int irq_base; 196 + 197 + struct twl6040_codec_data *codec; 198 + struct twl6040_vibra_data *vibra; 199 + }; 200 + 201 + struct regmap; 202 + 177 203 struct twl6040 { 178 204 struct device *dev; 205 + struct regmap *regmap; 179 206 struct mutex mutex; 180 207 struct mutex io_mutex; 181 208 struct mutex irq_mutex;
+1 -2
sound/soc/codecs/Kconfig
··· 57 57 select SND_SOC_TPA6130A2 if I2C 58 58 select SND_SOC_TLV320DAC33 if I2C 59 59 select SND_SOC_TWL4030 if TWL4030_CORE 60 - select SND_SOC_TWL6040 if TWL4030_CORE 60 + select SND_SOC_TWL6040 if TWL6040_CORE 61 61 select SND_SOC_UDA134X 62 62 select SND_SOC_UDA1380 if I2C 63 63 select SND_SOC_WL1273 if MFD_WL1273_CORE ··· 276 276 tristate 277 277 278 278 config SND_SOC_TWL6040 279 - select TWL6040_CORE 280 279 tristate 281 280 282 281 config SND_SOC_UDA134X
+1 -2
sound/soc/codecs/twl6040.c
··· 26 26 #include <linux/pm.h> 27 27 #include <linux/platform_device.h> 28 28 #include <linux/slab.h> 29 - #include <linux/i2c/twl.h> 30 29 #include <linux/mfd/twl6040.h> 31 30 32 31 #include <sound/core.h> ··· 1527 1528 static int twl6040_probe(struct snd_soc_codec *codec) 1528 1529 { 1529 1530 struct twl6040_data *priv; 1530 - struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); 1531 + struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev); 1531 1532 struct platform_device *pdev = container_of(codec->dev, 1532 1533 struct platform_device, dev); 1533 1534 int ret = 0;
+1 -1
sound/soc/omap/Kconfig
··· 97 97 98 98 config SND_OMAP_SOC_OMAP_ABE_TWL6040 99 99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" 100 - depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 100 + depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4 101 101 select SND_OMAP_SOC_DMIC 102 102 select SND_OMAP_SOC_MCPDM 103 103 select SND_SOC_TWL6040