#
# Configuration for HDMI
#

<confdir:pcm/hdmi.conf>

simple-card.pcm.hdmi."hdmi-sound" "cards.simple-card.pcm.hdmi.HDMI"
simple-card.pcm.hdmi."rockchip_tinker-codec" "cards.simple-card.pcm.hdmi.HDMI"

simple-card.pcm.hdmi."HDMI" {
	@args [ CARD DEVICE AES0 AES1 AES2 AES3 ]
	@args.CARD { type string }
	@args.DEVICE { type integer }
	@args.AES0 { type integer }
	@args.AES1 { type integer }
	@args.AES2 { type integer }
	@args.AES3 { type integer }
	type hooks
	slave.pcm {
		type hw
		card $CARD
		device $DEVICE
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{
				interface PCM
				name "IEC958 Playback Default"
				lock true
				preserve true
				optional true
				value [ $AES0 $AES1 $AES2 $AES3 ]
			}
		]
	}
	hint.device $DEVICE
}

simple-card.pcm.hdmi.0 {
	@args [ CARD AES0 AES1 AES2 AES3 ]
	@args.CARD { type string }
	@args.AES0 { type integer }
	@args.AES1 { type integer }
	@args.AES2 { type integer }
	@args.AES3 { type integer }
	@func refer
	name {
		@func concat
		strings [
			"cards.simple-card.pcm.hdmi."
			{ @func card_name card $CARD }
			":CARD=" $CARD ","
			"DEVICE=0,"
			"AES0=" $AES0 ","
			"AES1=" $AES1 ","
			"AES2=" $AES2 ","
			"AES3=" $AES3
		]
	}
	default {
		# point to non-existent device
		card $CARD
		device 999
		hint.device 999
	}
}

#
# Configuration for SPDIF
#

<confdir:pcm/iec958.conf>

simple-card.pcm.iec958."SPDIF" {
	@args [ CARD DEVICE AES0 AES1 AES2 AES3 ]
	@args.CARD { type string }
	@args.DEVICE { type integer }
	@args.AES0 { type integer }
	@args.AES1 { type integer }
	@args.AES2 { type integer }
	@args.AES3 { type integer }
	type hooks
	slave.pcm {
		type hw
		card $CARD
		device $DEVICE
	}
	hooks.0 {
		type ctl_elems
		hook_args [
			{
				interface PCM
				name "IEC958 Playback Default"
				lock true
				preserve true
				optional true
				value [ $AES0 $AES1 $AES2 $AES3 ]
			}
		]
	}
	hint.device $DEVICE
}

simple-card.pcm.iec958.0 {
	@args [ CARD AES0 AES1 AES2 AES3 ]
	@args.CARD { type string }
	@args.AES0 { type integer }
	@args.AES1 { type integer }
	@args.AES2 { type integer }
	@args.AES3 { type integer }
	@func refer
	name {
		@func concat
		strings [
			"cards.simple-card.pcm.iec958."
			{ @func card_name card $CARD }
			":CARD=" $CARD ","
			"DEVICE=0,"
			"AES0=" $AES0 ","
			"AES1=" $AES1 ","
			"AES2=" $AES2 ","
			"AES3=" $AES3
		]
	}
	default {
		# point to non-existent device
		card $CARD
		device 999
		hint.device 999
	}
}

simple-card.pcm.iec958.1 {
	@args [ CARD AES0 AES1 AES2 AES3 ]
	@args.CARD { type string }
	@args.AES0 { type integer }
	@args.AES1 { type integer }
	@args.AES2 { type integer }
	@args.AES3 { type integer }
	@func refer
	name {
		@func concat
		strings [
			"cards.simple-card.pcm.iec958."
			{ @func card_name card $CARD }
			":CARD=" $CARD ","
			"DEVICE=0,"
			"AES0=" $AES0 ","
			"AES1=" $AES1 ","
			"AES2=" $AES2 ","
			"AES3=" $AES3
		]
	}
	default {
		# point to non-existent device
		card $CARD
		device 999
		hint.device 999
	}
}

#
# Configuration for Analog/I2S
#

<confdir:pcm/front.conf>

simple-card.pcm.front."I2S" "cards.simple-card.pcm.front.Analog"

simple-card.pcm.front."Analog" {
	@args [ CARD DEVICE ]
	@args.CARD { type string }
	@args.DEVICE { type integer }
	type hw
	card $CARD
	hint.device $DEVICE
}

simple-card.pcm.front.0 {
	@args [ CARD ]
	@args.CARD { type string }
	@func refer
	name {
		@func concat
		strings [
			"cards.simple-card.pcm.front."
			{ @func card_name card $CARD }
			":CARD=" $CARD ","
			"DEVICE=0"
		]
	}
	default {
		# point to non-existent device
		card $CARD
		device 999
		hint.device 999
	}
}
