* [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count
@ 2011-11-08 13:24 Afzal Mohammed
2011-11-08 15:56 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Afzal Mohammed @ 2011-11-08 13:24 UTC (permalink / raw)
To: linux-kernel, broonie, lrg, sameo, nsekhar; +Cc: linux-omap, Afzal Mohammed
Count of selector voltage is required for regulator_set_voltage
to work via set_voltage_sel. VDD1/2 currently have it as zero,
so regulator_set_voltage won't work for VDD1/2.
Update count (n_voltages) for VDD1/2.
Output Voltage = (step value * 12.5 mV + 562.5 mV) * gain
With above expr, number of voltages that can be selected is
step value count * gain count
constant for gain count will be called VDD1_2_NUM_VOLT_COARSE
existing constant for step value count is VDD1_2_NUM_VOLTS,
use VDD1_2_NUM_VOLT_FINE instead to make clear that step value
is not the only component in deciding selectable voltage count
Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
v2: Use macros unambigously to specify count of selectable voltage
drivers/regulator/tps65910-regulator.c | 14 ++++++++------
include/linux/mfd/tps65910.h | 3 ++-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index a620e25..bb2a08d 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -640,10 +640,10 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev,
switch (id) {
case TPS65910_REG_VDD1:
- dcdc_mult = (selector / VDD1_2_NUM_VOLTS) + 1;
+ dcdc_mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1;
if (dcdc_mult == 1)
dcdc_mult--;
- vsel = (selector % VDD1_2_NUM_VOLTS) + 3;
+ vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3;
tps65910_modify_bits(pmic, TPS65910_VDD1,
(dcdc_mult << VDD1_VGAIN_SEL_SHIFT),
@@ -651,10 +651,10 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev,
tps65910_reg_write(pmic, TPS65910_VDD1_OP, vsel);
break;
case TPS65910_REG_VDD2:
- dcdc_mult = (selector / VDD1_2_NUM_VOLTS) + 1;
+ dcdc_mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1;
if (dcdc_mult == 1)
dcdc_mult--;
- vsel = (selector % VDD1_2_NUM_VOLTS) + 3;
+ vsel = (selector % VDD1_2_NUM_VOLT_FINE) + 3;
tps65910_modify_bits(pmic, TPS65910_VDD2,
(dcdc_mult << VDD2_VGAIN_SEL_SHIFT),
@@ -732,9 +732,9 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev,
switch (id) {
case TPS65910_REG_VDD1:
case TPS65910_REG_VDD2:
- mult = (selector / VDD1_2_NUM_VOLTS) + 1;
+ mult = (selector / VDD1_2_NUM_VOLT_FINE) + 1;
volt = VDD1_2_MIN_VOLT +
- (selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;
+ (selector % VDD1_2_NUM_VOLT_FINE) * VDD1_2_OFFSET;
break;
case TPS65911_REG_VDDCTRL:
volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
@@ -930,6 +930,8 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
if (i == TPS65910_REG_VDD1 || i == TPS65910_REG_VDD2) {
pmic->desc[i].ops = &tps65910_ops_dcdc;
+ pmic->desc[i].n_voltages = VDD1_2_NUM_VOLT_FINE *
+ VDD1_2_NUM_VOLT_COARSE;
} else if (i == TPS65910_REG_VDD3) {
if (tps65910_chip_id(tps65910) == TPS65910)
pmic->desc[i].ops = &tps65910_ops_vdd3;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 207b8b2..cfc1f76 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -250,7 +250,8 @@
/*Registers VDD1, VDD2 voltage values definitions */
-#define VDD1_2_NUM_VOLTS 73
+#define VDD1_2_NUM_VOLT_FINE 73
+#define VDD1_2_NUM_VOLT_COARSE 3
#define VDD1_2_MIN_VOLT 6000
#define VDD1_2_OFFSET 125
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count
2011-11-08 13:24 [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count Afzal Mohammed
@ 2011-11-08 15:56 ` Mark Brown
2011-11-23 5:31 ` Mohammed, Afzal
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2011-11-08 15:56 UTC (permalink / raw)
To: Afzal Mohammed; +Cc: linux-kernel, lrg, sameo, nsekhar, linux-omap
On Tue, Nov 08, 2011 at 06:54:10PM +0530, Afzal Mohammed wrote:
> Count of selector voltage is required for regulator_set_voltage
> to work via set_voltage_sel. VDD1/2 currently have it as zero,
> so regulator_set_voltage won't work for VDD1/2.
> Update count (n_voltages) for VDD1/2.
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count
2011-11-08 15:56 ` Mark Brown
@ 2011-11-23 5:31 ` Mohammed, Afzal
2011-11-23 9:59 ` Girdwood, Liam
0 siblings, 1 reply; 4+ messages in thread
From: Mohammed, Afzal @ 2011-11-23 5:31 UTC (permalink / raw)
To: Girdwood, Liam, lrg@slimlogic.co.uk, Mark Brown
Cc: linux-kernel@vger.kernel.org, sameo@linux.intel.com, Nori, Sekhar,
linux-omap@vger.kernel.org
Hi Liam,
On Tue, Nov 08, 2011 at 21:26:39, Mark Brown wrote:
> On Tue, Nov 08, 2011 at 06:54:10PM +0530, Afzal Mohammed wrote:
> > Count of selector voltage is required for regulator_set_voltage
> > to work via set_voltage_sel. VDD1/2 currently have it as zero,
> > so regulator_set_voltage won't work for VDD1/2.
> > Update count (n_voltages) for VDD1/2.
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
Can you please help this patch to get into mainline Kernel.
Without this VDD1 & 2 voltages cannot be varied on TPS65910.
This patch applies cleanly to current mainline and is not
dependent on any other patch.
Regards
Afzal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count
2011-11-23 5:31 ` Mohammed, Afzal
@ 2011-11-23 9:59 ` Girdwood, Liam
0 siblings, 0 replies; 4+ messages in thread
From: Girdwood, Liam @ 2011-11-23 9:59 UTC (permalink / raw)
To: Mohammed, Afzal
Cc: lrg@slimlogic.co.uk, Mark Brown, linux-kernel@vger.kernel.org,
sameo@linux.intel.com, Nori, Sekhar, linux-omap@vger.kernel.org
Hi Afzal,
On 23 November 2011 05:31, Mohammed, Afzal <afzal@ti.com> wrote:
> Hi Liam,
>
> On Tue, Nov 08, 2011 at 21:26:39, Mark Brown wrote:
>> On Tue, Nov 08, 2011 at 06:54:10PM +0530, Afzal Mohammed wrote:
>> > Count of selector voltage is required for regulator_set_voltage
>> > to work via set_voltage_sel. VDD1/2 currently have it as zero,
>> > so regulator_set_voltage won't work for VDD1/2.
>> > Update count (n_voltages) for VDD1/2.
>>
>> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>>
>
> Can you please help this patch to get into mainline Kernel.
> Without this VDD1 & 2 voltages cannot be varied on TPS65910.
>
> This patch applies cleanly to current mainline and is not
> dependent on any other patch.
>
Will do, just been getting stuff back together after the kernel.org
break in and a lot travel.
Liam
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-23 9:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 13:24 [PATCH RESEND v2 2/2] regulator: TPS65910: VDD1/2 voltage selector count Afzal Mohammed
2011-11-08 15:56 ` Mark Brown
2011-11-23 5:31 ` Mohammed, Afzal
2011-11-23 9:59 ` Girdwood, Liam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox