* [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change @ 2013-02-06 3:09 Axel Lin 2013-02-06 3:10 ` [PATCH 2/2] regulator: max8998: Let regulator core handle the case selector == old_selector Axel Lin ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Axel Lin @ 2013-02-06 3:09 UTC (permalink / raw) To: Mark Brown; +Cc: Kyungmin Park, Liam Girdwood, linux-kernel Optimize _regulator_do_set_voltage() for the case selector is equal to old_selector. Since the voltage does not change, we don't need to call set_voltage_sel() and set_voltage_time_sel() in this case. Signed-off-by: Axel Lin <axel.lin@ingics.com> --- drivers/regulator/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index de47880..e9df76e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2239,8 +2239,11 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev, best_val = rdev->desc->ops->list_voltage(rdev, ret); if (min_uV <= best_val && max_uV >= best_val) { selector = ret; - ret = rdev->desc->ops->set_voltage_sel(rdev, - ret); + if (old_selector == selector) + ret = 0; + else + ret = rdev->desc->ops->set_voltage_sel( + rdev, ret); } else { ret = -EINVAL; } @@ -2251,7 +2254,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev, /* Call set_voltage_time_sel if successfully obtained old_selector */ if (ret == 0 && _regulator_is_enabled(rdev) && old_selector >= 0 && - rdev->desc->ops->set_voltage_time_sel) { + old_selector != selector && rdev->desc->ops->set_voltage_time_sel) { delay = rdev->desc->ops->set_voltage_time_sel(rdev, old_selector, selector); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] regulator: max8998: Let regulator core handle the case selector == old_selector 2013-02-06 3:09 [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Axel Lin @ 2013-02-06 3:10 ` Axel Lin 2013-02-08 11:26 ` [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Mark Brown 2013-02-08 11:26 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Axel Lin @ 2013-02-06 3:10 UTC (permalink / raw) To: Mark Brown; +Cc: Kyungmin Park, Liam Girdwood, linux-kernel Signed-off-by: Axel Lin <axel.lin@ingics.com> --- drivers/regulator/max8998.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 0a8dd1c..b588f07 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -311,25 +311,13 @@ static int max8998_set_voltage_buck_sel(struct regulator_dev *rdev, dev_get_platdata(max8998->iodev->dev); struct i2c_client *i2c = max8998->iodev->i2c; int buck = rdev_get_id(rdev); - int reg, shift = 0, mask, ret; - int j, previous_sel; + int reg, shift = 0, mask, ret, j; static u8 buck1_last_val; ret = max8998_get_voltage_register(rdev, ®, &shift, &mask); if (ret) return ret; - previous_sel = max8998_get_voltage_sel(rdev); - - /* Check if voltage needs to be changed */ - /* if previous_voltage equal new voltage, return */ - if (previous_sel == selector) { - dev_dbg(max8998->dev, "No voltage change, old:%d, new:%d\n", - regulator_list_voltage_linear(rdev, previous_sel), - regulator_list_voltage_linear(rdev, selector)); - return ret; - } - switch (buck) { case MAX8998_BUCK1: dev_dbg(max8998->dev, -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change 2013-02-06 3:09 [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Axel Lin 2013-02-06 3:10 ` [PATCH 2/2] regulator: max8998: Let regulator core handle the case selector == old_selector Axel Lin @ 2013-02-08 11:26 ` Mark Brown 2013-02-08 11:26 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Mark Brown @ 2013-02-08 11:26 UTC (permalink / raw) To: Axel Lin; +Cc: Kyungmin Park, Liam Girdwood, linux-kernel [-- Attachment #1: Type: text/plain, Size: 283 bytes --] On Wed, Feb 06, 2013 at 11:09:48AM +0800, Axel Lin wrote: > Optimize _regulator_do_set_voltage() for the case selector is equal to > old_selector. Since the voltage does not change, we don't need to call > set_voltage_sel() and set_voltage_time_sel() in this case. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change 2013-02-06 3:09 [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Axel Lin 2013-02-06 3:10 ` [PATCH 2/2] regulator: max8998: Let regulator core handle the case selector == old_selector Axel Lin 2013-02-08 11:26 ` [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Mark Brown @ 2013-02-08 11:26 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Mark Brown @ 2013-02-08 11:26 UTC (permalink / raw) To: Axel Lin; +Cc: Kyungmin Park, Liam Girdwood, linux-kernel [-- Attachment #1: Type: text/plain, Size: 283 bytes --] On Wed, Feb 06, 2013 at 11:09:48AM +0800, Axel Lin wrote: > Optimize _regulator_do_set_voltage() for the case selector is equal to > old_selector. Since the voltage does not change, we don't need to call > set_voltage_sel() and set_voltage_time_sel() in this case. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-08 11:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-02-06 3:09 [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Axel Lin 2013-02-06 3:10 ` [PATCH 2/2] regulator: max8998: Let regulator core handle the case selector == old_selector Axel Lin 2013-02-08 11:26 ` [PATCH 1/2] regulator: core: Optimize _regulator_do_set_voltage if voltage does not change Mark Brown 2013-02-08 11:26 ` Mark Brown
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.