summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorZidan Wang <zidan.wang@freescale.com>2015-04-02 17:48:48 +0800
committerJason Liu <r64343@freescale.com>2015-05-08 17:23:59 +0800
commit5897611591b48581cb002fd627a93514b37ef72c (patch)
treed34a48403bbce609aee3d310f2ec794a7beeeef7 /sound
parenta876284947bac046760f20b68d19a8f55a1126c8 (diff)
MLK-10108-2: ASoC: imx-mqs: set tdm slot in hw_params() for sai master mode
Set tdm slot in hw_params() for sai master mode. Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-mqs.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sound/soc/fsl/imx-mqs.c b/sound/soc/fsl/imx-mqs.c
index 0a1c2ef94d47..7ef07f7ad22e 100644
--- a/sound/soc/fsl/imx-mqs.c
+++ b/sound/soc/fsl/imx-mqs.c
@@ -15,6 +15,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <sound/soc.h>
+#include <sound/pcm_params.h>
#define SUPPORT_RATE_NUM 10
@@ -51,12 +52,27 @@ static int imx_mqs_startup(struct snd_pcm_substream *substream)
return 0;
}
+static int imx_mqs_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+ struct snd_soc_card *card = rtd->card;
+ int ret;
+
+ ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0, 0, 2, params_width(params));
+ if (ret) {
+ dev_err(card->dev, "failed to set cpu dai tdm slot: %d\n", ret);
+ return ret;
+ }
+ return 0;
+}
+
static struct snd_soc_ops imx_mqs_ops = {
.startup = imx_mqs_startup,
+ .hw_params = imx_mqs_hw_params,
};
-
-
static struct snd_soc_dai_link imx_mqs_dai = {
.name = "HiFi",
.stream_name = "HiFi",