From patchwork Fri Dec 17 13:51:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77D8BC433EF for ; Fri, 17 Dec 2021 13:53:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yva4AbLw0ZU4EvkEuiBKDtz/V9u11/sY6JcUEnvfDyY=; b=f6bWy9y/fvE1h6 eZGztUoBv0tFrSaWpEpe6HVR38Hnm+wB8s9+kfBVNxVaECLjYycCJxEytADDpDg7jGIHbUxxcYJEo mqWR7p3mlsByenQufoUnlP3AM+BsL/shvFVndxt44aMDnJ8ixMpcb2J5NCbwGrnXKvXWMGJCyoiWu tbSC2yb7zrWA1x1KoOA4/myWkFLpLztHPtYJ4xyyw0fyOIBt/5gZaCQLVGNR1knkLdLon+rAMQRaS 2LCN3dkXs29q+ifMjjz/AEARFsKZRU0SVD5CuSVoloaf8BrkY2OduldBgdDCoDvDEG3s5YCiqJUGL vKRz1niJUXqGe8PTF9Vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDe3-00ATCd-KG; Fri, 17 Dec 2021 13:51:37 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDdw-00AT94-De for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:30 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D9A615C015A; Fri, 17 Dec 2021 08:51:24 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 17 Dec 2021 08:51:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=Ub19/beu6g/nu OZYDQVInDRY/8vv3wWB4gmsItdHjYw=; b=QDlaSgJcUdL39sH/3PjryYzfkOsoM 5k6aFJ0vDufUzrNedYz6/4nusnWdZFOD/KXvrG5Y8ttBKO0IaAGBLlRAkY6JHEwt Ftk/rH4rbYKGEGbfuIhAMrY969clbxKk6jyXDEt7w7p+gcjGBzKC8paMqqJwPCYm N6KJe71ra4FBJxSHMGHJwcqebypMc6JVbmnPcYc/6JQPv1dvr+0HTYWuNQtPQSEO vP2JU7ViVHn8S0zfm8zNWyHokYHo+e6giLqMYO2XFW5HmoY5GZ9/JZ7CS8G+HwPb IUEc8bDCFHO/+E1cBEhNVe1RpILl2s4xZsyJIwzzMh+meVv/Xtp+2n8Ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Ub19/beu6g/nuOZYDQVInDRY/8vv3wWB4gmsItdHjYw=; b=OQLFc/MW YYU+cf0K5ur6ZzMu2h6vhKs6cQPYTZHLoHC69azCu4JLNFJlEryzUjvVSPvANpZM TnXgZj0w6WGQ6O/uTj4dEKk3hI8niidoWHl1BgNwnnlKjCNI6issWyPxL9LpnAtx VW43qN7hZv4prcksMaqSdk97auTGxyEWQOFvK7rUai5h5s1avQtWM3xfX94jbGAr vULQ7+c+e5ck/RBnxhufN8+i64hdyoZQs/TFjZPQ6B5Pam+DJpDTW5K8CqcapXPu xCjC/8l49+bsfLd1f7NpUG7I5DYjfh8EI6GYhB52qlKVtkznjQTdBV6UXI721f+Z hKqgkPwujA+7sg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:24 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 1/7] of: Make of_graph_get_port_by_id take a const device_node Date: Fri, 17 Dec 2021 14:51:13 +0100 Message-Id: <20211217135119.316781-2-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055128_576214_D55AE64E X-CRM114-Status: GOOD ( 11.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org of_graph_get_port_by_id doesn't modify the device_node pointer it takes as argument, so we can make it const. Signed-off-by: Maxime Ripard --- drivers/of/property.c | 2 +- include/linux/of_graph.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 8e90071de6ed..8ad0ce5c87f3 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -603,7 +603,7 @@ EXPORT_SYMBOL(of_graph_parse_endpoint); * Return: A 'port' node pointer with refcount incremented. The caller * has to use of_node_put() on it when done. */ -struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) +struct device_node *of_graph_get_port_by_id(const struct device_node *parent, u32 id) { struct device_node *node, *port; diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h index 4d7756087b6b..87f3f4d0d0df 100644 --- a/include/linux/of_graph.h +++ b/include/linux/of_graph.h @@ -42,7 +42,7 @@ bool of_graph_is_present(const struct device_node *node); int of_graph_parse_endpoint(const struct device_node *node, struct of_endpoint *endpoint); int of_graph_get_endpoint_count(const struct device_node *np); -struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); +struct device_node *of_graph_get_port_by_id(const struct device_node *node, u32 id); struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, struct device_node *previous); struct device_node *of_graph_get_endpoint_by_regs( @@ -74,7 +74,7 @@ static inline int of_graph_get_endpoint_count(const struct device_node *np) } static inline struct device_node *of_graph_get_port_by_id( - struct device_node *node, u32 id) + const struct device_node *node, u32 id) { return NULL; } From patchwork Fri Dec 17 13:51:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64E46C433F5 for ; Fri, 17 Dec 2021 13:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q1eKhq2bqrV9lsdOLqCo+PHZ3P8K0YCIKd4ebTTXktk=; b=fyVtZc/WsQPgfq ctTdP1854fL0mS2hleS4ykZyWHYRGBcoFy1A+EtBvzbFnLV5v+4DrvncsETaaHoXpLoV9LMZDN0Qt kyfhcq9Iie8jdzOCo/LxXkx2nFoHzdpHoaSjBJmbpraYcMTAWPY/wmu9f3ZNHnOBAFB3AOsOkGMIM VO5DtsIbcDxKOZEQ30eRdEMwxWbirLl1jk3caALHtOmmOnFOGFSr0X8drcEpVZ96jsMGLVVpnvYR8 9KeBOX+BLAuRjtIJQgbhxsAxAiOt9PF3XbYd8mVoS33ZepmWccw6y9duq0rJgwvWS6lj92KvSXI6K C977IJh/GMT9+TM8qb8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDf3-00ATfz-P0; Fri, 17 Dec 2021 13:52:37 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDdy-00AT9r-9v for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:32 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 97B1D5C00D5; Fri, 17 Dec 2021 08:51:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 17 Dec 2021 08:51:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=7rP08aPs+xkew nuaJ6Ep4THyh1QpRjJ5GUE1j3GW0Os=; b=Ucopgy+oR+slJ3z7TBPhcOuK1RM1t iM7qU/m8XOqQA1u+Rr9qj+LV619LrYKBDPcHizSNbdGLstvgyfsHzAP6p6lnE75o s5LyYNZMeR7WGRoO4kE6AAmS5OTIwK1KctLWpg8aEEvVKskzdjnYcjfLhEZw3H5I 1dX1DBfIG5F19Xjqlhuib9KBmpyH66QmO/q6q48pXyWzUGFcoaSq/Gz8rkd/s8XC pJG+QsjifbqQNBw3ltbX4wk+a0MuauPGmXprq4zW3CJQ5kV72HPVlUC2jnBev11x XpT2+NDfDjDPC9RNZOkINZ5GStmCrvpEJR0cAXor2DZYZiqZMnvYI6fmw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=7rP08aPs+xkewnuaJ6Ep4THyh1QpRjJ5GUE1j3GW0Os=; b=bgEwdLoF ox51bq0tsX8ATQqKz0rsOKzJzvOgWY+ih+Hq5g8hVJ3tVKfIc0xAN1Gr4zWJ1rzp gsixarMvMzV8UpERiNN6QJDhONqfZK2qnq44CDkdqqZ65Pt6NUA7PVL/+8FwEWvh Xk+rX/y+3AwTfeeIrzWdbDZp3bx0Og2ULq9TTX2/PqyPcxLTQ+QD2TkvxamciHgs 1TLvUwezSVed+viOH1gDQ10JJekyuCmr4Lw2y5MSgUvPB+gqrUNAVxKKthLERW/+ HzEmDc1bvxMt0EB+rHGbNRPEiifo/3oZ87c5/DZZ5/BTCL5i9NmQ3cELgCIm7IIw JtoJOceSN0dZPQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:26 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 2/7] drm/of: Change the prototype of drm_of_lvds_get_dual_link_pixel_order Date: Fri, 17 Dec 2021 14:51:14 +0100 Message-Id: <20211217135119.316781-3-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055130_578959_40DC3DA2 X-CRM114-Status: GOOD ( 25.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The drm_of_lvds_get_dual_link_pixel_order() function took so far the device_node of the two ports used together to make up a dual-link LVDS output. This assumes that a binding would use an entire port for the LVDS output. However, some bindings have used endpoints instead and thus we need to operate at the endpoint level. Change slightly the arguments to allow that. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 9 +- drivers/gpu/drm/drm_of.c | 138 ++++++++++++++++++++------ drivers/gpu/drm/rcar-du/rcar_lvds.c | 8 +- include/drm/drm_of.h | 16 ++- 4 files changed, 123 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c index 945f08de45f1..763be3a43565 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c @@ -568,15 +568,10 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ctx->lvds_dual_link = false; ctx->lvds_dual_link_even_odd_swap = false; if (model != MODEL_SN65DSI83) { - struct device_node *port2, *port3; int dual_link; - port2 = of_graph_get_port_by_id(dev->of_node, 2); - port3 = of_graph_get_port_by_id(dev->of_node, 3); - dual_link = drm_of_lvds_get_dual_link_pixel_order(port2, port3); - of_node_put(port2); - of_node_put(port3); - + dual_link = drm_of_lvds_get_dual_link_pixel_order(dev->of_node, 2, -1, + dev->of_node, 3, -1); if (dual_link == DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS) { ctx->lvds_dual_link = true; /* Odd pixels to LVDS Channel A, even pixels to B */ diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 59d368ea006b..0759fff201ef 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -303,13 +303,35 @@ static int drm_of_lvds_get_port_pixels_type(struct device_node *port_node) (odd_pixels ? DRM_OF_LVDS_ODD : 0); } -static int drm_of_lvds_get_remote_pixels_type( - const struct device_node *port_node) +static int drm_of_lvds_get_remote_pixels_type(const struct device_node *endpoint) { - struct device_node *endpoint = NULL; - int pixels_type = -EPIPE; + struct device_node *remote_port; + int pixels_type; - for_each_child_of_node(port_node, endpoint) { + remote_port = of_graph_get_remote_port(endpoint); + if (!remote_port) + return -EPIPE; + + pixels_type = drm_of_lvds_get_port_pixels_type(remote_port); + of_node_put(remote_port); + + if (pixels_type < 0) + return -EPIPE; + + return pixels_type; +} + +static int drm_of_lvds_check_remote_port(const struct device_node *dev, int id) +{ + struct device_node *endpoint; + struct device_node *port; + int previous_pt = -EPIPE; + + port = of_graph_get_port_by_id(dev, id); + if (!port) + return -EINVAL; + + for_each_child_of_node(port, endpoint) { struct device_node *remote_port; int current_pt; @@ -318,14 +340,19 @@ static int drm_of_lvds_get_remote_pixels_type( remote_port = of_graph_get_remote_port(endpoint); if (!remote_port) { - of_node_put(endpoint); + of_node_put(port); return -EPIPE; } current_pt = drm_of_lvds_get_port_pixels_type(remote_port); of_node_put(remote_port); - if (pixels_type < 0) - pixels_type = current_pt; + if (!current_pt) { + of_node_put(port); + return -EINVAL; + } + + if (previous_pt < 0) + previous_pt = current_pt; /* * Sanity check, ensure that all remote endpoints have the same @@ -334,19 +361,26 @@ static int drm_of_lvds_get_remote_pixels_type( * configurations by passing the endpoints explicitly to * drm_of_lvds_get_dual_link_pixel_order(). */ - if (!current_pt || pixels_type != current_pt) { - of_node_put(endpoint); + if (previous_pt != current_pt) { + of_node_put(port); return -EINVAL; } + + previous_pt = current_pt; } - return pixels_type; + of_node_put(port); + return previous_pt < 0 ? previous_pt : 0; } /** * drm_of_lvds_get_dual_link_pixel_order - Get LVDS dual-link pixel order - * @port1: First DT port node of the Dual-link LVDS source - * @port2: Second DT port node of the Dual-link LVDS source + * @dev1: First DT device node of the Dual-Link LVDS source + * @port1_id: ID of the first DT port node of the Dual-Link LVDS source + * @endpoint1_id: ID of the first DT port node of the Dual-Link LVDS source + * @dev2: Second DT device node of the Dual-Link LVDS source + * @port2_id: ID of the second DT port node of the Dual-Link LVDS source + * @endpoint2_id: ID of the second DT port node of the Dual-Link LVDS source * * An LVDS dual-link connection is made of two links, with even pixels * transitting on one link, and odd pixels on the other link. This function @@ -360,43 +394,85 @@ static int drm_of_lvds_get_remote_pixels_type( * * If either port is not connected, this function returns -EPIPE. * - * @port1 and @port2 are typically DT sibling nodes, but may have different - * parents when, for instance, two separate LVDS encoders carry the even and odd - * pixels. + * @port1_id and @port2_id are typically DT sibling nodes, but may have + * different parents when, for instance, two separate LVDS encoders carry the + * even and odd pixels. + * + * If @port1_id, @port2_id, @endpoint1_id or @endpoint2_id are set to -1, their + * value is going to be ignored and the first port or endpoint will be used. * * Return: - * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @port1 carries even pixels and @port2 - * carries odd pixels - * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @port1 carries odd pixels and @port2 - * carries even pixels - * * -EINVAL - @port1 and @port2 are not connected to a dual-link LVDS sink, or - * the sink configuration is invalid - * * -EPIPE - when @port1 or @port2 are not connected + * * DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS - @endpoint1_id carries even pixels and + * @endpoint2_id carries odd pixels + * * DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS - @endpoint1_id carries odd pixels and + * @endpoint2_id carries even pixels + * * -EINVAL - @endpoint1_id and @endpoint2_id are not connected to a dual-link + * LVDS sink, or the sink configuration is invalid + * * -EPIPE - when @endpoint1_id or @endpoint2_id are not connected */ -int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, - const struct device_node *port2) +int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *dev1, + int port1_id, + int endpoint1_id, + const struct device_node *dev2, + int port2_id, + int endpoint2_id) { + struct device_node *endpoint1, *endpoint2; int remote_p1_pt, remote_p2_pt; + int ret; - if (!port1 || !port2) + if (!dev1 || !dev2) return -EINVAL; - remote_p1_pt = drm_of_lvds_get_remote_pixels_type(port1); - if (remote_p1_pt < 0) + if (endpoint1_id == -1) { + ret = drm_of_lvds_check_remote_port(dev1, port1_id); + if (ret) + return ret; + } + + if (endpoint2_id == -1) { + ret = drm_of_lvds_check_remote_port(dev2, port2_id); + if (ret) + return ret; + } + + endpoint1 = of_graph_get_endpoint_by_regs(dev1, port1_id, endpoint1_id); + if (!endpoint1) + return -EINVAL; + + endpoint2 = of_graph_get_endpoint_by_regs(dev2, port2_id, endpoint2_id); + if (!endpoint2) { + of_node_put(endpoint1); + return -EINVAL; + } + + remote_p1_pt = drm_of_lvds_get_remote_pixels_type(endpoint1); + if (remote_p1_pt < 0) { + of_node_put(endpoint2); + of_node_put(endpoint1); return remote_p1_pt; + } - remote_p2_pt = drm_of_lvds_get_remote_pixels_type(port2); - if (remote_p2_pt < 0) + remote_p2_pt = drm_of_lvds_get_remote_pixels_type(endpoint2); + if (remote_p2_pt < 0) { + of_node_put(endpoint2); + of_node_put(endpoint1); return remote_p2_pt; + } /* * A valid dual-lVDS bus is found when one remote port is marked with * "dual-lvds-even-pixels", and the other remote port is marked with * "dual-lvds-odd-pixels", bail out if the markers are not right. */ - if (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD) + if (remote_p1_pt + remote_p2_pt != DRM_OF_LVDS_EVEN + DRM_OF_LVDS_ODD) { + of_node_put(endpoint2); + of_node_put(endpoint1); return -EINVAL; + } + of_node_put(endpoint2); + of_node_put(endpoint1); return remote_p1_pt == DRM_OF_LVDS_EVEN ? DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS : DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS; diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 72a272cfc11e..09a43c2bb0ad 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -617,7 +617,6 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds) { const struct of_device_id *match; struct device_node *companion; - struct device_node *port0, *port1; struct rcar_lvds *companion_lvds; struct device *dev = lvds->dev; int dual_link; @@ -645,11 +644,8 @@ static int rcar_lvds_parse_dt_companion(struct rcar_lvds *lvds) * connected to, if they are marked as expecting even pixels and * odd pixels than we need to enable vertical stripe output. */ - port0 = of_graph_get_port_by_id(dev->of_node, 1); - port1 = of_graph_get_port_by_id(companion, 1); - dual_link = drm_of_lvds_get_dual_link_pixel_order(port0, port1); - of_node_put(port0); - of_node_put(port1); + dual_link = drm_of_lvds_get_dual_link_pixel_order(dev->of_node, 1, -1, + companion, 1, -1); switch (dual_link) { case DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS: diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index 99f79ac8b4cd..fb0213085db3 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -47,8 +47,12 @@ int drm_of_find_panel_or_bridge(const struct device_node *np, int port, int endpoint, struct drm_panel **panel, struct drm_bridge **bridge); -int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, - const struct device_node *port2); +int drm_of_lvds_get_dual_link_pixel_order(const struct device_node *dev1, + int port1_id, + int endpoint1_id, + const struct device_node *dev2, + int port2_id, + int endpoint2_id); int drm_of_lvds_get_data_mapping(const struct device_node *port); #else static inline uint32_t drm_of_crtc_port_mask(struct drm_device *dev, @@ -94,8 +98,12 @@ static inline int drm_of_find_panel_or_bridge(const struct device_node *np, } static inline int -drm_of_lvds_get_dual_link_pixel_order(const struct device_node *port1, - const struct device_node *port2) +drm_of_lvds_get_dual_link_pixel_order(const struct device_node *dev1, + int port1_id, + int endpoint1_id, + const struct device_node *dev2, + int port2_id, + int endpoint2_id) { return -EINVAL; } From patchwork Fri Dec 17 13:51:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CF16C433F5 for ; Fri, 17 Dec 2021 13:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kd+lReG29h0Iwd0ZTarJNiOkHWsySJw+Yl6/ioVQfS8=; b=bt1iJYyasiFZzd peaZtLe5wx4XyReKs2CZDjUEi1tG4WMwYsv/tZQ1TvAuC0lPz3kCSN8DaS7RafxmUijiuZJ67iqyg 6GyXK6jsnL0ZCZOH2gLwZpQSRpuexI88f7IGmHoNuONMdPtC3PlcNz9lGkL5u9URBmhqYJT//Y5Et 2eekyy8TQ3yzRaJ//PAD1vcMRlP6xJZTCBBYxXkgNkBxiqY4SuDi/C7Oa+3jOZZmBnixFIrTQqFBs W5OtHAzsM284zJKNxAMp4cDkrcEQPru9lGvxY8E6LQ43uunlXcqiPNH7uxrsEgX02AzpZhCYT5mdm d9igRWvEfbxVcN7G1/sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDei-00ATTs-LM; Fri, 17 Dec 2021 13:52:16 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDdy-00ATBP-M0 for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:32 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id EB1345C018C; Fri, 17 Dec 2021 08:51:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 17 Dec 2021 08:51:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=PKzc2Vxci6FO1 OEIAWNnzaJB8YhU7B9s1fu0Qqa+tFU=; b=Z6c6gMX7KO+q8KVwJDME5bgi6qax0 PoGDKFBc6AGYFIpEX5SSlWRSJZD/rLqYp80WPvMF6tlIUM62OmaOMBRSha8j1KoO 1IkNyicBcmoxZRoOz2rvMiU7tLQ1Pt18CSj2CPaGhiK7v8LEYZfAvdIR+6K2+cxx +5CTr3WLnvo/DX4/rGsZau54KtZSkqEEPVTnsTJjBKxX4XSgZH65mcaoYW6eZLJx 9/nlRrCsYolvRCm2y1Nl8NvMmDitU+E2D6cUBPj9G5oWVLhDEigQkr5fvI3F+uI0 yCvqpi4Po5zePKbGDlHmjl9AVmC8SDsTJSG7L7du737cNRuEPIdmb7WAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=PKzc2Vxci6FO1OEIAWNnzaJB8YhU7B9s1fu0Qqa+tFU=; b=VyBxtgR5 4iXaYmqzqQlzO5S1O/NvbCwoF3yUh3DjL5gl1TaUEdKd9X06zCmck8OUxG/h54tG yA5ctPhydy5lA9XhooWOfNHmweybv72MTsAMf037QN4QTDF0jyAPbplst6fHrH+W 3z8W5id01T6qER/+v9qkIJ9026UxXYROim6wH7Z2MKdvszXv3he4KhueNBPrzETj G/qCGX0jNHiKEFYMyuroK5I9DjEtmdyORBsNU5E3Ve9e0dOMWwsvIneNlMjAg5Rm la9MZXlGYqisuqz6VUJVjLNfqAVUDWvqHOQiSGL62wfVZ3uf2dgn3qd0yeyV/EYS P6go8YVLnanbXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:28 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 3/7] dt-bindings: display: sun4i: Add LVDS link companion property Date: Fri, 17 Dec 2021 14:51:15 +0100 Message-Id: <20211217135119.316781-4-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055130_834687_1E596753 X-CRM114-Status: UNSURE ( 9.55 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Allwinner SoCs with two TCONs and LVDS output can use both to drive an LVDS dual-link. Add a new property to express that link between these two TCONs. Reviewed-by: Laurent Pinchart Signed-off-by: Maxime Ripard --- .../bindings/display/allwinner,sun4i-a10-tcon.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml index 3a7d5d731712..42dcb8a86433 100644 --- a/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml +++ b/Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tcon.yaml @@ -113,6 +113,12 @@ properties: - const: edp - const: lvds + link-companion: + $ref: /schemas/types.yaml#/definitions/phandle + description: > + Phandle to the other TCON in the system used to drive a dual-link LVDS + output. This property shall be set in both TCON instances. + ports: $ref: /schemas/graph.yaml#/properties/ports From patchwork Fri Dec 17 13:51:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBE76C433F5 for ; Fri, 17 Dec 2021 13:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vr6GoH+pI2xq3Gctrs+Ccu720ADGbhPFBzRyP3mruxE=; b=5AgC8WXVCiip5B N+oOwnfjGpMlC8tPSWc7zXPF5isiRpSIFwac9JgPsBF0T0tVfnQ+eMsrDRRnGSxV00TcLvL/mcF++ HS3LB5Cx8Jc97FuPy0UHAPzDwM4i0dhwFUDeLOpax9gsJJMN3PA/wmewegvIN9NZ3Hb/XAvBplu+7 AQZ8kJS6rNPP0gfHExY1C6Tsq40InUh+57102OB8RKuh3skbHUV1YU5JvSkOrL1Q+NlM7Mv3elz/E HZETWnhou3XyLBeEo6yQL5onu5shskhbwflnR33/6KndHWjRK4Bwa5F973zxBAFCMpTsVuZmAPGLb PGE1UKLrAYgLt7lPOHOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDfU-00ATub-1G; Fri, 17 Dec 2021 13:53:04 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDe0-00ATCU-JY for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:34 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E949C5C0178; Fri, 17 Dec 2021 08:51:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 17 Dec 2021 08:51:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=aH1pAYV+tXJ5x oBSTjz2hscIrtUupVA0V4HuuGPNrPA=; b=LJPQK6m1mIXxl0h5ObR+8A4C8RZ8Q +fvIv5BYCqj7YX9qt3PYT3zZXxkSoR9Xv8PZEwY+qnyOid4Y8Zko9xtHlctjq8nG qEtMeUoAWaXxQ0k+tr1LGnxk5vd7zI4TZyPP4cm3jmKO/c7TvIv3RicSkDYi8ZGr niHqgGO6Re+ScOdinXadEYTw7N1gUgOIxZtKBXxmj7zkXZyG2yGI6RJMzxehAgRV s2HoFjqeUOePmDXswpW/abtQOICoPTEkWd+jqtfZVakIfrswpzV0wIykGNBw8oXj PeW0SzW7ievQB/9KcYDQN6ZV1vNM3NMXDE1KSKsRW054llYfmO8AANgmA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=aH1pAYV+tXJ5xoBSTjz2hscIrtUupVA0V4HuuGPNrPA=; b=nnTF8YBQ AtGGJy/lKacV3rpudcLgG4HhzGRUTqngZmJS4HzGO7MMKLhRaRifBtlg/qkaQFAV DYBDEzOZuyEUAPxmlfSkNkrEcqsIEEioEcZG91rlt9dRXCBFNOaG7K/9sVWH6/Wj UIsFO45YfWrQ/9XvIh52ngoBf0CZ5mvUD3t7l8d1JPCnCmxUPTrgKkhaeDlLJVpQ ID5DjBjaBiFLg7GOanGbuiedNgu7uZHVMXU3QHkeODOlB1Q0pFMS7MlzFKDrjMOU RmPMWmbIo3ZmwjTEt907NM99bx75CQkIaRCflDxOPKtWHx1VBdXLAE400N6tr8dg mWySCtDAcAfj8g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:31 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 4/7] drm/sun4i: tcon: Refactor the LVDS and panel probing Date: Fri, 17 Dec 2021 14:51:16 +0100 Message-Id: <20211217135119.316781-5-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055132_763407_F26A16B5 X-CRM114-Status: GOOD ( 19.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current code to parse the DT, deal with the older device trees, and register either the RGB or LVDS output has so far grown organically into the bind function and has become quite hard to extend properly. Let's move it into a single function that grabs all the resources it needs and registers the proper panel output. Reviewed-by: Chen-Yu Tsai Reviewed-by: Laurent Pinchart Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 127 +++++++++++++---------------- 1 file changed, 58 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 88db2d2a9336..4e01807ecf41 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -866,6 +866,63 @@ static int sun4i_tcon_init_regmap(struct device *dev, return 0; } +static int sun4i_tcon_register_panel(struct drm_device *drm, + struct sun4i_tcon *tcon) +{ + struct device_node *companion; + struct device_node *remote; + struct device *dev = tcon->dev; + int ret; + + /* + * If we have an LVDS panel connected to the TCON, we should + * just probe the LVDS connector. Otherwise, let's just register + * an RGB panel. + */ + remote = of_graph_get_remote_node(dev->of_node, 1, 0); + if (!tcon->quirks->supports_lvds || + !of_device_is_compatible(remote, "panel-lvds")) + return sun4i_rgb_init(drm, tcon); + + /* + * This can only be made optional since we've had DT + * nodes without the LVDS reset properties. + * + * If the property is missing, just disable LVDS, and + * print a warning. + */ + tcon->lvds_rst = devm_reset_control_get_optional(dev, "lvds"); + if (IS_ERR(tcon->lvds_rst)) { + dev_err(dev, "Couldn't get our reset line\n"); + return PTR_ERR(tcon->lvds_rst); + } else if (!tcon->lvds_rst) { + dev_warn(dev, "Missing LVDS reset property, please upgrade your DT\n"); + return -ENODEV; + } + + reset_control_reset(tcon->lvds_rst); + + /* + * This can only be made optional since we've had DT + * nodes without the LVDS clocks properties. + * + * If the property is missing, just disable LVDS, and + * print a warning. + */ + if (tcon->quirks->has_lvds_alt) { + tcon->lvds_pll = devm_clk_get_optional(dev, "lvds-alt"); + if (IS_ERR(tcon->lvds_pll)) { + dev_err(dev, "Couldn't get the LVDS PLL\n"); + return PTR_ERR(tcon->lvds_pll); + } else if (!tcon->lvds_pll) { + dev_warn(dev, "Missing LVDS PLL clock, please upgrade your DT\n"); + return -ENODEV; + } + } + + return sun4i_lvds_init(drm, tcon); +} + /* * On SoCs with the old display pipeline design (Display Engine 1.0), * the TCON is always tied to just one backend. Hence we can traverse @@ -1113,10 +1170,8 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, struct drm_device *drm = data; struct sun4i_drv *drv = drm->dev_private; struct sunxi_engine *engine; - struct device_node *remote; struct sun4i_tcon *tcon; struct reset_control *edp_rstc; - bool has_lvds_rst, has_lvds_alt, can_lvds; int ret; engine = sun4i_tcon_find_engine(drv, dev->of_node); @@ -1161,58 +1216,6 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, return ret; } - if (tcon->quirks->supports_lvds) { - /* - * This can only be made optional since we've had DT - * nodes without the LVDS reset properties. - * - * If the property is missing, just disable LVDS, and - * print a warning. - */ - tcon->lvds_rst = devm_reset_control_get_optional(dev, "lvds"); - if (IS_ERR(tcon->lvds_rst)) { - dev_err(dev, "Couldn't get our reset line\n"); - return PTR_ERR(tcon->lvds_rst); - } else if (tcon->lvds_rst) { - has_lvds_rst = true; - reset_control_reset(tcon->lvds_rst); - } else { - has_lvds_rst = false; - } - - /* - * This can only be made optional since we've had DT - * nodes without the LVDS reset properties. - * - * If the property is missing, just disable LVDS, and - * print a warning. - */ - if (tcon->quirks->has_lvds_alt) { - tcon->lvds_pll = devm_clk_get(dev, "lvds-alt"); - if (IS_ERR(tcon->lvds_pll)) { - if (PTR_ERR(tcon->lvds_pll) == -ENOENT) { - has_lvds_alt = false; - } else { - dev_err(dev, "Couldn't get the LVDS PLL\n"); - return PTR_ERR(tcon->lvds_pll); - } - } else { - has_lvds_alt = true; - } - } - - if (!has_lvds_rst || - (tcon->quirks->has_lvds_alt && !has_lvds_alt)) { - dev_warn(dev, "Missing LVDS properties, Please upgrade your DT\n"); - dev_warn(dev, "LVDS output disabled\n"); - can_lvds = false; - } else { - can_lvds = true; - } - } else { - can_lvds = false; - } - ret = sun4i_tcon_init_clocks(dev, tcon); if (ret) { dev_err(dev, "Couldn't init our TCON clocks\n"); @@ -1247,21 +1250,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, } if (tcon->quirks->has_channel_0) { - /* - * If we have an LVDS panel connected to the TCON, we should - * just probe the LVDS connector. Otherwise, just probe RGB as - * we used to. - */ - remote = of_graph_get_remote_node(dev->of_node, 1, 0); - if (of_device_is_compatible(remote, "panel-lvds")) - if (can_lvds) - ret = sun4i_lvds_init(drm, tcon); - else - ret = -EINVAL; - else - ret = sun4i_rgb_init(drm, tcon); - of_node_put(remote); - + ret = sun4i_tcon_register_panel(drm, tcon); if (ret < 0) goto err_free_dotclock; } From patchwork Fri Dec 17 13:51:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D4ECC433EF for ; Fri, 17 Dec 2021 13:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sxwopr3n8OxEjHkoq8LvQL2pkmXRrVjQPITcgi+U3Kk=; b=tg4Jvp6wXbhbSq Dwpo1Nl5IN/dJnMWBATT50DWZZggsZYmSLVcjvCszECVLpdQbu5SyjK6FhhkCE7RKK1As9fSJHXkx 9I8uHX6fpIgc7EmOTy2C+twAaJlslMo2BLd/gielyef9tyXSXSbJ60uD25NPPOVgSaYcvxFnA6vhD AL5IVsF0qDuCEwS3fkV2a5nWv2daQ6T3QVcLYzuByT2Us2d8Mjyhrzef7qf10Cc8qFoYehUoFdA8z 6oP7WG2tww4c27RJZJCDSr0QybdLis4kJD1JC4I8hmICYy5wIUwdRVaUddENa6W7mIE9LqolWe5WH eSLFbggTnJ2Yp2s5Zlew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDg0-00AUCT-V4; Fri, 17 Dec 2021 13:53:37 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDe2-00ATDe-HV for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:36 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id DC8AE5C017C; Fri, 17 Dec 2021 08:51:33 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 17 Dec 2021 08:51:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=yLWoOkQ6TZzUy yl70PvyuMwtxMG3V7qoapONhdLCXyI=; b=NFsq8BO2itVdQMaGRqA6A6ThpdVT5 14vCnVSUHRAM6GVTT9SCVZQEwgOVrB3VNUpl7VQi12+yuqmkubec7MKO3i2xqQGp 6kWqUDS8TuMDIqpNsavnE/myRjhiXvkU//Asw4JfkBMRH3ir2omNDzgReh5KYoDE IS14LLPRtrcrxpft3wEm6v6W9gCGaRGmXl+eICr1cb1hqRDbuxBKld161PuPz2rg nakcDHzzSsKwwXIg60VzBIwB8IPEWLdpkPlvTAz46k6GjnoLMCWQIeJ8G2bKt04A 4lQLw3krEy6Ktasr0rvdflTBB/9U0y5+FTwgiwurSIPhftNhsDkAlEj8A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=yLWoOkQ6TZzUyyl70PvyuMwtxMG3V7qoapONhdLCXyI=; b=S5j0Zewj iPgusZ+BAeTBVL1RMk4ot+b0X4bMZNgMpAQtRAV77foVoSXdcMTTqGICCxzQUNg8 sLkMKqS5lvqt6pvfsAczymGrCXmHE9lXsrDXjG0VXCs/3irUQwuLO0efQGJk/ftm ulQxRTmmtcE+wZ3H4nk8aRCGZ/VBplLbiBq/Cgt1UQkATpq7+ZXJpvZG1lNg0pOZ csPhxrHwzVWsD/7TCfL/fo9QJuMKJXlu88wyVMh23kQfmNGpZrcofUzlypqK+dU+ g2P+wrM8y1lBZOErkt5nWVbLRYrwA5Fl7RI/KALf+dSzK43otUvBIW/H2D5hv2p2 Q2pXkepshUXhYQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:33 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 5/7] drm/sun4i: tcon: Support the LVDS Dual-Link Date: Fri, 17 Dec 2021 14:51:17 +0100 Message-Id: <20211217135119.316781-6-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055134_711378_4C3CCA93 X-CRM114-Status: GOOD ( 19.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The A20 and other SoC with two TCONs (A31, R40, etc.) can use its second TCON as the secondary LVDS link in a dual-link setup, with the TCON0 being the main link. Extend a bit the parsing code to leverage the DRM dual-link code, register only the LVDS output on the primary TCON, and add the needed bits to setup the TCON properly. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 36 ++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_tcon.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 4e01807ecf41..5e8f020d8c03 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -475,6 +475,10 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, SUN4I_TCON0_BASIC2_V_BACKPORCH(bp)); reg = SUN4I_TCON0_LVDS_IF_CLK_SEL_TCON0; + + if (tcon->lvds_dual_link) + reg |= SUN4I_TCON0_LVDS_IF_DUAL_LINK; + if (sun4i_tcon_get_pixel_depth(encoder) == 24) reg |= SUN4I_TCON0_LVDS_IF_BITWIDTH_24BITS; else @@ -884,6 +888,16 @@ static int sun4i_tcon_register_panel(struct drm_device *drm, !of_device_is_compatible(remote, "panel-lvds")) return sun4i_rgb_init(drm, tcon); + /* + * Only the TCON0 will be relevant for the LVDS output, so if + * our ID is something else, let's prevent our TCON from + * registering its own LVDS output + */ + if (tcon->id) { + dev_dbg(dev, "TCON used as an LVDS secondary link."); + return 0; + } + /* * This can only be made optional since we've had DT * nodes without the LVDS reset properties. @@ -920,6 +934,28 @@ static int sun4i_tcon_register_panel(struct drm_device *drm, } } + /* + * If we don't have a second TCON, we will never be able to do + * dual-link LVDS, so we don't have much more to do. + */ + companion = of_parse_phandle(dev->of_node, "link-companion", 0); + if (!companion) + return sun4i_lvds_init(drm, tcon); + + /* + * Let's do a sanity check on the dual-link setup to make sure + * everything is properly described. + */ + ret = drm_of_lvds_get_dual_link_pixel_order(dev->of_node, 1, 0, + companion, 1, 0); + if (ret < 0) { + dev_err(dev, "Invalid Dual-Link Configuration.\n"); + return ret; + } + + dev_info(dev, "Primary TCON, enabling LVDS Dual-Link"); + tcon->lvds_dual_link = true; + return sun4i_lvds_init(drm, tcon); } diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index e624f6977eb8..7609a880a8a7 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -98,6 +98,7 @@ #define SUN4I_TCON0_LVDS_IF_REG 0x84 #define SUN4I_TCON0_LVDS_IF_EN BIT(31) +#define SUN4I_TCON0_LVDS_IF_DUAL_LINK BIT(30) #define SUN4I_TCON0_LVDS_IF_BITWIDTH_MASK BIT(26) #define SUN4I_TCON0_LVDS_IF_BITWIDTH_18BITS (1 << 26) #define SUN4I_TCON0_LVDS_IF_BITWIDTH_24BITS (0 << 26) @@ -281,6 +282,9 @@ struct sun4i_tcon { /* Associated crtc */ struct sun4i_crtc *crtc; + /* Is the LVDS link a dual-channel link? */ + bool lvds_dual_link; + int id; /* TCON list management */ From patchwork Fri Dec 17 13:51:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5ECDBC433EF for ; Fri, 17 Dec 2021 13:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l50BAKcWDuusmOp3WeXrgWQwHvllER2iKYRj1hsNObU=; b=Fxz6Y0GJNK05pE dKSUIMRgT221GH+V0RPBHqgkxR9IwEc0OC6tBQj+DIilKHQRaaF29G2ivwy4deZMe1OirdS8SmchT 8RhKy54Nexd5z534iJC01UCB0odJsXCV2hDcgmg7WYphUOo6SxLuiBW3t9xVd5YnN9kEuqb5Sjmit 0J487mqEP52TCEyJ5dhdykCKd/AVJoD0QOWMwlqhHxLmZbKxih69h+eg9aTNV36Ug9HX5z2Z2CLdO LBXzNLY1YCzQ+CvwMp/+ETGUJhH5sGPx48/iTucVSr4em55O/6mm+eFyQtXqPntTKrSclYJsLmabH Ur2qPSkQV89PKit9jZKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDga-00AUWw-TK; Fri, 17 Dec 2021 13:54:13 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDe4-00ATEJ-I9 for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:39 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D3C865C014E; Fri, 17 Dec 2021 08:51:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 17 Dec 2021 08:51:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=M5JGNx9FeMwdw lOvMmXdMRjjfgLQMV3WSX6j7dpkXZ8=; b=a2v5ceb/6apx31i/nsZy/79JostkI fwdoE1hfjWasvTUBPODdOpuvuc4hg3KG0xX+8+34BYG2HQUqz9ZwuSZN2mtzHZ8k vTGKMMavHCkLVlR+g4s75QzkVHF2dd/9uxxWv+Y+m/BCY6rSF8ZF1Ajdu03OOmXP uq6vvdg/+duZf6vHuWKn3Z6MevIi/f+XTEgUmpifacREjyFH2LuZZUuIgxdibuy4 OXDAPO3ufsNaRxH3mPnyLT2yyKdIS8EdburlsNpTCoSKnIOh3h0fBT2Fnd3m1cut a+DQZp60qEHIwBqehAUbP3pMk5trYnnP/pPmEe6lGxUEH3jfNpsS15h8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=M5JGNx9FeMwdwlOvMmXdMRjjfgLQMV3WSX6j7dpkXZ8=; b=C1M7Wd3L E9A8qM0giTVfJKvIuZk5EKIJYBkVZpwNFNjd9sFpUMuKX4MjHitstrAnmCV/oLVM jxEtFfR7mgEnBmCVrI2WjEiFZddZs9E3hsg/Jm5/ez+g+xAVLCzfiW/sbPsVY0M9 58J7du7izO9tCtLhZwWiwW+fUzN0zxlhDH1WJLxrhfLTSwQ5T7QwIHo5jZ8HvQq5 qhAoIxMhuE8I4bOcj9lDbI6zgwljiOjnPFyPVj3ObA1NjSixyRar6qaEDCRW/I/C z24gMFIZXrlb4syVuf8CoKGQJ/IHHZt5Tbk6ZNWwwftdCti3RPnV1MKPS7u3akxj ty8hEWG6R60qqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:35 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 6/7] drm/sun4i: tcon: Enable the A20 dual-link output Date: Fri, 17 Dec 2021 14:51:18 +0100 Message-Id: <20211217135119.316781-7-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055136_750060_C9F404D0 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The A20 second TCON (TCON1) can be used as a secondary output to drive a dual-link LVDS output. Let's add it to our capabilities. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 5e8f020d8c03..fef9457d898e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -1519,6 +1519,7 @@ static const struct sun4i_tcon_quirks sun7i_a20_tcon0_quirks = { }; static const struct sun4i_tcon_quirks sun7i_a20_quirks = { + .supports_lvds = true, .has_channel_0 = true, .has_channel_1 = true, .dclk_min_div = 4, From patchwork Fri Dec 17 13:51:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12696664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A8C9C433FE for ; Fri, 17 Dec 2021 13:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JvCYosrIRyjyhfOarwlDLy7wXK7CsLn64rYcKqdhaCE=; b=JmAWkwt2OubWrO iNiTT/+TRO1dSUyv1Hv7INjB4lKmUkZO+qYxa/1vD7J5REWzIrGG7J04lG0F44CZw8Mjv/QyHMyGa 1N+XL3JE/p6xKOMBTkanXqM6BvxnB84ItB7wWzEhLznUsv/a9cF877/XZDLgfin6AK2z1yc5i35kU UoY/t/clLR3xgzFKP2AkeFZVq4c9BgFQ2Pk6CCRxFi15eQcGbP2D+mzcL2vucfLx1A1LRP70BklVY SIDpFoJEDphqSixjooNwnVJYojN3xy1udnp3eiaqmy0T9qPnpxoDTWbVhh1Sf2J4MO5CjuM8QIg7d B4eXxXYgDjODBIjwntUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDh9-00AUoM-7R; Fri, 17 Dec 2021 13:54:47 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1myDe6-00ATFI-IA for linux-arm-kernel@lists.infradead.org; Fri, 17 Dec 2021 13:51:40 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CD7645C015B; Fri, 17 Dec 2021 08:51:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 17 Dec 2021 08:51:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=Ztxo4N32XiR58 mScp1s8TZl41sIcckkAII1E43MP8WI=; b=VBx59HdI91cjCbnU0Y+eumZ3Wlm+T w/Z4iw9JgwUo3GVNRgqpq+JiOs+uouu35rMf1joB9QdetMOnz8pwBT6X3XZ5fH1Z zF87LYVSSQqZqFWNjrSuId/snO/6VBjhuH2YdRaTPla++pCsphP+f25At6gC7uSU JtFy+GYa30FmqQffWaxuvZMK2zo8Z13beigyOcz5Zkuapvde6sPfhodQ9av67+xd jgr6vM4P7VV4sAIZBDTnOu0r5amXf5+ODGeIrRDzfeY2X99WQ8B2PnDSjCCXpRXN jOZ14t6d3FdAM2fDLnOek86oczdvNNgbV0JESU+Bcq8G3TOihMdTi0Odg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=Ztxo4N32XiR58mScp1s8TZl41sIcckkAII1E43MP8WI=; b=hAGZe/Lm ltIrOEs9vY6R/phjr6CsdzrWD/zMPVk/b1LVu2tuT2EtkWMwVIkf0SbCmwDQyDx1 8jigk5jDR70LJCwK0An2y/NQ26znMpQuCVP+JYJCjGXOBjqd01UlcLcTwPmQJJ2P pWXCrCxDxw/E4Sf7EF/icGRwyyYQ6Iiljo8UzPpVdbi3AyflvG2sodjX0SMVs3SF BgrcAi1vhHX5pCah8qBZdQPZLD+yJDi5n7dUsujpZZ5sFd82ToH2LL3uT6WawrD2 6m4owKAkEAGdDdaIaXTdC6BWwBxU1jwdcrUrfSRbIH8LES3VUF400F7LpHVZhgsK BAQyDQO/SRU+Nw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeigdehkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Dec 2021 08:51:37 -0500 (EST) From: Maxime Ripard To: Daniel Vetter , David Airlie , Rob Herring , Frank Rowand , Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 7/7] [DO NOT MERGE] ARM: dts: sun7i: Enable LVDS Dual-Link on the Cubieboard Date: Fri, 17 Dec 2021 14:51:19 +0100 Message-Id: <20211217135119.316781-8-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217135119.316781-1-maxime@cerno.tech> References: <20211217135119.316781-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211217_055138_736312_2F692ACA X-CRM114-Status: UNSURE ( 9.10 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For the sake of the example, let's enable an LVDS Dual-Link display on a Cubieboard. Signed-off-by: Maxime Ripard --- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 69 +++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts index e35e6990c4b2..b10d387385d9 100644 --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts @@ -85,6 +85,49 @@ led-1 { gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>; }; }; + + panel: panel { + compatible = "panel-lvds"; + width-mm = <153>; + height-mm = <90>; + data-mapping = "vesa-24"; + + panel-timing { + clock-frequency = <148500000>; + hfront-porch = <88>; + hactive = <1920>; + hback-porch = <148>; + hsync-len = <44>; + + vfront-porch = <4>; + vactive = <1080>; + vback-porch = <36>; + vsync-len = <5>; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dual-lvds-even-pixels; + + panel_input_0: endpoint { + remote-endpoint = <&tcon0_out_panel>; + }; + }; + + port@1 { + reg = <1>; + dual-lvds-odd-pixels; + + panel_input_1: endpoint { + remote-endpoint = <&tcon1_out_panel>; + }; + }; + }; + }; }; &ahci { @@ -218,6 +261,32 @@ ®_usb2_vbus { status = "okay"; }; +&tcon0 { + pinctrl-names = "default"; + pinctrl-0 = <&lcd_lvds0_pins>; + link-companion = <&tcon1>; + status = "okay"; +}; + +&tcon0_out { + tcon0_out_panel: endpoint@0 { + remote-endpoint = <&panel_input_0>; + }; +}; + +&tcon1 { + pinctrl-names = "default"; + pinctrl-0 = <&lcd_lvds1_pins>; + link-companion = <&tcon0>; + status = "okay"; +}; + +&tcon1_out { + tcon1_out_panel: endpoint@0 { + remote-endpoint = <&panel_input_1>; + }; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;