Discussion:
[Alsa-user] CM6206-LX usb sound card problem
Nikita Orlov
2016-03-04 07:21:09 UTC
Permalink
Hello!

I have cheap chinese usb audio card based on chip CM6206-LX

dmesg shows me following:

[ 3252.826326] usb 1-2: new full-speed USB device number 13 using xhci_hcd
[ 3252.956008] usb 1-2: New USB device found, idVendor=0d8c, idProduct=0102
[ 3252.956013] usb 1-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 3252.956015] usb 1-2: Product: USB Sound Device
[ 3252.958799] usb 1-2: current rate 30464 is different from the runtime rate 96000
[ 3252.959955] usb 1-2: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.
[ 3252.959957] usb 1-2: [9] FU [Mic Playback Volume] ch = 2, val = -6144/1921/1
[ 3252.960311] usb 1-2: Warning! Unlikely big volume range (=8065), cval->res is probably wrong.
[ 3252.960313] usb 1-2: [11] FU [Line Playback Volume] ch = 2, val = -6144/1921/1
[ 3252.961700] usb 1-2: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[ 3252.961702] usb 1-2: [8] FU [Mic Capture Volume] ch = 2, val = -4096/2832/1
[ 3252.962034] usb 1-2: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[ 3252.962036] usb 1-2: [15] FU [Line Capture Volume] ch = 2, val = -4096/2832/1
[ 3252.962441] usb 1-2: Warning! Unlikely big volume range (=6928), cval->res is probably wrong.
[ 3252.962443] usb 1-2: [2] FU [PCM Capture Volume] ch = 2, val = -4096/2832/1
[ 3252.963374] input: USB Sound Device as /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.3/0003:0D8C:0102.0007/input/input24
[ 3253.018580] hid-generic 0003:0D8C:0102.0007: input,hidraw0: USB HID v1.00 Device [USB Sound Device ] on usb-0000:00:14.0-2/input3

As I understand I have tow kind of errors.
First
[ 3252.958799] usb 1-2: current rate 30464 is different from the runtime rate 96000
I don`t know what is it.

Second error is not correct cval->res.
As I understand there can be some quirks added to correct support cval->res. Like for some Logitech web cameras.

Can anybody help me to fix these errors or at least show me point to start research about it.

P.S. Also I have CM108 audio card, that doesn`t show any errors. As both chips are from CMEDIA maybe there is a chance that info about implementation UAC in one chip, can be used for another.
-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
Clemens Ladisch
2016-03-04 07:37:47 UTC
Permalink
Post by Nikita Orlov
[ 3252.958799] usb 1-2: current rate 30464 is different from the runtime rate 96000
I don`t know what is it.
Does the device actually work? With different sample rates?
Post by Nikita Orlov
Second error is not correct cval->res.
Do the mixer controls actually work?


Regards,
Clemens
Nikita Orlov
2016-03-04 07:39:42 UTC
Permalink
Yes, device seems to be working, but I am worry that there can be different problems.
Will do detailed test a bit later.

Any way, I think it is a good idea try to fix these errors/warnings.
 [ 3252.958799] usb 1-2: current rate 30464 is different from the runtime rate 96000
 I don`t know what is it.
Does the device actually work? With different sample rates?
 Second error is not correct cval->res.
Do the mixer controls actually work?
Regards,
Clemens
-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
Nikita Orlov
2016-03-04 07:51:32 UTC
Permalink
By the way CM6206-LX if different to CM6206.
CM6206 has 7.1 channels output and CM6206-LX has 5.1 channels output.

Maybe these init:

/*
* C-Media CM6206 is based on CM106 with two additional
* registers that are not documented in the data sheet.
* Values here are chosen based on sniffing USB traffic
* under Windows.
*/
static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
{
int err = 0, reg;
int val[] = {0x2004, 0x3000, 0xf800, 0x143f, 0x0000, 0x3000};

for (reg = 0; reg < ARRAY_SIZE(val); reg++) {
err = snd_usb_cm106_write_int_reg(dev, reg, val[reg]);
if (err < 0)
return err;
}

return err;
}

is not sutible to -LX version, because it somehow try turn off channels that are not exist.
But maybe I am totally wrong.

P.S. Device ID is 0d8c:0102
Post by Nikita Orlov
Yes, device seems to be working, but I am worry that there can be different problems.
Will do detailed test a bit later.
Any way, I think it is a good idea try to fix these errors/warnings.
  [ 3252.958799] usb 1-2: current rate 30464 is different from the runtime rate 96000
  I don`t know what is it.
 Does the device actually work? With different sample rates?
  Second error is not correct cval->res.
 Do the mixer controls actually work?
 Regards,
 Clemens
--
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
Clemens Ladisch
2016-03-04 08:00:26 UTC
Permalink
Post by Nikita Orlov
By the way CM6206-LX if different to CM6206.
CM6206 has 7.1 channels output and CM6206-LX has 5.1 channels output.
static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
...
is not sutible to -LX version, because it somehow try turn off channels that are not exist.
Well, how would it possible for the driver to differentiate the CM6206
and the CM6206-LX?


Regards,
Clemens
Nikita Orlov
2016-03-04 08:03:40 UTC
Permalink
I don`t know much about it. But I can think following way as both C6206 and CM6206LX have same ID, original Windows driver can read some internal register and get such info.
I will try to find datasheets for both chips and see it.
As I know from mailing list archives reg init in quirk was done by sniffing usb traffic under windows.
But it was in 2009 year...
Post by Clemens Ladisch
 By the way CM6206-LX if different to CM6206.
 CM6206 has 7.1 channels output and CM6206-LX has 5.1 channels output.
   static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
   ...
 is not sutible to -LX version, because it somehow try turn off channels
 that are not exist.
Well, how would it possible for the driver to differentiate the CM6206
and the CM6206-LX?
Regards,
Clemens
-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
Nikita Orlov
2016-03-04 16:47:52 UTC
Permalink
So, I have found CM6206 datasheet via baidu.cn. I think most things must be similar to mine CM6206-LX chip.
It is unclear how to download pdf file, I am not very familiar with china language.
There is description of internal registers. There is no much interesting settings, already existed initial values in snd_usb_audio module must be ok.
If somebody needs reg info feel free to contact me.

Next there is some information about volume control. I think it can be used for quirks that can fix following errors:
[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

I have uploaded images of related info from datasheet here https://yadi.sk/d/1kdCFs7Gpv8L8

I have tested arecord with mic and line in via 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 or 96000.
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.
Maybe it is related to following warning:
[31010.643908] usb 1-1: current rate 30464 is different from the runtime rate 96000

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.

So, my questions:

1) How to make quirks for volume?
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.
Maybe this mailing list is not proper place to ask it, than what is proper place to ask?

2) What reason can be, that I can`t record at 44,1kHz sample rate?
Post by Nikita Orlov
I don`t know much about it. But I can think following way as both C6206 and CM6206LX have same ID, original Windows driver can read some internal register and get such info.
I will try to find datasheets for both chips and see it.
As I know from mailing list archives reg init in quirk was done by sniffing usb traffic under windows.
But it was in 2009 year...
  By the way CM6206-LX if different to CM6206.
  CM6206 has 7.1 channels output and CM6206-LX has 5.1 channels output.
    static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
    ...
  is not sutible to -LX version, because it somehow try turn off channels
  that are not exist.
 Well, how would it possible for the driver to differentiate the CM6206
 and the CM6206-LX?
 Regards,
 Clemens
--
Nikita Orlov
Skype: nik_stet
QQ: 2717846083
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
-- 
Nikita Orlov
Skype: nik_stet
QQ: 2717846083

Loading...