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

Commit 7ae9bdde authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 2cbabd4e b89f4164
Loading
Loading
Loading
Loading
+17 −7
Original line number Original line Diff line number Diff line
@@ -302,6 +302,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;
    bool ec_car_state;
    bool ec_car_state;
@@ -3253,7 +3254,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);
@@ -3758,6 +3758,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.
@@ -9469,6 +9474,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__);
@@ -9478,6 +9487,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;
}
}