asoc: check subsys state in FE instead of q6 state

audio can use adsp or modem. Hence check
apr subsys state commonly instead of adsp or modem.

Change-Id: Ice70ab23797ec5f940e1bda3fa1b2d84c196fc56
Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
This commit is contained in:
Ramprasad Katkam 2019-04-15 18:37:10 +05:30 • committed by Meng Wang
commit 17f0516574
4 changed files with 36 additions and 0 deletions

View file

@ -1640,6 +1640,7 @@ static int msm_compr_playback_open(struct snd_compr_stream *cstream)
struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd = NULL;
struct msm_compr_pdata *pdata = NULL;
enum apr_subsys_state subsys_state;
pr_debug("%s\n", __func__);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
@ -1653,6 +1654,13 @@ static int msm_compr_playback_open(struct snd_compr_stream *cstream)
__func__, rtd->dai_link->cpu_dai_name, -EBUSY);
return -EBUSY;
}
subsys_state = apr_get_subsys_state();
if (subsys_state == APR_SUBSYS_DOWN) {
pr_debug("%s: adsp is down\n", __func__);
return -ENETRESET;
}
prtd = kzalloc(sizeof(struct msm_compr_audio), GFP_KERNEL);
if (prtd == NULL) {
pr_err("Failed to allocate memory for msm_compr_audio\n");
@ -1747,6 +1755,7 @@ static int msm_compr_capture_open(struct snd_compr_stream *cstream)
struct snd_soc_component *component = NULL;
struct msm_compr_audio *prtd;
struct msm_compr_pdata *pdata = NULL;
enum apr_subsys_state subsys_state;
pr_debug("%s\n", __func__);
component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
@ -1759,6 +1768,12 @@ static int msm_compr_capture_open(struct snd_compr_stream *cstream)
pr_err("%s: pdata is NULL\n", __func__);
return -EINVAL;
}
subsys_state = apr_get_subsys_state();
if (subsys_state == APR_SUBSYS_DOWN) {
pr_debug("%s: adsp is down\n", __func__);
return -ENETRESET;
}
prtd = kzalloc(sizeof(struct msm_compr_audio), GFP_KERNEL);
if (!prtd) {
pr_err("Failed to allocate memory for msm_compr_audio\n");

View file

@ -181,7 +181,13 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
struct msm_audio *prtd;
int ret = 0;
enum apr_subsys_state subsys_state;
subsys_state = apr_get_subsys_state();
if (subsys_state == APR_SUBSYS_DOWN) {
pr_debug("%s: adsp is down\n", __func__);
return -ENETRESET;
}
prtd = kzalloc(sizeof(struct msm_audio), GFP_KERNEL);
if (prtd == NULL)

View file

@ -676,6 +676,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
snd_soc_rtdcom_lookup(soc_prtd, DRV_NAME);
struct msm_audio *prtd;
struct msm_plat_data *pdata;
enum apr_subsys_state subsys_state;
int ret = 0;
if (!component) {
@ -689,6 +690,13 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
pr_err("%s: platform data not populated\n", __func__);
return -EINVAL;
}
subsys_state = apr_get_subsys_state();
if (subsys_state == APR_SUBSYS_DOWN) {
pr_debug("%s: adsp is down\n", __func__);
return -ENETRESET;
}
prtd = kzalloc(sizeof(struct msm_audio), GFP_KERNEL);
if (prtd == NULL)
return -ENOMEM;

View file

@ -426,12 +426,19 @@ static int msm_transcode_loopback_set_params(struct snd_compr_stream *cstream,
struct trans_loopback_pdata *pdata;
uint32_t bit_width = 16;
int ret = 0;
enum apr_subsys_state subsys_state;
if (trans == NULL) {
pr_err("%s: Invalid param\n", __func__);
return -EINVAL;
}
subsys_state = apr_get_subsys_state();
if (subsys_state == APR_SUBSYS_DOWN) {
pr_debug("%s: adsp is down\n", __func__);
return -ENETRESET;
}
mutex_lock(&trans->lock);
rtd = snd_pcm_substream_chip(cstream);