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

Commit f30ef818 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hal: spk_prot: Update lock for v-validation and timestamp calculation"

parents d0d780d4 701704a9
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -935,6 +935,10 @@ static int spkr_calibrate(int t0_spk_1, int t0_spk_2)
        total_time = (handle.v_vali_wait_time + handle.v_vali_vali_time);
        ts.tv_sec += (total_time/1000);
        ts.tv_nsec += ((total_time%1000) * 1000000);
        if (ts.tv_nsec >= 1000000000) {
            ts.tv_nsec -= 1000000000;
            ts.tv_sec += 1;
        }
    }
    pthread_mutex_lock(&handle.mutex_spkr_prot);
    pthread_mutex_unlock(&adev->lock);
@@ -1748,12 +1752,14 @@ static void* spkr_v_vali_thread()
    if (!handle.v_vali_vali_time)
        handle.v_vali_vali_time = SPKR_V_VALI_DEFAULT_VALI_TIME;/*set default if not setparam */
    set_spkr_prot_v_vali_cfg(handle.v_vali_wait_time, handle.v_vali_vali_time);
    pthread_mutex_lock(&adev->lock);
    ret = spkr_calibrate(SPKR_V_VALI_TEMP_MASK,
                         SPKR_V_VALI_TEMP_MASK);/*use 0xfffe as temp to initiate v_vali*/
    pthread_mutex_unlock(&adev->lock);
    if (ret)
        ALOGE("%s: failed, retry again\n", __func__);
    pthread_exit(0);
    handle.trigger_v_vali = false;
    pthread_exit(0);
    return NULL;
}