[RESEND] Amlogic DPCM audio card(s) speaker placement issue

Christian Hewitt christianshewitt at gmail.com
Thu Dec 30 09:28:04 CET 2021


> On 26 Dec 2021, at 5:30 pm, Jaroslav Kysela <perex at perex.cz> wrote:
> 
> On 26. 12. 21 12:43, Christian Hewitt wrote:
> 
>> **** List of PLAYBACK Hardware Devices ****
>> card 0: LIBRETECHCC [LIBRETECH-CC], device 0: fe.dai-link-0 (*) []
>>  Subdevices: 1/1
>>  Subdevice #0: subdevice #0
> 
>> numid=12,iface=PCM,name='ELD',device=2
>> numid=11,iface=PCM,name='IEC958 Playback Default',device=2
>> numid=10,iface=PCM,name='IEC958 Playback Mask',device=2
>> numid=9,iface=PCM,name='Playback Channel Map',device=2
>> https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts#L136-L188
> 
> Have you tried to reorder the dai-link-# sections in DT? It appears to me that sound/soc/codecs/hdmi-codec.c / hdmi_codec_pcm_new() gets the internal PCM
> device rather than the exported PCM device for the user space.

I did a test reordering the nodes on the WP2 box like this:

        dai-link-0 {
                sound-dai = <&aiu AIU_HDMI CTRL_OUT>;

                codec-0 {
                        sound-dai = <&hdmi_tx>;
                };
        };

        dai-link-1 {
                sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
        };

        dai-link-2 {
                sound-dai = <&aiu AIU_CPU CPU_SPDIF_FIFO>;
        };

        dai-link-3 {
                sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
                dai-format = "i2s";
                mclk-fs = <256>;

                codec-0 {
                        sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
                };
        };

        dai-link-4 {
                sound-dai = <&aiu AIU_CPU CPU_SPDIF_ENCODER>;

                codec-0 {
                        sound-dai = <&spdif_dit>;
                };
        };

This gives output like:

WP2:~ # amixer controls
numid=5,iface=MIXER,name='AIU HDMI CTRL SRC'
numid=6,iface=MIXER,name='AIU SPDIF SRC SEL'
numid=4,iface=PCM,name='ELD'
numid=3,iface=PCM,name='IEC958 Playback Default'
numid=2,iface=PCM,name='IEC958 Playback Mask'
numid=1,iface=PCM,name='Playback Channel Map’

The “device=4” is gone, but also gone is the default PCM device:

WP2:~ # aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
iec958:CARD=WETEKPLAY2,DEV=0
    WETEK-PLAY2, 
    IEC958 (S/PDIF) Digital Audio Output

Assuming I did the changes above correctly? it looks like DAI order
matters and cannot be changed.

> If the DAI routing cannot be changed, then the hdmi-codec.c should be modified to export the correct device number for the user space:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/codecs/hdmi-codec.c?h=v5.16-rc6#n805


That’s some way beyond my limited kernel skills, so I will need to
phone friends and ask the audience for assistance :)

Christian



More information about the Alsa-devel mailing list