diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/regulator/tps65912-regulator.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/tps65912-regulator.c')
-rw-r--r-- | drivers/regulator/tps65912-regulator.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c index 9cafaa0..281e52a 100644 --- a/drivers/regulator/tps65912-regulator.c +++ b/drivers/regulator/tps65912-regulator.c @@ -119,9 +119,12 @@ struct tps65912_reg { }; static const struct regulator_linear_range tps65912_ldo_ranges[] = { - REGULATOR_LINEAR_RANGE(800000, 0, 32, 25000), - REGULATOR_LINEAR_RANGE(1650000, 33, 60, 50000), - REGULATOR_LINEAR_RANGE(3100000, 61, 63, 100000), + { .min_uV = 800000, .max_uV = 1600000, .min_sel = 0, .max_sel = 32, + .uV_step = 25000 }, + { .min_uV = 1650000, .max_uV = 3000000, .min_sel = 33, .max_sel = 60, + .uV_step = 50000 }, + { .min_uV = 3100000, .max_uV = 3300000, .min_sel = 61, .max_sel = 63, + .uV_step = 100000 }, }; static int tps65912_get_range(struct tps65912_reg *pmic, int id) @@ -458,7 +461,7 @@ static int tps65912_probe(struct platform_device *pdev) struct regulator_dev *rdev; struct tps65912_reg *pmic; struct tps65912_board *pmic_plat_data; - int i; + int i, err; pmic_plat_data = dev_get_platdata(tps65912->dev); if (!pmic_plat_data) @@ -501,19 +504,34 @@ static int tps65912_probe(struct platform_device *pdev) config.init_data = reg_data; config.driver_data = pmic; - rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i], - &config); + rdev = regulator_register(&pmic->desc[i], &config); if (IS_ERR(rdev)) { dev_err(tps65912->dev, "failed to register %s regulator\n", pdev->name); - return PTR_ERR(rdev); + err = PTR_ERR(rdev); + goto err; } /* Save regulator for cleanup */ pmic->rdev[i] = rdev; } return 0; + +err: + while (--i >= 0) + regulator_unregister(pmic->rdev[i]); + return err; +} + +static int tps65912_remove(struct platform_device *pdev) +{ + struct tps65912_reg *tps65912_reg = platform_get_drvdata(pdev); + int i; + + for (i = 0; i < TPS65912_NUM_REGULATOR; i++) + regulator_unregister(tps65912_reg->rdev[i]); + return 0; } static struct platform_driver tps65912_driver = { @@ -522,6 +540,7 @@ static struct platform_driver tps65912_driver = { .owner = THIS_MODULE, }, .probe = tps65912_probe, + .remove = tps65912_remove, }; static int __init tps65912_init(void) |