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

Commit 78ed0068 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Promotion of av-userspace.lnx.1.0-00047.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
975668   Ie121ea3e37697ee14e24d8ccd68c697c0220f0ab   hal: spkr_prot: read temperature once during calibration
978396   Ibe0f3639ac4825330a710e86abc31d609136c924   audiopolicy: do not set FM volume during device connecti
979685   Id1cc27db8ddbbdbf1dffc02c07ce7785b184770b   hal: Fix the device disable/enable sequence for capture

Change-Id: I925c58ffc5b9409492ce749eb0844d9c5494a1f7
CRs-Fixed: 979685, 978396, 975668
parents fdb6fa49 7d3cef31
Loading
Loading
Loading
Loading
+20 −70
Original line number Diff line number Diff line
@@ -66,9 +66,6 @@
#define MIN_RESISTANCE_SPKR_Q24 (2 * (1 << 24))
#define MAX_RESISTANCE_SPKR_Q24 (40 * (1 << 24))

/*Number of Attempts for WSA equilibrium t0 reads*/
#define NUM_ATTEMPTS 5

/*Path where the calibration file will be stored*/
#define CALIB_FILE "/data/misc/audio/audio.cal"

@@ -646,7 +643,6 @@ static void* spkr_calibration_thread()
    int i = 0;
    int t0_spk_1 = 0;
    int t0_spk_2 = 0;
    int t0_spk_prior = 0;
    bool goahead = false;
    struct audio_cal_info_spk_prot_cfg protCfg;
    FILE *fp;
@@ -769,30 +765,14 @@ static void* spkr_calibration_thread()
                   thermal_fd = -1;
                   thermal_fd = open(wsa_path, O_RDONLY);
                   if (thermal_fd > 0) {
                       for (i = 0; i < NUM_ATTEMPTS; i++) {
                            if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                       if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
                            t0_spk_1 = atoi(buf);
                                if (i > 0 && (t0_spk_1 != t0_spk_prior)) {
                                    ALOGE("%s: spkr1 curr temp: %d, prev temp: %d\n",
                                          __func__, t0_spk_1, t0_spk_prior);
                                    break;
                                }
                                t0_spk_prior = t0_spk_1;
                                pthread_mutex_unlock(&adev->lock);
                                sleep(1);
                                pthread_mutex_lock(&adev->lock);
                                if (is_speaker_in_use(&sec))
                                    break;
                            } else {
                       else
                           ALOGE("%s: read fail for %s err:%d\n", __func__, wsa_path, ret);
                               break;
                            }
                        }
                       close(thermal_fd);
                   } else {
                       ALOGE("%s: fd for %s is NULL\n", __func__, wsa_path);
                   }
                   if (i == NUM_ATTEMPTS) {
                   if (t0_spk_1 < TZ_TEMP_MIN_THRESHOLD ||
                       t0_spk_1 > TZ_TEMP_MAX_THRESHOLD) {
                       pthread_mutex_unlock(&adev->lock);
@@ -802,43 +782,20 @@ static void* spkr_calibration_thread()
                   ALOGD("%s: temp T0 for spkr1 %d\n", __func__, t0_spk_1);
                   /*Convert temp into q6 format*/
                   t0_spk_1 = (t0_spk_1 * (1 << 6));
                   } else {
                       ALOGV("%s: thermal equilibrium failed for spkr1 in %d/%d readings\n",
                                                __func__, i, NUM_ATTEMPTS);
                       pthread_mutex_unlock(&adev->lock);
                       sleep(WAKEUP_MIN_IDLE_CHECK);
                       continue;
                   }
               }
               if (spk_2_tzn >= 0) {
                   snprintf(wsa_path, MAX_PATH, TZ_WSA, spk_2_tzn);
                   ALOGV("%s: wsa_path: %s\n", __func__, wsa_path);
                   thermal_fd = open(wsa_path, O_RDONLY);
                   if (thermal_fd > 0) {
                       for (i = 0; i < NUM_ATTEMPTS; i++) {
                            if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                       if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
                           t0_spk_2 = atoi(buf);
                                if (i > 0 && (t0_spk_2 != t0_spk_prior)) {
                                    ALOGE("%s: spkr2 curr temp: %d, prev temp: %d\n",
                                          __func__, t0_spk_2, t0_spk_prior);
                                    break;
                                }
                                t0_spk_prior = t0_spk_2;
                                pthread_mutex_unlock(&adev->lock);
                                sleep(1);
                                pthread_mutex_lock(&adev->lock);
                                if (is_speaker_in_use(&sec))
                                    break;
                            } else {
                       else
                           ALOGE("%s: read fail for %s err:%d\n", __func__, wsa_path, ret);
                               break;
                            }
                        }
                       close(thermal_fd);
                   } else {
                       ALOGE("%s: fd for %s is NULL\n", __func__, wsa_path);
                   }
                   if (i == NUM_ATTEMPTS) {
                   if (t0_spk_2 < TZ_TEMP_MIN_THRESHOLD ||
                       t0_spk_2 > TZ_TEMP_MAX_THRESHOLD) {
                       pthread_mutex_unlock(&adev->lock);
@@ -848,13 +805,6 @@ static void* spkr_calibration_thread()
                   ALOGD("%s: temp T0 for spkr2 %d\n", __func__, t0_spk_2);
                   /*Convert temp into q6 format*/
                   t0_spk_2 = (t0_spk_2 * (1 << 6));
                   } else {
                       ALOGV("%s: thermal equilibrium failed for spkr2 in %d/%d readings\n",
                                                __func__, i, NUM_ATTEMPTS);
                       pthread_mutex_unlock(&adev->lock);
                       sleep(WAKEUP_MIN_IDLE_CHECK);
                       continue;
                   }
               }
           }
           pthread_mutex_unlock(&adev->lock);
+2 −1
Original line number Diff line number Diff line
@@ -754,7 +754,8 @@ static void check_and_route_capture_usecases(struct audio_device *adev,
                usecase != uc_info &&
                usecase->in_snd_device != snd_device &&
                ((uc_info->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) &&
                ((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND)) &&
                 (((usecase->devices & ~AUDIO_DEVICE_BIT_IN) & AUDIO_DEVICE_IN_ALL_CODEC_BACKEND) ||
                  (usecase->type == VOICE_CALL))) &&
                (usecase->id != USECASE_AUDIO_SPKR_CALIB_TX)) {
            ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
                  __func__, use_case_table[usecase->id],
+0 −3
Original line number Diff line number Diff line
@@ -291,9 +291,6 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d
               mPrimaryOutput->changeRefCount(AUDIO_STREAM_MUSIC, -1);
           }
           AudioParameter param = AudioParameter();
           float volumeDb = mPrimaryOutput->mCurVolume[AUDIO_STREAM_MUSIC];
           mPrevFMVolumeDb = volumeDb;
           param.addFloat(String8("fm_volume"), Volume::DbToAmpl(volumeDb));
           param.addInt(String8("handle_fm"), (int)newDevice);
           mpClientInterface->setParameters(mPrimaryOutput->mIoHandle, param.toString());
        }