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

Commit b6f729ae authored by xsang's avatar xsang
Browse files

hal: fix noise at device switch on holi

In case of single backend native clock for speaker and headphones,
force routing from speaker-and-headphones to headphones at native
clock is neither necessary nor correct. Keep the original backend
configuration to avoid force routing.

Change-Id: Id907bb90f6f0bd90621a03165ec8c8001d54871a
parent c1411665
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -9826,7 +9826,7 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
    struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
    struct audio_device_config_param *adev_device_cfg_ptr = adev->device_cfg_params;
    int controller = -1;
    int controller = -1;
    int stream = -1;
    int stream = -1;
    bool combo_in_use = false;
    /*BT devices backend is not configured from HAL hence skip*/
    /*BT devices backend is not configured from HAL hence skip*/
    if (snd_device == SND_DEVICE_OUT_BT_A2DP ||
    if (snd_device == SND_DEVICE_OUT_BT_A2DP ||
@@ -9941,6 +9941,9 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                uc = node_to_item(node, struct audio_usecase, list);
                uc = node_to_item(node, struct audio_usecase, list);
                struct stream_out *curr_out =
                struct stream_out *curr_out =
                    (struct stream_out*) uc->stream.out;
                    (struct stream_out*) uc->stream.out;
                if (check_hdset_combo_device(uc->out_snd_device) &&
                        spkr_hph_single_be_native_concurrency)
                    combo_in_use = true;
                /*if native audio playback
                /*if native audio playback
                * is active then it will take priority
                * is active then it will take priority
@@ -9949,9 +9952,15 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                    if (is_offload_usecase(uc->id) &&
                    if (is_offload_usecase(uc->id) &&
                        (curr_out->sample_rate % OUTPUT_SAMPLING_RATE_44100 == 0)) {
                        (curr_out->sample_rate % OUTPUT_SAMPLING_RATE_44100 == 0)) {
                        ALOGD("%s:napb:native stream detected %d sampling rate", __func__, curr_out->sample_rate);
                        ALOGD("%s:napb:native stream detected %d sampling rate", __func__, curr_out->sample_rate);
                        if (combo_in_use && spkr_hph_single_be_native_concurrency) {
                            ALOGE("%s: native playback loses priority due to spkr_hph_single_be.\n",
                                    __func__);
                        } else {
                            ALOGI("%s: native sample rate activates.\n", __func__);
                            sample_rate = curr_out->sample_rate;
                            sample_rate = curr_out->sample_rate;
                        }
                        }
                    }
                    }
                }
                /* WCD9380 support SR upto 192Khz only, hence reset
                /* WCD9380 support SR upto 192Khz only, hence reset
                 * SR > 192Khz to 192Khz.
                 * SR > 192Khz to 192Khz.
@@ -10010,10 +10019,11 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
        /*set sample rate to 48khz if multiple sample rates are not supported in spkr and hdset*/
        /*set sample rate to 48khz if multiple sample rates are not supported in spkr and hdset*/
        if (is_hdset_combo_device(&usecase->device_list) &&
        if (is_hdset_combo_device(&usecase->device_list) &&
            !my_data->is_multiple_sample_rate_combo_supported)
            !my_data->is_multiple_sample_rate_combo_supported) {
            sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
            sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
            ALOGD("%s:becf: afe: set default Sample Rate(48k) for combo device",__func__);
            ALOGD("%s:becf: afe: set default Sample Rate(48k) for combo device",__func__);
        }
        }
    }
    if (backend_idx != platform_get_voice_call_backend(adev)
    if (backend_idx != platform_get_voice_call_backend(adev)
        && usecase->type == PCM_PLAYBACK) {
        && usecase->type == PCM_PLAYBACK) {