CoreElec S/PDIF sound issue after CEC event

Hi CoreElec guys.
My environment:

  • Odroid n2+
  • Coreelec 9.2.8
  • Kodi 18.9

Description:
Using Odroid N2+ as sound source for JBL Cinema connected through Bluetooth or SPDIF OUT pin (GPIOA_13)
Odroid N2+ is connected to TV using HDMI, TV does not support HDMI-ARC, TV does support HDMI-CEC
using 5V SPDIF module, (PIN2,6,7)

Problem (use case):

  1. Booting/starting Coreelec on Odroid after full Power Off (12V )
  2. Sound output setting in Kodi menu ( ALSA: AML AUGESOUND, S/PDIF)
  3. Sound through SPDIF works well (when sound bar is switched ON by its remote)
  4. Switching OFF TV using TVs remote (+ Switching OFF JBL Sound Bar)
  5. Switching ON TV using TVs remote (+ Switching ON JBL Sound Bar)
  6. Sound through S/PDIF DOES NOT work at all (I have to switch manually to BT on JBL Soundbars remote), even I will try to change Kodi Sound output settings to HDMI and back to S/PDIF
  7. S/PDIF tranceiver state: SPDIF is ON, diode inside is ON/shining
  8. problem continues until next Coreelec reboot (after reboot SPDIF sound works well and state is back in step 1.)

my CEC settings:
CEC Wake-Up true
Auto power On true
Streamin Path True
Active route True

Module Size Used by
8021q 36864 0
ir_rc6_decoder 16384 0
ir_nec_decoder 16384 0
ir_lirc_codec 16384 0
lirc_dev 24576 1 ir_lirc_codec
meson_ir 16384 0
rc_core 36864 6 ir_rc6_decoder,ir_nec_decoder,ir_lirc_codec,meson_ir,lirc_dev
wireguard 139264 0
ip6_udp_tunnel 16384 1 wireguard
udp_tunnel 16384 1 wireguard
btusb 45056 0
btrtl 16384 1 btusb
btbcm 16384 1 btusb
btintel 20480 1 btusb
mali_kbase 499712 3
bluetooth 405504 31 btrtl,btintel,btbcm,btusb
wifi_dummy 16384 0
amvdec_vp9 126976 0
amvdec_vc1 69632 0
amvdec_real 45056 0
amvdec_ports 249856 0
v4l2_common 16384 1 amvdec_ports
videobuf2_dma_contig 20480 1 amvdec_ports
videobuf2_memops 16384 1 videobuf2_dma_contig
v4l2_mem2mem 28672 1 amvdec_ports
videobuf2_v4l2 28672 2 amvdec_ports,v4l2_mem2mem
videobuf2_core 49152 3 amvdec_ports,v4l2_mem2mem,videobuf2_v4l2
amvdec_mpeg4 65536 0
amvdec_mpeg12 110592 0
amvdec_mmpeg4 40960 0
amvdec_mmpeg12 49152 0
amvdec_mmjpeg 36864 0
amvdec_mjpeg 40960 0
amvdec_mh264 172032 0
amvdec_h265 159744 0
amvdec_h264mvc 57344 0
amvdec_h264 151552 0
amvdec_mavs 61440 0
amvdec_avs 69632 0
amvdec_avs2 212992 0
stream_input 208896 12 amvdec_h265,amvdec_mavs,amvdec_mh264,amvdec_h264mvc,amvdec_ports,amvdec_real,amvdec_vp9,amvdec_h264,amvdec_avs2,amvdec_mpeg12,amvdec_avs,amvdec_mmpeg12
decoder_common 196608 18 amvdec_h265,amvdec_mavs,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,amvdec_ports,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_avs2,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mmpeg12,amvdec_mpeg4
firmware 28672 18 amvdec_h265,amvdec_mavs,amvdec_mjpeg,amvdec_mh264,amvdec_mmpeg4,amvdec_h264mvc,amvdec_mmjpeg,decoder_common,amvdec_real,stream_input,amvdec_vp9,amvdec_h264,amvdec_avs2,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mmpeg12,amvdec_mpeg4
media_clock 45056 14 amvdec_h265,amvdec_mavs,amvdec_mh264,decoder_common,amvdec_ports,firmware,stream_input,amvdec_vp9,amvdec_h264,amvdec_avs2,amvdec_mpeg12,amvdec_avs,amvdec_vc1,amvdec_mpeg4
amlvideodri 24576 0
videobuf_res 16384 1 amlvideodri
videobuf_core 32768 2 amlvideodri,videobuf_res
videodev 286720 6 amlvideodri,v4l2_common,amvdec_ports,videobuf2_core,v4l2_mem2mem,videobuf2_v4l2
media 40960 1 videodev
fbcon 61440 0
bitblit 16384 1 fbcon
softcursor 16384 1 bitblit
font 20480 1 fbcon

Are you able to to help me a bit? Is it way how to hold optical output working without rebooting? I assume its software related issue.

Note: Solution bottom works for Coreelec 9.2.8 and 19.x too

Long OP, short answer:

Even if you found a bug, nobody will fix it.
Switchover to CE19, and if you see same issue, report back.

Hi again,
problem is identical with CoreElec 19.5 Matrix-rc.1, kernel 4.9.269, Kodi 19.4

After googling I have recognized that problem is in CEC, CEC forces
OS to sleep. Searching solution how to prevent OS to fall asleep by CEC.

Hi,
I have fixed problem by workaround.
Using knowhow from article ODroid C4 stop going to sleep - #3 by inversechi
(user Portisch, THX) I have tuned CEC settings to disable Odroid sleep when CEC command switches TV off.
KODI: Kodi->Settings->System->Input->Peripherials->CEC options
changed lines:

  1. When the TV is switched off → Ignore
  2. Devices to power off during shutdown → None

You can close this Thread. Problem is fixed by Kodi configuration update. It is not CoreElec bug.