Syntax 2

# To understand (or propose bug reports) for the different
# parts of these configuration files, see:
# https://www.alsa-project.org/alsa-doc/alsa-lib/group__ucm__conf.html

# PinePhone-specific audio card structure help:
# https://files.pine64.org/doc/PinePhone/PinePhone%20v1.2%20Released%20Schematic.pdf
# https://xnux.eu/devices/feature/audio-pp.html

# General PinePhone help:
# https://wiki.pine64.org/index.php/PinePhone

SectionUseCase."HiFi" {
	File "/Allwinner/A64/PinePhone/HiFi.conf"
	Comment "Play HiFi quality music"
}

SectionUseCase."Voice Call" {
	File "/Allwinner/A64/PinePhone/VoiceCall.conf"
	Comment "Make a phone call"
}

FixedBootSequence [
	# Routing.
	cset "name='ADC Digital DAC Playback Switch' off"
	cset "name='AIF1 DA0 Stereo Playback Route' Stereo"
	cset "name='AIF1 Data Digital ADC Capture Switch' on"
	cset "name='AIF1 Slot 0 Digital DAC Playback Switch' on"
	cset "name='AIF2 DAC Source Playback Route' AIF2"
	# AIF2 (Modem) is mono.
	cset "name='AIF2 DAC Stereo Playback Route' Mix Mono"
	cset "name='AIF3 ADC Source Capture Route' None"
	cset "name='DAC Playback Switch' on"
	# Routes DACR->MIXL and DACL->MIXR => MIXL are MIXR are identical mono-mix of the DAC.
	cset "name='DAC Reversed Playback Switch' on"
	cset "name='Earpiece Source Playback Route' Left Mixer"
	cset "name='Headphone Source Playback Route' DAC"
	# The Pinephone speaker is mono.
	cset "name='Line Out Source Playback Route' Mono Differential"
]

BootSequence [
	# Playback volumes.
	cset "name='AIF1 DA0 Playback Volume' 160"
	cset "name='AIF2 DAC Playback Volume' 160"
	cset "name='DAC Playback Volume' 160"
	cset "name='Earpiece Playback Volume' 100%"
	cset "name='Headphone Playback Volume' 70%"
	cset "name='Line Out Playback Volume' 100%"
	cset "name='Mic2 Boost Volume' 1"

	# Capture volumes.
	cset "name='ADC Capture Volume' 160"
	cset "name='AIF1 AD0 Capture Volume' 160"
	cset "name='AIF2 ADC Capture Volume' 160"
]

SectionDefaults [
	# Switch playback off.
	cset "name='Earpiece Playback Switch' off"
	cset "name='Headphone Playback Switch' off"
	cset "name='Line In Playback Switch' off"
	cset "name='Line Out Playback Switch' off"
	cset "name='Mic1 Playback Switch' off"
	cset "name='Mic2 Playback Switch' off"

	# Switch capture off.
	cset "name='Line In Capture Switch' off"
	cset "name='Mic1 Capture Switch' off"
	cset "name='Mic2 Capture Switch' off"
	cset "name='Mixer Capture Switch' off"
	cset "name='Mixer Reversed Capture Switch' off"
]
