From b4e1103d37df21095df0531e16af5e572b8debde Mon Sep 17 00:00:00 2001 From: Greg Meiste Date: Fri, 17 Dec 2010 11:41:19 -0600 Subject: [PATCH] mfd: cpcap-whisper: Only hold wake lock during debouncing Only need to hold the wake lock during debouncing. This change allows the device to suspend when docks are attached, resulting in better current drain. Change-Id: Ieb72bacc5da3678a25a70a34620faa0c8620cbd2 Signed-off-by: Greg Meiste --- drivers/mfd/cpcap-whisper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/cpcap-whisper.c b/drivers/mfd/cpcap-whisper.c index 673871101a35..f2c428e86559 100644 --- a/drivers/mfd/cpcap-whisper.c +++ b/drivers/mfd/cpcap-whisper.c @@ -170,7 +170,6 @@ static DEVICE_ATTR(dock_prop, S_IRUGO | S_IWUSR, dock_prop_show, NULL); static void vusb_enable(struct cpcap_whisper_data *data) { if (!data->is_vusb_enabled) { - wake_lock(&data->wake_lock); regulator_enable(data->regulator); data->is_vusb_enabled = 1; } @@ -179,7 +178,6 @@ static void vusb_enable(struct cpcap_whisper_data *data) static void vusb_disable(struct cpcap_whisper_data *data) { if (data->is_vusb_enabled) { - wake_unlock(&data->wake_lock); regulator_disable(data->regulator); data->is_vusb_enabled = 0; } @@ -339,6 +337,8 @@ static void whisper_notify(struct cpcap_whisper_data *di, enum cpcap_accy accy) memset(di->dock_prop, 0, CPCAP_WHISPER_PROP_SIZE); tegra_cpcap_audio_dock_state(false); } + + wake_lock_timeout(&di->wake_lock, HZ / 2); } static void whisper_audio_check(struct cpcap_whisper_data *di) @@ -387,6 +387,7 @@ static void whisper_det_work(struct work_struct *work) switch (data->state) { case CONFIG: + wake_lock(&data->wake_lock); vusb_enable(data); cpcap_irq_mask(data->cpcap, CPCAP_IRQ_CHRG_DET); cpcap_irq_mask(data->cpcap, CPCAP_IRQ_IDFLOAT); -- 2.34.1