[patch] SPDIF output preliminary support for (YAMAHA) AC97 codecs

WATANABE Kazuhiro CQG00620 at nifty.ne.jp
Wed Mar 18 08:59:22 PDT 2009


Hi, all.

I've created a patch that enables SPDIF output for (YAMAHA) AC97
codecs:

 http://homepage2.nifty.com/dumb_show/unix/work/ac97_spdif_20090210.diff

To create this patch, I referred the following article:

 [PATCH]: ICH5 [ac97 rev2.3] spdif support
 http://lists.freebsd.org/pipermail/freebsd-hackers/2004-September/008196.html


This patch will create a "dev.pcm.X.spdif" sysctl(8) variable for AC97
codecs that has a SPDIF interface.  If you set the variable to "1", it
enables the SPDIF output interface.

I think a number of AC97 codecs will be able to use their SPDIF output
interface with this setting.  But some codecs will need more hacks
(ex. slot mapping).


For YAMAHA YMF753 and YMF743, "dev.pcm.X.spdif_out" and
"dev.pcm.X.spdif_src" variables will also be created.
These selects a SPDIF output pin and output source.

spdif_out	SPDIF output pin
------------------------------------------------------------------
0		none
1		pin 43
2		pin 47 (By default it's used by the EAPD function)
4		pin 48 (The AC97 spec. standard) (YMF753 only)
------------------------------------------------------------------

spdif_src	SPDIF output source
-----------------------------------
0		AC-Link
1		A/D Converter
-----------------------------------

I've only tested the patch on 7.1-RELEASE and 8-current with the
following hardware:

 * NEC PC-VC3004D (SiS 7012 (snd_ich) + YAMAHA YMF753)

pcm0: <SiS 7012> port 0x1400-0x14ff,0x1080-0x10ff irq 18 at device 2.7 on pci0
pcm0: Reserved 0x100 bytes for rid 0x10 type 4 at 0x1400
pcm0: Reserved 0x80 bytes for rid 0x14 type 4 at 0x1080
pcm0: [MPSAFE]
pcm0: [ITHREAD]
pcm0: <Yamaha YMF753 AC97 Codec (id = 0x594d4803)>
pcm0: Codec features tone, 18 bit DAC, 5 bit master volume, Yamaha Ymersion
pcm0: Primary codec extended features SPDIF, AMAP, reserved 4
pcm0: ac97 codec dac ready count: 0
pcm0: Mixer "vol":
pcm0: Mixer "bass":
pcm0: Mixer "treble":
pcm0: Mixer "pcm":
pcm0: Mixer "speaker":
pcm0: Mixer "line":
pcm0: Mixer "mic":
pcm0: Mixer "cd":
pcm0: Mixer "rec":
pcm0: Mixer "igain":
pcm0: Mixer "line1":
pcm0: Mixer "phin":
pcm0: Mixer "phout":
pcm0: Mixer "video":
pcm0: clone manager: deadline=750ms flags=0x8000001e
pcm0: sndbuf_setmap 10f0000, 4000; 0xd44e7000 -> 10f0000
pcm0: sndbuf_setmap 10f8000, 4000; 0xd44eb000 -> 10f8000
pcm0: measured ac97 link rate at 48010 Hz, will use 48000 Hz

It has an optical SPDIF output, and works well with the following
setting:

dev.pcm.0.spdif=1
dev.pcm.0.spdif_out=4
---
WATANABE Kazuhiro (CQG00620 at nifty.ne.jp)


More information about the freebsd-multimedia mailing list