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

Commit 5849efa4 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd-dsp-mgr: add suspend and resume functionality



Currently, the suspend and resume routines for the wcd dsp manager
driver are not implemented, which causes race conditions when the
components suspend or resume out of order. Implement the suspend/
resume functionality and route the events to the components in
the expected sequence.

CRs-Fixed: 1111863
Change-Id: Ie84cdef5ed7ffd61610cd83e5f627427f85bc125
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 7a489c58
Loading
Loading
Loading
Loading
+40 −2
Original line number Diff line number Diff line
@@ -881,12 +881,50 @@ static int wdsp_vote_for_dsp(struct device *wdsp_dev,

static int wdsp_suspend(struct device *wdsp_dev)
{
	return 0;
	struct wdsp_mgr_priv *wdsp;
	int rc = 0, i;

	if (!wdsp_dev) {
		pr_err("%s: Invalid handle to device\n", __func__);
		return -EINVAL;
	}

	wdsp = dev_get_drvdata(wdsp_dev);

	for (i =  WDSP_CMPNT_TYPE_MAX - 1; i >= 0; i--) {
		rc = wdsp_unicast_event(wdsp, i, WDSP_EVENT_SUSPEND, NULL);
		if (rc < 0) {
			WDSP_ERR(wdsp, "component %s failed to suspend\n",
				WDSP_GET_CMPNT_TYPE_STR(i));
			break;
		}
	}

	return rc;
}

static int wdsp_resume(struct device *wdsp_dev)
{
	return 0;
	struct wdsp_mgr_priv *wdsp;
	int rc = 0, i;

	if (!wdsp_dev) {
		pr_err("%s: Invalid handle to device\n", __func__);
		return -EINVAL;
	}

	wdsp = dev_get_drvdata(wdsp_dev);

	for (i =  0; i < WDSP_CMPNT_TYPE_MAX; i++) {
		rc = wdsp_unicast_event(wdsp, i, WDSP_EVENT_RESUME, NULL);
		if (rc < 0) {
			WDSP_ERR(wdsp, "component %s failed to resume\n",
				WDSP_GET_CMPNT_TYPE_STR(i));
			break;
		}
	}

	return rc;
}

static struct wdsp_mgr_ops wdsp_ops = {