Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp289632img; Wed, 20 Mar 2019 00:19:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz195pHjuOQAuG+/EzG5x7DAsyLVm4qmvOgHSzF5kX8VHwdvlAG5IkiqyHf+ZriM3sq9T/ X-Received: by 2002:a63:2403:: with SMTP id k3mr6049755pgk.200.1553066366976; Wed, 20 Mar 2019 00:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553066366; cv=none; d=google.com; s=arc-20160816; b=XQgAXOLoZ+r99yn5cytvb7Y1SEzviGmYmDajIz9K9v/7oxlrk1SEJEGjMAL0qwZ1Ot ykEykuGIdrGWDi0U9TiyMJvggALd2vo4geILWmfX2zr9/UApNLitpLO/TnDUn/MFO7if l7rTXILtfXUClb79x6DIQVHLDj0/k5MdYw6voa9bRKPtZ85fnNvt2iTVjXPH3vBeK0Nh yrvhRAmbzf0yYoZe2noPR3sH5FOHmih+IAk8oeKJUl7h95jgXe5b4mRkGQGb3EhXCkFY 2yXTcQEaRuYS2CpTrzrPBOjDs/gU151hEw5Q4vekm6agqSW0fY66VD9PQNz+N0SxiLe3 6/bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Mtcq9S/v2Tl+uFG8ivjTYFKQCKpz3W6EmGjpkEFJ4cs=; b=J8oyjtvWpyiSrWBniRjOfkGfZ3zRj/a6uoLhdnGGqlmkMSK2nwvHt5e1fjhoH8tQXw anNi6YPR0oZZPA3s5/hHZNrAscoYElyfs6H8+AnnsdvNWsNhUz6PyLYf0M6UgCUSqCmM EXbV2hfxNcJMJHQJcIipWveFAmvcWgSh/leGqAGGcXv+tkftjJenUbs/wgv6omabP9QZ XNX9/Qv6Qc4zoiLtoz/UHGavyh7sOlvQuQo6+g9o5AYdX2VyTwWCzzszFrGsPjm7CP75 iws1l6pOU7sNfogwu8bB8vtBd0qE9yfieWBTMVJsCCvQ5OHY4KnS7nygmai47uVMYPFz w0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XYdQaKD6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si1267313plz.91.2019.03.20.00.19.10; Wed, 20 Mar 2019 00:19:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=XYdQaKD6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727139AbfCTHSb (ORCPT + 99 others); Wed, 20 Mar 2019 03:18:31 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41461 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbfCTHSb (ORCPT ); Wed, 20 Mar 2019 03:18:31 -0400 Received: by mail-pf1-f195.google.com with SMTP id d25so1244580pfn.8 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=REOfpHgUqZwHyHxEq6L92a5aCNs5CKeQpuaMkE211wO/lGzYB0SPv07LFxGt2apHkY 2Xwk835gMVBza4pvjCuZpNHylSAtoUzJs6l3Q3zkmgBvI+6vqaoCrAQ0MvahQ5PDljqc Adc37bs703Hm7cjbEgfZ55h7tab71MFe3BhVehWIa+0HLZjNOCbYFNyk4ffdgrGh8P0k iMJwh7Jkb/ooYBc+xN4PjPcu7j6lIMpdvFcsw+bMgoukw0CwDDB2h+y2pl1rRjCPw2AF UQ1niavvd1lzLhOdzWOjRPSH1RgCGqvPI9N1WUFxJ/w+Pum3Ac8woXh26Uer5wdXsw5I ZExw== X-Gm-Message-State: APjAAAUhdK1PLLuzkpTSk7YaFdhzW6T0TwKnTk0Ag4zbr7BiwKNLt8eG IwFHceRqRjc5G/NhrUlssm5aYg== 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 Cc: CK Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.20.1