Skip to contentSkip to conversation

Various tps6586x regulator fixes from ChromeOS

PATCH In review Stephen Warren 3 participants 7 messages Dec 1, 2010 – Dec 2, 2010 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
nvpublic
#1 lore raw

PATCH 1/4 regulator: tps6586x: Add missing bit mask generation

From: Danny Huang <[email protected]>

Change-Id I76eaceb31b56264f6978af15db1e6fc7e2e01b5a

(Split into separate patches)

---
 drivers/regulator/tps6586x-regulator.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/tps6586x-regulator.c +2 -2
index 51237fb..0e59e81 100644
@@ -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)
Signature · 2 lines
1.7.0.4
nvpublic
#2 lore raw

PATCH 2/4 regulator: tps6586x: Fix TPS6586X_DVM to store goreg/bit

In reply to Stephen Warren

From: Danny Huang <[email protected]>

Change-Id Idacf5e1e51dbbbcd5ea93f310a4e907977e7359e

(Split into separate patches)
(Minor formatting fixes)

---
 drivers/regulator/tps6586x-regulator.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/regulator/tps6586x-regulator.c +13 -6
index 0e59e81..effa677 100644
@@ -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),
Signature · 2 lines
1.7.0.4
nvpublic
#3 lore raw

PATCH 3/4 regulator: tps6586x: Handle both enable reg/bits being the same

In reply to Stephen Warren

From: Danny Huang <[email protected]>

Change-Id I40400bb65eab496bb1becd26b37a9653b99d4f41

(Split into separate patches)

---
 drivers/regulator/tps6586x-regulator.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/regulator/tps6586x-regulator.c +4 -0
index effa677..c668944 100644
@@ -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;
Signature · 2 lines
1.7.0.4
nvpublic
#4 lore raw

PATCH 4/4 regulator: tps6586x: correct register table

In reply to Stephen Warren

From: Danny Huang <[email protected]>

Correct the register table for SM2, LDO8, RTC

Change-Id I45348cec5ffbb7da9bd7523764fb611b537236b8
---
 drivers/regulator/tps6586x-regulator.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/regulator/tps6586x-regulator.c +3 -3
index c668944..6d20b04 100644
@@ -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),
Signature · 2 lines
1.7.0.4
nvpublic
Acked-by on the v1 series
#5 lore raw
In reply to Stephen Warren
Quoted 5 lines · Stephen Warren

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.

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

Quoted 2 lines

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.

#6 lore raw
Quoted 8 lines · Mark Brown
Quoted 5 lines · Stephen Warren

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.

All applied.

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk