ARM: tegra: pluto: put HV IOs into DPD explicitly during LP1
Daniel Solomon [Fri, 12 Apr 2013 18:36:30 +0000 (11:36 -0700)]
Rail VDDIO_HV is consuming higher power than predicted during LP1,
this could be fixed by explicitly putting the pins on that rail
into DPD mode. And by putting the pins into tristate mode, it
saves additional power during LP1.

bug 1248007

Change-Id: I636a307c6a24d4489b4889a068ccd2d00c6665d3
Signed-off-by: Eric Miao <emiao@nvidia.com>
Signed-off-by: Daniel Solomon <daniels@nvidia.com>
Reviewed-on: http://git-master/r/213864
(Cherry picked from fce59945c9a121033d8c0fd6ab623129676e4120)
Reviewed-on: http://git-master/r/226773
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/board-pluto-pinmux.c
arch/arm/mach-tegra/board-pluto-power.c

index 8232fe1..0fa2c1c 100644 (file)
@@ -136,6 +136,13 @@ static struct tegra_pingroup_config pluto_sleep_pinmux[] = {
        DEFAULT_PINMUX(GMI_CS7_N,   GMI,     NORMAL,    NORMAL,    INPUT),
        DEFAULT_PINMUX(GMI_IORDY,   GMI,     NORMAL,    NORMAL,    INPUT),
        DEFAULT_PINMUX(GMI_RST_N,   GMI,     NORMAL,    NORMAL,    INPUT),
+
+       /* VDDIO_HV_AP */
+       DEFAULT_PINMUX(OWR,  OWR,  NORMAL, TRISTATE, INPUT),
+       CEC_PINMUX(HDMI_CEC, CEC,  NORMAL, TRISTATE, INPUT, DISABLE, ENABLE),
+       I2C_PINMUX(DDC_SCL,  I2C4, NORMAL, TRISTATE, INPUT, DEFAULT, DEFAULT),
+       I2C_PINMUX(DDC_SDA,  I2C4, NORMAL, TRISTATE, INPUT, DEFAULT, DEFAULT),
+       USB_PINMUX(USB_VBUS_EN0, RSVD3, NORMAL, NORMAL, OUTPUT, DISABLE, DISABLE),
 };
 #endif
 
index 99e1926..ac673c3 100644 (file)
 #include <linux/platform_device.h>
 #include <linux/resource.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
 
 #include <mach/edp.h>
 #include <mach/irqs.h>
 #include <mach/hardware.h>
+#include <mach/io_dpd.h>
 #include <linux/regulator/fixed.h>
 #include <linux/mfd/palmas.h>
 #include <linux/regulator/machine.h>
@@ -702,6 +704,30 @@ static int __init pluto_fixed_regulator_init(void)
 }
 subsys_initcall_sync(pluto_fixed_regulator_init);
 
+static struct tegra_io_dpd hv_io = {
+       .name                   = "HV",
+       .io_dpd_reg_index       = 1,
+       .io_dpd_bit             = 6,
+};
+
+static void pluto_board_suspend(int state, enum suspend_stage stage)
+{
+       /* put HV IOs into DPD mode to save additional power */
+       if (state == TEGRA_SUSPEND_LP1 && stage == TEGRA_SUSPEND_BEFORE_CPU) {
+               gpio_direction_input(TEGRA_GPIO_PK6);
+               tegra_io_dpd_enable(&hv_io);
+       }
+}
+
+static void pluto_board_resume(int state, enum resume_stage stage)
+{
+       /* bring HV IOs back from DPD mode, GPIO configuration
+        * will be restored by gpio driver
+        */
+       if (state == TEGRA_SUSPEND_LP1 && stage == TEGRA_RESUME_AFTER_CPU)
+               tegra_io_dpd_disable(&hv_io);
+}
+
 static struct tegra_suspend_platform_data pluto_suspend_data = {
        .cpu_timer      = 300,
        .cpu_off_timer  = 300,
@@ -721,6 +747,8 @@ static struct tegra_suspend_platform_data pluto_suspend_data = {
        .lp1_core_volt_low = 0x2e,
        .lp1_core_volt_high = 0x42,
 #endif
+       .board_suspend  = pluto_board_suspend,
+       .board_resume   = pluto_board_resume,
 };
 
 int __init pluto_suspend_init(void)