SectionVerb {
	EnableSequence [
		disdevall ""
	]
}

If.dmic {
	Condition {
		Type String
		Empty "${var:DeviceDmic}"
	}
	False.SectionDevice."Mic" {
		Comment "Digital Microphone"

		Value {
			CapturePriority 100
			CapturePCM "hw:${CardId},${var:DeviceDmic}"
			CaptureChannels 2
		}
	}
}

SectionDevice."Speaker" {
	Comment "Speakers"

	ConflictingDevice [
		"Headphones"
	]

	EnableSequence [
		cset "name='Speaker Switch' on"
	]

	DisableSequence [
		cset "name='Speaker Switch' off"
	]

	Value {
		PlaybackPriority 100
		PlaybackPCM "hw:${CardId}"
		# The es8316 only has a HP-amp which is muxed to the speaker
		# or to the headpones output
		PlaybackMixerElem "Headphone Mixer"
		PlaybackMasterElem "DAC"
	}
}

SectionDevice."Headphones" {
	Comment "Headphones"

	ConflictingDevice [
		"Speaker"
	]

	Value {
		PlaybackPriority 300
		PlaybackPCM "hw:${CardId}"
		PlaybackMixerElem "Headphone Mixer"
		PlaybackMasterElem "DAC"
		JackControl "Headphone Jack"
		JackHWMute "Speaker"
	}
}

SectionDevice."Headset" {
	Comment "Headset Microphone"

	EnableSequence [
		cset "name='Differential Mux' lin1-rin1"
		cset "name='Headset Mic Switch' on"
		cset "name='Digital Mic Mux' 'dmic disable'"
		cset "name='Internal Mic Switch' on"
	]

	DisableSequence [
		cset "name='Headset Mic Switch' on"
		cset "name='Internal Mic Switch' off"
	]

	Value {
		CapturePriority 300
		CapturePCM "hw:${CardId}"
		CaptureMixerElem "ADC PGA Gain"
		CaptureMasterElem "ADC"
		JackControl "Headset Mic Jack"
	}
}

