From patchwork Fri Jul 6 17:51:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 10513727 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 E8CC56032A for ; Mon, 9 Jul 2018 07:10:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D529B28A3F for ; Mon, 9 Jul 2018 07:10:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8FFB28A41; Mon, 9 Jul 2018 07:10:42 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 76B9C28A3F for ; Mon, 9 Jul 2018 07:10:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7C5F6E3BB; Mon, 9 Jul 2018 07:07:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.siol.net (mailoutvs13.siol.net [185.57.226.204]) by gabe.freedesktop.org (Postfix) with ESMTPS id 610AB6E288 for ; Fri, 6 Jul 2018 17:53:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id 0D70F521137; Fri, 6 Jul 2018 19:53:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta11.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta11.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id DpAr6oIWZPMh; Fri, 6 Jul 2018 19:53:46 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 6C7E552099D; Fri, 6 Jul 2018 19:53:46 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id E271F520BE8; Fri, 6 Jul 2018 19:53:43 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Subject: [PATCH 16/17] drm/sun4i: tcon-top: Remove mux configuration at probe time Date: Fri, 6 Jul 2018 19:51:12 +0200 Message-Id: <20180706175113.26698-17-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706175113.26698-1-jernej.skrabec@siol.net> References: <20180706175113.26698-1-jernej.skrabec@siol.net> X-Mailman-Approved-At: Mon, 09 Jul 2018 07:06:44 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Now that R40 TCON migrated to runtime mux configuration, old code can be removed. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 81 +++----------------------- 1 file changed, 7 insertions(+), 74 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index c09b15b64192..78795d6cb174 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c @@ -87,34 +87,6 @@ int sun8i_tcon_top_de_config(struct device *dev, int mixer, int tcon) } EXPORT_SYMBOL(sun8i_tcon_top_de_config); -static int sun8i_tcon_top_get_connected_ep_id(struct device_node *node, - int port_id) -{ - struct device_node *ep, *remote, *port; - struct of_endpoint endpoint; - - port = of_graph_get_port_by_id(node, port_id); - if (!port) - return -ENOENT; - - for_each_available_child_of_node(port, ep) { - remote = of_graph_get_remote_port_parent(ep); - if (!remote) - continue; - - if (of_device_is_available(remote)) { - of_graph_parse_endpoint(ep, &endpoint); - - of_node_put(remote); - - return endpoint.id; - } - - of_node_put(remote); - } - - return -ENOENT; -} static struct clk_hw *sun8i_tcon_top_register_gate(struct device *dev, const char *parent, @@ -149,11 +121,9 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, struct platform_device *pdev = to_platform_device(dev); struct clk_hw_onecell_data *clk_data; struct sun8i_tcon_top *tcon_top; - bool mixer0_unused = false; struct resource *res; void __iomem *regs; - int ret, i, id; - u32 val; + int ret, i; tcon_top = devm_kzalloc(dev, sizeof(*tcon_top), GFP_KERNEL); if (!tcon_top) @@ -198,49 +168,12 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, goto err_assert_reset; } - val = 0; - - /* check if HDMI mux output is connected */ - if (sun8i_tcon_top_get_connected_ep_id(dev->of_node, 5) >= 0) { - /* find HDMI input endpoint id, if it is connected at all*/ - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 4); - if (id >= 0) - val = FIELD_PREP(TCON_TOP_HDMI_SRC_MSK, id + 1); - else - DRM_DEBUG_DRIVER("TCON TOP HDMI input is not connected\n"); - } else { - DRM_DEBUG_DRIVER("TCON TOP HDMI output is not connected\n"); - } - - writel(val, regs + TCON_TOP_GATE_SRC_REG); - - val = 0; - - /* process mixer0 mux output */ - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 1); - if (id >= 0) { - val = FIELD_PREP(TCON_TOP_PORT_DE0_MSK, id); - } else { - DRM_DEBUG_DRIVER("TCON TOP mixer0 output is not connected\n"); - mixer0_unused = true; - } - - /* process mixer1 mux output */ - id = sun8i_tcon_top_get_connected_ep_id(dev->of_node, 3); - if (id >= 0) { - val |= FIELD_PREP(TCON_TOP_PORT_DE1_MSK, id); - - /* - * mixer0 mux has priority over mixer1 mux. We have to - * make sure mixer0 doesn't overtake TCON from mixer1. - */ - if (mixer0_unused && id == 0) - val |= FIELD_PREP(TCON_TOP_PORT_DE0_MSK, 1); - } else { - DRM_DEBUG_DRIVER("TCON TOP mixer1 output is not connected\n"); - } - - writel(val, regs + TCON_TOP_PORT_SEL_REG); + /* + * Default register values might have some reserved bits set, which + * prevents TCON TOP from working properly. Set them to 0 here. + */ + writel(0, regs + TCON_TOP_GATE_SRC_REG); + writel(0, regs + TCON_TOP_PORT_SEL_REG); /* * TCON TOP has two muxes, which select parent clock for each TCON TV