Define.Speaker "Speaker"
Define.Mic "InternalMic"
Define.SST "yes"
Define.RightOutputChannel 1

If.Controls {
	Condition {
		Type ControlExists
		Control "name='media0_in Gain 0 Switch'"
	}
	False {
		Define.SST ""
		Define.RightOutputChannel 0
	}
}

# Figure out which components are in use on the device, we check both the
# components string (present on newer kernels) as well as checking for DMI
# strings for compatibility with older kernels. Note DMI matches for new
# models should only be added to the kernel, this UCM profile will then
# automatically pick up the info from the components string.

If.components-mono-spk {
	Condition {
		Type String
		Haystack "${CardComponents}"
		Needle "cfg-spk:1"
	}
	True.Define.Speaker "MonoSpeaker"
}

If.cfg-mspk {
	Condition {
		Type RegexMatch
		String "${CardLongName}"
		Regex "(cube-i1_TF|PIPO-W2S)"
	}
	True {
		Define.Speaker "MonoSpeaker"
	}
}

If.cfg-mic {
	Condition {
		Type RegexMatch
		String "${CardLongName}"
		# Medion E22??T models put DMIC in their product version
		# when using DMICs
		Regex "(MEDION-E22..T.*-DMIC-)"
	}
	True {
		Define.Mic "DMIC1_2"
	}
}

SectionVerb {

	Value {
		TQ "HiFi"
	}

	Include.e.File "/codecs/nau8824/EnableSeq.conf"

	If.SST {
		Condition {
			Type String
			Empty "${var:SST}"
		}
		False {
			Include.pe {
				File "/platforms/bytcr/PlatformEnableSeq.conf"
				Before.EnableSequence "0"
			}
			Include.pd.File "/platforms/bytcr/PlatformDisableSeq.conf"
		}
	}
}

# The includes using $vars in there path must be conditional otherwise the
# $var gets expanded before the other If-s above can change the vars.
If.cfg-includes {
	Condition { Type String Empty "" }
	True {
		Include.spk.File "/codecs/nau8824/${var:Speaker}.conf"
		Include.hp.File "/codecs/nau8824/HeadPhones.conf"

		Include.mic.File "/codecs/nau8824/${var:Mic}.conf"
		Include.hsmic.File "/codecs/nau8824/HeadsetMic.conf"
	}
}
