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

Commit 0de16784 authored by Bharath Ramachandramurthy's avatar Bharath Ramachandramurthy Committed by Gerrit - the friendly Code Review server
Browse files

hal: fix listen and audio calibration concurency

- ACDB loader is maintaining the same calibration buffers
for both listen and audio. So there is a possibility that
the audio calibration buffers may be overwritten with listen
calibration soon after notifying the device busy state to
listen hal
- Avoid this issue by notifying listen hal before sending the
audio calibration so that listen hal can complete pushing its
calibration

Change-Id: I4d954b1287b59ee4e1510707db25f466d14dca97
parent 87f0102b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -329,13 +329,16 @@ int enable_snd_device(struct audio_device *adev,
    } else {
        ALOGV("%s: snd_device(%d: %s)", __func__,
        snd_device, device_name);
        /* due to the possibility of calibration overwrite between listen
            and audio, notify listen hal before audio calibration is sent */
        audio_extn_listen_update_status(snd_device,
                       LISTEN_EVENT_SND_DEVICE_BUSY);
        if (platform_send_audio_calibration(adev->platform, snd_device) < 0) {
            adev->snd_dev_ref_cnt[snd_device]--;
            audio_extn_listen_update_status(snd_device,
                           LISTEN_EVENT_SND_DEVICE_FREE);
            return -EINVAL;
        }
        audio_extn_listen_update_status(snd_device,
                LISTEN_EVENT_SND_DEVICE_BUSY);

        audio_route_apply_path(adev->audio_route, device_name);
    }
    if (update_mixer)