* [PATCH] regulator: twl: Add 'fixed' set_voltage callback
@ 2011-06-23 20:46 Jassi Brar
2011-06-24 11:19 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Jassi Brar @ 2011-06-23 20:46 UTC (permalink / raw)
To: linux-kernel; +Cc: ti, linux-omap, lrg, broonie, sameo, Jassi Brar
Define dummy set_voltage callback for fixed lines,
without which voltage constraints fail to apply.
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
---
drivers/regulator/twl-regulator.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 87fe0f7..8223e49 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -591,10 +591,18 @@ static int twlfixed_get_voltage(struct regulator_dev *rdev)
return info->min_mV * 1000;
}
+static int twlfixed_set_voltage(struct regulator_dev *rdev,
+ int min_uV, int max_uV, unsigned *selector)
+{
+ *selector = min_uV / 1000;
+ return 0;
+}
+
static struct regulator_ops twl4030fixed_ops = {
.list_voltage = twlfixed_list_voltage,
.get_voltage = twlfixed_get_voltage,
+ .set_voltage = twlfixed_set_voltage,
.enable = twl4030reg_enable,
.disable = twl4030reg_disable,
@@ -609,6 +617,7 @@ static struct regulator_ops twl6030fixed_ops = {
.list_voltage = twlfixed_list_voltage,
.get_voltage = twlfixed_get_voltage,
+ .set_voltage = twlfixed_set_voltage,
.enable = twl6030reg_enable,
.disable = twl6030reg_disable,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: twl: Add 'fixed' set_voltage callback
2011-06-23 20:46 [PATCH] regulator: twl: Add 'fixed' set_voltage callback Jassi Brar
@ 2011-06-24 11:19 ` Mark Brown
2011-06-24 13:06 ` Jaswinder Singh
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2011-06-24 11:19 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-kernel, ti, linux-omap, lrg, sameo, Jassi Brar
On Fri, Jun 24, 2011 at 02:16:54AM +0530, Jassi Brar wrote:
> Define dummy set_voltage callback for fixed lines,
> without which voltage constraints fail to apply.
>
> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
No, this isn't sensible - fixed voltage regulators aren't an unusual
property of this device, they've very common. The core should handle
this gracefully. Probably whatever consumer is doing the setting also
ought to be updated to check that the voltages it wants to set are
supported at startup since otherwise it can end up repeatedly trying to
set something that'll never work.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] regulator: twl: Add 'fixed' set_voltage callback
2011-06-24 11:19 ` Mark Brown
@ 2011-06-24 13:06 ` Jaswinder Singh
0 siblings, 0 replies; 3+ messages in thread
From: Jaswinder Singh @ 2011-06-24 13:06 UTC (permalink / raw)
To: Mark Brown; +Cc: Jassi Brar, linux-kernel, ti, linux-omap, lrg, sameo
On 24 June 2011 16:49, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Jun 24, 2011 at 02:16:54AM +0530, Jassi Brar wrote:
>> Define dummy set_voltage callback for fixed lines,
>> without which voltage constraints fail to apply.
>>
>> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
>
> No, this isn't sensible - fixed voltage regulators aren't an unusual
> property of this device, they've very common. The core should handle
> this gracefully. Probably whatever consumer is doing the setting also
> ought to be updated to check that the voltages it wants to set are
> supported at startup since
Well, there's no consumer in the picture yet. The core even fails to register
the regulator.
After digging deeper, I realized removing
.apply_uV = true;
from the constraints is the correct solution. Patch is coming next.
> otherwise it can end up repeatedly trying to
> set something that'll never work.
Though the semantic could be defined that the 'closest' possible value
is already
set after the set_{voltage,current_limit} returns.
The consumer has no point in retrying - just like sample-rate setting
in Alsa works.
Thanks,
Jassi
--
Linaro.org │ Open source software for ARM SoCs | Follow Linaro
http://facebook.com/pages/Linaro/155974581091106 -
http://twitter.com/#!/linaroorg - http://linaro.org/linaro-blog
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-24 13:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 20:46 [PATCH] regulator: twl: Add 'fixed' set_voltage callback Jassi Brar
2011-06-24 11:19 ` Mark Brown
2011-06-24 13:06 ` Jaswinder Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox