diff options
Diffstat (limited to 'sound/soc/fsl/mpc5200_psc_ac97.c')
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_ac97.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index c4ae3e096bb9..3dbc7f7cd7b9 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
@@ -130,6 +130,7 @@ static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream, | |||
130 | struct snd_soc_dai *cpu_dai) | 130 | struct snd_soc_dai *cpu_dai) |
131 | { | 131 | { |
132 | struct psc_dma *psc_dma = cpu_dai->private_data; | 132 | struct psc_dma *psc_dma = cpu_dai->private_data; |
133 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); | ||
133 | 134 | ||
134 | dev_dbg(psc_dma->dev, "%s(substream=%p) p_size=%i p_bytes=%i" | 135 | dev_dbg(psc_dma->dev, "%s(substream=%p) p_size=%i p_bytes=%i" |
135 | " periods=%i buffer_size=%i buffer_bytes=%i channels=%i" | 136 | " periods=%i buffer_size=%i buffer_bytes=%i channels=%i" |
@@ -140,20 +141,10 @@ static int psc_ac97_hw_analog_params(struct snd_pcm_substream *substream, | |||
140 | params_channels(params), params_rate(params), | 141 | params_channels(params), params_rate(params), |
141 | params_format(params)); | 142 | params_format(params)); |
142 | 143 | ||
143 | 144 | /* Determine the set of enable bits to turn on */ | |
144 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) { | 145 | s->ac97_slot_bits = (params_channels(params) == 1) ? 0x100 : 0x300; |
145 | if (params_channels(params) == 1) | 146 | if (substream->pstr->stream != SNDRV_PCM_STREAM_CAPTURE) |
146 | psc_dma->slots |= 0x00000100; | 147 | s->ac97_slot_bits <<= 16; |
147 | else | ||
148 | psc_dma->slots |= 0x00000300; | ||
149 | } else { | ||
150 | if (params_channels(params) == 1) | ||
151 | psc_dma->slots |= 0x01000000; | ||
152 | else | ||
153 | psc_dma->slots |= 0x03000000; | ||
154 | } | ||
155 | out_be32(&psc_dma->psc_regs->ac97_slots, psc_dma->slots); | ||
156 | |||
157 | return 0; | 148 | return 0; |
158 | } | 149 | } |
159 | 150 | ||
@@ -163,6 +154,8 @@ static int psc_ac97_hw_digital_params(struct snd_pcm_substream *substream, | |||
163 | { | 154 | { |
164 | struct psc_dma *psc_dma = cpu_dai->private_data; | 155 | struct psc_dma *psc_dma = cpu_dai->private_data; |
165 | 156 | ||
157 | dev_dbg(psc_dma->dev, "%s(substream=%p)\n", __func__, substream); | ||
158 | |||
166 | if (params_channels(params) == 1) | 159 | if (params_channels(params) == 1) |
167 | out_be32(&psc_dma->psc_regs->ac97_slots, 0x01000000); | 160 | out_be32(&psc_dma->psc_regs->ac97_slots, 0x01000000); |
168 | else | 161 | else |
@@ -176,14 +169,24 @@ static int psc_ac97_trigger(struct snd_pcm_substream *substream, int cmd, | |||
176 | { | 169 | { |
177 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 170 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
178 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; | 171 | struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; |
172 | struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma); | ||
179 | 173 | ||
180 | switch (cmd) { | 174 | switch (cmd) { |
175 | case SNDRV_PCM_TRIGGER_START: | ||
176 | dev_dbg(psc_dma->dev, "AC97 START: stream=%i\n", | ||
177 | substream->pstr->stream); | ||
178 | |||
179 | /* Set the slot enable bits */ | ||
180 | psc_dma->slots |= s->ac97_slot_bits; | ||
181 | out_be32(&psc_dma->psc_regs->ac97_slots, psc_dma->slots); | ||
182 | break; | ||
183 | |||
181 | case SNDRV_PCM_TRIGGER_STOP: | 184 | case SNDRV_PCM_TRIGGER_STOP: |
182 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | 185 | dev_dbg(psc_dma->dev, "AC97 STOP: stream=%i\n", |
183 | psc_dma->slots &= 0xFFFF0000; | 186 | substream->pstr->stream); |
184 | else | ||
185 | psc_dma->slots &= 0x0000FFFF; | ||
186 | 187 | ||
188 | /* Clear the slot enable bits */ | ||
189 | psc_dma->slots &= ~(s->ac97_slot_bits); | ||
187 | out_be32(&psc_dma->psc_regs->ac97_slots, psc_dma->slots); | 190 | out_be32(&psc_dma->psc_regs->ac97_slots, psc_dma->slots); |
188 | break; | 191 | break; |
189 | } | 192 | } |