improve mtk23d driver's compatibility
authorluowei <lw@rock-chips.com>
Fri, 15 Apr 2011 02:36:37 +0000 (10:36 +0800)
committerluowei <lw@rock-chips.com>
Fri, 15 Apr 2011 02:38:05 +0000 (10:38 +0800)
arch/arm/mach-rk29/board-rk29-a22.c
arch/arm/mach-rk29/board-rk29-phonesdk.c
drivers/misc/mtk23d.c
drivers/serial/rk29_serial.c
include/linux/mtk23d.h

index c7f697f49eea810afb37d930959b86e89a70289a..14c72ef985fa72e6188e3686f80ba42c8334ed95 100755 (executable)
@@ -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,
index 0ea98c32e1027761b37c3da1220d8c2271a05d84..2872efbb9fe5f566447015fee183dcadfabefeaf 100755 (executable)
@@ -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
 
 
index 4a7efebfd1ccb2f7c96faa921918f8ca27eeeaea..65c9fecca12c27bc770ebaf42f3d494b5fd9b115 100755 (executable)
@@ -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);
index 721e370319f676755d8e9e89b8e9c675c8ff64c7..7a80de0fa7f381b33e88e612016dd3ee2f59d39a 100755 (executable)
@@ -37,7 +37,7 @@
 #include "rk2818_serial.h"
 
 #define DBG_PORT    0
-#if 1
+#if 0
 #define DBG(msg...)    printk(msg);
 #else
 #define DBG(...)
index 84f0350b3e235e0112fa0a036cbb89cff2ea7f43..6be28a66497ddf54c6416ae2f498247f1a4e4f97 100644 (file)
@@ -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;