[Samsung Galaxy A3, A5, A7 (2017) ROMs, Kernels, Re] Intelensprotient:
What is your--

LineageOS version: 14.1

LineageOS Download url: https://www.androidfilehost.com/?fid=961840155545590372

Gapps version: None

Did you--

wipe: No

restore with titanium backup: No

reboot after having the issue: Yes

Are you using--

a task killer: No

a non-stock kernel: No

other modifications: ViPER4Android by now, but the bug is present without it

The speaker doesn't work for me from the start (for no kind of playback, and the lack of ringer / notification sounds is disconcerting). The open audio driver you supplied before (latest in this thread, 371520B vs 104916B that came with the ROM) changes nothing about it. (Rest of the sound sources still work, though.) This is the result of adb logcat upon playing a single sound (just a UI click):

10-11 16:09:33.930 2499 2536 V audio_hw_primary: start_output_stream: enter: usecase(0: playback) devices(0x2) channels(2)
10-11 16:09:33.930 2499 2536 V audio_hw_primary: select_devices: usecase(0)
10-11 16:09:33.930 2499 2536 V audio_hw_primary: get_output_snd_device: enter: output devices(0x2), mode(0)
10-11 16:09:33.930 2499 2536 V audio_hw_primary: get_output_snd_device: exit: snd_device(speaker)
10-11 16:09:33.930 2499 2536 V audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
10-11 16:09:33.931 2499 2536 V audio_hw_primary: enable_snd_device: snd_device(2: speaker)
10-11 16:09:33.931 2499 2536 I audio_route: > audio_route_apply_path : "speaker"
10-11 16:09:33.931 2499 2536 V audio_hw_amplifier: speaker_amp_set_mode: enter
10-11 16:09:33.931 2499 2536 I audio_route: > audio_route_update_mixer : +
10-11 16:09:33.931 2499 2536 I audio_route: > audio_route_update_mixer : changed(0) -
10-11 16:09:33.931 2499 2536 V audio_hw_primary: out_open_pcm_devices: Opening PCM device card_id(0) device_id(0)
10-11 16:09:33.998 2499 2536 V audio_hw_amplifier: get_audio_mode: audio_mode music
10-11 16:09:33.998 2499 2536 V audio_hw_amplifier: tfa_power: Enabling amplifier device
10-11 16:09:33.998 2499 2536 D tfa98xxApp: [NXP] [MAR 28, 2017] tfa_enable: turning tfa on
10-11 16:09:33.998 2499 2536 D tfa98xxApp: [NXP] tfa_enable: tfa_i2c_dev_name = /dev/i2c-20, tfa_i2c_speed = 0 kbps, tfa_log_enable_cnt = 20, tfa_log_coldboot_cnt = 1
10-11 16:09:33.998 2499 2536 D tfa98xxApp: [NXP] tfa_enable: coldstartup_flag = 1
10-11 16:09:33.998 2499 2536 D tfa98xxApp: [NXP] tfa_enable: check speakerOn(0) && (tfaMode(0) == prev_tfaMode(0))
10-11 16:09:33.999 2499 2536 D tfa98xxApp: [NXP] tfa_iscoldboot: Loaded container file /system/etc/Tfa9896.cnt.
10-11 16:09:33.999 2499 2536 D tfa_usrdrv: [NXP] tfaRunIsCold: status reg = 0x001c
10-11 16:09:33.999 2499 2536 D tfa98xxApp: [NXP] tfa_enable: warm boot
10-11 16:09:33.999 2499 2536 D tfa98xxApp: [NXP] tfa_enable: ic stable time 80 ms
10-11 16:09:34.080 2499 2536 D tfa98xxApp: [NXP] tfa_enable: Tfa mode would be switched. prev = 0, current = 0
10-11 16:09:34.080 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: begin
10-11 16:09:34.080 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: set mode 0, current mode 0
10-11 16:09:34.080 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: Loaded container file speaker_on /system/etc/Tfa9896.cnt.
10-11 16:09:34.080 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: tfa start with volume 0.
10-11 16:09:34.082 2499 2536 D tfa_dsp : tfaRunMute: -------------------- muted --------------------
10-11 16:09:34.082 2499 2536 D tfa_container: tfaContWriteRegsProf: ----- profile: HQ (0) -----
10-11 16:09:34.083 2499 2536 D tfa_dsp : tfa_cf_powerup: power on (PWDN=0)
10-11 16:09:34.095 2499 2536 D tfa_dsp : [NXP] tfa_start: status = 0xd05e (after power up)
10-11 16:09:34.105 2499 2536 D tfa_dsp : tfaRunUnmute: -------------------unmuted ------------------
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: start usecase success
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: tfa mode same, nothing to be done
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: tfa start use case success
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_speakeron: end
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_enable: tfaVolume : 0
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_setvolumestep: begin
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_setvolumestep: tfa setvolume - leftvolume(0) rightvolume(0) tfa_mode(0)
10-11 16:09:34.105 2499 2536 D tfa98xxApp: [NXP] tfa_setvolumestep: volume set to : 0
10-11 16:09:34.105 2499 2536 D tfa_usrdrv: [NXP] tfaContVstepMapping: vstep mapping vstep(0) -> vstep_in_cnt(0)
10-11 16:09:34.105 2499 2536 D tfa_container: [NXP] tfaContWriteFile: begin
10-11 16:09:34.105 2499 2536 D tfa_container: [NXP] tfaContWriteFile: type = vstep (device = 0, slave 0x34)
10-11 16:09:34.105 2499 2536 D tfa_container: [NXP] tfaContWriteVstep: set volume attenuation VOL = 0 (-0.0 dB)
10-11 16:09:34.105 2499 2536 D tfa_dsp : tfa98xx_dsp_write_preset: write preset size=87
10-11 16:09:34.111 2499 2536 D tfa_container: [NXP] tfaContWriteFile: end
10-11 16:09:34.111 2499 2536 D tfa98xxApp: [NXP] tfa_setvolumestep: tfa set volume successful
10-11 16:09:34.111 2499 2536 D tfa98xxApp: [NXP] tfa_setvolumestep: end
10-11 16:09:34.112 2499 2536 D tfa_usrdrv: [NXP] tfa_show_status_device: /dev/i2c-20 0x34, device = 0, status = 0xd05e, WDS = 0, ACS = 0, CHSA = 2, DCA = 1, CHS12 = 3, SWS = 1, PLLS = 1, SBSL = 1, RCV = 0, INPLVL = 0, PWDN = 0, re0 = 0x1752 (5.8301 ohm)
10-11 16:09:34.112 2499 2536 D tfa98xxApp: [NXP] tfa_enable: end
10-11 16:09:34.112 2499 2536 V audio_hw_primary: start_output_stream: exit
10-11 16:09:37.258 2499 2536 V audio_hw_primary: out_standby: enter: usecase(0: playback)
10-11 16:09:37.260 2499 2536 V audio_hw_primary: stop_output_stream: enter: usecase(0: playback)
10-11 16:09:37.260 2499 2536 V audio_hw_amplifier: tfa_power: Disabling amplifier device
10-11 16:09:37.260 2499 2536 D tfa98xxApp: [NXP] tfa_enable: turning tfa off
10-11 16:09:37.260 2499 2536 D tfa98xxApp: [NXP] tfa_speakeroff: begin
10-11 16:09:37.260 2499 2536 D tfa98xxApp: [NXP] tfa_speakeroff: Loaded container file speaker_off /system/etc/Tfa9896.cnt.
10-11 16:09:37.261 2499 2536 D tfa_dsp : tfa_stop: device = 0, Stopping device [Left]
10-11 16:09:37.261 2499 2536 D tfa_dsp : [NXP] tfa_stop : device = 0, status = 0xd05e stop1 (running)
10-11 16:09:37.262 2499 2536 D tfa_dsp : [NXP] tfa_stop : device = 0, status = 0x021c stop2 (soft mute)
10-11 16:09:37.263 2499 2536 D tfa_dsp : tfaRunMute: -------------------- muted --------------------
10-11 16:09:37.264 2499 2536 D tfa_dsp : [NXP] tfa_stop : device = 0, status = 0x001c stop3 (mute amp)
10-11 16:09:37.264 2499 2536 D tfa_dsp : tfa98xx_powerdown: power off (PWDN=1)
10-11 16:09:37.265 2499 2536 D tfa_dsp : [NXP] tfa_stop : device = 0, status = 0x001c stop4 (power down)
10-11 16:09:37.265 2499 2536 D tfa_dsp : [NXP] tfa_stop : device = 0, status = 0x001c stop5
10-11 16:09:37.265 2499 2536 D tfa98xxApp: [NXP] tfa_speakeroff: device goes to stop success
10-11 16:09:37.265 2499 2536 D tfa98xxApp: [NXP] tfa_speakeroff: end
10-11 16:09:37.265 2499 2536 D tfa98xxApp: [NXP] tfa_enable: end
10-11 16:09:37.266 2499 2536 V audio_hw_primary: disable_snd_device: snd_device(2: speaker)
10-11 16:09:37.266 2499 2536 I audio_route: > audio_route_update_mixer : +
10-11 16:09:37.266 2499 2536 I audio_route: > audio_route_update_mixer : changed(4) -
10-11 16:09:37.266 2499 2536 V audio_hw_primary: stop_output_stream: exit: status(0)
10-11 16:09:37.266 2499 2536 V audio_hw_primary: out_standby: exit

It also noticed that it was complaining about this originally:

10-11 15:41:24.314 2536 2536 I AudioOut_D: type=1400 audit(0.0:284): avc: denied { ioctl } for path="/dev/i2c-20" dev="tmpfs" ino=11589 ioctlcmd=703 scontext=u:r:audioserver:s0 tcontext=u:object_r:i2c_device:s0 tclass=chr_file permissive=1

Got rid of that message with chmod 666 /dev/i2c-20 but that didn't change anything about the problem as such.

Also, you should probably mention that the library needs to be set to mode 644 and owned by root:root, otherwise sound won't work at all. That's probably a mistake some people made when testing.