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

Commit 4d7e5b8c authored by Sachin Mohan Gadag's avatar Sachin Mohan Gadag Committed by Gerrit - the friendly Code Review server
Browse files

hal: platform: Support 24bit record usecase for internal codec

-When input stream is requested for 24bit record check whether
 targets supports by reading platform info and configure
 accordingly.

Change-Id: I94f0ec1852c88fe66418983b835b801420efb4d6
parent 521952d5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@
<audio_platform_info>
    <bit_width_configs>
        <device name="SND_DEVICE_OUT_SPEAKER" bit_width="24"/>
        <device name="SND_DEVICE_IN_HANDSET_MIC" bit_width="24"/>
        <device name="SND_DEVICE_IN_HANDSET_GENERIC_QMIC" bit_width="24"/>
    </bit_width_configs>
    <interface_names>
        <device name="AUDIO_DEVICE_IN_BUILTIN_MIC" interface="INT3_MI2S" codec_type="internal"/>
+9 −4
Original line number Diff line number Diff line
@@ -6713,7 +6713,8 @@ bool platform_check_and_set_codec_backend_cfg(struct audio_device* adev,
 */
static bool platform_check_capture_codec_backend_cfg(struct audio_device* adev,
                                   int backend_idx,
                                   struct audio_backend_cfg *backend_cfg)
                                   struct audio_backend_cfg *backend_cfg,
                                   snd_device_t snd_device)
{
    bool backend_change = false;
    unsigned int bit_width;
@@ -6734,14 +6735,18 @@ static bool platform_check_capture_codec_backend_cfg(struct audio_device* adev,
    // For voice calls use default configuration i.e. 16b/48K, only applicable to
    // default backend
    // force routing is not required here, caller will do it anyway
    if ((voice_is_in_call(adev) || adev->mode == AUDIO_MODE_IN_COMMUNICATION)
        || (my_data->is_internal_codec)) {
    if ((voice_is_in_call(adev) || adev->mode == AUDIO_MODE_IN_COMMUNICATION)) {

        ALOGW("%s:txbecf: afe: Use default bw and sr for voice/voip calls and "
              "for unprocessed/camera source", __func__);
        bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
        sample_rate =  CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        channels = CODEC_BACKEND_DEFAULT_TX_CHANNELS;
    } else if (my_data->is_internal_codec) {
        sample_rate =  CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
        channels = CODEC_BACKEND_DEFAULT_TX_CHANNELS;
        if (adev->active_input->bit_width == 24)
            bit_width = platform_get_snd_device_bit_width(snd_device);
    } else {
        struct listnode *node;
        struct audio_usecase *uc = NULL;
@@ -6833,7 +6838,7 @@ bool platform_check_and_set_capture_codec_backend_cfg(struct audio_device* adev,
          backend_idx, usecase->id,
          platform_get_snd_device_name(snd_device));
    if (platform_check_capture_codec_backend_cfg(adev, backend_idx,
                                                 &backend_cfg)) {
                                                 &backend_cfg, snd_device)) {
        ret = platform_set_codec_backend_cfg(adev, snd_device,
                                             backend_cfg);
        if(!ret)