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; | ||
