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

Commit ab211133 authored by kawhi.chen's avatar kawhi.chen Committed by hecaiqiang
Browse files

Optimize GPS issue

Change-Id: I5ea92ed8afa8abb77866880334c2c6e8e649102f
parent a8a259f5
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/rwsem.h>
#include <linux/ipc_logging.h>
#include <linux/uidgid.h>
#include <linux/pm_wakeup.h>

#include <net/sock.h>

@@ -149,6 +150,7 @@ static DEFINE_MUTEX(qrtr_port_lock);
 * @kworker: worker thread for recv work
 * @task: task to run the worker thread
 * @read_data: scheduled work for recv work
 * @ws: wakeupsource avoid system suspend
 * @ilc: ipc logging context reference
 */
struct qrtr_node {
@@ -170,6 +172,8 @@ struct qrtr_node {
	struct task_struct *task;
	struct kthread_work read_data;

	struct wakeup_source *ws;

	void *ilc;
};

@@ -346,6 +350,7 @@ static void __qrtr_node_release(struct kref *kref)
	}
	mutex_unlock(&node->qrtr_tx_lock);

	wakeup_source_unregister(node->ws);
	kthread_flush_worker(&node->kworker);
	kthread_stop(node->task);

@@ -609,10 +614,16 @@ static void qrtr_node_assign(struct qrtr_node *node, unsigned int nid)
		node->nid = nid;
	up_write(&qrtr_node_lock);

	if (!node->ilc) {
	snprintf(name, sizeof(name), "qrtr_%d", nid);
	if (!node->ilc) {
		node->ilc = ipc_log_context_create(QRTR_LOG_PAGE_CNT, name, 0);
	}
	/* create wakeup source for only  NID = 0.
	 * From other nodes sensor service stream samples
	 * cause APPS suspend problems and power drain issue.
	 */
	if (!node->ws && nid == 0)
		node->ws = wakeup_source_register(name);
}

/**
@@ -735,6 +746,9 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
	    cb->type != QRTR_TYPE_RESUME_TX)
		goto err;

	if (node->ws && node->nid == 0)
		__pm_wakeup_event(node->ws, 0);

	skb_put_data(skb, data + hdrlen, size);
	qrtr_log_rx_msg(node, skb);