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

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

Merge "hal: audio_extn: enable speaker protection for wsa analog mono speaker"

parents e43ef22d be641abf
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -251,7 +251,7 @@ void audio_extn_fm_set_parameters(struct audio_device *adev,
                 * Currently, platform_get_wsa_mode will directly return
                 * Currently, platform_get_wsa_mode will directly return
                 * 1 when wsa is in analog mode.
                 * 1 when wsa is in analog mode.
                 */
                 */
                if (platform_get_wsa_mode(adev->platform) == 1) {
                if (platform_get_wsa_mode(adev) == 1) {
                    fm_stop(adev);
                    fm_stop(adev);
                    fm_start(adev);
                    fm_start(adev);
                } else {
                } else {
+6 −0
Original line number Original line Diff line number Diff line
@@ -925,6 +925,12 @@ void audio_extn_spkr_prot_init(void *adev)
    handle.spkr_prot_t0 = -1;
    handle.spkr_prot_t0 = -1;


    if (is_wsa_present()) {
    if (is_wsa_present()) {
        if (platform_get_wsa_mode(adev) == 1) {
            ALOGD("%s: WSA analog mode", __func__);
            platform_set_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_PROTECTED, 136);
            platform_set_snd_device_acdb_id(SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, 137);
            pcm_config_skr_prot.channels = 2;
        }
        pthread_cond_init(&handle.spkr_calib_cancel, NULL);
        pthread_cond_init(&handle.spkr_calib_cancel, NULL);
        pthread_cond_init(&handle.spkr_calibcancel_ack, NULL);
        pthread_cond_init(&handle.spkr_calibcancel_ack, NULL);
        pthread_mutex_init(&handle.mutex_spkr_prot, NULL);
        pthread_mutex_init(&handle.mutex_spkr_prot, NULL);
+2 −2
Original line number Original line Diff line number Diff line
@@ -486,7 +486,7 @@ int enable_snd_device(struct audio_device *adev,
    if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device)
    if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device)
       audio_extn_usb_start_capture(adev);
       audio_extn_usb_start_capture(adev);


    if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
    if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA ||
        snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
        snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
        audio_extn_spkr_prot_is_enabled()) {
        audio_extn_spkr_prot_is_enabled()) {
       if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
       if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
@@ -556,7 +556,7 @@ int disable_snd_device(struct audio_device *adev,
        if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device)
        if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device)
            audio_extn_usb_stop_capture();
            audio_extn_usb_stop_capture();


        if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
        if ((snd_device == SND_DEVICE_OUT_SPEAKER || snd_device == SND_DEVICE_OUT_SPEAKER_WSA ||
            snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
            snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
            audio_extn_spkr_prot_is_enabled()) {
            audio_extn_spkr_prot_is_enabled()) {
            audio_extn_spkr_prot_stop_processing(snd_device);
            audio_extn_spkr_prot_stop_processing(snd_device);
+4 −3
Original line number Original line Diff line number Diff line
@@ -4506,13 +4506,14 @@ done:
    return ret;
    return ret;
}
}


int platform_get_wsa_mode(void *platform)
int platform_get_wsa_mode(void *adev)
{
{
    struct platform_data *my_data = (struct platform_data *)platform;
    struct audio_device *adev_h = adev;
    char *snd_card_name;
    char *snd_card_name;


    snd_card_name = mixer_get_name(my_data->adev->mixer);
    snd_card_name = mixer_get_name(adev_h->mixer);
    if ((!strcmp(snd_card_name, "msm8952-skum-snd-card")) ||
    if ((!strcmp(snd_card_name, "msm8952-skum-snd-card")) ||
        (!strcmp(snd_card_name, "msm8952-snd-card")) ||
        (!strcmp(snd_card_name, "msm8952-snd-card-mtp")))
        (!strcmp(snd_card_name, "msm8952-snd-card-mtp")))
        return 1;
        return 1;
    else
    else
+1 −1
Original line number Original line Diff line number Diff line
@@ -1176,7 +1176,7 @@ int platform_set_spkr_device_tz_names(snd_device_t index,
    return -ENOSYS;
    return -ENOSYS;
}
}


int platform_get_wsa_mode(void *platform)
int platform_get_wsa_mode(void *adev)
{
{
    return 0;
    return 0;
}
}
Loading