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

Commit b89f4164 authored by Aditya Bavanari's avatar Aditya Bavanari Committed by Gerrit - the friendly Code Review server
Browse files

hal: Reset HPH power mode to class AB for wcd9370 variant

As wcd9370 codec only supports Class AB HPH power mode,
reset the power mode for that variant

Change-Id: I791aad8447c89bf43e573f080f6c610c6c7c539b
parent e9023e2a
Loading
Loading
Loading
Loading
+17 −7
Original line number Original line Diff line number Diff line
@@ -300,6 +300,7 @@ struct platform_data {
    bool ec_ref_enabled;
    bool ec_ref_enabled;
    bool is_wsa_speaker;
    bool is_wsa_speaker;
    bool hifi_audio;
    bool hifi_audio;
    bool is_cls_ab_only_supported;
    bool is_i2s_ext_modem;
    bool is_i2s_ext_modem;
    bool is_acdb_initialized;
    bool is_acdb_initialized;
    /* Vbat monitor related flags */
    /* Vbat monitor related flags */
@@ -3238,7 +3239,6 @@ void *platform_init(struct audio_device *adev)
        my_data->hifi_audio = true;
        my_data->hifi_audio = true;
    set_platform_defaults(my_data);
    set_platform_defaults(my_data);



    /* Initialize ACDB ID's */
    /* Initialize ACDB ID's */
    if (my_data->is_i2s_ext_modem && !is_auto_snd_card(snd_card_name))
    if (my_data->is_i2s_ext_modem && !is_auto_snd_card(snd_card_name))
        platform_info_init(PLATFORM_INFO_XML_PATH_I2S, my_data, PLATFORM);
        platform_info_init(PLATFORM_INFO_XML_PATH_I2S, my_data, PLATFORM);
@@ -3743,6 +3743,11 @@ acdb_init_fail:
                                             my_data->adev->snd_card,
                                             my_data->adev->snd_card,
                                             my_data->codec_version);
                                             my_data->codec_version);


    /* WCD9370 codec variant only supports Class AB power mode */
    if (strstr(my_data->codec_variant, "WCD9370")) {
        my_data->is_cls_ab_only_supported = true;
    }

    if (NATIVE_AUDIO_MODE_INVALID != platform_get_native_support()) {
    if (NATIVE_AUDIO_MODE_INVALID != platform_get_native_support()) {
        /*
        /*
         * Native playback is enabled from the UI.
         * Native playback is enabled from the UI.
@@ -9230,6 +9235,10 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,


    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
    if (snd_device == SND_DEVICE_OUT_HEADPHONES || snd_device ==
        SND_DEVICE_OUT_HEADPHONES_44_1 || snd_device == SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER) {
        SND_DEVICE_OUT_HEADPHONES_44_1 || snd_device == SND_DEVICE_OUT_HEADPHONES_HIFI_FILTER) {
        if (my_data->is_cls_ab_only_supported) {
           ALOGI("%s: apply CLS AB HPH power mode\n", __func__);
           audio_route_apply_and_update_path(adev->audio_route, "hph-class-ab-mode");
        } else {
            if (sample_rate > 48000 ||
            if (sample_rate > 48000 ||
                (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
                (bit_width >= 24 && (sample_rate == 48000  || sample_rate == 44100))) {
                ALOGI("%s: apply HPH HQ mode\n", __func__);
                ALOGI("%s: apply HPH HQ mode\n", __func__);
@@ -9239,6 +9248,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
                audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
            }
            }
        }
        }
    }


    return backend_change;
    return backend_change;
}
}