linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes
@ 2011-08-29 18:15 Kevin Hilman
  2011-08-29 18:15 ` [PATCH 1/5] OMAP4: PM: TWL6030: fix voltage conversion formula Kevin Hilman
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

This series focuses on cleanups and fixes in support of the TWL6030 PMIC.

Available in the pm-wip/voltdm_e branch of my linux-omap-pm tree
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git

Applies on v3.1-rc3 + the part A, B, C & D series.

Kevin



Nishanth Menon (3):
  OMAP4: PM: TWL6030: fix uv to voltage for >0x39
  OMAP4: PM: TWL6030: address 0V conversions
  OMAP4: PM: TWL6030: add cmd register

Patrick Titiano (2):
  OMAP4: PM: TWL6030: fix voltage conversion formula
  OMAP4: PM: TWL6030: fix ON/RET/OFF voltages

 arch/arm/mach-omap2/omap_twl.c |   55 +++++++++++++++++++++++++--------------
 1 files changed, 35 insertions(+), 20 deletions(-)

-- 
1.7.6

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] OMAP4: PM: TWL6030: fix voltage conversion formula
  2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
@ 2011-08-29 18:15 ` Kevin Hilman
  2011-08-29 18:15 ` [PATCH 2/5] OMAP4: PM: TWL6030: fix uv to voltage for >0x39 Kevin Hilman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Patrick Titiano <p-titiano@ti.com>

omap_twl_vsel_to_uv() and omap_twl_uv_to_vsel() functions used to convert
voltages to TWL6030 SMPS commands (a.k.a "vsel") implement incorrect conversion
formula.
It uses legacy OMAP3 formula, but OMAP4 Power IC has different offset and
voltage step:
 - Voltage Step is now 12.66mV (instead of 12.5mV)
 - Offset is either 607.7mV or 709mV depending on TWL6030 chip revision
   (instead of 600mV)
This leads to setting voltages potentially higher than expected, and so
potentially some (limited) power overconsumption.

For reference, see formula and tables in section 8.5.2.3
"Output Voltage Selection (Standard Mode / Extended Mode with or without offset)"
 in TWL6030 functional specifications document.

[nm at ti.com: ported to voltdm_c]
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Patrick Titiano <p-titiano@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 6b247d1..a66bf6b 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -106,9 +106,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
 		return 1350000;
 
 	if (smps_offset & 0x8)
-		return ((((vsel - 1) * 125) + 7000)) * 100;
+		return ((((vsel - 1) * 1266) + 70900)) * 10;
 	else
-		return ((((vsel - 1) * 125) + 6000)) * 100;
+		return ((((vsel - 1) * 1266) + 60770)) * 10;
 }
 
 static u8 twl6030_uv_to_vsel(unsigned long uv)
@@ -138,9 +138,9 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
 		return 0x3A;
 
 	if (smps_offset & 0x8)
-		return DIV_ROUND_UP(uv - 700000, 12500) + 1;
+		return DIV_ROUND_UP(uv - 709000, 12660) + 1;
 	else
-		return DIV_ROUND_UP(uv - 600000, 12500) + 1;
+		return DIV_ROUND_UP(uv - 607700, 12660) + 1;
 }
 
 static struct omap_voltdm_pmic omap3_mpu_pmic = {
@@ -187,7 +187,7 @@ static struct omap_voltdm_pmic omap3_core_pmic = {
 
 static struct omap_voltdm_pmic omap4_mpu_pmic = {
 	.slew_rate		= 4000,
-	.step_size		= 12500,
+	.step_size		= 12660,
 	.on_volt		= 1350000,
 	.onlp_volt		= 1350000,
 	.ret_volt		= 837500,
@@ -208,7 +208,7 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
 
 static struct omap_voltdm_pmic omap4_iva_pmic = {
 	.slew_rate		= 4000,
-	.step_size		= 12500,
+	.step_size		= 12660,
 	.on_volt		= 1100000,
 	.onlp_volt		= 1100000,
 	.ret_volt		= 837500,
@@ -229,7 +229,7 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
 
 static struct omap_voltdm_pmic omap4_core_pmic = {
 	.slew_rate		= 4000,
-	.step_size		= 12500,
+	.step_size		= 12660,
 	.on_volt		= 1100000,
 	.onlp_volt		= 1100000,
 	.ret_volt		= 837500,
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] OMAP4: PM: TWL6030: fix uv to voltage for >0x39
  2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
  2011-08-29 18:15 ` [PATCH 1/5] OMAP4: PM: TWL6030: fix voltage conversion formula Kevin Hilman
@ 2011-08-29 18:15 ` Kevin Hilman
  2011-08-29 18:15 ` [PATCH 3/5] OMAP4: PM: TWL6030: address 0V conversions Kevin Hilman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

using 1.35V as a check is not correct, we know that beyond 0x39,
voltages are non linear - hence use the conversion iff uV greater
than that for 0x39. For example, with  709mV as the smps offset,
the max linear is actually 1.41V(0x39vsel)!

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index a66bf6b..5def7c2 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -134,8 +134,13 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
 	 * hardcoding only for 1.35 V which is used for 1GH OPP for
 	 * OMAP4430.
 	 */
-	if (uv == 1350000)
+	if (uv > twl6030_vsel_to_uv(0x39)) {
+		if (uv == 1350000)
+			return 0x3A;
+		pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n",
+			__func__, uv, twl6030_vsel_to_uv(0x39));
 		return 0x3A;
+	}
 
 	if (smps_offset & 0x8)
 		return DIV_ROUND_UP(uv - 709000, 12660) + 1;
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] OMAP4: PM: TWL6030: address 0V conversions
  2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
  2011-08-29 18:15 ` [PATCH 1/5] OMAP4: PM: TWL6030: fix voltage conversion formula Kevin Hilman
  2011-08-29 18:15 ` [PATCH 2/5] OMAP4: PM: TWL6030: fix uv to voltage for >0x39 Kevin Hilman
@ 2011-08-29 18:15 ` Kevin Hilman
  2011-08-29 18:15 ` [PATCH 4/5] OMAP4: PM: TWL6030: fix ON/RET/OFF voltages Kevin Hilman
  2011-08-29 18:15 ` [PATCH 5/5] OMAP4: PM: TWL6030: add cmd register Kevin Hilman
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

0V conversions should be mapped to 0 as it is meant to denote
off voltages.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 5def7c2..b30adf3 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -95,6 +95,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
 		is_offset_valid = true;
 	}
 
+	if (!vsel)
+		return 0;
 	/*
 	 * There is no specific formula for voltage to vsel
 	 * conversion above 1.3V. There are special hardcoded
@@ -127,6 +129,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
 		is_offset_valid = true;
 	}
 
+	if (!uv)
+		return 0x00;
 	/*
 	 * There is no specific formula for voltage to vsel
 	 * conversion above 1.3V. There are special hardcoded
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] OMAP4: PM: TWL6030: fix ON/RET/OFF voltages
  2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
                   ` (2 preceding siblings ...)
  2011-08-29 18:15 ` [PATCH 3/5] OMAP4: PM: TWL6030: address 0V conversions Kevin Hilman
@ 2011-08-29 18:15 ` Kevin Hilman
  2011-08-29 18:15 ` [PATCH 5/5] OMAP4: PM: TWL6030: add cmd register Kevin Hilman
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Patrick Titiano <p-titiano@ti.com>

According to latest OMAP4430 Data Manual v0.4 dated March 2011:
 - Retention voltage shall be set to 0.83V. See tables 2.2, 2.4 and 2.6 in DM.
   This allows saving a little more power in retention states.
 - OPP100 IVA nominal voltage is 1.188V. See table 2.4 in DM.
   This allows saving a little power when CPU wakes up until Smart-Reflex is
   not yet resumed.

[nm at ti.com: ported to voltdm_c]
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Patrick Titiano <p-titiano@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index b30adf3..4bc99fb 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -197,10 +197,10 @@ static struct omap_voltdm_pmic omap3_core_pmic = {
 static struct omap_voltdm_pmic omap4_mpu_pmic = {
 	.slew_rate		= 4000,
 	.step_size		= 12660,
-	.on_volt		= 1350000,
-	.onlp_volt		= 1350000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
+	.on_volt		= 1375000,
+	.onlp_volt		= 1375000,
+	.ret_volt		= 830000,
+	.off_volt		= 0,
 	.volt_setup_time	= 0,
 	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
 	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -218,10 +218,10 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
 static struct omap_voltdm_pmic omap4_iva_pmic = {
 	.slew_rate		= 4000,
 	.step_size		= 12660,
-	.on_volt		= 1100000,
-	.onlp_volt		= 1100000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
+	.on_volt		= 1188000,
+	.onlp_volt		= 1188000,
+	.ret_volt		= 830000,
+	.off_volt		= 0,
 	.volt_setup_time	= 0,
 	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
 	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
@@ -239,10 +239,10 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
 static struct omap_voltdm_pmic omap4_core_pmic = {
 	.slew_rate		= 4000,
 	.step_size		= 12660,
-	.on_volt		= 1100000,
-	.onlp_volt		= 1100000,
-	.ret_volt		= 837500,
-	.off_volt		= 600000,
+	.on_volt		= 1200000,
+	.onlp_volt		= 1200000,
+	.ret_volt		= 830000,
+	.off_volt		= 0,
 	.volt_setup_time	= 0,
 	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
 	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] OMAP4: PM: TWL6030: add cmd register
  2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
                   ` (3 preceding siblings ...)
  2011-08-29 18:15 ` [PATCH 4/5] OMAP4: PM: TWL6030: fix ON/RET/OFF voltages Kevin Hilman
@ 2011-08-29 18:15 ` Kevin Hilman
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2011-08-29 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Nishanth Menon <nm@ti.com>

Without the command register, ON/ONLP/RET/OFF voltages are
useless. and TWL will be unable to use these

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap_twl.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 4bc99fb..f515a1a 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -42,8 +42,11 @@
 
 #define OMAP4_SRI2C_SLAVE_ADDR		0x12
 #define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
+#define OMAP4_VDD_MPU_SR_CMD_REG	0x56
 #define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
+#define OMAP4_VDD_IVA_SR_CMD_REG	0x5C
 #define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
+#define OMAP4_VDD_CORE_SR_CMD_REG	0x62
 
 #define OMAP4_VP_CONFIG_ERROROFFSET	0x00
 #define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
@@ -210,6 +213,7 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
 	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
 	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
 	.volt_reg_addr		= OMAP4_VDD_MPU_SR_VOLT_REG,
+	.cmd_reg_addr		= OMAP4_VDD_MPU_SR_CMD_REG,
 	.i2c_high_speed		= true,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
@@ -231,6 +235,7 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
 	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
 	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
 	.volt_reg_addr		= OMAP4_VDD_IVA_SR_VOLT_REG,
+	.cmd_reg_addr		= OMAP4_VDD_IVA_SR_CMD_REG,
 	.i2c_high_speed		= true,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
@@ -252,6 +257,7 @@ static struct omap_voltdm_pmic omap4_core_pmic = {
 	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
 	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
 	.volt_reg_addr		= OMAP4_VDD_CORE_SR_VOLT_REG,
+	.cmd_reg_addr		= OMAP4_VDD_CORE_SR_CMD_REG,
 	.vsel_to_uv		= twl6030_vsel_to_uv,
 	.uv_to_vsel		= twl6030_uv_to_vsel,
 };
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-29 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 18:15 [PATCH 0/5] OMAP: voltage cleanup part E: TWL6030 PMIC fixes Kevin Hilman
2011-08-29 18:15 ` [PATCH 1/5] OMAP4: PM: TWL6030: fix voltage conversion formula Kevin Hilman
2011-08-29 18:15 ` [PATCH 2/5] OMAP4: PM: TWL6030: fix uv to voltage for >0x39 Kevin Hilman
2011-08-29 18:15 ` [PATCH 3/5] OMAP4: PM: TWL6030: address 0V conversions Kevin Hilman
2011-08-29 18:15 ` [PATCH 4/5] OMAP4: PM: TWL6030: fix ON/RET/OFF voltages Kevin Hilman
2011-08-29 18:15 ` [PATCH 5/5] OMAP4: PM: TWL6030: add cmd register Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).