From patchwork Wed Nov 16 09:37:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 9433281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4F18360469 for ; Thu, 17 Nov 2016 00:49:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40B8C291A6 for ; Thu, 17 Nov 2016 00:49:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35417291BB; Thu, 17 Nov 2016 00:49:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BEF2B291A6 for ; Thu, 17 Nov 2016 00:49:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A8196E705; Thu, 17 Nov 2016 00:48:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from wens.csie.org (mirror2.csie.ntu.edu.tw [140.112.30.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 658306E671 for ; Wed, 16 Nov 2016 09:37:39 +0000 (UTC) Received: by wens.csie.org (Postfix, from userid 1000) id 4ED635FA53; Wed, 16 Nov 2016 17:37:36 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , David Airlie Subject: [PATCH] drm/sun4i: Only count TCON endpoints as valid outputs Date: Wed, 16 Nov 2016 17:37:31 +0800 Message-Id: <20161116093732.12828-1-wens@csie.org> X-Mailer: git-send-email 2.10.2 X-Mailman-Approved-At: Thu, 17 Nov 2016 00:48:12 +0000 Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The sun4i DRM driver counts the number of endpoints it found and registers the whole DRM pipeline if any endpoints are found. However, if the TCON and its child endpoints (LCD panels, TV encoder, HDMI encoder, MIPI DSI encoder, etc.) aren't found, that means we don't have any usable CRTCs, and the display pipeline is incomplete and useless. The whole DRM display pipeline should only be registered and enabled if there are proper outputs available. The debug message "Queued %d outputs on pipeline %d\n" is also telling. This patch makes the driver only count enabled TCON endpoints. If none are found, the DRM pipeline is not used. This avoids screwing up the simple framebuffer provided by the bootloader in cases where we aren't able to support the display with the DRM subsystem, due to lack of panel or bridge drivers, or just lack of progress. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Signed-off-by: Chen-Yu Tsai --- Hi Maxime, This avoids DRM screwing up simplefb on my SinA31s, which does not have the display pipeline enabled in its dts file. But the display engine and backend are already enabled in the dtsi. I think this is a better and proper (for the driver) fix. The alternative would be to disable the display-engine node in the dts by default. Last time I asked you wanted to have them enabled by default? It may also be possible to push the check further down, and check against panel and encoder endpoints, but I think that complicates things. The TCON is a necessary part of the output. ChenYu --- drivers/gpu/drm/sun4i/sun4i_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index c3b21865443e..3603f34901b6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -243,9 +243,12 @@ static int sun4i_drv_add_endpoints(struct device *dev, DRM_DEBUG_DRIVER("Adding component %s\n", of_node_full_name(node)); component_match_add(dev, match, compare_of, node); - count++; } + /* Only count the tcon as an output */ + if (sun4i_drv_node_is_tcon(node)) + count++; + /* Inputs are listed first, then outputs */ port = of_graph_get_port_by_id(node, 1); if (!port) {