Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a09da007 authored by Meng Wang's avatar Meng Wang
Browse files

hal: close haptics PCM device during standby

Close haptics PCM device during haptics playback standby.

Change-Id: Ia22da049a246ee57bfde597696743369fe19fa87
parent 84aa1fea
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -4416,6 +4416,20 @@ static int out_standby(struct audio_stream *stream)
                pcm_close(out->pcm);
                out->pcm = NULL;
            }
            if (out->usecase == USECASE_AUDIO_PLAYBACK_WITH_HAPTICS) {
                if (adev->haptic_pcm) {
                    pcm_close(adev->haptic_pcm);
                    adev->haptic_pcm = NULL;
                }

                if (adev->haptic_buffer != NULL) {
                    free(adev->haptic_buffer);
                    adev->haptic_buffer = NULL;
                    adev->haptic_buffer_size = 0;
                }
                adev->haptic_pcm_device_id = 0;
            }

            if (out->usecase == USECASE_AUDIO_PLAYBACK_MMAP) {
                do_stop = out->playback_started;
                out->playback_started = false;