From owner-freebsd-current@FreeBSD.ORG Tue Apr 21 19:30:22 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32C8DC3A for ; Tue, 21 Apr 2015 19:30:22 +0000 (UTC) Received: from mail-ig0-x22f.google.com (mail-ig0-x22f.google.com [IPv6:2607:f8b0:4001:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F215811C0 for ; Tue, 21 Apr 2015 19:30:21 +0000 (UTC) Received: by igbhj9 with SMTP id hj9so24378507igb.1 for ; Tue, 21 Apr 2015 12:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=mgMxbg1haq7tD7mupcB3+ENjYpuMliYrvcC4NAxjdGo=; b=wFSZ0QLjtpuALJOC7KT97F820qkRnLQs4IbL9v+vAMu7pRKWMIv2C/6nDC3GC/LdWa LtSOn3BZ/fCpp4np6BvsUmIpIbCGfVPUbnXlXxyS0MZjdn+JumCszDoxk46txHk4FRiC PsE9TuRAFDcUXRYqKUBSGjbefBlUqJyTO58MDkTIEcdLmEPsD0RYijcSV+oOt6sjNa+K wqmV2/Mm6xxV14Y4M2RGJMNc8ySKnShycZGIkKHDqkj3/EKSm8z/Xs+bQdwhudtXgMT8 9661I+nfUOkLT/3B19FEEo6mouaDqa4WRDOxjlwmknDZHF1OUAuqyGPlGOcaZBF/Gn7O iklQ== MIME-Version: 1.0 X-Received: by 10.107.129.229 with SMTP id l98mr30297406ioi.32.1429644621413; Tue, 21 Apr 2015 12:30:21 -0700 (PDT) Received: by 10.36.51.129 with HTTP; Tue, 21 Apr 2015 12:30:21 -0700 (PDT) Date: Tue, 21 Apr 2015 21:30:21 +0200 Message-ID: Subject: CM6206 USB Audio is mute. From: "Ranjan1018 ." <214748mv@gmail.com> To: FreeBSD CURRENT Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2015 19:30:22 -0000 Connecting the USB cable the item is recognized: ugen0.5: at usbus0 uaudio0: 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: 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: on hdaa0 (1p:1v/0r:0v) snddev flags=0x2e7 [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 {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 {userland} -> feeder_root(0x00000000) -> {hardware} pcm1: at ? kld snd_uaudio (1p:1v/1r:1v) default snddev flags=0x2e6 [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 {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 {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 {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 {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