summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-nvodm.c
diff options
context:
space:
mode:
authorGary King <gking@nvidia.com>2010-05-25 17:30:33 -0700
committerGary King <gking@nvidia.com>2010-05-25 17:36:05 -0700
commit9325f7a9386bef0158277fcef77b789c96c02e06 (patch)
treec93582dba3b2514f21805f2cee0d5a3d72800a25 /arch/arm/mach-tegra/board-nvodm.c
parent728efdade0e861db1b334e0f22c2cbab04d1845a (diff)
[ARM/tegra] board-nvodm: add pm_power_off support
create a regulator soc_main for NV_VDD_SoC_ODM_ID, and use an enable/disable pair (the enable does nothing except bump the use_count to 1, so that the disable actually disables the regulator) to shut off the SoC if the shutdown fails for any reason, print out an error message and enter an infinite deadloop. Change-Id: I93268a0538c4be218eb7258e059c307795bf1206
Diffstat (limited to 'arch/arm/mach-tegra/board-nvodm.c')
-rw-r--r--arch/arm/mach-tegra/board-nvodm.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-nvodm.c b/arch/arm/mach-tegra/board-nvodm.c
index 8186a930769e..a0cf19397e17 100644
--- a/arch/arm/mach-tegra/board-nvodm.c
+++ b/arch/arm/mach-tegra/board-nvodm.c
@@ -663,6 +663,11 @@ static struct regulator_consumer_supply lbee9qmb_consumers[] = {
.dev_name = "lbee9qmb-rfkill.0",
},
};
+static struct regulator_consumer_supply tegra_soc_consumers[] = {
+ [0] = {
+ .supply = "soc_main",
+ },
+};
static struct tegra_regulator_entry tegra_regulators[] = {
[0] = {
.guid = NV_VDD_PEX_CLK_ODM_ID,
@@ -678,6 +683,13 @@ static struct tegra_regulator_entry tegra_regulators[] = {
.consumers = lbee9qmb_consumers,
.nr_consumers = ARRAY_SIZE(lbee9qmb_consumers),
},
+ [2] = {
+ .guid = NV_VDD_SoC_ODM_ID,
+ .name = "soc_main",
+ .id = 2,
+ .consumers = tegra_soc_consumers,
+ .nr_consumers = ARRAY_SIZE(tegra_soc_consumers),
+ },
};
static struct tegra_regulator_platform_data tegra_regulator_platform = {
.regs = tegra_regulators,
@@ -760,6 +772,25 @@ static int tegra_setup_pcie(void)
late_initcall(tegra_setup_pcie);
#endif
+static void tegra_system_power_off(void)
+{
+ struct regulator *regulator = regulator_get(NULL, "soc_main");
+
+ if (!IS_ERR(regulator)) {
+ int rc;
+ regulator_enable(regulator);
+ rc = regulator_disable(regulator);
+ pr_err("%s: regulator_disable returned %d\n", __func__, rc);
+ } else {
+ pr_err("%s: regulator_get returned %ld\n", __func__,
+ PTR_ERR(regulator));
+ }
+ local_irq_disable();
+ while (1) {
+ __asm__ ("wfi");
+ }
+}
+
void __init tegra_setup_nvodm(void)
{
NvRmGpioOpen(s_hRmGlobal, &s_hGpioGlobal);
@@ -769,4 +800,5 @@ void __init tegra_setup_nvodm(void)
tegra_setup_sdhci();
tegra_setup_rfkill();
platform_add_devices(nvodm_devices, ARRAY_SIZE(nvodm_devices));
+ pm_power_off = tegra_system_power_off;
}