Bug 118161 - Regression: No right channel sound on Creative Xtreme Audio (CA0106)
Summary: Regression: No right channel sound on Creative Xtreme Audio (CA0106)
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-13 02:21 UTC by luke
Modified: 2016-09-24 19:19 UTC (History)
2 users (show)

See Also:
Kernel Version: 4.4.0-22-generic
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Mixer Setup (43.61 KB, image/png)
2016-05-18 16:43 UTC, luke
Details

Description luke 2016-05-13 02:21:30 UTC
Created attachment 119222 [details]
PulseAudio verbose log

After a fresh install of Ubuntu 14.04, 15.04, 15.10 and on the liveCD, There is no sound on right channel. But it works perfectly in Win 7/10. It also worked perfectly on Ubuntu 12.04 My sound card is Creative Xtreme Audio (PCI CA0106).

In the forum, many users also have experienced this bug with the incorrect default alsamixer settings.

http://ubuntuforums.org/showthread.php?t=2217724
http://askubuntu.com/questions/496607/no-sound-from-right-speakers#

Here are my alsa-info.sh results.

http://www.alsa-project.org/db/?f=e3ae99437c3d283b35cac7c33ace996bedf43a16

Also attached the result of:
# echo autospawn = no >> ~/.config/pulse/client.conf
# sudo killall pulseaudio
# LANG=C pulseaudio -vvvv --log-time=1 > ~/pulseverbose.log 2>&1

Raymond has some analysis here:
https://bugs.freedesktop.org/show_bug.cgi?id=92690
and here:
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1497666
Comment 1 Takashi Iwai 2016-05-13 07:17:43 UTC
It can't be a regression since there are no relevant changes in ca0106 driver over 6 years.  If it worked, it's very likely a regression in PulseAudio side.

Try to go to runlevel 3, kill PA, unload snd-ca0106 module, and remove /var/lib/alsa/asound.state (or whatever alsactl stores).  Then reload snd-ca0106 module again.

At this state, how does the mixer setup look?  If the mixers are unbalanced (no matter whether volume zero or full), we need to fix.  If the mixer values are balanced, it's no driver bug, but it's PA who tries to set the unbalanced values.
Comment 2 Raymond 2016-05-14 01:57:49 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/pci/ca0106

only few change if it work on ubuntu 12.04


do the virtual master alway expect max dB is 0 dB ?



	control.5 {
		iface MIXER
		name 'Analog Front Playback Volume'
		value.0 207
		value.1 207
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 255'
			dbmin -9999999
			dbmax 1200
			dbvalue.0 0
			dbvalue.1 0
		}
	}


control.38 {
		iface MIXER
		name 'Master Playback Volume'
		value 202
		comment {
			access 'read write'
			type INTEGER
			count 1
			range '0 - 255'
			dbmin -9999999
			dbmax 0
			dbvalue.0 -1325
		}
	}
Comment 3 Raymond 2016-05-14 02:11:13 UTC
do the windows drier also have those iec958 front , rear, center/lfe amd side playback volume

ut us strange that there is 12 dB gain on these controls

control.9 {
		iface MIXER
		name 'IEC958 Front Playback Volume'
		value.0 211
		value.1 211
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 255'
			dbmin -9999999
			dbmax 1200
			dbvalue.0 100
			dbvalue.1 100
		}
	}
	control.10 {
		iface MIXER
		name 'IEC958 Rear Playback Volume'
		value.0 205
		value.1 205
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 255'
			dbmin -9999999
			dbmax 1200
			dbvalue.0 -50
			dbvalue.1 -50
		}
	}
	control.11 {
		iface MIXER
		name 'IEC958 Center/LFE Playback Volume'
		value.0 207
		value.1 207
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 255'
			dbmin -9999999
			dbmax 1200
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.12 {
		iface MIXER
		name 'IEC958 Unknown Playback Volume'
		value.0 207
		value.1 207
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 255'
			dbmin -9999999
			dbmax 1200
			dbvalue.0 0
			dbvalue.1 0
		}
	}
Comment 4 Raymond 2016-05-14 02:24:11 UTC
do the analog capture work since it is not clear how the driver switch between analog capture and iec958 capture and the driver has 4 capture devices

imple mixer control 'Analog Source',0
  Capabilities: cenum
  Items: 'Phone' 'Mic' 'Line in' 'Aux'
  Item0: 'Mic'
Simple mixer control 'CAPTURE feedback',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 0 [0%] [-99999.99dB]
  Front Right: Playback 0 [0%] [-99999.99dB]
Simple mixer control 'Digital Source',0
  Capabilities: cenum
  Items: 'IEC958 out' 'i2s mixer out' 'IEC958 in' 'i2s in' 'AC97 in' 'SRC out'
  Item0: 'i2s in'
Simple mixer control 'Shared Mic/Line in',0
  Capabilities: cenum
  Items: 'Line in' 'Mic in'
  Item0: 'Mic in'


**** List of CAPTURE Hardware Devices ****
card 0: CA0106 [CA0106], device 0: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 1: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 2: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CA0106 [CA0106], device 3: ca0106 [CA0106]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Comment 6 Raymond 2016-05-16 15:43:43 UTC
try 

speaker-test -c 2  -t wav -D hw:CARD=CA0106


do you get the correct sound if the application use alsa hw device ?




  23.816|   0.000) D: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.pci-0000_01_07.0.analog-stereo becomes idle, timeout in 5 seconds.
(  23.816|   0.000) I: [pulseaudio] resampler.c: Forcing resampler 'copy', because of fixed, identical sample rates.
(  23.816|   0.000) D: [pulseaudio] resampler.c: Resampler:
(  23.816|   0.000) D: [pulseaudio] resampler.c:   rate 48000 -> 48000 (method copy)
(  23.816|   0.000) D: [pulseaudio] resampler.c:   format s16le -> s16le (intermediate s16le)
(  23.816|   0.000) D: [pulseaudio] resampler.c:   channels 1 -> 2 (resampling 1)
(  23.816|   0.000) D: [pulseaudio] resampler.c: Channel matrix:
(  23.816|   0.000) D: [pulseaudio] resampler.c:        I00 
(  23.816|   0.000) D: [pulseaudio] resampler.c:     +------
(  23.816|   0.000) D: [pulseaudio] resampler.c: O00 | 0.000
(  23.816|   0.000) D: [pulseaudio] resampler.c: O01 | 1.000
(  23.816|   0.000) I: [pulseaudio] remap.c: Using stereo arrange remapping
(  23.817|   0.000) D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
(  23.817|   0.000) D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
(  23.817|   0.000) I: [pulseaudio] sink-input.c: Created input 2 "Front Right" on alsa_output.pci-0000_01_07.0.analog-stereo with sample spec s16le 1ch 48000Hz and channel map front-right
(  23.817|   0.000) I: [pulseaudio] sink-input.c:     event.id = "audio-channel-front-right"
(  23.817|   0.000) I: [pulseaudio] sink-input.c:     media.name = "Front Right"
(  23.817|   0.000) I: [pulseaudio] sink-input.c:     media.role = "test"
(  23.817|   0.000) I: [pulseaudio] sink-input.c:     media.filename = "/usr/share//sounds/freedesktop/stereo/audio-channel-front-right.oga"
(  23.817|   0.000) I: [pulseaudio] sink-input.c:     application.name = "libcanberra"
Comment 7 Raymond 2016-05-18 02:48:07 UTC


   0.343|   0.000) I: [pulseaudio] alsa-util.c: Successfully attached to mixer 'hw:0'
(   0.344|   0.000) D: [pulseaudio] alsa-mixer.c: Available mixer paths (after tidying):
(   0.344|   0.000) D: [pulseaudio] alsa-mixer.c: Path Set 0x860eda0, direction=1
(   0.344|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-output (Analog Output), direction=1, priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=255, min_dB=-100000, max_dB=0
(   0.344|   0.000) D: [pulseaudio] alsa-mixer.c: Element Master, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x7ffffffffffff, n_channels=1, override_map=yes

the fix is better done in driver by removing "Analog" prefix from those playback volume controls instead of adding "Element Analog xxx " in pulseaudio conf files




(   0.367|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-output (Analog Output), direction=1, priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=255, min_dB=-200000, max_dB=12
(   0.367|   0.000) D: [pulseaudio] alsa-mixer.c: Element Master, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x7ffffffffffff, n_channels=1, override_map=yes
(   0.367|   0.000) D: [pulseaudio] alsa-mixer.c: Element Analog Front, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2, override_map=yes
(   0.367|   0.000) D: [pulseaudio] alsa-mixer.c: Element Analog Side, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0xc00, n_channels=2, override_map=yes
(   0.367|   0.000) D: [pulseaudio] alsa-mixer.c: Element Analog Center/LFE, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x4900000000098, n_channels=2, override_map=yes
(
Comment 8 luke 2016-05-18 04:48:21 UTC
On a clean install of Ubuntu 16.04, 
$ speaker-test -c 2  -t wav -D hw:CARD=CA0106
Only speaks "Front Left"

I'm not sure what how you want me to force speaker-test to use ALSA. If I "killall pulseaudio", I get:

Playback open error: -16,Device or resource busy
Comment 9 luke 2016-05-18 16:20:57 UTC
With Lubuntu 14.4 Live CD (No PulseAudio),

$ speaker-test -c 2  -t wav -D hw:CARD=CA0106
-> I only hear "Front Left"

$ speaker-test -c2 -t wav -D pulse
Playback device is pulse
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM pulse
Playback open error: -2,No such file or directory

What else do you need from me?
Comment 10 luke 2016-05-18 16:43:19 UTC
Created attachment 216561 [details]
Mixer Setup

(In reply to Takashi Iwai from comment #1)
> It can't be a regression since there are no relevant changes in ca0106
> driver over 6 years.  If it worked, it's very likely a regression in
> PulseAudio side.
> 
> Try to go to runlevel 3, kill PA, unload snd-ca0106 module, and remove
> /var/lib/alsa/asound.state (or whatever alsactl stores).  Then reload
> snd-ca0106 module again.
> 
> At this state, how does the mixer setup look?  If the mixers are unbalanced
> (no matter whether volume zero or full), we need to fix.  If the mixer
> values are balanced, it's no driver bug, but it's PA who tries to set the
> unbalanced values.

Lubuntu doesn't have PA and I hosed my system trying to get runlevel 3 on Ubuntu 16.4 (followed old guide, forgetting it changed to systemd). 

Lubuntu doesn't have a /var/lib/alsa/asound.state file. But I did a $ alsa force-reload to reload the sound modules. Then ran $ alsamixer
Comment 11 Takashi Iwai 2016-05-18 17:03:24 UTC
(In reply to luke from comment #10)
> Created attachment 216561 [details]
> Mixer Setup
> 
> (In reply to Takashi Iwai from comment #1)
> > It can't be a regression since there are no relevant changes in ca0106
> > driver over 6 years.  If it worked, it's very likely a regression in
> > PulseAudio side.
> > 
> > Try to go to runlevel 3, kill PA, unload snd-ca0106 module, and remove
> > /var/lib/alsa/asound.state (or whatever alsactl stores).  Then reload
> > snd-ca0106 module again.
> > 
> > At this state, how does the mixer setup look?  If the mixers are unbalanced
> > (no matter whether volume zero or full), we need to fix.  If the mixer
> > values are balanced, it's no driver bug, but it's PA who tries to set the
> > unbalanced values.
> 
> Lubuntu doesn't have PA and I hosed my system trying to get runlevel 3 on
> Ubuntu 16.4 (followed old guide, forgetting it changed to systemd). 
> 
> Lubuntu doesn't have a /var/lib/alsa/asound.state file. But I did a $ alsa
> force-reload to reload the sound modules. Then ran $ alsamixer

Just remove the whole init stuff (it might be /etc/asound.state or such path), but do modprobe snd-ca0106 instead.  At best, rename or remove /usr/sbin/alsactl so that it won't be invoked before loading the module.

And try the same procedure with the old kernel where you assuming it working as is.  If there is really a difference, try to narrow down which kernel starts regression.
Comment 12 luke 2016-05-18 21:50:44 UTC
When I did a dist-upgrade from Ubuntu 12.04 to 14.04, the sound in my right channel cut out, so something changed in alsa or kernel. This is not an Ubuntu specific issue, as I experienced the same issue with a fresh install of CentOS and Debian.

This regression likely happened betweeen 3.2 (12.04) and 3.13 (14.04). I'll see if I can narrow it down more, but it will take some time.
Comment 13 luke 2016-05-19 04:00:14 UTC
I installed Lubuntu 12.04, 3.2.0-102-generic-pae. Both channels played. I upgraded the kernel to 3.10.101-0310101-generic from here:
http://kernel.ubuntu.com/~kernel-ppa/mainline/

Unlike the bootable iso image, once installed it had a /var/lib/alsa/asound.state

I removed this and did a $ alsa force-reload and $ alsactl init, but asound.state wasn't recreated. Also the old alsamixer settings seemed to remain.  How do I reset ALL the alsa settings to reproduce this bug with newer kernels?
Comment 14 luke 2016-09-24 19:19:25 UTC
Verified fixed with a clean install of Ubuntu 16.10.

$ uname -a
Linux luke-PowerEdge-T105 4.4.0-9136-generic #55-Ubuntu SMP Fri Aug 26 05:58:34 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Raymond,
Thank you so much for all your help on this issue!

Note You need to log in before you can comment on or make changes to this bug.