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

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

Merge "hal: Send temperature initialization mixer control" into audio-hal.lnx.4.0

parents 17cffe87 46991d48
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -1007,6 +1007,7 @@ static void* spkr_calibration_thread()
    int ret;
    bool spv3_enable = false;
    unsigned int afe_api_version = 0;
    struct mixer_ctl *ctl;

    memset(&protCfg, 0, sizeof(protCfg));
    /* If the value of this persist.vendor.audio.spkr.cal.duration is 0
@@ -1114,9 +1115,18 @@ static void* spkr_calibration_thread()
           }
           if (goahead) {
               if (spk_1_tzn >= 0) {
                   const char *mixer_ctl_name = "SpkrLeft WSA T0 Init";
                   snprintf(wsa_path, MAX_PATH, TZ_WSA, spk_1_tzn);
                   ALOGV("%s: wsa_path: %s\n", __func__, wsa_path);
                   thermal_fd = -1;

                   ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
                   if (ctl) {
                       ALOGD("%s: Got ctl for mixer cmd %s",
                                             __func__, mixer_ctl_name);
                       mixer_ctl_set_value(ctl, 0, 1);
                   }

                   thermal_fd = open(wsa_path, O_RDONLY);
                   if (thermal_fd > 0) {
                       if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
@@ -1127,6 +1137,9 @@ static void* spkr_calibration_thread()
                   } else {
                       ALOGE("%s: fd for %s is NULL\n", __func__, wsa_path);
                   }
                   if (ctl) {
                       mixer_ctl_set_value(ctl, 0, 0);
                   }
                   if (t0_spk_1 < TZ_TEMP_MIN_THRESHOLD ||
                       t0_spk_1 > TZ_TEMP_MAX_THRESHOLD) {
                       pthread_mutex_unlock(&adev->lock);
@@ -1138,8 +1151,15 @@ static void* spkr_calibration_thread()
                   t0_spk_1 = (t0_spk_1 * (1 << 6));
               }
               if (spk_2_tzn >= 0) {
                   const char *mixer_ctl_name = "SpkrRight WSA T0 Init";
                   snprintf(wsa_path, MAX_PATH, TZ_WSA, spk_2_tzn);
                   ALOGV("%s: wsa_path: %s\n", __func__, wsa_path);
                   ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
                   if (ctl) {
                       ALOGD("%s: Got ctl for mixer cmd %s",
                                             __func__, mixer_ctl_name);
                       mixer_ctl_set_value(ctl, 0, 1);
                   }
                   thermal_fd = open(wsa_path, O_RDONLY);
                   if (thermal_fd > 0) {
                       if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
@@ -1150,6 +1170,9 @@ static void* spkr_calibration_thread()
                   } else {
                       ALOGE("%s: fd for %s is NULL\n", __func__, wsa_path);
                   }
                   if (ctl) {
                       mixer_ctl_set_value(ctl, 0, 0);
                   }
                   if (t0_spk_2 < TZ_TEMP_MIN_THRESHOLD ||
                       t0_spk_2 > TZ_TEMP_MAX_THRESHOLD) {
                       pthread_mutex_unlock(&adev->lock);