# Use case Configuration for MAX98089 on LG Optimus 4X HD/Vu P880/P895

SectionDevice."Speaker" {
	Comment "Speaker"

	ConflictingDevice [
		"Headphones"
	]

	EnableSequence [
		cset "name='Speaker Switch' on"
		cset "name='Int Spk Switch' on"

		cset "name='Left SPK Mixer Left DAC1 Switch' on"
		cset "name='Left SPK Mixer Left DAC2 Switch' on"
		cset "name='Left SPK Mixer Right DAC1 Switch' on"
		cset "name='Left SPK Mixer Right DAC2 Switch' on"
	]

	DisableSequence [
		cset "name='Speaker Switch' off"
		cset "name='Int Spk Switch' off"

		cset "name='Left SPK Mixer Left DAC1 Switch' off"
		cset "name='Left SPK Mixer Left DAC2 Switch' off"
		cset "name='Left SPK Mixer Right DAC1 Switch' off"
		cset "name='Left SPK Mixer Right DAC2 Switch' off"
	]

	Value {
		PlaybackPCM "hw:${CardId}"
		PlaybackChannels 2
		PlaybackPriority 300

		PlaybackMixerElem "Speaker"
	}
}

SectionDevice."Headphones" {
	Comment "Headphones"

	ConflictingDevice [
		"Speaker"
	]

	EnableSequence [
		cset "name='Headphone Switch' on"

		cset "name='Left HP Mixer Left DAC1 Switch' on"
		cset "name='Left HP Mixer Left DAC2 Switch' on"
		cset "name='Right HP Mixer Right DAC1 Switch' on"
		cset "name='Right HP Mixer Right DAC2 Switch' on"
	]

	DisableSequence [
		cset "name='Headphone Switch' off"

		cset "name='Left HP Mixer Left DAC1 Switch' off"
		cset "name='Left HP Mixer Left DAC2 Switch' off"
		cset "name='Right HP Mixer Right DAC1 Switch' off"
		cset "name='Right HP Mixer Right DAC2 Switch' off"
	]

	Value {
		PlaybackPCM "hw:${CardId}"
		PlaybackChannels 2
		PlaybackPriority 100

		PlaybackMixerElem "Headphone"

		JackControl "Headphone Jack"
	}
}

SectionDevice."Mic1" {
	Comment "Internal Microphone"

	ConflictingDevice [
		"Mic2"
	]

	EnableSequence [
		# Main MIC
		cset "name='Internal Mic 1 Switch' on"
		cset "name='DAI1 ADC Filter' fc=258/fs=16k"

		cset "name='Left ADC Mixer MIC1 Switch' on"
		cset "name='Right ADC Mixer MIC1 Switch' on"

		# Secondary MIC
		cset "name='Int Mic Switch' on"
		cset "name='Internal Mic 2 Switch' on"

		cset "name='Left ADC Mixer MIC2 Switch' on"
		cset "name='Right ADC Mixer MIC2 Switch' on"
	]

	DisableSequence [
		# Main MIC
		cset "name='Internal Mic 1 Switch' off"
		cset "name='DAI1 ADC Filter' off"

		cset "name='Left ADC Mixer MIC1 Switch' off"
		cset "name='Right ADC Mixer MIC1 Switch' off"

		# Secondary MIC
		cset "name='Int Mic Switch' off"
		cset "name='Internal Mic 2 Switch' off"

		cset "name='Left ADC Mixer MIC2 Switch' off"
		cset "name='Right ADC Mixer MIC2 Switch' off"
	]

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

SectionDevice."Mic2" {
	Comment "External Microphone"

	ConflictingDevice [
		"Mic1"
	]

	EnableSequence [
		cset "name='Mic Jack Switch' on"

		cset "name='Left ADC Mixer INA1 Switch' on"
		cset "name='Right ADC Mixer INA1 Switch' on"
	]

	DisableSequence [
		cset "name='Mic Jack Switch' off"

		cset "name='Left ADC Mixer INA1 Switch' off"
		cset "name='Right ADC Mixer INA1 Switch' off"
	]

	Value {
		CapturePCM "hw:${CardId}"
		CapturePriority 100

		JackControl "Mic Jack"
	}
}
