[alsa-devel] ASoC Multiple outputs

Matt Redfearn Matt.Redfearn at imgtec.com
Mon Jul 13 09:39:33 CEST 2015


Hi list,
I am writing an ALSA driver for an SoC / board which has a single I2S source. The source may be connected internally to either a codec outputting to analogue headphones, or to an HDMI transmitter.
At the moment I have set up two snd_soc_dai_link within the same card connecting the source to each sink. 

static struct snd_soc_dai_link ci20_dai_link[] = {
	{
		.name = "ci20",
		.stream_name = "headphones",
		.cpu_dai_name = "jz4780-i2s",
		.platform_name = "jz4780-i2s",
		.codec_dai_name = "jz4780-hifi",
		.codec_name = "jz4780-codec",
		.init = ci20_init,
		.ops = &ci20_audio_dai_ops,
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM,
	},
	{
		.name = "ci20 HDMI",
		.stream_name = "hdmi",
		.cpu_dai_name = "jz4780-i2s",
		.platform_name = "jz4780-i2s",
		.codec_dai_name = "dw-hdmi-hifi",
		.codec_name = "dw-hdmi-audio",
		.init = ci20_hdmi_init,
		.ops = &ci20_audio_dai_ops,
		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS,
	}
};

This works and creates 2 devices, and I am able to get mplayer to play sound out to either the headphones or HDMI using the argument "-ao alsa:device=hw=0.0" or "-ao alsa:device=hw=0.1"

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ci20 [ci20], device 0: headphones jz4780-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: ci20 [ci20], device 1: hdmi jz4780-hdmi-hifi-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

However, alsamixer does not show anything about the second device (HDMI), only the analogue output associated with device 0.
Please could someone advise what is the "correct" way to set up multiple links in such a system such that the headphones / HDMI outputs appear in the mixer and are available to pulseaudio. Should I create multiple cards? Should I create subdevices for the different outputs? If so, what structures should be set up within the driver to achieve this?
Suggestions of any documentation / websites that may help would be great!

Thanks!
Matt


More information about the Alsa-devel mailing list