Author: wmb Date: Mon Jun 20 22:33:27 2011 New Revision: 2298 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2298
Log: OLPC - fixed XO-1.5 build problem introduced by XO-1.75 audio test.
Modified: cpu/arm/olpc/1.75/sound.fth dev/hdaudio/conexant.fth dev/hdaudio/core.fth dev/hdaudio/olpc-ports.fth dev/hdaudio/test.fth
Modified: cpu/arm/olpc/1.75/sound.fth ============================================================================== --- cpu/arm/olpc/1.75/sound.fth Mon Jun 20 19:13:54 2011 (r2297) +++ cpu/arm/olpc/1.75/sound.fth Mon Jun 20 22:33:27 2011 (r2298) @@ -522,13 +522,19 @@
false value force-internal-mic? \ Can't be implemented on XO-1.75 2 value #channels -fload ${BP}/dev/hdaudio/test.fth -: input-settings ( -- ) - audio-clock-on ( ) \ If you don't do this, the L/R phase is often wrong + +\ Unless you do the audio-clock-on, the L/R phase is often wrong +: input-test-settings ( -- ) audio-clock-on ; +: output-test-settings ( -- ) ; + +d# -1 constant case-test-volume +d# -13 constant fixture-test-volume +d# -22 constant loopback-test-volume +: configure-platform ( -- ) + board-revision h# 1a28 >= if " configure-xo1.75" $call-analyzer exit then ; -: output-settings ( -- ) ; -' input-settings to input-common-settings -' output-settings to output-common-settings + +fload ${BP}/dev/hdaudio/test.fth
end-package
Modified: dev/hdaudio/conexant.fth ============================================================================== --- dev/hdaudio/conexant.fth Mon Jun 20 19:13:54 2011 (r2297) +++ dev/hdaudio/conexant.fth Mon Jun 20 22:33:27 2011 (r2298) @@ -136,6 +136,25 @@ \ setup-config-default ;
+\ As far as I can tell, the CX2058 does not have a way to turn off the +\ bias for the external mic port (port b). To eliminate the bias, we +\ would have to use port f instead, but that doesn't work with loopback +\ because port f is DC coupled, so the DC offset on the headphone output +\ would overwhelm the input. +: mic-bias-off ( -- ) true to mic-bias-off? ; +: mic-bias-on ( -- ) false to mic-bias-off? ; + +: input-test-settings ( -- ) + open-in 48kHz 16bit with-adc d# 73 input-gain +; +: output-test-settings ( -- ) + open-out 48kHz 16bit stereo +; +d# -9 constant case-test-volume +d# -23 constant fixture-test-volume +d# -33 constant loopback-test-volume +: configure-platform ( -- ) ; + \ LICENSE_BEGIN \ Copyright (c) 2009 Luke Gorrie luke@bup.co.nz \
Modified: dev/hdaudio/core.fth ============================================================================== --- dev/hdaudio/core.fth Mon Jun 20 19:13:54 2011 (r2297) +++ dev/hdaudio/core.fth Mon Jun 20 22:33:27 2011 (r2298) @@ -697,7 +697,6 @@ : mic+20db ( -- ) d# 20 to boost-db ; : mic+0db ( -- ) 0 to boost-db ;
-: set-record-gain ( dB -- ) ; \ with-adc step# input-gain ; : in-amp-caps ( -- u ) h# f000d cmd? ; : in-gain-steps ( -- n ) in-amp-caps 8 rshift h# 7f and 1+ ; : set-record-gain ( dB -- ) drop ( hardcoded for now ) with-adc h# 40 input-gain ;
Modified: dev/hdaudio/olpc-ports.fth ============================================================================== --- dev/hdaudio/olpc-ports.fth Mon Jun 20 19:13:54 2011 (r2297) +++ dev/hdaudio/olpc-ports.fth Mon Jun 20 22:33:27 2011 (r2298) @@ -18,6 +18,10 @@ speakers-on then ; +\ Connection #2 is for port e which is unused on OLPC +: select-dc-input ( -- ) + mux 3 set-connection dc-input enable-hp-input +; : select-internal-mic ( -- ) mux 1 set-connection internal-mic enable-hp-input ; @@ -26,8 +30,13 @@ ; \ Set this to use the internal mic even if an external mic is plugged in false value force-internal-mic? +false value mic-bias-off? : set-recording-port ( -- ) external-mic pin-sense? force-internal-mic? 0= and if +\ select-dc-input does not work for some reason I haven't yet discovered +\ When you try to do a loopback test through the dc input, the received +\ sample values are all 0 +\ mic-bias-off? if select-dc-input else select-external-mic then select-external-mic else select-internal-mic
Modified: dev/hdaudio/test.fth ============================================================================== --- dev/hdaudio/test.fth Mon Jun 20 19:13:54 2011 (r2297) +++ dev/hdaudio/test.fth Mon Jun 20 22:33:27 2011 (r2298) @@ -105,27 +105,14 @@ " 0 set-fg h# ffff set-bg single-drawing clear-drawing wave" evaluate key ascii d = if debug-me then ; -defer input-common-settings -defer output-common-settings -[ifdef] with-adc -\ XXX this is hd-audio specific. Factor it out -: (input-common-settings) ( -- ) - open-in 48kHz 16bit with-adc d# 73 input-gain -; -' (input-common-settings) to input-common-settings -: (output-common-settings) ( -- ) - open-out 48kHz 16bit stereo -; -' (output-common-settings) to output-common-settings -[then]
: test-with-case ( -- ) \ " setup-case" $call-analyzer \ xxx - this needs to use the internal speakers and mic even though the loopback cable is attached true to force-speakers? true to force-internal-mic? mic-bias-on - input-common-settings mono - output-common-settings d# -1 set-volume + input-test-settings mono + output-test-settings case-test-volume set-volume ." Testing internal speakers and microphone" cr " setup-case" test-common false to force-speakers? false to force-internal-mic? @@ -137,8 +124,8 @@ : test-with-fixture ( -- error? ) true to force-speakers? true to force-internal-mic? mic-bias-on - input-common-settings mono - output-common-settings d# -13 set-volume \ -23 prevents obvious visible clipping + input-test-settings mono + output-test-settings fixture-test-volume set-volume \ -23 prevents obvious visible clipping ." Testing internal speakers and microphone with fixture" cr " setup-fixture" test-common false to force-speakers? false to force-internal-mic? @@ -149,8 +136,8 @@ ; : test-with-loopback ( -- error? ) mic-bias-off - input-common-settings stereo - output-common-settings d# -22 set-volume + input-test-settings stereo + output-test-settings loopback-test-volume set-volume ." Testing headphone and microphone jacks with loopback cable" cr " setup-loopback" test-common plot? if @@ -196,9 +183,6 @@ instructions-done then ; -: configure-platform ( -- ) - board-revision h# 1a28 >= if " configure-xo1.75" $call-analyzer exit then -; \ Returns failure by throwing : automatic-test ( -- ) configure-platform