Author: wmb Date: Wed Oct 12 23:49:29 2011 New Revision: 2598 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2598
Log: OLPC XO-1.75 - trac # 11329 - Eliminated, or at least greatly reduced, pops at the beginning and end of the startup sound. The beginning pop was fixed by reordering the CODEC power-up sequence so the DAC is turned on before the output amp. The ending pop was fixed by appending zeros to the upsampling buffer so the filter does not pick up unrelated garbage after the end.
Modified: cpu/arm/firfilter.fth cpu/arm/olpc/1.75/alc5631.fth cpu/arm/olpc/1.75/sound.fth
Modified: cpu/arm/firfilter.fth ============================================================================== --- cpu/arm/firfilter.fth Wed Oct 12 23:27:50 2011 (r2597) +++ cpu/arm/firfilter.fth Wed Oct 12 23:49:29 2011 (r2598) @@ -21,7 +21,9 @@ \ Taps/phase=16 \ Stride=2 (mono)
-code 16tap-upsample ( 'out 'in /in 'weights #phases -- ) +d# 16 constant taps/phase + +code 16tap-upsample ( 'out 'in /in 'weights #phases -- 'out' ) ldmia sp!,{r0,r1,r2,r3} \ r0:'weights r1:/in r2:'in r3:'out tos:#phases
mov r4,#15 \ Multiplier scale factor @@ -88,7 +90,7 @@ decs r1,#2 \ Decrement input length by the sample size 0<= until
- pop tos,sp + mov tos,r3 c;
\ Filter coefficients for 6x upsampling. The following filter was @@ -152,9 +154,19 @@ end [then]
+taps/phase 2+ 2* /w* constant /end-buf +/end-buf buffer: end-buf + : upsample6 ( src-adr /src dst-adr -- ) - enable-iwmmx ( src-adr #src-samples dst-adr ) - -rot weights-6phase #phases 16tap-upsample ( ) + enable-iwmmx ( src-adr /src dst-adr ) + >r taps/phase /w* - ( src-adr /src' r: dst-adr ) + r> third third ( src-adr /src dst-adr src-adr /src ) + weights-6phase #phases 16tap-upsample ( src-adr /src dst-adr' ) + -rot + ( dst-adr src-adr' ) + end-buf /end-buf erase ( dst-adr src-adr' ) + end-buf taps/phase /w* move ( dst-adr ) + end-buf taps/phase /w* weights-6phase #phases 16tap-upsample ( dst-adr' ) + drop ;
\ LICENSE_BEGIN
Modified: cpu/arm/olpc/1.75/alc5631.fth ============================================================================== --- cpu/arm/olpc/1.75/alc5631.fth Wed Oct 12 23:27:50 2011 (r2597) +++ cpu/arm/olpc/1.75/alc5631.fth Wed Oct 12 23:49:29 2011 (r2598) @@ -1,12 +1,6 @@ \ See license at end of file purpose: Driver for Realtek ALC5631Q audio CODEC chip
-: adc-on ( -- ) h# 0c00 h# 3a codec-set ; -: adc-off ( -- ) h# 0c00 h# 3a codec-clr ; -: dac-on ( -- ) h# 0300 h# 3a codec-set ; -: dac-off ( -- ) h# 0300 h# 3a codec-clr ; -: adc+dac-on ( -- ) h# 0f00 h# 3a codec-set ; - : set-routing ( -- ) h# c0c0 h# 02 codec-set \ SPKMIXLR -> SPKVOLLR, muted h# c0c0 h# 04 codec-set \ OUTMIXLR -> HPOVOLLR, muted @@ -45,14 +39,6 @@ h# 1010 h# 38 codec! \ Divisors; the values in this register don't seem to make much \ difference unless you set the divisors to very high values. ; -: elided ( -- ) - \ The ADC and DAC will be turned on as needed by adc-on and dac-on, after - \ the BCLK clock from the SoC is on. If you turn on the ADC when BCLK is - \ not clocking, the ADC often doesn't output any data. - b# 1001.0000.1110.0000 h# 3a codec! \ All on except ADC and DAC - b# 1111.1100.0011.1100 h# 3b codec! \ All on except PLL - b# 1111.1100.0000.0000 h# 3e codec! \ AXI and MONO IN off -; : mic-bias-off ( -- ) h# 000c h# 3b codec-clr ; : mic-bias-on ( -- ) h# 000c h# 3b codec-set ;
@@ -176,11 +162,13 @@ \ h# 0000 pwr3b! \ Power off PLL ; : open-out-specific ( -- ) + \ Turning on the DAC here at the beginning seems to prevent pops better than doing + \ it a few steps later at the point that Realtek suggested. + h# 0300 h# 3a codec-set \ Power on DACs h# 0060 h# 3a codec-set \ Power on DAC to mixer speakers-on? if h# 1000 h# 3a codec-set then \ Power on ClassD amp speakers-on? if h# c000 h# 3e codec-set then \ Power on SPKL/RVOL headphones-on? if h# 0c00 h# 3e codec-set then \ Power on HPOVOLL/R -\ h# 0300 h# 3a codec-set \ Power on DACL/R - defer until dac-on is called by start-audio-out or out-in h# c000 pwr3b! \ Power on OUTMIXL/R speakers-on? if h# 3000 h# 3b codec-set then \ Power on SPKMIXL/R
@@ -192,7 +180,7 @@ open-common open-out-specific ; - + : close-out-specific ( -- ) speakers-on? if mute-speakers then headphones-on? if hp-powerdown-depop then @@ -218,7 +206,7 @@ adc-stereo h# 0c00 h# 3b codec-set \ Power on RECMIXLR h# 0030 h# 3b codec-set \ Power on MIC1/2 boost gain -\ h# 0c00 h# 3a codec-set \ Power on ADCL/R - defer until adc-on is called by audio-in or out-in + h# 0c00 h# 3a codec-set \ Power on ADCL/R ; : open-in ( -- ) \ h# 46f0 h# 44 codec! \ pll: 256000 -> 2048000 ??? why is this different from playback? - 8khz record?
Modified: cpu/arm/olpc/1.75/sound.fth ============================================================================== --- cpu/arm/olpc/1.75/sound.fth Wed Oct 12 23:27:50 2011 (r2597) +++ cpu/arm/olpc/1.75/sound.fth Wed Oct 12 23:49:29 2011 (r2598) @@ -345,7 +345,6 @@ out-len if copy-out then \ Prefill the second buffer start-out-ring master-tx - dac-on install-playback-alarm true to playing? ; @@ -390,7 +389,6 @@ make-in-ring ( actual ) start-in-ring ( actual ) master-rx ( actual ) - adc-on ( actual ) begin in-len while ( actual ) wait-in ( actual ) copy-in ( actual ) @@ -436,8 +434,6 @@ master-rx ( ) \ Now the clock is on slave-tx ( )
- adc+dac-on ( ) - true to playing?
begin in-len playing? or while ( ) @@ -453,11 +449,8 @@ reset-rx reset-tx
- dac-off adc-off ( ) - - mono? if collapse-in then ( ) - close-out-in + mono? if collapse-in then ( ) ;
0 [if] \ Interactive test words for out-in
openfirmware@openfirmware.info