From 4807018478d62750441f23f586af9cefe1d1f8bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Sat, 22 Jan 2011 16:13:03 +0800 Subject: [PATCH] rk29: add board_boot_mode API --- arch/arm/mach-rk29/devices.c | 27 +++++++++++++++++++++++++ arch/arm/mach-rk29/include/mach/board.h | 8 ++++++++ 2 files changed, 35 insertions(+) diff --git a/arch/arm/mach-rk29/devices.c b/arch/arm/mach-rk29/devices.c index 73008be7b96b..fc2258670367 100755 --- a/arch/arm/mach-rk29/devices.c +++ b/arch/arm/mach-rk29/devices.c @@ -23,6 +23,7 @@ #include #include #include /* ddl@rock-chips.com : camera support */ +#include #include "devices.h" #ifdef CONFIG_ADC_RK29 static struct resource rk29_adc_resource[] = { @@ -718,3 +719,29 @@ struct platform_device rk29_device_usb20_host = { }; #endif +static int boot_mode; +static int __init boot_mode_init(char *s) +{ + if (!strcmp(s, "normal")) + boot_mode = BOOT_MODE_NORMAL; + else if (!strcmp(s, "factory2")) + boot_mode = BOOT_MODE_FACTORY2; + else if (!strcmp(s, "recovery")) + boot_mode = BOOT_MODE_RECOVERY; + else if (!strcmp(s, "charge")) + boot_mode = BOOT_MODE_CHARGE; + else if (!strcmp(s, "power_test")) + boot_mode = BOOT_MODE_POWER_TEST; + else if (!strcmp(s, "offmode_charging")) + boot_mode = BOOT_MODE_OFFMODE_CHARGING; + + return 1; +} +__setup("androidboot.mode=", boot_mode_init); + +int board_boot_mode(void) +{ + return boot_mode; +} +EXPORT_SYMBOL(board_boot_mode); + diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h index eaa56d7895cf..a971ffe2b6e6 100755 --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -169,4 +169,12 @@ struct akm8975_platform_data { void __init rk29_map_common_io(void); void __init rk29_clock_init(void); +#define BOOT_MODE_NORMAL 0 +#define BOOT_MODE_FACTORY2 1 +#define BOOT_MODE_RECOVERY 2 +#define BOOT_MODE_CHARGE 3 +#define BOOT_MODE_POWER_TEST 4 +#define BOOT_MODE_OFFMODE_CHARGING 5 +int board_boot_mode(void); + #endif -- 2.34.1