From 99331f5bc0367c667b87a45447ea0cc8d0b14a36 Mon Sep 17 00:00:00 2001 From: luowei Date: Fri, 15 Apr 2011 10:36:37 +0800 Subject: [PATCH] improve mtk23d driver's compatibility --- arch/arm/mach-rk29/board-rk29-a22.c | 46 +++++++++++++++--------- arch/arm/mach-rk29/board-rk29-phonesdk.c | 20 +++++++++++ drivers/misc/mtk23d.c | 41 ++++++++++----------- drivers/serial/rk29_serial.c | 2 +- include/linux/mtk23d.h | 4 +++ 5 files changed, 76 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-a22.c b/arch/arm/mach-rk29/board-rk29-a22.c index c7f697f49eea..14c72ef985fa 100755 --- a/arch/arm/mach-rk29/board-rk29-a22.c +++ b/arch/arm/mach-rk29/board-rk29-a22.c @@ -2154,24 +2154,38 @@ static struct platform_device rk29_device_pwm_regulator = { #if defined(CONFIG_MTK23D) +static int mtk23d_io_init(void) +{ + return 0; +} + +static int mtk23d_io_deinit(void) +{ + + return 0; +} + struct rk2818_23d_data rk2818_23d_info = { - .bp_power = RK29_PIN0_PA0, - .bp_reset = RK29_PIN0_PA1, - .bp_statue = RK29_PIN0_PA3,//input high bp sleep; - .ap_statue = RK29_PIN0_PA2,//output high ap sleep; - .ap_bp_wakeup = RK29_PIN0_PA4, //output AP wake up BP used rising edge; - //.bp_ap_wakeup = RK2818_PIN_PE0,//input BP wake up AP -}; -struct platform_device rk2818_device_mtk23d = { - .name = "mtk23d", - .id = -1, - .dev = { - .platform_data = &rk2818_23d_info, - } + .io_init = mtk23d_io_init, + .io_deinit = mtk23d_io_deinit, + .bp_power = RK29_PIN6_PB0, + .bp_power_active_low = 0, + .bp_reset = RK29_PIN6_PB1, + .bp_reset_active_low = 0, + .bp_statue = RK29_PIN0_PA2,//input high bp sleep; + .ap_statue = RK29_PIN0_PA3,//output high ap sleep; + .ap_bp_wakeup = RK29_PIN0_PA0, //output AP wake up BP used rising edge; + //.bp_ap_wakeup = RK2818_PIN_PA4,//input BP wake up AP +}; +struct platform_device rk2818_device_mtk23d = { + .name = "mtk23d", + .id = -1, + .dev = { + .platform_data = &rk2818_23d_info, + } }; #endif - /***************************************************************************************** * SDMMC devices *****************************************************************************************/ @@ -2904,7 +2918,7 @@ static struct kobj_attribute rk29xx_virtual_keys_attr = { .name = "virtualkeys.hx8520-touchscreen", #elif defined(CONFIG_TOUCHSCREEN_GT801_IIC) .name = "virtualkeys.gt801-touchscreen", -#elif defined(CONFIG_TOUCHSCREEN_GT801_IIC) +#elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC) .name = "virtualkeys.ili2102-touchscreen", #endif @@ -3000,7 +3014,7 @@ static void __init machine_rk29_board_init(void) rk29sdk_init_wifi_mem(); #endif - //rk29xx_virtual_keys_init(); + rk29xx_virtual_keys_init(); } static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags, diff --git a/arch/arm/mach-rk29/board-rk29-phonesdk.c b/arch/arm/mach-rk29/board-rk29-phonesdk.c index 0ea98c32e102..2872efbb9fe5 100755 --- a/arch/arm/mach-rk29/board-rk29-phonesdk.c +++ b/arch/arm/mach-rk29/board-rk29-phonesdk.c @@ -729,6 +729,9 @@ static struct regulator_consumer_supply dcdc1_consumers[] = { static struct regulator_consumer_supply dcdc2_consumers[] = { { .supply = "dcdc2", + }, + { + .supply = "vcore", } }; static struct regulator_consumer_supply dcdc3_consumers[] = { @@ -2151,9 +2154,24 @@ static struct platform_device rk29_device_pwm_regulator = { #if defined(CONFIG_MTK23D) +static int mtk23d_io_init(void) +{ + return 0; +} + +static int mtk23d_io_deinit(void) +{ + + return 0; +} + struct rk2818_23d_data rk2818_23d_info = { + .io_init = mtk23d_io_init, + .io_deinit = mtk23d_io_deinit, .bp_power = RK29_PIN0_PA0, + .bp_power_active_low = 0, .bp_reset = RK29_PIN0_PA1, + .bp_reset_active_low = 1, .bp_statue = RK29_PIN0_PA3,//input high bp sleep; .ap_statue = RK29_PIN0_PA2,//output high ap sleep; .ap_bp_wakeup = RK29_PIN0_PA4, //output AP wake up BP used rising edge; @@ -2899,6 +2917,8 @@ static struct kobj_attribute rk29xx_virtual_keys_attr = { .name = "virtualkeys.hx8520-touchscreen", #elif defined(CONFIG_TOUCHSCREEN_GT801_IIC) .name = "virtualkeys.gt801-touchscreen", +#elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC) + .name = "virtualkeys.ili2102-touchscreen", #endif diff --git a/drivers/misc/mtk23d.c b/drivers/misc/mtk23d.c index 4a7efebfd1cc..65c9fecca12c 100755 --- a/drivers/misc/mtk23d.c +++ b/drivers/misc/mtk23d.c @@ -115,7 +115,7 @@ static int mtk23d_open(struct inode *inode, struct file *file) int ret = 0; - gpio_direction_output(pdata->bp_power, GPIO_HIGH); + gpio_direction_output(pdata->bp_power, pdata->bp_power_active_low? GPIO_LOW:GPIO_HIGH); gpio_direction_input(pdata->bp_statue); @@ -126,18 +126,19 @@ static int mtk23d_open(struct inode *inode, struct file *file) gpio_direction_output(pdata->ap_bp_wakeup, GPIO_LOW); mdelay(100); //rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7); - gpio_direction_output(pdata->bp_reset, GPIO_LOW); + gpio_direction_output(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_LOW:GPIO_HIGH); mdelay(100); - gpio_set_value(pdata->bp_reset, GPIO_HIGH); + gpio_set_value(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_HIGH:GPIO_LOW); mdelay(2000); - gpio_set_value(pdata->bp_power, GPIO_LOW); + gpio_set_value(pdata->bp_power, pdata->bp_power_active_low? GPIO_HIGH:GPIO_LOW); gpio_set_value(pdata->ap_bp_wakeup, GPIO_HIGH); //INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work); device_init_wakeup(&pdev, 1); + printk("%s\n",__FUNCTION__); return 0; } @@ -184,6 +185,8 @@ static int mtk23d_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, mt6223d_data); + pdata->io_init(); + result = gpio_request(pdata->bp_statue, "mtk23d"); if (result) { printk("failed to request BP_STATUS gpio\n"); @@ -211,32 +214,30 @@ static int mtk23d_probe(struct platform_device *pdev) printk("failed to request BP_POW_EN gpio\n"); goto err1; } + #if 0 - gpio_direction_output(pdata->bp_power, GPIO_HIGH); + gpio_direction_output(pdata->bp_power, pdata->bp_power_active_low? GPIO_HIGH:GPIO_LOW); gpio_direction_input(pdata->bp_statue); - - rk2818_mux_api_set(CXGPIO_HSADC_SEL_NAME, 0); + + //rk2818_mux_api_set(CXGPIO_HSADC_SEL_NAME, 0); gpio_direction_output(pdata->ap_statue, GPIO_LOW); - - rk2818_mux_api_set(GPIOF5_APWM3_DPWM3_NAME,0); + + //rk2818_mux_api_set(GPIOF5_APWM3_DPWM3_NAME,0); gpio_direction_output(pdata->ap_bp_wakeup, GPIO_LOW); mdelay(100); + //rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7); + gpio_direction_output(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_LOW:GPIO_HIGH); + mdelay(100); + gpio_set_value(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_HIGH:GPIO_LOW); - //rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7); - gpio_direction_output(pdata->bp_reset, GPIO_LOW); - mdelay(100); - gpio_set_value(pdata->bp_reset, GPIO_HIGH); - mdelay(2000); - gpio_set_value(pdata->bp_power, GPIO_LOW); - + gpio_set_value(pdata->bp_power, pdata->bp_power_active_low? GPIO_LOW:GPIO_HIGH); + gpio_set_value(pdata->ap_bp_wakeup, GPIO_HIGH); - - //INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work); - - device_init_wakeup(&pdev->dev, 1); + printk("%s:power up modem\n",__FUNCTION__); #endif + INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work); result = misc_register(&mtk23d_misc); diff --git a/drivers/serial/rk29_serial.c b/drivers/serial/rk29_serial.c index 721e370319f6..7a80de0fa7f3 100755 --- a/drivers/serial/rk29_serial.c +++ b/drivers/serial/rk29_serial.c @@ -37,7 +37,7 @@ #include "rk2818_serial.h" #define DBG_PORT 0 -#if 1 +#if 0 #define DBG(msg...) printk(msg); #else #define DBG(...) diff --git a/include/linux/mtk23d.h b/include/linux/mtk23d.h index 84f0350b3e23..6be28a66497d 100644 --- a/include/linux/mtk23d.h +++ b/include/linux/mtk23d.h @@ -11,8 +11,12 @@ struct modem_dev /* 耳机数据结构体 */ struct rk2818_23d_data { + int (*io_init)(void); + int (*io_deinit)(void); unsigned int bp_power; + unsigned int bp_power_active_low; unsigned int bp_reset; + unsigned int bp_reset_active_low; unsigned int bp_statue; unsigned int ap_statue; unsigned int ap_bp_wakeup; -- 2.34.1