From nobody Mon Nov 11 05:29:09 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EDF9C6FA82 for ; Wed, 14 Sep 2022 14:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiINOCH (ORCPT ); Wed, 14 Sep 2022 10:02:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbiINOBj (ORCPT ); Wed, 14 Sep 2022 10:01:39 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6929A1CB0E for ; Wed, 14 Sep 2022 07:00:39 -0700 (PDT) X-UUID: 4a42c3792f96464299de123730c8ac07-20220914 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Wy5CZ7whd4Um5NV5JQOHZfdTnoxxIEcuBpfmElqhC5s=; b=E+A3eU8DGU1Q/RIEZp2Yev0oa5jAvLZ0L6rArb8Pk9Gq4/sgyxQAXWMJje0Ctw28mCjAQZDWKItcJbpqcks2ygtu/UfgrjiPaJO9IhLu8AsLao2tj4qNCGzD3rTu8NM4Mx8hJt3nzVg6/n1fwQf4baxgxnQ4YD6ABvqBHV2/TEU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:8ae5156e-af4b-4551-a9c1-679e1eae0475,IP:0,U RL:25,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:25 X-CID-META: VersionHash:39a5ff1,CLOUDID:59e16cec-2856-4fce-b125-09d4c7ebe045,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 4a42c3792f96464299de123730c8ac07-20220914 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1613845095; Wed, 14 Sep 2022 22:00:35 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 14 Sep 2022 22:00:34 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 14 Sep 2022 22:00:34 +0800 From: Allen-KH Cheng To: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , Xinlei Lee , Allen-KH Cheng Subject: [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi Date: Wed, 14 Sep 2022 22:00:31 +0800 Message-ID: <20220914140031.18578-1-allen-kh.cheng@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xinlei Lee Dsi is turned off at bridge.disable, causing crtc to wait for vblank timeout. It is necessary to add count protection to turn off dsi and turn off at post_disable. Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/d= isable and define new funcs") Signed-off-by: Xinlei Lee Co-developed-by: Allen-KH Cheng Signed-off-by: Allen-KH Cheng --- Change in v1: * Rebase to kernel/git/chunkuang.hu/linux.git, mediatek-drm-fixes [Allen-KH Cheng ] --- --- drivers/gpu/drm/mediatek/mtk_dsi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index 5b624e0f5b0a..e30f4244c001 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -768,14 +768,6 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge = *bridge, drm_display_mode_to_videomode(adjusted, &dsi->vm); } =20 -static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge, - struct drm_bridge_state *old_bridge_state) -{ - struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); - - mtk_output_dsi_disable(dsi); -} - static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { @@ -803,13 +795,15 @@ static void mtk_dsi_bridge_atomic_post_disable(struct= drm_bridge *bridge, { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 + if (dsi->refcount =3D=3D 1) + mtk_output_dsi_disable(dsi); + mtk_dsi_poweroff(dsi); } =20 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, - .atomic_disable =3D mtk_dsi_bridge_atomic_disable, .atomic_duplicate_state =3D drm_atomic_helper_bridge_duplicate_state, .atomic_enable =3D mtk_dsi_bridge_atomic_enable, .atomic_pre_enable =3D mtk_dsi_bridge_atomic_pre_enable, @@ -829,6 +823,9 @@ void mtk_dsi_ddp_stop(struct device *dev) { struct mtk_dsi *dsi =3D dev_get_drvdata(dev); =20 + if (dsi->refcount =3D=3D 1) + mtk_output_dsi_disable(dsi); + mtk_dsi_poweroff(dsi); } =20 --=20 2.18.0