diff options
author | Andrew Jackson <Andrew.Jackson@arm.com> | 2014-12-19 11:18:06 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-12-22 10:06:03 -0500 |
commit | db2c1f9e38a38e0f9294b5a8a83d744f68fbe726 (patch) | |
tree | 04b6376bee6cb7c3e210023f14614731a9e1a5b3 /sound | |
parent | 3475c3d034d7f276a474c8bd53f44b48c8bf669d (diff) |
ASoC: dwc: Iterate over all channels
The Designware core can be configured with up to four stereo channels.
Each stereo channel is individually configured so, when the driver's
hw_params call is made, each requested stereo channel has to be
programmed.
Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/dwc/designware_i2s.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index 4df19b57429c..8d18bbda661b 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
209 | 209 | ||
210 | switch (config->chan_nr) { | 210 | switch (config->chan_nr) { |
211 | case EIGHT_CHANNEL_SUPPORT: | 211 | case EIGHT_CHANNEL_SUPPORT: |
212 | ch_reg = 3; | ||
213 | break; | ||
214 | case SIX_CHANNEL_SUPPORT: | 212 | case SIX_CHANNEL_SUPPORT: |
215 | ch_reg = 2; | ||
216 | break; | ||
217 | case FOUR_CHANNEL_SUPPORT: | 213 | case FOUR_CHANNEL_SUPPORT: |
218 | ch_reg = 1; | ||
219 | break; | ||
220 | case TWO_CHANNEL_SUPPORT: | 214 | case TWO_CHANNEL_SUPPORT: |
221 | ch_reg = 0; | ||
222 | break; | 215 | break; |
223 | default: | 216 | default: |
224 | dev_err(dev->dev, "channel not supported\n"); | 217 | dev_err(dev->dev, "channel not supported\n"); |
@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
227 | 220 | ||
228 | i2s_disable_channels(dev, substream->stream); | 221 | i2s_disable_channels(dev, substream->stream); |
229 | 222 | ||
230 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 223 | for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { |
231 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); | 224 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
232 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); | 225 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), |
233 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 226 | xfer_resolution); |
234 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); | 227 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); |
235 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); | 228 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); |
236 | } else { | 229 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); |
237 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); | 230 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); |
238 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); | 231 | } else { |
239 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 232 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), |
240 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | 233 | xfer_resolution); |
241 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | 234 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); |
235 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | ||
236 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | ||
237 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | ||
238 | } | ||
242 | } | 239 | } |
243 | 240 | ||
244 | i2s_write_reg(dev->i2s_base, CCR, ccr); | 241 | i2s_write_reg(dev->i2s_base, CCR, ccr); |