summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorOla Lilja <ola.o.lilja@stericsson.com>2010-12-06 09:16:20 +0100
committerRobert Marklund <robert.marklund@stericsson.com>2011-05-13 10:40:13 +0200
commitbb959ba17465e6d874b4d3d470ffcf72e57981dd (patch)
treee002798a87094939fae9e0a4af18e844edd412ea /sound
parentbf365555ed0e725b54bd9accaef35147f8a615c1 (diff)
Ux500 ASoC: Allow multiple prepares.
Keeping track of configured status to handle multiple calls to the prepare-callback. Change-Id: I4e39aa535ac0fc4cb71f2aa19da5eb9672d82270 Signed-off-by: Ola Lilja <ola.o.lilja@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/10297
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c21
-rw-r--r--sound/soc/ux500/ux500_msp_dai.h4
2 files changed, 24 insertions, 1 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 18aa608a602..c6528a7aeed 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -34,6 +34,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.slot_width = 16,
.playback_active = false,
.capture_active = false,
+ .configured = 0,
},
{
.i2s = NULL,
@@ -44,6 +45,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.slot_width = 16,
.playback_active = false,
.capture_active = false,
+ .configured = 0,
},
{
.i2s = NULL,
@@ -54,6 +56,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.slot_width = 16,
.playback_active = false,
.capture_active = false,
+ .configured = 0,
},
};
@@ -191,7 +194,10 @@ static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream,
stream_str(substream));
}
- return;
+ if (mode_playback)
+ drvdata->configured &= ~PLAYBACK_CONFIGURED;
+ else
+ drvdata->configured &= ~CAPTURE_CONFIGURED;
}
static void ux500_msp_dai_setup_multichannel(struct ux500_platform_drvdata *private,
@@ -509,9 +515,19 @@ static int ux500_msp_dai_prepare(struct snd_pcm_substream *substream,
struct ux500_platform_drvdata *drvdata = &platform_drvdata[dai->id];
struct snd_pcm_runtime *runtime = substream->runtime;
struct msp_config msp_config;
+ bool mode_playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
pr_debug("%s: MSP %d (%s): Enter.\n", __func__, dai->id, stream_str(substream));
+ /* If already configured -> not errors reported */
+ if (mode_playback) {
+ if (drvdata->configured & PLAYBACK_CONFIGURED)
+ goto cleanup;
+ } else {
+ if (drvdata->configured & CAPTURE_CONFIGURED)
+ goto cleanup;
+ }
+
pr_debug("%s: Setup dai (Rate: %u).\n", __func__, runtime->rate);
ux500_msp_dai_compile_msp_config(substream,
drvdata,
@@ -524,6 +540,9 @@ static int ux500_msp_dai_prepare(struct snd_pcm_substream *substream,
goto cleanup;
}
+ drvdata->configured |= mode_playback ?
+ PLAYBACK_CONFIGURED : CAPTURE_CONFIGURED;
+
cleanup:
return ret;
}
diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h
index 28f06120f58..d531f7246c7 100644
--- a/sound/soc/ux500/ux500_msp_dai.h
+++ b/sound/soc/ux500/ux500_msp_dai.h
@@ -38,6 +38,9 @@
#define UX500_MSP_MIN_CHANNELS 1
#define UX500_MSP_MAX_CHANNELS 8
+#define PLAYBACK_CONFIGURED 1
+#define CAPTURE_CONFIGURED 2
+
struct ux500_platform_drvdata {
struct i2s_device *i2s;
unsigned int fmt;
@@ -47,6 +50,7 @@ struct ux500_platform_drvdata {
int slot_width;
bool playback_active;
bool capture_active;
+ u8 configured;
};
extern struct snd_soc_dai ux500_msp_dai[UX500_NBR_OF_DAI];