Syntax 7

SectionUseCase."HiFi" {
	File "/sof-soundwire/HiFi.conf"
	Comment "Play HiFi quality Music"
}

Include.led.File "/common/ctl/led.conf"
Include.card-init.File "/lib/card-init.conf"
Include.ctl-remap.File "/lib/ctl-remap.conf"

Define {
	SpeakerCodec1 ""
	SpeakerChannels1 "2"
	SpeakerAmps1 "0"
	HeadsetCodec1 ""
	MicCodec1 ""
	Mics1 "0"
	Iec61937Pcms1 ""
	MultiCodec1 ""
}

DefineRegex {
	SpeakerCodec {
		Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?)"
		String "${CardComponents}"
	}
	SpeakerChannels {
		Regex " cfg-spk:([0-9]+)"
		String "${CardComponents}"
	}
	SpeakerAmps {
		Regex " cfg-amp:([0-9]+)"
		String "${CardComponents}"
	}
	HeadsetCodec {
		Regex " hs:([a-z0-9]+(-sdca)?)"
		String "${CardComponents}"
	}
	MicCodec {
		Regex " mic:([a-z0-9]+(-dmic)?+(-sdca)?)"
		String "${CardComponents}"
	}
	Mics {
		Regex " cfg-mics:([1-9][0-9]*)"
		String "${CardComponents}"
	}
	Iec61937Pcms {
		Regex "iec61937-pcm:(([0-9]+(,))*[0-9]+)"
		String "${CardComponents}"
	}
	MultiCodec {
		Regex "(rt712|rt722(-sdca)?)"
		String "${var:SpeakerCodec1} ${var:HeadsetCodec1} ${var:MicCodec1}"
	}
}

If.multi_init {
	Condition {
		Type String
		Empty "${var:MultiCodec1}"
	}
	False {
		Define {
			MultiSpeakerShadow "${var:SpeakerCodec1}"
			MultiMicShadow "${var:MicCodec1}"
		}
		Include.multi_init.File "/codecs/${var:MultiCodec1}/init.conf"
	}
}

If.multi_speaker {
	Condition {
		Type RegexMatch
		Regex "${var:SpeakerCodec1}"
		String "${var:MultiCodec1}"
	}
	True {
		Define.SpeakerCodec1 ""
	}
}

If.multi_mic {
	Condition {
		Type RegexMatch
		Regex "${var:MicCodec1}"
		String "${var:MultiCodec1}"
	}
	True {
		Define.MicCodec1 ""
	}
}

If.multi_headset {
	Condition {
		Type RegexMatch
		Regex "${var:HeadsetCodec1}"
		String "${var:MultiCodec1}"
	}
	True {
		Define.HeadsetCodec1 ""
	}
}

If.spk_init {
	Condition {
		Type RegexMatch
		Regex "(rt1318(-1)?|cs35l56(-bridge)?)"
		String "${var:SpeakerCodec1}"
	}
	True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"
}

If.hs_init {
	Condition {
		Type RegexMatch
		Regex "(cs42l43|rt5682|rt700|rt711|rt713(-sdca)?)"
		String "${var:HeadsetCodec1}"
	}
	True.Include.hs_init.File "/codecs/${var:HeadsetCodec1}/init.conf"
}

If.mic_init {
	Condition {
		Type RegexMatch
		Regex "(cs42l43-dmic|rt712-dmic|rt713-dmic|rt715(-sdca)?)"
		String "${var:MicCodec1}"
	}
	True.Include.mic_init.File "/codecs/${var:MicCodec1}/init.conf"
}

If.mic_init_rt715 {
	Condition {
		Type String
		Needle "rt715"
		Haystack "${var:MicCodec1}"
	}
	True.Macro [{ SetLED { LED="mic" Action="detach" CtlId="PGA5.0 5 Master Capture Switch" } }]
}

If.pga_init_pga2 {
	Condition {
		Type ControlExists
		Control "name='PGA2.0 2 Master Capture Switch'"
	}
	True.BootSequence [
		cset "name='PGA2.0 2 Master Capture Switch' 1"
	]
}

If.pga_init_pga5 {
	Condition {
		Type ControlExists
		Control "name='PGA5.0 5 Master Capture Switch'"
	}
	True.BootSequence [
		cset "name='PGA5.0 5 Master Capture Switch' 1"
	]
}

If.mics-array {
	Condition {
		Type String
		Empty "${var:Mics1}"
	}
	False.FixedBootSequence [
		# dmic array info
		exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json"
	]
}

Include.hdmi-pcm.File "/common/pcm/hdmi.conf"

Macro.0.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 5 Idx 0 }
Macro.1.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 6 Idx 1 }
Macro.2.HdmiDevice { Iec61937Devices "${var:Iec61937Pcms1}" Dev 7 Idx 2 }

If.HdmiIec61937 {
	Condition {
		Type RegexMatch
		Regex "((^|,)[567](,|$))"
		String "${var:Iec61937Pcms1}"
	}
	True.Macro.save_hdmi_cfg.HdmiPCMSave { Name "42-sof-hdmi" }
}

# Define macros to set up processing controls
Include.dsp-variables.File "/Intel/sof-hda-dsp/dsp.conf"

# Set BootSequence and FixedBootSequence for drc, eqiir, eqfir
Macro.SpeakerDrc.SofDrcBootSetup "endpoint='PostMixerSpeaker' direction='Playback'"
Macro.SpeakerIir.SofEqBootSetup "endpoint='PostMixerSpeaker' direction='Playback' eqtype='Iir'"
Macro.SpeakerFir.SofEqBootSetup "endpoint='PostMixerSpeaker' direction='Playback' eqtype='Fir'"

# Set BootSequence and FixedBootSequence for Mic array eqiir, tdfb, drc
Macro.MicArrayIir.SofEqBootSetup "endpoint='MicArray' direction='Capture' eqtype='Iir'"
Macro.MicArrayDrc.SofDrcBootSetup "endpoint='MicArray' direction='Capture'"
Macro.MicarrayTdfb.SofBeamformerBootSetup "endpoint='MicArray' direction='Capture'"

# For SoundWire PC with PCH-DMIC set BootSequence and FixedBootSequence for eqiir, tdfb, drc
Macro.Dmic0ArrayIir.SofEqBootSetup "endpoint='Dmic0' direction='Capture' eqtype='Iir'"
Macro.Dmic0ArrayDrc.SofDrcBootSetup "endpoint='Dmic0' direction='Capture'"
Macro.Dmic0ArrayTdfb.SofBeamformerBootSetup "endpoint='Dmic0' direction='Capture'"
