Bug 12456 - Implement audio crossover
: Implement audio crossover
Status: CLOSED FIXED
Product: SB Radio
Classification: Unclassified
Component: Audio
: Include FW version in comment
: PC Windows XP
: P1 normal (vote)
: CAT
Assigned To: Richard Titmuss
:
Depends on: 12272
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-18 16:29 UTC by Chris Owens
Modified: 2009-10-06 09:22 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments
DAC page 1 write gets borked by the headphone detect transaction (144.18 KB, image/jpeg)
2009-07-08 20:05 UTC, Caleb Crome
Details
amixer sset "Audio Effects Filter N0 Coefficient" 4660,22136 (138.07 KB, image/jpeg)
2009-07-08 20:21 UTC, Caleb Crome
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Owens 2009-06-18 16:29:57 UTC
for CAT testing
Comment 1 Caleb Crome 2009-06-18 17:28:35 UTC
Sending to richard to implement the stub routine.
Comment 2 Richard Titmuss 2009-06-23 05:53:59 UTC
Stub implemented in: https://svn.slimdevices.com/repos/player/squeezeos/7.4/trunk/squeezeos_dsp

See the README for instructions on developing/testing on the desktop.

Also in fab4 branch r6120 the dsp plugin is built for the baby firmware, and just disabled in /etc/asound.conf. The demo plugin mutes the right channel, and is useful for testing the channel swap.
Comment 3 Caleb Crome 2009-06-28 11:17:07 UTC
Richard, I created a .c file that contains some filter coefficients, in https://svn.slimdevices.com/repos/player/trunk/hardware/babyboom/dsp/aic3104_aic_settings.c.

I don't know how to integrate these settings into the DSP driver.

For now, we should mix to mono in software, and use these aic3104_aic_settings.c to do the crossover in the DAC.  

Will you either integrate the above file into the aic driver, or point me in the right direction.

Thanks
  -Caleb
Comment 4 Caleb Crome 2009-06-28 17:32:52 UTC
Richard, in https://svn.slimdevices.com/repos/player/squeezeos/7.4/trunk/squeezeos_dsp, where is the most significant bit in the 32-bit word?

For starters, I'll use the omx library, which needs to process in 16-bits.  

-Caleb
Comment 5 Richard Titmuss 2009-06-30 02:41:43 UTC
I'm about to check in a patch that exposes the audio effect registers to userspace. amixer is silly, and i can't work out how to enter -ive numbers, so you'll have to but the MSB-LSB values in.

This should be the same as your C code, but the right channel is all screwed up (and my right ear now too!):

amixer sset "Audio Effects Filter N0 Coefficient" 516,40475
amixer sset "Audio Effects Filter N1 Coefficient" 516,25061
amixer sset "Audio Effects Filter N2 Coefficient" 65020,25061
amixer sset "Audio Effects Filter N3 Coefficient" 32767,32767
amixer sset "Audio Effects Filter N4 Coefficient" 0,0
amixer sset "Audio Effects Filter N5 Coefficient" 0,0

amixer set "Audio Effects Filter D1 Coefficient" 24546,24546
amixer set "Audio Effects Filter D2 Coefficient" 47149,47149
amixer set "Audio Effects Filter D4 Coefficient" 0,0
amixer set "Audio Effects Filter D5 Coefficient" 0,0

amixer sset "Audio Codec Digital Filter Control" 10

BTW you can see (a cache) of the register settings in: cat /sys/devices/platform/baby-aic3104.0/aic3104-codec/codec_reg
Comment 6 Caleb Crome 2009-07-08 20:05:34 UTC
Created attachment 5434 [details]
DAC page 1 write gets borked by the headphone detect transaction
Comment 7 Caleb Crome 2009-07-08 20:19:09 UTC
The DAC write gets borked by the headphone detect transaction.

The command I executed was: 
# amixer sset "Audio Effects Filter N0 Coefficient" 516,40475

(which is 0x204,0x9E1B), which should go into registers 1/1, 1/2, 1/1B, 1/1C

xaction 529 changes to Page 1.

530 & 531 write registers 1/1 and 1/2 with 0x02 and 0x04.  That's right.

Then 532 changes back to page 0, 533 & 534 check headphone status.
Then 535 writes E3 into 1B.  That's not right.  It should be 9E.

Then 536 gets around to changing back to page 1.
Then 537 writes 6B into 1C, but it should really be writing 1B, not 6B.  

Then 538 *rewrites* register 1/1, 539 rewrites 1/2, and so on.  

There is some seriously wacky business going on.

Back to you Richard for some analysis.
Comment 8 Caleb Crome 2009-07-08 20:21:15 UTC
Created attachment 5435 [details]
amixer sset "Audio Effects Filter N0 Coefficient" 4660,22136

amixer sset "Audio Effects Filter N0 Coefficient" 4660,22136
causes this transaction.  Again hp detect borks the transaction, but it was none too correct even without the hp detect.
Comment 9 Caleb Crome 2009-07-09 09:33:07 UTC
Checked in revision 6232.  The file aic3104_aic_settings.sh contains the shell commands to start the crossover.

To make things easy, here's the result:

amixer sset "Audio Codec Digital Filter Control" 0
amixer sset "Audio Effects Filter N0 Coefficient" 22555,65072 # 581b,fe30
amixer sset "Audio Effects Filter N1 Coefficient" 42981,65072 # a7e5,fe30
amixer sset "Audio Effects Filter N2 Coefficient" 22555,65072 # 581b,fe30
amixer sset "Audio Effects Filter N3 Coefficient" 32767,32767 # 7fff,7fff
amixer sset "Audio Effects Filter N4 Coefficient" 0,0 # 0000,0000
amixer sset "Audio Effects Filter N5 Coefficient" 0,0 # 0000,0000
amixer sset "Audio Effects Filter D1 Coefficient" 24546,24546 # 5fe2,5fe2
amixer sset "Audio Effects Filter D2 Coefficient" 47149,47149 # b82d,b82d
amixer sset "Audio Effects Filter D4 Coefficient" 0,0 # 0000,0000
amixer sset "Audio Effects Filter D5 Coefficient" 0,0 # 0000,0000
amixer sset "Audio Codec Digital Filter Control" 10

-Caleb
Comment 10 Wadzinski Tom 2009-07-09 15:33:42 UTC
Commented out version committed - r6484

Notes for richard:
log with extra debug lines as each command is called.
 
Jan  1 00:00:26 udhcpc[936]: Sending select for 192.168.1.155...
Jan  1 00:00:26 udhcpc[936]: Lease of 192.168.1.155 obtained, lease time 268435455
Jan  1 00:00:26 root: udhcpc_action eth0 bound ip=192.168.1.155
Jan  1 00:00:27 squeezeplay: INFO   squeezeplay.applets - AppletManager.lua:304 Registering: SqueezeboxBaby
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:146 here
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:149 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 0: 00000001
Jan  1 00:00:28 kernel: AIC3104 WRITE 1: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 2: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 27: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 28: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:151 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 3: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 4: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 29: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 0: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 0: 00000001
Jan  1 00:00:28 kernel: AIC3104 WRITE 30: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:153 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 5: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 6: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 31: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 32: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:155 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 7: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 8: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 33: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 34: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:157 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 7: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 8: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 33: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 34: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:159 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 7: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 8: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 33: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 34: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:161 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 7: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 8: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 33: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 34: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:163 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 9: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 10: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 35: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 36: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:165 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 11: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 12: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 37: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 38: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:167 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:169 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:171 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:173 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:175 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:177 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:179 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 13: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 14: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 39: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 40: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:181 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 15: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 16: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 41: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 42: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:183 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 17: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 18: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 43: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 44: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:185 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 19: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 20: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 45: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 46: 00000000
Jan  1 00:00:28 squeezeplay: WARN   applet.SqueezeboxBaby - SqueezeboxBabyApplet.lua:191 here
Jan  1 00:00:28 kernel: AIC3104 WRITE 0: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 12: 0000000a
Jan  1 00:00:28 squeezeplay: INFO   squeezeplay.applets - AppletManager.lua:694 store settings: SqueezeboxBaby
Jan  1 00:00:28 squeezeplay: INFO   squeezeplay.applets - AppletManager.lua:304 Registering: Playback
Jan  1 00:00:28 kernel: AIC3104 WRITE 43: 00000080
Jan  1 00:00:28 kernel: AIC3104 WRITE 44: 00000080
Jan  1 00:00:28 kernel: ###### sound/soc/codecs/tlv320aic3104.c:1137 aic3104_dapm_event
Jan  1 00:00:28 kernel: AIC3104 WRITE 8: 000000c0
Jan  1 00:00:28 kernel: AIC3104 WRITE 9: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 7: 0000008a
Jan  1 00:00:28 kernel: AIC3104 WRITE 2: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 3: 00000012
Jan  1 00:00:28 kernel: AIC3104 WRITE 11: 00000001
Jan  1 00:00:28 kernel: AIC3104 WRITE 4: 0000003c
Jan  1 00:00:28 kernel: AIC3104 WRITE 5: 00000008
Jan  1 00:00:28 kernel: AIC3104 WRITE 6: 00000040
Jan  1 00:00:28 kernel: AIC3104 WRITE 9: 00000020
Jan  1 00:00:28 kernel: ###### sound/soc/codecs/tlv320aic3104.c:1137 aic3104_dapm_event
Jan  1 00:00:28 kernel: AIC3104 WRITE 37: 00000040
Jan  1 00:00:28 kernel: AIC3104 WRITE 37: 000000c0
Jan  1 00:00:28 kernel: AIC3104 WRITE 72: 00000005
Jan  1 00:00:28 kernel: AIC3104 WRITE 93: 00000009
Jan  1 00:00:28 kernel: AIC3104 WRITE 58: 00000005
Jan  1 00:00:28 kernel: AIC3104 WRITE 86: 00000009
Jan  1 00:00:28 kernel: speaker on
Jan  1 00:00:28 kernel: ###### sound/soc/codecs/tlv320aic3104.c:1137 aic3104_dapm_event
Jan  1 00:00:28 kernel: AIC3104 WRITE 3: 00000092
Jan  1 00:00:28 kernel: AIC3104 WRITE 43: 00000000
Jan  1 00:00:28 kernel: AIC3104 WRITE 44: 00000000
Comment 11 Richard Titmuss 2009-07-10 04:05:02 UTC
The kernel changes need to write the registers correctly is done in r6491. I am not 100% sure the registers are getting set correctly, always. This needs further testing.

Tom can you look at the application code, just uncommenting does not seem to work, but writing the registers from the command line does. You may need to get Caleb to help out too.
Comment 12 Wadzinski Tom 2009-07-10 06:36:21 UTC
Checked in working xover code in r6493. I'm using the amixer commands directly rather than the setMixer API. I'm working to find out why I can't use the API directly.
Comment 13 Wadzinski Tom 2009-07-10 11:07:53 UTC
same alsa calls, but now with bsp API used in r6504
Comment 14 Caleb Crome 2009-07-16 14:09:16 UTC
Had to take out of dac because of tweeter hot problem.
Comment 15 Wadzinski Tom 2009-07-16 14:43:14 UTC
reassigning to Caleb, or should it be Richard...
Comment 16 Caleb Crome 2009-07-20 14:41:23 UTC
No.
Comment 17 Caleb Crome 2009-07-20 14:56:46 UTC
Moving to CAT/CXR. 

Maybe will have something by end of day today.
Comment 18 Caleb Crome 2009-07-21 23:02:05 UTC
I've installed the beginnings of the audio crossover, but it doesn't compile because the alsa plugin is being compiled with -mthumb, and the instruction I need isn't in the thumb instruciton set.

Richard, can you fix the build so the plugin is compiled without thumb?
Comment 19 Richard Titmuss 2009-07-27 01:09:40 UTC
Reset priority before triage.
Comment 20 Richard Titmuss 2009-07-30 03:42:11 UTC
The DSP is not implemented. One problem remains that the crossover is turned off late when booting with the headphones inserted.
Comment 21 SVN Bot 2009-08-12 03:12:35 UTC
 == Auto-comment from SVN commit #7025 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7025 ==

Bug #12456
Delay main process until the alsa backend has completed it's initialization.
Comment 22 SVN Bot 2009-08-12 03:34:59 UTC
 == Auto-comment from SVN commit #7026 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7026 ==

Bug #12456
Fix typo.
Comment 23 SVN Bot 2009-08-12 04:05:07 UTC
 == Auto-comment from SVN commit #7027 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7027 ==

Bug #12456
Don't open the audio device in PlaybackMeta, this will be done in the platform specific files.
Comment 24 SVN Bot 2009-08-12 04:05:59 UTC
 == Auto-comment from SVN commit #7028 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7028 ==

Bug #12456
Open the audio device in the platform specific file for baby, this allows the audio endpoint and crossover to be configured correctly while booting.
Comment 25 SVN Bot 2009-08-12 04:20:18 UTC
 == Auto-comment from SVN commit #7029 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7029 ==

Bug #12456
Fix desktop, fab and jive after r7027-7028.
Comment 26 SVN Bot 2009-08-12 04:47:38 UTC
 == Auto-comment from SVN commit #7030 to the jive repo by richard ==
 == https://svn.slimdevices.com/jive?view=revision&revision=7030 ==

Bug #12456
Minor fixes for baby and jive.
Comment 27 James Richardson 2009-10-06 09:22:32 UTC
This bug has been fixed in the latest release of MySqueezebox.com (formally
known as SqueezeNetwork)!

If you are still experiencing this problem, feel free to reopen the bug with
your new comments and we'll have another look.