From 3d7a3b49fdb67464f04f6bf720c411a95498938a Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Mon, 1 Dec 2014 17:44:13 +0100 Subject: 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 --- arch/arm/mach-tegra/board-apalis_t30-power.c | 19 +++++++++++++++++++ arch/arm/mach-tegra/board-apalis_t30.c | 2 ++ arch/arm/mach-tegra/board-apalis_t30.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/arch/arm/mach-tegra/board-apalis_t30-power.c b/arch/arm/mach-tegra/board-apalis_t30-power.c index 7b2744a0fe8b..064c438b4b64 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 f119ec7724df..a114e4773e12 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 9fde9ef1d89e..a62bab002ae0 100644 --- a/arch/arm/mach-tegra/board-apalis_t30.h +++ b/arch/arm/mach-tegra/board-apalis_t30.h @@ -26,6 +26,8 @@ #include #include +//#define FORCE_OFF_GPIO APALIS_GPIO6 + /* GPIO */ #define APALIS_GPIO1 TEGRA_GPIO_PS2 -- cgit v1.2.3