# Use case Configuration for sof-soundwire card

#
# Arguments:
#   ForAmps - regex filter for var:SpeakerAmps
#   Amp - amplifier number (1,2 etc.)
#   Sel - channel selection (LR LL RL RR)
#
DefineMacro.rt1308spk.If.0 {
	Condition {
		Type RegexMatch
		Regex "${var:__ForAmps}"
		String "${var:SpeakerAmps}"
	}
	True {
		EnableSequence [
			cset "name='rt1308-${var:__Amp} RX Channel Select' ${var:__Sel}"
			cset "name='rt1308-${var:__Amp} DAC L Switch' 1"
			cset "name='rt1308-${var:__Amp} DAC R Switch' 1"
		]
		DisableSequence [
			cset "name='rt1308-${var:__Amp} DAC L Switch' 0"
			cset "name='rt1308-${var:__Amp} DAC R Switch' 0"
		]
	}
}

SectionDevice."Speaker" {
	Comment	"Speaker"

	Macro.num1.rt1308spk { ForAmps "1" Amp 1 Sel LR }
	Macro.num2.rt1308spk { ForAmps "2" Amp 1 Sel LL }
	Macro.num3.rt1308spk { ForAmps "2" Amp 2 Sel RR }

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

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

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