summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-09-04 17:10:13 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-10-12 14:15:58 -0700
commit82d02c8163f3e815aa74813b63a2f98f50b67fda (patch)
treeff5dab16f7a605ed94679b2e45574c65d0d2fd32
parentef2e5ab3aba005414a34c6e3bfc1e3427f333708 (diff)
arm: tegra: Add handle for kernel option power_supply
Adding the handler function for the kernel command line option "power_supply". Reviewed-on: http://git-master/r/50674 (cherry picked from commit 8d9e6bbe59ab68f44a4713f5d1bcc7877baf8180) Change-Id: I07796b6ee5893d73ac7557e81aac5d26b299c491 Reviewed-on: http://git-master/r/57262 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board.h2
-rw-r--r--arch/arm/mach-tegra/common.c19
2 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 9f563a69c4f2..8adee66b2b8a 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -23,6 +23,7 @@
#define __MACH_TEGRA_BOARD_H
#include <linux/types.h>
+#include <linux/power_supply.h>
#define NVMAP_HEAP_CARVEOUT_IRAM_INIT \
{ .name = "iram", \
@@ -100,5 +101,6 @@ void cpufreq_set_conservative_governor_param(int up_th, int down_th);
int get_core_edp(void);
enum panel_type get_panel_type(void);
int tegra_get_modem_id(void);
+enum power_supply_type get_power_supply_type(void);
#endif
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index edb25e1c7486..d3020bea220f 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -92,6 +92,7 @@ static struct board_info pmu_board_info;
static int pmu_core_edp = 1200; /* default 1.2V EDP limit */
static int board_panel_type;
+static enum power_supply_type pow_supply_type = POWER_SUPPLY_TYPE_MAINS;
void (*arch_reset)(char mode, const char *cmd) = tegra_assert_system_reset;
@@ -369,6 +370,24 @@ static int __init tegra_board_panel_type(char *options)
}
__setup("panel=", tegra_board_panel_type);
+enum power_supply_type get_power_supply_type(void)
+{
+ return pow_supply_type;
+}
+static int __init tegra_board_power_supply_type(char *options)
+{
+ if (!strcmp(options, "Adapter"))
+ pow_supply_type = POWER_SUPPLY_TYPE_MAINS;
+ if (!strcmp(options, "Mains"))
+ pow_supply_type = POWER_SUPPLY_TYPE_MAINS;
+ else if (!strcmp(options, "Battery"))
+ pow_supply_type = POWER_SUPPLY_TYPE_BATTERY;
+ else
+ return 0;
+ return 1;
+}
+__setup("power_supply=", tegra_board_power_supply_type);
+
int get_core_edp(void)
{
return pmu_core_edp;