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: Bhalchandra Gajare <gajare@codeaurora.org>
This commit is contained in:
parent
314869eb56
commit
896e0b12ac
1 changed files with 41 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
* Copyright (c) 2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -881,12 +880,50 @@ done:
|
|||
|
||||
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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue