aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index 54253e9b4b02..ac6238e93513 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -18,8 +18,6 @@ module_param(nforce_wa, bool, 0444);
18MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " 18MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
19 "(expect bad sound)"); 19 "(expect bad sound)");
20 20
21#define DMIX_WANTS_S16 1
22
23static void pcsp_start_timer(unsigned long dummy) 21static void pcsp_start_timer(unsigned long dummy)
24{ 22{
25 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL); 23 hrtimer_start(&pcsp_chip.timer, ktime_set(0, 0), HRTIMER_MODE_REL);
@@ -49,7 +47,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
49{ 47{
50 unsigned long flags; 48 unsigned long flags;
51 unsigned char timer_cnt, val; 49 unsigned char timer_cnt, val;
52 int fmt_size, periods_elapsed; 50 int periods_elapsed;
53 u64 ns; 51 u64 ns;
54 size_t period_bytes, buffer_bytes; 52 size_t period_bytes, buffer_bytes;
55 struct snd_pcm_substream *substream; 53 struct snd_pcm_substream *substream;
@@ -94,11 +92,8 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
94 goto exit_nr_unlock2; 92 goto exit_nr_unlock2;
95 93
96 runtime = substream->runtime; 94 runtime = substream->runtime;
97 fmt_size = snd_pcm_format_physical_width(runtime->format) >> 3; 95 /* assume it is u8 mono */
98 /* assume it is mono! */ 96 val = runtime->dma_area[chip->playback_ptr];
99 val = runtime->dma_area[chip->playback_ptr + fmt_size - 1];
100 if (snd_pcm_format_signed(runtime->format))
101 val ^= 0x80;
102 timer_cnt = val * CUR_DIV() / 256; 97 timer_cnt = val * CUR_DIV() / 256;
103 98
104 if (timer_cnt && chip->enable) { 99 if (timer_cnt && chip->enable) {
@@ -116,7 +111,7 @@ enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle)
116 111
117 period_bytes = snd_pcm_lib_period_bytes(substream); 112 period_bytes = snd_pcm_lib_period_bytes(substream);
118 buffer_bytes = snd_pcm_lib_buffer_bytes(substream); 113 buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
119 chip->playback_ptr += PCSP_INDEX_INC() * fmt_size; 114 chip->playback_ptr += PCSP_INDEX_INC();
120 periods_elapsed = chip->playback_ptr - chip->period_ptr; 115 periods_elapsed = chip->playback_ptr - chip->period_ptr;
121 if (periods_elapsed < 0) { 116 if (periods_elapsed < 0) {
122 printk(KERN_WARNING "PCSP: playback_ptr inconsistent " 117 printk(KERN_WARNING "PCSP: playback_ptr inconsistent "
@@ -275,11 +270,7 @@ static struct snd_pcm_hardware snd_pcsp_playback = {
275 .info = (SNDRV_PCM_INFO_INTERLEAVED | 270 .info = (SNDRV_PCM_INFO_INTERLEAVED |
276 SNDRV_PCM_INFO_HALF_DUPLEX | 271 SNDRV_PCM_INFO_HALF_DUPLEX |
277 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), 272 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),
278 .formats = (SNDRV_PCM_FMTBIT_U8 273 .formats = SNDRV_PCM_FMTBIT_U8,
279#if DMIX_WANTS_S16
280 | SNDRV_PCM_FMTBIT_S16_LE
281#endif
282 ),
283 .rates = SNDRV_PCM_RATE_KNOT, 274 .rates = SNDRV_PCM_RATE_KNOT,
284 .rate_min = PCSP_DEFAULT_SRATE, 275 .rate_min = PCSP_DEFAULT_SRATE,
285 .rate_max = PCSP_DEFAULT_SRATE, 276 .rate_max = PCSP_DEFAULT_SRATE,