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

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

Merge "hal: Update the correct channel count for dolby configuration"

parents 052c452c 0b2de1cf
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ void audio_extn_set_anc_parameters(struct audio_device *adev,
#endif /* ANC_HEADSET_ENABLED */

#ifndef AFE_PROXY_ENABLED
#define audio_extn_set_afe_proxy_parameters(parms)        (0)
#define audio_extn_set_afe_proxy_parameters(adev, parms)  (0)
#define audio_extn_get_afe_proxy_parameters(query, reply) (0)
#else
/* Front left channel. */
@@ -290,7 +290,8 @@ int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev)
    return ret;
}

void audio_extn_set_afe_proxy_parameters(struct str_parms *parms)
void audio_extn_set_afe_proxy_parameters(struct audio_device *adev,
                                         struct str_parms *parms)
{
    int ret, val;
    char value[32]={0};
@@ -300,6 +301,7 @@ void audio_extn_set_afe_proxy_parameters(struct str_parms *parms)
    if (ret >= 0) {
        val = atoi(value);
        aextnmod.proxy_channel_num = val;
        adev->cur_wfd_channels = val;
        ALOGD("%s: channel capability set to: %d", __func__,
               aextnmod.proxy_channel_num);
    }
@@ -358,7 +360,7 @@ void audio_extn_set_parameters(struct audio_device *adev,
                               struct str_parms *parms)
{
   audio_extn_set_anc_parameters(adev, parms);
   audio_extn_set_afe_proxy_parameters(parms);
   audio_extn_set_afe_proxy_parameters(adev, parms);
   audio_extn_fm_set_parameters(adev, parms);
   audio_extn_listen_set_parameters(adev, parms);
   audio_extn_hfp_set_parameters(adev, parms);
+27 −9
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@

/* DS1-DDP Endp Params */
#define DDP_ENDP_NUM_PARAMS 17
#define DDP_ENDP_NUM_DEVICES 22
#define DDP_ENDP_NUM_DEVICES 23
static int ddp_endp_params_id[DDP_ENDP_NUM_PARAMS] = {
    PARAM_ID_MAX_OUTPUT_CHANNELS, PARAM_ID_CTL_RUNNING_MODE,
    PARAM_ID_CTL_ERROR_CONCEAL, PARAM_ID_CTL_ERROR_MAX_RPTS,
@@ -147,7 +147,10 @@ static struct ddp_endp_params {
              {8, 0, 0, 0, 0, 0, 0, 21, 1, 6, 0, 0, 0, 0, 0, 0, 0},
              {1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0} },
          {AUDIO_DEVICE_OUT_PROXY, 2,
              {8, 0, 0, 0, 0, 0, 0, 21, 1, 6, 0, 0, 0, 0, 0, 0, 0},
              {8, 0, 0, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 0, 0},
              {1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0} },
          {AUDIO_DEVICE_OUT_PROXY, 6,
              {8, 0, 0, 0, 0, 0, 0, 21, 1, 2, 0, 0, 0, 0, 0, 0, 0},
              {1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0} },
};

@@ -264,9 +267,16 @@ void audio_extn_dolby_send_ddp_endp_params(struct audio_device *adev)
            (usecase->stream.out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) &&
            ((usecase->stream.out->format == AUDIO_FORMAT_AC3) ||
             (usecase->stream.out->format == AUDIO_FORMAT_EAC3))) {
            /*
             * Use wfd /hdmi sink channel cap for dolby params if device is wfd
             * or hdmi. Otherwise use stereo configuration
             */
            int channel_cap = usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL ?
                              adev->cur_hdmi_channels :
                              usecase->devices & AUDIO_DEVICE_OUT_PROXY ?
                              adev->cur_wfd_channels : 2;
            send_ddp_endp_params_stream(usecase->stream.out, usecase->devices,
                           usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL ?
                           adev->cur_hdmi_channels : 2, false /* set cache */);
                                        channel_cap, false /* set cache */);
        }
    }
}
@@ -334,7 +344,9 @@ void audio_extn_ddp_set_parameters(struct audio_device *adev,
        update_ddp_endp_table(ddp_dev, dev_ch_cap,
                              PARAM_ID_OUT_CTL_STEREO_MODE, val);
    }

    /* TODO: Do we need device channel caps here?
     * We dont have that information as this is from dolby modules
     */
    send_ddp_endp_params(adev, ddp_dev, dev_ch_cap);
}

@@ -343,13 +355,20 @@ int audio_extn_dolby_get_snd_codec_id(struct audio_device *adev,
                                      audio_format_t format)
{
    int id = 0;
    /*
     * Use wfd /hdmi sink channel cap for dolby params if device is wfd
     * or hdmi. Otherwise use stereo configuration
     */
    int channel_cap = out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL ?
                      adev->cur_hdmi_channels :
                      out->devices & AUDIO_DEVICE_OUT_PROXY ?
                      adev->cur_wfd_channels : 2;

    switch (format) {
    case AUDIO_FORMAT_AC3:
        id = SND_AUDIOCODEC_AC3;
        send_ddp_endp_params_stream(out, out->devices,
                            out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL ?
                            adev->cur_hdmi_channels : 2, true /* set_cache */);
                            channel_cap, true /* set_cache */);
#ifndef DS1_DOLBY_DAP_ENABLED
        audio_extn_dolby_set_dmid(adev);
#endif
@@ -357,8 +376,7 @@ int audio_extn_dolby_get_snd_codec_id(struct audio_device *adev,
    case AUDIO_FORMAT_EAC3:
        id = SND_AUDIOCODEC_EAC3;
        send_ddp_endp_params_stream(out, out->devices,
                            out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL ?
                            adev->cur_hdmi_channels : 2, true /* set_cache */);
                            channel_cap, true /* set_cache */);
#ifndef DS1_DOLBY_DAP_ENABLED
        audio_extn_dolby_set_dmid(adev);
#endif
+1 −0
Original line number Diff line number Diff line
@@ -2695,6 +2695,7 @@ static int adev_open(const hw_module_t *module, const char *name,
    adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
    voice_init(adev);
    list_init(&adev->usecase_list);
    adev->cur_wfd_channels = 2;

    /* Loads platform specific libraries dynamically */
    adev->platform = platform_init(adev);
+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ struct audio_device {
    bool speaker_lr_swap;
    struct voice voice;
    unsigned int cur_hdmi_channels;
    unsigned int cur_wfd_channels;

    int snd_card;
    void *platform;