common: Add quirk standby_set_route.

Some devices don't like to receive set_parameters() call while they
are in write(), even if it seems the mutexes are correctly in place.
Standby is another synchronization point which seems to work better.

[common] Add quirk standby_set_route. JB#53992
This commit is contained in:
Juho Hämäläinen 2021-05-05 16:01:03 +03:00
parent edec25347e
commit 446ac62a6e
3 changed files with 16 additions and 0 deletions

View file

@ -388,6 +388,13 @@ Currently there are following quirks:
writing audio too early will break the calibration. In these cases
this quirk can be enabled and 10 seconds of sleep is added after
opening hw module.
* standby_set_route
* Disabled by default.
* Some devices don't like to receive set_parameters() call while they
are in write(), even if it seems the mutexes are correctly in place.
Standby is another synchronization point which seems to work better.
If there are hiccups like long delays when setting route during
voice call start try enabling this quirk.
For example, to disable input_atoi and enable close_input quirks, use module
argument

View file

@ -88,6 +88,7 @@ struct droid_quirk valid_quirks[] = {
{ "output_fast", QUIRK_OUTPUT_FAST },
{ "output_deep_buffer", QUIRK_OUTPUT_DEEP_BUFFER },
{ "audio_cal_wait", QUIRK_AUDIO_CAL_WAIT },
{ "standby_set_route", QUIRK_STANDBY_SET_ROUTE },
};
#define QUIRK_AUDIO_CAL_WAIT_S (10)
@ -1915,6 +1916,13 @@ static int droid_output_stream_set_route(pa_droid_stream *s, audio_devices_t dev
if (slave == s)
continue;
if (pa_droid_quirk(s->module, QUIRK_STANDBY_SET_ROUTE)) {
/* Some devices don't like to receive set_parameters() call while they
* are in write(), even if it seems the mutexes are correctly in place.
* Standby is another synchronization point which seems to work better. */
slave->output->stream->common.standby(&slave->output->stream->common);
}
pa_log_debug("slave output stream %p set_parameters(%s)", (void *) slave, parameters);
ret = slave->output->stream->common.set_parameters(&slave->output->stream->common, parameters);

View file

@ -80,6 +80,7 @@ enum pa_droid_quirk_type {
QUIRK_OUTPUT_FAST,
QUIRK_OUTPUT_DEEP_BUFFER,
QUIRK_AUDIO_CAL_WAIT,
QUIRK_STANDBY_SET_ROUTE,
QUIRK_COUNT
};