aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-dcdc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/wm831x-dcdc.c')
-rw-r--r--drivers/regulator/wm831x-dcdc.c174
1 files changed, 75 insertions, 99 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index ff810e787eac..a885911bb5fc 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -35,7 +35,7 @@
35#define WM831X_DCDC_MODE_IDLE 2 35#define WM831X_DCDC_MODE_IDLE 2
36#define WM831X_DCDC_MODE_STANDBY 3 36#define WM831X_DCDC_MODE_STANDBY 3
37 37
38#define WM831X_DCDC_MAX_NAME 6 38#define WM831X_DCDC_MAX_NAME 9
39 39
40/* Register offsets in control block */ 40/* Register offsets in control block */
41#define WM831X_DCDC_CONTROL_1 0 41#define WM831X_DCDC_CONTROL_1 0
@@ -50,6 +50,7 @@
50 50
51struct wm831x_dcdc { 51struct wm831x_dcdc {
52 char name[WM831X_DCDC_MAX_NAME]; 52 char name[WM831X_DCDC_MAX_NAME];
53 char supply_name[WM831X_DCDC_MAX_NAME];
53 struct regulator_desc desc; 54 struct regulator_desc desc;
54 int base; 55 int base;
55 struct wm831x *wm831x; 56 struct wm831x *wm831x;
@@ -60,41 +61,6 @@ struct wm831x_dcdc {
60 int dvs_vsel; 61 int dvs_vsel;
61}; 62};
62 63
63static int wm831x_dcdc_is_enabled(struct regulator_dev *rdev)
64{
65 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
66 struct wm831x *wm831x = dcdc->wm831x;
67 int mask = 1 << rdev_get_id(rdev);
68 int reg;
69
70 reg = wm831x_reg_read(wm831x, WM831X_DCDC_ENABLE);
71 if (reg < 0)
72 return reg;
73
74 if (reg & mask)
75 return 1;
76 else
77 return 0;
78}
79
80static int wm831x_dcdc_enable(struct regulator_dev *rdev)
81{
82 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
83 struct wm831x *wm831x = dcdc->wm831x;
84 int mask = 1 << rdev_get_id(rdev);
85
86 return wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, mask, mask);
87}
88
89static int wm831x_dcdc_disable(struct regulator_dev *rdev)
90{
91 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
92 struct wm831x *wm831x = dcdc->wm831x;
93 int mask = 1 << rdev_get_id(rdev);
94
95 return wm831x_set_bits(wm831x, WM831X_DCDC_ENABLE, mask, 0);
96}
97
98static unsigned int wm831x_dcdc_get_mode(struct regulator_dev *rdev) 64static unsigned int wm831x_dcdc_get_mode(struct regulator_dev *rdev)
99 65
100{ 66{
@@ -414,9 +380,9 @@ static struct regulator_ops wm831x_buckv_ops = {
414 .set_current_limit = wm831x_buckv_set_current_limit, 380 .set_current_limit = wm831x_buckv_set_current_limit,
415 .get_current_limit = wm831x_buckv_get_current_limit, 381 .get_current_limit = wm831x_buckv_get_current_limit,
416 382
417 .is_enabled = wm831x_dcdc_is_enabled, 383 .is_enabled = regulator_is_enabled_regmap,
418 .enable = wm831x_dcdc_enable, 384 .enable = regulator_enable_regmap,
419 .disable = wm831x_dcdc_disable, 385 .disable = regulator_disable_regmap,
420 .get_status = wm831x_dcdc_get_status, 386 .get_status = wm831x_dcdc_get_status,
421 .get_mode = wm831x_dcdc_get_mode, 387 .get_mode = wm831x_dcdc_get_mode,
422 .set_mode = wm831x_dcdc_set_mode, 388 .set_mode = wm831x_dcdc_set_mode,
@@ -437,23 +403,17 @@ static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
437 if (!pdata || !pdata->dvs_gpio) 403 if (!pdata || !pdata->dvs_gpio)
438 return; 404 return;
439 405
440 ret = gpio_request(pdata->dvs_gpio, "DCDC DVS");
441 if (ret < 0) {
442 dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
443 dcdc->name, ret);
444 return;
445 }
446
447 /* gpiolib won't let us read the GPIO status so pick the higher 406 /* gpiolib won't let us read the GPIO status so pick the higher
448 * of the two existing voltages so we take it as platform data. 407 * of the two existing voltages so we take it as platform data.
449 */ 408 */
450 dcdc->dvs_gpio_state = pdata->dvs_init_state; 409 dcdc->dvs_gpio_state = pdata->dvs_init_state;
451 410
452 ret = gpio_direction_output(pdata->dvs_gpio, dcdc->dvs_gpio_state); 411 ret = gpio_request_one(pdata->dvs_gpio,
412 dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0,
413 "DCDC DVS");
453 if (ret < 0) { 414 if (ret < 0) {
454 dev_err(wm831x->dev, "Failed to enable %s DVS GPIO: %d\n", 415 dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
455 dcdc->name, ret); 416 dcdc->name, ret);
456 gpio_free(pdata->dvs_gpio);
457 return; 417 return;
458 } 418 }
459 419
@@ -498,6 +458,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
498{ 458{
499 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 459 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
500 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 460 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
461 struct regulator_config config = { };
501 int id; 462 int id;
502 struct wm831x_dcdc *dcdc; 463 struct wm831x_dcdc *dcdc;
503 struct resource *res; 464 struct resource *res;
@@ -511,9 +472,6 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
511 472
512 dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); 473 dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1);
513 474
514 if (pdata == NULL || pdata->dcdc[id] == NULL)
515 return -ENODEV;
516
517 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), 475 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc),
518 GFP_KERNEL); 476 GFP_KERNEL);
519 if (dcdc == NULL) { 477 if (dcdc == NULL) {
@@ -533,11 +491,18 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
533 491
534 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1); 492 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1);
535 dcdc->desc.name = dcdc->name; 493 dcdc->desc.name = dcdc->name;
494
495 snprintf(dcdc->supply_name, sizeof(dcdc->supply_name),
496 "DC%dVDD", id + 1);
497 dcdc->desc.supply_name = dcdc->supply_name;
498
536 dcdc->desc.id = id; 499 dcdc->desc.id = id;
537 dcdc->desc.type = REGULATOR_VOLTAGE; 500 dcdc->desc.type = REGULATOR_VOLTAGE;
538 dcdc->desc.n_voltages = WM831X_BUCKV_MAX_SELECTOR + 1; 501 dcdc->desc.n_voltages = WM831X_BUCKV_MAX_SELECTOR + 1;
539 dcdc->desc.ops = &wm831x_buckv_ops; 502 dcdc->desc.ops = &wm831x_buckv_ops;
540 dcdc->desc.owner = THIS_MODULE; 503 dcdc->desc.owner = THIS_MODULE;
504 dcdc->desc.enable_reg = WM831X_DCDC_ENABLE;
505 dcdc->desc.enable_mask = 1 << id;
541 506
542 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG); 507 ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG);
543 if (ret < 0) { 508 if (ret < 0) {
@@ -553,11 +518,16 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
553 } 518 }
554 dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK; 519 dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK;
555 520
556 if (pdata->dcdc[id]) 521 if (pdata && pdata->dcdc[id])
557 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); 522 wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data);
558 523
559 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 524 config.dev = pdev->dev.parent;
560 pdata->dcdc[id], dcdc, NULL); 525 if (pdata)
526 config.init_data = pdata->dcdc[id];
527 config.driver_data = dcdc;
528 config.regmap = wm831x->regmap;
529
530 dcdc->regulator = regulator_register(&dcdc->desc, &config);
561 if (IS_ERR(dcdc->regulator)) { 531 if (IS_ERR(dcdc->regulator)) {
562 ret = PTR_ERR(dcdc->regulator); 532 ret = PTR_ERR(dcdc->regulator);
563 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 533 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -675,29 +645,15 @@ static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev,
675 return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector); 645 return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector);
676} 646}
677 647
678static int wm831x_buckp_get_voltage_sel(struct regulator_dev *rdev)
679{
680 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
681 struct wm831x *wm831x = dcdc->wm831x;
682 u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
683 int val;
684
685 val = wm831x_reg_read(wm831x, reg);
686 if (val < 0)
687 return val;
688
689 return val & WM831X_DC3_ON_VSEL_MASK;
690}
691
692static struct regulator_ops wm831x_buckp_ops = { 648static struct regulator_ops wm831x_buckp_ops = {
693 .set_voltage = wm831x_buckp_set_voltage, 649 .set_voltage = wm831x_buckp_set_voltage,
694 .get_voltage_sel = wm831x_buckp_get_voltage_sel, 650 .get_voltage_sel = regulator_get_voltage_sel_regmap,
695 .list_voltage = wm831x_buckp_list_voltage, 651 .list_voltage = wm831x_buckp_list_voltage,
696 .set_suspend_voltage = wm831x_buckp_set_suspend_voltage, 652 .set_suspend_voltage = wm831x_buckp_set_suspend_voltage,
697 653
698 .is_enabled = wm831x_dcdc_is_enabled, 654 .is_enabled = regulator_is_enabled_regmap,
699 .enable = wm831x_dcdc_enable, 655 .enable = regulator_enable_regmap,
700 .disable = wm831x_dcdc_disable, 656 .disable = regulator_disable_regmap,
701 .get_status = wm831x_dcdc_get_status, 657 .get_status = wm831x_dcdc_get_status,
702 .get_mode = wm831x_dcdc_get_mode, 658 .get_mode = wm831x_dcdc_get_mode,
703 .set_mode = wm831x_dcdc_set_mode, 659 .set_mode = wm831x_dcdc_set_mode,
@@ -708,6 +664,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
708{ 664{
709 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 665 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
710 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 666 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
667 struct regulator_config config = { };
711 int id; 668 int id;
712 struct wm831x_dcdc *dcdc; 669 struct wm831x_dcdc *dcdc;
713 struct resource *res; 670 struct resource *res;
@@ -721,9 +678,6 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
721 678
722 dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); 679 dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1);
723 680
724 if (pdata == NULL || pdata->dcdc[id] == NULL)
725 return -ENODEV;
726
727 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), 681 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc),
728 GFP_KERNEL); 682 GFP_KERNEL);
729 if (dcdc == NULL) { 683 if (dcdc == NULL) {
@@ -743,14 +697,28 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
743 697
744 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1); 698 snprintf(dcdc->name, sizeof(dcdc->name), "DCDC%d", id + 1);
745 dcdc->desc.name = dcdc->name; 699 dcdc->desc.name = dcdc->name;
700
701 snprintf(dcdc->supply_name, sizeof(dcdc->supply_name),
702 "DC%dVDD", id + 1);
703 dcdc->desc.supply_name = dcdc->supply_name;
704
746 dcdc->desc.id = id; 705 dcdc->desc.id = id;
747 dcdc->desc.type = REGULATOR_VOLTAGE; 706 dcdc->desc.type = REGULATOR_VOLTAGE;
748 dcdc->desc.n_voltages = WM831X_BUCKP_MAX_SELECTOR + 1; 707 dcdc->desc.n_voltages = WM831X_BUCKP_MAX_SELECTOR + 1;
749 dcdc->desc.ops = &wm831x_buckp_ops; 708 dcdc->desc.ops = &wm831x_buckp_ops;
750 dcdc->desc.owner = THIS_MODULE; 709 dcdc->desc.owner = THIS_MODULE;
751 710 dcdc->desc.vsel_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
752 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 711 dcdc->desc.vsel_mask = WM831X_DC3_ON_VSEL_MASK;
753 pdata->dcdc[id], dcdc, NULL); 712 dcdc->desc.enable_reg = WM831X_DCDC_ENABLE;
713 dcdc->desc.enable_mask = 1 << id;
714
715 config.dev = pdev->dev.parent;
716 if (pdata)
717 config.init_data = pdata->dcdc[id];
718 config.driver_data = dcdc;
719 config.regmap = wm831x->regmap;
720
721 dcdc->regulator = regulator_register(&dcdc->desc, &config);
754 if (IS_ERR(dcdc->regulator)) { 722 if (IS_ERR(dcdc->regulator)) {
755 ret = PTR_ERR(dcdc->regulator); 723 ret = PTR_ERR(dcdc->regulator);
756 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 724 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -832,15 +800,16 @@ static int wm831x_boostp_get_status(struct regulator_dev *rdev)
832static struct regulator_ops wm831x_boostp_ops = { 800static struct regulator_ops wm831x_boostp_ops = {
833 .get_status = wm831x_boostp_get_status, 801 .get_status = wm831x_boostp_get_status,
834 802
835 .is_enabled = wm831x_dcdc_is_enabled, 803 .is_enabled = regulator_is_enabled_regmap,
836 .enable = wm831x_dcdc_enable, 804 .enable = regulator_enable_regmap,
837 .disable = wm831x_dcdc_disable, 805 .disable = regulator_disable_regmap,
838}; 806};
839 807
840static __devinit int wm831x_boostp_probe(struct platform_device *pdev) 808static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
841{ 809{
842 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 810 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
843 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 811 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
812 struct regulator_config config = { };
844 int id = pdev->id % ARRAY_SIZE(pdata->dcdc); 813 int id = pdev->id % ARRAY_SIZE(pdata->dcdc);
845 struct wm831x_dcdc *dcdc; 814 struct wm831x_dcdc *dcdc;
846 struct resource *res; 815 struct resource *res;
@@ -851,7 +820,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
851 if (pdata == NULL || pdata->dcdc[id] == NULL) 820 if (pdata == NULL || pdata->dcdc[id] == NULL)
852 return -ENODEV; 821 return -ENODEV;
853 822
854 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); 823 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
855 if (dcdc == NULL) { 824 if (dcdc == NULL) {
856 dev_err(&pdev->dev, "Unable to allocate private data\n"); 825 dev_err(&pdev->dev, "Unable to allocate private data\n");
857 return -ENOMEM; 826 return -ENOMEM;
@@ -873,9 +842,16 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
873 dcdc->desc.type = REGULATOR_VOLTAGE; 842 dcdc->desc.type = REGULATOR_VOLTAGE;
874 dcdc->desc.ops = &wm831x_boostp_ops; 843 dcdc->desc.ops = &wm831x_boostp_ops;
875 dcdc->desc.owner = THIS_MODULE; 844 dcdc->desc.owner = THIS_MODULE;
845 dcdc->desc.enable_reg = WM831X_DCDC_ENABLE;
846 dcdc->desc.enable_mask = 1 << id;
876 847
877 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 848 config.dev = pdev->dev.parent;
878 pdata->dcdc[id], dcdc, NULL); 849 if (pdata)
850 config.init_data = pdata->dcdc[id];
851 config.driver_data = dcdc;
852 config.regmap = wm831x->regmap;
853
854 dcdc->regulator = regulator_register(&dcdc->desc, &config);
879 if (IS_ERR(dcdc->regulator)) { 855 if (IS_ERR(dcdc->regulator)) {
880 ret = PTR_ERR(dcdc->regulator); 856 ret = PTR_ERR(dcdc->regulator);
881 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", 857 dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n",
@@ -900,7 +876,6 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
900err_regulator: 876err_regulator:
901 regulator_unregister(dcdc->regulator); 877 regulator_unregister(dcdc->regulator);
902err: 878err:
903 kfree(dcdc);
904 return ret; 879 return ret;
905} 880}
906 881
@@ -912,7 +887,6 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev)
912 887
913 free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 888 free_irq(platform_get_irq_byname(pdev, "UV"), dcdc);
914 regulator_unregister(dcdc->regulator); 889 regulator_unregister(dcdc->regulator);
915 kfree(dcdc);
916 890
917 return 0; 891 return 0;
918} 892}
@@ -936,9 +910,9 @@ static struct platform_driver wm831x_boostp_driver = {
936#define WM831X_EPE_BASE 6 910#define WM831X_EPE_BASE 6
937 911
938static struct regulator_ops wm831x_epe_ops = { 912static struct regulator_ops wm831x_epe_ops = {
939 .is_enabled = wm831x_dcdc_is_enabled, 913 .is_enabled = regulator_is_enabled_regmap,
940 .enable = wm831x_dcdc_enable, 914 .enable = regulator_enable_regmap,
941 .disable = wm831x_dcdc_disable, 915 .disable = regulator_disable_regmap,
942 .get_status = wm831x_dcdc_get_status, 916 .get_status = wm831x_dcdc_get_status,
943}; 917};
944 918
@@ -946,16 +920,14 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
946{ 920{
947 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); 921 struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
948 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 922 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
923 struct regulator_config config = { };
949 int id = pdev->id % ARRAY_SIZE(pdata->epe); 924 int id = pdev->id % ARRAY_SIZE(pdata->epe);
950 struct wm831x_dcdc *dcdc; 925 struct wm831x_dcdc *dcdc;
951 int ret; 926 int ret;
952 927
953 dev_dbg(&pdev->dev, "Probing EPE%d\n", id + 1); 928 dev_dbg(&pdev->dev, "Probing EPE%d\n", id + 1);
954 929
955 if (pdata == NULL || pdata->epe[id] == NULL) 930 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
956 return -ENODEV;
957
958 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL);
959 if (dcdc == NULL) { 931 if (dcdc == NULL) {
960 dev_err(&pdev->dev, "Unable to allocate private data\n"); 932 dev_err(&pdev->dev, "Unable to allocate private data\n");
961 return -ENOMEM; 933 return -ENOMEM;
@@ -972,9 +944,16 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
972 dcdc->desc.ops = &wm831x_epe_ops; 944 dcdc->desc.ops = &wm831x_epe_ops;
973 dcdc->desc.type = REGULATOR_VOLTAGE; 945 dcdc->desc.type = REGULATOR_VOLTAGE;
974 dcdc->desc.owner = THIS_MODULE; 946 dcdc->desc.owner = THIS_MODULE;
947 dcdc->desc.enable_reg = WM831X_DCDC_ENABLE;
948 dcdc->desc.enable_mask = 1 << dcdc->desc.id;
949
950 config.dev = pdev->dev.parent;
951 if (pdata)
952 config.init_data = pdata->epe[id];
953 config.driver_data = dcdc;
954 config.regmap = wm831x->regmap;
975 955
976 dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, 956 dcdc->regulator = regulator_register(&dcdc->desc, &config);
977 pdata->epe[id], dcdc, NULL);
978 if (IS_ERR(dcdc->regulator)) { 957 if (IS_ERR(dcdc->regulator)) {
979 ret = PTR_ERR(dcdc->regulator); 958 ret = PTR_ERR(dcdc->regulator);
980 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n", 959 dev_err(wm831x->dev, "Failed to register EPE%d: %d\n",
@@ -987,7 +966,6 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
987 return 0; 966 return 0;
988 967
989err: 968err:
990 kfree(dcdc);
991 return ret; 969 return ret;
992} 970}
993 971
@@ -996,9 +974,7 @@ static __devexit int wm831x_epe_remove(struct platform_device *pdev)
996 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); 974 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
997 975
998 platform_set_drvdata(pdev, NULL); 976 platform_set_drvdata(pdev, NULL);
999
1000 regulator_unregister(dcdc->regulator); 977 regulator_unregister(dcdc->regulator);
1001 kfree(dcdc);
1002 978
1003 return 0; 979 return 0;
1004} 980}