Skip to contentSkip to conversation

HAL2: fix LE stream playback

PATCH New Ladislav Michl 1 participant 1 message Jan 10, 2003 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HAL2: fix LE stream playback

Hi,

several people complained about it on IRC, so here is a patch against linux_2_4 branch. Please apply.

Side note: recording still doesn't work. while ago i tried to play with PBUS configuration and found following (refer to hpc3.ps):
1) writing 0x08248844 (ie. 16bit DMA stream) into pbus_dmacfgs produces noise at output.
2) writing 0x082c8844 (ie. 16bit with EVEN_HIGH bit set) make playback two times faster.
3) writing 0x08248844 (ie. 8 bit stream) works as expected. That is strange, because I still believe that HAL2 is 16bit device. I'd guess that there are two bugs in driver which neutralizes each other.
In all cases DMA stream wasn't started for recording.

drivers/sound/hal2.c +5 -3
@@ -1,6 +1,6 @@
 /*
  *  Driver for HAL2 sound processors
- *  Copyright (c) 2001, 2002 Ladislav Michl <[email protected]>
+ *  Copyright (c) 2001-2003 Ladislav Michl <[email protected]>
  *  
  *  Based on Ulf Carlsson's code.
  *
@@ -394,7 +394,8 @@
 	fifobeg = 0;				/* playback is first */
 	fifoend = (sample_size * 4) >> 3;	/* doublewords */
 	pbus->ctrl = HPC3_PDMACTRL_RT | HPC3_PDMACTRL_LD |
-		     (highwater << 8) | (fifobeg << 16) | (fifoend << 24);
+		     (highwater << 8) | (fifobeg << 16) | (fifoend << 24) |
+		     (hal2->dac.format & AFMT_S16_LE ? HPC3_PDMACTRL_SEL : 0);
 	/* We disable everything before we do anything at all */
 	pbus->pbus->pbdma_ctrl = HPC3_PDMACTRL_LD;
 	hal2_i_clearbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECTX);
@@ -420,7 +421,8 @@
 	fifobeg = (4 * 4) >> 3;				/* record is second */
 	fifoend = (4 * 4 + sample_size * 4) >> 3;	/* doublewords */
 	pbus->ctrl = HPC3_PDMACTRL_RT | HPC3_PDMACTRL_RCV | HPC3_PDMACTRL_LD | 
-		     (highwater << 8) | (fifobeg << 16) | (fifoend << 24);
+		     (highwater << 8) | (fifobeg << 16) | (fifoend << 24) |
+		     (hal2->adc.format & AFMT_S16_LE ? HPC3_PDMACTRL_SEL : 0);
 	pbus->pbus->pbdma_ctrl = HPC3_PDMACTRL_LD;
 	hal2_i_clearbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECR);
 	hal2_i_clearbit16(hal2, H2I_DMA_DRV, (1 << pbus->pbusnr));