# Use case Configuration for sof-soundwire card

If.codecmic {
	Condition {
		Type RegexMatch
		Regex "(rt722(-sdca)?)"
		String "${var:MultiMicShadow}"
	}
	True {
		SectionDevice."Mic" {
			Comment	"SoundWire microphones"

			EnableSequence [
				cset "name='rt722 FU1E Capture Switch' 1"
			]

			DisableSequence [
				cset "name='rt722 FU1E Capture Switch' 0"
			]

			Value {
				CapturePriority 100
				CapturePCM "hw:${CardId},4"
				CaptureSwitch "rt722 FU1E Capture Switch"
				CaptureVolume "rt722 FU1E Capture Volume"
				CaptureMixerElem "rt722 FU1E"
			}
		}
	}
}

If.codecspk {
	Condition {
		Type RegexMatch
		Regex "(rt722(-sdca)?)"
		String "${var:MultiSpeakerShadow}"
	}
	True {
		SectionDevice."Speaker" {
			Comment "Speaker"

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

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

			Value {
				PlaybackPriority 100
				PlaybackPCM "hw:${CardId},2"
				PlaybackMixerElem "rt722 FU06"
				PlaybackVolume "rt722 FU06 Playback Volume"
			}
		}
	}
}

SectionDevice."Headphones" {
	Comment	"Headphones"

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

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

	Value {
	      PlaybackPriority 200
	      PlaybackPCM "hw:${CardId}"
	      JackControl "Headphone Jack"
	}
}

SectionDevice."Headset" {
	Comment "Headset Microphone"

	EnableSequence [
		cset "name='rt722 FU0F Capture Switch' 1"
	]

	DisableSequence [
		cset "name='rt722 FU0F Capture Switch' 0"
	]

	If.hsmicsw {
		Condition {
			Type ControlExists
			Control "name='Headset Mic Switch'"
		}
		True {
			EnableSequence [
				cset "name='Headset Mic Switch' on"
			]
			DisableSequence [
				cset "name='Headset Mic Switch' off"
			]
		}
	}

	Value {
		CapturePriority 200
		CapturePCM "hw:${CardId},1"
		JackControl "Headset Mic Jack"
		CaptureSwitch "rt722 FU0F Capture Switch"
		CaptureVolume "rt722 FU0F Capture Volume"
		CaptureMixerElem "rt722 FU0F"
	}
}
