From: Thara Gopinath <thara@ti.com>
To: linux-omap@vger.kernel.org
Cc: paul@pwsan.com, khilman@deeprootsystems.com, b-cousson@ti.com,
vishwanath.bs@ti.com, sawant@ti.com,
Thara Gopinath <thara@ti.com>
Subject: [PATCH v3 1/6] OMAP4: Add the new voltage to vsel calculation formula
Date: Wed, 27 Oct 2010 21:46:31 +0530 [thread overview]
Message-ID: <1288196196-15469-2-git-send-email-thara@ti.com> (raw)
In-Reply-To: <1288196196-15469-1-git-send-email-thara@ti.com>
TWL6030 the power IC used along with OMAP4 in OMAP4 SDPs,
blaze boards and panda boards has a different formula
from that of TWL4030 for voltage to vsel and
vsel to voltage calculation. This patch implements the new
formula depending on the PMIC type.
Signed-off-by: Thara Gopinath <thara@ti.com>
---
arch/arm/plat-omap/opp_twl_tps.c | 71 ++++++++++++++++++++++++++++++++++++++
1 files changed, 71 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c
index 4448fc5..358b67b 100644
--- a/arch/arm/plat-omap/opp_twl_tps.c
+++ b/arch/arm/plat-omap/opp_twl_tps.c
@@ -15,9 +15,16 @@
#include <linux/module.h>
+#include <linux/i2c/twl.h>
+
#include <plat/opp_twl_tps.h>
#include <plat/voltage.h>
+static bool is_offset_valid;
+static u8 smps_offset;
+
+#define REG_SMPS_OFFSET 0xE0
+
/**
* omap_twl_vsel_to_vdc - convert TWL/TPS VSEL value to microvolts DC
* @vsel: TWL/TPS VSEL value to convert
@@ -27,6 +34,38 @@
*/
unsigned long omap_twl_vsel_to_uv(const u8 vsel)
{
+ if (twl_class_is_6030()) {
+ /*
+ * In TWL6030 depending on the value of SMPS_OFFSET
+ * efuse register the voltage range supported in
+ * standard mode can be either between 0.6V - 1.3V or
+ * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
+ * is programmed to all 0's where as starting from
+ * TWL6030 ES1.1 the efuse is programmed to 1
+ */
+ if (!is_offset_valid) {
+ twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset, 0xE0);
+ is_offset_valid = true;
+ }
+
+ if (smps_offset & 0x8) {
+ return ((((vsel - 1) * 125) + 7000)) * 100;
+ } else {
+ /*
+ * In case of the supported voltage range being
+ * between 0.6V - 1.3V, there is not specific
+ * formula for voltage to vsel conversion above
+ * 1.3V. There are special hardcoded values for
+ * voltages above 1.3V. Currently we are hardcodig
+ * only for 1.35 V which is used for 1GH OPP for
+ * OMAP4430.
+ */
+ if (vsel == 0x3A)
+ return 1350000;
+ return ((((vsel - 1) * 125) + 6000)) * 100;
+ }
+ }
+
return (((vsel * 125) + 6000)) * 100;
}
@@ -40,6 +79,38 @@ unsigned long omap_twl_vsel_to_uv(const u8 vsel)
u8 omap_twl_uv_to_vsel(unsigned long uv)
{
/* Round up to higher voltage */
+ if (twl_class_is_6030()) {
+ /*
+ * In TWL6030 depending on the value of SMPS_OFFSET
+ * efuse register the voltage range supported in
+ * standard mode can be either between 0.6V - 1.3V or
+ * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
+ * is programmed to all 0's where as starting from
+ * TWL6030 ES1.1 the efuse is programmed to 1
+ */
+ if (!is_offset_valid) {
+ twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset, 0xE0);
+ is_offset_valid = true;
+ }
+
+ if (smps_offset & 0x8) {
+ return DIV_ROUND_UP(uv - 700000, 12500) + 1;
+ } else {
+ /*
+ * In case of the supported voltage range being
+ * between 0.6V - 1.3V, there is not specific
+ * formula for voltage to vsel conversion above
+ * 1.3V. There are special hardcoded values for
+ * voltages above 1.3V. Currently we are hardcodig
+ * only for 1.35 V which is used for 1GH OPP for
+ * OMAP4430.
+ */
+ if (uv == 1350000)
+ return 0x3A;
+ return DIV_ROUND_UP(uv - 600000, 12500) + 1;
+ }
+ }
+
return DIV_ROUND_UP(uv - 600000, 12500);
}
--
1.7.0.4
next prev parent reply other threads:[~2010-10-27 16:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 16:16 [PATCH v3 0/6] OMAP4: Smartreflex and Voltage layer support Thara Gopinath
2010-10-27 16:16 ` Thara Gopinath [this message]
2010-11-04 17:24 ` [PATCH v3 1/6] OMAP4: Add the new voltage to vsel calculation formula Tony Lindgren
2010-11-15 14:46 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 2/6] OMAP4: Adding voltage driver support Thara Gopinath
2010-11-10 19:22 ` Kevin Hilman
2010-11-15 11:04 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 3/6] OMAP4: PM: Program correct init voltages for scalable VDDs Thara Gopinath
2010-11-04 17:20 ` Tony Lindgren
2010-11-15 14:51 ` Gopinath, Thara
2010-10-27 16:16 ` [PATCH v3 4/6] OMAP4: hwmod: Add inital data for smartreflex modules Thara Gopinath
2010-10-27 16:16 ` [PATCH v3 5/6] OMAP4: Adding dev atrributes to OMAP4 smartreflex hwmod data Thara Gopinath
2010-10-27 16:16 ` [PATCH v3 6/6] OMAP4: Smartreflex framework extensions Thara Gopinath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1288196196-15469-2-git-send-email-thara@ti.com \
--to=thara@ti.com \
--cc=b-cousson@ti.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=sawant@ti.com \
--cc=vishwanath.bs@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox