regulator: core: Call set_voltage_time_sel() only when the regulator is on
PATCH 1/2 regulator: core: Call set_voltage_time_sel() only when the regulator is on
If the regulator is not on, it won't take time setting new voltage. So only call set_voltage_time_sel() to get the necessary delay when the regulator is on.
--- drivers/regulator/core.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/regulator/core.c +3 -2
@@ -2103,7 +2103,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,* If we can't obtain the old selector there is not enough * info to call set_voltage_time_sel(). */ -if (rdev->desc->ops->set_voltage_time_sel && +if (_regulator_is_enabled (rdev) && + rdev->desc->ops->set_voltage_time_sel && rdev->desc->ops->get_voltage_sel) { old_selector = rdev->desc->ops->get_voltage_sel (rdev);if (old_selector <0 )
@@ -2135,7 +2136,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev, best_val =-1 ;/* Call set_voltage_time_sel if successfully obtained old_selector */ -if (ret ==0 && old_selector >=0 && +if (_regulator_is_enabled (rdev) && ret ==0 && old_selector >=0 && rdev->desc->ops->set_voltage_time_sel) { delay = rdev->desc->ops->set_voltage_time_sel(rdev,
Signature · 1 line
1.7.5.4
PATCH 2/2 regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off
--- drivers/regulator/ab8500.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/regulator/ab8500.c +0 -7
@@ -256,14 +256,7 @@ static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev, unsigned int new_sel) {struct ab8500_regulator_info *info =rdev_get_drvdata (rdev); -int ret; -/* If the regulator isn't on, it won't take time here */ - ret =ab8500_regulator_is_enabled (rdev); -if (ret <0 ) -return ret; -if (!ret) -return 0 ;return info->delay; }
Signature · 1 line
1.7.5.4
Re: [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off
Quoted 4 lines · Axel Lin
Signed-off-by Axel Lin <[email protected]>---
drivers/regulator/ab8500.c | 7 -------1 files changed, 0 insertions(+), 7 deletions(-)
Looks correct following the other patch.
Linus Walleij
Mark Brown
AppliedQuoted 3 lines · Axel Lin
If the regulator is not on, it won't take time setting new voltage. So only call
set_voltage_time_sel()to get the necessary delay when the regulator is on.
Applied both, thanks.