mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-04-09 08:21:21 -04:00
alsa-ucm: Disable UCM devices when suspending
This might save some power, according to the discussion here: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/294#note_522388
This commit is contained in:
parent
738f64a133
commit
45cf9d61e7
4 changed files with 54 additions and 0 deletions
|
|
@ -954,6 +954,12 @@ static void suspend(struct userdata *u) {
|
|||
/* Close PCM device */
|
||||
close_pcm(u);
|
||||
|
||||
/* Disabling the UCM devices may save some power. */
|
||||
if (u->ucm_context) {
|
||||
pa_alsa_ucm_port_data *data = PA_DEVICE_PORT_DATA(u->source->active_port);
|
||||
pa_alsa_ucm_port_enable_devices(data, false);
|
||||
}
|
||||
|
||||
pa_log_info("Device suspended...");
|
||||
}
|
||||
|
||||
|
|
@ -1044,6 +1050,13 @@ static int unsuspend(struct userdata *u, bool recovering) {
|
|||
|
||||
pa_log_info("Trying resume...");
|
||||
|
||||
/* We disable all UCM devices when suspending, so let's enable them
|
||||
* again. */
|
||||
if (u->ucm_context) {
|
||||
pa_alsa_ucm_port_data *data = PA_DEVICE_PORT_DATA(u->source->active_port);
|
||||
pa_alsa_ucm_port_enable_devices(data, true);
|
||||
}
|
||||
|
||||
if ((err = snd_pcm_open(&u->pcm_handle, u->device_name, SND_PCM_STREAM_CAPTURE,
|
||||
SND_PCM_NONBLOCK|
|
||||
SND_PCM_NO_AUTO_RESAMPLE|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue