From fc96590a622424cce4f2fcfbd60829999b2bea87 Mon Sep 17 00:00:00 2001 From: Lei Qian Date: Thu, 07 Sep 2017 07:46:18 +0000 Subject: AVIN: release source at first when plugged in [3/3] PD# 150571 or afe status will be wrong Change-Id: Ibf8ce8531004cc3a6edd7baa443bbf27f7fc87f9 Signed-off-by: Lei Qian --- diff --git a/tv_input.cpp b/tv_input.cpp index e2afe80..ea9f225 100644 --- a/tv_input.cpp +++ b/tv_input.cpp @@ -147,15 +147,25 @@ void TvCallback::onTvEvent (int32_t msgType, const Parcel &p) int connectState = p.readInt32(); LOGD("TvCallback::onTvEvent source = %d, status = %d", source, connectState); - if (source != SOURCE_HDMI1 && source != SOURCE_HDMI2 && source != SOURCE_HDMI3 - && source != SOURCE_HDMI4 && source != SOURCE_AV1 && source != SOURCE_AV2) - break; - - if (connectState == 1) { - notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_AVAILABLE); - notify_tv_device_status(priv, source, TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED); + bool isHotplugDetectOn = priv->mpTv->GetHdmiAvHotplugDetectOnoff(); + if (isHotplugDetectOn) { + if (source != SOURCE_HDMI1 && source != SOURCE_HDMI2 && source != SOURCE_HDMI3 + && source != SOURCE_HDMI4 && source != SOURCE_AV1 && source != SOURCE_AV2) + break; + + if (connectState == 1) { + notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_AVAILABLE); + notify_tv_device_status(priv, source, TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED); + } else { + notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_UNAVAILABLE); + } } else { - notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_UNAVAILABLE); + if (connectState == 1 && (source == SOURCE_AV1 || source == SOURCE_AV2)) { + // need close afe at first ,it's a workarround way + notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_UNAVAILABLE); + notify_tv_device_status(priv, source, TV_INPUT_EVENT_DEVICE_AVAILABLE); + notify_tv_device_status(priv, source, TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED); + } } break; } @@ -215,8 +225,8 @@ static void available_all_tv_device(tv_input_private_t *priv) bool isHotplugDetectOn = priv->mpTv->GetHdmiAvHotplugDetectOnoff(); - if (isHotplugDetectOn) - priv->mpTv->setTvObserver(priv->tvcallback); + // if (isHotplugDetectOn) + priv->mpTv->setTvObserver(priv->tvcallback); for (int i=0; i < count; i++) { tv_source_input_t source_input = (tv_source_input_t)tv_devices[i]; -- cgit