[PATCH 2/10] deadbat-defer-ldo.patch

Werner Almesberger werner at openmoko.org
Tue Jul 15 12:58:01 CEST 2008


This patch defers the enabling of LDO regulators that are not needed during
early boot. (In fact, LDO1, LDO2, and LDO5 are not needed while in u-boot
at all.) These are:

- LDO1 (GSENSOR_3V3)
- LDO2 (CODEC_3V3)
- LDO5 (RF_3V)
- LDO6 (LCM_3V)

Enabling them after we've established that we have a good power source
reduces the USB current budget by about 40mA.

Signed-off-by: Werner Almesberger <werner at openmoko.org>

Index: u-boot/board/neo1973/gta02/gta02.c
===================================================================
--- u-boot.orig/board/neo1973/gta02/gta02.c	2008-07-14 16:49:45.000000000 -0300
+++ u-boot/board/neo1973/gta02/gta02.c	2008-07-14 19:53:48.000000000 -0300
@@ -345,6 +345,22 @@
 	neo1973_led(GTA02_LED_AUX_RED, 0);
 }
 
+static void pcf50633_late_init(void)
+{
+#ifdef CONFIG_ARCH_GTA02_v1
+	uint8_t pwren = 1;	/* always on */
+	uint8_t recent = 0;	/* antiques don't have that */
+#else
+	uint8_t pwren = 2;	/* enabled if GPIO1 = HIGH */
+	uint8_t recent = 1;	/* always on */
+#endif
+
+	pcf50633_reg_write(PCF50633_REG_LDO1ENA, pwren);
+	pcf50633_reg_write(PCF50633_REG_LDO2ENA, 2); /* enabled if GPIO1 = H */
+	pcf50633_reg_write(PCF50633_REG_LDO5ENA, recent);
+	pcf50633_reg_write(PCF50633_REG_LDO6ENA, recent);
+}
+
 int board_late_init(void)
 {
 	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
@@ -364,6 +380,7 @@
 	int2 = pcf50633_reg_read(PCF50633_REG_INT2);
 
 	wait_for_power();
+	pcf50633_late_init();
 
 	/* issue a short pulse with the vibrator */
 	neo1973_led(GTA02_LED_AUX_RED, 1);
Index: u-boot/board/neo1973/gta02/pcf50633.c
===================================================================
--- u-boot.orig/board/neo1973/gta02/pcf50633.c	2008-07-14 16:49:50.000000000 -0300
+++ u-boot/board/neo1973/gta02/pcf50633.c	2008-07-14 19:53:31.000000000 -0300
@@ -63,14 +63,10 @@
 	[PCF50633_REG_LEDDIM]	= 0x20,	/* dimming curve */
 
 	[PCF50633_REG_LDO1OUT]	= 0x18,	/* 3.3V (24 * 0.1V + 0.9V) */
-#ifdef CONFIG_ARCH_GTA02_v1
-	[PCF50633_REG_LDO1ENA]	= 0x01,	/* always on */
-#else
-	[PCF50633_REG_LDO1ENA]	= 0x02, /* enabled if GPIO1 = HIGH */
-#endif
+	[PCF50633_REG_LDO1ENA]	= 0x00,	/* GSENSOR_3V3, enable later */
 
 	[PCF50633_REG_LDO2OUT]	= 0x18,	/* 3.3V (24 * 0.1V + 0.9V) */
-	[PCF50633_REG_LDO2ENA]	= 0x02, /* enabled if GPIO1 = HIGH */
+	[PCF50633_REG_LDO2ENA]	= 0x00, /* CODEC_3V3, enable later */
 
 #ifdef CONFIG_ARCH_GTA02_v1
 	[PCF50633_REG_LDO3OUT]	= 0x15,	/* 3.0V (21 * 0.1V + 0.9V) */
@@ -82,19 +78,11 @@
 
 	[PCF50633_REG_LDO4ENA]	= 0x00,
 
-#ifdef CONFIG_ARCH_GTA02_v1
-	[PCF50633_REG_LDO5ENA]	= 0x00,
-#else
 	[PCF50633_REG_LDO5OUT]	= 0x15, /* 3.0V (21 * 0.1V + 0.9V) */
-	[PCF50633_REG_LDO5ENA]	= 0x01, /* always on */
-#endif
+	[PCF50633_REG_LDO5ENA]	= 0x00, /* RF_3V, enable later  */
 
-#ifdef CONFIG_ARCH_GTA02_v1
-	[PCF50633_REG_LDO6ENA]	= 0x00,
-#else
 	[PCF50633_REG_LDO6OUT]	= 0x15,	/* 3.0V (21 * 0.1V + 0.9V) */
-	[PCF50633_REG_LDO6ENA]	= 0x01,	/* always on */
-#endif
+	[PCF50633_REG_LDO6ENA]	= 0x00,	/* LCM_3V, enable later */
 
 	[PCF50633_REG_HCLDOOUT]	= 0x18,	/* 3.3V (24 * 0.1V + 0.9V) */
 	[PCF50633_REG_HCLDOENA]	= 0x00, /* off by default*/




More information about the openmoko-kernel mailing list