Commit 1841c0f2 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Liam Girdwood

regulator: da903x regulator bug fix

Changes the device registration part of the probe function to supply the
regulator device rather than its parent (the mfd device) as this caused
problems when the regulator core attempted to find constraints associated
with the regulators.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Acked-by: default avatarEric Miao <eric.miao@marvell.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent f49d81a8
...@@ -79,6 +79,11 @@ struct da903x_regulator_info { ...@@ -79,6 +79,11 @@ struct da903x_regulator_info {
int enable_bit; int enable_bit;
}; };
static inline struct device *to_da903x_dev(struct regulator_dev *rdev)
{
return rdev_get_dev(rdev)->parent->parent;
}
static inline int check_range(struct da903x_regulator_info *info, static inline int check_range(struct da903x_regulator_info *info,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
...@@ -93,7 +98,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev, ...@@ -93,7 +98,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
if (check_range(info, min_uV, max_uV)) { if (check_range(info, min_uV, max_uV)) {
...@@ -111,7 +116,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev, ...@@ -111,7 +116,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev,
static int da903x_get_voltage(struct regulator_dev *rdev) static int da903x_get_voltage(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int ret; int ret;
...@@ -128,7 +133,7 @@ static int da903x_get_voltage(struct regulator_dev *rdev) ...@@ -128,7 +133,7 @@ static int da903x_get_voltage(struct regulator_dev *rdev)
static int da903x_enable(struct regulator_dev *rdev) static int da903x_enable(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
return da903x_set_bits(da9034_dev, info->enable_reg, return da903x_set_bits(da9034_dev, info->enable_reg,
1 << info->enable_bit); 1 << info->enable_bit);
...@@ -137,7 +142,7 @@ static int da903x_enable(struct regulator_dev *rdev) ...@@ -137,7 +142,7 @@ static int da903x_enable(struct regulator_dev *rdev)
static int da903x_disable(struct regulator_dev *rdev) static int da903x_disable(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
return da903x_clr_bits(da9034_dev, info->enable_reg, return da903x_clr_bits(da9034_dev, info->enable_reg,
1 << info->enable_bit); 1 << info->enable_bit);
...@@ -146,7 +151,7 @@ static int da903x_disable(struct regulator_dev *rdev) ...@@ -146,7 +151,7 @@ static int da903x_disable(struct regulator_dev *rdev)
static int da903x_is_enabled(struct regulator_dev *rdev) static int da903x_is_enabled(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t reg_val; uint8_t reg_val;
int ret; int ret;
...@@ -162,7 +167,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, ...@@ -162,7 +167,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da903x_dev = rdev_get_dev(rdev)->parent; struct device *da903x_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int ret; int ret;
...@@ -189,7 +194,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, ...@@ -189,7 +194,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da903x_dev = rdev_get_dev(rdev)->parent; struct device *da903x_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int thresh; int thresh;
...@@ -215,7 +220,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, ...@@ -215,7 +220,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev,
static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) static int da9030_get_ldo14_voltage(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da903x_dev = rdev_get_dev(rdev)->parent; struct device *da903x_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int ret; int ret;
...@@ -238,7 +243,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev, ...@@ -238,7 +243,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int ret; int ret;
...@@ -264,7 +269,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, ...@@ -264,7 +269,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV) int min_uV, int max_uV)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
if (check_range(info, min_uV, max_uV)) { if (check_range(info, min_uV, max_uV)) {
...@@ -283,7 +288,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, ...@@ -283,7 +288,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev,
static int da9034_get_ldo12_voltage(struct regulator_dev *rdev) static int da9034_get_ldo12_voltage(struct regulator_dev *rdev)
{ {
struct da903x_regulator_info *info = rdev_get_drvdata(rdev); struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = rdev_get_dev(rdev)->parent; struct device *da9034_dev = to_da903x_dev(rdev);
uint8_t val, mask; uint8_t val, mask;
int ret; int ret;
...@@ -466,7 +471,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev) ...@@ -466,7 +471,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15) if (ri->desc.id == DA9030_ID_LDO1 || ri->desc.id == DA9030_ID_LDO15)
ri->desc.ops = &da9030_regulator_ldo1_15_ops; ri->desc.ops = &da9030_regulator_ldo1_15_ops;
rdev = regulator_register(&ri->desc, pdev->dev.parent, ri); rdev = regulator_register(&ri->desc, &pdev->dev, ri);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register regulator %s\n", dev_err(&pdev->dev, "failed to register regulator %s\n",
ri->desc.name); ri->desc.name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment