From 13cf431b544bd3d89ebe204152dd32de4d2f0c9f Mon Sep 17 00:00:00 2001 From: yxj Date: Fri, 14 Sep 2012 14:01:01 +0800 Subject: [PATCH] board rk3066 rk3066b m701: add rk610 power ioctl --- arch/arm/mach-rk30/board-rk30-sdk.c | 41 +++++++++++++++++++++++++ arch/arm/mach-rk30/board-rk3066b-m701.c | 41 +++++++++++++++++++++++++ arch/arm/mach-rk30/board-rk3066b-sdk.c | 41 +++++++++++++++++++++++++ 3 files changed, 123 insertions(+) diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index ba9dc209f465..7da6525dda3a 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -45,6 +45,11 @@ #include #include #include + +#if defined(CONFIG_MFD_RK610) +#include +#endif + #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -701,6 +706,41 @@ static struct platform_device device_lcdc1 = { }; #endif +#if defined(CONFIG_MFD_RK610) +#define RK610_RST_PIN_MUX_NAME GPIO0C6_TRACECLK_SMCADDR2_NAME +#define RK610_RST_PIN_MUX_MODE GPIO0C_GPIO0C6 +#define RK610_RST_PIN RK30_PIN0_PC6 +static int rk610_power_on_init(void) +{ + int ret; + if(RK610_RST_PIN != INVALID_GPIO) + { + rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE); + ret = gpio_request(RK610_RST_PIN, "rk610 reset"); + if (ret) + { + printk(KERN_ERR "rk610_control_probe request gpio fail\n"); + } + else + { + gpio_direction_output(RK610_RST_PIN, GPIO_HIGH); + msleep(100); + gpio_direction_output(RK610_RST_PIN, GPIO_LOW); + msleep(100); + gpio_set_value(RK610_RST_PIN, GPIO_HIGH); + } + } + + return 0; + +} + + +static struct rk610_ctl_platform_data rk610_ctl_pdata = { + .rk610_power_on_init = rk610_power_on_init, +}; +#endif + #ifdef CONFIG_ANDROID_TIMED_GPIO static struct timed_gpio timed_gpios[] = { { @@ -1302,6 +1342,7 @@ static struct i2c_board_info __initdata i2c0_info[] = { .type = "rk610_ctl", .addr = 0x40, .flags = 0, + .platform_data = &rk610_power_on_init, }, #ifdef CONFIG_RK610_TVOUT { diff --git a/arch/arm/mach-rk30/board-rk3066b-m701.c b/arch/arm/mach-rk30/board-rk3066b-m701.c index 94ba8c63dff2..fb3b4ffc4371 100755 --- a/arch/arm/mach-rk30/board-rk3066b-m701.c +++ b/arch/arm/mach-rk30/board-rk3066b-m701.c @@ -46,6 +46,11 @@ #include #include #include + +#if defined(CONFIG_MFD_RK610) +#include +#endif + #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -773,6 +778,41 @@ static struct platform_device device_lcdc1 = { }; #endif +#if defined(CONFIG_MFD_RK610) +#define RK610_RST_PIN_MUX_NAME GPIO2C5_LCDC1DATA21_SMCADDR5_NAME +#define RK610_RST_PIN_MUX_MODE GPIO2C_GPIO2C5 +#define RK610_RST_PIN RK30_PIN2_PC5 +static int rk610_power_on_init(void) +{ + int ret; + if(RK610_RST_PIN != INVALID_GPIO) + { + rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE); + ret = gpio_request(RK610_RST_PIN, "rk610 reset"); + if (ret) + { + printk(KERN_ERR "rk610_control_probe request gpio fail\n"); + } + else + { + gpio_direction_output(RK610_RST_PIN, GPIO_HIGH); + msleep(100); + gpio_direction_output(RK610_RST_PIN, GPIO_LOW); + msleep(100); + gpio_set_value(RK610_RST_PIN, GPIO_HIGH); + } + } + + return 0; + +} + + +static struct rk610_ctl_platform_data rk610_ctl_pdata = { + .rk610_power_on_init = rk610_power_on_init, +}; +#endif + #ifdef CONFIG_ANDROID_TIMED_GPIO static struct timed_gpio timed_gpios[] = { { @@ -1324,6 +1364,7 @@ static struct i2c_board_info __initdata i2c0_info[] = { .type = "rk610_ctl", .addr = 0x40, .flags = 0, + .platform_data = &rk610_ctl_pdata, }, #ifdef CONFIG_RK610_TVOUT { diff --git a/arch/arm/mach-rk30/board-rk3066b-sdk.c b/arch/arm/mach-rk30/board-rk3066b-sdk.c index ebfec737d24f..5d3d699a4d73 100755 --- a/arch/arm/mach-rk30/board-rk3066b-sdk.c +++ b/arch/arm/mach-rk30/board-rk3066b-sdk.c @@ -46,6 +46,11 @@ #include #include #include + +#if defined(CONFIG_MFD_RK610) +#include +#endif + #if defined(CONFIG_HDMI_RK30) #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h" #endif @@ -622,6 +627,41 @@ static struct platform_device device_lcdc1 = { }; #endif +#if defined(CONFIG_MFD_RK610) +#define RK610_RST_PIN_MUX_NAME GPIO2C5_LCDC1DATA21_SMCADDR5_NAME +#define RK610_RST_PIN_MUX_MODE GPIO2C_GPIO2C5 +#define RK610_RST_PIN RK30_PIN2_PC5 +static int rk610_power_on_init(void) +{ + int ret; + if(RK610_RST_PIN != INVALID_GPIO) + { + rk30_mux_api_set(RK610_RST_PIN_MUX_NAME,RK610_RST_PIN_MUX_MODE); + ret = gpio_request(RK610_RST_PIN, "rk610 reset"); + if (ret) + { + printk(KERN_ERR "rk610_control_probe request gpio fail\n"); + } + else + { + gpio_direction_output(RK610_RST_PIN, GPIO_HIGH); + msleep(100); + gpio_direction_output(RK610_RST_PIN, GPIO_LOW); + msleep(100); + gpio_set_value(RK610_RST_PIN, GPIO_HIGH); + } + } + + return 0; + +} + + +static struct rk610_ctl_platform_data rk610_ctl_pdata = { + .rk610_power_on_init = rk610_power_on_init, +}; +#endif + #ifdef CONFIG_ANDROID_TIMED_GPIO static struct timed_gpio timed_gpios[] = { { @@ -1155,6 +1195,7 @@ static struct i2c_board_info __initdata i2c0_info[] = { .type = "rk610_ctl", .addr = 0x40, .flags = 0, + .platform_data = &rk610_ctl_pdata, }, #ifdef CONFIG_RK610_TVOUT { -- 2.34.1