From: Ramesh Babu K V Date: Thu, 6 Oct 2011 15:18:24 +0000 (+0100) Subject: ASoC: sst_platform: remove hardcoding for voice dai checks X-Git-Tag: 2.1b_release~2003 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a0c5ca5a0af941283b786054b045cfd51f8a9f5;p=kernel%2Fkernel-mfld-blackbay.git ASoC: sst_platform: remove hardcoding for voice dai checks This patch removes hard coded value for checking the voice dai. It uses run time data to differentiate the voice dai. Change-Id: I3064f8e3039014764a23ba4c65e76a40d7f6b10c Signed-off-by: Ramesh Babu K V --- diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index f8404fe..2a89b8a 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -35,7 +35,7 @@ #include "../../../drivers/staging/intel_sst/intel_sst.h" #include "sst_platform.h" -#define VOICE_DAI 4 +#define SST_VOICE_DAI "Voice-cpu-dai" static struct snd_pcm_hardware sst_platform_pcm_hw = { .info = (SNDRV_PCM_INFO_INTERLEAVED | @@ -248,11 +248,13 @@ static int sst_platform_open(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime; struct sst_runtime_stream *stream; int ret_val = 0; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai_link *dai_link = rtd->dai_link; pr_debug("sst_platform_open called\n"); runtime = substream->runtime; runtime->hw = sst_platform_pcm_hw; - if (substream->pcm->device == VOICE_DAI) { + if (!strcmp(dai_link->cpu_dai_name, SST_VOICE_DAI)) { pr_debug("pcm_open for Voice, returning.\n"); return snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); @@ -290,9 +292,11 @@ static int sst_platform_close(struct snd_pcm_substream *substream) { struct sst_runtime_stream *stream; int ret_val = 0, str_id; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai_link *dai_link = rtd->dai_link; pr_debug("sst_platform_close called\n"); - if (substream->pcm->device == VOICE_DAI) { + if (!strcmp(dai_link->cpu_dai_name, SST_VOICE_DAI)) { pr_debug("pcm_close for Voice, returning.\n"); return ret_val; } @@ -318,9 +322,12 @@ static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream) { struct sst_runtime_stream *stream; int ret_val = 0, str_id; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai_link *dai_link = rtd->dai_link; pr_debug("sst_platform_pcm_prepare called\n"); - if (substream->pcm->device == VOICE_DAI) { + + if (!strcmp(dai_link->cpu_dai_name, SST_VOICE_DAI)) { pr_debug("pcm_preare for Voice, returning.\n"); return ret_val; }