diff options
author | Sumit Bhattacharya <sumitb@nvidia.com> | 2011-11-05 02:31:54 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2012-03-23 15:39:11 -0700 |
commit | 96ff4d08255da8817f044c9d783bb944567294ca (patch) | |
tree | ebd102cc652c67fbbd59120d02dc7c788852bbd0 | |
parent | 1df4df8c421bb69b15dc83bc45131fc7ce78c2fe (diff) |
ASoC: Tegra: Support mono playback/capture on Tegra30
Program I2s and AHUB CIF channel counts based on hw params instead of
always setting CIF channel count to 2.
Bug 872652
Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com>
Change-Id: I683e976d330ab001a36df6c368bb37fa733a788e
Reviewed-on: http://git-master/r/62502
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: R1dbcdb946b95060a07a1744b4714e2588901f15d
-rw-r--r-- | sound/soc/tegra/tegra30_i2s.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index ec0deb89d8cb..27613f9d1ae9 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -271,9 +271,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, struct tegra30_i2s *i2s = snd_soc_dai_get_drvdata(dai); u32 val; int ret, sample_size, srate, i2sclock, bitcnt, sym_bitclk; - - if (params_channels(params) != 2) - return -EINVAL; + int i2s_client_ch; i2s->reg_ctrl &= ~TEGRA30_I2S_CTRL_BIT_SIZE_MASK; switch (params_format(params)) { @@ -303,9 +301,11 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, if (i2s->reg_ctrl & TEGRA30_I2S_CTRL_FRAME_FORMAT_FSYNC) { bitcnt = (i2sclock / srate) - 1; sym_bitclk = !(i2sclock % srate); + i2s_client_ch = params_channels(params); } else { bitcnt = (i2sclock / (2 * srate)) - 1; sym_bitclk = !(i2sclock % (2 * srate)); + i2s_client_ch = 2; } tegra30_i2s_enable_clocks(i2s); @@ -318,17 +318,27 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, tegra30_i2s_write(i2s, TEGRA30_I2S_TIMING, val); val = (0 << TEGRA30_AUDIOCIF_CTRL_FIFO_THRESHOLD_SHIFT) | - (1 << TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) | - (1 << TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT) | + ((params_channels(params) - 1) << + TEGRA30_AUDIOCIF_CTRL_AUDIO_CHANNELS_SHIFT) | + ((i2s_client_ch - 1) << + TEGRA30_AUDIOCIF_CTRL_CLIENT_CHANNELS_SHIFT) | TEGRA30_AUDIOCIF_CTRL_AUDIO_BITS_16 | TEGRA30_AUDIOCIF_CTRL_CLIENT_BITS_16; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_RX; tegra30_i2s_write(i2s, TEGRA30_I2S_CIF_RX_CTRL, val); + + tegra30_ahub_set_tx_cif_channels(i2s->txcif, + params_channels(params), + params_channels(params)); } else { val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX; tegra30_i2s_write(i2s, TEGRA30_I2S_CIF_TX_CTRL, val); + + tegra30_ahub_set_rx_cif_channels(i2s->rxcif, + params_channels(params), + params_channels(params)); } val = (1 << TEGRA30_I2S_OFFSET_RX_DATA_OFFSET_SHIFT) | @@ -434,13 +444,13 @@ static struct snd_soc_dai_ops tegra30_i2s_dai_ops = { .name = DRV_NAME "." #id, \ .probe = tegra30_i2s_probe, \ .playback = { \ - .channels_min = 2, \ + .channels_min = 1, \ .channels_max = 2, \ .rates = SNDRV_PCM_RATE_8000_96000, \ .formats = SNDRV_PCM_FMTBIT_S16_LE, \ }, \ .capture = { \ - .channels_min = 2, \ + .channels_min = 1, \ .channels_max = 2, \ .rates = SNDRV_PCM_RATE_8000_96000, \ .formats = SNDRV_PCM_FMTBIT_S16_LE, \ |