Add AACI audio playback support to the ARM Versatile/PB platform
PATCH 1/1 Add AACI audio playback support to the ARM Versatile/PB platform
The PL041 driver provides an interface to an ACLink bus. The LM4549 driver emulates a DAC connected on the ACLink bus. Only audio playback is implemented.
Versatile/PB test build:
linux-2.6.38.5
buildroot-2010.11
alsa-lib-1.0.22
alsa-utils-1.0.22
mpg123-0.66
Qemu host: Ubuntu 10.04 in Vmware/OS X
Playback tested successfully with aplay and mpg123.
--- Makefile.target | 1 + hw/aclink.c | 121 +++++++++++++++ hw/aclink.h | 63 ++++++++ hw/lm4549.c | 368 +++++++++++++++++++++++++++++++++++++++++++++ hw/pl041.c | 436 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/pl041.h | 126 ++++++++++++++++ hw/pl041.hx | 62 ++++++++ hw/versatilepb.c | 6 + 8 files changed, 1183 insertions(+), 0 deletions(-) create mode 100644 hw/aclink.c create mode 100644 hw/aclink.h create mode 100644 hw/lm4549.c create mode 100644 hw/pl041.c create mode 100644 hw/pl041.h create mode 100644 hw/pl041.hx
Makefile.target +1 -0
@@ -354,6 +354,7 @@ obj-arm-y += syborg_virtio.o obj-arm-y += vexpress.o obj-arm-y += strongarm.o obj-arm-y += collie.o +obj-arm-y += pl041.o aclink.o lm4549.o obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
hw/aclink.c new file +121 -0
121 lines not on this page · raw message
hw/aclink.h new file +63 -0
63 lines not on this page · raw message
hw/lm4549.c new file +368 -0
368 lines not on this page · raw message
hw/pl041.c new file +436 -0
436 lines not on this page · raw message
hw/pl041.h new file +126 -0
126 lines not on this page · raw message
hw/pl041.hx new file +62 -0
62 lines not on this page · raw message
hw/versatilepb.c +6 -0
@@ -17,6 +17,7 @@#include "usb-ohci.h" #include "boards.h" #include "blockdev.h" +#include "aclink.h" /* Primary interrupt controller. */
@@ -258,6 +259,11 @@ static void versatile_init(ram_addr_t ram_size,/* Add PL031 Real Time Clock. */ sysbus_create_simple ("pl031" ,0x101e8000 , pic[10 ]); +/* Add PL041 AACI Interface and connect the LM4549 codec */ + dev =sysbus_create_varargs ("pl041" ,0x10004000 , sic[24 ]); +ACLinkBus * bus = (ACLinkBus *)qdev_get_child_bus (dev,"aclink" ); +aclink_create_device (bus,"lm4549" ); +/* Memory map for Versatile/PB: */ /* 0x10000000 System registers. */ /* 0x10001000 PCI controller config registers. */
--
1.7.0.4
Quoted 11 lines · Mathieu Sonet
The PL041 driver provides an interface to an ACLink bus. The LM4549 driver emulates a DAC connected on the ACLink bus. Only audio playback is implemented.
Versatile/PB test build:
linux-2.6.38.5
buildroot-2010.11
alsa-lib-1.0.22
alsa-utils-1.0.22
mpg123-0.66
Quoted 5 lines
Qemu host: Ubuntu 10.04 in Vmware/OS X
Playback tested successfully with aplay and mpg123.
Signed-off-by Mathieu Sonet <[email protected]>
Looks fine to me.
Signature · 1 line
mailto:[email protected]
Quoted 3 lines
The PL041 driver provides an interface to an ACLink bus. The LM4549 driver emulates a DAC connected on the ACLink bus. Only audio playback is implemented.
Shouldn't this be shared with the other AC97 devices?
Paul
Quoted 7 lines · Paul Brook
Quoted 3 lines
The PL041 driver provides an interface to an ACLink bus. The LM4549 driver emulates a DAC connected on the ACLink bus. Only audio playback is implemented.
Shouldn't this be shared with the other AC97 devices?
Paul
I organized the code in 3 different drivers (PL041 <=> ACLink <=> LM4549) to decorrelate the codec interface from its implementation. This could allow the use of alternative AC97 models with the same PL041 implementation.
On the other hand the current ac97.c implementation is a closely coupled combination of a PCI/ACLink bridge (Intel 82801AA) with a generic AC97 codec. This has prevent me to easily reuse this code.
The milkymist-ac97 implementation is another case. It looks like a basic implementation with the AC97 registers directly mapped on the system bus.
Using the ACLink bus I defined, it could be interesting to implement separately the PCI/ACLink bridge from ac97.c.
Is it what you mean by saying this should be shared with the other AC97 devices ?
Mathieu
Quoted 4 lines
On the other hand the current
ac97.cimplementation is a closely coupled combination of a PCI/ACLink bridge (Intel 82801AA) with a generic AC97 codec. This has prevent me to easily reuse this code.
Quoted 8 lines
The milkymist-ac97 implementation is another case. It looks like a basic implementation with the AC97 registers directly mapped on the system bus.
Using the ACLink bus I defined, it could be interesting to implement separately the PCI/ACLink bridge from
ac97.c.Is it what you mean by saying this should be shared with the other AC97 devices ?
Yes. The whole point of AClink is that it separates the host bridge from the codec. We now have at least three devices implementing this. Your aclink implementation is only used by one of these, which gives me little confidence it actually does what it claims.
Paul
Quoted 10 lines · Paul Brook
Quoted 10 lines
On the other hand the current
ac97.cimplementation is a closely coupled combination of a PCI/ACLink bridge (Intel 82801AA) with a generic AC97 codec. This has prevent me to easily reuse this code.The milkymist-ac97 implementation is another case. It looks like a basic implementation with the AC97 registers directly mapped on the system bus.
Using the ACLink bus I defined, it could be interesting to implement separately the PCI/ACLink bridge from
ac97.c.
Quoted 6 lines
Quoted 2 lines
Is it what you mean by saying this should be shared with the other AC97 devices ?
Yes. The whole point of AClink is that it separates the host bridge from the codec. We now have at least three devices implementing this. Your aclink implementation is only used by one of these, which gives me little confidence it actually does what it claims.
Paul
I understand your concern.
In fact after digging the Intel PCI bridge documentation, I see that it
offers a mapping of the AC97 registers in the PCI I/O space.
Reusing my current ACLink bus with this bridge would mean to encode register accesses into ACLink frames and then to decode them again on the codec side. Not very simple just for the sake of device models correctness and no added value.
Also QEMU may not need N different re-implemention of an AC97 codec.
So I will ditch ACLink/LM4549 and will instead interface the PL041 driver with the codec defined in ac97.c.
PCI---AC97
PL041--/
Thanks for your input
Mathieu