← Back to team overview

ubuntu-phone team mailing list archive

[Porting] Problems with UCM audio config

 

Hi,

Following the porting guide, I tried to add the Alsa UCM configuration files for my tablet. They are found at boot time and the default (reset) configuration is executed, but the devices (Speaker and Headphones) are never activated.

BTW, as a basis I used the latest stable loop-mounted image #144.

Here is what I did and what I saw in more detail:

1) Patched the kernel to set the device name to "tegra-wm8903" instead of "tegra-codecs", which was used by two other chipsets too.

2) Created directory /usr/share/alsa/ucm/tegra-wm8903 with the two files tegra-wm8903.conf and hifi (see attachments for reference).

3) The first version had some cset commands that made the kernel crash and reboot right away. That's why I know that the files are actually found and executed at boot time.

4) After removing those commands, the speakers were muted in pulseaudio. Removing the commands to switch off speakers in the default reset settings finally made the speakers work.

5) Plugging in headphones, I see the kernel acting on that and the speakers go off. But looking at Alsa settings, I see that only one of the two settings has changed. The 2nd one! I rather suspect something or someone else is switching them off (possibly the kernel and Alsa just sees it?). The headphones are not properly enabled, but I can use alsamixer to make them work.

6) Then I tried to use alsaucm to figure out what is going on. It did show the verb "HiFi" and my two devices, but any attempt to enable or disable something failed. Possibly I don't understand the right sequence or the right syntax, as it is all thoroughly undocumented. ;-)

So, after all my digging, I am pretty sure that the files are located and parsed properly and the default reset section is executed at boot time and whenever I run alsaucm. But the two devices are never enabled or disabled.

Any ideas?
Anything would be helpful: how to get more verbose logging from the UCM handlers, hints how the devices are supposed to be enabled/disabled, ...
Possibly I need to create some trigger event?

Thanks!
SectionVerb {

	EnableSequence [
	]

	DisableSequence [
	]

	Value {
		PlaybackPCM "hw:tegrawm8903"
		PlaybackVolume "Digital Playback Volume"
	}
}

SectionDevice."Speaker" {
	Comment "Speaker playback"

	EnableSequence [
		cdev "hw:tegrawm8903"
		cset "name='Int Spk Switch' on"
		cset "name='Speaker Switch' on,on"
	]

	DisableSequence [
		cdev "hw:tegrawm8903"
		cset "name='Int Spk Switch' off"
		cset "name='Speaker Switch' off,off"
	]

	Value {
		  PlaybackChannels "2"
	}
}

SectionDevice."Headphones" {
	Comment "Headphones playback"

	EnableSequence [
		cdev "hw:tegrawm8903"
		cset "name='Headphone Jack Switch' on"
		cset "name='Headphone Switch' on,on"
	]

	DisableSequence [
		cdev "hw:tegrawm8903"
		cset "name='Headphone Jack Switch' off"
		cset "name='Headphone Switch' off,off"
	]

	Value {
		PlaybackChannels "2"
	}
}

SectionUseCase."HiFi" {
	File "hifi"
	Comment "Play HiFi qualiy Music"
}

SectionDefaults [
	cdev "hw:tegrawm8903"

	exec "echo Setting UCM defaults for tegra-wm8903"

	cset "name='Left Speaker Mixer DACL Switch' on"
	cset "name='Left Speaker Mixer DACR Switch' off"
	cset "name='Right Speaker Mixer DACL Switch' off"
	cset "name='Right Speaker Mixer DACR Switch' on"

	cset "name='Left Output Mixer DACL Switch' on"
	cset "name='Left Output Mixer DACR Switch' off"
	cset "name='Right Output Mixer DACL Switch' off"
	cset "name='Right Output Mixer DACR Switch' on"

	cset "name='Left Input PGA Switch' off"
	cset "name='Right Input PGA Switch' off"
]


Follow ups