Revert "alsa: UCM conflicting devices changes"

If needs some more work

This reverts commit aae770f18b.
This reverts commit 2216956e05.
This reverts commit 1d3c4501ef.
This reverts commit c7ca024607.
This reverts commit 8e4a5f5d5e.
This reverts commit 8b20675ad1.
This reverts commit ebe6f8b51a.
This reverts commit 4b97da1277.
This reverts commit 7c46a656c7.
This reverts commit 96ed03e1fc.
This reverts commit 43770c533c.
This reverts commit ccb2fce054.
This reverts commit 93d0ddc8b3.
This reverts commit 815e8c8fa0.
This reverts commit 97b99a0f7c.
This reverts commit 7e4d87402b.
This reverts commit 168b3ee22c.
This reverts commit 5128cdba31.
This reverts commit 31cde774c5.
This reverts commit b02c8ba153.
This reverts commit 68ac72d098.
This reverts commit 96cfc9bc1a.
This reverts commit e2d642a20b.
This reverts commit 80fc80c343.
This reverts commit 3a68905c7c.
This reverts commit 7e64680a65.
This reverts commit 8d1e38a281.
This reverts commit 591188195c.
This reverts commit 973fe0cb79.
This reverts commit 4d08c9ad60.
This reverts commit 3dce92e580.
This reverts commit 6b5e232c5c.
This reverts commit b1286c62c9.
This commit is contained in:
Wim Taymans 2023-04-12 12:30:56 +02:00
parent 5fc782b893
commit a66d5b90f9
9 changed files with 635 additions and 930 deletions

View file

@ -362,7 +362,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
devstr, NULL, &m->sample_spec,
&m->channel_map, SND_PCM_STREAM_PLAYBACK,
&try_period_size, &try_buffer_size,
0, NULL, NULL, NULL, NULL, false))) {
0, NULL, NULL, false))) {
pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm);
pa_proplist_setf(m->output_proplist, "clock.name", "api.alsa.%u", index);
pa_alsa_close(&m->output_pcm);
@ -392,7 +392,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
devstr, NULL, &m->sample_spec,
&m->channel_map, SND_PCM_STREAM_CAPTURE,
&try_period_size, &try_buffer_size,
0, NULL, NULL, NULL, NULL, false))) {
0, NULL, NULL, false))) {
pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm);
pa_proplist_setf(m->input_proplist, "clock.name", "api.alsa.%u", index);
pa_alsa_close(&m->input_pcm);
@ -449,8 +449,8 @@ static void add_profiles(pa_card *impl)
pa_dynarray_append(&impl->out.devices, dev);
}
if (impl->use_ucm) {
if (m->ucm_context.ucm_device) {
pa_alsa_ucm_add_port(NULL, &m->ucm_context,
if (m->ucm_context.ucm_devices) {
pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context,
true, impl->ports, ap, NULL);
pa_alsa_ucm_add_ports(&dev->ports, m->proplist, &m->ucm_context,
true, impl, dev->pcm_handle, impl->profile_set->ignore_dB);
@ -473,8 +473,8 @@ static void add_profiles(pa_card *impl)
}
if (impl->use_ucm) {
if (m->ucm_context.ucm_device) {
pa_alsa_ucm_add_port(NULL, &m->ucm_context,
if (m->ucm_context.ucm_devices) {
pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context,
false, impl->ports, ap, NULL);
pa_alsa_ucm_add_ports(&dev->ports, m->proplist, &m->ucm_context,
false, impl, dev->pcm_handle, impl->profile_set->ignore_dB);
@ -608,7 +608,7 @@ struct temp_port_avail {
static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
{
pa_card *impl = snd_mixer_elem_get_callback_private(melem);
snd_hctl_elem_t **_elem = snd_mixer_elem_get_private(melem), *elem;
snd_hctl_elem_t *elem = snd_mixer_elem_get_private(melem);
snd_ctl_elem_value_t *elem_value;
bool plugged_in, any_input_port_available;
void *state;
@ -618,8 +618,6 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask)
enum acp_available active_available = ACP_AVAILABLE_UNKNOWN;
size_t size;
pa_assert(_elem);
elem = *_elem;
#if 0
/* Changing the jack state may cause a port change, and a port change will
* make the sink or source change the mixer settings. If there are multiple
@ -888,17 +886,13 @@ static pa_device_port* find_port_with_eld_device(pa_card *impl, int device)
static int hdmi_eld_changed(snd_mixer_elem_t *melem, unsigned int mask)
{
pa_card *impl = snd_mixer_elem_get_callback_private(melem);
snd_hctl_elem_t **_elem = snd_mixer_elem_get_private(melem), *elem;
int device;
snd_hctl_elem_t *elem = snd_mixer_elem_get_private(melem);
int device = snd_hctl_elem_get_device(elem);
const char *old_monitor_name;
pa_device_port *p;
pa_hdmi_eld eld;
bool changed = false;
pa_assert(_elem);
elem = *_elem;
device = snd_hctl_elem_get_device(elem);
if (mask == SND_CTL_EVENT_MASK_REMOVE)
return 0;
@ -1259,7 +1253,8 @@ static int setup_mixer(pa_card *impl, pa_alsa_device *dev, bool ignore_dB)
* will be NULL, but the UCM device enable sequence will still need to be
* executed. */
if (dev->active_port && dev->ucm_context) {
if ((res = pa_alsa_ucm_set_port(dev->ucm_context, dev->active_port)) < 0)
if ((res = pa_alsa_ucm_set_port(dev->ucm_context, dev->active_port,
dev->direction == PA_ALSA_DIRECTION_OUTPUT)) < 0)
return res;
}
@ -1434,7 +1429,8 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index, uint32_t fla
/* if UCM is available for this card then update the verb */
if (impl->use_ucm && !(np->profile.flags & ACP_PROFILE_PRO)) {
if ((res = pa_alsa_ucm_set_profile(&impl->ucm, impl,
np->profile.flags & ACP_PROFILE_OFF ? NULL : np, op)) < 0) {
np->profile.flags & ACP_PROFILE_OFF ? NULL : np->profile.name,
op ? op->profile.name : NULL)) < 0) {
return res;
}
}
@ -1443,8 +1439,8 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index, uint32_t fla
PA_IDXSET_FOREACH(am, np->output_mappings, idx) {
if (impl->use_ucm) {
/* Update ports priorities */
if (am->ucm_context.ucm_device) {
pa_alsa_ucm_add_port(am->output.ports, &am->ucm_context,
if (am->ucm_context.ucm_devices) {
pa_alsa_ucm_add_ports_combination(am->output.ports, &am->ucm_context,
true, impl->ports, np, NULL);
}
}
@ -1456,8 +1452,8 @@ int acp_card_set_profile(struct acp_card *card, uint32_t new_index, uint32_t fla
PA_IDXSET_FOREACH(am, np->input_mappings, idx) {
if (impl->use_ucm) {
/* Update ports priorities */
if (am->ucm_context.ucm_device) {
pa_alsa_ucm_add_port(am->input.ports, &am->ucm_context,
if (am->ucm_context.ucm_devices) {
pa_alsa_ucm_add_ports_combination(am->input.ports, &am->ucm_context,
false, impl->ports, np, NULL);
}
}
@ -1848,7 +1844,8 @@ int acp_device_set_port(struct acp_device *dev, uint32_t port_index, uint32_t fl
mixer_volume_init(impl, d);
sync_mixer(d, p);
res = pa_alsa_ucm_set_port(d->ucm_context, p);
res = pa_alsa_ucm_set_port(d->ucm_context, p,
dev->direction == ACP_DIRECTION_PLAYBACK);
} else {
pa_alsa_port_data *data;