Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp698203img; Thu, 21 Mar 2019 07:10:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlKrxYxEdB0dsvhDvUvKGfoFD+oBVJtelBkcfm3dHfg0Bwv9KC6KPxUWD4YxozX0Yug3ZS X-Received: by 2002:a17:902:728e:: with SMTP id d14mr3604192pll.327.1553177455079; Thu, 21 Mar 2019 07:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553177455; cv=none; d=google.com; s=arc-20160816; b=mmcnhCHAcU+Ir1oCxJ2n03NP9PN4BO6THs1dgXxbdvG4d30V5JKpR+58NM2LxoTyRW ER8LOb5T9e6l/zcvo04VrYeWgbrHtuEDDZyYwHAUcmn5plUq4PkF9E3iqz8HzO3dVqNw xksu4WoeOZDnDYaZvthbDex5uTobMcWu3EBvnRD5juA0Qo9smizcl9RIY7YL0GUvF059 IPkhLigmRKRLt4NJbJyBDkYyl/lpnv7zZqN+2Fp0+9s/m510iQumb40FGAUe/SH1B/S5 2dh9R0ekCFUREssHANKidTqCA+RPEQEhwaQr7bPpejoNcv3FmP2hggZMErsf4+ErwRPI 1waQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=f6d7pLaiQP1ZFnfCbsOUot4AdI7jDcls+c6Qs396FEM=; b=cn8xWUC4fZxkiqZg7gwOtTI5gVlGv4bfSlRAq5f7lIh9RCQDidpEa7D8p7YRpg97rs jWBMWe82zMcUeoU1c0KZ6KFwcXc7E1N1AxhxzBceEYOybLJrvE91KVjf5v99omOABqL/ 5S5ZQG4uOLlxJc2C+SDiTYodm11hpZx/T6BnCmCu4sruPZ7ERkZVtmeO4lGhA18Bn3xH 5kpGhXBIre5DojjnCUIa5ZjzoNM2Mw4hK8Ia9OE6NzWKE/tAeqrrLSFqSmFM/K9wLFJy hbmrZU6N5HQxLym01wOIsN4486ACxXB+zizHEM7WahEvDREeahhrE1hzB59wS6CjkZoN /sOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DQsiWDLj; 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 89si4729652pla.124.2019.03.21.07.10.39; Thu, 21 Mar 2019 07:10:55 -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=DQsiWDLj; 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 S1728172AbfCUOJy (ORCPT + 99 others); Thu, 21 Mar 2019 10:09:54 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:47040 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727922AbfCUOJy (ORCPT ); Thu, 21 Mar 2019 10:09:54 -0400 Received: by mail-qt1-f196.google.com with SMTP id z17so5658381qts.13 for ; Thu, 21 Mar 2019 07:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f6d7pLaiQP1ZFnfCbsOUot4AdI7jDcls+c6Qs396FEM=; b=DQsiWDLjJgQC+Z9TxfEwxlry+NQOO+ghxpWhuvII+pPJzx8ZaVzEZWDIlHUY3pOa0u S6VF6GSMUbglheLAfbH8Aivoz7zwRu5VLrYF01faEwdam8eHZjtAyFv95nZtTlqrhwXy nbfxLCD1dKxf0qwgJlQuSlp9fa1RTb2QLRftY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f6d7pLaiQP1ZFnfCbsOUot4AdI7jDcls+c6Qs396FEM=; b=DQHABKAjyrfc/C6Dc+XUCgLUF9uwA+7YEqzbvg/cl9bc29UnUZsDvdlID1FGgvWtN4 4tV+hH1S5IIo9PuyjxhX+E8BkbeScn1v9XmFuNuOL5TlozE/E+zLyjDf4imfrQCQP31k 3XdzSE4Jd2JNB6TMrZfXBp9UsHrB3r4MONuUTMYQEHeKjulnbDstEXykyOL5pCBVfPBb ow2Z1lXVkzJr52+Yds2xYf4FRxVCE3a2kKfxL9j5sOOoNBqhskFWtI8zt7iA72tV7IYP HiKST9DeAE6bl8nI2FlZDJ4JByZJQdhMnXnVttM5bQMNm+Gplqlk4vOai0t6LcbWSX6e Wkjg== X-Gm-Message-State: APjAAAUbnUgk/KnlPbhBi2FHGZbPC8Pq1eRFL+Pw8A3e+pmmwaTUZfxV C8ApSzPSWiNFnbWdu4H3lDye5CydOlxzUkiz3Tvu7w== X-Received: by 2002:ac8:2aa7:: with SMTP id b36mr3091420qta.187.1553177392922; Thu, 21 Mar 2019 07:09:52 -0700 (PDT) MIME-Version: 1.0 References: <20190320071825.20268-1-hsinyi@chromium.org> <1553131722.18216.10.camel@mtksdaap41> <1553132815.18216.18.camel@mtksdaap41> In-Reply-To: <1553132815.18216.18.camel@mtksdaap41> From: Hsin-Yi Wang Date: Thu, 21 Mar 2019 22:09:42 +0800 Message-ID: Subject: Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() To: CK Hu Cc: 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > > > > > @@ -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; > > > >