msm: ultrasound: USF stays awake after each event
Give upper layers enough time to turn on screen before falling back into SUSPEND. Change-Id: I162f25dffdbbeb783d0bca673d6e6db8de412aac Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
This commit is contained in:
parent
57d7fb0e5f
commit
f6c9eb5139
1 changed files with 12 additions and 0 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <linux/uaccess.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/kmemleak.h>
|
||||
#include <linux/wakelock.h>
|
||||
#include <sound/apr_audio.h>
|
||||
#include <linux/qdsp6v2/usf.h>
|
||||
#include "q6usm.h"
|
||||
|
@ -67,6 +68,9 @@
|
|||
|
||||
#define BITS_IN_BYTE 8
|
||||
|
||||
/* Time to stay awake after tx read event (e.g., proximity) */
|
||||
#define STAY_AWAKE_AFTER_READ_MSECS 3000
|
||||
|
||||
/* The driver states */
|
||||
enum usf_state_type {
|
||||
USF_IDLE_STATE,
|
||||
|
@ -171,6 +175,8 @@ static const int s_button_map[] = {
|
|||
/* The opened devices container */
|
||||
static int s_opened_devs[MAX_DEVS_NUMBER];
|
||||
|
||||
static struct wakeup_source usf_wakeup_source;
|
||||
|
||||
#define USF_NAME_PREFIX "usf_"
|
||||
#define USF_NAME_PREFIX_SIZE 4
|
||||
|
||||
|
@ -435,6 +441,10 @@ static void usf_tx_cb(uint32_t opcode, uint32_t token,
|
|||
|
||||
switch (opcode) {
|
||||
case Q6USM_EVENT_READ_DONE:
|
||||
pr_debug("%s: acquiring %d msec wake lock\n", __func__,
|
||||
STAY_AWAKE_AFTER_READ_MSECS);
|
||||
__pm_wakeup_event(&usf_wakeup_source,
|
||||
STAY_AWAKE_AFTER_READ_MSECS);
|
||||
if (token == USM_WRONG_TOKEN)
|
||||
usf_xx->usf_state = USF_ERROR_STATE;
|
||||
usf_xx->new_region = token;
|
||||
|
@ -2285,6 +2295,7 @@ static int usf_open(struct inode *inode, struct file *file)
|
|||
pr_err("%s:usf allocation failed\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
wakeup_source_init(&usf_wakeup_source, "usf");
|
||||
|
||||
file->private_data = usf;
|
||||
usf->dev_ind = dev_ind;
|
||||
|
@ -2312,6 +2323,7 @@ static int usf_release(struct inode *inode, struct file *file)
|
|||
|
||||
s_opened_devs[usf->dev_ind] = 0;
|
||||
|
||||
wakeup_source_trash(&usf_wakeup_source);
|
||||
kfree(usf);
|
||||
pr_debug("%s: release exit\n", __func__);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue