I've updated a laptop Acer C720 from r342378 to r368166 and do not have any sound recording with the build-in micro anymore. I rebooted back on the same hardware to r342378 from an USB stick and the old kernel produces already noise in the speakers when I touch the micro hole in the keyboard, the new kernel does not produce any noise there. Both system have the same /boot/device.hints values: hint.hdaa.1.nid20.config="as=3 seq=0" hint.hdaa.1.nid25.config="as=2 seq=15" hint.hdaa.1.nid26.config="as=2 seq=14" hint.hdaa.1.nid33.config="as=3 seq=15" I booted both in verbose mode and the messages about 'pcm1' are identically (after removing the time stamps and system name from the lines in /var/log/messages). See below. Here are some more observations. The values are the same as on the older system: # cat /dev/sndstat Installed devices: pcm0: <Intel Haswell (HDMI/DP 8ch)> (play) pcm1: <Realtek ALC283 (Analog 2.0+HP/2.0)> (play/rec) default No devices installed from userspace. # ls -l /dev/mixer* crw-rw-rw- 1 root wheel 0x4b 9 dic. 10:52 /dev/mixer0 crw-rw-rw- 1 root wheel 0x4e 9 dic. 10:52 /dev/mixer1 # mixer -f /dev/mixer0 Mixer vol is currently set to 100:100 Mixer pcm is currently set to 100:100 # mixer -f /dev/mixer1 Mixer vol is currently set to 100:100 Mixer pcm is currently set to 100:100 Mixer speaker is currently set to 100:100 Mixer mic is currently set to 100:100 Mixer mix is currently set to 100:100 Mixer rec is currently set to 100:100 Mixer igain is currently set to 100:100 Mixer ogain is currently set to 100:100 Mixer monitor is currently set to 100:100 Recording source: mix (I also tested the other rec devices: speaker, mic, mix, monitor). And recording with 'rec' from ports/sox does not get any input: $ rec -c 2 /tmp/out.wavHere are the values (as on the older system): # cat /dev/sndstat Installed devices: pcm0: <Intel Haswell (HDMI/DP 8ch)> (play) pcm1: <Realtek ALC283 (Analog 2.0+HP/2.0)> (play/rec) default No devices installed from userspace. # ls -l /dev/mixer* crw-rw-rw- 1 root wheel 0x4b 9 dic. 10:52 /dev/mixer0 crw-rw-rw- 1 root wheel 0x4e 9 dic. 10:52 /dev/mixer1 # mixer -f /dev/mixer0 Mixer vol is currently set to 100:100 Mixer pcm is currently set to 100:100 # mixer -f /dev/mixer1 Mixer vol is currently set to 100:100 Mixer pcm is currently set to 100:100 Mixer speaker is currently set to 100:100 Mixer mic is currently set to 100:100 Mixer mix is currently set to 100:100 Mixer rec is currently set to 100:100 Mixer igain is currently set to 100:100 Mixer ogain is currently set to 100:100 Mixer monitor is currently set to 100:100 Recording source: mix (I also tested the other rec devices: speaker, mic, mix, monitor). And recording does not get any input: $ rec -c 2 /tmp/out.wav Input File : 'default' (ossdsp) Channels : 2 Sample Rate : 48000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM In:0.00% 00:00:07.34 [00:00:00.00] Out:348k [XXXXXX|XXXXXX] Clip:0 ^C Aborted. Where I put the XXXXXX normally indicators are moving according the level of the recorded noise. Nothing is there, only blanks. Input File : 'default' (ossdsp) Channels : 2 Sample Rate : 48000 Precision : 16-bit Sample Encoding: 16-bit Signed Integer PCM In:0.00% 00:00:07.34 [00:00:00.00] Out:348k [XXXXXX|XXXXXX] Clip:0 ^C Aborted. Where I put the XXXXXX normally indicators are moving according the level of the recorded noise. Nothing is there, only blanks. # diff pcm1.342378 pcm1.368166 # cat pcm1.368166 kernel: pcm1: <Realtek ALC283 (Analog 2.0+HP/2.0)> at nid 20,33 and 26,25 on hdaa1 kernel: pcm1: Playback: kernel: pcm1: Stream cap: 0x00000001 PCM kernel: pcm1: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz kernel: pcm1: DAC: 2 kernel: pcm1: kernel: pcm1: nid=20 [pin: Speaker (Fixed)] kernel: pcm1: + <- nid=12 [audio mixer] [src: pcm, mix] kernel: pcm1: + <- nid=2 [audio output] [src: pcm] kernel: pcm1: + <- nid=11 [audio mixer] [src: mix] kernel: pcm1: kernel: pcm1: nid=33 [pin: Headphones (Black Jack)] kernel: pcm1: + <- nid=12 [audio mixer] [src: pcm, mix] kernel: pcm1: + <- nid=2 [audio output] [src: pcm] kernel: pcm1: + <- nid=11 [audio mixer] [src: mix] kernel: pcm1: kernel: pcm1: Record: kernel: pcm1: Stream cap: 0x00000001 PCM kernel: pcm1: PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz kernel: pcm1: ADC: 8 kernel: pcm1: ADC: 9 kernel: pcm1: kernel: pcm1: nid=8 [audio input] kernel: pcm1: + <- nid=35 [audio mixer] [src: speaker, mic, mix, monitor] kernel: pcm1: + <- nid=25 [pin: Mic (Black Jack)] [src: mic] kernel: pcm1: + <- nid=26 [pin: Mic (Fixed)] [src: monitor] kernel: pcm1: + <- nid=29 [beep widget] [src: speaker] kernel: pcm1: + <- nid=11 [audio mixer] [src: mix] kernel: pcm1: kernel: pcm1: nid=9 [audio input] kernel: pcm1: + <- nid=34 [audio mixer] [src: speaker, mic, mix, monitor] kernel: pcm1: + <- nid=25 [pin: Mic (Black Jack)] [src: mic] kernel: pcm1: + <- nid=26 [pin: Mic (Fixed)] [src: monitor] kernel: pcm1: + <- nid=29 [beep widget] [src: speaker] kernel: pcm1: + <- nid=11 [audio mixer] [src: mix] kernel: pcm1: kernel: pcm1: Input Mix: kernel: pcm1: kernel: pcm1: nid=11 [audio mixer] kernel: pcm1: + <- nid=25 [pin: Mic (Black Jack)] [src: mic] kernel: pcm1: + <- nid=26 [pin: Mic (Fixed)] [src: monitor] kernel: pcm1: + <- nid=29 [beep widget] [src: speaker] kernel: pcm1: kernel: pcm1: Master Volume (OSS: vol): -65/0dB kernel: pcm1: +- ctl 1 (nid 2 out): -65/0dB (88 steps) kernel: pcm1: +- ctl 10 (nid 12 in 0): mute kernel: pcm1: +- ctl 11 (nid 12 in 1): mute kernel: pcm1: +- ctl 17 (nid 20 in ): mute kernel: pcm1: +- ctl 24 (nid 33 in ): mute kernel: pcm1: kernel: pcm1: PCM Volume (OSS: pcm): -65/0dB kernel: pcm1: +- ctl 1 (nid 2 out): -65/0dB (88 steps) kernel: pcm1: +- ctl 10 (nid 12 in 0): mute kernel: pcm1: kernel: pcm1: Microphone Volume (OSS: mic): 0/36dB kernel: pcm1: +- ctl 6 (nid 11 in 1): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 20 (nid 25 out): 0/36dB (4 steps) kernel: pcm1: +- ctl 26 (nid 34 in 1): mute kernel: pcm1: +- ctl 32 (nid 35 in 1): mute kernel: pcm1: kernel: pcm1: Microphone2 Volume (OSS: monitor): 0/36dB kernel: pcm1: +- ctl 7 (nid 11 in 2): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 21 (nid 26 out): 0/36dB (4 steps) kernel: pcm1: +- ctl 27 (nid 34 in 2): mute kernel: pcm1: +- ctl 33 (nid 35 in 2): mute kernel: pcm1: kernel: pcm1: Speaker/Beep Volume (OSS: speaker): -34/12dB kernel: pcm1: +- ctl 9 (nid 11 in 4): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 29 (nid 34 in 4): mute kernel: pcm1: +- ctl 35 (nid 35 in 4): mute kernel: pcm1: kernel: pcm1: Recording Level (OSS: rec): -17/30dB kernel: pcm1: +- ctl 3 (nid 8 in 0): -17/30dB (64 steps) + mute kernel: pcm1: +- ctl 4 (nid 9 in 0): -17/30dB (64 steps) + mute kernel: pcm1: +- ctl 26 (nid 34 in 1): mute kernel: pcm1: +- ctl 27 (nid 34 in 2): mute kernel: pcm1: +- ctl 29 (nid 34 in 4): mute kernel: pcm1: +- ctl 30 (nid 34 in 5): mute kernel: pcm1: +- ctl 32 (nid 35 in 1): mute kernel: pcm1: +- ctl 33 (nid 35 in 2): mute kernel: pcm1: +- ctl 35 (nid 35 in 4): mute kernel: pcm1: +- ctl 36 (nid 35 in 5): mute kernel: pcm1: kernel: pcm1: Input Mix Level (OSS: mix): -34/12dB kernel: pcm1: +- ctl 6 (nid 11 in 1): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 7 (nid 11 in 2): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 9 (nid 11 in 4): -34/12dB (32 steps) + mute kernel: pcm1: +- ctl 11 (nid 12 in 1): mute kernel: pcm1: +- ctl 30 (nid 34 in 5): mute kernel: pcm1: +- ctl 36 (nid 35 in 5): mute kernel: pcm1: kernel: pcm1: Input Monitoring Level (OSS: igain): 0/0dB kernel: pcm1: +- ctl 11 (nid 12 in 1): mute kernel: pcm1: kernel: pcm1: Mixer "vol": kernel: pcm1: Mixer "pcm": kernel: pcm1: Mixer "speaker": kernel: pcm1: Mixer "mic": kernel: pcm1: Mixer "mix": kernel: pcm1: Mixer "rec": kernel: pcm1: Mixer "igain": kernel: pcm1: Mixer "ogain": kernel: pcm1: Mixer "monitor": kernel: pcm1: Playback channel set is: Front Left, Front Right, kernel: pcm1: Playback channel matrix is: 2.0 (unknown) kernel: pcm1: Automatically set rec source to: monitor kernel: pcm1: Recording channel set is: Front Left, Front Right, kernel: pcm1: Recording channel matrix is: 2.0 (unknown) -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub _______________________________________________ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
I reverted the kernel source in the directory sys/dev/sound/pci/hda to r342378: $ cd /usr/src/sys/dev/sound/pci $ svn info hda Path: hda Working Copy Root Path: /usr/src URL: svn://svn.freebsd.org/base/head/sys/dev/sound/pci/hda Relative URL: ^/head/sys/dev/sound/pci/hda Repository Root: svn://svn.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 342378 Node Kind: directory Schedule: normal Last Changed Author: mav Last Changed Rev: 340071 Last Changed Date: 2018-11-02 18:02:10 +0100 (Fri, 02 Nov 2018) compiled and installed the kernel: $ uname -a FreeBSD c720-r368166 13.0-CURRENT FreeBSD 13.0-CURRENT #1 r342378:368166M: Fri Dec 11 07:46:32 CET 2020 guru@c720-r368166:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 and all is fine again as it was before. Someone with more knowledge should have a look into a 'svn diff -r342378:368166 sys/dev/sound/pci/hda' and see which of the changes might break the things.
The issue was reproduced by others on the same hardware Acer C720, see freebsd-current@
I have nailed down the problem and locally fixed it with this: # svn diff sys/dev/sound/pci/hda/hdaa.c Index: sys/dev/sound/pci/hda/hdaa.c =================================================================== --- sys/dev/sound/pci/hda/hdaa.c (revisión: 368166) +++ sys/dev/sound/pci/hda/hdaa.c (copia de trabajo) @@ -6598,6 +6598,7 @@ devinfo->newgpo = -1; callout_init(&devinfo->poll_jack, 1); devinfo->poll_ival = hz; + devinfo->init_clear = 1; /* added by guru@unixarea.de */ hdaa_lock(devinfo); res = hda_command(dev, because there seems to be no code to set devinfo->init_clear from the device.hints(5) file;
I added a few debug statements in hdaa.c and here is what gets logged (without the above change of setting devinfo->init_clear = 1) to messages: Dec 16 08:21:33 c720-r368166 kernel: hdaa0: DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() has devinfo->init_clear as: 0 Dec 16 08:21:33 c720-r368166 kernel: hdaa0: DEBUG hdaa.c: hdaa_attach() calls SYSCTL_ADD_INT() macro for init_clear Dec 16 08:21:33 c720-r368166 kernel: hdaa1: DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() has devinfo->init_clear as: 0 Dec 16 08:21:33 c720-r368166 kernel: hdaa1: DEBUG hdaa.c: hdaa_attach() calls SYSCTL_ADD_INT() macro for init_clear
I am no expert on the code, but I did test sbruno's patch from D17772 and verified that it helped my case. And I recall that he (at least) tried to make the clearing optional. The code contains(e.g): hdaa.c-6673- dev, 0, hdaa_sysctl_reconfig, "I", "Reprocess configuration"); hdaa.c-6674- SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), hdaa.c-6675- SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, hdaa.c:6676: "init_clear", CTLFLAG_RW, hdaa.c:6677: &devinfo->init_clear, 1,"Clear initial pin widget configuration"); hdaa.c-6678- bus_generic_attach(dev); hdaa.c-6679- return (0); hdaa.c-6680-} And checking, I find: g1-48(12.2-S)[2] sysctl dev.hdaa.{0,1}.init_clear dev.hdaa.0.init_clear: 0 dev.hdaa.1.init_clear: 0 So: What happens if you set the appropriate dev.hdaa.%d.init_clear to 1?
What happens is that the values have no effect: [guru@c720-r368166 ~]$ grep init_clear /boot/device.hints dev.hdaa.0.init_clear=1 dev.hdaa.1.init_clear=1 [guru@c720-r368166 ~]$ sysctl dev.hdaa.0.init_clear dev.hdaa.0.init_clear: 0 [guru@c720-r368166 ~]$ sysctl dev.hdaa.1.init_clear dev.hdaa.1.init_clear: 0 and if you look also in my DEBUG messages above, the code in hdacc.c in the test ... device_printf(devinfo->dev, "DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() has devinfo->init_clear as: %d\n", devinfo->init_clear); /* Disable everything. */ if (devinfo->init_clear) { device_printf(devinfo->dev, "DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() disables everything\n"); w->wclass.pin.ctrl &= ~( HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE | ... does not have any value !=0 in devinfo->init_clear;
(In reply to Matthias Apitz from comment #6) Hrm ... I have my settings in /etc/sysctl.conf I wonder if I've totally confused myself where these should be. I didn't call them "hints" so /boot/device.hints is not correct. Ugh ... the man page clearly states these are device.hints changes. Can you verify that moving them to /etc/sysctl.conf works for you?
(In reply to Sean Bruno from comment #7) moving the seetings to /etc/sysctl.conf sets them now correctly: [root@c720-r368166 /home/guru]# grep dev.hdaa. /etc/sysctl.conf dev.hdaa.0.init_clear=1 dev.hdaa.1.init_clear=1 [root@c720-r368166 /home/guru]# sysctl dev.hdaa.0.init_clear dev.hdaa.0.init_clear: 1 [root@c720-r368166 /home/guru]# sysctl dev.hdaa.1.init_clear dev.hdaa.1.init_clear: 1 but this has nothing todo with the clearing of the BIOS values, which is done (or not done) during the attach phase when the kernel boots up; as you see the value devinfo->init_clear in hdaa.c is checked *before* the root gets mounted (and /etc/sysctl.conf could have any affect): # egrep 'DEBUG|Root mount' /var/log/messages Dec 17 06:35:31 c720-r368166 kernel: hdaa0: DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() has devinfo->init_clear as: 0 Dec 17 06:35:31 c720-r368166 kernel: hdaa0: DEBUG hdaa.c: hdaa_attach() calls SYSCTL_ADD_INT() macro for init_clear Dec 17 06:35:31 c720-r368166 kernel: hdaa1: DEBUG hdaa.c: hdaa_audio_prepare_pin_ctrl() has devinfo->init_clear as: 0 Dec 17 06:35:31 c720-r368166 kernel: hdaa1: DEBUG hdaa.c: hdaa_attach() calls SYSCTL_ADD_INT() macro for init_clear Dec 17 06:35:31 c720-r368166 kernel: Root mount waiting for: usbus0 usbus1 CAM Dec 17 06:35:31 c720-r368166 kernel: Root mount waiting for: usbus0 usbus1 CAM Dec 17 06:35:31 c720-r368166 kernel: Root mount waiting for: CAM this can not be configured from sysctl.conf;
Sean, and I think that that was what I asked about here: https://reviews.freebsd.org/D17772#553549 sysctl.conf:dev.hdaa.0.init_clear=0 "worked" for you, because it seems that init_clear is always a zero on boot anyway. sysctl.conf:dev.hdaa.0.init_clear=1 wouldn't work for that reason. Also, another comment of mine: https://reviews.freebsd.org/D17772#553550
here is a proposal to fix this issue with values in device.hints(5) as: # grep init_clear /boot/device.hints hint.hdaa.0.init_clear=1 hint.hdaa.1.init_clear=1 # svn diff sys/dev/sound/pci/hda/hdaa.c Index: sys/dev/sound/pci/hda/hdaa.c =================================================================== --- sys/dev/sound/pci/hda/hdaa.c (revisión: 368166) +++ sys/dev/sound/pci/hda/hdaa.c (copia de trabajo) @@ -5031,6 +5031,11 @@ pincap = w->wclass.pin.cap; + /* default is "disable everything" */ + devinfo->init_clear = 1; + resource_int_value(device_get_name(devinfo->dev), + device_get_unit(devinfo->dev), "init_clear", + &(devinfo->init_clear)); /* Disable everything. */ if (devinfo->init_clear) { w->wclass.pin.ctrl &= ~( @@ -6671,10 +6676,6 @@ SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "reconfig", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, dev, 0, hdaa_sysctl_reconfig, "I", "Reprocess configuration"); - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, - "init_clear", CTLFLAG_RW, - &devinfo->init_clear, 1,"Clear initial pin widget configuration"); bus_generic_attach(dev); return (0); }
(In reply to Matthias Apitz from comment #10) This looks good to me.
Created attachment 220693 [details] patch against head to solve this PR (including man page snd_hda.4)
After my usual daily update on head (amd64) on my laptop (from r368756 to r368801), I applied the patch from attachment 220693 [details] (via "svn patch"), then rebuilt (world -- which was superfluous -- as well as kernel). On reboot, everything seems fine; sound still plays as it did before. I did not change anything in /etc/sysctl/conf or /boot/loader.conf or /boot/device.hints. So: works for me. This is on the Dell Precision M4800 that is described at https://wiki.freebsd.org/Laptops/Dell_Precision_M4800?highlight=%28\bCategoryLaptop\b%29 Reviewing a diff of the dmesg from verbose boots (before & after the change), I see a few different addresses for kernel modules and some slightly different timing numbers; I don't believe those are either "significant" or "issues." In particular, the pcm0 & pcm1 lines merely appear to had other things interspersed at different points: filtering the non-pcm lines out is not showing any difference that I spot by eye; here it is, in case it's useful: pcm0: <NVIDIA (0x0041) (HDMI/DP 8ch)> at nid 5 on hdaa0 pcm0: Playback: pcm0: Stream cap: 0x00000005 AC3 PCM pcm0: Mixer "vol" -> "none": child=0x00000010 pcm0: Mixer "pcm": parent="vol" pcm0: Soft PCM mixer ENABLED pcm0: Playback channel matrix is: unknown, assuming 7.1 (disconnected) pcm1: <NVIDIA (0x0041) (HDMI/DP 8ch)> at nid 7 on hdaa0 pcm1: Playback: pcm1: Stream cap: 0x00000005 AC3 PCM -pcm1: PCM cap: 0x000e07f0 16 20 24 bits, 32 44 48 88 96 176 192 KHz -pcm1: DAC: 9 -pcm1: -pcm1: nid=7 [pin: Digital-out (Jack)] -pcm1: + <- nid=9 [audio output] [src: pcm] -pcm1: -pcm1: Mixer "vol" -> "none": child=0x00000010 -pcm1: Mixer "pcm": parent="vol" -pcm1: Soft PCM mixer ENABLED +pcm1: PCM cap: 0x000e07f0 16 20 24 bits, 32 44 48 88 96 176 192 KHz +pcm1: DAC:battery0: units = 0 -pcm1: Playback channel matrix is: unknown, assuming 7.1 (disconnected) +pcm1: +pcm1: nid=7 [pin: Digital-out (Jack)] +pcm1: + <- nid=9 [audio output] [src: pcm] +pcm1: +pcm1: Mixer "vol" -> "none": child=0x00000010 +pcm1: Mixer "pcm": parent="vol" +pcm1: Soft PCM mixer ENABLED +pcm1: Playback channel matrix is: unknown, assuming 7.1 (disconnected)
I am willing to commit this patch. Can you please explain in a few lines why this works and what the underlying problem is?