aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-03-08 05:08:32 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:22 -0400
commit4a295ca47424b48c993d5cea7c3fbeca75ddb608 (patch)
treee27cff5cc6c01e52ec07bb2c73ccab25b528b1ed /sound
parentc67582b195fb5deb24808ebbafb41045f1a61425 (diff)
[ALSA] at73c213: monaural support
Add support for monaural playback to at73c213 driver. The sound will be apear on L-channel. Tested on AT91SAM9260-EK. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/spi/at73c213.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index c1b0b9dff819..1355fe0c6674 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -118,7 +118,7 @@ static struct snd_pcm_hardware snd_at73c213_playback_hw = {
118 .rates = SNDRV_PCM_RATE_CONTINUOUS, 118 .rates = SNDRV_PCM_RATE_CONTINUOUS,
119 .rate_min = 8000, /* Replaced by chip->bitrate later. */ 119 .rate_min = 8000, /* Replaced by chip->bitrate later. */
120 .rate_max = 50000, /* Replaced by chip->bitrate later. */ 120 .rate_max = 50000, /* Replaced by chip->bitrate later. */
121 .channels_min = 2, 121 .channels_min = 1,
122 .channels_max = 2, 122 .channels_max = 2,
123 .buffer_bytes_max = 64 * 1024 - 1, 123 .buffer_bytes_max = 64 * 1024 - 1,
124 .period_bytes_min = 512, 124 .period_bytes_min = 512,
@@ -229,6 +229,14 @@ static int snd_at73c213_pcm_close(struct snd_pcm_substream *substream)
229static int snd_at73c213_pcm_hw_params(struct snd_pcm_substream *substream, 229static int snd_at73c213_pcm_hw_params(struct snd_pcm_substream *substream,
230 struct snd_pcm_hw_params *hw_params) 230 struct snd_pcm_hw_params *hw_params)
231{ 231{
232 struct snd_at73c213 *chip = snd_pcm_substream_chip(substream);
233 int channels = params_channels(hw_params);
234 int val;
235
236 val = ssc_readl(chip->ssc->regs, TFMR);
237 val = SSC_BFINS(TFMR_DATNB, channels - 1, val);
238 ssc_writel(chip->ssc->regs, TFMR, val);
239
232 return snd_pcm_lib_malloc_pages(substream, 240 return snd_pcm_lib_malloc_pages(substream,
233 params_buffer_bytes(hw_params)); 241 params_buffer_bytes(hw_params));
234} 242}
@@ -250,10 +258,12 @@ static int snd_at73c213_pcm_prepare(struct snd_pcm_substream *substream)
250 258
251 ssc_writel(chip->ssc->regs, PDC_TPR, 259 ssc_writel(chip->ssc->regs, PDC_TPR,
252 (long)runtime->dma_addr); 260 (long)runtime->dma_addr);
253 ssc_writel(chip->ssc->regs, PDC_TCR, runtime->period_size * 2); 261 ssc_writel(chip->ssc->regs, PDC_TCR,
262 runtime->period_size * runtime->channels);
254 ssc_writel(chip->ssc->regs, PDC_TNPR, 263 ssc_writel(chip->ssc->regs, PDC_TNPR,
255 (long)runtime->dma_addr + block_size); 264 (long)runtime->dma_addr + block_size);
256 ssc_writel(chip->ssc->regs, PDC_TNCR, runtime->period_size * 2); 265 ssc_writel(chip->ssc->regs, PDC_TNCR,
266 runtime->period_size * runtime->channels);
257 267
258 return 0; 268 return 0;
259} 269}
@@ -376,7 +386,8 @@ static irqreturn_t snd_at73c213_interrupt(int irq, void *dev_id)
376 386
377 ssc_writel(chip->ssc->regs, PDC_TNPR, 387 ssc_writel(chip->ssc->regs, PDC_TNPR,
378 (long)runtime->dma_addr + offset); 388 (long)runtime->dma_addr + offset);
379 ssc_writel(chip->ssc->regs, PDC_TNCR, runtime->period_size * 2); 389 ssc_writel(chip->ssc->regs, PDC_TNCR,
390 runtime->period_size * runtime->channels);
380 retval = IRQ_HANDLED; 391 retval = IRQ_HANDLED;
381 } 392 }
382 393