Re: Sound on GPD's MicroPC?

From: Milan Obuch <freebsd-multimedia_at_dino.sk>
Date: Sat, 12 Mar 2022 12:43:52 UTC
On Sat, 12 Mar 2022 09:34:32 +0100 I wrote:

> Hi,
> 
> I am starting to work on MicroPC as a mobile platform. I managed to
> boot FreeBSD here, started X, built some ports etc. so it is working
> quite well for me.
> 
> Now I decided to try some multimedia - in another words, play some
> video. For this purpose I built multimedia/mlt7 port and it works
> nicely, albeit without sound. I am sure it has audio output, see
> 'pciconf -lv' excerpt:
> 
> hdac0@pci0:0:14:0:      class=0x040300 rev=0x06 hdr=0x00 vendor=0x8086
> device=0x3198 subvendor=0x10ec subdevice=0x0000 vendor     = 'Intel
> Corporation' device     = 'Celeron/Pentium Silver Processor High
> Definition Audio' class      = multimedia
>     subclass   = HDA
> 
> and in Windows, some sound is played as well.
> 
> I am not sure about the audio setup - I see some devices in /dev
> 
> crw-rw-rw-  1 root  wheel      0x25 Mar 12 09:10 midistat
> crw-rw-rw-  1 root  wheel      0x58 Mar 12 10:10 mixer0
> crw-rw-rw-  1 root  wheel      0x59 Mar 12 10:10 mixer1
> crw-rw-rw-  1 root  wheel      0x5a Mar 12 10:10 mixer2
> crw-rw-rw-  1 root  wheel      0x27 Mar 12 09:10 music0
> crw-rw-rw-  1 root  wheel      0x26 Mar 12 09:10 sequencer0
> 
> I think audio related... I can use mixer:
> 
> # mixer -f /dev/mixer0
> Mixer vol      is currently set to  85:85
> Mixer pcm      is currently set to 100:100
> Mixer speaker  is currently set to  74:74
> Mixer mic      is currently set to  67:67
> Mixer mix      is currently set to  74:74
> Mixer rec      is currently set to  37:37
> Mixer igain    is currently set to   0:0
> Mixer ogain    is currently set to 100:100
> Recording source: mic
> # mixer -f /dev/mixer1
> Mixer vol      is currently set to  85:85
> Mixer pcm      is currently set to 100:100
> Mixer rec      is currently set to  37:37
> Mixer igain    is currently set to   0:0
> Mixer monitor  is currently set to  67:67
> Recording source: monitor
> # mixer -f /dev/mixer2
> Mixer vol      is currently set to 100:100
> Mixer pcm      is currently set to 100:100
> 
> but that's it. No more ideas... well, just some status:
> 
> # cat /dev/sndstat
> Installed devices:
> pcm0: <Realtek ALC269 (Right Analog)> (play/rec) default
> pcm1: <Realtek ALC269 (Analog)> (play/rec)
> pcm2: <Intel Gemini Lake (HDMI/DP 8ch)> (play)
> No devices installed from userspace.
> 
> Any hints? For now, setting 'sysctl hw.snd.default_unit=2' allows me to
> play sound via HDMI, but I like to use internal speaker as well (and
> setting this sysctl to 0 or 1 does not produce sound).
> 
> Regards,
> Milan
> 

[ Follow-up to my mail ]

Additional info:

I tried headphone output jack as well, no sound with default_unit set
to either 0 or 1.

Output on console after issuing 'sysctl dev.hdac.0.pindump=1':

hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 18 b7a60140 4  0  Mic           Fixed Digital Lid-In     Unknown 1
hdaa0:     Caps: IN
hdaa0: 20 40000000 0  0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT    EAPD      Sense: 0x00000000 (disconnected)
hdaa0: 21 04211010 1  0  Headphones    Jack  1/8     Right      Black   0
hdaa0:     Caps:    OUT HP EAPD      Sense: 0x00000000 (disconnected)
hdaa0: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT
hdaa0: 24 04a11030 3  0  Mic           Jack  1/8     Right      Black   0
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 25 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 26 90170120 2  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0:     Caps: IN OUT HP      VREF Sense: 0x00000000 (disconnected)
hdaa0: 27 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0: NumGPIO=2 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa0:  GPIO0: disabled
hdaa0:  GPIO1: disabled
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1:  3 18560010 1  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa1:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa1: NumGPIO=0 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0

The same when headphones are connected:

hdaa0: Dumping AFG pins:
hdaa0: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa0: 18 b7a60140 4  0  Mic           Fixed Digital Lid-In     Unknown 1
hdaa0:     Caps: IN
hdaa0: 20 40000000 0  0  Line-out      None  Unknown 0x00       Unknown 0 DISA
hdaa0:     Caps:    OUT    EAPD      Sense: 0x00000000 (disconnected)
hdaa0: 21 04211010 1  0  Headphones    Jack  1/8     Right      Black   0
hdaa0:     Caps:    OUT HP EAPD      Sense: 0x80000000 (connected)
hdaa0: 23 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT
hdaa0: 24 04a11030 3  0  Mic           Jack  1/8     Right      Black   0
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 25 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 26 90170120 2  0  Speaker       Fixed Analog  Internal   Unknown 1
hdaa0:     Caps: IN OUT HP      VREF Sense: 0x00000000 (disconnected)
hdaa0: 27 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps: IN OUT         VREF Sense: 0x00000000 (disconnected)
hdaa0: 30 411111f0 15 0  Speaker       None  1/8     Rear       Black   1 DISA
hdaa0:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa0: NumGPIO=2 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
hdaa0:  GPIO0: disabled
hdaa0:  GPIO1: disabled
hdaa1: Dumping AFG pins:
hdaa1: nid   0x    as seq device       conn  jack    loc        color   misc
hdaa1:  3 18560010 1  0  Digital-out   Jack  Digital 0x18       Unknown 0
hdaa1:     Caps:    OUT              Sense: 0x00000000 (disconnected)
hdaa1: NumGPIO=0 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=0

This confirms nid 21 on hdaa0 is connected to headphones jack. It looks
like internal speaker should be nid 26, but question is what should I
configure here... no idea how to send sound output there, even after
some reading of 'man snd_hda'. Maybe I need more reading. 

Output of command 'sysctl dev.hdaa' is in attachment...

So, I need some kind of enlightement, what I should do, now.

Regards,
Milan