From 543296a34d8586fea0535faff7a2f575cdd8f624 Mon Sep 17 00:00:00 2001 From: Hemanth Puranik Date: Fri, 13 Jan 2012 15:36:24 +0530 Subject: ASoC:Ux500: Random crash in MSP driver Corrected the condition check which released the TX DMA if RX is opened first on same msp interface. Also corrected the alsa pcm device active and configure device flags, add suspend and resume cases. ST-Ericsson Linux next: NA ST-Ericsson ID: 407933 ST-Ericsson FOSS-OUT ID: Trivial Signed-off-by: Hemanth Puranik Change-Id: I78b73585333cd9ad61fda1f6a2d5d3be9d15210c Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/45411 Tested-by: Hemanth Ramachandra PURANIK Reviewed-by: Ola LILJA2 Reviewed-by: QATOOLS --- sound/soc/ux500/ux500_msp_dai.c | 12 +++++------- sound/soc/ux500/ux500_msp_i2s.c | 3 ++- sound/soc/ux500/ux500_pcm.c | 4 +++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c index 2af5bf14193..4a2ff3419f2 100644 --- a/sound/soc/ux500/ux500_msp_dai.c +++ b/sound/soc/ux500/ux500_msp_dai.c @@ -189,11 +189,6 @@ static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream, if (drvdata == NULL) return; - if (mode_playback) - drvdata->playback_active = false; - else - drvdata->capture_active = false; - if (ux500_msp_i2s_close(drvdata->msp_i2s_drvdata, mode_playback ? DISABLE_TRANSMIT : DISABLE_RECEIVE)) { pr_err("%s: Error: MSP %d (%s): Unable to close i2s.\n", @@ -202,10 +197,13 @@ static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream, stream_str(substream)); } - if (mode_playback) + if (mode_playback) { + drvdata->playback_active = false; drvdata->configured &= ~PLAYBACK_CONFIGURED; - else + } else { + drvdata->capture_active = false; drvdata->configured &= ~CAPTURE_CONFIGURED; + } } static void ux500_msp_dai_setup_multichannel(struct ux500_platform_drvdata *private, diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c index 91a9a03f93d..f8138bd1aa3 100644 --- a/sound/soc/ux500/ux500_msp_i2s.c +++ b/sound/soc/ux500/ux500_msp_i2s.c @@ -317,7 +317,8 @@ void ux500_msp_i2s_configure_dma(struct msp *msp, struct msp_config *config) u16 word_width; bool rx_active, tx_active; - if (msp->tx_pipeid != NULL) { + if ((msp->tx_pipeid != NULL) && + (config->direction == MSP_TRANSMIT_MODE)) { dma_release_channel(msp->tx_pipeid); msp->tx_pipeid = NULL; } diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index 29b3f5e0ffb..07e18135451 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -276,11 +276,13 @@ static int ux500_pcm_trigger(struct snd_pcm_substream *substream, int cmd) return -EINVAL; } break; - + case SNDRV_PCM_TRIGGER_RESUME: + break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: break; case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: pr_debug("%s: SNDRV_PCM_TRIGGER_STOP\n", __func__); pr_debug("%s: no_of_underruns = %u\n", __func__, -- cgit v1.2.3