Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp248804ybd; Tue, 25 Jun 2019 20:42:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQm2D8Fsbxihgq59eDCK6vWgyP3P4KaFZEtoEyha4vwSHyF44u1oq/E1D9AVeW8OLV6eJe X-Received: by 2002:a17:90a:8c92:: with SMTP id b18mr1738083pjo.97.1561520577527; Tue, 25 Jun 2019 20:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561520577; cv=none; d=google.com; s=arc-20160816; b=v9rJbQeC8zvGT5Pq18ulEAasyZS189y5TJLHKiBTVF65yUWiz/DINMPX6ToemjtO1d 3kaoxxe469hE+innQosYLJi6hWxHhRa9oflWRU8MJyOo/B7BZ7Gdd3xLkAx0dS3Gdnbq vCnHRyvSKw0KK2tP7thdHWDAmSzin5prLPq/hDADb64mUT049xZw0H0t59NHImBZUd9O UDjtEMQegXF+T4zDwLORjz208syqjeE0oGOBRfwaJdhd3U8AcEj5i51UkdxZrNfkB93M KY73A7SJG4L3IPnGXiy69nwPR5MHu/k5pubeIE4RAf+Pq9gR7qB2j8iJ8m+5yj9rCi1Z VINA== 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:message-id:date:subject:cc:to:from :dkim-signature; bh=CkGECusputEd6IAoYPtv60dNs5/mfdZav5Q+TDA/Q7A=; b=PyZKk1KYeWVAewTwseQ1D5nqEzyeB1JA5frwVAWa0FoYKf/HBZ0BRbrDtw8nyTAXBz 0GbHIbweBVoOOqxcTZ+WM4nM5+64eDtwc0qTdi1oNf4wBqNZJzGzS90F9tNdGk121EOo t0cMc+Zxki9JUaw72md1hy5E/YsGCppit+d8ZyIMf0nzQUAB2Rb7JHIpMFn9eiZYKxrJ yAUXGa9EL0nqlzxFeXpG3Gylw9Ukms4G96QY4VqFExDx86qP4ljyS+t37t6tEUmlvovR YrK0kQmYP3At72LjwpJnC1PmAUlSb/eERXBfLNXEi1TlnQPK9mgTEHsC2uuYFFU12i11 bkYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VGqxxWyU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si14594793pgd.155.2019.06.25.20.42.41; Tue, 25 Jun 2019 20:42:57 -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=@kernel.org header.s=default header.b=VGqxxWyU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726988AbfFZDmG (ORCPT + 99 others); Tue, 25 Jun 2019 23:42:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:52774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbfFZDmE (ORCPT ); Tue, 25 Jun 2019 23:42:04 -0400 Received: from sasha-vm.mshome.net (mobile-107-77-172-74.mobile.att.net [107.77.172.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80B9521726; Wed, 26 Jun 2019 03:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561520523; bh=99xBhp4ECME6Q0i8RH0ioOBaHti5Ryh8K/hMwgZaIrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGqxxWyUTCIjL5HDobbFTxPOhY0z0WVvpVlURi9MsJrKO/RjkHdyD5PVm9/nK0E/x qy54Lggccvftr3tOCSnoPUfwbXOTnSvTdUgM2UxqSKZQXY6g/+ps28WHuwCdcM8jPl r6iIvBcxmhWJdOiUUhzdUinb9j/0gJfIoT49vPLY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hsin-Yi Wang , CK Hu , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.1 19/51] drm/mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Date: Tue, 25 Jun 2019 23:40:35 -0400 Message-Id: <20190626034117.23247-19-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190626034117.23247-1-sashal@kernel.org> References: <20190626034117.23247-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hsin-Yi Wang [ Upstream commit 2458d9d6d94be982b917e93c61a89b4426f32e31 ] 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 Signed-off-by: CK Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index 1ae3be99e0ff..179f2b080342 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -630,6 +630,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) if (--dsi->refcount != 0) return; + /* + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), + * after dsi is fully set. + */ + 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 +705,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) } } - mtk_dsi_stop(dsi); mtk_dsi_poweroff(dsi); dsi->enabled = false; -- 2.20.1