hal: Update the correct channel count for dolby configuration
-Wfd supports both 5.1 and stereo. Based on the sink capabilities
update the correct channel count for dolby configuration for wfd.
CRs-Fixed: 609429
Change-Id: I85b81ba7db7134a6781007393f0f3c2adb5ea138
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index c6a8e68..245f5ca 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -174,7 +174,7 @@
#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 @@
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 @@
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 @@
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);
diff --git a/hal/audio_extn/dolby.c b/hal/audio_extn/dolby.c
index bcc7381..f209e5c 100644
--- a/hal/audio_extn/dolby.c
+++ b/hal/audio_extn/dolby.c
@@ -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 @@
{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 @@
(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 @@
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 @@
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 @@
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