Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp335022img; Thu, 21 Mar 2019 22:09:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx0f7I5QXtH6qQv0ON2MpUmDVbq5S1DC9aYMdE9ssLLNjDNnAD4r7iKnvwLFJOoJfF6WLl X-Received: by 2002:a17:902:d889:: with SMTP id b9mr4999826plz.294.1553231359664; Thu, 21 Mar 2019 22:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553231359; cv=none; d=google.com; s=arc-20160816; b=rUJLfW4d19jJzL3DfOb/0AqaKAug01C09emzOhGmyeH8ApDcLvw1tqb+EJCJerUXxI inPpNOndGGp2ySdvDzC+IwvUm8lOMB4T9caN/MZDIwpYl2bM5AGRbUm3NLFXyX09OEHS dPg2c8u/9fXdPgrQ+nedAOBQ+5sNHgpSZ9CpaFLJqsMKiMCpJDXIGYtcuFh5U0nxIG/V /q1F+D3u6QnyOi8ytG26UIodKsLmTCA6USh01wkV8MZhuSaIXJ7Vnk+PmY3mokkAPB+y tPyPMTGQjwwOLUV2QH8fJsiuZSi+uu260t7vl4wH66iDhl9CiFD36YJQNQzSo9jW7ETb VRHQ== 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=7L37hQQjmaVuHCvZQWFxszrQ0br55Vrkf1k3F9bkPos=; b=O7ce6T1fjYOMDdmXBGDjdqabYD5XaU8GBNOURPlayGsHKAmfvSgvXSUI8EzHG56nfW ogCPXvHzL7cAxvGR6sc0rruBsLM6UscP4scWvUKXuLeLUhS9kKO9WqQQhvirrirbpcrA 8+vZhSnEf/Z/ZcahuxaWN+S7VqaMVRFIVWQfqJztURLQvEcEynRGhPqHxUhsM1HDXGd9 HrCwy41A0vpH2GOe6Uxgey2kMfhIfFGzgETHQ4OD3g+zz3jdU2peiGdiAU6Q0ZpAPTIG /1fR0lBhZGXlcDs2x7ifllJCkGSs7MhHfjG68YqIznJaeXnnQUvffiJHlK7vonKqORnx bpyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lNFMpvFx; 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 h11si6497850plb.38.2019.03.21.22.08.50; Thu, 21 Mar 2019 22:09:19 -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=lNFMpvFx; 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 S1726061AbfCVFGH (ORCPT + 99 others); Fri, 22 Mar 2019 01:06:07 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:39365 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbfCVFGH (ORCPT ); Fri, 22 Mar 2019 01:06:07 -0400 Received: by mail-qk1-f195.google.com with SMTP id c189so524862qke.6 for ; Thu, 21 Mar 2019 22:06:06 -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=7L37hQQjmaVuHCvZQWFxszrQ0br55Vrkf1k3F9bkPos=; b=lNFMpvFxwwRNj0z8NpV3CTamv470Vas0/sNHtl3RX6LxPVNCFC3FzZM8XWBkvfAUN/ DJ9USOmW0EwcXdUB7cs+/a1IO+dlgg6e4NsM0wRYdLYctuCmh3AfYk3IgjOxpBmJWY1D nrFjxQLZkn7xMpFmAiY76N1sIL1s8AYXXD+BY= 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=7L37hQQjmaVuHCvZQWFxszrQ0br55Vrkf1k3F9bkPos=; b=L1+a9Fv1O/abTNRwgd46AJ/L0Op55y7kjP6bTX8P2JG5KuDH10yV8O/rCh1U5o8qPa oAl4fmi6/6Vn0yKVL6eD7FnfHOLr+mgqr0Q3rZosLFQGQ49J6g0tYK3YfS0AgmneKf0j em2BdaVtsGNB6HhhhWe8fvOCqnLCmFfA5aHkNWA8kbXcO75tTDGNhUnq0/Rjumv22+yw JaQ68XNwnUYRO3NCi1LHlxXT7VCuPx5uNTefQNItfZ3iO1gUIP/+EK7NaIsiWoiidnjV bB0DWsiWCNbzWs5YGfeHAENUP6ohkaorwYW9g3JYGiuHp5hL8xsFL3B55dvXdHyVEjEC WRcw== X-Gm-Message-State: APjAAAUwq/YRCbNdTREsj8jxGQTBk0ZiwHOwmYea124QW6htF7M3C4wM a3ReYLoSuUWEFObS3uaP3GT4VB/Vvz3aTwtPE2TvNA== X-Received: by 2002:a05:620a:145b:: with SMTP id i27mr5984872qkl.103.1553231165956; Thu, 21 Mar 2019 22:06:05 -0700 (PDT) MIME-Version: 1.0 References: <20190320071825.20268-1-hsinyi@chromium.org> <1553131722.18216.10.camel@mtksdaap41> <1553132815.18216.18.camel@mtksdaap41> <1553217695.25217.5.camel@mtksdaap41> In-Reply-To: <1553217695.25217.5.camel@mtksdaap41> From: Hsin-Yi Wang Date: Fri, 22 Mar 2019 13:05:54 +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, jitao.shi@mediatek.com 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 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 > > 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; > > > > > > > > > > > >