# Generic HDA devices for analog I/O

SectionVerb {
	EnableSequence [
		disdevall ""
	]

	Value.TQ "HiFi"
}

Define.lovol "AUXOUT"
#Define.loctl "AUXOUT"
Define.hpvol "Headphone"
Define.hpjack "Headphone Jack"

#------------------LineOut Device begin-------------------------
SectionDevice."LineOut" {
	Comment "Line Out"

	EnableSequence [
		cset "name='AUXOUT Playback Switch' on"
		cset "name='AUX1 Output Mixer RDAC Switch' on"
		cset "name='AUX2 Output Mixer LDAC Switch' on"

	]

	DisableSequence [
		cset "name='AUXOUT Playback Switch' off"
		cset "name='AUX1 Output Mixer RDAC Switch' off"
		cset "name='AUX2 Output Mixer LDAC Switch' off"
	]

	Value {
		PlaybackPriority 300
		PlaybackPCM "hw:${CardId}"
		PlaybackChannels "2"
		PlaybackSwitch "AUXOUT Playback Switch"
	}
}
#------------------LineOut Device end-------------------------

#------------------Headphones Device begin--------------------
If.hpjack {
	Condition {
		Type ControlExists
		Control "iface=CARD,name='Headphones Jack'"
	}
	True.Define.hpjack "Headphones Jack"
}

SectionDevice."Headphones" {
	Comment "Headphones"

	EnableSequence [
		cset "name='Left Output Mixer LDAC Switch' on"
		cset "name='Left Output Mixer RDAC Switch' on"
		cset "name='Right Output Mixer LDAC Switch' on"
		cset "name='Right Output Mixer RDAC Switch' on"
		cset "name='Headphone ZC Switch' on"
		cset "name='Headphone Playback Switch' on"
	]

	DisableSequence [
		cset "name='Left Output Mixer LDAC Switch' off"
		cset "name='Left Output Mixer RDAC Switch' off"
		cset "name='Right Output Mixer LDAC Switch' off"
		cset "name='Right Output Mixer RDAC Switch' off"
		cset "name='Headphone ZC Switch' off"
		cset "name='Headphone Playback Switch' off"
	]

	Value {
		PlaybackPriority 200
		PlaybackPCM "hw:${CardId}"
		PlaybackChannels "2"
		PlaybackVolume "Headphone Volume"
		PlaybackSwitch "Headphone Playback Switch"
		JackControl "${var:hpjack}"
	}
}
#------------------Headphones Device end--------------------

#------------------Mic Devices begin------------------------
SectionDevice."RearMic" {
	Comment "Rear Mic"

	EnableSequence [
		cset "name='Left Input Mixer MicN Switch' on"
		cset "name='Left Input Mixer MicP Switch' on"
		cset "name='Right Input Mixer MicN Switch' on"
		cset "name='Right Input Mixer MicP Switch' on"
	]

	DisableSequence [
		cset "name='Left Input Mixer MicN Switch' off"
		cset "name='Left Input Mixer MicP Switch' off"
		cset "name='Right Input Mixer MicN Switch' off"
		cset "name='Right Input Mixer MicP Switch' off"
	]

	Value {
		CapturePriority 200
		CapturePCM "hw:${CardId}"
		CaptureChannels "2"
		CaptureMixerElem "ADC"
	}
}

SectionDevice."FrontMic" {
	Comment "Front Mic"

	EnableSequence [
		cset "name='Left Input Mixer L2 Switch' on"
		cset "name='Right Input Mixer R2 Switch' on"
	]

	DisableSequence [
		cset "name='Left Input Mixer L2 Switch' off"
		cset "name='Right Input Mixer R2 Switch' off"
	]

	Value {
		CapturePriority 100
		CapturePCM "hw:${CardId}"
		CaptureChannels "2"
		CaptureMixerElem "ADC"
		JackControl "Mic Jack"
	}
}
#------------------Mic Devices end------------------------
