git: 8511a14eb0cf - stable/15 - sound: Retire FEEDEQ_BYPASS
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 Jun 2026 08:23:14 UTC
The branch stable/15 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=8511a14eb0cf3bc78fe8436f14bd01f760f923ec
commit 8511a14eb0cf3bc78fe8436f14bd01f760f923ec
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-04-17 14:45:40 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-06-03 08:22:22 +0000
sound: Retire FEEDEQ_BYPASS
In effect, this is the same as the disable state. There is a comment
that says the bypass state skips EQ altogether, which is what the
disable should be. The disable state according to the comment disables
EQ but keeps the EQ preamp (dev.pcm.%d.eq_preamp), however after testing
it seems that the preamp does not really take effect, because with EQ
disabled, feeder_eq is non existent, so we never execute any EQ code in
the first place.
Make things simpler and clearer and have 2 states; enable and disable,
and do what they should do intuitively.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/15
(cherry picked from commit 54a03b44ae386e26d29df6eece3fadb5c0d1105a)
---
sys/dev/sound/pcm/channel.c | 4 +---
sys/dev/sound/pcm/feeder.h | 1 -
sys/dev/sound/pcm/feeder_eq.c | 26 +++++++-------------------
sys/dev/sound/pcm/sound.h | 4 ++--
4 files changed, 10 insertions(+), 25 deletions(-)
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index c1e0d8d3bc52..be6d7f82f502 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2209,9 +2209,7 @@ chn_syncstate(struct pcm_channel *c)
device_printf(c->dev,
"EQ: Failed to set preamp -- %d\n",
d->eqpreamp);
- if (d->flags & SD_F_EQ_BYPASSED)
- state = FEEDEQ_BYPASS;
- else if (d->flags & SD_F_EQ_ENABLED)
+ if (d->flags & SD_F_EQ_ENABLED)
state = FEEDEQ_ENABLE;
else
state = FEEDEQ_DISABLE;
diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h
index e1e91d468455..7d14022c6849 100644
--- a/sys/dev/sound/pcm/feeder.h
+++ b/sys/dev/sound/pcm/feeder.h
@@ -122,7 +122,6 @@ enum {
FEEDEQ_STATE,
FEEDEQ_DISABLE,
FEEDEQ_ENABLE,
- FEEDEQ_BYPASS,
FEEDEQ_UNKNOWN
};
diff --git a/sys/dev/sound/pcm/feeder_eq.c b/sys/dev/sound/pcm/feeder_eq.c
index 4cf9d4f6695f..8f3acbf4e156 100644
--- a/sys/dev/sound/pcm/feeder_eq.c
+++ b/sys/dev/sound/pcm/feeder_eq.c
@@ -334,8 +334,7 @@ feed_eq_set(struct pcm_feeder *f, int what, int value)
info->preamp = FEEDEQ_PREAMP2IDX(value);
break;
case FEEDEQ_STATE:
- if (!(value == FEEDEQ_BYPASS || value == FEEDEQ_ENABLE ||
- value == FEEDEQ_DISABLE))
+ if (!(value == FEEDEQ_ENABLE || value == FEEDEQ_DISABLE))
return (EINVAL);
info->state = value;
feed_eq_reset(info);
@@ -370,13 +369,7 @@ feed_eq_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b,
info = f->data;
- /*
- * 3 major states:
- * FEEDEQ_BYPASS - Bypass entirely, nothing happened.
- * FEEDEQ_ENABLE - Preamp+biquad filtering.
- * FEEDEQ_DISABLE - Preamp only.
- */
- if (info->state == FEEDEQ_BYPASS)
+ if (info->state == FEEDEQ_DISABLE)
return (FEEDER_FEED(f->source, c, b, count, source));
dst = b;
@@ -482,9 +475,7 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS)
PCM_LOCK(d);
PCM_WAIT(d);
- if (d->flags & SD_F_EQ_BYPASSED)
- val = 2;
- else if (d->flags & SD_F_EQ_ENABLED)
+ if (d->flags & SD_F_EQ_ENABLED)
val = 1;
else
val = 0;
@@ -495,18 +486,15 @@ sysctl_dev_pcm_eq(SYSCTL_HANDLER_ARGS)
err = sysctl_handle_int(oidp, &val, 0, req);
if (err == 0 && req->newptr != NULL && val != oval) {
- if (!(val == 0 || val == 1 || val == 2)) {
+ if (!(val == 0 || val == 1)) {
PCM_RELEASE_QUICK(d);
return (EINVAL);
}
PCM_LOCK(d);
- d->flags &= ~(SD_F_EQ_ENABLED | SD_F_EQ_BYPASSED);
- if (val == 2) {
- val = FEEDEQ_BYPASS;
- d->flags |= SD_F_EQ_BYPASSED;
- } else if (val == 1) {
+ d->flags &= ~(SD_F_EQ_ENABLED);
+ if (val == 1) {
val = FEEDEQ_ENABLE;
d->flags |= SD_F_EQ_ENABLED;
} else
@@ -612,7 +600,7 @@ feeder_eq_initsys(device_t dev)
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
"eq", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, d,
sizeof(d), sysctl_dev_pcm_eq, "I",
- "Bass/Treble Equalizer (0=disable, 1=enable, 2=bypass)");
+ "Bass/Treble Equalizer (0=disable, 1=enable)");
(void)snprintf(buf, sizeof(buf), "Bass/Treble Equalizer Preamp "
"(-/+ %d.0dB , %d.%ddB step)",
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 7f89c1d14df1..06de95e461ec 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -104,7 +104,7 @@ struct snd_mixer;
#define SD_F_VPC 0x00000080 /* volume-per-channel */
/* unused 0x00000100 */
#define SD_F_EQ_ENABLED 0x00000200 /* EQ enabled */
-#define SD_F_EQ_BYPASSED 0x00000400 /* EQ bypassed */
+/* unused 0x00000400 */
#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 */
@@ -120,7 +120,7 @@ struct snd_mixer;
"\010VPC" \
/* "\011 */ \
"\012EQ_ENABLED" \
- "\013EQ_BYPASSED" \
+ /* "\013 */ \
"\014EQ_PC" \
"\015PVCHANS" \
"\016RVCHANS"