[alsa-devel] CM6206-LX usb sound card

Nikita Orlov nikitos1550 at yandex.ru
Fri Mar 4 18:09:30 CET 2016


Hello! 

First I sent these questions to alsa-user, but I think this mailing list is more proper place to ask such questions.

I have cheap chinese usb audio card, based on CM6206-LX chip from CMEDIA. CM6206-LX is similar to CM6206, but not 7.1 channels output, it is 5.1 channels.
I use ubuntu 15.* with kernel 4.2.0-30-generic. 

dmesg show me some warnings about sound card:

[31010.394487] usb 1-1: new full-speed USB device number 24 using xhci_hcd
[31010.523953] usb 1-1: New USB device found, idVendor=0d8c, idProduct=0102
[31010.523956] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[31010.523957] usb 1-1: Product: USB Sound Device        
[31010.526235] input: USB Sound Device         as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.3/0003:0D8C:0102.0010/input/input33
[31010.578876] hid-generic 0003:0D8C:0102.0010: input,hidraw0: USB HID v1.00 Device [USB Sound Device        ] on usb-0000:00:14.0-1/input3
[31010.643908] usb 1-1: current rate 30464 is different from the runtime rate 96000
[31010.646123] usb 1-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.
[31010.646126] usb 1-1: [9] FU [Mic Playback Volume] ch = 2, val = -6144/1921/1
[31010.646485] usb 1-1: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.
[31010.646486] usb 1-1: [11] FU [Line Playback Volume] ch = 2, val = -6144/1921/1
[31010.647884] usb 1-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[31010.647887] usb 1-1: [8] FU [Mic Capture Volume] ch = 2, val = -4096/2832/1
[31010.648291] usb 1-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[31010.648295] usb 1-1: [15] FU [Line Capture Volume] ch = 2, val = -4096/2832/1
[31010.648662] usb 1-1: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[31010.648664] usb 1-1: [2] FU [PCM Capture Volume] ch = 2, val = -4096/2832/1
[31010.648887] usbcore: registered new interface driver snd-usb-audio


There are two types of errors, first that current rate 30464 is different from the runtime rate 96000. Unfortunately I have no idea about this warning.

And warnings like Unlikely big volume range (=8065), cval->res is probably wrong.
As I understand it is because auto value range for some mixers are not proper detected.

I have test capturing with simple test app.
It seems only one avalible sample rate is 48000 Hz.

        printf("Sample rate = %d\n", SampleRate);
        snd_pcm_hw_params_set_rate_near(Handle, params,
                &SampleRate, &dir);
        printf("Sample rate = %d\n", SampleRate);

After calling these function SampleRate becomes 48000, even if before it was 44100.
Maybe it is related to first error in dmesg. Anybody knows?

But, according to

cat /proc/asound/card2/stream0
USB Sound Device at usb-0000:00:14.0-1, full speed : USB Audio

Playback:
  Status: Stop
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 8
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
  Interface 1
    Altset 2
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
  Interface 1
    Altset 3
    Format: S16_LE
    Channels: 4
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
  Interface 1
    Altset 4
    Format: S16_LE
    Channels: 6
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 44100, 48000
  Interface 1
    Altset 5
    Format: S16_LE
    Channels: 2
    Endpoint: 6 OUT (ADAPTIVE)
    Rates: 96000

Capture:
  Status: Stop
  Interface 2
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 5 IN (ASYNC)
    Rates: 44100, 48000

It is able to capture 44100.

I have tried to capture via arecord:
 arecord -D hw:2,0 -f cd -c 2 > ./test2.wav

and VLC said it is 44100, but I don`t have microphone at the moment to test is there proper sound recorded or not. I will try it later.

I have found that init of sound card is related to snd_usb_audio.ko module and learn a bit how it works.
There is a quirk that write internal registers. According to mailing list archives dated in 2009, values were found by usb traffic sniffing under Windows.
I have found CM6206 datasheet and check description of internal registers.
http://wenku.baidu.com/link?url=vkQLGhKUuvVmHC7vyobjKlF0yixpjn3ueAdD81OO6UlEiOGpJhFiVox57qriQrRtiShPSay3kWbySsnU13b13SKtmFKROV7RAoBaL2Wp3Ya
It is link to datasheet. Website is chinese, but datasheet itsel is in english. To see it after 3rd page click 下载文档到电脑,查找使用更方便.

But there are no interesting things about registers and mostly values that are exist in current snd_usb_audio must work ok.

Also in datasheet there some info about values of volume ranges that can be related to second dmesg warnings.
I have uploaded images of related info from datasheet here https://yadi.sk/d/1kdCFs7Gpv8L8

I have try with mixer.c in sound/usb/ dir of kernel tree (4.2.0) and tried to add experimental code in volume_control_quirks function.
But it seems function is not called for my device for some reason. It is more complicated that I think first.

So another question is how to make quirk for proper mixer values?

-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083


More information about the Alsa-devel mailing list