From patchwork Wed Mar 20 07:18:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 10860947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A28D5922 for ; Wed, 20 Mar 2019 07:18:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 799A829A22 for ; Wed, 20 Mar 2019 07:18:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D93029A2E; Wed, 20 Mar 2019 07:18:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2325C29A22 for ; Wed, 20 Mar 2019 07:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kDCxJ5l8q9TlE5SrJz7Ojjcx4dpK6FsROvDso8aVlqw=; b=dErnzBjH+0LDZ9 c+wGSF9tEhRHPu5DJL4jTe6zzv6nyllWxgnKk7yo4FAxqzE7LZG9Rrv0QDYeK1aJx9i1obPMHOiAB dQ/OxOwibAl4wjVwKHNip3UrokepUsZx8rIIt7r8oEcNOLMsdYwd434OIyTaE6FhsFCh7WZ9Xxe4h DLAZdFOVaF2iRRf4zzhCJ6stx262TP49ljfWmVMlp3Rr4Qm5nVloy+A8u9aT8OXE5PEuxzC/ixxlP V19WBwEVi+Ct+ub2RK4HPFOpA4PY5s3v0JjJNT/4sQnAzlZEk2wuqxhIUlM+XqQF+SKp8eLO5QEli 3Peaw5Q3w+evwGevpgUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6VUl-0000ks-VU; Wed, 20 Mar 2019 07:18:40 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6VUd-0000cs-7y for linux-mediatek@lists.infradead.org; Wed, 20 Mar 2019 07:18:32 +0000 Received: by mail-pg1-x543.google.com with SMTP id v12so1127960pgq.1 for ; Wed, 20 Mar 2019 00:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mtcq9S/v2Tl+uFG8ivjTYFKQCKpz3W6EmGjpkEFJ4cs=; b=XYdQaKD62Uc3PQvaYbXUSYqA2iBDHwnMF01B+WOLaYLLPBHWiQJg4xzKyrbgIGFBe2 i47kGXU41UWimuGRsqohqhOxUkxxvS8fogJIlYFrQJcRDFe4NMrtglvEp741k2g971pM qAOMXPFerplhpCOtQ8pFwOcjrXNXTDhrMGj+8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Mtcq9S/v2Tl+uFG8ivjTYFKQCKpz3W6EmGjpkEFJ4cs=; b=Bkb3NFLvZmW2YFfjoFvZEV/vSkMpFKka6tnQ2yIVr772gsHdSPU5oXAGB3wPHuBc5/ e+YqUqtEq5/O8upcZeG8a2b3C9i+XPUQ7f7t8JoJGjG3anq48uWDU/j3Z3A/MWgA+lR7 vpqM74tJZ5KI6SmirPgSzk48/CcR5zaN7Iit3gxY3cj5kqXJ3EAMF4y8qebxgSwJqqpl WUdw7f0qVyOgcRQKhOYxsh6MALmWWarp3ND168ZVmauA44Rpe88hffplfMirQL2/7wah LH7wIo/LHy8lyZ7FO2slWuw3IK5b3mQH7dNaX/BhYOjCC9yBy/nMzNT6dgzf5gXN1vT6 Wq3w== X-Gm-Message-State: APjAAAXKrGE+Bybl4DBSzvY87PL1FTRFR9sho/BlBj5UAWdyR98ZcnPF wzgmuAOmxUPwhKH8OGFxA9DmbA== X-Google-Smtp-Source: APXvYqws1Wq1zw3UK9tB1eJ1pU0nnhICoChdQWRZmcqeRsBI33N++GPHTDNKRmme1nTLPHv5LaPGkw== X-Received: by 2002:a63:c204:: with SMTP id b4mr5897712pgd.335.1553066310716; Wed, 20 Mar 2019 00:18:30 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:b852:bd51:9305:4261]) by smtp.gmail.com with ESMTPSA id l184sm1579803pfc.41.2019.03.20.00.18.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Mar 2019 00:18:30 -0700 (PDT) From: Hsin-Yi Wang To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Date: Wed, 20 Mar 2019 15:18:25 +0800 Message-Id: <20190320071825.20268-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190320_001831_307952_4624BF39 X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthias Brugger , linux-mediatek@lists.infradead.org, Daniel Vetter , CK Hu Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), which needs ovl irq for drm_crtc_wait_one_vblank(), since after mtk_dsi_stop() is called, ovl irq will be disabled. If drm_crtc_wait_one_vblank() is called after last irq, it will timeout with this message: "vblank wait timed out on crtc 0". This happens sometimes when turning off the screen. In drm_atomic_helper.c#disable_outputs(), the calling sequence when turning off the screen is: 1. mtk_dsi_encoder_disable() --> mtk_output_dsi_disable() --> mtk_dsi_stop(); // sometimes make vblank timeout in atomic_disable --> mtk_dsi_poweroff(); 2. mtk_drm_crtc_atomic_disable() --> drm_crtc_wait_one_vblank(); ... --> mtk_dsi_ddp_stop() --> mtk_dsi_poweroff(); mtk_dsi_poweroff() has reference count design, change to make mtk_dsi_stop() called in mtk_dsi_poweroff() when refcount is 0. Fixes: 0707632b5bac ("drm/mediatek: update DSI sub driver flow for sending commands to panel") Signed-off-by: Hsin-Yi Wang --- change log: v1->v2: * update commit message. * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0. --- drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index b00eb2d2e086..e152f37af57d 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) if (--dsi->refcount != 0) return; + mtk_dsi_stop(dsi); + if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) { if (dsi->panel) { if (drm_panel_unprepare(dsi->panel)) { @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) } } - mtk_dsi_stop(dsi); mtk_dsi_poweroff(dsi); dsi->enabled = false; @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev) struct mtk_dsi *dsi = platform_get_drvdata(pdev); mtk_output_dsi_disable(dsi); + mtk_dsi_stop(dsi); + mtk_dsi_poweroff(dsi); component_del(&pdev->dev, &mtk_dsi_component_ops); return 0;