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.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull mfd fixes from Samuel Ortiz:
"This is the remaining MFD fixes for 3.6, with 5 pending fixes:

- A tps65217 build error fix.
- A lcp_ich regression fix caused by the MFD driver failing to
initialize the watchdog sub device due to ACPI conflicts.
- 2 MAX77693 interrupt handling bug fixes.
- An MFD core fix, adding an IRQ domain argument to the MFD device
addition API in order to prevent silent and potentially harmful
remapping behaviour changes for drivers supporting non-DT
platforms."

* tag 'mfd-for-linus-3.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
mfd: MAX77693: Fix NULL pointer error when initializing irqs
mfd: MAX77693: Fix interrupt handling bug
mfd: core: Push irqdomain mapping out into devices
mfd: lpc_ich: Fix a 3.5 kernel regression for iTCO_wdt driver
mfd: Move tps65217 regulator plat data handling to regulator

+343 -247
+12 -7
drivers/extcon/extcon-max77693.c
··· 669 669 } 670 670 info->dev = &pdev->dev; 671 671 info->max77693 = max77693; 672 - info->max77693->regmap_muic = regmap_init_i2c(info->max77693->muic, 673 - &max77693_muic_regmap_config); 674 - if (IS_ERR(info->max77693->regmap_muic)) { 675 - ret = PTR_ERR(info->max77693->regmap_muic); 676 - dev_err(max77693->dev, 677 - "failed to allocate register map: %d\n", ret); 678 - goto err_regmap; 672 + if (info->max77693->regmap_muic) 673 + dev_dbg(&pdev->dev, "allocate register map\n"); 674 + else { 675 + info->max77693->regmap_muic = devm_regmap_init_i2c( 676 + info->max77693->muic, 677 + &max77693_muic_regmap_config); 678 + if (IS_ERR(info->max77693->regmap_muic)) { 679 + ret = PTR_ERR(info->max77693->regmap_muic); 680 + dev_err(max77693->dev, 681 + "failed to allocate register map: %d\n", ret); 682 + goto err_regmap; 683 + } 679 684 } 680 685 platform_set_drvdata(pdev, info); 681 686 mutex_init(&info->mutex);
+3 -2
drivers/mfd/88pm800.c
··· 470 470 471 471 ret = 472 472 mfd_add_devices(chip->dev, 0, &onkey_devs[0], 473 - ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0); 473 + ARRAY_SIZE(onkey_devs), &onkey_resources[0], 0, 474 + NULL); 474 475 if (ret < 0) { 475 476 dev_err(chip->dev, "Failed to add onkey subdev\n"); 476 477 goto out_dev; ··· 482 481 rtc_devs[0].platform_data = pdata->rtc; 483 482 rtc_devs[0].pdata_size = sizeof(struct pm80x_rtc_pdata); 484 483 ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], 485 - ARRAY_SIZE(rtc_devs), NULL, 0); 484 + ARRAY_SIZE(rtc_devs), NULL, 0, NULL); 486 485 if (ret < 0) { 487 486 dev_err(chip->dev, "Failed to add rtc subdev\n"); 488 487 goto out_dev;
+2 -1
drivers/mfd/88pm805.c
··· 216 216 } 217 217 218 218 ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], 219 - ARRAY_SIZE(codec_devs), &codec_resources[0], 0); 219 + ARRAY_SIZE(codec_devs), &codec_resources[0], 0, 220 + NULL); 220 221 if (ret < 0) { 221 222 dev_err(chip->dev, "Failed to add codec subdev\n"); 222 223 goto out_codec;
+11 -10
drivers/mfd/88pm860x-core.c
··· 637 637 bk_devs[i].resources = &bk_resources[j]; 638 638 ret = mfd_add_devices(chip->dev, 0, 639 639 &bk_devs[i], 1, 640 - &bk_resources[j], 0); 640 + &bk_resources[j], 0, NULL); 641 641 if (ret < 0) { 642 642 dev_err(chip->dev, "Failed to add " 643 643 "backlight subdev\n"); ··· 672 672 led_devs[i].resources = &led_resources[j], 673 673 ret = mfd_add_devices(chip->dev, 0, 674 674 &led_devs[i], 1, 675 - &led_resources[j], 0); 675 + &led_resources[j], 0, NULL); 676 676 if (ret < 0) { 677 677 dev_err(chip->dev, "Failed to add " 678 678 "led subdev\n"); ··· 709 709 regulator_devs[i].resources = &regulator_resources[seq]; 710 710 711 711 ret = mfd_add_devices(chip->dev, 0, &regulator_devs[i], 1, 712 - &regulator_resources[seq], 0); 712 + &regulator_resources[seq], 0, NULL); 713 713 if (ret < 0) { 714 714 dev_err(chip->dev, "Failed to add regulator subdev\n"); 715 715 goto out; ··· 733 733 rtc_devs[0].resources = &rtc_resources[0]; 734 734 ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], 735 735 ARRAY_SIZE(rtc_devs), &rtc_resources[0], 736 - chip->irq_base); 736 + chip->irq_base, NULL); 737 737 if (ret < 0) 738 738 dev_err(chip->dev, "Failed to add rtc subdev\n"); 739 739 } ··· 752 752 touch_devs[0].resources = &touch_resources[0]; 753 753 ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], 754 754 ARRAY_SIZE(touch_devs), &touch_resources[0], 755 - chip->irq_base); 755 + chip->irq_base, NULL); 756 756 if (ret < 0) 757 757 dev_err(chip->dev, "Failed to add touch subdev\n"); 758 758 } ··· 770 770 power_devs[0].num_resources = ARRAY_SIZE(battery_resources); 771 771 power_devs[0].resources = &battery_resources[0], 772 772 ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 1, 773 - &battery_resources[0], chip->irq_base); 773 + &battery_resources[0], chip->irq_base, NULL); 774 774 if (ret < 0) 775 775 dev_err(chip->dev, "Failed to add battery subdev\n"); 776 776 ··· 779 779 power_devs[1].num_resources = ARRAY_SIZE(charger_resources); 780 780 power_devs[1].resources = &charger_resources[0], 781 781 ret = mfd_add_devices(chip->dev, 0, &power_devs[1], 1, 782 - &charger_resources[0], chip->irq_base); 782 + &charger_resources[0], chip->irq_base, NULL); 783 783 if (ret < 0) 784 784 dev_err(chip->dev, "Failed to add charger subdev\n"); 785 785 ··· 788 788 power_devs[2].num_resources = ARRAY_SIZE(preg_resources); 789 789 power_devs[2].resources = &preg_resources[0], 790 790 ret = mfd_add_devices(chip->dev, 0, &power_devs[2], 1, 791 - &preg_resources[0], chip->irq_base); 791 + &preg_resources[0], chip->irq_base, NULL); 792 792 if (ret < 0) 793 793 dev_err(chip->dev, "Failed to add preg subdev\n"); 794 794 } ··· 802 802 onkey_devs[0].resources = &onkey_resources[0], 803 803 ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], 804 804 ARRAY_SIZE(onkey_devs), &onkey_resources[0], 805 - chip->irq_base); 805 + chip->irq_base, NULL); 806 806 if (ret < 0) 807 807 dev_err(chip->dev, "Failed to add onkey subdev\n"); 808 808 } ··· 815 815 codec_devs[0].num_resources = ARRAY_SIZE(codec_resources); 816 816 codec_devs[0].resources = &codec_resources[0], 817 817 ret = mfd_add_devices(chip->dev, 0, &codec_devs[0], 818 - ARRAY_SIZE(codec_devs), &codec_resources[0], 0); 818 + ARRAY_SIZE(codec_devs), &codec_resources[0], 0, 819 + NULL); 819 820 if (ret < 0) 820 821 dev_err(chip->dev, "Failed to add codec subdev\n"); 821 822 }
+1 -1
drivers/mfd/aat2870-core.c
··· 424 424 } 425 425 426 426 ret = mfd_add_devices(aat2870->dev, 0, aat2870_devs, 427 - ARRAY_SIZE(aat2870_devs), NULL, 0); 427 + ARRAY_SIZE(aat2870_devs), NULL, 0, NULL); 428 428 if (ret != 0) { 429 429 dev_err(aat2870->dev, "Failed to add subdev: %d\n", ret); 430 430 goto out_disable;
+1 -1
drivers/mfd/ab3100-core.c
··· 946 946 } 947 947 948 948 err = mfd_add_devices(&client->dev, 0, ab3100_devs, 949 - ARRAY_SIZE(ab3100_devs), NULL, 0); 949 + ARRAY_SIZE(ab3100_devs), NULL, 0, NULL); 950 950 951 951 ab3100_setup_debugfs(ab3100); 952 952
+5 -5
drivers/mfd/ab8500-core.c
··· 1418 1418 1419 1419 ret = mfd_add_devices(ab8500->dev, 0, abx500_common_devs, 1420 1420 ARRAY_SIZE(abx500_common_devs), NULL, 1421 - ab8500->irq_base); 1421 + ab8500->irq_base, ab8500->domain); 1422 1422 if (ret) 1423 1423 goto out_freeirq; 1424 1424 1425 1425 if (is_ab9540(ab8500)) 1426 1426 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, 1427 1427 ARRAY_SIZE(ab9540_devs), NULL, 1428 - ab8500->irq_base); 1428 + ab8500->irq_base, ab8500->domain); 1429 1429 else 1430 1430 ret = mfd_add_devices(ab8500->dev, 0, ab8500_devs, 1431 1431 ARRAY_SIZE(ab8500_devs), NULL, 1432 - ab8500->irq_base); 1432 + ab8500->irq_base, ab8500->domain); 1433 1433 if (ret) 1434 1434 goto out_freeirq; 1435 1435 1436 1436 if (is_ab9540(ab8500) || is_ab8505(ab8500)) 1437 1437 ret = mfd_add_devices(ab8500->dev, 0, ab9540_ab8505_devs, 1438 1438 ARRAY_SIZE(ab9540_ab8505_devs), NULL, 1439 - ab8500->irq_base); 1439 + ab8500->irq_base, ab8500->domain); 1440 1440 if (ret) 1441 1441 goto out_freeirq; 1442 1442 ··· 1444 1444 /* Add battery management devices */ 1445 1445 ret = mfd_add_devices(ab8500->dev, 0, ab8500_bm_devs, 1446 1446 ARRAY_SIZE(ab8500_bm_devs), NULL, 1447 - ab8500->irq_base); 1447 + ab8500->irq_base, ab8500->domain); 1448 1448 if (ret) 1449 1449 dev_err(ab8500->dev, "error adding bm devices\n"); 1450 1450 }
+3 -3
drivers/mfd/arizona-core.c
··· 316 316 } 317 317 318 318 ret = mfd_add_devices(arizona->dev, -1, early_devs, 319 - ARRAY_SIZE(early_devs), NULL, 0); 319 + ARRAY_SIZE(early_devs), NULL, 0, NULL); 320 320 if (ret != 0) { 321 321 dev_err(dev, "Failed to add early children: %d\n", ret); 322 322 return ret; ··· 516 516 switch (arizona->type) { 517 517 case WM5102: 518 518 ret = mfd_add_devices(arizona->dev, -1, wm5102_devs, 519 - ARRAY_SIZE(wm5102_devs), NULL, 0); 519 + ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 520 520 break; 521 521 case WM5110: 522 522 ret = mfd_add_devices(arizona->dev, -1, wm5110_devs, 523 - ARRAY_SIZE(wm5102_devs), NULL, 0); 523 + ARRAY_SIZE(wm5102_devs), NULL, 0, NULL); 524 524 break; 525 525 } 526 526
+3 -3
drivers/mfd/asic3.c
··· 913 913 if (pdata->clock_rate) { 914 914 ds1wm_pdata.clock_rate = pdata->clock_rate; 915 915 ret = mfd_add_devices(&pdev->dev, pdev->id, 916 - &asic3_cell_ds1wm, 1, mem, asic->irq_base); 916 + &asic3_cell_ds1wm, 1, mem, asic->irq_base, NULL); 917 917 if (ret < 0) 918 918 goto out; 919 919 } 920 920 921 921 if (mem_sdio && (irq >= 0)) { 922 922 ret = mfd_add_devices(&pdev->dev, pdev->id, 923 - &asic3_cell_mmc, 1, mem_sdio, irq); 923 + &asic3_cell_mmc, 1, mem_sdio, irq, NULL); 924 924 if (ret < 0) 925 925 goto out; 926 926 } ··· 934 934 asic3_cell_leds[i].pdata_size = sizeof(pdata->leds[i]); 935 935 } 936 936 ret = mfd_add_devices(&pdev->dev, 0, 937 - asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0); 937 + asic3_cell_leds, ASIC3_NUM_LEDS, NULL, 0, NULL); 938 938 } 939 939 940 940 out:
+1 -1
drivers/mfd/cs5535-mfd.c
··· 149 149 } 150 150 151 151 err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, 152 - ARRAY_SIZE(cs5535_mfd_cells), NULL, 0); 152 + ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); 153 153 if (err) { 154 154 dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); 155 155 goto err_disable;
+1 -1
drivers/mfd/da9052-core.c
··· 803 803 dev_err(da9052->dev, "DA9052 ADC IRQ failed ret=%d\n", ret); 804 804 805 805 ret = mfd_add_devices(da9052->dev, -1, da9052_subdev_info, 806 - ARRAY_SIZE(da9052_subdev_info), NULL, 0); 806 + ARRAY_SIZE(da9052_subdev_info), NULL, 0, NULL); 807 807 if (ret) 808 808 goto err; 809 809
+1 -1
drivers/mfd/davinci_voicecodec.c
··· 129 129 cell->pdata_size = sizeof(*davinci_vc); 130 130 131 131 ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, 132 - DAVINCI_VC_CELLS, NULL, 0); 132 + DAVINCI_VC_CELLS, NULL, 0, NULL); 133 133 if (ret != 0) { 134 134 dev_err(&pdev->dev, "fail to register client devices\n"); 135 135 goto fail4;
+1 -1
drivers/mfd/db8500-prcmu.c
··· 3010 3010 prcmu_config_esram0_deep_sleep(ESRAM0_DEEP_SLEEP_STATE_RET); 3011 3011 3012 3012 err = mfd_add_devices(&pdev->dev, 0, db8500_prcmu_devs, 3013 - ARRAY_SIZE(db8500_prcmu_devs), NULL, 0); 3013 + ARRAY_SIZE(db8500_prcmu_devs), NULL, 0, NULL); 3014 3014 if (err) { 3015 3015 pr_err("prcmu: Failed to add subdevices\n"); 3016 3016 return err;
+3 -2
drivers/mfd/htc-pasic3.c
··· 168 168 /* the first 5 PASIC3 registers control the DS1WM */ 169 169 ds1wm_resources[0].end = (5 << asic->bus_shift) - 1; 170 170 ret = mfd_add_devices(&pdev->dev, pdev->id, 171 - &ds1wm_cell, 1, r, irq); 171 + &ds1wm_cell, 1, r, irq, NULL); 172 172 if (ret < 0) 173 173 dev_warn(dev, "failed to register DS1WM\n"); 174 174 } ··· 176 176 if (pdata && pdata->led_pdata) { 177 177 led_cell.platform_data = pdata->led_pdata; 178 178 led_cell.pdata_size = sizeof(struct pasic3_leds_machinfo); 179 - ret = mfd_add_devices(&pdev->dev, pdev->id, &led_cell, 1, r, 0); 179 + ret = mfd_add_devices(&pdev->dev, pdev->id, &led_cell, 1, r, 180 + 0, NULL); 180 181 if (ret < 0) 181 182 dev_warn(dev, "failed to register LED device\n"); 182 183 }
+2 -2
drivers/mfd/intel_msic.c
··· 344 344 continue; 345 345 346 346 ret = mfd_add_devices(&pdev->dev, -1, &msic_devs[i], 1, NULL, 347 - pdata->irq[i]); 347 + pdata->irq[i], NULL); 348 348 if (ret) 349 349 goto fail; 350 350 } 351 351 352 352 ret = mfd_add_devices(&pdev->dev, 0, msic_other_devs, 353 - ARRAY_SIZE(msic_other_devs), NULL, 0); 353 + ARRAY_SIZE(msic_other_devs), NULL, 0, NULL); 354 354 if (ret) 355 355 goto fail; 356 356
+1 -1
drivers/mfd/janz-cmodio.c
··· 147 147 } 148 148 149 149 return mfd_add_devices(&pdev->dev, 0, priv->cells, 150 - num_probed, NULL, pdev->irq); 150 + num_probed, NULL, pdev->irq, NULL); 151 151 } 152 152 153 153 /*
+2 -1
drivers/mfd/jz4740-adc.c
··· 287 287 writeb(0xff, adc->base + JZ_REG_ADC_CTRL); 288 288 289 289 ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells, 290 - ARRAY_SIZE(jz4740_adc_cells), mem_base, irq_base); 290 + ARRAY_SIZE(jz4740_adc_cells), mem_base, 291 + irq_base, NULL); 291 292 if (ret < 0) 292 293 goto err_clk_put; 293 294
+4 -3
drivers/mfd/lm3533-core.c
··· 393 393 lm3533_als_devs[0].platform_data = pdata->als; 394 394 lm3533_als_devs[0].pdata_size = sizeof(*pdata->als); 395 395 396 - ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL, 0); 396 + ret = mfd_add_devices(lm3533->dev, 0, lm3533_als_devs, 1, NULL, 397 + 0, NULL); 397 398 if (ret) { 398 399 dev_err(lm3533->dev, "failed to add ALS device\n"); 399 400 return ret; ··· 423 422 } 424 423 425 424 ret = mfd_add_devices(lm3533->dev, 0, lm3533_bl_devs, 426 - pdata->num_backlights, NULL, 0); 425 + pdata->num_backlights, NULL, 0, NULL); 427 426 if (ret) { 428 427 dev_err(lm3533->dev, "failed to add backlight devices\n"); 429 428 return ret; ··· 452 451 } 453 452 454 453 ret = mfd_add_devices(lm3533->dev, 0, lm3533_led_devs, 455 - pdata->num_leds, NULL, 0); 454 + pdata->num_leds, NULL, 0, NULL); 456 455 if (ret) { 457 456 dev_err(lm3533->dev, "failed to add LED devices\n"); 458 457 return ret;
+3 -21
drivers/mfd/lpc_ich.c
··· 750 750 751 751 lpc_ich_finalize_cell(&lpc_ich_cells[LPC_GPIO], id); 752 752 ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_GPIO], 753 - 1, NULL, 0); 753 + 1, NULL, 0, NULL); 754 754 755 755 gpio_done: 756 756 if (acpi_conflict) ··· 765 765 u32 base_addr_cfg; 766 766 u32 base_addr; 767 767 int ret; 768 - bool acpi_conflict = false; 769 768 struct resource *res; 770 769 771 770 /* Setup power management base register */ ··· 779 780 res = wdt_io_res(ICH_RES_IO_TCO); 780 781 res->start = base_addr + ACPIBASE_TCO_OFF; 781 782 res->end = base_addr + ACPIBASE_TCO_END; 782 - ret = acpi_check_resource_conflict(res); 783 - if (ret) { 784 - acpi_conflict = true; 785 - goto wdt_done; 786 - } 787 783 788 784 res = wdt_io_res(ICH_RES_IO_SMI); 789 785 res->start = base_addr + ACPIBASE_SMI_OFF; 790 786 res->end = base_addr + ACPIBASE_SMI_END; 791 - ret = acpi_check_resource_conflict(res); 792 - if (ret) { 793 - acpi_conflict = true; 794 - goto wdt_done; 795 - } 787 + 796 788 lpc_ich_enable_acpi_space(dev); 797 789 798 790 /* ··· 803 813 res = wdt_mem_res(ICH_RES_MEM_GCS); 804 814 res->start = base_addr + ACPIBASE_GCS_OFF; 805 815 res->end = base_addr + ACPIBASE_GCS_END; 806 - ret = acpi_check_resource_conflict(res); 807 - if (ret) { 808 - acpi_conflict = true; 809 - goto wdt_done; 810 - } 811 816 } 812 817 813 818 lpc_ich_finalize_cell(&lpc_ich_cells[LPC_WDT], id); 814 819 ret = mfd_add_devices(&dev->dev, -1, &lpc_ich_cells[LPC_WDT], 815 - 1, NULL, 0); 820 + 1, NULL, 0, NULL); 816 821 817 822 wdt_done: 818 - if (acpi_conflict) 819 - pr_warn("Resource conflict(s) found affecting %s\n", 820 - lpc_ich_cells[LPC_WDT].name); 821 823 return ret; 822 824 } 823 825
+4 -2
drivers/mfd/lpc_sch.c
··· 127 127 lpc_sch_cells[i].id = id->device; 128 128 129 129 ret = mfd_add_devices(&dev->dev, 0, 130 - lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, 0); 130 + lpc_sch_cells, ARRAY_SIZE(lpc_sch_cells), NULL, 131 + 0, NULL); 131 132 if (ret) 132 133 goto out_dev; 133 134 ··· 154 153 tunnelcreek_cells[i].id = id->device; 155 154 156 155 ret = mfd_add_devices(&dev->dev, 0, tunnelcreek_cells, 157 - ARRAY_SIZE(tunnelcreek_cells), NULL, 0); 156 + ARRAY_SIZE(tunnelcreek_cells), NULL, 157 + 0, NULL); 158 158 } 159 159 160 160 return ret;
+1 -1
drivers/mfd/max77686.c
··· 126 126 max77686_irq_init(max77686); 127 127 128 128 ret = mfd_add_devices(max77686->dev, -1, max77686_devs, 129 - ARRAY_SIZE(max77686_devs), NULL, 0); 129 + ARRAY_SIZE(max77686_devs), NULL, 0, NULL); 130 130 131 131 if (ret < 0) 132 132 goto err_mfd;
+31 -5
drivers/mfd/max77693-irq.c
··· 137 137 const struct max77693_irq_data *irq_data = 138 138 irq_to_max77693_irq(max77693, data->irq); 139 139 140 + if (irq_data->group >= MAX77693_IRQ_GROUP_NR) 141 + return; 142 + 140 143 if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) 141 144 max77693->irq_masks_cur[irq_data->group] &= ~irq_data->mask; 142 145 else ··· 151 148 struct max77693_dev *max77693 = irq_get_chip_data(data->irq); 152 149 const struct max77693_irq_data *irq_data = 153 150 irq_to_max77693_irq(max77693, data->irq); 151 + 152 + if (irq_data->group >= MAX77693_IRQ_GROUP_NR) 153 + return; 154 154 155 155 if (irq_data->group >= MUIC_INT1 && irq_data->group <= MUIC_INT3) 156 156 max77693->irq_masks_cur[irq_data->group] |= irq_data->mask; ··· 206 200 207 201 if (irq_src & MAX77693_IRQSRC_MUIC) 208 202 /* MUIC INT1 ~ INT3 */ 209 - max77693_bulk_read(max77693->regmap, MAX77693_MUIC_REG_INT1, 203 + max77693_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1, 210 204 MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]); 211 205 212 206 /* Apply masking */ ··· 261 255 { 262 256 struct irq_domain *domain; 263 257 int i; 264 - int ret; 258 + int ret = 0; 259 + u8 intsrc_mask; 265 260 266 261 mutex_init(&max77693->irqlock); 267 262 ··· 294 287 &max77693_irq_domain_ops, max77693); 295 288 if (!domain) { 296 289 dev_err(max77693->dev, "could not create irq domain\n"); 297 - return -ENODEV; 290 + ret = -ENODEV; 291 + goto err_irq; 298 292 } 299 293 max77693->irq_domain = domain; 294 + 295 + /* Unmask max77693 interrupt */ 296 + ret = max77693_read_reg(max77693->regmap, 297 + MAX77693_PMIC_REG_INTSRC_MASK, &intsrc_mask); 298 + if (ret < 0) { 299 + dev_err(max77693->dev, "fail to read PMIC register\n"); 300 + goto err_irq; 301 + } 302 + 303 + intsrc_mask &= ~(MAX77693_IRQSRC_CHG); 304 + intsrc_mask &= ~(MAX77693_IRQSRC_FLASH); 305 + intsrc_mask &= ~(MAX77693_IRQSRC_MUIC); 306 + ret = max77693_write_reg(max77693->regmap, 307 + MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask); 308 + if (ret < 0) { 309 + dev_err(max77693->dev, "fail to write PMIC register\n"); 310 + goto err_irq; 311 + } 300 312 301 313 ret = request_threaded_irq(max77693->irq, NULL, max77693_irq_thread, 302 314 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 303 315 "max77693-irq", max77693); 304 - 305 316 if (ret) 306 317 dev_err(max77693->dev, "Failed to request IRQ %d: %d\n", 307 318 max77693->irq, ret); 308 319 309 - return 0; 320 + err_irq: 321 + return ret; 310 322 } 311 323 312 324 void max77693_irq_exit(struct max77693_dev *max77693)
+15 -1
drivers/mfd/max77693.c
··· 152 152 max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); 153 153 i2c_set_clientdata(max77693->haptic, max77693); 154 154 155 + /* 156 + * Initialize register map for MUIC device because use regmap-muic 157 + * instance of MUIC device when irq of max77693 is initialized 158 + * before call max77693-muic probe() function. 159 + */ 160 + max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic, 161 + &max77693_regmap_config); 162 + if (IS_ERR(max77693->regmap_muic)) { 163 + ret = PTR_ERR(max77693->regmap_muic); 164 + dev_err(max77693->dev, 165 + "failed to allocate register map: %d\n", ret); 166 + goto err_regmap; 167 + } 168 + 155 169 ret = max77693_irq_init(max77693); 156 170 if (ret < 0) 157 171 goto err_irq; ··· 173 159 pm_runtime_set_active(max77693->dev); 174 160 175 161 ret = mfd_add_devices(max77693->dev, -1, max77693_devs, 176 - ARRAY_SIZE(max77693_devs), NULL, 0); 162 + ARRAY_SIZE(max77693_devs), NULL, 0, NULL); 177 163 if (ret < 0) 178 164 goto err_mfd; 179 165
+6 -6
drivers/mfd/max8925-core.c
··· 598 598 599 599 ret = mfd_add_devices(chip->dev, 0, &rtc_devs[0], 600 600 ARRAY_SIZE(rtc_devs), 601 - &rtc_resources[0], chip->irq_base); 601 + &rtc_resources[0], chip->irq_base, NULL); 602 602 if (ret < 0) { 603 603 dev_err(chip->dev, "Failed to add rtc subdev\n"); 604 604 goto out; ··· 606 606 607 607 ret = mfd_add_devices(chip->dev, 0, &onkey_devs[0], 608 608 ARRAY_SIZE(onkey_devs), 609 - &onkey_resources[0], 0); 609 + &onkey_resources[0], 0, NULL); 610 610 if (ret < 0) { 611 611 dev_err(chip->dev, "Failed to add onkey subdev\n"); 612 612 goto out_dev; ··· 615 615 if (pdata) { 616 616 ret = mfd_add_devices(chip->dev, 0, &regulator_devs[0], 617 617 ARRAY_SIZE(regulator_devs), 618 - &regulator_resources[0], 0); 618 + &regulator_resources[0], 0, NULL); 619 619 if (ret < 0) { 620 620 dev_err(chip->dev, "Failed to add regulator subdev\n"); 621 621 goto out_dev; ··· 625 625 if (pdata && pdata->backlight) { 626 626 ret = mfd_add_devices(chip->dev, 0, &backlight_devs[0], 627 627 ARRAY_SIZE(backlight_devs), 628 - &backlight_resources[0], 0); 628 + &backlight_resources[0], 0, NULL); 629 629 if (ret < 0) { 630 630 dev_err(chip->dev, "Failed to add backlight subdev\n"); 631 631 goto out_dev; ··· 635 635 if (pdata && pdata->power) { 636 636 ret = mfd_add_devices(chip->dev, 0, &power_devs[0], 637 637 ARRAY_SIZE(power_devs), 638 - &power_supply_resources[0], 0); 638 + &power_supply_resources[0], 0, NULL); 639 639 if (ret < 0) { 640 640 dev_err(chip->dev, "Failed to add power supply " 641 641 "subdev\n"); ··· 646 646 if (pdata && pdata->touch) { 647 647 ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], 648 648 ARRAY_SIZE(touch_devs), 649 - &touch_resources[0], 0); 649 + &touch_resources[0], 0, NULL); 650 650 if (ret < 0) { 651 651 dev_err(chip->dev, "Failed to add touch subdev\n"); 652 652 goto out_dev;
+1 -1
drivers/mfd/max8997.c
··· 160 160 161 161 mfd_add_devices(max8997->dev, -1, max8997_devs, 162 162 ARRAY_SIZE(max8997_devs), 163 - NULL, 0); 163 + NULL, 0, NULL); 164 164 165 165 /* 166 166 * TODO: enable others (flash, muic, rtc, battery, ...) and
+4 -4
drivers/mfd/max8998.c
··· 161 161 switch (id->driver_data) { 162 162 case TYPE_LP3974: 163 163 ret = mfd_add_devices(max8998->dev, -1, 164 - lp3974_devs, ARRAY_SIZE(lp3974_devs), 165 - NULL, 0); 164 + lp3974_devs, ARRAY_SIZE(lp3974_devs), 165 + NULL, 0, NULL); 166 166 break; 167 167 case TYPE_MAX8998: 168 168 ret = mfd_add_devices(max8998->dev, -1, 169 - max8998_devs, ARRAY_SIZE(max8998_devs), 170 - NULL, 0); 169 + max8998_devs, ARRAY_SIZE(max8998_devs), 170 + NULL, 0, NULL); 171 171 break; 172 172 default: 173 173 ret = -EINVAL;
+1 -1
drivers/mfd/mc13xxx-core.c
··· 612 612 if (!cell.name) 613 613 return -ENOMEM; 614 614 615 - return mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0); 615 + return mfd_add_devices(mc13xxx->dev, -1, &cell, 1, NULL, 0, NULL); 616 616 } 617 617 618 618 static int mc13xxx_add_subdevice(struct mc13xxx *mc13xxx, const char *format)
+6 -6
drivers/mfd/mfd-core.c
··· 74 74 static int mfd_add_device(struct device *parent, int id, 75 75 const struct mfd_cell *cell, 76 76 struct resource *mem_base, 77 - int irq_base) 77 + int irq_base, struct irq_domain *domain) 78 78 { 79 79 struct resource *res; 80 80 struct platform_device *pdev; 81 81 struct device_node *np = NULL; 82 - struct irq_domain *domain = NULL; 83 82 int ret = -ENOMEM; 84 83 int r; 85 84 ··· 96 97 for_each_child_of_node(parent->of_node, np) { 97 98 if (of_device_is_compatible(np, cell->of_compatible)) { 98 99 pdev->dev.of_node = np; 99 - domain = irq_find_host(parent->of_node); 100 100 break; 101 101 } 102 102 } ··· 175 177 int mfd_add_devices(struct device *parent, int id, 176 178 struct mfd_cell *cells, int n_devs, 177 179 struct resource *mem_base, 178 - int irq_base) 180 + int irq_base, struct irq_domain *domain) 179 181 { 180 182 int i; 181 183 int ret = 0; ··· 189 191 for (i = 0; i < n_devs; i++) { 190 192 atomic_set(&cnts[i], 0); 191 193 cells[i].usage_count = &cnts[i]; 192 - ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base); 194 + ret = mfd_add_device(parent, id, cells + i, mem_base, 195 + irq_base, domain); 193 196 if (ret) 194 197 break; 195 198 } ··· 246 247 for (i = 0; i < n_clones; i++) { 247 248 cell_entry.name = clones[i]; 248 249 /* don't give up if a single call fails; just report error */ 249 - if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0)) 250 + if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, NULL, 0, 251 + NULL)) 250 252 dev_err(dev, "failed to create platform device '%s'\n", 251 253 clones[i]); 252 254 }
+2 -1
drivers/mfd/palmas.c
··· 453 453 454 454 ret = mfd_add_devices(palmas->dev, -1, 455 455 children, ARRAY_SIZE(palmas_children), 456 - NULL, regmap_irq_chip_get_base(palmas->irq_data)); 456 + NULL, regmap_irq_chip_get_base(palmas->irq_data), 457 + NULL); 457 458 kfree(children); 458 459 459 460 if (ret < 0)
+1 -1
drivers/mfd/rc5t583.c
··· 289 289 } 290 290 291 291 ret = mfd_add_devices(rc5t583->dev, -1, rc5t583_subdevs, 292 - ARRAY_SIZE(rc5t583_subdevs), NULL, 0); 292 + ARRAY_SIZE(rc5t583_subdevs), NULL, 0, NULL); 293 293 if (ret) { 294 294 dev_err(&i2c->dev, "add mfd devices failed: %d\n", ret); 295 295 goto err_add_devs;
+2 -1
drivers/mfd/rdc321x-southbridge.c
··· 87 87 rdc321x_wdt_pdata.sb_pdev = pdev; 88 88 89 89 return mfd_add_devices(&pdev->dev, -1, 90 - rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells), NULL, 0); 90 + rdc321x_sb_cells, ARRAY_SIZE(rdc321x_sb_cells), 91 + NULL, 0, NULL); 91 92 } 92 93 93 94 static void __devexit rdc321x_sb_remove(struct pci_dev *pdev)
+4 -4
drivers/mfd/sec-core.c
··· 141 141 switch (sec_pmic->device_type) { 142 142 case S5M8751X: 143 143 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8751_devs, 144 - ARRAY_SIZE(s5m8751_devs), NULL, 0); 144 + ARRAY_SIZE(s5m8751_devs), NULL, 0, NULL); 145 145 break; 146 146 case S5M8763X: 147 147 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8763_devs, 148 - ARRAY_SIZE(s5m8763_devs), NULL, 0); 148 + ARRAY_SIZE(s5m8763_devs), NULL, 0, NULL); 149 149 break; 150 150 case S5M8767X: 151 151 ret = mfd_add_devices(sec_pmic->dev, -1, s5m8767_devs, 152 - ARRAY_SIZE(s5m8767_devs), NULL, 0); 152 + ARRAY_SIZE(s5m8767_devs), NULL, 0, NULL); 153 153 break; 154 154 case S2MPS11X: 155 155 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, 156 - ARRAY_SIZE(s2mps11_devs), NULL, 0); 156 + ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); 157 157 break; 158 158 default: 159 159 /* If this happens the probe function is problem */
+2 -2
drivers/mfd/sta2x11-mfd.c
··· 407 407 sta2x11_mfd_bar0, 408 408 ARRAY_SIZE(sta2x11_mfd_bar0), 409 409 &pdev->resource[0], 410 - 0); 410 + 0, NULL); 411 411 if (err) { 412 412 dev_err(&pdev->dev, "mfd_add_devices[0] failed: %d\n", err); 413 413 goto err_disable; ··· 417 417 sta2x11_mfd_bar1, 418 418 ARRAY_SIZE(sta2x11_mfd_bar1), 419 419 &pdev->resource[1], 420 - 0); 420 + 0, NULL); 421 421 if (err) { 422 422 dev_err(&pdev->dev, "mfd_add_devices[1] failed: %d\n", err); 423 423 goto err_disable;
+1 -1
drivers/mfd/stmpe.c
··· 962 962 struct mfd_cell *cell, int irq) 963 963 { 964 964 return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, 965 - NULL, stmpe->irq_base + irq); 965 + NULL, stmpe->irq_base + irq, NULL); 966 966 } 967 967 968 968 static int __devinit stmpe_devices_init(struct stmpe *stmpe)
+1 -1
drivers/mfd/t7l66xb.c
··· 388 388 389 389 ret = mfd_add_devices(&dev->dev, dev->id, 390 390 t7l66xb_cells, ARRAY_SIZE(t7l66xb_cells), 391 - iomem, t7l66xb->irq_base); 391 + iomem, t7l66xb->irq_base, NULL); 392 392 393 393 if (!ret) 394 394 return 0;
+4 -4
drivers/mfd/tc3589x.c
··· 262 262 263 263 if (blocks & TC3589x_BLOCK_GPIO) { 264 264 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio, 265 - ARRAY_SIZE(tc3589x_dev_gpio), NULL, 266 - tc3589x->irq_base); 265 + ARRAY_SIZE(tc3589x_dev_gpio), NULL, 266 + tc3589x->irq_base, NULL); 267 267 if (ret) { 268 268 dev_err(tc3589x->dev, "failed to add gpio child\n"); 269 269 return ret; ··· 273 273 274 274 if (blocks & TC3589x_BLOCK_KEYPAD) { 275 275 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad, 276 - ARRAY_SIZE(tc3589x_dev_keypad), NULL, 277 - tc3589x->irq_base); 276 + ARRAY_SIZE(tc3589x_dev_keypad), NULL, 277 + tc3589x->irq_base, NULL); 278 278 if (ret) { 279 279 dev_err(tc3589x->dev, "failed to keypad child\n"); 280 280 return ret;
+1 -1
drivers/mfd/tc6387xb.c
··· 192 192 printk(KERN_INFO "Toshiba tc6387xb initialised\n"); 193 193 194 194 ret = mfd_add_devices(&dev->dev, dev->id, tc6387xb_cells, 195 - ARRAY_SIZE(tc6387xb_cells), iomem, irq); 195 + ARRAY_SIZE(tc6387xb_cells), iomem, irq, NULL); 196 196 197 197 if (!ret) 198 198 return 0;
+2 -2
drivers/mfd/tc6393xb.c
··· 700 700 tc6393xb_cells[TC6393XB_CELL_FB].pdata_size = sizeof(*tcpd->fb_data); 701 701 702 702 ret = mfd_add_devices(&dev->dev, dev->id, 703 - tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), 704 - iomem, tcpd->irq_base); 703 + tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), 704 + iomem, tcpd->irq_base, NULL); 705 705 706 706 if (!ret) 707 707 return 0;
+1 -1
drivers/mfd/ti-ssp.c
··· 412 412 cells[id].data_size = data->pdata_size; 413 413 } 414 414 415 - error = mfd_add_devices(dev, 0, cells, 2, NULL, 0); 415 + error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL); 416 416 if (error < 0) { 417 417 dev_err(dev, "cannot add mfd cells\n"); 418 418 goto error_enable;
+6 -6
drivers/mfd/timberdale.c
··· 757 757 err = mfd_add_devices(&dev->dev, -1, 758 758 timberdale_cells_bar0_cfg0, 759 759 ARRAY_SIZE(timberdale_cells_bar0_cfg0), 760 - &dev->resource[0], msix_entries[0].vector); 760 + &dev->resource[0], msix_entries[0].vector, NULL); 761 761 break; 762 762 case TIMB_HW_VER1: 763 763 err = mfd_add_devices(&dev->dev, -1, 764 764 timberdale_cells_bar0_cfg1, 765 765 ARRAY_SIZE(timberdale_cells_bar0_cfg1), 766 - &dev->resource[0], msix_entries[0].vector); 766 + &dev->resource[0], msix_entries[0].vector, NULL); 767 767 break; 768 768 case TIMB_HW_VER2: 769 769 err = mfd_add_devices(&dev->dev, -1, 770 770 timberdale_cells_bar0_cfg2, 771 771 ARRAY_SIZE(timberdale_cells_bar0_cfg2), 772 - &dev->resource[0], msix_entries[0].vector); 772 + &dev->resource[0], msix_entries[0].vector, NULL); 773 773 break; 774 774 case TIMB_HW_VER3: 775 775 err = mfd_add_devices(&dev->dev, -1, 776 776 timberdale_cells_bar0_cfg3, 777 777 ARRAY_SIZE(timberdale_cells_bar0_cfg3), 778 - &dev->resource[0], msix_entries[0].vector); 778 + &dev->resource[0], msix_entries[0].vector, NULL); 779 779 break; 780 780 default: 781 781 dev_err(&dev->dev, "Uknown IP setup: %d.%d.%d\n", ··· 792 792 793 793 err = mfd_add_devices(&dev->dev, 0, 794 794 timberdale_cells_bar1, ARRAY_SIZE(timberdale_cells_bar1), 795 - &dev->resource[1], msix_entries[0].vector); 795 + &dev->resource[1], msix_entries[0].vector, NULL); 796 796 if (err) { 797 797 dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); 798 798 goto err_mfd2; ··· 803 803 ((priv->fw.config & TIMB_HW_VER_MASK) == TIMB_HW_VER3)) { 804 804 err = mfd_add_devices(&dev->dev, 1, timberdale_cells_bar2, 805 805 ARRAY_SIZE(timberdale_cells_bar2), 806 - &dev->resource[2], msix_entries[0].vector); 806 + &dev->resource[2], msix_entries[0].vector, NULL); 807 807 if (err) { 808 808 dev_err(&dev->dev, "mfd_add_devices failed: %d\n", err); 809 809 goto err_mfd2;
+1 -1
drivers/mfd/tps6105x.c
··· 188 188 } 189 189 190 190 ret = mfd_add_devices(&client->dev, 0, tps6105x_cells, 191 - ARRAY_SIZE(tps6105x_cells), NULL, 0); 191 + ARRAY_SIZE(tps6105x_cells), NULL, 0, NULL); 192 192 if (ret) 193 193 goto fail; 194 194
+1 -1
drivers/mfd/tps6507x.c
··· 100 100 101 101 ret = mfd_add_devices(tps6507x->dev, -1, 102 102 tps6507x_devs, ARRAY_SIZE(tps6507x_devs), 103 - NULL, 0); 103 + NULL, 0, NULL); 104 104 105 105 if (ret < 0) 106 106 goto err;
+1 -1
drivers/mfd/tps65090.c
··· 292 292 } 293 293 294 294 ret = mfd_add_devices(tps65090->dev, -1, tps65090s, 295 - ARRAY_SIZE(tps65090s), NULL, 0); 295 + ARRAY_SIZE(tps65090s), NULL, 0, NULL); 296 296 if (ret) { 297 297 dev_err(&client->dev, "add mfd devices failed with err: %d\n", 298 298 ret);
+43 -87
drivers/mfd/tps65217.c
··· 24 24 #include <linux/slab.h> 25 25 #include <linux/regmap.h> 26 26 #include <linux/err.h> 27 - #include <linux/regulator/of_regulator.h> 27 + #include <linux/of.h> 28 + #include <linux/of_device.h> 28 29 29 30 #include <linux/mfd/core.h> 30 31 #include <linux/mfd/tps65217.h> 32 + 33 + static struct mfd_cell tps65217s[] = { 34 + { 35 + .name = "tps65217-pmic", 36 + }, 37 + }; 31 38 32 39 /** 33 40 * tps65217_reg_read: Read a single tps65217 register. ··· 140 133 } 141 134 EXPORT_SYMBOL_GPL(tps65217_clear_bits); 142 135 143 - #ifdef CONFIG_OF 144 - static struct of_regulator_match reg_matches[] = { 145 - { .name = "dcdc1", .driver_data = (void *)TPS65217_DCDC_1 }, 146 - { .name = "dcdc2", .driver_data = (void *)TPS65217_DCDC_2 }, 147 - { .name = "dcdc3", .driver_data = (void *)TPS65217_DCDC_3 }, 148 - { .name = "ldo1", .driver_data = (void *)TPS65217_LDO_1 }, 149 - { .name = "ldo2", .driver_data = (void *)TPS65217_LDO_2 }, 150 - { .name = "ldo3", .driver_data = (void *)TPS65217_LDO_3 }, 151 - { .name = "ldo4", .driver_data = (void *)TPS65217_LDO_4 }, 152 - }; 153 - 154 - static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) 155 - { 156 - struct device_node *node = client->dev.of_node; 157 - struct tps65217_board *pdata; 158 - struct device_node *regs; 159 - int count = ARRAY_SIZE(reg_matches); 160 - int ret, i; 161 - 162 - regs = of_find_node_by_name(node, "regulators"); 163 - if (!regs) 164 - return NULL; 165 - 166 - ret = of_regulator_match(&client->dev, regs, reg_matches, count); 167 - of_node_put(regs); 168 - if ((ret < 0) || (ret > count)) 169 - return NULL; 170 - 171 - count = ret; 172 - pdata = devm_kzalloc(&client->dev, count * sizeof(*pdata), GFP_KERNEL); 173 - if (!pdata) 174 - return NULL; 175 - 176 - for (i = 0; i < count; i++) { 177 - if (!reg_matches[i].init_data || !reg_matches[i].of_node) 178 - continue; 179 - 180 - pdata->tps65217_init_data[i] = reg_matches[i].init_data; 181 - pdata->of_node[i] = reg_matches[i].of_node; 182 - } 183 - 184 - return pdata; 185 - } 186 - 187 - static struct of_device_id tps65217_of_match[] = { 188 - { .compatible = "ti,tps65217", }, 189 - { }, 190 - }; 191 - #else 192 - static struct tps65217_board *tps65217_parse_dt(struct i2c_client *client) 193 - { 194 - return NULL; 195 - } 196 - #endif 197 - 198 136 static struct regmap_config tps65217_regmap_config = { 199 137 .reg_bits = 8, 200 138 .val_bits = 8, 139 + }; 140 + 141 + static const struct of_device_id tps65217_of_match[] = { 142 + { .compatible = "ti,tps65217", .data = (void *)TPS65217 }, 143 + { /* sentinel */ }, 201 144 }; 202 145 203 146 static int __devinit tps65217_probe(struct i2c_client *client, 204 147 const struct i2c_device_id *ids) 205 148 { 206 149 struct tps65217 *tps; 207 - struct regulator_init_data *reg_data; 208 - struct tps65217_board *pdata = client->dev.platform_data; 209 - int i, ret; 210 150 unsigned int version; 151 + unsigned int chip_id = ids->driver_data; 152 + const struct of_device_id *match; 153 + int ret; 211 154 212 - if (!pdata && client->dev.of_node) 213 - pdata = tps65217_parse_dt(client); 155 + if (client->dev.of_node) { 156 + match = of_match_device(tps65217_of_match, &client->dev); 157 + if (!match) { 158 + dev_err(&client->dev, 159 + "Failed to find matching dt id\n"); 160 + return -EINVAL; 161 + } 162 + chip_id = (unsigned int)match->data; 163 + } 164 + 165 + if (!chip_id) { 166 + dev_err(&client->dev, "id is null.\n"); 167 + return -ENODEV; 168 + } 214 169 215 170 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); 216 171 if (!tps) 217 172 return -ENOMEM; 218 173 219 - tps->pdata = pdata; 174 + i2c_set_clientdata(client, tps); 175 + tps->dev = &client->dev; 176 + tps->id = chip_id; 177 + 220 178 tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); 221 179 if (IS_ERR(tps->regmap)) { 222 180 ret = PTR_ERR(tps->regmap); ··· 190 218 return ret; 191 219 } 192 220 193 - i2c_set_clientdata(client, tps); 194 - tps->dev = &client->dev; 221 + ret = mfd_add_devices(tps->dev, -1, tps65217s, 222 + ARRAY_SIZE(tps65217s), NULL, 0, NULL); 223 + if (ret < 0) { 224 + dev_err(tps->dev, "mfd_add_devices failed: %d\n", ret); 225 + return ret; 226 + } 195 227 196 228 ret = tps65217_reg_read(tps, TPS65217_REG_CHIPID, &version); 197 229 if (ret < 0) { ··· 208 232 (version & TPS65217_CHIPID_CHIP_MASK) >> 4, 209 233 version & TPS65217_CHIPID_REV_MASK); 210 234 211 - for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { 212 - struct platform_device *pdev; 213 - 214 - pdev = platform_device_alloc("tps65217-pmic", i); 215 - if (!pdev) { 216 - dev_err(tps->dev, "Cannot create regulator %d\n", i); 217 - continue; 218 - } 219 - 220 - pdev->dev.parent = tps->dev; 221 - pdev->dev.of_node = pdata->of_node[i]; 222 - reg_data = pdata->tps65217_init_data[i]; 223 - platform_device_add_data(pdev, reg_data, sizeof(*reg_data)); 224 - tps->regulator_pdev[i] = pdev; 225 - 226 - platform_device_add(pdev); 227 - } 228 - 229 235 return 0; 230 236 } 231 237 232 238 static int __devexit tps65217_remove(struct i2c_client *client) 233 239 { 234 240 struct tps65217 *tps = i2c_get_clientdata(client); 235 - int i; 236 241 237 - for (i = 0; i < TPS65217_NUM_REGULATOR; i++) 238 - platform_device_unregister(tps->regulator_pdev[i]); 242 + mfd_remove_devices(tps->dev); 239 243 240 244 return 0; 241 245 } 242 246 243 247 static const struct i2c_device_id tps65217_id_table[] = { 244 - {"tps65217", 0xF0}, 245 - {/* end of list */} 248 + {"tps65217", TPS65217}, 249 + { /* sentinel */ } 246 250 }; 247 251 MODULE_DEVICE_TABLE(i2c, tps65217_id_table); 248 252
+2 -1
drivers/mfd/tps6586x.c
··· 493 493 } 494 494 495 495 ret = mfd_add_devices(tps6586x->dev, -1, 496 - tps6586x_cell, ARRAY_SIZE(tps6586x_cell), NULL, 0); 496 + tps6586x_cell, ARRAY_SIZE(tps6586x_cell), 497 + NULL, 0, NULL); 497 498 if (ret < 0) { 498 499 dev_err(&client->dev, "mfd_add_devices failed: %d\n", ret); 499 500 goto err_mfd_add;
+1 -1
drivers/mfd/tps65910.c
··· 254 254 255 255 ret = mfd_add_devices(tps65910->dev, -1, 256 256 tps65910s, ARRAY_SIZE(tps65910s), 257 - NULL, 0); 257 + NULL, 0, NULL); 258 258 if (ret < 0) { 259 259 dev_err(&i2c->dev, "mfd_add_devices failed: %d\n", ret); 260 260 return ret;
+1 -1
drivers/mfd/tps65912-core.c
··· 146 146 147 147 ret = mfd_add_devices(tps65912->dev, -1, 148 148 tps65912s, ARRAY_SIZE(tps65912s), 149 - NULL, 0); 149 + NULL, 0, NULL); 150 150 if (ret < 0) 151 151 goto err; 152 152
+1 -1
drivers/mfd/twl4030-audio.c
··· 223 223 224 224 if (childs) 225 225 ret = mfd_add_devices(&pdev->dev, pdev->id, audio->cells, 226 - childs, NULL, 0); 226 + childs, NULL, 0, NULL); 227 227 else { 228 228 dev_err(&pdev->dev, "No platform data found for childs\n"); 229 229 ret = -ENODEV;
+1 -1
drivers/mfd/twl6040-core.c
··· 632 632 } 633 633 634 634 ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, 635 - NULL, 0); 635 + NULL, 0, NULL); 636 636 if (ret) 637 637 goto mfd_err; 638 638
+1 -1
drivers/mfd/vx855.c
··· 102 102 vx855_gpio_resources[1].end = vx855_gpio_resources[1].start + 3; 103 103 104 104 ret = mfd_add_devices(&pdev->dev, -1, vx855_cells, ARRAY_SIZE(vx855_cells), 105 - NULL, 0); 105 + NULL, 0, NULL); 106 106 107 107 /* we always return -ENODEV here in order to enable other 108 108 * drivers like old, not-yet-platform_device ported i2c-viapro */
+1 -1
drivers/mfd/wl1273-core.c
··· 241 241 __func__, children); 242 242 243 243 r = mfd_add_devices(&client->dev, -1, core->cells, 244 - children, NULL, 0); 244 + children, NULL, 0, NULL); 245 245 if (r) 246 246 goto err; 247 247
+8 -8
drivers/mfd/wm831x-core.c
··· 1813 1813 case WM8310: 1814 1814 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1815 1815 wm8310_devs, ARRAY_SIZE(wm8310_devs), 1816 - NULL, 0); 1816 + NULL, 0, NULL); 1817 1817 break; 1818 1818 1819 1819 case WM8311: 1820 1820 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1821 1821 wm8311_devs, ARRAY_SIZE(wm8311_devs), 1822 - NULL, 0); 1822 + NULL, 0, NULL); 1823 1823 if (!pdata || !pdata->disable_touch) 1824 1824 mfd_add_devices(wm831x->dev, wm831x_num, 1825 1825 touch_devs, ARRAY_SIZE(touch_devs), 1826 - NULL, 0); 1826 + NULL, 0, NULL); 1827 1827 break; 1828 1828 1829 1829 case WM8312: 1830 1830 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1831 1831 wm8312_devs, ARRAY_SIZE(wm8312_devs), 1832 - NULL, 0); 1832 + NULL, 0, NULL); 1833 1833 if (!pdata || !pdata->disable_touch) 1834 1834 mfd_add_devices(wm831x->dev, wm831x_num, 1835 1835 touch_devs, ARRAY_SIZE(touch_devs), 1836 - NULL, 0); 1836 + NULL, 0, NULL); 1837 1837 break; 1838 1838 1839 1839 case WM8320: ··· 1842 1842 case WM8326: 1843 1843 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1844 1844 wm8320_devs, ARRAY_SIZE(wm8320_devs), 1845 - NULL, 0); 1845 + NULL, 0, NULL); 1846 1846 break; 1847 1847 1848 1848 default: ··· 1867 1867 if (ret & WM831X_XTAL_ENA) { 1868 1868 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1869 1869 rtc_devs, ARRAY_SIZE(rtc_devs), 1870 - NULL, 0); 1870 + NULL, 0, NULL); 1871 1871 if (ret != 0) { 1872 1872 dev_err(wm831x->dev, "Failed to add RTC: %d\n", ret); 1873 1873 goto err_irq; ··· 1880 1880 /* Treat errors as non-critical */ 1881 1881 ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, 1882 1882 ARRAY_SIZE(backlight_devs), NULL, 1883 - 0); 1883 + 0, NULL); 1884 1884 if (ret < 0) 1885 1885 dev_err(wm831x->dev, "Failed to add backlight: %d\n", 1886 1886 ret);
+1 -1
drivers/mfd/wm8400-core.c
··· 70 70 .pdata_size = sizeof(*wm8400), 71 71 }; 72 72 73 - return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0); 73 + return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0, NULL); 74 74 } 75 75 76 76 /*
+2 -2
drivers/mfd/wm8994-core.c
··· 414 414 ret = mfd_add_devices(wm8994->dev, -1, 415 415 wm8994_regulator_devs, 416 416 ARRAY_SIZE(wm8994_regulator_devs), 417 - NULL, 0); 417 + NULL, 0, NULL); 418 418 if (ret != 0) { 419 419 dev_err(wm8994->dev, "Failed to add children: %d\n", ret); 420 420 goto err; ··· 648 648 649 649 ret = mfd_add_devices(wm8994->dev, -1, 650 650 wm8994_devs, ARRAY_SIZE(wm8994_devs), 651 - NULL, 0); 651 + NULL, 0, NULL); 652 652 if (ret != 0) { 653 653 dev_err(wm8994->dev, "Failed to add children: %d\n", ret); 654 654 goto err_irq;
+109 -15
drivers/regulator/tps65217-regulator.c
··· 22 22 #include <linux/err.h> 23 23 #include <linux/platform_device.h> 24 24 25 + #include <linux/regulator/of_regulator.h> 25 26 #include <linux/regulator/driver.h> 26 27 #include <linux/regulator/machine.h> 27 28 #include <linux/mfd/tps65217.h> ··· 282 281 NULL), 283 282 }; 284 283 284 + #ifdef CONFIG_OF 285 + static struct of_regulator_match reg_matches[] = { 286 + { .name = "dcdc1", .driver_data = (void *)TPS65217_DCDC_1 }, 287 + { .name = "dcdc2", .driver_data = (void *)TPS65217_DCDC_2 }, 288 + { .name = "dcdc3", .driver_data = (void *)TPS65217_DCDC_3 }, 289 + { .name = "ldo1", .driver_data = (void *)TPS65217_LDO_1 }, 290 + { .name = "ldo2", .driver_data = (void *)TPS65217_LDO_2 }, 291 + { .name = "ldo3", .driver_data = (void *)TPS65217_LDO_3 }, 292 + { .name = "ldo4", .driver_data = (void *)TPS65217_LDO_4 }, 293 + }; 294 + 295 + static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) 296 + { 297 + struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); 298 + struct device_node *node = tps->dev->of_node; 299 + struct tps65217_board *pdata; 300 + struct device_node *regs; 301 + int i, count; 302 + 303 + regs = of_find_node_by_name(node, "regulators"); 304 + if (!regs) 305 + return NULL; 306 + 307 + count = of_regulator_match(pdev->dev.parent, regs, 308 + reg_matches, TPS65217_NUM_REGULATOR); 309 + of_node_put(regs); 310 + if ((count < 0) || (count > TPS65217_NUM_REGULATOR)) 311 + return NULL; 312 + 313 + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 314 + if (!pdata) 315 + return NULL; 316 + 317 + for (i = 0; i < count; i++) { 318 + if (!reg_matches[i].init_data || !reg_matches[i].of_node) 319 + continue; 320 + 321 + pdata->tps65217_init_data[i] = reg_matches[i].init_data; 322 + pdata->of_node[i] = reg_matches[i].of_node; 323 + } 324 + 325 + return pdata; 326 + } 327 + #else 328 + static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) 329 + { 330 + return NULL; 331 + } 332 + #endif 333 + 285 334 static int __devinit tps65217_regulator_probe(struct platform_device *pdev) 286 335 { 336 + struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); 337 + struct tps65217_board *pdata = dev_get_platdata(tps->dev); 338 + struct regulator_init_data *reg_data; 287 339 struct regulator_dev *rdev; 288 - struct tps65217 *tps; 289 - struct tps_info *info = &tps65217_pmic_regs[pdev->id]; 290 340 struct regulator_config config = { }; 341 + int i, ret; 291 342 292 - /* Already set by core driver */ 293 - tps = dev_to_tps65217(pdev->dev.parent); 294 - tps->info[pdev->id] = info; 343 + if (tps->dev->of_node) 344 + pdata = tps65217_parse_dt(pdev); 295 345 296 - config.dev = &pdev->dev; 297 - config.of_node = pdev->dev.of_node; 298 - config.init_data = pdev->dev.platform_data; 299 - config.driver_data = tps; 346 + if (!pdata) { 347 + dev_err(&pdev->dev, "Platform data not found\n"); 348 + return -EINVAL; 349 + } 300 350 301 - rdev = regulator_register(&regulators[pdev->id], &config); 302 - if (IS_ERR(rdev)) 303 - return PTR_ERR(rdev); 351 + if (tps65217_chip_id(tps) != TPS65217) { 352 + dev_err(&pdev->dev, "Invalid tps chip version\n"); 353 + return -ENODEV; 354 + } 304 355 305 - platform_set_drvdata(pdev, rdev); 356 + platform_set_drvdata(pdev, tps); 306 357 358 + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { 359 + 360 + reg_data = pdata->tps65217_init_data[i]; 361 + 362 + /* 363 + * Regulator API handles empty constraints but not NULL 364 + * constraints 365 + */ 366 + if (!reg_data) 367 + continue; 368 + 369 + /* Register the regulators */ 370 + tps->info[i] = &tps65217_pmic_regs[i]; 371 + 372 + config.dev = tps->dev; 373 + config.init_data = reg_data; 374 + config.driver_data = tps; 375 + config.regmap = tps->regmap; 376 + if (tps->dev->of_node) 377 + config.of_node = pdata->of_node[i]; 378 + 379 + rdev = regulator_register(&regulators[i], &config); 380 + if (IS_ERR(rdev)) { 381 + dev_err(tps->dev, "failed to register %s regulator\n", 382 + pdev->name); 383 + ret = PTR_ERR(rdev); 384 + goto err_unregister_regulator; 385 + } 386 + 387 + /* Save regulator for cleanup */ 388 + tps->rdev[i] = rdev; 389 + } 307 390 return 0; 391 + 392 + err_unregister_regulator: 393 + while (--i >= 0) 394 + regulator_unregister(tps->rdev[i]); 395 + 396 + return ret; 308 397 } 309 398 310 399 static int __devexit tps65217_regulator_remove(struct platform_device *pdev) 311 400 { 312 - struct regulator_dev *rdev = platform_get_drvdata(pdev); 401 + struct tps65217 *tps = platform_get_drvdata(pdev); 402 + unsigned int i; 403 + 404 + for (i = 0; i < TPS65217_NUM_REGULATOR; i++) 405 + regulator_unregister(tps->rdev[i]); 313 406 314 407 platform_set_drvdata(pdev, NULL); 315 - regulator_unregister(rdev); 316 408 317 409 return 0; 318 410 }
+1 -1
drivers/staging/nvec/nvec.c
··· 837 837 } 838 838 839 839 ret = mfd_add_devices(nvec->dev, -1, nvec_devices, 840 - ARRAY_SIZE(nvec_devices), base, 0); 840 + ARRAY_SIZE(nvec_devices), base, 0, NULL); 841 841 if (ret) 842 842 dev_err(nvec->dev, "error adding subdevices\n"); 843 843
+3 -1
include/linux/mfd/core.h
··· 16 16 17 17 #include <linux/platform_device.h> 18 18 19 + struct irq_domain; 20 + 19 21 /* 20 22 * This struct describes the MFD part ("cell"). 21 23 * After registration the copy of this structure will become the platform data ··· 100 98 extern int mfd_add_devices(struct device *parent, int id, 101 99 struct mfd_cell *cells, int n_devs, 102 100 struct resource *mem_base, 103 - int irq_base); 101 + int irq_base, struct irq_domain *irq_domain); 104 102 105 103 extern void mfd_remove_devices(struct device *parent); 106 104
+9 -3
include/linux/mfd/tps65217.h
··· 22 22 #include <linux/regulator/driver.h> 23 23 #include <linux/regulator/machine.h> 24 24 25 + /* TPS chip id list */ 26 + #define TPS65217 0xF0 27 + 25 28 /* I2C ID for TPS65217 part */ 26 29 #define TPS65217_I2C_ID 0x24 27 30 ··· 251 248 struct tps65217 { 252 249 struct device *dev; 253 250 struct tps65217_board *pdata; 251 + unsigned int id; 254 252 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 255 253 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; 256 254 struct tps_info *info[TPS65217_NUM_REGULATOR]; 257 255 struct regmap *regmap; 258 - 259 - /* Client devices */ 260 - struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR]; 261 256 }; 262 257 263 258 static inline struct tps65217 *dev_to_tps65217(struct device *dev) 264 259 { 265 260 return dev_get_drvdata(dev); 261 + } 262 + 263 + static inline int tps65217_chip_id(struct tps65217 *tps65217) 264 + { 265 + return tps65217->id; 266 266 } 267 267 268 268 int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,