Alsaucm: различия между версиями

Материал из Toshiba AC100 wiki
Перейти к навигации Перейти к поиску
Нет описания правки
 
Нет описания правки
 
Строка 5: Строка 5:
http://www.alsa-project.org/main/index.php/Use_Case_Manager
http://www.alsa-project.org/main/index.php/Use_Case_Manager


http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=include/use-case.h;h=f57762846cdc275a28839f0cc09d90bea4870ff5;hb=02b20067138c98f89c853ba510ea5e9023573104
[http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=include/use-case.h;h=f57762846cdc275a28839f0cc09d90bea4870ff5;hb=02b20067138c98f89c853ba510ea5e9023573104 use-case.h]


http://git.linaro.org/gitweb?p=people/weifeng/alsa-ucm-conf.git;a=tree;f=ucm;h=46303ba06cdb3673e48ef7f911f43e903211e120;hb=master
[http://git.linaro.org/gitweb?p=people/weifeng/alsa-ucm-conf.git;a=tree;f=ucm;h=46303ba06cdb3673e48ef7f911f43e903211e120;hb=master alsa-ucm-conf git]
 
[https://wiki.linaro.org/WorkingGroups/Middleware/Multimedia/Specs/1111/AudioIntegration/UCMPulseAudio UCM for pulse audio]


<ogra_> stuw, do you have an ubuntu install by chance ? on all arm installs we have ucm files for the panda, based on these it should be not to hard to create an ucm profile for someone who understands alsa deeply enough
<ogra_> stuw, do you have an ubuntu install by chance ? on all arm installs we have ucm files for the panda, based on these it should be not to hard to create an ucm profile for someone who understands alsa deeply enough

Текущая версия от 13:14, 16 января 2015

For downstream kernel

"Modern mobile devices are increasingly required to provide a rich set of audio functionality required by todays applications. This richer functionality places additional requirements on the audio hardware and leads to further complexity. Example: a modern Linux phone could have as much as 80 bespoke ALSA audio controls to manage different use cases." --- http://www.slimlogic.co.uk/2009/02/alsa-use-case-manager/

http://www.alsa-project.org/main/index.php/Use_Case_Manager

use-case.h

alsa-ucm-conf git

UCM for pulse audio

<ogra_> stuw, do you have an ubuntu install by chance ? on all arm installs we have ucm files for the panda, based on these it should be not to hard to create an ucm profile for someone who understands alsa deeply enough ... <ogra_> well, all ucm needs is a /usr/share/alsa/ucm/<device> directory and the profile files in there that are essentially amixer settings <ogra_> to enable ucm you then run: alsaucm set _verb <profile name>


Current UCM config from ogra:

# UCM configuration for tegra-alc5632

ValueDefaults {
  PlaybackCTL "hw:0"
  CaptureCTL "hw:0"
}

SectionDefaults [
		exec "echo Im setting defaults for tegra-alc5632"
		cdev "hw:tegraalc5632"
		cset "name='Master Playback Switch' on"
		cset "name='Master Playback Volume' 44,44"
		cset "name='Headphone Playback Switch' on"
		cset "name='Headphone Playback Volume' 21,21"
		cset "name='Speaker Playback Switch' on"
		cset "name='Speaker Playback Volume' 21,21"
		cset "name='Speaker Mix DAC2SPK Playback Switch' on"
		cset "name='SpeakerOut Mux' 2"
		cset "name='SpeakerOut N Mux' LN/-R"
		cset "name='AB-D Amp Mux' 0"
		cset "name='HPL Mix DACL2HP Playback Switch' on"
		cset "name='HPR Mix DACR2HP Playback Switch' on"
		cset "name='Int Spk Switch' on"
		cset "name='Left Headphone Mux' 1"
		cset "name='Right Headphone Mux' 1"
		cset "name='DMICL Mix DMICL2ADC Capture Switch' on"
		cset "name='DMIC En Capture Switch' on"
		cset "name='DMIC PreFilter Capture Switch' on"
		cset "name='DMIC Boost Capture Volume' 4"
		cset "name='Rec Capture Volume' 24"
]

Save this file as /usr/share/alsa/ucm/tegraalc5632/tegraalc5632.conf NOTE: for modern kernels replace "hw:tegraalc5632" to "hw:PAZ00"

And apply ucm settings:

alsaucm -c tegraalc5632 reset


New generation

NOT TESTED There is no documentation about UCM :( Based on: http://mailman.alsa-project.org/pipermail/alsa-devel/2013-May/061892.html http://mailman.alsa-project.org/pipermail/alsa-devel/2013-May/061893.html http://mailman.alsa-project.org/pipermail/alsa-devel/2013-May/061896.html

/usr/share/alsa/ucm/paz00/paz00.conf

Comment "PAZ00 alc5632"

ValueDefaults {
  PlaybackCTL "hw:0"
  CaptureCTL "hw:0"
}

SectionDefaults [
		cdev "hw:PAZ00"

		cset "name='Master Playback Switch' on"
		cset "name='Master Playback Volume' 44,44"
		cset "name='Headphone Playback Volume' 21,21"
		cset "name='Speaker Playback Volume' 21,21"
		cset "name='SpeakerOut Mux' 2"
		cset "name='SpeakerOut N Mux' LN/-R"
		cset "name='AB-D Amp Mux' 0"
		cset "name='Left Headphone Mux' 1"
		cset "name='Right Headphone Mux' 1"
		cset "name='DMIC Boost Capture Volume' 4"
		cset "name='Rec Capture Volume' 24"

		# Fix external mic record volumes
		cset "name='Mic 1 Boost Volume' 0"
		cset "name='Mic1 Capture Volume' 0"
		cset "name='Rec Capture Volume' 0"
]

SectionUseCase."HiFi" {
	File "HiFi.conf"
	Comment "Music playback"
}

SectionUseCase."Voice Call IP" {
	File "VoiceCall.conf"
	Comment "Playback and capture"
}

/usr/share/alsa/ucm/paz00/HiFi.conf

SectionVerb {
	EnableSequence [
		cdev "hw:PAZ00"

		cset "name='Speaker Playback Switch' on"
		cset "name='Int Spk Switch' on"
		cset "name='Speaker Mix DAC2SPK Playback Switch' on"
	]
	DisableSequence [
		cset "name='Speaker Playback Switch' off"
		cset "name='Int Spk Switch' off"
		cset "name='Speaker Mix DAC2SPK Playback Switch' off"
	]
}

SectionDevice."Headset".0 {
	Comment "3.5mm Headset"

	Value {
		JackName "Paz00 Headset Jack"
	}

	EnableSequence [
		cdev "hw:PAZ00"

		# Internal speaker
		cset "name='Int Spk Switch' off"

		# Headphones
		cset "name='Headphone Playback Switch' on"
		cset "name='HPL Mix DACL2HP Playback Switch' on"
		cset "name='HPR Mix DACR2HP Playback Switch' on"
	]
	DisableSequence [
		cdev "hw:PAZ00"

		# Headphones
		cset "name='Headphone Playback Switch' off"
		cset "name='HPL Mix DACL2HP Playback Switch' off"
		cset "name='HPR Mix DACR2HP Playback Switch' off"

		# Internal speaker
		cset "name='Int Spk Switch' on"
	]
}

/usr/share/alsa/ucm/paz00/VoiceCall.conf

SectionVerb {
	EnableSequence [
		cdev "hw:PAZ00"

		cset "name='Speaker Playback Switch' on"
		cset "name='Int Spk Switch' on"
		cset "name='Speaker Mix DAC2SPK Playback Switch' on"

		cset "name='DMICL Mix DMICL2ADC Capture Switch' on"
		cset "name='DMIC En Capture Switch' on"
		cset "name='DMIC PreFilter Capture Switch' on"
	]
	DisableSequence [
		cset "name='Speaker Playback Switch' off"
		cset "name='Int Spk Switch' off"
		cset "name='Speaker Mix DAC2SPK Playback Switch' off"

		cset "name='DMICL Mix DMICL2ADC Capture Switch' off"
		cset "name='DMIC En Capture Switch' off"
		cset "name='DMIC PreFilter Capture Switch' off"
	]
}

SectionDevice."Headset".0 {
	Comment "3.5mm Headset"

	Value {
		JackName "Paz00 Headset Jack"
	}

	EnableSequence [
		cdev "hw:PAZ00"

		# Internal speaker
		cset "name='Int Spk Switch' off"

		# Internal mic
		cset "name='DMIC En Capture Switch' off"

		# Headphones
		cset "name='Headphone Playback Switch' on"
		cset "name='HPL Mix DACL2HP Playback Switch' on"
		cset "name='HPR Mix DACR2HP Playback Switch' on"

		# External min
		cset "name='Left Capture Mix MIC12REC_L Capture Switch' on"
	]
	DisableSequence [
		cdev "hw:PAZ00"

		# Headphones
		cset "name='Headphone Playback Switch' off"
		cset "name='HPL Mix DACL2HP Playback Switch' off"
		cset "name='HPR Mix DACR2HP Playback Switch' off"

		# External mic
		cset "name='Left Capture Mix MIC12REC_L Capture Switch' on"

		# Internal speaker
		cset "name='Int Spk Switch' on"

		# Internal mic
		cset "name='DMIC En Capture Switch' on"
	]
}

How to get all control names of current driver

amixer controls

Output example from 3.15-rc7

numid=12,iface=MIXER,name='Master Playback Switch'
numid=11,iface=MIXER,name='Master Playback Volume'
numid=4,iface=MIXER,name='Headphone Playback Switch'
numid=3,iface=MIXER,name='Headphone Playback Volume'
numid=10,iface=MIXER,name='LineIn Playback Volume'
numid=16,iface=MIXER,name='Mic 1 Boost Volume'
numid=17,iface=MIXER,name='Mic 2 Boost Volume'
numid=13,iface=MIXER,name='Mic1 Playback Volume'
numid=14,iface=MIXER,name='Mic2 Playback Volume'
numid=9,iface=MIXER,name='Phone Playback Volume'
numid=67,iface=MIXER,name='AuxOut Mux'
numid=6,iface=MIXER,name='Auxout Playback Switch'
numid=5,iface=MIXER,name='Auxout Playback Volume'
numid=45,iface=MIXER,name='Mono Mix ADC2MONO_L Playback Switch'
numid=46,iface=MIXER,name='Mono Mix ADC2MONO_R Playback Switch'
numid=50,iface=MIXER,name='Mono Mix DAC2MONO Playback Switch'
numid=47,iface=MIXER,name='Mono Mix LI2MONO Playback Switch'
numid=48,iface=MIXER,name='Mono Mix MIC12MONO Playback Switch'
numid=49,iface=MIXER,name='Mono Mix MIC22MONO Playback Switch'
numid=51,iface=MIXER,name='Mono Mix VOICE2MONO Playback Switch'
numid=62,iface=MIXER,name='ADCR Mux'
numid=61,iface=MIXER,name='I2SOut Mux'
numid=22,iface=MIXER,name='AB-D Amp Mux'
numid=18,iface=MIXER,name='DMIC Boost Capture Volume'
numid=19,iface=MIXER,name='DMIC En Capture Switch'
numid=20,iface=MIXER,name='DMIC PreFilter Capture Switch'
numid=38,iface=MIXER,name='DMICL Mix DMICL2ADC Capture Switch'
numid=37,iface=MIXER,name='DMICR Mix DMICR2ADC Capture Switch'
numid=56,iface=MIXER,name='HP Mix LI2HP Playback Switch'
numid=58,iface=MIXER,name='HP Mix MIC12HP Playback Switch'
numid=59,iface=MIXER,name='HP Mix MIC22HP Playback Switch'
numid=57,iface=MIXER,name='HP Mix PHONE2HP Playback Switch'
numid=60,iface=MIXER,name='HP Mix VOICE2HP Playback Switch'
numid=52,iface=MIXER,name='HPL Mix ADC2HP_L Playback Switch'
numid=53,iface=MIXER,name='HPL Mix DACL2HP Playback Switch'
numid=54,iface=MIXER,name='HPR Mix ADC2HP_R Playback Switch'
numid=55,iface=MIXER,name='HPR Mix DACR2HP Playback Switch'
numid=21,iface=MIXER,name='Int Spk Switch'
numid=34,iface=MIXER,name='Left Capture Mix HPL2REC Capture Switch'
numid=32,iface=MIXER,name='Left Capture Mix LIL2REC Capture Switch'
numid=30,iface=MIXER,name='Left Capture Mix MIC12REC_L Capture Switch'
numid=31,iface=MIXER,name='Left Capture Mix MIC22REC_L Capture Switch'
numid=36,iface=MIXER,name='Left Capture Mix MONO2REC_L Capture Switch'
numid=33,iface=MIXER,name='Left Capture Mix PH2REC_L Capture Switch'
numid=35,iface=MIXER,name='Left Capture Mix SPK2REC_L Capture Switch'
numid=65,iface=MIXER,name='Left Headphone Mux'
numid=15,iface=MIXER,name='Rec Capture Volume'
numid=27,iface=MIXER,name='Right Capture Mix HPR2REC Capture Switch'
numid=25,iface=MIXER,name='Right Capture Mix LIR2REC Capture Switch'
numid=23,iface=MIXER,name='Right Capture Mix MIC12REC_R Capture Switch'
numid=24,iface=MIXER,name='Right Capture Mix MIC22REC_R Capture Switch'
numid=29,iface=MIXER,name='Right Capture Mix MONO2REC_R Capture Switch'
numid=26,iface=MIXER,name='Right Capture Mix PH2REC_R Capture Switch'
numid=28,iface=MIXER,name='Right Capture Mix SPK2REC_R Capture Switch'
numid=64,iface=MIXER,name='Right Headphone Mux'
numid=43,iface=MIXER,name='Speaker Mix DAC2SPK Playback Switch'
numid=39,iface=MIXER,name='Speaker Mix LI2SPK Playback Switch'
numid=41,iface=MIXER,name='Speaker Mix MIC12SPK Playback Switch'
numid=42,iface=MIXER,name='Speaker Mix MIC22SPK Playback Switch'
numid=40,iface=MIXER,name='Speaker Mix PHONE2SPK Playback Switch'
numid=44,iface=MIXER,name='Speaker Mix VOICE2SPK Playback Switch'
numid=2,iface=MIXER,name='Speaker Playback Switch'
numid=1,iface=MIXER,name='Speaker Playback Volume'
numid=66,iface=MIXER,name='SpeakerOut Mux'
numid=63,iface=MIXER,name='SpeakerOut N Mux'
numid=8,iface=MIXER,name='Voice DAC Playback Switch'
numid=7,iface=MIXER,name='Voice DAC Playback Volume'

Test ucm profile

alsaucm -c PAZ00 -i