diff options
-rw-r--r-- | Documentation/power/regulator/consumer.txt | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/edp/edp_ctrl.c | 6 | ||||
-rw-r--r-- | drivers/phy/phy-qcom-ufs.c | 4 | ||||
-rw-r--r-- | drivers/regulator/core.c | 8 | ||||
-rw-r--r-- | drivers/regulator/devres.c | 85 | ||||
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 11 | ||||
-rw-r--r-- | drivers/regulator/qcom_rpm-regulator.c | 290 | ||||
-rw-r--r-- | drivers/regulator/stw481x-vmmc.c | 8 | ||||
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 27 | ||||
-rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 4 | ||||
-rw-r--r-- | drivers/usb/phy/phy-msm-usb.c | 15 | ||||
-rw-r--r-- | include/linux/mfd/palmas.h | 1 | ||||
-rw-r--r-- | include/linux/mfd/stw481x.h | 4 | ||||
-rw-r--r-- | include/linux/regulator/consumer.h | 21 |
14 files changed, 334 insertions, 152 deletions
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt index 8afb236ca765..e51564c1a140 100644 --- a/Documentation/power/regulator/consumer.txt +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -137,7 +137,7 @@ Indirect operating mode control. | |||
137 | Consumer drivers can request a change in their supply regulator operating mode | 137 | Consumer drivers can request a change in their supply regulator operating mode |
138 | by calling :- | 138 | by calling :- |
139 | 139 | ||
140 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | 140 | int regulator_set_load(struct regulator *regulator, int load_uA); |
141 | 141 | ||
142 | This will cause the core to recalculate the total load on the regulator (based | 142 | This will cause the core to recalculate the total load on the regulator (based |
143 | on all its consumers) and change operating mode (if necessary and permitted) | 143 | on all its consumers) and change operating mode (if necessary and permitted) |
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c index 3e246210c46f..0ec5abdba5c4 100644 --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c | |||
@@ -332,7 +332,7 @@ static int edp_regulator_enable(struct edp_ctrl *ctrl) | |||
332 | goto vdda_set_fail; | 332 | goto vdda_set_fail; |
333 | } | 333 | } |
334 | 334 | ||
335 | ret = regulator_set_optimum_mode(ctrl->vdda_vreg, VDDA_UA_ON_LOAD); | 335 | ret = regulator_set_load(ctrl->vdda_vreg, VDDA_UA_ON_LOAD); |
336 | if (ret < 0) { | 336 | if (ret < 0) { |
337 | pr_err("%s: vdda_vreg set regulator mode failed.\n", __func__); | 337 | pr_err("%s: vdda_vreg set regulator mode failed.\n", __func__); |
338 | goto vdda_set_fail; | 338 | goto vdda_set_fail; |
@@ -356,7 +356,7 @@ static int edp_regulator_enable(struct edp_ctrl *ctrl) | |||
356 | lvl_enable_fail: | 356 | lvl_enable_fail: |
357 | regulator_disable(ctrl->vdda_vreg); | 357 | regulator_disable(ctrl->vdda_vreg); |
358 | vdda_enable_fail: | 358 | vdda_enable_fail: |
359 | regulator_set_optimum_mode(ctrl->vdda_vreg, VDDA_UA_OFF_LOAD); | 359 | regulator_set_load(ctrl->vdda_vreg, VDDA_UA_OFF_LOAD); |
360 | vdda_set_fail: | 360 | vdda_set_fail: |
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
@@ -365,7 +365,7 @@ static void edp_regulator_disable(struct edp_ctrl *ctrl) | |||
365 | { | 365 | { |
366 | regulator_disable(ctrl->lvl_vreg); | 366 | regulator_disable(ctrl->lvl_vreg); |
367 | regulator_disable(ctrl->vdda_vreg); | 367 | regulator_disable(ctrl->vdda_vreg); |
368 | regulator_set_optimum_mode(ctrl->vdda_vreg, VDDA_UA_OFF_LOAD); | 368 | regulator_set_load(ctrl->vdda_vreg, VDDA_UA_OFF_LOAD); |
369 | } | 369 | } |
370 | 370 | ||
371 | static int edp_gpio_config(struct edp_ctrl *ctrl) | 371 | static int edp_gpio_config(struct edp_ctrl *ctrl) |
diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c index 44ee983d57fe..86665e9dc399 100644 --- a/drivers/phy/phy-qcom-ufs.c +++ b/drivers/phy/phy-qcom-ufs.c | |||
@@ -346,10 +346,10 @@ int ufs_qcom_phy_cfg_vreg(struct phy *phy, | |||
346 | goto out; | 346 | goto out; |
347 | } | 347 | } |
348 | uA_load = on ? vreg->max_uA : 0; | 348 | uA_load = on ? vreg->max_uA : 0; |
349 | ret = regulator_set_optimum_mode(reg, uA_load); | 349 | ret = regulator_set_load(reg, uA_load); |
350 | if (ret >= 0) { | 350 | if (ret >= 0) { |
351 | /* | 351 | /* |
352 | * regulator_set_optimum_mode() returns new regulator | 352 | * regulator_set_load() returns new regulator |
353 | * mode upon success. | 353 | * mode upon success. |
354 | */ | 354 | */ |
355 | ret = 0; | 355 | ret = 0; |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e23fd00ec5e2..443eaab933fc 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3061,7 +3061,7 @@ unsigned int regulator_get_mode(struct regulator *regulator) | |||
3061 | EXPORT_SYMBOL_GPL(regulator_get_mode); | 3061 | EXPORT_SYMBOL_GPL(regulator_get_mode); |
3062 | 3062 | ||
3063 | /** | 3063 | /** |
3064 | * regulator_set_optimum_mode - set regulator optimum operating mode | 3064 | * regulator_set_load - set regulator load |
3065 | * @regulator: regulator source | 3065 | * @regulator: regulator source |
3066 | * @uA_load: load current | 3066 | * @uA_load: load current |
3067 | * | 3067 | * |
@@ -3084,9 +3084,9 @@ EXPORT_SYMBOL_GPL(regulator_get_mode); | |||
3084 | * DRMS will sum the total requested load on the regulator and change | 3084 | * DRMS will sum the total requested load on the regulator and change |
3085 | * to the most efficient operating mode if platform constraints allow. | 3085 | * to the most efficient operating mode if platform constraints allow. |
3086 | * | 3086 | * |
3087 | * Returns the new regulator mode or error. | 3087 | * On error a negative errno is returned. |
3088 | */ | 3088 | */ |
3089 | int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | 3089 | int regulator_set_load(struct regulator *regulator, int uA_load) |
3090 | { | 3090 | { |
3091 | struct regulator_dev *rdev = regulator->rdev; | 3091 | struct regulator_dev *rdev = regulator->rdev; |
3092 | int ret; | 3092 | int ret; |
@@ -3098,7 +3098,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
3098 | 3098 | ||
3099 | return ret; | 3099 | return ret; |
3100 | } | 3100 | } |
3101 | EXPORT_SYMBOL_GPL(regulator_set_optimum_mode); | 3101 | EXPORT_SYMBOL_GPL(regulator_set_load); |
3102 | 3102 | ||
3103 | /** | 3103 | /** |
3104 | * regulator_allow_bypass - allow the regulator to go into bypass mode | 3104 | * regulator_allow_bypass - allow the regulator to go into bypass mode |
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index 8f785bc9e510..6ec1d400adae 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c | |||
@@ -413,3 +413,88 @@ void devm_regulator_bulk_unregister_supply_alias(struct device *dev, | |||
413 | devm_regulator_unregister_supply_alias(dev, id[i]); | 413 | devm_regulator_unregister_supply_alias(dev, id[i]); |
414 | } | 414 | } |
415 | EXPORT_SYMBOL_GPL(devm_regulator_bulk_unregister_supply_alias); | 415 | EXPORT_SYMBOL_GPL(devm_regulator_bulk_unregister_supply_alias); |
416 | |||
417 | struct regulator_notifier_match { | ||
418 | struct regulator *regulator; | ||
419 | struct notifier_block *nb; | ||
420 | }; | ||
421 | |||
422 | static int devm_regulator_match_notifier(struct device *dev, void *res, | ||
423 | void *data) | ||
424 | { | ||
425 | struct regulator_notifier_match *match = res; | ||
426 | struct regulator_notifier_match *target = data; | ||
427 | |||
428 | return match->regulator == target->regulator && match->nb == target->nb; | ||
429 | } | ||
430 | |||
431 | static void devm_regulator_destroy_notifier(struct device *dev, void *res) | ||
432 | { | ||
433 | struct regulator_notifier_match *match = res; | ||
434 | |||
435 | regulator_unregister_notifier(match->regulator, match->nb); | ||
436 | } | ||
437 | |||
438 | /** | ||
439 | * devm_regulator_register_notifier - Resource managed | ||
440 | * regulator_register_notifier | ||
441 | * | ||
442 | * @regulator: regulator source | ||
443 | * @nb: notifier block | ||
444 | * | ||
445 | * The notifier will be registers under the consumer device and be | ||
446 | * automatically be unregistered when the source device is unbound. | ||
447 | */ | ||
448 | int devm_regulator_register_notifier(struct regulator *regulator, | ||
449 | struct notifier_block *nb) | ||
450 | { | ||
451 | struct regulator_notifier_match *match; | ||
452 | int ret; | ||
453 | |||
454 | match = devres_alloc(devm_regulator_destroy_notifier, | ||
455 | sizeof(struct regulator_notifier_match), | ||
456 | GFP_KERNEL); | ||
457 | if (!match) | ||
458 | return -ENOMEM; | ||
459 | |||
460 | match->regulator = regulator; | ||
461 | match->nb = nb; | ||
462 | |||
463 | ret = regulator_register_notifier(regulator, nb); | ||
464 | if (ret < 0) { | ||
465 | devres_free(match); | ||
466 | return ret; | ||
467 | } | ||
468 | |||
469 | devres_add(regulator->dev, match); | ||
470 | |||
471 | return 0; | ||
472 | } | ||
473 | EXPORT_SYMBOL_GPL(devm_regulator_register_notifier); | ||
474 | |||
475 | /** | ||
476 | * devm_regulator_unregister_notifier - Resource managed | ||
477 | * regulator_unregister_notifier() | ||
478 | * | ||
479 | * @regulator: regulator source | ||
480 | * @nb: notifier block | ||
481 | * | ||
482 | * Unregister a notifier registered with devm_regulator_register_notifier(). | ||
483 | * Normally this function will not need to be called and the resource | ||
484 | * management code will ensure that the resource is freed. | ||
485 | */ | ||
486 | void devm_regulator_unregister_notifier(struct regulator *regulator, | ||
487 | struct notifier_block *nb) | ||
488 | { | ||
489 | struct regulator_notifier_match match; | ||
490 | int rc; | ||
491 | |||
492 | match.regulator = regulator; | ||
493 | match.nb = nb; | ||
494 | |||
495 | rc = devres_release(regulator->dev, devm_regulator_destroy_notifier, | ||
496 | devm_regulator_match_notifier, &match); | ||
497 | if (rc != 0) | ||
498 | WARN_ON(rc); | ||
499 | } | ||
500 | EXPORT_SYMBOL_GPL(devm_regulator_unregister_notifier); | ||
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 18198316b6cf..8217613807d3 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -916,6 +916,9 @@ static int palmas_ldo_registration(struct palmas_pmic *pmic, | |||
916 | (id == PALMAS_REG_LDO6)) | 916 | (id == PALMAS_REG_LDO6)) |
917 | desc->enable_time = 2000; | 917 | desc->enable_time = 2000; |
918 | } else { | 918 | } else { |
919 | if (!ddata->has_regen3 && id == PALMAS_REG_REGEN3) | ||
920 | continue; | ||
921 | |||
919 | desc->n_voltages = 1; | 922 | desc->n_voltages = 1; |
920 | if (reg_init && reg_init->roof_floor) | 923 | if (reg_init && reg_init->roof_floor) |
921 | desc->ops = &palmas_ops_ext_control_extreg; | 924 | desc->ops = &palmas_ops_ext_control_extreg; |
@@ -1398,6 +1401,7 @@ static struct palmas_pmic_driver_data palmas_ddata = { | |||
1398 | .ldo_begin = PALMAS_REG_LDO1, | 1401 | .ldo_begin = PALMAS_REG_LDO1, |
1399 | .ldo_end = PALMAS_REG_LDOUSB, | 1402 | .ldo_end = PALMAS_REG_LDOUSB, |
1400 | .max_reg = PALMAS_NUM_REGS, | 1403 | .max_reg = PALMAS_NUM_REGS, |
1404 | .has_regen3 = true, | ||
1401 | .palmas_regs_info = palmas_generic_regs_info, | 1405 | .palmas_regs_info = palmas_generic_regs_info, |
1402 | .palmas_matches = palmas_matches, | 1406 | .palmas_matches = palmas_matches, |
1403 | .sleep_req_info = palma_sleep_req_info, | 1407 | .sleep_req_info = palma_sleep_req_info, |
@@ -1411,6 +1415,7 @@ static struct palmas_pmic_driver_data tps65917_ddata = { | |||
1411 | .ldo_begin = TPS65917_REG_LDO1, | 1415 | .ldo_begin = TPS65917_REG_LDO1, |
1412 | .ldo_end = TPS65917_REG_LDO5, | 1416 | .ldo_end = TPS65917_REG_LDO5, |
1413 | .max_reg = TPS65917_NUM_REGS, | 1417 | .max_reg = TPS65917_NUM_REGS, |
1418 | .has_regen3 = true, | ||
1414 | .palmas_regs_info = tps65917_regs_info, | 1419 | .palmas_regs_info = tps65917_regs_info, |
1415 | .palmas_matches = tps65917_matches, | 1420 | .palmas_matches = tps65917_matches, |
1416 | .sleep_req_info = tps65917_sleep_req_info, | 1421 | .sleep_req_info = tps65917_sleep_req_info, |
@@ -1505,7 +1510,7 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
1505 | pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator"); | 1510 | pdata->ldo6_vibrator = of_property_read_bool(node, "ti,ldo6-vibrator"); |
1506 | } | 1511 | } |
1507 | 1512 | ||
1508 | static struct of_device_id of_palmas_match_tbl[] = { | 1513 | static const struct of_device_id of_palmas_match_tbl[] = { |
1509 | { | 1514 | { |
1510 | .compatible = "ti,palmas-pmic", | 1515 | .compatible = "ti,palmas-pmic", |
1511 | .data = &palmas_ddata, | 1516 | .data = &palmas_ddata, |
@@ -1572,9 +1577,11 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
1572 | if (!pmic) | 1577 | if (!pmic) |
1573 | return -ENOMEM; | 1578 | return -ENOMEM; |
1574 | 1579 | ||
1575 | if (of_device_is_compatible(node, "ti,tps659038-pmic")) | 1580 | if (of_device_is_compatible(node, "ti,tps659038-pmic")) { |
1576 | palmas_generic_regs_info[PALMAS_REG_REGEN2].ctrl_addr = | 1581 | palmas_generic_regs_info[PALMAS_REG_REGEN2].ctrl_addr = |
1577 | TPS659038_REGEN2_CTRL; | 1582 | TPS659038_REGEN2_CTRL; |
1583 | palmas_ddata.has_regen3 = false; | ||
1584 | } | ||
1578 | 1585 | ||
1579 | pmic->dev = &pdev->dev; | 1586 | pmic->dev = &pdev->dev; |
1580 | pmic->palmas = palmas; | 1587 | pmic->palmas = palmas; |
diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c index 15e07c233c1e..e254272585b2 100644 --- a/drivers/regulator/qcom_rpm-regulator.c +++ b/drivers/regulator/qcom_rpm-regulator.c | |||
@@ -607,31 +607,6 @@ static const struct qcom_rpm_reg smb208_smps = { | |||
607 | .supports_force_mode_bypass = false, | 607 | .supports_force_mode_bypass = false, |
608 | }; | 608 | }; |
609 | 609 | ||
610 | static const struct of_device_id rpm_of_match[] = { | ||
611 | { .compatible = "qcom,rpm-pm8058-pldo", .data = &pm8058_pldo }, | ||
612 | { .compatible = "qcom,rpm-pm8058-nldo", .data = &pm8058_nldo }, | ||
613 | { .compatible = "qcom,rpm-pm8058-smps", .data = &pm8058_smps }, | ||
614 | { .compatible = "qcom,rpm-pm8058-ncp", .data = &pm8058_ncp }, | ||
615 | { .compatible = "qcom,rpm-pm8058-switch", .data = &pm8058_switch }, | ||
616 | |||
617 | { .compatible = "qcom,rpm-pm8901-pldo", .data = &pm8901_pldo }, | ||
618 | { .compatible = "qcom,rpm-pm8901-nldo", .data = &pm8901_nldo }, | ||
619 | { .compatible = "qcom,rpm-pm8901-ftsmps", .data = &pm8901_ftsmps }, | ||
620 | { .compatible = "qcom,rpm-pm8901-switch", .data = &pm8901_switch }, | ||
621 | |||
622 | { .compatible = "qcom,rpm-pm8921-pldo", .data = &pm8921_pldo }, | ||
623 | { .compatible = "qcom,rpm-pm8921-nldo", .data = &pm8921_nldo }, | ||
624 | { .compatible = "qcom,rpm-pm8921-nldo1200", .data = &pm8921_nldo1200 }, | ||
625 | { .compatible = "qcom,rpm-pm8921-smps", .data = &pm8921_smps }, | ||
626 | { .compatible = "qcom,rpm-pm8921-ftsmps", .data = &pm8921_ftsmps }, | ||
627 | { .compatible = "qcom,rpm-pm8921-ncp", .data = &pm8921_ncp }, | ||
628 | { .compatible = "qcom,rpm-pm8921-switch", .data = &pm8921_switch }, | ||
629 | |||
630 | { .compatible = "qcom,rpm-smb208", .data = &smb208_smps }, | ||
631 | { } | ||
632 | }; | ||
633 | MODULE_DEVICE_TABLE(of, rpm_of_match); | ||
634 | |||
635 | static int rpm_reg_set(struct qcom_rpm_reg *vreg, | 610 | static int rpm_reg_set(struct qcom_rpm_reg *vreg, |
636 | const struct request_member *req, | 611 | const struct request_member *req, |
637 | const int value) | 612 | const int value) |
@@ -645,7 +620,9 @@ static int rpm_reg_set(struct qcom_rpm_reg *vreg, | |||
645 | return 0; | 620 | return 0; |
646 | } | 621 | } |
647 | 622 | ||
648 | static int rpm_reg_of_parse_freq(struct device *dev, struct qcom_rpm_reg *vreg) | 623 | static int rpm_reg_of_parse_freq(struct device *dev, |
624 | struct device_node *node, | ||
625 | struct qcom_rpm_reg *vreg) | ||
649 | { | 626 | { |
650 | static const int freq_table[] = { | 627 | static const int freq_table[] = { |
651 | 19200000, 9600000, 6400000, 4800000, 3840000, 3200000, 2740000, | 628 | 19200000, 9600000, 6400000, 4800000, 3840000, 3200000, 2740000, |
@@ -659,7 +636,7 @@ static int rpm_reg_of_parse_freq(struct device *dev, struct qcom_rpm_reg *vreg) | |||
659 | int i; | 636 | int i; |
660 | 637 | ||
661 | key = "qcom,switch-mode-frequency"; | 638 | key = "qcom,switch-mode-frequency"; |
662 | ret = of_property_read_u32(dev->of_node, key, &freq); | 639 | ret = of_property_read_u32(node, key, &freq); |
663 | if (ret) { | 640 | if (ret) { |
664 | dev_err(dev, "regulator requires %s property\n", key); | 641 | dev_err(dev, "regulator requires %s property\n", key); |
665 | return -EINVAL; | 642 | return -EINVAL; |
@@ -676,88 +653,40 @@ static int rpm_reg_of_parse_freq(struct device *dev, struct qcom_rpm_reg *vreg) | |||
676 | return -EINVAL; | 653 | return -EINVAL; |
677 | } | 654 | } |
678 | 655 | ||
679 | static int rpm_reg_probe(struct platform_device *pdev) | 656 | static int rpm_reg_of_parse(struct device_node *node, |
657 | const struct regulator_desc *desc, | ||
658 | struct regulator_config *config) | ||
680 | { | 659 | { |
681 | struct regulator_init_data *initdata; | 660 | struct qcom_rpm_reg *vreg = config->driver_data; |
682 | const struct qcom_rpm_reg *template; | 661 | struct device *dev = config->dev; |
683 | const struct of_device_id *match; | ||
684 | struct regulator_config config = { }; | ||
685 | struct regulator_dev *rdev; | ||
686 | struct qcom_rpm_reg *vreg; | ||
687 | const char *key; | 662 | const char *key; |
688 | u32 force_mode; | 663 | u32 force_mode; |
689 | bool pwm; | 664 | bool pwm; |
690 | u32 val; | 665 | u32 val; |
691 | int ret; | 666 | int ret; |
692 | 667 | ||
693 | match = of_match_device(rpm_of_match, &pdev->dev); | ||
694 | template = match->data; | ||
695 | |||
696 | vreg = devm_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); | ||
697 | if (!vreg) { | ||
698 | dev_err(&pdev->dev, "failed to allocate vreg\n"); | ||
699 | return -ENOMEM; | ||
700 | } | ||
701 | memcpy(vreg, template, sizeof(*vreg)); | ||
702 | mutex_init(&vreg->lock); | ||
703 | vreg->dev = &pdev->dev; | ||
704 | vreg->desc.id = -1; | ||
705 | vreg->desc.owner = THIS_MODULE; | ||
706 | vreg->desc.type = REGULATOR_VOLTAGE; | ||
707 | vreg->desc.name = pdev->dev.of_node->name; | ||
708 | vreg->desc.supply_name = "vin"; | ||
709 | |||
710 | vreg->rpm = dev_get_drvdata(pdev->dev.parent); | ||
711 | if (!vreg->rpm) { | ||
712 | dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); | ||
713 | return -ENODEV; | ||
714 | } | ||
715 | |||
716 | initdata = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node, | ||
717 | &vreg->desc); | ||
718 | if (!initdata) | ||
719 | return -EINVAL; | ||
720 | |||
721 | key = "reg"; | ||
722 | ret = of_property_read_u32(pdev->dev.of_node, key, &val); | ||
723 | if (ret) { | ||
724 | dev_err(&pdev->dev, "failed to read %s\n", key); | ||
725 | return ret; | ||
726 | } | ||
727 | vreg->resource = val; | ||
728 | |||
729 | if ((vreg->parts->uV.mask || vreg->parts->mV.mask) && | ||
730 | (!initdata->constraints.min_uV || !initdata->constraints.max_uV)) { | ||
731 | dev_err(&pdev->dev, "no voltage specified for regulator\n"); | ||
732 | return -EINVAL; | ||
733 | } | ||
734 | |||
735 | /* Regulators with ia property suppports drms */ | ||
736 | if (vreg->parts->ia.mask) | ||
737 | initdata->constraints.valid_ops_mask |= REGULATOR_CHANGE_DRMS; | ||
738 | |||
739 | key = "bias-pull-down"; | 668 | key = "bias-pull-down"; |
740 | if (of_property_read_bool(pdev->dev.of_node, key)) { | 669 | if (of_property_read_bool(node, key)) { |
741 | ret = rpm_reg_set(vreg, &vreg->parts->pd, 1); | 670 | ret = rpm_reg_set(vreg, &vreg->parts->pd, 1); |
742 | if (ret) { | 671 | if (ret) { |
743 | dev_err(&pdev->dev, "%s is invalid", key); | 672 | dev_err(dev, "%s is invalid", key); |
744 | return ret; | 673 | return ret; |
745 | } | 674 | } |
746 | } | 675 | } |
747 | 676 | ||
748 | if (vreg->parts->freq.mask) { | 677 | if (vreg->parts->freq.mask) { |
749 | ret = rpm_reg_of_parse_freq(&pdev->dev, vreg); | 678 | ret = rpm_reg_of_parse_freq(dev, node, vreg); |
750 | if (ret < 0) | 679 | if (ret < 0) |
751 | return ret; | 680 | return ret; |
752 | } | 681 | } |
753 | 682 | ||
754 | if (vreg->parts->pm.mask) { | 683 | if (vreg->parts->pm.mask) { |
755 | key = "qcom,power-mode-hysteretic"; | 684 | key = "qcom,power-mode-hysteretic"; |
756 | pwm = !of_property_read_bool(pdev->dev.of_node, key); | 685 | pwm = !of_property_read_bool(node, key); |
757 | 686 | ||
758 | ret = rpm_reg_set(vreg, &vreg->parts->pm, pwm); | 687 | ret = rpm_reg_set(vreg, &vreg->parts->pm, pwm); |
759 | if (ret) { | 688 | if (ret) { |
760 | dev_err(&pdev->dev, "failed to set power mode\n"); | 689 | dev_err(dev, "failed to set power mode\n"); |
761 | return ret; | 690 | return ret; |
762 | } | 691 | } |
763 | } | 692 | } |
@@ -766,11 +695,11 @@ static int rpm_reg_probe(struct platform_device *pdev) | |||
766 | force_mode = -1; | 695 | force_mode = -1; |
767 | 696 | ||
768 | key = "qcom,force-mode"; | 697 | key = "qcom,force-mode"; |
769 | ret = of_property_read_u32(pdev->dev.of_node, key, &val); | 698 | ret = of_property_read_u32(node, key, &val); |
770 | if (ret == -EINVAL) { | 699 | if (ret == -EINVAL) { |
771 | val = QCOM_RPM_FORCE_MODE_NONE; | 700 | val = QCOM_RPM_FORCE_MODE_NONE; |
772 | } else if (ret < 0) { | 701 | } else if (ret < 0) { |
773 | dev_err(&pdev->dev, "failed to read %s\n", key); | 702 | dev_err(dev, "failed to read %s\n", key); |
774 | return ret; | 703 | return ret; |
775 | } | 704 | } |
776 | 705 | ||
@@ -805,25 +734,192 @@ static int rpm_reg_probe(struct platform_device *pdev) | |||
805 | } | 734 | } |
806 | 735 | ||
807 | if (force_mode == -1) { | 736 | if (force_mode == -1) { |
808 | dev_err(&pdev->dev, "invalid force mode\n"); | 737 | dev_err(dev, "invalid force mode\n"); |
809 | return -EINVAL; | 738 | return -EINVAL; |
810 | } | 739 | } |
811 | 740 | ||
812 | ret = rpm_reg_set(vreg, &vreg->parts->fm, force_mode); | 741 | ret = rpm_reg_set(vreg, &vreg->parts->fm, force_mode); |
813 | if (ret) { | 742 | if (ret) { |
814 | dev_err(&pdev->dev, "failed to set force mode\n"); | 743 | dev_err(dev, "failed to set force mode\n"); |
815 | return ret; | 744 | return ret; |
816 | } | 745 | } |
817 | } | 746 | } |
818 | 747 | ||
819 | config.dev = &pdev->dev; | 748 | return 0; |
820 | config.init_data = initdata; | 749 | } |
821 | config.driver_data = vreg; | 750 | |
822 | config.of_node = pdev->dev.of_node; | 751 | struct rpm_regulator_data { |
823 | rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); | 752 | const char *name; |
824 | if (IS_ERR(rdev)) { | 753 | int resource; |
825 | dev_err(&pdev->dev, "can't register regulator\n"); | 754 | const struct qcom_rpm_reg *template; |
826 | return PTR_ERR(rdev); | 755 | const char *supply; |
756 | }; | ||
757 | |||
758 | static const struct rpm_regulator_data rpm_pm8058_regulators[] = { | ||
759 | { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, | ||
760 | { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, | ||
761 | { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, | ||
762 | { "l3", QCOM_RPM_PM8058_LDO3, &pm8058_pldo, "vdd_l3_l4_l5" }, | ||
763 | { "l4", QCOM_RPM_PM8058_LDO4, &pm8058_pldo, "vdd_l3_l4_l5" }, | ||
764 | { "l5", QCOM_RPM_PM8058_LDO5, &pm8058_pldo, "vdd_l3_l4_l5" }, | ||
765 | { "l6", QCOM_RPM_PM8058_LDO6, &pm8058_pldo, "vdd_l6_l7" }, | ||
766 | { "l7", QCOM_RPM_PM8058_LDO7, &pm8058_pldo, "vdd_l6_l7" }, | ||
767 | { "l8", QCOM_RPM_PM8058_LDO8, &pm8058_pldo, "vdd_l8" }, | ||
768 | { "l9", QCOM_RPM_PM8058_LDO9, &pm8058_pldo, "vdd_l9" }, | ||
769 | { "l10", QCOM_RPM_PM8058_LDO10, &pm8058_pldo, "vdd_l10" }, | ||
770 | { "l11", QCOM_RPM_PM8058_LDO11, &pm8058_pldo, "vdd_l2_l11_l12" }, | ||
771 | { "l12", QCOM_RPM_PM8058_LDO12, &pm8058_pldo, "vdd_l2_l11_l12" }, | ||
772 | { "l13", QCOM_RPM_PM8058_LDO13, &pm8058_pldo, "vdd_l13_l16" }, | ||
773 | { "l14", QCOM_RPM_PM8058_LDO14, &pm8058_pldo, "vdd_l14_l15" }, | ||
774 | { "l15", QCOM_RPM_PM8058_LDO15, &pm8058_pldo, "vdd_l14_l15" }, | ||
775 | { "l16", QCOM_RPM_PM8058_LDO16, &pm8058_pldo, "vdd_l13_l16" }, | ||
776 | { "l17", QCOM_RPM_PM8058_LDO17, &pm8058_pldo, "vdd_l17_l18" }, | ||
777 | { "l18", QCOM_RPM_PM8058_LDO18, &pm8058_pldo, "vdd_l17_l18" }, | ||
778 | { "l19", QCOM_RPM_PM8058_LDO19, &pm8058_pldo, "vdd_l19_l20" }, | ||
779 | { "l20", QCOM_RPM_PM8058_LDO20, &pm8058_pldo, "vdd_l19_l20" }, | ||
780 | { "l21", QCOM_RPM_PM8058_LDO21, &pm8058_nldo, "vdd_l21" }, | ||
781 | { "l22", QCOM_RPM_PM8058_LDO22, &pm8058_nldo, "vdd_l22" }, | ||
782 | { "l23", QCOM_RPM_PM8058_LDO23, &pm8058_nldo, "vdd_l23_l24_l25" }, | ||
783 | { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, | ||
784 | { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, | ||
785 | |||
786 | { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, | ||
787 | { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, | ||
788 | { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, | ||
789 | { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, | ||
790 | { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, | ||
791 | |||
792 | { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, | ||
793 | { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, | ||
794 | |||
795 | { "ncp", QCOM_RPM_PM8058_NCP, &pm8058_ncp, "vdd_ncp" }, | ||
796 | { } | ||
797 | }; | ||
798 | |||
799 | static const struct rpm_regulator_data rpm_pm8901_regulators[] = { | ||
800 | { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, | ||
801 | { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, | ||
802 | { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, | ||
803 | { "l3", QCOM_RPM_PM8901_LDO3, &pm8901_pldo, "vdd_l3" }, | ||
804 | { "l4", QCOM_RPM_PM8901_LDO4, &pm8901_pldo, "vdd_l4" }, | ||
805 | { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, | ||
806 | { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, | ||
807 | |||
808 | { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, | ||
809 | { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, | ||
810 | { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, | ||
811 | { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, | ||
812 | { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, | ||
813 | |||
814 | { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, | ||
815 | { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, | ||
816 | { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, | ||
817 | { "lvs3", QCOM_RPM_PM8901_LVS3, &pm8901_switch, "lvs3_in" }, | ||
818 | |||
819 | { "mvs", QCOM_RPM_PM8901_MVS, &pm8901_switch, "mvs_in" }, | ||
820 | { } | ||
821 | }; | ||
822 | |||
823 | static const struct rpm_regulator_data rpm_pm8921_regulators[] = { | ||
824 | { "s1", QCOM_RPM_PM8921_SMPS1, &pm8921_smps, "vdd_s1" }, | ||
825 | { "s2", QCOM_RPM_PM8921_SMPS2, &pm8921_smps, "vdd_s2" }, | ||
826 | { "s3", QCOM_RPM_PM8921_SMPS3, &pm8921_smps }, | ||
827 | { "s4", QCOM_RPM_PM8921_SMPS4, &pm8921_smps, "vdd_s4" }, | ||
828 | { "s7", QCOM_RPM_PM8921_SMPS7, &pm8921_smps, "vdd_s7" }, | ||
829 | { "s8", QCOM_RPM_PM8921_SMPS8, &pm8921_smps, "vdd_s8" }, | ||
830 | |||
831 | { "l1", QCOM_RPM_PM8921_LDO1, &pm8921_nldo, "vdd_l1_l2_l12_l18" }, | ||
832 | { "l2", QCOM_RPM_PM8921_LDO2, &pm8921_nldo, "vdd_l1_l2_l12_l18" }, | ||
833 | { "l3", QCOM_RPM_PM8921_LDO3, &pm8921_pldo, "vdd_l3_l15_l17" }, | ||
834 | { "l4", QCOM_RPM_PM8921_LDO4, &pm8921_pldo, "vdd_l4_l14" }, | ||
835 | { "l5", QCOM_RPM_PM8921_LDO5, &pm8921_pldo, "vdd_l5_l8_l16" }, | ||
836 | { "l6", QCOM_RPM_PM8921_LDO6, &pm8921_pldo, "vdd_l6_l7" }, | ||
837 | { "l7", QCOM_RPM_PM8921_LDO7, &pm8921_pldo, "vdd_l6_l7" }, | ||
838 | { "l8", QCOM_RPM_PM8921_LDO8, &pm8921_pldo, "vdd_l5_l8_l16" }, | ||
839 | { "l9", QCOM_RPM_PM8921_LDO9, &pm8921_pldo, "vdd_l9_l11" }, | ||
840 | { "l10", QCOM_RPM_PM8921_LDO10, &pm8921_pldo, "vdd_l10_l22" }, | ||
841 | { "l11", QCOM_RPM_PM8921_LDO11, &pm8921_pldo, "vdd_l9_l11" }, | ||
842 | { "l12", QCOM_RPM_PM8921_LDO12, &pm8921_nldo, "vdd_l1_l2_l12_l18" }, | ||
843 | { "l14", QCOM_RPM_PM8921_LDO14, &pm8921_pldo, "vdd_l4_l14" }, | ||
844 | { "l15", QCOM_RPM_PM8921_LDO15, &pm8921_pldo, "vdd_l3_l15_l17" }, | ||
845 | { "l16", QCOM_RPM_PM8921_LDO16, &pm8921_pldo, "vdd_l5_l8_l16" }, | ||
846 | { "l17", QCOM_RPM_PM8921_LDO17, &pm8921_pldo, "vdd_l3_l15_l17" }, | ||
847 | { "l18", QCOM_RPM_PM8921_LDO18, &pm8921_nldo, "vdd_l1_l2_l12_l18" }, | ||
848 | { "l21", QCOM_RPM_PM8921_LDO21, &pm8921_pldo, "vdd_l21_l23_l29" }, | ||
849 | { "l22", QCOM_RPM_PM8921_LDO22, &pm8921_pldo, "vdd_l10_l22" }, | ||
850 | { "l23", QCOM_RPM_PM8921_LDO23, &pm8921_pldo, "vdd_l21_l23_l29" }, | ||
851 | { "l24", QCOM_RPM_PM8921_LDO24, &pm8921_nldo1200, "vdd_l24" }, | ||
852 | { "l25", QCOM_RPM_PM8921_LDO25, &pm8921_nldo1200, "vdd_l25" }, | ||
853 | { "l26", QCOM_RPM_PM8921_LDO26, &pm8921_nldo1200, "vdd_l26" }, | ||
854 | { "l27", QCOM_RPM_PM8921_LDO27, &pm8921_nldo1200, "vdd_l27" }, | ||
855 | { "l28", QCOM_RPM_PM8921_LDO28, &pm8921_nldo1200, "vdd_l28" }, | ||
856 | { "l29", QCOM_RPM_PM8921_LDO29, &pm8921_pldo, "vdd_l21_l23_l29" }, | ||
857 | |||
858 | { "lvs1", QCOM_RPM_PM8921_LVS1, &pm8921_switch, "vin_lvs1_3_6" }, | ||
859 | { "lvs2", QCOM_RPM_PM8921_LVS2, &pm8921_switch, "vin_lvs2" }, | ||
860 | { "lvs3", QCOM_RPM_PM8921_LVS3, &pm8921_switch, "vin_lvs1_3_6" }, | ||
861 | { "lvs4", QCOM_RPM_PM8921_LVS4, &pm8921_switch, "vin_lvs4_5_7" }, | ||
862 | { "lvs5", QCOM_RPM_PM8921_LVS5, &pm8921_switch, "vin_lvs4_5_7" }, | ||
863 | { "lvs6", QCOM_RPM_PM8921_LVS6, &pm8921_switch, "vin_lvs1_3_6" }, | ||
864 | { "lvs7", QCOM_RPM_PM8921_LVS7, &pm8921_switch, "vin_lvs4_5_7" }, | ||
865 | |||
866 | { "usb-switch", QCOM_RPM_USB_OTG_SWITCH, &pm8921_switch, "vin_5vs" }, | ||
867 | { "hdmi-switch", QCOM_RPM_HDMI_SWITCH, &pm8921_switch, "vin_5vs" }, | ||
868 | { "ncp", QCOM_RPM_PM8921_NCP, &pm8921_ncp, "vdd_ncp" }, | ||
869 | { } | ||
870 | }; | ||
871 | |||
872 | static const struct of_device_id rpm_of_match[] = { | ||
873 | { .compatible = "qcom,rpm-pm8058-regulators", .data = &rpm_pm8058_regulators }, | ||
874 | { .compatible = "qcom,rpm-pm8901-regulators", .data = &rpm_pm8901_regulators }, | ||
875 | { .compatible = "qcom,rpm-pm8921-regulators", .data = &rpm_pm8921_regulators }, | ||
876 | { } | ||
877 | }; | ||
878 | MODULE_DEVICE_TABLE(of, rpm_of_match); | ||
879 | |||
880 | static int rpm_reg_probe(struct platform_device *pdev) | ||
881 | { | ||
882 | const struct rpm_regulator_data *reg; | ||
883 | const struct of_device_id *match; | ||
884 | struct regulator_config config = { }; | ||
885 | struct regulator_dev *rdev; | ||
886 | struct qcom_rpm_reg *vreg; | ||
887 | struct qcom_rpm *rpm; | ||
888 | |||
889 | rpm = dev_get_drvdata(pdev->dev.parent); | ||
890 | if (!rpm) { | ||
891 | dev_err(&pdev->dev, "unable to retrieve handle to rpm\n"); | ||
892 | return -ENODEV; | ||
893 | } | ||
894 | |||
895 | match = of_match_device(rpm_of_match, &pdev->dev); | ||
896 | for (reg = match->data; reg->name; reg++) { | ||
897 | vreg = devm_kmalloc(&pdev->dev, sizeof(*vreg), GFP_KERNEL); | ||
898 | if (!vreg) | ||
899 | return -ENOMEM; | ||
900 | |||
901 | memcpy(vreg, reg->template, sizeof(*vreg)); | ||
902 | mutex_init(&vreg->lock); | ||
903 | |||
904 | vreg->dev = &pdev->dev; | ||
905 | vreg->resource = reg->resource; | ||
906 | vreg->rpm = rpm; | ||
907 | |||
908 | vreg->desc.id = -1; | ||
909 | vreg->desc.owner = THIS_MODULE; | ||
910 | vreg->desc.type = REGULATOR_VOLTAGE; | ||
911 | vreg->desc.name = reg->name; | ||
912 | vreg->desc.supply_name = reg->supply; | ||
913 | vreg->desc.of_match = reg->name; | ||
914 | vreg->desc.of_parse_cb = rpm_reg_of_parse; | ||
915 | |||
916 | config.dev = &pdev->dev; | ||
917 | config.driver_data = vreg; | ||
918 | rdev = devm_regulator_register(&pdev->dev, &vreg->desc, &config); | ||
919 | if (IS_ERR(rdev)) { | ||
920 | dev_err(&pdev->dev, "failed to register %s\n", reg->name); | ||
921 | return PTR_ERR(rdev); | ||
922 | } | ||
827 | } | 923 | } |
828 | 924 | ||
829 | return 0; | 925 | return 0; |
diff --git a/drivers/regulator/stw481x-vmmc.c b/drivers/regulator/stw481x-vmmc.c index 89025f560259..7d2ae3e9e942 100644 --- a/drivers/regulator/stw481x-vmmc.c +++ b/drivers/regulator/stw481x-vmmc.c | |||
@@ -56,6 +56,7 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev) | |||
56 | { | 56 | { |
57 | struct stw481x *stw481x = dev_get_platdata(&pdev->dev); | 57 | struct stw481x *stw481x = dev_get_platdata(&pdev->dev); |
58 | struct regulator_config config = { }; | 58 | struct regulator_config config = { }; |
59 | struct regulator_dev *rdev; | ||
59 | int ret; | 60 | int ret; |
60 | 61 | ||
61 | /* First disable the external VMMC if it's active */ | 62 | /* First disable the external VMMC if it's active */ |
@@ -75,12 +76,11 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev) | |||
75 | pdev->dev.of_node, | 76 | pdev->dev.of_node, |
76 | &vmmc_regulator); | 77 | &vmmc_regulator); |
77 | 78 | ||
78 | stw481x->vmmc_regulator = devm_regulator_register(&pdev->dev, | 79 | rdev = devm_regulator_register(&pdev->dev, &vmmc_regulator, &config); |
79 | &vmmc_regulator, &config); | 80 | if (IS_ERR(rdev)) { |
80 | if (IS_ERR(stw481x->vmmc_regulator)) { | ||
81 | dev_err(&pdev->dev, | 81 | dev_err(&pdev->dev, |
82 | "error initializing STw481x VMMC regulator\n"); | 82 | "error initializing STw481x VMMC regulator\n"); |
83 | return PTR_ERR(stw481x->vmmc_regulator); | 83 | return PTR_ERR(rdev); |
84 | } | 84 | } |
85 | 85 | ||
86 | dev_info(&pdev->dev, "initialized STw481x VMMC regulator\n"); | 86 | dev_info(&pdev->dev, "initialized STw481x VMMC regulator\n"); |
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 5d60a868830d..2aa85e398f76 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c | |||
@@ -4225,22 +4225,15 @@ static struct scsi_host_template ufshcd_driver_template = { | |||
4225 | static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | 4225 | static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, |
4226 | int ua) | 4226 | int ua) |
4227 | { | 4227 | { |
4228 | int ret = 0; | 4228 | int ret; |
4229 | struct regulator *reg = vreg->reg; | ||
4230 | const char *name = vreg->name; | ||
4231 | 4229 | ||
4232 | BUG_ON(!vreg); | 4230 | if (!vreg) |
4231 | return 0; | ||
4233 | 4232 | ||
4234 | ret = regulator_set_optimum_mode(reg, ua); | 4233 | ret = regulator_set_load(vreg->reg, ua); |
4235 | if (ret >= 0) { | 4234 | if (ret < 0) { |
4236 | /* | 4235 | dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n", |
4237 | * regulator_set_optimum_mode() returns new regulator | 4236 | __func__, vreg->name, ua, ret); |
4238 | * mode upon success. | ||
4239 | */ | ||
4240 | ret = 0; | ||
4241 | } else { | ||
4242 | dev_err(dev, "%s: %s set optimum mode(ua=%d) failed, err=%d\n", | ||
4243 | __func__, name, ua, ret); | ||
4244 | } | 4237 | } |
4245 | 4238 | ||
4246 | return ret; | 4239 | return ret; |
@@ -4249,18 +4242,12 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, | |||
4249 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, | 4242 | static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, |
4250 | struct ufs_vreg *vreg) | 4243 | struct ufs_vreg *vreg) |
4251 | { | 4244 | { |
4252 | if (!vreg) | ||
4253 | return 0; | ||
4254 | |||
4255 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); | 4245 | return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); |
4256 | } | 4246 | } |
4257 | 4247 | ||
4258 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, | 4248 | static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, |
4259 | struct ufs_vreg *vreg) | 4249 | struct ufs_vreg *vreg) |
4260 | { | 4250 | { |
4261 | if (!vreg) | ||
4262 | return 0; | ||
4263 | |||
4264 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); | 4251 | return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); |
4265 | } | 4252 | } |
4266 | 4253 | ||
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 0b1bd2369293..f5b3b928941b 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -277,7 +277,7 @@ static void ab8500_usb_regulator_enable(struct ab8500_usb *ab) | |||
277 | dev_err(ab->dev, "Failed to set the Vintcore to 1.3V, ret=%d\n", | 277 | dev_err(ab->dev, "Failed to set the Vintcore to 1.3V, ret=%d\n", |
278 | ret); | 278 | ret); |
279 | 279 | ||
280 | ret = regulator_set_optimum_mode(ab->v_ulpi, 28000); | 280 | ret = regulator_set_load(ab->v_ulpi, 28000); |
281 | if (ret < 0) | 281 | if (ret < 0) |
282 | dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n", | 282 | dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n", |
283 | ret); | 283 | ret); |
@@ -317,7 +317,7 @@ static void ab8500_usb_regulator_disable(struct ab8500_usb *ab) | |||
317 | ab->saved_v_ulpi, ret); | 317 | ab->saved_v_ulpi, ret); |
318 | } | 318 | } |
319 | 319 | ||
320 | ret = regulator_set_optimum_mode(ab->v_ulpi, 0); | 320 | ret = regulator_set_load(ab->v_ulpi, 0); |
321 | if (ret < 0) | 321 | if (ret < 0) |
322 | dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n", | 322 | dev_err(ab->dev, "Failed to set optimum mode (ret=%d)\n", |
323 | ret); | 323 | ret); |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 000fd892455f..6ed67ea4ef7e 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -142,27 +142,22 @@ static int msm_hsusb_ldo_set_mode(struct msm_otg *motg, int on) | |||
142 | int ret = 0; | 142 | int ret = 0; |
143 | 143 | ||
144 | if (on) { | 144 | if (on) { |
145 | ret = regulator_set_optimum_mode(motg->v1p8, | 145 | ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_HPM_LOAD); |
146 | USB_PHY_1P8_HPM_LOAD); | ||
147 | if (ret < 0) { | 146 | if (ret < 0) { |
148 | pr_err("Could not set HPM for v1p8\n"); | 147 | pr_err("Could not set HPM for v1p8\n"); |
149 | return ret; | 148 | return ret; |
150 | } | 149 | } |
151 | ret = regulator_set_optimum_mode(motg->v3p3, | 150 | ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_HPM_LOAD); |
152 | USB_PHY_3P3_HPM_LOAD); | ||
153 | if (ret < 0) { | 151 | if (ret < 0) { |
154 | pr_err("Could not set HPM for v3p3\n"); | 152 | pr_err("Could not set HPM for v3p3\n"); |
155 | regulator_set_optimum_mode(motg->v1p8, | 153 | regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD); |
156 | USB_PHY_1P8_LPM_LOAD); | ||
157 | return ret; | 154 | return ret; |
158 | } | 155 | } |
159 | } else { | 156 | } else { |
160 | ret = regulator_set_optimum_mode(motg->v1p8, | 157 | ret = regulator_set_load(motg->v1p8, USB_PHY_1P8_LPM_LOAD); |
161 | USB_PHY_1P8_LPM_LOAD); | ||
162 | if (ret < 0) | 158 | if (ret < 0) |
163 | pr_err("Could not set LPM for v1p8\n"); | 159 | pr_err("Could not set LPM for v1p8\n"); |
164 | ret = regulator_set_optimum_mode(motg->v3p3, | 160 | ret = regulator_set_load(motg->v3p3, USB_PHY_3P3_LPM_LOAD); |
165 | USB_PHY_3P3_LPM_LOAD); | ||
166 | if (ret < 0) | 161 | if (ret < 0) |
167 | pr_err("Could not set LPM for v3p3\n"); | 162 | pr_err("Could not set LPM for v3p3\n"); |
168 | } | 163 | } |
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index ee7b1ce7a6f8..bb270bd03eed 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
@@ -117,6 +117,7 @@ struct palmas_pmic_driver_data { | |||
117 | int ldo_begin; | 117 | int ldo_begin; |
118 | int ldo_end; | 118 | int ldo_end; |
119 | int max_reg; | 119 | int max_reg; |
120 | bool has_regen3; | ||
120 | struct palmas_regs_info *palmas_regs_info; | 121 | struct palmas_regs_info *palmas_regs_info; |
121 | struct of_regulator_match *palmas_matches; | 122 | struct of_regulator_match *palmas_matches; |
122 | struct palmas_sleep_requestor_info *sleep_req_info; | 123 | struct palmas_sleep_requestor_info *sleep_req_info; |
diff --git a/include/linux/mfd/stw481x.h b/include/linux/mfd/stw481x.h index eda121556e5d..833074b766bd 100644 --- a/include/linux/mfd/stw481x.h +++ b/include/linux/mfd/stw481x.h | |||
@@ -41,15 +41,11 @@ | |||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * struct stw481x - state holder for the Stw481x drivers | 43 | * struct stw481x - state holder for the Stw481x drivers |
44 | * @mutex: mutex to serialize I2C accesses | ||
45 | * @i2c_client: corresponding I2C client | 44 | * @i2c_client: corresponding I2C client |
46 | * @regulator: regulator device for regulator children | ||
47 | * @map: regmap handle to access device registers | 45 | * @map: regmap handle to access device registers |
48 | */ | 46 | */ |
49 | struct stw481x { | 47 | struct stw481x { |
50 | struct mutex lock; | ||
51 | struct i2c_client *client; | 48 | struct i2c_client *client; |
52 | struct regulator_dev *vmmc_regulator; | ||
53 | struct regmap *map; | 49 | struct regmap *map; |
54 | }; | 50 | }; |
55 | 51 | ||
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index aeacd624a794..f8a689ed62a5 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -238,7 +238,7 @@ int regulator_get_current_limit(struct regulator *regulator); | |||
238 | 238 | ||
239 | int regulator_set_mode(struct regulator *regulator, unsigned int mode); | 239 | int regulator_set_mode(struct regulator *regulator, unsigned int mode); |
240 | unsigned int regulator_get_mode(struct regulator *regulator); | 240 | unsigned int regulator_get_mode(struct regulator *regulator); |
241 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | 241 | int regulator_set_load(struct regulator *regulator, int load_uA); |
242 | 242 | ||
243 | int regulator_allow_bypass(struct regulator *regulator, bool allow); | 243 | int regulator_allow_bypass(struct regulator *regulator, bool allow); |
244 | 244 | ||
@@ -252,8 +252,12 @@ int regulator_list_hardware_vsel(struct regulator *regulator, | |||
252 | /* regulator notifier block */ | 252 | /* regulator notifier block */ |
253 | int regulator_register_notifier(struct regulator *regulator, | 253 | int regulator_register_notifier(struct regulator *regulator, |
254 | struct notifier_block *nb); | 254 | struct notifier_block *nb); |
255 | int devm_regulator_register_notifier(struct regulator *regulator, | ||
256 | struct notifier_block *nb); | ||
255 | int regulator_unregister_notifier(struct regulator *regulator, | 257 | int regulator_unregister_notifier(struct regulator *regulator, |
256 | struct notifier_block *nb); | 258 | struct notifier_block *nb); |
259 | void devm_regulator_unregister_notifier(struct regulator *regulator, | ||
260 | struct notifier_block *nb); | ||
257 | 261 | ||
258 | /* driver data - core doesn't touch */ | 262 | /* driver data - core doesn't touch */ |
259 | void *regulator_get_drvdata(struct regulator *regulator); | 263 | void *regulator_get_drvdata(struct regulator *regulator); |
@@ -479,8 +483,7 @@ static inline unsigned int regulator_get_mode(struct regulator *regulator) | |||
479 | return REGULATOR_MODE_NORMAL; | 483 | return REGULATOR_MODE_NORMAL; |
480 | } | 484 | } |
481 | 485 | ||
482 | static inline int regulator_set_optimum_mode(struct regulator *regulator, | 486 | static inline int regulator_set_load(struct regulator *regulator, int load_uA) |
483 | int load_uA) | ||
484 | { | 487 | { |
485 | return REGULATOR_MODE_NORMAL; | 488 | return REGULATOR_MODE_NORMAL; |
486 | } | 489 | } |
@@ -515,12 +518,24 @@ static inline int regulator_register_notifier(struct regulator *regulator, | |||
515 | return 0; | 518 | return 0; |
516 | } | 519 | } |
517 | 520 | ||
521 | static inline int devm_regulator_register_notifier(struct regulator *regulator, | ||
522 | struct notifier_block *nb) | ||
523 | { | ||
524 | return 0; | ||
525 | } | ||
526 | |||
518 | static inline int regulator_unregister_notifier(struct regulator *regulator, | 527 | static inline int regulator_unregister_notifier(struct regulator *regulator, |
519 | struct notifier_block *nb) | 528 | struct notifier_block *nb) |
520 | { | 529 | { |
521 | return 0; | 530 | return 0; |
522 | } | 531 | } |
523 | 532 | ||
533 | static inline int devm_regulator_unregister_notifier(struct regulator *regulator, | ||
534 | struct notifier_block *nb) | ||
535 | { | ||
536 | return 0; | ||
537 | } | ||
538 | |||
524 | static inline void *regulator_get_drvdata(struct regulator *regulator) | 539 | static inline void *regulator_get_drvdata(struct regulator *regulator) |
525 | { | 540 | { |
526 | return NULL; | 541 | return NULL; |