diff options
author | Songhee Baek <sbaek@nvidia.com> | 2014-02-24 16:43:19 -0800 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2014-03-05 22:54:34 -0800 |
commit | aceb86229e95f171046ec20460005a12733b88ed (patch) | |
tree | f88e1a3a5e83fc46f2b990464180dc536eede87c /sound | |
parent | 91e4b351b77955b10b525b6b24a736a559e20abd (diff) |
ASoC: tegra-alt: fix sample rate change in mono
I2S hw doesn't support mono so we convert mono to stereo.
So I2S bit count value should be same as stereo in mono case.
Bug 1411049
Change-Id: I7db961049788846ee28d0baee5e81e1bd6d1d1dd
Signed-off-by: Songhee Baek <sbaek@nvidia.com>
Reviewed-on: http://git-master/r/373793
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Gajanan Bhat <gbhat@nvidia.com>
Reviewed-by: Bob Johnston <bjohnston@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra-alt/tegra30_i2s_alt.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/sound/soc/tegra-alt/tegra30_i2s_alt.c b/sound/soc/tegra-alt/tegra30_i2s_alt.c index 1ca5fb9e9324..c1aac76599b7 100644 --- a/sound/soc/tegra-alt/tegra30_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra30_i2s_alt.c @@ -279,12 +279,36 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, regmap_read(i2s->regmap, TEGRA30_I2S_CTRL, &val); if ((val & TEGRA30_I2S_CTRL_FRAME_FORMAT_MASK) == TEGRA30_I2S_CTRL_FRAME_FORMAT_FSYNC) { + i2sclock = srate * channels * sample_size; i2s->soc_data->set_slot_ctrl(i2s->regmap, channels, (1 << channels) - 1, (1 << channels) - 1); - } else - i2sclock = srate * channels * sample_size * 2; + + cif_conf.threshold = 0; + cif_conf.audio_channels = channels; + cif_conf.client_channels = channels; + cif_conf.expand = 0; + cif_conf.stereo_conv = 0; + cif_conf.replicate = 0; + cif_conf.truncate = 0; + cif_conf.mono_conv = 0; + } else { + if (channels == 1) + i2sclock = srate * 2 * sample_size * 2; + else + i2sclock = srate * channels * sample_size * 2; + /* In LRCK mode, hw doesn't support mono. + We should convert mono to steroe through acif */ + cif_conf.threshold = 0; + cif_conf.audio_channels = channels; + cif_conf.client_channels = (channels == 1) ? 2 : channels; + cif_conf.expand = 0; + cif_conf.stereo_conv = 0; + cif_conf.replicate = 0; + cif_conf.truncate = 0; + cif_conf.mono_conv = 0; + } bitcnt = (i2sclock / srate) - 1; if ((bitcnt < 0) || @@ -299,7 +323,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, return ret; } - if (channels != 2) + if (channels > 2) val = bitcnt << TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT; else val = (bitcnt >> 1) << @@ -310,15 +334,6 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, regmap_write(i2s->regmap, TEGRA30_I2S_TIMING, val); - cif_conf.threshold = 0; - cif_conf.audio_channels = channels; - cif_conf.client_channels = (channels == 1) ? 2 : channels; - cif_conf.expand = 0; - cif_conf.stereo_conv = 0; - cif_conf.replicate = 0; - cif_conf.truncate = 0; - cif_conf.mono_conv = 0; - /* As a COCEC DAI, CAPTURE is transmit */ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { cif_conf.direction = TEGRA30_AUDIOCIF_DIRECTION_RX; |