From: Sebastien Guiriec Date: Fri, 18 Dec 2015 02:35:39 +0000 (-0600) Subject: ASoC: Intel: bytcr_rt5640: set SSP to I2S mode 2ch X-Git-Tag: v4.5-rc1~80^2~26^2~1^2~6^4~9 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3f27dedda463347e98d406fc97ff6767ac59ea05;p=karo-tx-linux.git 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 Signed-off-by: Pierre-Louis Bossart Signed-off-by: Mark Brown --- diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index 7a5c9a36c1db..66d37b0e64d1 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; }