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

Commit a5f32b42 authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat
Browse files

hal : fix miscellaneous errors

 fix for the following issues
 21746, 21753, 21754, 25319, 67407, 82922, 82923
 82924, 82926, 82929, 91098, 91100, 112335, 112336
 112337.
Change-Id: I66d3a18271a2212345f90f0be6f9cfbf6996fcc3
parent 86ed63f7
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -339,6 +339,9 @@ static int spkr_calibrate(int t0)
        }
    }
    uc_info_rx = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
    if (!uc_info_rx) {
        return -ENOMEM;
    }
    uc_info_rx->id = USECASE_AUDIO_SPKR_CALIB_RX;
    uc_info_rx->type = PCM_PLAYBACK;
    uc_info_rx->in_snd_device = SND_DEVICE_NONE;
@@ -368,6 +371,10 @@ static int spkr_calibrate(int t0)
    }
    uc_info_tx = (struct audio_usecase *)
    calloc(1, sizeof(struct audio_usecase));
    if (!uc_info_tx) {
        status.status = -ENOMEM;
        goto exit;
    }
    uc_info_tx->id = USECASE_AUDIO_SPKR_CALIB_TX;
    uc_info_tx->type = PCM_CAPTURE;
    uc_info_tx->in_snd_device = SND_DEVICE_IN_CAPTURE_VI_FEEDBACK;
@@ -812,6 +819,9 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device)
    snd_device = audio_extn_get_spkr_prot_snd_device(snd_device);
    spkr_prot_set_spkrstatus(true);
    uc_info_tx = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
    if (!uc_info_tx) {
        return -ENOMEM;
    }
    ALOGV("%s: snd_device(%d: %s)", __func__, snd_device,
           platform_get_snd_device_name(snd_device));
    audio_route_apply_and_update_path(adev->audio_route,
@@ -892,6 +902,7 @@ void audio_extn_spkr_prot_stop_processing(snd_device_t snd_device)
    }
    handle.spkr_processing_state = SPKR_PROCESSING_IN_IDLE;
    pthread_mutex_unlock(&handle.mutex_spkr_prot);
    if (adev)
        audio_route_reset_and_update_path(adev->audio_route,
                                      platform_get_snd_device_name(snd_device));
    ALOGV("%s: Exit", __func__);
+10 −1
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ int disable_audio_route(struct audio_device *adev,
    snd_device_t snd_device;
    char mixer_path[MIXER_PATH_MAX_LENGTH];

    if (usecase == NULL)
    if (usecase == NULL || usecase->id == USECASE_INVALID)
        return -EINVAL;

    ALOGV("%s: enter: usecase(%d)", __func__, usecase->id);
@@ -1600,6 +1600,8 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
    ALOGD("%s: enter: usecase(%d: %s) kvpairs: %s",
          __func__, out->usecase, use_case_table[out->usecase], kvpairs);
    parms = str_parms_create_str(kvpairs);
    if (!parms)
        goto error;
    err = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value));
    if (err >= 0) {
        val = atoi(value);
@@ -1676,6 +1678,7 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
    }

    str_parms_destroy(parms);
error:
    ALOGV("%s: exit: code(%d)", __func__, ret);
    return ret;
}
@@ -2167,6 +2170,8 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
    ALOGD("%s: enter: kvpairs=%s", __func__, kvpairs);
    parms = str_parms_create_str(kvpairs);

    if (!parms)
        goto error;
    pthread_mutex_lock(&in->lock);
    pthread_mutex_lock(&adev->lock);

@@ -2206,6 +2211,7 @@ done:
    pthread_mutex_unlock(&in->lock);

    str_parms_destroy(parms);
error:
    ALOGV("%s: exit: status(%d)", __func__, ret);
    return ret;
}
@@ -2683,6 +2689,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
    ALOGD("%s: enter: %s", __func__, kvpairs);
    parms = str_parms_create_str(kvpairs);

    if (!parms)
        goto error;
    ret = str_parms_get_str(parms, "SND_CARD_STATUS", value, sizeof(value));
    if (ret >= 0) {
        char *snd_card_status = value+2;
@@ -2785,6 +2793,7 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
done:
    str_parms_destroy(parms);
    pthread_mutex_unlock(&adev->lock);
error:
    ALOGV("%s: exit with code(%d)", __func__, status);
    return status;
}