Asoc: msm: 8064: Set channel number based on recording mode

The shared channel number can be overwritten by front-end
DAI's channel setting. Add fixup function to set the correct
channel number based on recording mode in the machine driver.

Signed-off-by: SathishKumar Mani <smani@codeaurora.org>
BUG-ID: 7313016
This commit is contained in:
SathishKumar Mani 2012-08-17 17:35:32 -07:00 committed by Iliyan Malchev
parent c5949fef4b
commit 335106e3b4

View file

@ -1353,6 +1353,28 @@ static int msm_slim_3_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
static int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
struct snd_interval *rate = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_RATE);
struct snd_interval *channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS);
pr_debug("%s()\n", __func__);
rate->min = rate->max = 48000;
if (rec_mode == INCALL_REC_STEREO)
channels->min = channels->max = 2;
else
channels->min = channels->max = 1;
pr_debug("%s channels->min %u channels->max %u ()\n", __func__,
channels->min, channels->max);
return 0;
}
static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
@ -2022,7 +2044,7 @@ static struct snd_soc_dai_link msm_dai[] = {
.codec_dai_name = "msm-stub-tx",
.no_pcm = 1,
.be_id = MSM_BACKEND_DAI_SLIMBUS_4_TX,
.be_hw_params_fixup = msm_be_hw_params_fixup,
.be_hw_params_fixup = msm_slim_4_tx_be_hw_params_fixup,
.ops = &msm_slimbus_4_be_ops,
},
{