RK29MobileSDK:support mtk23d sleep and wakeup
authorphc <phc@rk29>
Fri, 6 May 2011 12:30:53 +0000 (20:30 +0800)
committerphc <phc@rk29>
Fri, 6 May 2011 12:30:53 +0000 (20:30 +0800)
arch/arm/mach-rk29/board-rk29-phonesdk.c
drivers/misc/mtk23d.c

index 5b6b31b3ea969c92445acb56b6033af24db6c0ae..10f2f744ce0bacf64a88f186f70830e229fc6dc1 100755 (executable)
@@ -2241,9 +2241,9 @@ struct rk2818_23d_data rk2818_23d_info = {
        .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;
+       .bp_statue = RK29_PIN0_PA2,//input  high bp sleep;
+       .ap_statue = RK29_PIN0_PA4,//output high ap sleep;
+       .ap_bp_wakeup = RK29_PIN0_PA3, //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 = {        
index 0367884e40c99cbad34adbfbd8adf68e0087e0c3..d63ba9f954bb92587a047ddba66afc1c7ec34f5f 100755 (executable)
@@ -21,6 +21,7 @@
 //#include <asm/arch/gpio_extend.h>
 #include <linux/workqueue.h>
 #include <linux/mtk23d.h>
+#include <linux/wakelock.h>
 
 MODULE_LICENSE("GPL");
 
@@ -44,6 +45,9 @@ MODULE_LICENSE("GPL");
 //#define AP_BP_WAKEUP  RK2818_PIN_PF5   //output AP wake up BP used rising edge
 //#define BP_AP_WAKEUP  RK2818_PIN_PE0 //input BP wake up AP
 
+//static bool wakelock_inited;
+//static struct wake_lock mtk23d_wakelock;
+
 #define SLEEP 1
 #define READY 0
 
@@ -275,6 +279,7 @@ static int mtk23d_probe(struct platform_device *pdev)
        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);
+       gpio_set_value(pdata->ap_bp_wakeup, GPIO_HIGH);
 #endif 
        
 #if 0 
@@ -301,6 +306,12 @@ static int mtk23d_probe(struct platform_device *pdev)
                MODEMDBG("misc_register err\n");
        }
        MODEMDBG("mtk23d_probe ok\n");
+       
+//     if (!wakelock_inited) {
+//             wake_lock_init(&mtk23d_wakelock, WAKE_LOCK_SUSPEND, "23d_resume");
+//             wakelock_inited = true;
+//     }
+       
        return result;
 err0:
        cancel_work_sync(&mt6223d_data->work);
@@ -342,6 +353,9 @@ int mtk23d_resume(struct platform_device *pdev)
        //disable_irq_wake(irq);
        ap_wakeup(pdev);
        ap_wakeup_bp(pdev, 1);
+       
+//     wake_lock_timeout(&mtk23d_wakelock, 10 * HZ);
+       
        return 0;
 }