CM6206 USB Audio is mute.

From: Ranjan1018 . <214748mv_at_gmail.com>
Date: Tue, 21 Apr 2015 21:30:21 +0200
Connecting the USB cable the item is recognized:
ugen0.5: <vendor 0x0d8c> at usbus0
uaudio0: <vendor 0x0d8c USB Sound Device, class 0/0, rev 1.10/0.10, addr 5>
on usbus0
uaudio0: Play: 48000 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 4 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
pcm1: <USB audio> on uaudio0
uaudio0: HID volume keys found.

Setting it as default unit
# sysctl  hw.snd.default_unit=1
and playing a song the interrupts count increase:
# sysctl hw.snd.verbose=2
# cat /dev/sndstat
FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <ATI R6xx (HDMI)> on hdaa0  (1p:1v/0r:0v)
    snddev
flags=0x2e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
    [pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00006100,
0x00000004
    interrupts 0, underruns 0, feed 0, ready 0
[b:4096/2048/2|bs:4096/2048/2]
    channel flags=0x6100<BUSY,HAS_VCHAN,VCHAN_PASSTHROUGH>
    {userland} -> feeder_mixer(0x00200010) -> {hardware}
    pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 8000, fmt 0x00100008,
flags 0x10000000, 0x00000000
    interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:0/0/0]
    channel flags=0x10000000<VIRTUAL>
    {userland} -> feeder_root(0x00000000) -> {hardware}
pcm1: <USB audio> at ? kld snd_uaudio (1p:1v/1r:1v) default
    snddev flags=0x2e6<AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
    [pcm1:play:dsp1.p0]: spd 48000, fmt 0x00200010/0x00400010, flags
0x00002108, 0x00000044
    interrupts 4926, underruns 0, feed 9850, ready 0
[b:6144/3072/2|bs:4096/2048/2]
    channel flags=0x2108<TRIGGERED,BUSY,HAS_VCHAN>
    {userland} -> feeder_mixer(0x00200010) -> feeder_matrix(2.0 -> 4.0) ->
{hardware}
    pcm1:play:dsp1.p0[pcm1:virtual:dsp1.vp0]: spd 44100/48000, fmt
0x00200010, flags 0x1000010c, 0x00000029, pid 1769 (mplayer)
    interrupts 0, underruns 0, feed 9287, ready 62192
[b:0/0/0|bs:65536/2048/32]
    channel flags=0x1000010c<RUNNING,TRIGGERED,BUSY,VIRTUAL>
    {userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) ->
feeder_rate(0x00200010 q:1 44100 -> 48000) -> {hardware}
    [pcm1:record:dsp1.r0]: spd 48000, fmt 0x00200010, flags 0x00002100,
0x00000005
    interrupts 0, overruns 0, feed 0, hfree 3072, sfree 4096
[b:3072/1536/2|bs:4096/2048/2]
    channel flags=0x2100<BUSY,HAS_VCHAN>
    {hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) ->
{userland}
    pcm1:record:dsp1.r0[pcm1:virtual:dsp1.vr0]: spd 8000, fmt 0x00100008,
flags 0x10000000, 0x00000000
    interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0]
    channel flags=0x10000000<VIRTUAL>
    {hardware} -> feeder_root(0x00000000) -> {userland}

But the output is mute.

In Debian Linux it works:
# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 014: ID 0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound
Device
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Device [USB Sound Device], device 0: USB Audio [USB Audio]
 Subdevices: 0/1
 Subdevice #0: subdevice #0

Looking at http://lxr.free-electrons.com/source/sound/usb/quirks.c I have
found this code:
/*
632 * C-Media CM106/CM106+ have four 16-bit internal registers that are
nicely
633 * documented in the device's data sheet.
634 */
635 static int snd_usb_cm106_write_int_reg(struct usb_device *dev, int reg,
u16 value)
636 {
637         u8 buf[4];
638         buf[0] = 0x20;
639         buf[1] = value & 0xff;
640         buf[2] = (value >> 8) & 0xff;
641         buf[3] = reg;
642         return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
USB_REQ_SET_CONFIGURATION,
643                                USB_DIR_OUT | USB_TYPE_CLASS |
USB_RECIP_ENDPOINT,
644                                0, 0, &buf, 4);
645 }
646
 647 static int snd_usb_cm106_boot_quirk(struct usb_device *dev)
648 {
649         /*
650         * Enable line-out driver mode, set headphone source to front
651         * channels, enable stereo mic.
652         */
653         return snd_usb_cm106_write_int_reg(dev, 2, 0x8004);
654 }
655
 656 /*
657 * C-Media CM6206 is based on CM106 with two additional
658 * registers that are not documented in the data sheet.
659 * Values here are chosen based on sniffing USB traffic
660 * under Windows.
661 */
662 static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
663 {
664         int err  = 0, reg;
665         int val[] = {0x2004, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000};
666
 667         for (reg = 0; reg < ARRAY_SIZE(val); reg++) {
668                 err = snd_usb_cm106_write_int_reg(dev, reg, val[reg]);
669                 if (err < 0)
670                         return err;
671         }
672
 673         return err;
674 }
675

How can I test this code in FreeBSD ?

Thanks,
Maurizio
Received on Tue Apr 21 2015 - 17:30:22 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:57 UTC