2010-12-01 20:38:23

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 0/4] Various tps6586x regulator fixes from ChromeOS

Following are some patches for the tps6586x regulator driver that were
made in the ChromeOS repository.

A variety of people have built a kernel containing these patches, and
booted Tegra Seaboard with that kernel.

Danny Huang (4):
regulator: tps6586x: Add missing bit mask generation
regulator: tps6586x: Fix TPS6586X_DVM to store goreg/bit
regulator: tps6586x: Handle both enable reg/bits being the same
regulator: tps6586x: correct register table

drivers/regulator/tps6586x-regulator.c | 33 +++++++++++++++++++++----------
1 files changed, 22 insertions(+), 11 deletions(-)

--
nvpublic


2010-12-01 20:38:27

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 4/4] regulator: tps6586x: correct register table

From: Danny Huang <[email protected]>

Correct the register table for SM2, LDO8, RTC

Change-Id: I45348cec5ffbb7da9bd7523764fb611b537236b8
Signed-off-by: Danny Huang <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
---
drivers/regulator/tps6586x-regulator.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index c668944..6d20b04 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -274,11 +274,11 @@ static struct tps6586x_regulator tps6586x_regulator[] = {
TPS6586X_LDO(LDO_5, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6),
TPS6586X_LDO(LDO_6, ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4),
TPS6586X_LDO(LDO_7, ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5),
- TPS6586X_LDO(LDO_8, ldo, SUPPLYV1, 5, 3, ENC, 6, END, 6),
+ TPS6586X_LDO(LDO_8, ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6),
TPS6586X_LDO(LDO_9, ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7),
- TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, ENE, 7, ENE, 7),
+ TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7),
TPS6586X_LDO(LDO_1, dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1),
- TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 1, END, 1),
+ TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7),

TPS6586X_DVM(LDO_2, dvm, LDO2BV1, 0, 5, ENA, 3, ENB, 3, VCC2, 6),
TPS6586X_DVM(LDO_4, ldo4, LDO4V1, 0, 5, ENC, 3, END, 3, VCC1, 6),
--
1.7.0.4
nvpublic

2010-12-01 20:38:35

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 2/4] regulator: tps6586x: Fix TPS6586X_DVM to store goreg/bit

From: Danny Huang <[email protected]>

Change-Id: Idacf5e1e51dbbbcd5ea93f310a4e907977e7359e
Signed-off-by: Danny Huang <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
(Split into separate patches)
(Minor formatting fixes)
---
drivers/regulator/tps6586x-regulator.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 0e59e81..effa677 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -231,8 +231,7 @@ static int tps6586x_dvm_voltages[] = {
};

#define TPS6586X_REGULATOR(_id, vdata, _ops, vreg, shift, nbits, \
- ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
-{ \
+ ereg0, ebit0, ereg1, ebit1) \
.desc = { \
.name = "REG-" #_id, \
.ops = &tps6586x_regulator_##_ops, \
@@ -248,18 +247,26 @@ static int tps6586x_dvm_voltages[] = {
.enable_bit[0] = (ebit0), \
.enable_reg[1] = TPS6586X_SUPPLY##ereg1, \
.enable_bit[1] = (ebit1), \
- .voltages = tps6586x_##vdata##_voltages, \
-}
+ .voltages = tps6586x_##vdata##_voltages,
+
+#define TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \
+ .go_reg = TPS6586X_##goreg, \
+ .go_bit = (gobit),

#define TPS6586X_LDO(_id, vdata, vreg, shift, nbits, \
ereg0, ebit0, ereg1, ebit1) \
+{ \
TPS6586X_REGULATOR(_id, vdata, ldo_ops, vreg, shift, nbits, \
- ereg0, ebit0, ereg1, ebit1, 0, 0)
+ ereg0, ebit0, ereg1, ebit1) \
+}

#define TPS6586X_DVM(_id, vdata, vreg, shift, nbits, \
ereg0, ebit0, ereg1, ebit1, goreg, gobit) \
+{ \
TPS6586X_REGULATOR(_id, vdata, dvm_ops, vreg, shift, nbits, \
- ereg0, ebit0, ereg1, ebit1, goreg, gobit)
+ ereg0, ebit0, ereg1, ebit1) \
+ TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \
+}

static struct tps6586x_regulator tps6586x_regulator[] = {
TPS6586X_LDO(LDO_0, ldo, SUPPLYV1, 5, 3, ENC, 0, END, 0),
--
1.7.0.4
nvpublic

2010-12-01 20:38:25

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 1/4] regulator: tps6586x: Add missing bit mask generation

From: Danny Huang <[email protected]>

Change-Id: I76eaceb31b56264f6978af15db1e6fc7e2e01b5a
Signed-off-by: Danny Huang <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
(Split into separate patches)
---
drivers/regulator/tps6586x-regulator.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 51237fb..0e59e81 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -298,14 +298,14 @@ static inline int tps6586x_regulator_preinit(struct device *parent,
if (ret)
return ret;

- if (!(val2 & ri->enable_bit[1]))
+ if (!(val2 & (1 << ri->enable_bit[1])))
return 0;

/*
* The regulator is on, but it's enabled with the bit we don't
* want to use, so we switch the enable bits
*/
- if (!(val1 & ri->enable_bit[0])) {
+ if (!(val1 & (1 << ri->enable_bit[0]))) {
ret = tps6586x_set_bits(parent, ri->enable_reg[0],
1 << ri->enable_bit[0]);
if (ret)
--
1.7.0.4
nvpublic

2010-12-01 20:38:25

by Stephen Warren

[permalink] [raw]
Subject: [PATCH 3/4] regulator: tps6586x: Handle both enable reg/bits being the same

From: Danny Huang <[email protected]>

Change-Id: I40400bb65eab496bb1becd26b37a9653b99d4f41
Signed-off-by: Danny Huang <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
(Split into separate patches)
---
drivers/regulator/tps6586x-regulator.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index effa677..c668944 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -297,6 +297,10 @@ static inline int tps6586x_regulator_preinit(struct device *parent,
uint8_t val1, val2;
int ret;

+ if (ri->enable_reg[0] == ri->enable_reg[1] &&
+ ri->enable_bit[0] == ri->enable_bit[1])
+ return 0;
+
ret = tps6586x_read(parent, ri->enable_reg[0], &val1);
if (ret)
return ret;
--
1.7.0.4
nvpublic

2010-12-02 09:40:44

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/4] Various tps6586x regulator fixes from ChromeOS

On Wed, Dec 01, 2010 at 01:37:27PM -0700, Stephen Warren wrote:
> Following are some patches for the tps6586x regulator driver that were
> made in the ChromeOS repository.
>
> A variety of people have built a kernel containing these patches, and
> booted Tegra Seaboard with that kernel.

Acked-by: Mark Brown <[email protected]>

In general please do try to provide a bit more detail in your changelogs
- things like missing shifts are fairly obvious but...

> regulator: tps6586x: Fix TPS6586X_DVM to store goreg/bit
> regulator: tps6586x: Handle both enable reg/bits being the same

...things like these aren't obvious.

Please also note that the kernel does not use Gerritt.

2010-12-02 11:28:21

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH 0/4] Various tps6586x regulator fixes from ChromeOS

On Thu, 2010-12-02 at 09:40 +0000, Mark Brown wrote:
> On Wed, Dec 01, 2010 at 01:37:27PM -0700, Stephen Warren wrote:
> > Following are some patches for the tps6586x regulator driver that were
> > made in the ChromeOS repository.
> >
> > A variety of people have built a kernel containing these patches, and
> > booted Tegra Seaboard with that kernel.
>
> Acked-by: Mark Brown <[email protected]>

All applied.

Thanks

Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk