diff options
author | Sumit Bhattacharya <sumitb@nvidia.com> | 2014-01-30 16:13:10 +0530 |
---|---|---|
committer | Sachin Nikam <snikam@nvidia.com> | 2014-02-13 05:37:34 -0800 |
commit | 0f34c30d28e8c4a72b0ad824a437a43da3aa64bc (patch) | |
tree | b5e68904c6f2722e6e21d37a4c8ae13ceb0e32d4 /sound | |
parent | 9ade082cb9cff200c646bbd6cffa159396ab0fdb (diff) |
ASoC : compress: Ensure proper hw_param is passed
Ensure proper sample rate and channel information is passed to BE
DAI hw_param when called from compressed FE DAI.
Bug 1399922
Change-Id: Iecd5f61ae84c91050a9c6f8ab2cd49f7699388b3
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Reviewed-on: http://git-master/r/361956
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-compress.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 19556a0203da..d073f5b89712 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -473,6 +473,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream; struct snd_soc_platform *platform = fe->platform; struct snd_pcm_hw_params *hw_params; + struct snd_interval *interval; int ret = 0, stream; if (cstream->direction == SND_COMPRESS_PLAYBACK) @@ -504,7 +505,14 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, goto out; } - memcpy(&fe->dpcm[fe_substream->stream].hw_params, params, + interval = hw_param_interval(hw_params, SNDRV_PCM_HW_PARAM_RATE); + interval->min = interval->max = + snd_pcm_rate_bit_to_rate(params->codec.sample_rate); + + interval = hw_param_interval(hw_params, SNDRV_PCM_HW_PARAM_CHANNELS); + interval->min = interval->max = params->codec.ch_out; + + memcpy(&fe->dpcm[fe_substream->stream].hw_params, hw_params, sizeof(struct snd_pcm_hw_params)); fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; @@ -529,6 +537,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, out: fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; mutex_unlock(&fe->card->mutex); + kfree(hw_params); return ret; } |