[Gta04-owner] GTA04 power management.

NeilBrown neilb at suse.de
Sat Dec 24 10:27:17 CET 2011


On Sat, 24 Dec 2011 16:10:02 +1100 NeilBrown <neilb at suse.de> wrote:

> 
> 
> Hi,
>  I've been playing with power management and have not achieved the results I
>  had hoped for yet and am running out of ideas.  So I thought I would
>  summarise were I am at in the hope that someone can say something helpful.
> 
>  I'm particularly looking at suspend-mode.  While runtime power management
>  (turning the CPU on/off dynamically as needed and adjusting voltage) is
>  attractive it can never save more power than full suspend, so suspend mode
>  will show us the minimum power usage without turning the device off
>  completely.
> 
>  I'm current measuring about 8%/hour battery discharge while in suspend mode
>  which corresponds to approximately 100mA current drain.  When the device is
>  off I lose about  1%/hour which is around 10mA (the precision of these
>  measurements isn't great so there is a lot of rounding here) which is
>  presumably attributed to the OPTION GSM module (and matches what HNS said it
>  would be).
> 
>  So that suggests around 90mA still being used by something else.
> 
>  I've turned off the power supplies for WIFI, BT, GPS antenna, sensors.
>  I've turned off VDD1 and VDD2 to the CPU, and the various power supplies for
>  USB and the battery charger (VINTANA, VINTDIG).  All the leds are off.

If anyone wants to try or review the code that turns everything off, I have
just pushed out an update to git://neil.brown.name/gta04#merge

and include the last commit below.

NeilBrown

From 5fdb570f0bdcb3fbd054491a7ff6706ee53c623a Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb at suse.de>
Date: Sat, 24 Dec 2011 20:23:12 +1100
Subject: [PATCH] gta04 - add suspend/resume scripts.

These should turn off VDD1, VDD2, various VINT regulators etc.

But I still see a current draw of about 100mA during suspend.

Signed-off-by: NeilBrown <neilb at suse.de>

diff --git a/arch/arm/mach-omap2/board-omap3gta04.c b/arch/arm/mach-omap2/board-omap3gta04.c
index 657dde6..52d80ea 100644
--- a/arch/arm/mach-omap2/board-omap3gta04.c
+++ b/arch/arm/mach-omap2/board-omap3gta04.c
@@ -358,8 +358,6 @@ static struct regulator_consumer_supply gta04_vdvi_supply = {
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 
-static void wlan_reset(struct device *dev, int slow, int power_on);
-
 static struct omap2_hsmmc_info mmc[] = {
 	{
 		.mmc		= 1,
@@ -636,10 +634,110 @@ static struct twl4030_madc_platform_data gta04_madc_data = {
 
 // FIXME: we could copy more scripts from board-sdp3430.c if we understand what they do... */
 
+
+static struct twl4030_ins __initdata sleep_on_seq[] = {
+	/* Turn off HFCLKOUT */
+//	{MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_OFF), 2},
+	/* Turn OFF VDD1 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD1, RES_STATE_OFF), 2},
+	/* Turn OFF VDD2 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD2, RES_STATE_OFF), 2},
+	/* Turn OFF VPLL1 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VPLL1, RES_STATE_OFF), 2},
+
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTANA1, RES_STATE_OFF), 2},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTANA2, RES_STATE_OFF), 2},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTDIG, RES_STATE_OFF), 2},
+
+};
+
+static struct twl4030_script sleep_on_script __initdata = {
+	.script	= sleep_on_seq,
+	.size	= ARRAY_SIZE(sleep_on_seq),
+	.flags	= TWL4030_SLEEP_SCRIPT,
+};
+
+static struct twl4030_ins wakeup_p12_seq[] __initdata = {
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTANA1, RES_STATE_ACTIVE), 2},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTANA2, RES_STATE_ACTIVE), 2},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VINTDIG, RES_STATE_ACTIVE), 2},
+
+	/* Turn on HFCLKOUT */
+//	{MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
+	/* Turn ON VDD1 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD1, RES_STATE_ACTIVE), 2},
+	/* Turn ON VDD2 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD2, RES_STATE_ACTIVE), 2},
+	/* Turn ON VPLL1 */
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VPLL1, RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p12_script __initdata = {
+	.script	= wakeup_p12_seq,
+	.size	= ARRAY_SIZE(wakeup_p12_seq),
+	.flags	= TWL4030_WAKEUP12_SCRIPT,
+};
+
+/* Turn the HFCLK on when CPU asks for it. */
+static struct twl4030_ins wakeup_p3_seq[] __initdata = {
+	{MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wakeup_p3_script __initdata = {
+	.script = wakeup_p3_seq,
+	.size   = ARRAY_SIZE(wakeup_p3_seq),
+	.flags  = TWL4030_WAKEUP3_SCRIPT,
+};
+
+static struct twl4030_ins wrst_seq[] __initdata = {
+/*
+ * Reset twl4030.
+ * Reset VDD1 regulator.
+ * Reset VDD2 regulator.
+ * Reset VPLL1 regulator.
+ * Enable sysclk output.
+ * Reenable twl4030.
+ */
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD1, RES_STATE_WRST), 15},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VDD2, RES_STATE_WRST), 15},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_VPLL1, RES_STATE_WRST), 0x60},
+	{MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
+	{MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
+};
+
+static struct twl4030_script wrst_script __initdata = {
+	.script = wrst_seq,
+	.size   = ARRAY_SIZE(wrst_seq),
+	.flags  = TWL4030_WRST_SCRIPT,
+};
+
+static struct twl4030_script *twl4030_scripts[] __initdata = {
+	&wakeup_p12_script,
+	&wakeup_p3_script,
+	&sleep_on_script,
+	&wrst_script,
+};
+
+#define TWL_RES_CFG(_res, _devg) { .resource = _res, .devgroup = _devg, \
+	.type = TWL4030_RESCONFIG_UNDEF, .type2 = TWL4030_RESCONFIG_UNDEF,}
+
+#define DEV_GRP_ALL (DEV_GRP_P1|DEV_GRP_P2|DEV_GRP_P3)
+static struct twl4030_resconfig twl4030_rconfig[] = {
+	TWL_RES_CFG(RES_HFCLKOUT, DEV_GRP_P3),
+	TWL_RES_CFG(RES_VINTANA1, DEV_GRP_ALL),
+	TWL_RES_CFG(RES_VINTANA1, DEV_GRP_P1),
+	TWL_RES_CFG(RES_VINTANA2, DEV_GRP_ALL),
+	TWL_RES_CFG(RES_VINTANA2, DEV_GRP_P1),
+	TWL_RES_CFG(RES_VINTDIG, DEV_GRP_ALL),
+	TWL_RES_CFG(RES_VINTDIG, DEV_GRP_P1),
+	{ 0, 0},
+};
+
 struct twl4030_power_data gta04_power_scripts = {
-/*	.scripts	= NULL,	*/
-	.num		= 0,
-/*	.resource_config	= NULL; */
+	.scripts	= twl4030_scripts,
+	.num		= ARRAY_SIZE(twl4030_scripts),
+	.resource_config = twl4030_rconfig,
 	.use_poweroff	= 1,
 };
 
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index bfbd660..7af905d 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -380,6 +380,9 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
 	msg->len = num_bytes + 1;
 	msg->flags = 0;
 	msg->buf = value;
+	printk("%02x/%02x:", mod_no,reg);
+	for (ret = 0; ret < num_bytes; ret++) printk(" %02x", value[ret+1]);
+	printk("\n");
 	/* over write the first byte of buffer with the register address */
 	*value = twl_map[mod_no].base + reg;
 	ret = i2c_transfer(twl->client->adapter, twl->xfer_msg, 1);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20111224/e0f141ee/attachment.bin>


More information about the Gta04-owner mailing list