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

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

Merge "hal: Fixed incall recording backend ids"

parents 83be5d6b 85d0a594
Loading
Loading
Loading
Loading
+38 −4
Original line number Diff line number Diff line
@@ -873,6 +873,25 @@ void audio_extn_utils_update_stream_app_type_cfg_for_usecase(
    }
}

void audio_extn_btsco_get_sample_rate(int snd_device, int *sample_rate)
{
    switch (snd_device) {
    case SND_DEVICE_OUT_BT_SCO:
    case SND_DEVICE_IN_BT_SCO_MIC:
    case SND_DEVICE_IN_BT_SCO_MIC_NREC:
        *sample_rate = 8000;
        break;
    case SND_DEVICE_OUT_BT_SCO_WB:
    case SND_DEVICE_IN_BT_SCO_MIC_WB:
    case SND_DEVICE_IN_BT_SCO_MIC_WB_NREC:
        *sample_rate = 16000;
        break;
    default:
        ALOGD("%s:Not a BT SCO device, need not update sampling rate\n", __func__);
        break;
    }
}

static int send_app_type_cfg_for_device(struct audio_device *adev,
                                        struct audio_usecase *usecase,
                                        int split_snd_device)
@@ -939,8 +958,13 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
        goto exit_send_app_type_cfg;
    }
    snd_device = platform_get_spkr_prot_snd_device(snd_device);

    if (voice_is_in_call_rec_stream(usecase->stream.in) && usecase->type == PCM_CAPTURE) {
        snd_device_t voice_device = voice_get_incall_rec_snd_device(usecase->in_snd_device);
        acdb_dev_id = platform_get_snd_device_acdb_id(voice_device);
        ALOGV("acdb id for voice call use case %d", acdb_dev_id);
    } else {
        acdb_dev_id = platform_get_snd_device_acdb_id(snd_device);
    }
    if (acdb_dev_id <= 0) {
        ALOGE("%s: Couldn't get the acdb dev id", __func__);
        rc = -EINVAL;
@@ -996,6 +1020,7 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
                   ALOGI("%s using %d sample rate rate for A2DP CoPP",
                        __func__, usecase->stream.out->app_type_cfg.sample_rate);
        }
        audio_extn_btsco_get_sample_rate(snd_device, &usecase->stream.out->app_type_cfg.sample_rate);
        sample_rate = usecase->stream.out->app_type_cfg.sample_rate;

        /* Interactive streams are supported with only direct app type id.
@@ -1038,6 +1063,11 @@ static int send_app_type_cfg_for_device(struct audio_device *adev,
        app_type_cfg[len++] = acdb_dev_id;
        if (usecase->id == USECASE_AUDIO_RECORD_VOIP)
            usecase->stream.in->app_type_cfg.sample_rate = usecase->stream.in->sample_rate;
        if (voice_is_in_call_rec_stream(usecase->stream.in)) {
            audio_extn_btsco_get_sample_rate(usecase->in_snd_device, &usecase->stream.in->app_type_cfg.sample_rate);
        } else {
            audio_extn_btsco_get_sample_rate(snd_device, &usecase->stream.in->app_type_cfg.sample_rate);
        }
        sample_rate = usecase->stream.in->app_type_cfg.sample_rate;
        app_type_cfg[len++] = sample_rate;
        if (snd_device_be_idx > 0)
@@ -1071,6 +1101,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
{
    int i, num_devices = 0;
    snd_device_t new_snd_devices[SND_DEVICE_OUT_END] = {0};
    snd_device_t in_snd_device = usecase->in_snd_device;
    int rc = 0;

    switch (usecase->type) {
@@ -1089,11 +1120,14 @@ int audio_extn_utils_send_app_type_cfg(struct audio_device *adev,
    case PCM_CAPTURE:
        ALOGD("%s: usecase->in_snd_device %s",
              __func__, platform_get_snd_device_name(usecase->in_snd_device));
        if (voice_is_in_call_rec_stream(usecase->stream.in)) {
            in_snd_device = voice_get_incall_rec_backend_device(usecase->stream.in);
        }
        /* check for in combo device */
        if (platform_split_snd_device(adev->platform,
                                      usecase->in_snd_device,
                                      in_snd_device,
                                      &num_devices, new_snd_devices)) {
            new_snd_devices[0] = usecase->in_snd_device;
            new_snd_devices[0] = in_snd_device;
            num_devices = 1;
        }
        break;
+13 −0
Original line number Diff line number Diff line
@@ -567,6 +567,9 @@ static const char * const device_table[SND_DEVICE_MAX] = {
    [SND_DEVICE_IN_EC_REF_LOOPBACK_MONO] = "ec-ref-loopback-mono",
    [SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO] = "ec-ref-loopback-stereo",
    [SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
    [SND_DEVICE_IN_INCALL_REC_RX] = "incall-rec-rx",
    [SND_DEVICE_IN_INCALL_REC_TX] = "incall-rec-tx",
    [SND_DEVICE_IN_INCALL_REC_RX_TX] = "incall-rec-rx-tx",
};

// Platform specific backend bit width table
@@ -899,6 +902,9 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
    {TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_MONO)},
    {TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO)},
    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_TX)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX_TX)},
};

static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@@ -1741,6 +1747,8 @@ static void set_platform_defaults(struct platform_data * my_data)
    hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_INCALL_REC_RX] = strdup("INCALL_RECORD_RX");
    hw_interface_table[SND_DEVICE_IN_INCALL_REC_TX] = strdup("INCALL_RECORD_TX");

    my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
    /*remove ALAC & APE from DSP decoder list based on software decoder availability*/
@@ -3899,6 +3907,11 @@ int platform_split_snd_device(void *platform,
        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
        ret = 0;
    } else if (SND_DEVICE_IN_INCALL_REC_RX_TX == snd_device) {
        *num_devices = 2;
        new_snd_devices[0] = SND_DEVICE_IN_INCALL_REC_RX;
        new_snd_devices[1] = SND_DEVICE_IN_INCALL_REC_TX;
        ret = 0;
    }

    ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
+3 −0
Original line number Diff line number Diff line
@@ -241,6 +241,9 @@ enum {
    SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
    SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
    SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
    SND_DEVICE_IN_INCALL_REC_RX,
    SND_DEVICE_IN_INCALL_REC_TX,
    SND_DEVICE_IN_INCALL_REC_RX_TX,
    SND_DEVICE_IN_END,

    SND_DEVICE_MAX = SND_DEVICE_IN_END,
+13 −0
Original line number Diff line number Diff line
@@ -554,6 +554,9 @@ static const char * const device_table[SND_DEVICE_MAX] = {
    [SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = "unprocessed-quad-mic",
    [SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = "unprocessed-headset-mic",
    [SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
    [SND_DEVICE_IN_INCALL_REC_RX] = "incall-rec-rx",
    [SND_DEVICE_IN_INCALL_REC_TX] = "incall-rec-tx",
    [SND_DEVICE_IN_INCALL_REC_RX_TX] = "incall-rec-rx-tx",
};

// Platform specific backend bit width table
@@ -890,6 +893,9 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
    {TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_QUAD_MIC)},
    {TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC)},
    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_TX)},
    {TO_NAME_INDEX(SND_DEVICE_IN_INCALL_REC_RX_TX)},
};

static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@@ -1627,6 +1633,8 @@ static void set_platform_defaults(struct platform_data * my_data)
    hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
    hw_interface_table[SND_DEVICE_IN_INCALL_REC_RX] = strdup("INCALL_RECORD_RX");
    hw_interface_table[SND_DEVICE_IN_INCALL_REC_TX] = strdup("INCALL_RECORD_TX");

    my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;

@@ -3789,6 +3797,11 @@ int platform_split_snd_device(void *platform,
        new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
        new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
        ret = 0;
    } else if (SND_DEVICE_IN_INCALL_REC_RX_TX == snd_device) {
        *num_devices = 2;
        new_snd_devices[0] = SND_DEVICE_IN_INCALL_REC_RX;
        new_snd_devices[1] = SND_DEVICE_IN_INCALL_REC_TX;
        ret = 0;
    }

    ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
+3 −0
Original line number Diff line number Diff line
@@ -247,6 +247,9 @@ enum {
    SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
    SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
    SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
    SND_DEVICE_IN_INCALL_REC_RX,
    SND_DEVICE_IN_INCALL_REC_TX,
    SND_DEVICE_IN_INCALL_REC_RX_TX,
    SND_DEVICE_IN_END,

    SND_DEVICE_MAX = SND_DEVICE_IN_END,
Loading