Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp572048pxj; Tue, 18 May 2021 09:29:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkSVuvaZqTLRdCxrd6a/nku9oiK3j6Z67uPhUSNdfYe3AcwnReKlQV3dJH8riyrSnCq7eX X-Received: by 2002:a17:906:ad9a:: with SMTP id la26mr7019131ejb.122.1621355341746; Tue, 18 May 2021 09:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621355341; cv=none; d=google.com; s=arc-20160816; b=sqiL35BZOmDEPLpoz8bhaIfJ1Lz25On+W5FbY2bHfJOtVajlb7O448JVbMDhsw4qz4 0/iEyAcxLZbkmbcITV77wU6Lh5A3laaf1X1tINl5+pKw0U5Q1A9R/V1Jdjyl4oezjR5e hAPbwXWagFcEyTEufLKtHcQIrKuzFAL8PnLzccUoPYrf7e9hESi7p4W47RuW/9g+lUje whjjjxjrPSD3euSrCqSFCn1E1f8zBFzfeOaSPSjIHDYpEg2Ff3HcSfDWhaUJgm77+aoR YaRSMD5l4NoQbFIuuxeLdUufNP9NByYg/ip6OhIbhQ7lHVuZo9TikJOryE/qQ6Amrtoo raPw== 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=SQpcTVtshw1iy4IfIEfgVDZX9K5dzOlsAM0vsM39Kbs=; b=Kxalou501rwPHpMBp0Y4MB26hbNsFWbH4lzrfMvtMGFYxbgJAEt+e00mxsmbfZBsse 9CtP1Felf08xY3Hgp+WVt84SgxOw0vbDex4xxgj0iD3/wni5vmDL/aJk0hFxL0PpqQEu tHMqk52oetLaqCtpJhg7rV0/B+Pu+pLuMkzkvdvrX3LiHnwB60SXG8pbxoXnDgNixP8g UrgORePFmvyDayW1hCnBL/Gy6sU6xUIFZt7ks+dDWFXbJcK+zoWCTfGYQ4TBCNedlMpj lMlb6+A7F9EpaH/RQ2Qf9Ut5pxOsSHa5VBbEndM9tl3p9SGeognEj2/eczYsOCFfPnHQ OOFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gjl7U6DF; 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 pw5si17572985ejb.531.2021.05.18.09.28.37; Tue, 18 May 2021 09:29:01 -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=gjl7U6DF; 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 S244082AbhEQQCg (ORCPT + 99 others); Mon, 17 May 2021 12:02:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:52358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344132AbhEQPmO (ORCPT ); Mon, 17 May 2021 11:42:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E74761D1E; Mon, 17 May 2021 14:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262556; bh=EWO/kkYXf351A3Bh9OBScgWx3DoKGU2C1rkCUnGXcRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gjl7U6DFNLtZB5qSF/nlLqmAiSTSWL4t3aDbAY/ttAYgCWOwSz+apZ97vXsWjQpR+ uFYvbmsQ95+5MjNsfu38dMQTYQHt0Jef/sdUdvaw3pVc1Y+BPzg0IWI5b/FjgLIzXH S7AeaioVi82QPqCr91/h3PVg9UZyakark6fPduXo= 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.10 213/289] drm/msm/dp: initialize audio_comp when audio starts Date: Mon, 17 May 2021 16:02:18 +0200 Message-Id: <20210517140312.290401057@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 a2db14f852f1..66f2ea3d42fc 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -176,6 +176,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; @@ -620,7 +629,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 | @@ -841,7 +849,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