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

Commit 3a0d3b70 authored by kunleiz's avatar kunleiz Committed by Gerrit - the friendly Code Review server
Browse files

Revert "hal: ensure correct device selection when native playback is atvice"

This reverts commit 5346b4a3.

The headphone-44.1 is not used for native playback in warlock and talos.

Fix usb mute by adding headphone backend check to reset afe sample rate
when output sample is 44.1Khz

CRs-Fixed: 2310099
Change-Id: I9bae3febfa87f77399b4c2f13ba63956726fb778
parent c0a9cf69
Loading
Loading
Loading
Loading
+6 −22
Original line number Diff line number Diff line
@@ -2487,10 +2487,6 @@ acdb_init_fail:
                strdup("RX_CDC_DMA_RX_0 Format");
            my_data->current_backend_cfg[HEADPHONE_BACKEND].samplerate_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 SampleRate");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 Format");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
                strdup("RX_CDC_DMA_RX_0 SampleRate");

            if (default_rx_backend)
                free(default_rx_backend);
@@ -2511,10 +2507,6 @@ acdb_init_fail:
                strdup("INT0_MI2S_RX Format");
            my_data->current_backend_cfg[HEADPHONE_BACKEND].samplerate_mixer_ctl =
                strdup("INT0_MI2S_RX SampleRate");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].bitwidth_mixer_ctl =
                strdup("INT0_MI2S_RX Format");
            my_data->current_backend_cfg[HEADPHONE_44_1_BACKEND].samplerate_mixer_ctl =
                strdup("INT0_MI2S_RX SampleRate");

            if (default_rx_backend)
                free(default_rx_backend);
@@ -4090,9 +4082,6 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
        } else if (NATIVE_AUDIO_MODE_SRC == na_mode &&
                   OUTPUT_SAMPLING_RATE_44100 == sample_rate) {
                snd_device = SND_DEVICE_OUT_HEADPHONES_44_1;
        } else if (NATIVE_AUDIO_MODE_TRUE_44_1 == na_mode &&
                   OUTPUT_SAMPLING_RATE_44100 == sample_rate) {
                snd_device = SND_DEVICE_OUT_HEADPHONES_44_1;
        } else if (NATIVE_AUDIO_MODE_MULTIPLE_44_1 == na_mode &&
                   (sample_rate % OUTPUT_SAMPLING_RATE_44100 == 0) &&
                   (out->format != AUDIO_FORMAT_DSD)) {
@@ -6296,10 +6285,12 @@ static bool platform_check_codec_backend_cfg(struct audio_device* adev,
                       __func__);
        }
        /*reset sample rate to 48khz if sample rate less than 44.1khz, or device backend dose not support 44.1 khz*/
        if ((sample_rate == OUTPUT_SAMPLING_RATE_44100 && backend_idx != HEADPHONE_44_1_BACKEND)
            || sample_rate < OUTPUT_SAMPLING_RATE_44100) {
        if ((sample_rate == OUTPUT_SAMPLING_RATE_44100 &&
             backend_idx != HEADPHONE_44_1_BACKEND &&
             backend_idx != HEADPHONE_BACKEND) ||
            sample_rate < OUTPUT_SAMPLING_RATE_44100) {
            sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
            ALOGD("%s:becf: afe: reset sample rate to default Sample Rate(48k)",__func__);
            ALOGD("%s:becf: afe: set sample rate to default Sample Rate(48k)",__func__);
        }
    }

@@ -6429,13 +6420,6 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev,

    backend_idx = platform_get_backend_index(snd_device);

    //initialize backend config if current snd_device is SND_DEVICE_NONE
    if (usecase->out_snd_device == SND_DEVICE_NONE) {
        my_data->current_backend_cfg[backend_idx].sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        my_data->current_backend_cfg[backend_idx].bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
        my_data->current_backend_cfg[backend_idx].channels = CODEC_BACKEND_DEFAULT_CHANNELS;
    }

    if (usecase->type == TRANSCODE_LOOPBACK) {
        backend_cfg.bit_width = usecase->stream.inout->out_config.bit_width;
        backend_cfg.sample_rate = usecase->stream.inout->out_config.sample_rate;