From 99c23d5b0ed1cb518e32aeddbf7e0e8e4bc6592f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 24 Sep 2024 13:14:17 +0200 Subject: [PATCH] acp: add api.alsa.disable-mixer-path Don't use the api.alsa.soft-mixer option to disable the path selection but make a new api.alsa.disable-mixer-path. Disabling the path selection might leave cards unusable after suspend, so a separate option is a better idea. See #4311 --- doc/dox/config/pipewire-props.7.md | 15 +++++++++++++-- spa/plugins/alsa/acp/acp.c | 10 ++++++---- spa/plugins/alsa/acp/card.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/doc/dox/config/pipewire-props.7.md b/doc/dox/config/pipewire-props.7.md index f49f3537a..ab25fe7af 100644 --- a/doc/dox/config/pipewire-props.7.md +++ b/doc/dox/config/pipewire-props.7.md @@ -668,8 +668,19 @@ This option does nothing if `api.alsa.use-acp` is set to `false`. @PAR@ device-prop api.alsa.soft-mixer = false # boolean Setting this option to `true` will disable the hardware mixer for volume control and mute. All volume handling will then use software volume and mute, -leaving the hardware mixer untouched. The hardware mixer will still be used -to mute unused audio paths in the device. +leaving the hardware mixer untouched. This can be interesting to work around +bugs in the mixer detection or decibel reporting. The hardware mixer will still +be used to mute unused audio paths in the device. Use `api.alsa.disable-mixer-path` +to also disable mixer path selection. + +@PAR@ device-prop api.alsa.disable-mixer-path = false # boolean +Setting this option to `true` will disable the hardware mixer path selection. +The hardware mixer path is the configuration of the mixer depending on the +jacks that are inserted in the card. If this is disabled, you will have to +manually enable and disable mixer controls but it can be used to work around +bugs in the mixer. The hardware mixer will still be used for +volume and mute. Use `api.alsa.soft-mixer` to also disable hardware volume +and mute. @PAR@ device-prop api.alsa.ignore-dB = false # boolean Setting this option to `true` will ignore the decibel setting configured by diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c index ecc7b598b..a3632cc7f 100644 --- a/spa/plugins/alsa/acp/acp.c +++ b/spa/plugins/alsa/acp/acp.c @@ -1377,7 +1377,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB) data = PA_DEVICE_PORT_DATA(dev->active_port); dev->mixer_path = data->path; - if (!impl->soft_mixer) + if (!impl->disable_mixer_path) pa_alsa_path_select(data->path, data->setting, dev->mixer_handle, dev->muted); } else { pa_alsa_ucm_port_data *data; @@ -1387,7 +1387,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB) /* Now activate volume controls, if any */ if (data->path) { dev->mixer_path = data->path; - if (!impl->soft_mixer) + if (!impl->disable_mixer_path) pa_alsa_path_select(dev->mixer_path, NULL, dev->mixer_handle, dev->muted); } } @@ -1397,7 +1397,7 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB) if (dev->mixer_path) { /* Hmm, we have only a single path, then let's activate it */ - if (!impl->soft_mixer) + if (!impl->disable_mixer_path) pa_alsa_path_select(dev->mixer_path, dev->mixer_path->settings, dev->mixer_handle, dev->muted); } else @@ -1662,6 +1662,8 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props) impl->use_ucm = spa_atob(s); if ((s = acp_dict_lookup(props, "api.alsa.soft-mixer")) != NULL) impl->soft_mixer = spa_atob(s); + if ((s = acp_dict_lookup(props, "api.alsa.disable-mixer-path")) != NULL) + impl->disable_mixer_path = spa_atob(s); if ((s = acp_dict_lookup(props, "api.alsa.ignore-dB")) != NULL) impl->ignore_dB = spa_atob(s); if ((s = acp_dict_lookup(props, "device.profile-set")) != NULL) @@ -1880,7 +1882,7 @@ static void sync_mixer(pa_alsa_device *d, pa_device_port *port) setting = data->setting; } - if (d->mixer_handle && !impl->soft_mixer) + if (d->mixer_handle && !impl->disable_mixer_path) pa_alsa_path_select(d->mixer_path, setting, d->mixer_handle, d->muted); if (d->set_mute) diff --git a/spa/plugins/alsa/acp/card.h b/spa/plugins/alsa/acp/card.h index c58f89abe..c1126fe23 100644 --- a/spa/plugins/alsa/acp/card.h +++ b/spa/plugins/alsa/acp/card.h @@ -44,6 +44,7 @@ struct pa_card { bool use_ucm; bool soft_mixer; + bool disable_mixer_path; bool auto_profile; bool auto_port; bool ignore_dB;