Syntax 7

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

Define {
	DeviceMic "Mic"
	DeviceDmic ""
	Iec61937Pcms1 ""
}

DefineRegex {
	Iec61937Pcms {
		Regex "iec61937-pcm:(([0-9]+(,))*[0-9]+)"
		String "${CardComponents}"
	}
}

If.devdmic {
	Condition {
		Type String
		Haystack "${CardComponents}"
		Needle "cfg-dmics:"
	}
	True {
		Define.DeviceDmic "Mic1"
		Define.DeviceMic "Mic2"
		#
		# users expect to turn the LED on when only internal
		# mic is off, but it makes sense to turn this LED
		# when all internal inputs are off
		#
		Macro [{ SetLED { LED="mic" Action="detach" CtlId="Capture Switch" } }]
		FixedBootSequence [
			# dmic array info
			exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json"
		]
	}
}

SectionUseCase."HiFi" {
	File "/Intel/sof-hda-dsp/HiFi.conf"
	Comment "Play HiFi quality Music"
}

Include.hda-init.File "/HDA/init.conf"

If.DellMuteLed {
	Condition {
		Type String
		Haystack "$${sys:class/leds/platform::mute/device}"
		Needle "dell-laptop"
	}
	True.Macro [{ SetLED { LED="speaker" Action="detach" CtlId="Master Playback Switch" } }]
}

If.dmic {
	Condition {
		Type String
		Empty "${var:DeviceDmic}"
	}
	False.If.Dmic0 {
		Condition {
			Type ControlExists
			Control "name='Dmic0 Capture Volume'"
		}
		True {
			BootSequence [
				cset "name='Dmic0 Capture Volume' 70%"
				cset "name='Dmic0 Capture Switch' on"
			]
			Macro.Dmic0.SofEqBootSetup "endpoint='Dmic0' direction='Capture' eqtype='Iir'"
			Macro.Dmic0.SofDrcBootSetup "endpoint='Dmic0' direction='Capture'"
			Macro.Dmic0.SofBeamformerBootSetup "endpoint=Dmic0 direction='Capture'"
		}
	}
}

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

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

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