Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3149012pxj; Mon, 17 May 2021 19:02:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Qw2L9TK3Bp3YNxyZpRMmooJDI2eHVPWTjQ21Z/0rLObrhdAOHuOk2wJ5d0erqbvpT+Zx X-Received: by 2002:a02:c73a:: with SMTP id h26mr2945306jao.95.1621303375088; Mon, 17 May 2021 19:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621303375; cv=none; d=google.com; s=arc-20160816; b=0UfRUqPTdW9RIGKy5Pk8gVKQLCaub8PPrihiKc02PizdZmeM/QcKp/iJacGbFYJuO7 7cOCszMI4ro1KSNF4WAc5170aQHzNXlpGxmNpgeSak4oxGBidCMeXws2pxeqpij5zwxd W13WXYUxzoifFSI3MchIzLNeLm9k1X8/DD//kFMWA5hwpWGCQJQ75jjF5JjEvx1B4DNT 8O+Ddgd8BrKeHnCOJEfeO4cUOQGiKYf7EwUmsGQVFxQAHErqWsnyYM5Wp3IYfqRqNSyf hXskG3JgFrbARpEdsWejGhhNxncCBIQ+GqHNXPd3GzizcLBgon9/L96HvIJ8kesFtUPv cwkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YAC9Co8ehz3gNNNaRlq2ZLShfqGMYSnlpNovZGkSbxg=; b=cTq5pn2cFnqxWQxlaDLGHK/gxHp+cjqdxupLgDj1nAyVgRP+AD42e1e3ympzaqzVGQ X/sEbr52Lg+4xDONp/CpjJ6lz0HmWrOAGMzrGtH6Fk1/z4mb+hT2AksdbF07sdom+A1r lAB0+8DSjpAVeo8ywyK4+PH9qpu69jVW45JkA+AY9HBSastH57Q0Ha3cQqs0lyxmzAWk duE7Vs9ze99ycSD92CK8ACDVMDXtZ/x/9vGejfBEL0aom08VGyMH+WMJOlJQOiA7ZcPH CXG31Aw+yicMXKuWv4koH68lgxxXRo1fhh8THaPigHRIykR/YOyb4QOChF0QSXrAq6Er gYOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dUy2PNRs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si2663889ilb.75.2021.05.17.19.02.33; Mon, 17 May 2021 19:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dUy2PNRs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240060AbhEQOgz (ORCPT + 99 others); Mon, 17 May 2021 10:36:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:40556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238399AbhEQOcQ (ORCPT ); Mon, 17 May 2021 10:32:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5EF906191A; Mon, 17 May 2021 14:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260963; bh=0Q9sItVJADPaj0GEl4aT6bBiMfmmbTcjj3Sw0Kt/rNI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dUy2PNRskoy7A2p/H9WL6MRhvTRQ87sn3BKUN+h+sjvQ9JhD5d+iloyEmb3n93GZB FeNT+5sLEM7XYgZoj3X21Qn69Tv6PZzNHpcMGtaPVrVL66teifq/e8YvpyT7Io1yIs 1Udu7XbtOV1yt0aKC6wOimglPTVKoCyFfm8FY8qE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuogee Hsieh , Stephen Boyd , Rob Clark , Sasha Levin Subject: [PATCH 5.12 276/363] drm/msm/dp: initialize audio_comp when audio starts Date: Mon, 17 May 2021 16:02:22 +0200 Message-Id: <20210517140311.952492245@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuogee Hsieh [ Upstream commit f2f46b878777e0d3f885c7ddad48f477b4dea247 ] Initialize audio_comp when audio starts and wait for audio_comp at dp_display_disable(). This will take care of both dongle unplugged and display off (suspend) cases. Changes in v2: -- add dp_display_signal_audio_start() Changes in v3: -- restore dp_display_handle_plugged_change() at dp_hpd_unplug_handle(). Changes in v4: -- none Signed-off-by: Kuogee Hsieh Reviewed-by: Stephen Boyd Tested-by: Stephen Boyd Fixes: c703d5789590 ("drm/msm/dp: trigger unplug event in msm_dp_display_disable") Link: https://lore.kernel.org/r/1619048258-8717-3-git-send-email-khsieh@codeaurora.org Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/dp/dp_audio.c | 1 + drivers/gpu/drm/msm/dp/dp_display.c | 11 +++++++++-- drivers/gpu/drm/msm/dp/dp_display.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index 82a8673ab8da..d7e4a39a904e 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -527,6 +527,7 @@ int dp_audio_hw_params(struct device *dev, dp_audio_setup_acr(audio); dp_audio_safe_to_exit_level(audio); dp_audio_enable(audio, true); + dp_display_signal_audio_start(dp_display); dp_display->audio_enabled = true; end: diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 5a39da6e1eaf..f3d74f8f35fe 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -178,6 +178,15 @@ static int dp_del_event(struct dp_display_private *dp_priv, u32 event) return 0; } +void dp_display_signal_audio_start(struct msm_dp *dp_display) +{ + struct dp_display_private *dp; + + dp = container_of(dp_display, struct dp_display_private, dp_display); + + reinit_completion(&dp->audio_comp); +} + void dp_display_signal_audio_complete(struct msm_dp *dp_display) { struct dp_display_private *dp; @@ -651,7 +660,6 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) dp_add_event(dp, EV_DISCONNECT_PENDING_TIMEOUT, 0, DP_TIMEOUT_5_SECOND); /* signal the disconnect event early to ensure proper teardown */ - reinit_completion(&dp->audio_comp); dp_display_handle_plugged_change(g_dp_display, false); dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK | @@ -898,7 +906,6 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data) /* wait only if audio was enabled */ if (dp_display->audio_enabled) { /* signal the disconnect event */ - reinit_completion(&dp->audio_comp); dp_display_handle_plugged_change(dp_display, false); if (!wait_for_completion_timeout(&dp->audio_comp, HZ * 5)) diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 6092ba1ed85e..5173c89eedf7 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -34,6 +34,7 @@ int dp_display_get_modes(struct msm_dp *dp_display, int dp_display_request_irq(struct msm_dp *dp_display); bool dp_display_check_video_test(struct msm_dp *dp_display); int dp_display_get_test_bpp(struct msm_dp *dp_display); +void dp_display_signal_audio_start(struct msm_dp *dp_display); void dp_display_signal_audio_complete(struct msm_dp *dp_display); #endif /* _DP_DISPLAY_H_ */ -- 2.30.2