Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8852b187 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ultrasound: USF stays awake after each event"

parents 2cafee7f 8d74ba72
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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;