[alsa-devel] ASoC Multiple outputs
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
Reflowed formatting. Best to always CC maintainers too.
On Mon, 2015-07-13 at 07:39 +0000, Matt Redfearn wrote:
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.
This looks correct. You have a PCM for each device. The mixers should all be available for both PCMs unless there are mixer naming problems/collisions ?
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!
Best to use a single card if the audio HW is shared between HDMI and analog otherwise you could create separate cards if no audio HW is shared between either PCM.
Liam
Thanks! Matt _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Liam Girdwood
-
Matt Redfearn