Posts by LandLover

    This concerns playback of media on an Amlogic S905 device.

    Model: MXpro 4k

    CPU: AArch64 Processor rev 4 (aarch64)

    GPU: Mali-450 MP

    Audio output device: ALSA: Default (AML-M8AUDIO Analog)

    Number of channels: 2.0

    Installed software is LibreELEC 9.0.2, with the following audio codecs configured for passthrough:

    Dolby Digital (AC3)

    Dolby Digital Plus (E-AC3)

    DTS

    TrueHD

    DTS-HD

    The MXpro is connected through an HDMI cable to an audio receiver and from there to a television. Initially playback of media functions properly for a variety of different codecs. GUI sounds and playback of audio decoded to PCM (AAC for example) also work correctly.

    However after playing a sample containing Dolby Digital 5.1 or DTS 5.1 audio, the audio system is not reset properly and there are no GUI sounds or decoded PCM output. This does not occur for the "Dolby Digital Plus" or TrueHD codecs. And it only affects PCM audio, passthrough audio continues to function properly.

    - play PCM (sound), play DD5.1 (sound), play PCM (NO SOUND)

    - play PCM (sound), play DD+5.1 (sound), play PCM (sound)

    - play PCM (sound), play DTS5.1 (sound), play PCM (NO SOUND)

    - play PCM (sound), play TrueHD7.1 (sound), play PCM (sound)

    Media samples are ripped from BluRay or DVDs and reside on a local external driver or an NFS mount point. Playback is done via the file manager.

    In the function 'aml_hw_iec958_init' of source file 'aml_spdif_dai.c' the variable 'div' is uninitialized in some cases. After applying the proposed patch (attached at the end), all playback operates normally, all codecs, all sound all the time.

    Thank you for your consideration.

    --- a/sound/soc/aml/m8/aml_spdif_dai.c 2018-09-13 08:22:03.000000000 -0400

    +++ b/sound/soc/aml/m8/aml_spdif_dai.c 2019-06-11 16:37:50.088056626 -0400

    @@ -261,6 +261,7 @@

    if (runtime->rate == 192000 && runtime->channels == 8 && runtime->format == SNDRV_PCM_FORMAT_S16) {

    IEC958_mode_codec = 8; /* TrueHD/DTS-HD MA */

    pr_info("set 4x audio clk for 958\n");

    + div = 1;

    aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 0 << 4);

    } else if (runtime->rate == 192000 && runtime->channels == 2 && runtime->format == SNDRV_PCM_FORMAT_S16) {

    IEC958_mode_codec = 4; /* EAC3 */

    @@ -273,6 +274,7 @@

    } else if (runtime->rate == 48000 && runtime->channels == 2 && runtime->format == SNDRV_PCM_FORMAT_S16) {

    IEC958_mode_codec = 2; /* AC3/DTS */

    pr_info("set normal 512 fs /4 fs\n");

    + div = 4;

    aml_cbus_update_bits(AIU_CLK_CTRL, 3 << 4, 3 << 4);

    } else {

    IEC958_mode_codec = 0;