aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/qcom_rpm-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/qcom_rpm-regulator.c')
-rw-r--r--drivers/regulator/qcom_rpm-regulator.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c
index 8364ff331a81..e8647f7cf25e 100644
--- a/drivers/regulator/qcom_rpm-regulator.c
+++ b/drivers/regulator/qcom_rpm-regulator.c
@@ -227,9 +227,11 @@ static int rpm_reg_set_mV_sel(struct regulator_dev *rdev,
227 return uV; 227 return uV;
228 228
229 mutex_lock(&vreg->lock); 229 mutex_lock(&vreg->lock);
230 vreg->uV = uV;
231 if (vreg->is_enabled) 230 if (vreg->is_enabled)
232 ret = rpm_reg_write(vreg, req, vreg->uV / 1000); 231 ret = rpm_reg_write(vreg, req, uV / 1000);
232
233 if (!ret)
234 vreg->uV = uV;
233 mutex_unlock(&vreg->lock); 235 mutex_unlock(&vreg->lock);
234 236
235 return ret; 237 return ret;
@@ -252,9 +254,11 @@ static int rpm_reg_set_uV_sel(struct regulator_dev *rdev,
252 return uV; 254 return uV;
253 255
254 mutex_lock(&vreg->lock); 256 mutex_lock(&vreg->lock);
255 vreg->uV = uV;
256 if (vreg->is_enabled) 257 if (vreg->is_enabled)
257 ret = rpm_reg_write(vreg, req, vreg->uV); 258 ret = rpm_reg_write(vreg, req, uV);
259
260 if (!ret)
261 vreg->uV = uV;
258 mutex_unlock(&vreg->lock); 262 mutex_unlock(&vreg->lock);
259 263
260 return ret; 264 return ret;
@@ -674,6 +678,7 @@ static int rpm_reg_probe(struct platform_device *pdev)
674 vreg->desc.owner = THIS_MODULE; 678 vreg->desc.owner = THIS_MODULE;
675 vreg->desc.type = REGULATOR_VOLTAGE; 679 vreg->desc.type = REGULATOR_VOLTAGE;
676 vreg->desc.name = pdev->dev.of_node->name; 680 vreg->desc.name = pdev->dev.of_node->name;
681 vreg->desc.supply_name = "vin";
677 682
678 vreg->rpm = dev_get_drvdata(pdev->dev.parent); 683 vreg->rpm = dev_get_drvdata(pdev->dev.parent);
679 if (!vreg->rpm) { 684 if (!vreg->rpm) {
@@ -768,7 +773,7 @@ static int rpm_reg_probe(struct platform_device *pdev)
768 break; 773 break;
769 } 774 }
770 775
771 if (force_mode < 0) { 776 if (force_mode == -1) {
772 dev_err(&pdev->dev, "invalid force mode\n"); 777 dev_err(&pdev->dev, "invalid force mode\n");
773 return -EINVAL; 778 return -EINVAL;
774 } 779 }