From mboxrd@z Thu Jan 1 00:00:00 1970 From: abhijeet.kumar@intel.com Subject: [PATCH] ASoC: hdac_hdmi : Ensuring proper setting of output widget power state Date: Thu, 15 Feb 2018 14:05:38 +0530 Message-ID: <1518683739-4448-1-git-send-email-abhijeet.kumar@intel.com> References: <1516728657-21522-3-git-send-email-abhijeet.kumar@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by alsa0.perex.cz (Postfix) with ESMTP id 477202671AE for ; Thu, 15 Feb 2018 09:27:34 +0100 (CET) In-Reply-To: <1516728657-21522-3-git-send-email-abhijeet.kumar@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Vinod Koul , Jeeja KP , Guneshwor Singh , "Subhransu S. Prusty" , "Ughreja, Rakesh A" , Puneeth Prabhu , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: abhijeet.kumar@intel.com List-Id: alsa-devel@alsa-project.org From: Abhijeet Kumar In usecases like hot plug-unplug DP panel or modeset during a playback, sometimes we observe no audio after codec resets. During no audio condition, we have noticed that the power state of the pin or the connector is D3. Optimizing the way we set the power mitigates the issue. With this changes the verb is sent to set the power state and waits until actual state reaches target state. Thus ensuring power state is set. Signed-off-by: Abhijeet Kumar --- sound/soc/codecs/hdac_hdmi.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index dba6f4c5074a..0483afc40db6 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -718,10 +718,22 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev, static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev, hda_nid_t nid, unsigned int pwr_state) { + int count; + unsigned int state; + if (get_wcaps(&edev->hdev, nid) & AC_WCAP_POWER) { - if (!snd_hdac_check_power_state(&edev->hdev, nid, pwr_state)) - snd_hdac_codec_write(&edev->hdev, nid, 0, - AC_VERB_SET_POWER_STATE, pwr_state); + if (!snd_hdac_check_power_state(&edev->hdac, nid, pwr_state)) { + for (count = 0; count < 10; count++) { + snd_hdac_codec_read(&edev->hdac, nid, 0, + AC_VERB_SET_POWER_STATE, + pwr_state); + state = snd_hdac_sync_power_state(&edev->hdac, + nid, pwr_state); + if (!(state & AC_PWRST_ERROR)) + break; + } + } + } } -- 1.9.1