hal: enable support for GKI
With introduction of GKI from kernel 5.4, audio hal
needs to support both GKI and non-GKI kernel builds.
Add an audio feature flag which enables support for GKI.
CRs-Fixed: 2605183
Change-Id: I2d7c68d0006940f6f6939649dae0816456f6f902
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 4a70358..02a819f 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -9042,6 +9042,7 @@
bool passthrough_enabled = false;
int controller = -1;
int stream = -1;
+ uint32_t compr_passthr = 0;
if (!usecase) {
ALOGE("%s: becf: HDMI: usecase is NULL", __func__);
@@ -9067,8 +9068,15 @@
", usecase = %d", __func__, bit_width,
sample_rate, channels, usecase->id);
+#ifdef AUDIO_GKI_ENABLED
+ /* out->compr_config.codec->reserved[0] is for compr_passthr */
+ compr_passthr = usecase->stream.out->compr_config.codec->reserved[0];
+#else
+ compr_passthr = usecase->stream.out->compr_config.codec->compr_passthr;
+#endif
+
if (audio_extn_passthru_is_enabled() && audio_extn_passthru_is_active()
- && (usecase->stream.out->compr_config.codec->compr_passthr != 0)) {
+ && (compr_passthr != 0)) {
passthrough_enabled = true;
ALOGI("passthrough is enabled for this stream");
}
@@ -9109,7 +9117,7 @@
if (((usecase->stream.out->format == AUDIO_FORMAT_E_AC3) ||
(usecase->stream.out->format == AUDIO_FORMAT_E_AC3_JOC) ||
(usecase->stream.out->format == AUDIO_FORMAT_DOLBY_TRUEHD))
- && (usecase->stream.out->compr_config.codec->compr_passthr == PASSTHROUGH)) {
+ && (compr_passthr == PASSTHROUGH)) {
sample_rate = sample_rate * 4;
if (sample_rate > HDMI_PASSTHROUGH_MAX_SAMPLE_RATE)
sample_rate = HDMI_PASSTHROUGH_MAX_SAMPLE_RATE;