summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-12-01 17:44:13 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-12-01 17:44:13 +0100
commit3d7a3b49fdb67464f04f6bf720c411a95498938a (patch)
tree993795e6f8472571d0955094bfe791aefac909cd
parentfdab4a21aca960b11ce8ffcef82a7794c03e93f9 (diff)
apalis_t30: implement optional force off gpio support
Both the Apalis EvalBoard as well as Ixora allow their LTC2954 pushbutton on/off controller to optionally be forced off by using a GPIO. This patch implements this upon poweroff/shutdown using Apalis GPIO6 which happens to be internally pulled-up upon power-on reset (otherwise we would immediately get powered off again). For this to work the following wiring is required: Apalis EvalBoard V1.1a X2-A5 to X61-5 Ixora V1.0a X27-18 to X5-5
-rw-r--r--arch/arm/mach-tegra/board-apalis_t30-power.c19
-rw-r--r--arch/arm/mach-tegra/board-apalis_t30.c2
-rw-r--r--arch/arm/mach-tegra/board-apalis_t30.h2
3 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-apalis_t30-power.c b/arch/arm/mach-tegra/board-apalis_t30-power.c
index 7b2744a0..064c438 100644
--- a/arch/arm/mach-tegra/board-apalis_t30-power.c
+++ b/arch/arm/mach-tegra/board-apalis_t30-power.c
@@ -246,7 +246,11 @@ static struct tps6591x_platform_data tps_platform = {
.gpio_base = TPS6591X_GPIO_BASE,
.dev_slp_en = true,
.slp_keepon = &tps_slp_keepon,
+#ifdef FORCE_OFF_GPIO
+ .use_power_off = false,
+#else
.use_power_off = true,
+#endif
};
static struct i2c_board_info __initdata apalis_t30_regulators[] = {
@@ -418,6 +422,13 @@ static struct platform_device *fixed_reg_devs_apalis_t30[] = {
ADD_FIXED_REG(v3_3),
};
+#ifdef FORCE_OFF_GPIO
+static void apalis_t30_power_off(void)
+{
+ gpio_set_value(FORCE_OFF_GPIO, 0);
+}
+#endif /* FORCE_OFF_GPIO */
+
int __init apalis_t30_regulator_init(void)
{
void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -442,6 +453,14 @@ int __init apalis_t30_regulator_init(void)
pr_info("Registering the device TPS62360\n");
i2c_register_board_info(4, tps6236x_boardinfo, 1);
+#ifdef FORCE_OFF_GPIO
+ if (!pm_power_off) {
+ gpio_request(FORCE_OFF_GPIO, "FORCE_OFF_N");
+ gpio_direction_output(FORCE_OFF_GPIO, 1);
+ pm_power_off = apalis_t30_power_off;
+ }
+#endif /* FORCE_OFF_GPIO */
+
return 0;
}
diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c
index f119ec7..a114e47 100644
--- a/arch/arm/mach-tegra/board-apalis_t30.c
+++ b/arch/arm/mach-tegra/board-apalis_t30.c
@@ -366,7 +366,9 @@ static struct gpio apalis_t30_gpios[] = {
{APALIS_GPIO3, GPIOF_IN, "GPIO3 X1-5"},
{APALIS_GPIO4, GPIOF_IN, "GPIO4 X1-7"},
{APALIS_GPIO5, GPIOF_IN, "GPIO5 X1-9"},
+#ifndef FORCE_OFF_GPIO
{APALIS_GPIO6, GPIOF_IN, "GPIO6 X1-11"},
+#endif
/* GPIO7 is used by PCIe driver on Evaluation board */
/* {APALIS_GPIO7, GPIOF_IN, "GPIO7 X1-13"}, */
{APALIS_GPIO8, GPIOF_IN, "GPIO8 X1-15, FAN"},
diff --git a/arch/arm/mach-tegra/board-apalis_t30.h b/arch/arm/mach-tegra/board-apalis_t30.h
index 9fde9ef..a62bab0 100644
--- a/arch/arm/mach-tegra/board-apalis_t30.h
+++ b/arch/arm/mach-tegra/board-apalis_t30.h
@@ -26,6 +26,8 @@
#include <mach/gpio.h>
#include <mach/irqs.h>
+//#define FORCE_OFF_GPIO APALIS_GPIO6
+
/* GPIO */
#define APALIS_GPIO1 TEGRA_GPIO_PS2