mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
mt6622: support wake up host
This commit is contained in:
parent
b9ec311ce0
commit
ef49919498
|
|
@ -60,7 +60,7 @@ if(eint_handle_method == 0) {
|
|||
//BT_HWCTL_ALERT("hdev is NULL\n");
|
||||
}else{
|
||||
//BT_HWCTL_ALERT("EINT arrives! notify host wakeup\n");
|
||||
printk("Send host wakeup command\n");
|
||||
//printk("Send host wakeup command\n");
|
||||
hci_send_cmd(hdev, 0xFCC1, 0, NULL);
|
||||
/* enable irq after receiving host wakeup command's event */
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ if(eint_handle_method == 0) {
|
|||
/* Maybe handle the interrupt in user space? */
|
||||
eint_gen = 1;
|
||||
wake_up_interruptible(&eint_wait);
|
||||
|
||||
/* Send host wakeup command in user space, enable irq then */
|
||||
//#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/rfkill-rk.h>
|
||||
#include <linux/wakelock.h>
|
||||
|
||||
struct gpio_set {
|
||||
unsigned int gpio;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ wait_queue_head_t eint_wait;
|
|||
int eint_gen;
|
||||
int eint_mask;
|
||||
int eint_handle_method = 0; // 0: for 4.1; 1: for 4.2
|
||||
struct wake_lock mt6622_irq_wakelock;
|
||||
int mt6622_suspend_flag;
|
||||
|
||||
struct bt_hwctl {
|
||||
bool powerup;
|
||||
|
|
@ -202,6 +204,12 @@ static unsigned int bt_hwctl_poll(struct file *file, poll_table *wait)
|
|||
wait_event_interruptible(eint_wait, (eint_gen == 1 || eint_mask == 1));
|
||||
BT_HWCTL_DEBUG("bt_hwctl_poll eint_gen %d, eint_mask %d --\n", eint_gen, eint_mask);
|
||||
|
||||
if(mt6622_suspend_flag == 1) {
|
||||
printk("mt6622 wake lock 5000ms\n");
|
||||
mt6622_suspend_flag = 0;
|
||||
wake_lock_timeout(&mt6622_irq_wakelock, msecs_to_jiffies(5000));
|
||||
}
|
||||
|
||||
if(eint_gen == 1){
|
||||
mask = POLLIN|POLLRDNORM;
|
||||
eint_gen = 0;
|
||||
|
|
@ -310,8 +318,8 @@ static struct file_operations bt_hwctl_fops = {
|
|||
static struct platform_driver mt6622_driver = {
|
||||
.probe = mt6622_probe,
|
||||
.remove = mt6622_remove,
|
||||
//.suspend = mt6622_suspend,
|
||||
//.resume = mt6622_resume,
|
||||
.suspend = mt6622_suspend,
|
||||
.resume = mt6622_resume,
|
||||
.driver = {
|
||||
.name = "mt6622",
|
||||
.owner = THIS_MODULE,
|
||||
|
|
@ -365,6 +373,8 @@ static int __init bt_hwctl_init(void)
|
|||
|
||||
init_waitqueue_head(&eint_wait);
|
||||
|
||||
wake_lock_init(&mt6622_irq_wakelock, WAKE_LOCK_SUSPEND, "mt6622_irq_wakelock");
|
||||
|
||||
/*INIT_WORK(&mtk_wcn_bt_event_work, mtk_wcn_bt_work_fun);
|
||||
mtk_wcn_bt_workqueue = create_singlethread_workqueue("mtk_wcn_bt");
|
||||
if (!mtk_wcn_bt_workqueue) {
|
||||
|
|
@ -398,6 +408,8 @@ static void __exit bt_hwctl_exit(void)
|
|||
{
|
||||
BT_HWCTL_DEBUG("bt_hwctl_exit\n");
|
||||
|
||||
wake_lock_destroy(&mt6622_irq_wakelock);
|
||||
|
||||
platform_driver_unregister(&mt6622_driver);
|
||||
|
||||
if (bh){
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
|
||||
#include "bt_hwctl.h"
|
||||
|
||||
extern int mt6622_suspend_flag;
|
||||
|
||||
/****************************************************************************
|
||||
* C O N S T A N T S *
|
||||
*****************************************************************************/
|
||||
|
|
@ -105,6 +107,7 @@ int mt6622_suspend(struct platform_device *pdev, pm_message_t state)
|
|||
{
|
||||
if(irq_num != -1) {
|
||||
printk(KERN_INFO MODULE_TAG "mt6622_suspend\n");
|
||||
mt6622_suspend_flag = 1;
|
||||
enable_irq_wake(irq_num);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user