sound: Expose EQ by default

The dev.pcm.%d.eq* sysctls and mixer "bass" and "treble" controls are
exposed only if hint.pcm.%d.eq is set. However, there is no good reason
why we shouldn't at least expose the controls, and let the user
enable/disable/bypass equalization through the sysctl.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Pull Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
This commit is contained in:
Christos Margiolis
2026-04-16 16:26:25 +02:00
parent 7bb6b62394
commit a0011c74f8
5 changed files with 7 additions and 32 deletions
-9
View File
@@ -197,9 +197,6 @@ The Parametric Software Equalizer (EQ) enables the use of
controls (bass and treble).
Commonly used for ear-candy or frequency compensation due to the vast
difference in hardware quality.
EQ is disabled by default, but can be enabled with the
.Va hint.pcm.%d.eq
tunable.
.Ss VCHANs
Each device can optionally support more playback and recording channels
than physical hardware provides by using
@@ -230,12 +227,6 @@ driver.
The following tunables can not be changed during runtime using
.Xr sysctl 8 .
.Bl -tag -width indent
.It Va hint.pcm.%d.eq
Set to 1 or 0 to explicitly enable (1) or disable (0) the equalizer.
Requires a driver reload if changed.
Enabling this will make bass and treble controls appear in mixer applications.
This tunable is undefined by default.
Equalizing is disabled by default.
.It Va hint.pcm.%d.vpc
Set to 1 or 0 to explicitly enable (1) or disable (0) the VPC feature.
This tunable is undefined by default.
+1 -1
View File
@@ -725,7 +725,7 @@ feeder_chain(struct pcm_channel *c)
/* Soft EQ only applicable for PLAY. */
if (cdesc.dummy == 0 &&
c->direction == PCMDIR_PLAY && (d->flags & SD_F_EQ) &&
c->direction == PCMDIR_PLAY && (d->flags & SD_F_EQ_ENABLED) &&
(((d->flags & SD_F_EQ_PC) &&
!(c->flags & CHN_F_HAS_VCHAN)) ||
(!(d->flags & SD_F_EQ_PC) && !(c->flags & CHN_F_VIRTUAL))))
+3 -14
View File
@@ -304,7 +304,7 @@ mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev)
if (dev == SOUND_MIXER_PCM && (d->flags & SD_F_SOFTPCMVOL))
(void)mixer_set_softpcmvol(m, d, l, r);
else if ((dev == SOUND_MIXER_TREBLE ||
dev == SOUND_MIXER_BASS) && (d->flags & SD_F_EQ))
dev == SOUND_MIXER_BASS) && (d->flags & SD_F_EQ_ENABLED))
(void)mixer_set_eq(m, d, dev, (l + r) >> 1);
else if (realdev != SOUND_MIXER_NONE &&
MIXER_SET(m, realdev, l, r) < 0) {
@@ -484,8 +484,7 @@ mix_setdevs(struct snd_mixer *m, u_int32_t v)
d = device_get_softc(m->dev);
if (d != NULL && (d->flags & SD_F_SOFTPCMVOL))
v |= SOUND_MASK_PCM;
if (d != NULL && (d->flags & SD_F_EQ))
v |= SOUND_MASK_TREBLE | SOUND_MASK_BASS;
v |= SOUND_MASK_TREBLE | SOUND_MASK_BASS;
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
if (m->parent[i] < SOUND_MIXER_NRDEVICES)
v |= 1 << m->parent[i];
@@ -706,15 +705,6 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
name = device_get_name(dev);
unit = device_get_unit(dev);
if (resource_int_value(name, unit, "eq", &val) == 0 &&
val != 0) {
snddev->flags |= SD_F_EQ;
if ((val & SD_F_EQ_MASK) == val)
snddev->flags |= val;
else
snddev->flags |= SD_F_EQ_DEFAULT;
snddev->eqpreamp = 0;
}
m = mixer_obj_create(dev, cls, devinfo, MIXER_TYPE_PRIMARY, NULL);
if (m == NULL)
@@ -762,8 +752,7 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
}
if (snddev->flags & SD_F_SOFTPCMVOL)
device_printf(dev, "Soft PCM mixer ENABLED\n");
if (snddev->flags & SD_F_EQ)
device_printf(dev, "EQ Treble/Bass ENABLED\n");
device_printf(dev, "EQ Treble/Bass ENABLED\n");
}
return (0);
+1 -2
View File
@@ -415,8 +415,7 @@ pcm_register(device_t dev, char *str)
"mode (1=mixer, 2=play, 4=rec. The values are OR'ed if more than "
"one mode is supported)");
vchan_initsys(dev);
if (d->flags & SD_F_EQ)
feeder_eq_initsys(dev);
feeder_eq_initsys(dev);
if (snd_unit_auto < 0)
snd_unit_auto = (snd_unit < 0) ? 1 : 0;
+2 -6
View File
@@ -105,17 +105,13 @@ struct snd_mixer;
#define SD_F_REGISTERED 0x00000020
#define SD_F_BITPERFECT 0x00000040
#define SD_F_VPC 0x00000080 /* volume-per-channel */
#define SD_F_EQ 0x00000100 /* EQ */
/* unused 0x00000100 */
#define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */
#define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */
#define SD_F_EQ_PC 0x00000800 /* EQ per-channel */
#define SD_F_PVCHANS 0x00001000 /* Playback vchans enabled */
#define SD_F_RVCHANS 0x00002000 /* Recording vchans enabled */
#define SD_F_EQ_DEFAULT (SD_F_EQ | SD_F_EQ_ENABLED)
#define SD_F_EQ_MASK (SD_F_EQ | SD_F_EQ_ENABLED | \
SD_F_EQ_BYPASSED | SD_F_EQ_PC)
#define SD_F_BITS "\020" \
"\001SIMPLEX" \
/* "\002 */ \
@@ -125,7 +121,7 @@ struct snd_mixer;
"\006REGISTERED" \
"\007BITPERFECT" \
"\010VPC" \
"\011EQ" \
/* "\011 */ \
"\012EQ_ENABLED" \
"\013EQ_BYPASSED" \
"\014EQ_PC" \