summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShyam Krishnan M <shyam.moni@stericsson.com>2011-10-03 13:45:06 +0530
committerSrinidhi KASAGAR <srinidhi.kasagar@stericsson.com>2011-10-03 14:11:04 +0200
commit985cad9b0d437c8fa2f6d877b44d7bc172d01f74 (patch)
tree37de7a052a6b035a102f193a1e9dd1543bf44828 /sound
parent39d3e34482a6cb306b363a82edd8a2ccaecd362e (diff)
ASOC CG29xx: Configures driver cg2900 for FM
This patch sets the driver configuration on cg2900. The MSP1 line is used to receive FM. ST-Ericsson Linux next: NA ST-Ericsson ID: 335714 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ic8f2e00b1ed57716007ef65b5b9eb4663c4f5e3b Signed-off-by: Shyam Krishnan M <shyam.moni@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32392 Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/ux500/u5500.c26
-rw-r--r--sound/soc/ux500/ux500_cg29xx.c116
-rw-r--r--sound/soc/ux500/ux500_cg29xx.h1
3 files changed, 134 insertions, 9 deletions
diff --git a/sound/soc/ux500/u5500.c b/sound/soc/ux500/u5500.c
index 6564fe9d639..75f5a3ca1e1 100644
--- a/sound/soc/ux500/u5500.c
+++ b/sound/soc/ux500/u5500.c
@@ -81,14 +81,24 @@ struct snd_soc_dai_link u5500_dai_links[] = {
},
#ifdef CONFIG_SND_SOC_UX500_CG29XX
{
- .name = "cg29xx_0",
- .stream_name = "cg29xx_0",
- .cpu_dai_name = "i2s.0",
- .codec_dai_name = "cg29xx-codec-dai.0",
- .platform_name = "ux500-pcm.0",
- .codec_name = "cg29xx-codec.0",
- .init = NULL,
- .ops = ux500_cg29xx_ops,
+ .name = "cg29xx_0",
+ .stream_name = "cg29xx_0",
+ .cpu_dai_name = "i2s.1",
+ .codec_dai_name = "cg29xx-codec-dai.0",
+ .platform_name = "ux500-pcm.0",
+ .codec_name = "cg29xx-codec.0",
+ .init = NULL,
+ .ops = u5500_cg29xx_ops,
+ },
+ {
+ .name = "cg29xx_1",
+ .stream_name = "cg29xx_1",
+ .cpu_dai_name = "i2s.0",
+ .codec_dai_name = "cg29xx-codec-dai.1",
+ .platform_name = "ux500-pcm.0",
+ .codec_name = "cg29xx-codec.0",
+ .init = NULL,
+ .ops = u5500_cg29xx_ops,
},
#endif
{
diff --git a/sound/soc/ux500/ux500_cg29xx.c b/sound/soc/ux500/ux500_cg29xx.c
index e83a6869c5a..8301a80f54d 100644
--- a/sound/soc/ux500/ux500_cg29xx.c
+++ b/sound/soc/ux500/ux500_cg29xx.c
@@ -102,9 +102,123 @@ out_err:
return err;
}
+int u5500_cg29xx_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_dai *codec_dai = rtd->codec_dai;
+ int channels = params_channels(params);
+ int err;
+ struct snd_soc_codec *codec = codec_dai->codec;
+ int dai_id = codec_dai->id;
+ struct cg29xx_codec_dai_data *codec_drvdata =
+ snd_soc_codec_get_drvdata(codec);
+ struct cg29xx_codec_dai_data *dai_data = &codec_drvdata[dai_id];
+
+ pr_debug("%s: Enter.\n", __func__);
+ pr_debug("%s: substream->pcm->name=%s\n",
+ __func__, substream->pcm->name);
+ pr_debug("%s: substream->pcm->id = %s\n", __func__, substream->pcm->id);
+ pr_debug("%s: substream->name = %s.\n", __func__, substream->name);
+ pr_debug("%s: substream->number = %d.\n", __func__, substream->number);
+ pr_debug("%s: channels = %d.\n", __func__, channels);
+ pr_debug("%s: DAI-index (Codec): %d\n", __func__, codec_dai->id);
+ pr_debug("%s: DAI-index (Platform): %d\n", __func__, cpu_dai->id);
+
+ if (dai_data->config.port == PORT_0_I2S) {
+ err = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
+ if (err) {
+ pr_err("%s: snd_soc_dai_set_fmt (codec) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+
+ err = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS);
+
+ if (err) {
+ pr_err("%s: snd_soc_dai_set_sysclk(cpu_dai) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+ } else {
+ err = snd_soc_dai_set_fmt(codec_dai,
+ SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_CBS_CFS);
+ if (err) {
+ pr_err("%s: snd_soc_dai_set_fmt(codec) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+
+ err = snd_soc_dai_set_tdm_slot(codec_dai,
+ 1 << CG29XX_DAI_SLOT0_SHIFT,
+ 1 << CG29XX_DAI_SLOT0_SHIFT,
+ UX500_CG29XX_DAI_SLOTS,
+ UX500_CG29XX_DAI_SLOT_WIDTH);
+
+ if (err) {
+ pr_err("%s: cg29xx_set_tdm_slot(codec_dai) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+
+ err = snd_soc_dai_set_fmt(cpu_dai,
+ SND_SOC_DAIFMT_DSP_A |
+ SND_SOC_DAIFMT_CBS_CFS |
+ SND_SOC_DAIFMT_NB_NF);
+
+ if (err) {
+ pr_err("%s: snd_soc_dai_set_fmt(cpu_dai) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+
+ err = snd_soc_dai_set_sysclk(cpu_dai,
+ UX500_MSP_MASTER_CLOCK,
+ UX500_CG29XX_MSP_CLOCK_FREQ,
+ 0);
+
+ if (err) {
+ pr_err("%s: snd_soc_dai_set_sysclk(cpu_dai) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+
+ err = snd_soc_dai_set_tdm_slot(cpu_dai,
+ UX500_CG29XX_DAI_ACTIVE_SLOTS,
+ UX500_CG29XX_DAI_ACTIVE_SLOTS,
+ UX500_CG29XX_DAI_SLOTS,
+ UX500_CG29XX_DAI_SLOT_WIDTH);
+
+ if (err) {
+ pr_err("%s: cg29xx_set_tdm_slot(cpu_dai) failed with %d.\n",
+ __func__,
+ err);
+ goto out_err;
+ }
+ }
+out_err:
+ return err;
+}
+
struct snd_soc_ops ux500_cg29xx_ops[] = {
{
- .hw_params = ux500_cg29xx_hw_params,
+ .hw_params = ux500_cg29xx_hw_params,
+ }
+};
+
+struct snd_soc_ops u5500_cg29xx_ops[] = {
+ {
+ .hw_params = u5500_cg29xx_hw_params,
}
};
diff --git a/sound/soc/ux500/ux500_cg29xx.h b/sound/soc/ux500/ux500_cg29xx.h
index 49a8c3e0478..33736bca0cd 100644
--- a/sound/soc/ux500/ux500_cg29xx.h
+++ b/sound/soc/ux500/ux500_cg29xx.h
@@ -15,5 +15,6 @@
#define UX500_CG29XX_H
extern struct snd_soc_ops ux500_cg29xx_ops[];
+extern struct snd_soc_ops u5500_cg29xx_ops[];
#endif