hal: Address missing sysfs update during DP disconnect
During display port disconnect, adev_set_parameter() is calling
platform_invalidate_hdmi_config() before the audio extension.
Attempts to read the current display type in order to determine
which sysfs node to communicate with. The solution is to
relocate invalidate function in audio extension to ensure that
it does not get called prematurely.
Change-Id: Ifc7bc8cc753855edacb8fa90a9f784086fef7594
CRs-Fixed: 1082254
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 083b925..81b8e9a 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -185,7 +185,7 @@
return ret;
}
-static void check_and_set_ext_disp_connection_status(const struct audio_device *adev,
+static void audio_extn_ext_disp_set_parameters(const struct audio_device *adev,
struct str_parms *parms)
{
char value[32] = {0};
@@ -204,13 +204,14 @@
&& (atoi(value) & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
//params = "disconnect=1024" for external display disconnection.
update_ext_disp_sysfs_node(adev, 0);
+ ALOGV("invalidate cached edid");
+ platform_invalidate_hdmi_config(adev->platform);
} else {
// handle ext disp devices only
return;
}
}
-
#ifndef FM_POWER_OPT
#define audio_extn_fm_set_parameters(adev, parms) (0)
#else
@@ -772,7 +773,7 @@
audio_extn_source_track_set_parameters(adev, parms);
audio_extn_fbsp_set_parameters(parms);
audio_extn_keep_alive_set_parameters(adev, parms);
- check_and_set_ext_disp_connection_status(adev, parms);
+ audio_extn_ext_disp_set_parameters(adev, parms);
if (adev->offload_effects_set_parameters != NULL)
adev->offload_effects_set_parameters(parms);
}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3816748..bf5fb02 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -4251,10 +4251,13 @@
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value));
if (ret >= 0) {
val = atoi(value);
- if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- ALOGV("invalidate cached edid");
- platform_invalidate_hdmi_config(adev->platform);
- } else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
+ /*
+ * The HDMI / Displayport disconnect handling has been moved to
+ * audio extension to ensure that its parameters are not
+ * invalidated prior to updating sysfs of the disconnect event
+ * Invalidate will be handled by audio_extn_ext_disp_set_parameters()
+ */
+ if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
!(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
ret = str_parms_get_str(parms, "card", value, sizeof(value));
if (ret >= 0) {
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 7dcd1b6..cafdff5 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -163,6 +163,7 @@
bool platform_check_codec_asrc_support(void *platform);
int platform_get_backend_index(snd_device_t snd_device);
int platform_get_ext_disp_type(void *platform);
+void platform_invalidate_hdmi_config(void *platform);
int platform_send_audio_cal(void* platform, int acdb_dev_id, int acdb_device_type,
int app_type, int topology_id, int sample_rate, uint32_t module_id, uint32_t param_id,