1
0
Fork 0
mirror of https://github.com/followmsi/android_kernel_google_msm.git synced 2024-11-06 23:17:41 +00:00

driver: usb: otg: Add a wakelock for the usb cable and otg cable detected.

The msm_otg wakelock is unlocked becuase of the irq functions of usb cable and otg cable.

b/11110052

Change-Id: I78eb8bebbb47aa2c9843d72866b1cafa415bc847
Signed-off-by: yi-hsin_hung <yi-hsin_hung@asus.com>
This commit is contained in:
yi-hsin_hung 2013-10-07 21:02:54 +08:00 committed by Ed Tam
parent b60cd31fc3
commit c13b8e1478
2 changed files with 8 additions and 4 deletions
drivers/usb/otg
include/linux/usb

View file

@ -3195,7 +3195,7 @@ static irqreturn_t msm_otg_acok_irq(int irq, void *dev_id)
struct msm_otg *motg = dev_id;
queue_delayed_work(msm_otg_acok_wq, &motg->acok_irq_work, 0.6*HZ);
wake_lock_timeout(&motg->wlock, 1*HZ);
wake_lock_timeout(&motg->cable_lock, 1*HZ);
return IRQ_HANDLED;
}
@ -3205,7 +3205,7 @@ static irqreturn_t msm_otg_id_pin_irq(int irq, void *dev_id)
struct msm_otg *motg = dev_id;
queue_delayed_work(msm_otg_id_pin_wq, &motg->id_pin_irq_work, 0.6*HZ);
wake_lock_timeout(&motg->wlock, 1*HZ);
wake_lock_timeout(&motg->cable_lock, 1*HZ);
return IRQ_HANDLED;
}
@ -3972,6 +3972,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
if (ret)
dev_dbg(&pdev->dev, "MHL can not be supported\n");
wake_lock_init(&motg->wlock, WAKE_LOCK_SUSPEND, "msm_otg");
wake_lock_init(&motg->cable_lock, WAKE_LOCK_SUSPEND, "msm_cable_dectect");
msm_otg_init_timer(motg);
INIT_WORK(&motg->sm_work, msm_otg_sm_work);
INIT_DELAYED_WORK(&motg->chg_work, msm_chg_detect_work);
@ -4094,6 +4095,7 @@ free_irq:
free_irq(motg->irq, motg);
destroy_wlock:
wake_lock_destroy(&motg->wlock);
wake_lock_destroy(&motg->cable_lock);
clk_disable_unprepare(motg->core_clk);
msm_hsusb_ldo_enable(motg, 0);
free_ldo_init:
@ -4152,6 +4154,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 0);
pm_runtime_disable(&pdev->dev);
wake_lock_destroy(&motg->wlock);
wake_lock_destroy(&motg->cable_lock);
msm_otg_id_pin_free(motg);
msm_otg_acok_free(motg);
@ -4294,12 +4297,12 @@ static int msm_otg_pm_resume(struct device *dev)
if (gpio_get_value(vbus_det_gpio) != global_vbus_suspend_status) {
dev_info(dev, "%s: usb vbus change in suspend\n", __func__);
wake_lock_timeout(&motg->wlock, 1*HZ);
wake_lock_timeout(&motg->cable_lock, 1*HZ);
}
if (gpio_get_value(id_gpio) != global_id_pin_suspend_status) {
dev_info(dev, "%s: usb id pin change in suspend\n", __func__);
wake_lock_timeout(&motg->wlock, 1*HZ);
wake_lock_timeout(&motg->cable_lock, 1*HZ);
}
return 0;

View file

@ -333,6 +333,7 @@ struct msm_otg {
enum usb_chg_type chg_type;
unsigned dcd_time;
struct wake_lock wlock;
struct wake_lock cable_lock;
struct notifier_block usbdev_nb;
unsigned mA_port;
struct timer_list id_timer;