Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6158646ybi; Wed, 29 May 2019 03:50:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNTY++5rZIk2s3MRuxNcqbIuvsTkV7EjsTXdtVJd7jZIXbVTqDWqmB2EpI3Vb9sYxTSiC9 X-Received: by 2002:a17:902:8c8c:: with SMTP id t12mr64741795plo.116.1559127050213; Wed, 29 May 2019 03:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559127050; cv=none; d=google.com; s=arc-20160816; b=dtwgqajYm0F7AavZSMTbxruwMQqssNtgCxFnUwlf+QXgtzeBoY8xiEoibRUUswpiB0 Ia22iNdlUrfnPDGqdzD5/rmMLPlW43w1g8PVMOQHFEDcSN8yalxkRZIHkb1Z1+qrwNcy XNTzs49+p2vp0CvmtWlKvPz9+obZ+8+cV0Zi3u4FWPG7+Coo8R0MkZ1WKVMjE9e0IUts w417TB+NLLIWi2Y4RMH0Iw2yhV1xVkrAHqu7uzRoZuhT+s2P2ODz/AC231mM+Dh1urUG ZTEhtWo2Dv26eN3MdrNq2RSbLMJsZDKSNj1CH6yrCNPAgvf5O2yX4SbUTU7aDR4s+7JZ JCXA== 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 :references:in-reply-to:date:cc:to:from:subject:message-id; bh=EgmCRhiqYCNgAUP+V0zjkrVhh6BRvwyPQYG8RwTB4xc=; b=ERRbEvIAVhhKPXeZR+14j758shDFGWzsozCZZgA7NhIz9/fXRhEZLWuroPmLgQfFjp F9MJ6uKiE/aBk1dY+M4koPPH9j9OahwXGOrUTYzu8J7wKR9TsMNFjD3iHa8R4g1liQzL 0212SztS1Rm88ejzmY9PRCkwz1hOfvRmWuo5JM4qiT9g28AXk8ZYrg5w5Ac+rzfvm7+c MYQoyGgAP94vY3tgeyg+PkCl3t465/HTOWQEhu7hKuLDCUVX27rIzZ22j3A4Fb7DdGV+ HBcaTarybBMT62cjrP8sme/CtKSz6d+Qe0fJPl7R3HOoa/G1+K2szt7tnAh2JLDe+pCs mteg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b40si9833862pla.49.2019.05.29.03.50.34; Wed, 29 May 2019 03:50:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726097AbfE2Kst (ORCPT + 99 others); Wed, 29 May 2019 06:48:49 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:58399 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725914AbfE2Kst (ORCPT ); Wed, 29 May 2019 06:48:49 -0400 X-UUID: 1d9e1bea161e45bba2bb111fb52ffd89-20190529 X-UUID: 1d9e1bea161e45bba2bb111fb52ffd89-20190529 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1860894148; Wed, 29 May 2019 18:48:43 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 29 May 2019 18:48:41 +0800 Received: from [10.16.6.141] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 29 May 2019 18:48:39 +0800 Message-ID: <1559126919.12097.6.camel@mszsdaap41> Subject: Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() From: Jitao Shi To: Hsin-Yi Wang CC: CK Hu =?UTF-8?Q?=28=E8=83=A1=E4=BF=8A=E5=85=89=29?= , "linux-arm-kernel@lists.infradead.org" , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , "dri-devel@lists.freedesktop.org" , "linux-mediatek@lists.infradead.org" , "linux-kernel@vger.kernel.org" Date: Wed, 29 May 2019 18:48:39 +0800 In-Reply-To: References: <20190320071825.20268-1-hsinyi@chromium.org> <1553131722.18216.10.camel@mtksdaap41> <1553132815.18216.18.camel@mtksdaap41> <1553217695.25217.5.camel@mtksdaap41> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-03-22 at 13:05 +0800, Hsin-Yi Wang wrote: > On Fri, Mar 22, 2019 at 9:21 AM CK Hu wrote: > > > > Hi, Hsin-yi: > > > > On Thu, 2019-03-21 at 22:09 +0800, Hsin-Yi Wang wrote: > > > On Thu, Mar 21, 2019 at 9:46 AM CK Hu wrote: > > > > > > > > Hi, Hsin-yi: > > > > > > > > On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote: > > > > > Hi, Hsin-yi: > > > > > > > > > > On Wed, 2019-03-20 at 15:18 +0800, Hsin-Yi Wang wrote: > > > > > > 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)) { > > > > > > > > > > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works > > > > > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop() > > > > > in a symmetric manner. That means you may also move below functions into > > > > > mtk_dsi_poweron(): > > > > > > > > > > mtk_dsi_set_mode(dsi); > > > > > mtk_dsi_clk_hs_mode(dsi, 1); > > > > > mtk_dsi_start(dsi); > > > > > > For MT8183 with bridge panel, calling mtk_dsi_start() in > > > mtk_dsi_poweron() when refcount is 0->1, like the following order, > > > will results in no irq, not sure why though. I think this might be the > > > timing issue you mentioned in patch v1. (MT8183 without bridge panel > > > doesn't have this issue.) > > > > > > atomic_enable > > > --> mtk_crtc_ddp_hw_init > > > --> mtk_dsi_ddp_start > > > --> mtk_dsi_poweron (ref 0->1) > > > --> drm_panel_prepare > > > --> *mtk_dsi_start // results in no irq for MT8183 with bridge > > > --> drm_crtc_vblank_on > > > > > > mtk_output_dsi_enable > > > --> mtk_dsi_poweron (ref 1->2, ignored) > > > --> mtk_dsi_start //original position > > > > > > For mtk_dsi_stop() both with or without bridge is fine. > Add cc Jitao. > > Hi Jitao, > Do you know if this is a known hardware behavior? > > Thanks mtk_dsi_start must after dsi full setting. If you put it in mtk_dsi_ddp_start, mtk_dsi_set_mode won't work. DSI will keep cmd mode. So you see no irq. I think we show keep the mtk_dsi_start in mtk_output_dsi_enable Best Regards Jitao > > > > I'm not familiar with dsi hardware, so I could not answer why this > > problem happen. Jitao is familiar with dsi hardware, you may ask him for > > help. If this is hardware behavior, I could accept asymmetric flow, but > > please be sure this is hardware behavior not software bug. > > > > Regards, > > CK > > > > > > > > > > > > > > > > > > > > > @@ -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); > > > > > > > > > > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and > > > > > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are > > > > > redundant. And I think you should remove mtk_dsi_stop() in > > > > > mtk_output_dsi_disable(), why not in this patch? > > > > > > > > You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss > > > > it, sorry for this. > > > > > > > > Regards, > > > > CK > > > > > > > > > > > > > > Regards, > > > > > CK > > > > > > > > > > > component_del(&pdev->dev, &mtk_dsi_component_ops); > > > > > > > > > > > > return 0; > > > > > > > > > > > > > > > > >