Bug 231004 - powerd causes click noises on RPi pcm audio using 12-CURRENT
Summary: powerd causes click noises on RPi pcm audio using 12-CURRENT
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Some People
Assignee: freebsd-arm (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-29 18:13 UTC by Bob Frazier
Modified: 2018-08-29 18:43 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Frazier 2018-08-29 18:13:01 UTC
when running powerd on an RPi model 2B, audible 'click' noises can be heard on the RPi pcm audio output (both channels simultaneously), loud enough to be disruptive.

However, these noises do not appear to happen when the CPU is sufficiently utilized, such as when playing a media file.  As such, it may have been happening for a long time but had gone unnoticed.

The CPU frequency changes from powerd appear to be the root cause.  Loading the BCM PWM kernel driver has no effect (whether present or absent in the kernel).

Steps to repro:
a)  run an application that opens the audio output (/dev/dsp0.0) but doesn't send any signals over it. [alternately you can leave it 'unopened' but noise may be more frequent this way if you have it open]

b) configure powerd to properly cycle the CPU frequency in rc.conf, and make sure it has been started with 'service powerd start'.

c) repeatedly enter 'sysctl hw.cpufreq' into a console, and observe frequency cycling and 'click noises' on the audio output.

d) stop powerd with 'service powerd stop'.

e) repeat 'c' except no noise.

f) rinse/repeat as needed to confirm


my settings for powerd are:
powerd_enable="YES"
powerd_flags="-n hadp -a hadp -b hadp"

uname output:
FreeBSD pi2c 12.0-ALPHA2 FreeBSD 12.0-ALPHA2 #16 r338208: Wed Aug 22 15:06:45 PDT 2018     bobf@hack.SFT.local:/e-drive/obj.current/e-drive/src.current/arm.armv7/sys/RPI2  arm

running processes:
PID TT  STAT     TIME COMMAND
  0  -  DLs   0:00.02 [kernel]
  1  -  SLs   0:00.08 /sbin/init --
  2  -  DL    0:00.00 [crypto]
  3  -  DL    0:00.00 [crypto returns 0]
  4  -  DL    0:00.00 [crypto returns 1]
  5  -  DL    0:00.00 [crypto returns 2]
  6  -  DL    0:00.00 [crypto returns 3]
  7  -  DL    0:00.00 [cam]
  8  -  SL    0:13.08 [VCHIQ-0]
  9  -  SL    0:01.25 [VCHIQr-0]
 10  -  RNL  79:00.98 [idle]
 11  -  WL    0:17.34 [intr]
 12  -  DL    0:00.30 [geom]
 13  -  DL    0:04.82 [usb]
 14  -  IL    0:00.00 [VCHIQs-0]
 15  -  DL    0:00.00 [sctp_iterator]
 16  -  DL    0:00.70 [rand_harvestq]
 17  -  DL    0:00.00 [soaiod1]
 18  -  DL    0:00.00 [soaiod2]
 19  -  DL    0:00.00 [soaiod3]
 20  -  DL    0:00.00 [soaiod4]
 21  -  DL    0:00.16 [mmcsd0: mmc/sd card]
 22  -  IL    0:00.00 [VCHIQka-0]
 23  -  SL    0:03.78 [bcm2835_audio_worke]
 24  -  DL    0:00.75 [pagedaemon]
 25  -  DL    0:00.00 [vmdaemon]
 26  -  DL    0:00.45 [bufdaemon]
 27  -  DL    0:00.04 [vnlru]
 28  -  DL    0:00.25 [syncer]
442  -  Is    0:00.02 dhclient: system.syslog (dhclient)
445  -  Is    0:00.02 dhclient: ue0 [priv] (dhclient)
491  -  Is    0:00.00 dhclient: ue0 (dhclient)
492  -  Is    0:00.01 /sbin/devd
562  -  Ss    0:00.07 /usr/sbin/syslogd -s
773  -  Is    0:00.02 /usr/sbin/sshd
777  -  Ss    0:00.07 /usr/sbin/cron -s
836  -  Is    0:00.18 sshd: ME [priv] (sshd)
839  -  I     0:00.07 sshd: ME@pts/0 (sshd)
971  -  Ss    0:00.00 /usr/sbin/powerd -n hadp -a hadp -b hadp
835 u0  Is    0:00.19 login [pam] (login)
852 u0  S     0:00.71 -csh (csh)
974 u0  R+    0:00.02 ps ax
827 v0  Is+   0:00.03 /usr/libexec/getty Pc ttyv0
828 v1  Is+   0:00.02 /usr/libexec/getty Pc ttyv1
829 v2  Is+   0:00.03 /usr/libexec/getty Pc ttyv2
830 v3  Is+   0:00.02 /usr/libexec/getty Pc ttyv3
831 v4  Is+   0:00.03 /usr/libexec/getty Pc ttyv4
832 v5  Is+   0:00.02 /usr/libexec/getty Pc ttyv5
833 v6  Is+   0:00.04 /usr/libexec/getty Pc ttyv6
834 v7  Is+   0:00.02 /usr/libexec/getty Pc ttyv7
840  0  Is    0:00.22 -csh (csh)
849  0  S+    5:47.71 ./ethermidi -F /home/bobf/mysounds.sf2 0.0.0.0:5000


NOTE:  the 'ethermidi' application is one that I'm working on; it opens the audio output and idles waiting for MIDI commands over ethernet, and invokes libfluidsynth to play the MIDI sounds via 'oss'.  It's not the noise source since this doesn't happen on other platforms with the same application.  However, it does reveal that there IS a noise source.