Any suggestions are welcome, thank you.
I think they both use the same driver because here is the lspci output
x86:/ $ lspci -k
00:1f.5 Class 0101: 8086:3a06 ata_piix
00:19.0 Class 0200: 8086:10df e1000e
00:1e.0 Class 0604: 8086:244e
00:03.2 Class 0101: 8086:2e16 ata_generic
00:1f.3 Class 0c05: 8086:3a60 i801_smbus
00:00.0 Class 0600: 8086:2e10
00:1a.2 Class 0c03: 8086:3a69 uhci_hcd
00:03.0 Class 0780: 8086:2e14
00:1d.2 Class 0c03: 8086:3a66 uhci_hcd
00:1a.0 Class 0c03: 8086:3a67 uhci_hcd
00:1d.0 Class 0c03: 8086:3a64 uhci_hcd
01:00.1 Class 0403: 10de:0be2 snd_hda_intel
00:1a.7 Class 0c03: 8086:3a6c ehci-pci
00:1c.4 Class 0604: 8086:3a78 pcieport
00:1d.7 Class 0c03: 8086:3a6a ehci-pci
00:03.3 Class 0700: 8086:2e17 serial
00:1f.2 Class 0101: 8086:3a00 ata_piix
00:1c.0 Class 0604: 8086:3a70 pcieport
00:1a.1 Class 0c03: 8086:3a68 uhci_hcd
00:1f.0 Class 0601: 8086:3a1a lpc_ich
00:01.0 Class 0604: 8086:2e11 pcieport
00:1d.1 Class 0c03: 8086:3a65 uhci_hcd
01:00.0 Class 0300: 10de:0a22 nouveau
00:1b.0 Class 0403: 8086:3a6e snd_hda_intel
x86:/ $
-r--r--r-- 1 root root 0 2017-09-10 14:16 /proc/asound/cards
/proc/asound/card0:
total 0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#2
-r--r--r-- 1 root root 0 2017-09-10 14:16 id
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm0c
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm0p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm2c
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm3p
/proc/asound/card1:
total 0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#1
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#2
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#3
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#0.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#1.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#2.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#3.0
-r--r--r-- 1 root root 0 2017-09-10 14:16 id
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm3p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm7p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm8p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm9p
x86:/ $
alsa_aplay -Dhw:0,0 /sdcard/piano2.wav
So now I know that the card and drivers are working, even if the sound routing is wrong.
These two lines appear during boot
11-16 15:06:12.401 2291 2291 I audio_hw_primary: using pcmC0D0p from property
11-16 15:06:12.401 2291 2291 W audio_hw_primary: Unable to find the mixer
And these appear after boot when I kill the audioserver
11-16 15:10:37.540 4758 4758 I audio_hw_primary: using pcmC0D0p from property
11-16 15:10:37.540 4758 4758 I audioserver: type=1400 audit(0.0:641): avc: denied { write } for name="pcmC0D0p" dev="tmpfs" ino=6767 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
11-16 15:10:37.698 4758 4758 D audio_hw_primary: found audio out at /dev/snd/pcmC0D0p
11-16 15:10:37.698 4758 4758 D audio_hw_primary: card: 0/0 id: ALC663 Analog
11-16 15:10:37.698 4758 4758 D audio_hw_primary: name: ALC663 Analog
11-16 15:10:37.698 4758 4758 D audio_hw_primary: subname: subdevice #0
11-16 15:10:37.698 4758 4758 D audio_hw_primary: stream: 0
11-16 15:10:37.698 4758 4758 I audio_hw_primary: choose pcmC0D0p for 0
11-16 15:10:37.698 4758 4758 E audio_hw_primary: Failed to open /system/etc/mixer_paths.xml
11-16 15:10:37.698 4758 4758 I AudioFlinger: loadHwModule() Loaded primary audio interface from Grouper audio HW HAL (audio) handle 10
11-16 15:10:37.698 4758 4758 I audio_hw_primary: choose pcmC0D0p for 0
pkill audioserver
to the end of the init.sh just before return 0 line and now the correct card gets chosen after boot.
This is fine for me, but if anyone is interested in finding better solution, I'm willing to participate.
Yes, it seems so.
However, without deep analyzing how audio driver is initialized
it hard to say what happened.
Could you please get dmesg and lsmod?