aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Guiriec <sebastien.guiriec@intel.com>2015-12-17 20:35:39 -0600
committerMark Brown <broonie@kernel.org>2015-12-19 11:49:56 +0000
commit3f27dedda463347e98d406fc97ff6767ac59ea05 (patch)
tree9ba21e8a04e009fd1a2b399e4907579face9ab12
parentd2c7db854ed07548ca7d01118eee67fd6a78a2be (diff)
downloadsound-unstable-3f27dedda463347e98d406fc97ff6767ac59ea05.tar.gz
ASoC: Intel: bytcr_rt5640: set SSP to I2S mode 2ch
Using the hw_fixup function in order to overwrite the default SSP setting for Audio DSP port connected to the codec. Instead of TDM 4ch use I2S 2ch 24 bits. Signed-off-by: Sebastien Guiriec <sebastien.guiriec@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 7a5c9a36c1db67..66d37b0e64d15b 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -107,6 +107,7 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd,
SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
+ int ret;
/* The DSP will covert the FE rate to 48k, stereo, 24bits */
rate->min = rate->max = 48000;
@@ -114,6 +115,28 @@ static int byt_codec_fixup(struct snd_soc_pcm_runtime *rtd,
/* set SSP2 to 24-bit */
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
+
+ /*
+ * Default mode for SSP configuration is TDM 4 slot, override config
+ * with explicit setting to I2S 2ch 24-bit. The word length is set with
+ * dai_set_tdm_slot() since there is no other API exposed
+ */
+ ret = snd_soc_dai_set_fmt(rtd->cpu_dai,
+ SND_SOC_DAIFMT_I2S |
+ SND_SOC_DAIFMT_NB_IF |
+ SND_SOC_DAIFMT_CBS_CFS
+ );
+ if (ret < 0) {
+ dev_err(rtd->dev, "can't set format to I2S, err %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 24);
+ if (ret < 0) {
+ dev_err(rtd->dev, "can't set I2S config, err %d\n", ret);
+ return ret;
+ }
+
return 0;
}