From patchwork Wed Sep 29 08:42:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524913 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55739C433F5 for ; Wed, 29 Sep 2021 08:45:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 209026128E for ; Wed, 29 Sep 2021 08:45:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 209026128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=8rQhPItybTQlHYflobLOZznhbnnTuakKTfMLLL3tayc=; b=NM2jrAHYZ2mUTJ S0K6aJVQmxidNndzjwvgHwfT8zkrvdPzisnfs2y0EDiI+ZtX0bPPZOKUATwRZQpFcng5ZPyc/3bL9 39NhzgqDNUVyw1eyw2n1Qm22tvhYqmvCoHkKagtJW1LbLSKtmJg1J+ZxXkERrynSb/3uIZzGWVlbT hOAmbBBIrliC4QXDel41CCnq6iV8S1poaxRDnzWum0qqRmf5hncH2OA7jT5Dh5dZsXxPdqfI/ISzo 8T7yjdIuUCXizH2Vjb+UgQRyCGqclKi3pPYbOQQ2+owTaRgi+PEYmr3KA4HBzGkyqSvLzX2Ju5sjW j1ROHLwtUavIk6xGoOmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVB6-00ATQz-9c; Wed, 29 Sep 2021 08:43:00 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVAr-00ATMI-Td for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:42:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 96C6A3201124; Wed, 29 Sep 2021 04:42:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 29 Sep 2021 04:42:45 -0400 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=YeZoYhoLBnI/P hLkXsYpsONnRE4tJxGHMKmgk564N80=; b=Pj3Si0HzKxT9XpRI8/sIgEQfu4dV3 6Nvyyhjo4ryYETD8+M4zlLBNFlm3wY9cqcJ9a6Fr9XMYug9uMZ6zP2H4rkT+F2f8 Nqgg2K4uI6wae1lOTuIQmzzrogkMm+sT6Zp6pW0W+IEa3ril31MV9yF2vpQH5SeV c7vdxCIFGFHkL80g1gytQhli9JoTGwA3de6FG1uzTXiXibtYuR0jnBRASMsV2a5u rCeYslbOaPu0F2358XFTTFbfhDzxHuhznlsbeTjfPZTQj0yxv+yrRMXiqMcAtPXC Jvtckd/umxlczvUrXv0nBZEztm8x6Z9iiT/TJiM2HkQ6f0xB8ENFh8D5g== 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= fm3; bh=YeZoYhoLBnI/PhLkXsYpsONnRE4tJxGHMKmgk564N80=; b=HrKXdRYs X6oeZUquuntYYL2iOCueHNCaVkIMCqlrNdOuwecudbfi/woHz8IYo4mCudOE3Hcv Zur7EDAI7nVDsDAJkiFcTuJ3Evn45eeG5bhZL1Cs7GvnWWDu6ZjHt8Iu/YUP5k3k YpcepeRL9z8QeF01JCSfbV2BUn4Ur0e3zWZBYvNN5m1sJcOkS2CqH9HZqN0QHN+w YzhdnGHiRpGbWm45UEKhaJw6xoOpgcguMWbA4Ckkne7LUxbWkh7zK0GRcDXP2ZDP nhr4jqWnQ2eiX1vSIEFPT1KvhC6v//VkzFr4y3J6RdydepWhHpVHdswtM8sXePe+ yre3OeoHHMMWNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:41 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 1/7] of: Make of_graph_get_port_by_id take a const device_node Date: Wed, 29 Sep 2021 10:42:28 +0200 Message-Id: <20210929084234.1271915-2-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014246_003650_5F37495C X-CRM114-Status: GOOD ( 12.75 ) 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 3fd74bb34819..739d5d1c8c3a 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 Wed Sep 29 08:42:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524915 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53916C433F5 for ; Wed, 29 Sep 2021 08:45:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2A41A613A6 for ; Wed, 29 Sep 2021 08:45:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2A41A613A6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=hB0zrit0jahbGetq1KlkKts7StrTqXzquJcS99/9S0s=; b=F3h6KsKT6lcFBT IyALeVNVujQqxkC9B2i68axZig2pWJmzpnJHXdksibtPWijyuO+2vrWHQet8Jbod4aJSKGgm95sUe ZHtqVCQUEpbMy0pA84i5BYQt36aHdAQEEcQT4ge5J1qKvlL8X7w1vP2uRDKL3pqF0wJzzIKut7ocm E3fuM6/9fdTA0mHUUK9DQ+cekKl9jj2pAl/4jzMa1O+8YbsBVj9HO/SyYZf8DKZFzANE6rUBNKTJL 4eWKqkNyh7WkL61J7G+/rrxvdXNCrjmk5rKBZ7dimk6qZDPRm90ExbOCDiGzcVfVnBRTrWaXZKKaO jYgaTHhY97Uxq69F8tVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVBI-00ATUK-66; Wed, 29 Sep 2021 08:43:12 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVAv-00ATNH-5c for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:42:51 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 26C823201C3B; Wed, 29 Sep 2021 04:42:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 29 Sep 2021 04:42:48 -0400 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=xoWGDMqkYJxoo jhfxxwBIkYd3ZVsrUiJz6HEomEUlu0=; b=Ef3A6uRCB7IpyBl4Xwabf/quDs3hR Z4NnLx1fEk6XpQ04QrXY4OXYKOCA9ZOF6sDaWqR/7fST/y/NlVm/dUAQYIfhVLSz XJgEBtGN/0FYODjWum5RxL67gNj5NRmRe34WHnXAOCPVUrbMnBWLXachWLtMyYyC I4EGhEUFMpmWOHdcL4DOzaugFy8natmh95jigyoZDxIR6I/77qnAL5T9lzSeNtX5 Q0jxAc9iUUSWEuF5Gj3msx8coaU6mpq1EEonE3EGNkMq08sDeCCQh9nnudbSOHv/ AuKoceHXTZeg9PwvReV4+KyPOW6qJmpbh0wWWFMf+sgCWRoDBitqn4cJA== 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= fm3; bh=xoWGDMqkYJxoojhfxxwBIkYd3ZVsrUiJz6HEomEUlu0=; b=eNa93cK/ TphC4VnMZXwzlyHBlkZo09S5ATL5QKSd/KC3cpJlqisb4IpkpZl6YH6QCB7KMXSY Rp3mzEpBuKOlIyu16tU+fXloS12hCzCq7AGy6dZTd07T79/Bd/bVewwt1Q+ljUOu 6XdUmDGSudHv4PrTrXLxh34B0VPgngxdHYDFP0kpgzzsdJ3ZL4pFPFOqPC+TY8Bx +GBVF6M25zy2sYvHe7SctQjyClJMDbfZBsIKWACds2nTdOCtzeC83+lfgq66N1/h 9TT+g6uOgA1ooXAu2zjgcxxTItTILpwAl5FgvonhdiJrQPtuRXIsZKo9wyFxHmUd a6WV0iL1FuNLjw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:47 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 2/7] drm/of: Change the prototype of drm_of_lvds_get_dual_link_pixel_order Date: Wed, 29 Sep 2021 10:42:29 +0200 Message-Id: <20210929084234.1271915-3-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014249_325908_E7272AE2 X-CRM114-Status: GOOD ( 25.90 ) 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/drm_of.c | 138 +++++++++++++++++++++------- drivers/gpu/drm/rcar-du/rcar_lvds.c | 8 +- include/drm/drm_of.h | 16 +++- 3 files changed, 121 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 997b8827fed2..681664a8875f 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -300,13 +300,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; @@ -315,14 +337,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 @@ -331,19 +358,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 @@ -357,43 +391,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 d061b8de748f..40389e76e04b 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -606,7 +606,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; @@ -634,11 +633,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 b9b093add92e..7bb1f6603beb 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); #else static inline uint32_t drm_of_crtc_port_mask(struct drm_device *dev, struct device_node *port) @@ -93,8 +97,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 Wed Sep 29 08:42:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524917 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6B21C433FE for ; Wed, 29 Sep 2021 08:45:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B914A6128E for ; Wed, 29 Sep 2021 08:45:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B914A6128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=o8FamJjn0Jz8gdqIKAROWYy274aAoTW9cpdmDYyjQkE=; b=AhT1AIzydp05mp VUZSLY90FQmedCkDcVOSTjV7tyM1lgMXDX4s+kguera5I0LfQKe01ztnUb3EZ8naDZTD16a0UDsqP xbaKF1DiV6ML/vQylncFsDoSJpLXRCft1kKwOnPkkiDf6d60K5uFOEDnDaaszGKEgzAKaCjX/I28S KRuM9YmSOiaKEOay+nhVF3gFxzkoVH5qTcd/KhkhZa6Q1UZcx2AMLeRa4A4c6X+pWEGZVUBl0HNdv WwqDcf2jSavKvl9lZg0ox0cfK9JEtBKgMLJTXCW07pbxgvISS63ODH3quTF2kfcAAsuNmHYew1Zhi ToMhN2iSZlrratgadMbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVBZ-00ATYI-2f; Wed, 29 Sep 2021 08:43:29 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVAy-00ATOg-6S for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:42:53 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 22C963201805; Wed, 29 Sep 2021 04:42:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 29 Sep 2021 04:42:51 -0400 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=2XBfNZb0gFnrN QzASAZlAbRsEd3HfA8Fg9893QKOwPk=; b=iKfsDCLkoq8w/vsJH5hoeudXWh7GD su5/W9udJ7IgIfskIApTs+8H3eKieIrz9FPnnqkTHeQ1wLeaFRYW/o2A32SqRbJM bAILpS2cre1TqDc2IIHY2Z3TP9N5hb7NiAnZdGUZd7jix0CWygYuWXIgq9wDORs2 AsFWPGxqxHTN2/ENU/pT6/pSNXB/C/8f7dJUUVyKokhy55Fec31kdkGq0KEmKoED XoIqaqPkYIt5qoaUjs6vDmvJyJWMRreP6AZCcY2l0HP5+FbsksmUexmTuKfEaFM6 zEQIdCWivJV9rk/9KZDD9QbO/uGKBvrRqjN6Jhwen22ptvXy15QqCC3mA== 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= fm3; bh=2XBfNZb0gFnrNQzASAZlAbRsEd3HfA8Fg9893QKOwPk=; b=BjGZ6CKZ KLLP3t+EM13GdAAWJOzBkGRJA1Zs6DqIzjl94GZtuLiwvBt1j330kCbcgu95Yyjw DvmvppQQrixIBxwUuKnAFezeVB+WIFDYjlum8YDfyVD5r6F2reDTtTWQkSFeikqj HC4e6e6usoOhGYf/KL0IyhtBTkXq/wsxpRIJzfu7d9ZEwNX4dJOfcUHdXElmxjn3 CGkiKLHtF7m4+9pyfLlwyVFSUk0DCuwieiiAMugGCl0ZxQ+NlAMxd4DsUVf/40WP LPzfJ4vURcJe0/4z87dFyj0fDKx9lLi5UXD1T7AKxxyExQKBggQdMrIPqGVZoGEk I7e1aw5u5BrgCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:50 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 3/7] dt-bindings: display: sun4i: Add LVDS Dual-Link property Date: Wed, 29 Sep 2021 10:42:30 +0200 Message-Id: <20210929084234.1271915-4-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014252_289484_D3A63348 X-CRM114-Status: GOOD ( 10.33 ) 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. Signed-off-by: Maxime Ripard Reviewed-by: Laurent Pinchart --- .../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..d01b0689785c 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. + ports: $ref: /schemas/graph.yaml#/properties/ports From patchwork Wed Sep 29 08:42:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524919 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51418C433F5 for ; Wed, 29 Sep 2021 08:46:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 22CE36128E for ; Wed, 29 Sep 2021 08:46:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 22CE36128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=krZzD73lgcGcJFRAvOspFP5lb0nS1YCxK8JMNPByQSQ=; b=n8/MUFi2XZn06J eXENXteXyQh+2u2LMP+07jHdz/QMd5iFvX3WxMt32YvBIcPdHym9v9ET7eU2tXskeSaFPer06g7T/ r9pTud9nJJGDl4HDhUH150GrvA+bKwNmiiIsQruD1If+wjWDXihWsL53DB7vJqcNqUyeWrWFkqZeq DOsFDeLwgnUkGwXbCAnRhdKezCCeQY8PcJ6nPqAxeS95J/88fnN3S520/fBdHWI4F4QpOJLgro6kp l8WLAjR1pvntQlLDoQP3CTyJrLofroMNH6C/3UULPSQxUy7NDE7iAAiOcVGxkTSHHyj3CKxpi5J/O cS3e/8oAJIvKbfIM+5pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVBq-00ATfA-AM; Wed, 29 Sep 2021 08:43:46 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVB1-00ATPg-2p for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:42:57 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 03B9C3200F9F; Wed, 29 Sep 2021 04:42:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 29 Sep 2021 04:42:54 -0400 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=m7erXvXAgiomR 18EaZboPnGxQzKM2J1BreGTXbt+er0=; b=fJK16vRqXpt34z6Xpz7OAJEcgjRrr xvmeiq2Ja1I5r1UCYdYM2beU6X9J+GlMDrgRfbPb7rNRzHNvNc43KlTXDJ8EnqhH gNzVvlKT+6Ct8Jlw0b7+saJvSjDM8b3skPhi3otNNaRIHgmqhBcOZVWz/TjTA3YL 9WYwkO0UOLIs7YE7vCtPz1eY4CsxCa790/IPxk3uLKqT1uDoEi7tKgT787DK5/Ip P7ApbiIctzJ7piLMDWhlQhc+ZNEYdznEZ9avkDYEKWvkCs/cxI9ICbuK+Mco0oOL Cg8EntG7DLYK1pCPL2UFGCrLsS3BM2SZHwJBd7TQ/pos+MmOIwxHH6J9Q== 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= fm3; bh=m7erXvXAgiomR18EaZboPnGxQzKM2J1BreGTXbt+er0=; b=PBNmC6Da gRktST4wvpvXixTlSOkUZV9qv8/gh6hBB/YvNlmBy11fsyx11T0kDeSskbKIzim0 v4Hs/JSito7YQrifmcoRzwSS7p37CxeWdYO6kVJ6JT7ypDZigYLk0xAdtT9k84Cc H4feoan6vFo7HYei1X2MPJCC3rrgbufB9fR5R4lU5RI12Nw9EoSbe8UzCxMPB0je 4Agr/+d/YFzpiWe05oPgErfAeCj4UmHKZroZ4jdKCtls7xqSBy6SIxq+9oNJSE6X BVLvroKfRNM4gd/Botcaqr0dRlia07I/adSCAYIZxdvs9y+FPop+EHs2Q0dT/VKF h/edju+GM6KZ0Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:53 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 4/7] drm/sun4i: tcon: Refactor the LVDS and panel probing Date: Wed, 29 Sep 2021 10:42:31 +0200 Message-Id: <20210929084234.1271915-5-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014255_228608_58865043 X-CRM114-Status: GOOD ( 20.89 ) 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 9f06dec0fc61..e38e60faafd2 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -868,6 +868,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 @@ -1115,10 +1172,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); @@ -1163,58 +1218,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"); @@ -1249,21 +1252,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 Wed Sep 29 08:42:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524921 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30523C433F5 for ; Wed, 29 Sep 2021 08:46:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EEAA26128E for ; Wed, 29 Sep 2021 08:46:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EEAA26128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=KzpvaI6OLIRVedhmAv5mNc6Z5QPJ0fCct3APatDMLWM=; b=FoktD7bMSh4Cuy fZFGbhK9jBFr3glB16l/ocwQqnZBt9JCFpis5ulLWY5UNhf4+CW4AlWEEdyn6zdOycQg2TUD9pzp9 Qo/d/a7iUxXbxRSrtkAQ6pNJO3rfuwzxFz49kO+zXvCQayTdlvKd1JE8NzYeDU18RwWPzDUgKhViW RQ/sh7kn+GJKuJQOhBcsbJNwJVzTJpInjBkzBgvHKu6qk/2RUq3SdAHnkLSbSSQ1FE/auoW5Lrzwj 7qwidWJOim3UiyseL1MYWcUHh4yrZR140d49syNrI8wf63xaQ5YW1M0gY5qUFQP46sc02MPffOOzY yRsq3fDunLhfh0LaZYtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVC5-00ATkC-Ef; Wed, 29 Sep 2021 08:44:01 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVB4-00ATQe-HE for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:43:00 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 7D5DF3200F9F; Wed, 29 Sep 2021 04:42:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 29 Sep 2021 04:42:58 -0400 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=FJFQ1azQRDRmA YHCJ8TvmTKHApO5RLnncYdEXMr5UsM=; b=NjOc4nS/f4GkCF7075NWSJTeQLKWf IUj2Kjz/aw/uAe+QWfRejRAo2OJoXrIFf7H0k8BdmhTEfxD9fGiXC7aXX3DhVXFl BfWJjvTfogNyJ/4asC3TaBH8iv7IOMnUXe9JVCQzD8rbwf7tYI3lkb2wo+G/K8f0 tF54hjnQZEq6pNsAVNERj8Bxw331zgCMFEI5odJtb9wDTI6kIt2uR9NTCoxVnz0n ZJmXw0zIsY98WxTb3+JMiXwU4jGEbE5Qdt/kgdxqrC0SgQBdPrMEgrEZsNa/sv7P 8BmKBXp55EKnyngvBPcmXmMf/oOMS5e4W11TbvTIzPSYYzNmRIAZFQIMg== 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= fm3; bh=FJFQ1azQRDRmAYHCJ8TvmTKHApO5RLnncYdEXMr5UsM=; b=ZxrawEVY fDyp/705XtU+DgFfkdjj98VVAzrt9ucLcsGDVLLR6XPD63dVXmfQ4/y+D9/CNrk7 YoUmq/4y8/9kOFtHujh7nNBLvBXGQtzuguFo0bRBXoKQXB/o/JVDVL60qf/tHuYm cjDeIlenvbgxxElXc2YWlp6auwNc4b2GANz2WMe24Szg/HThsJ8gB50LiRiRN8+G oaJGh8JPur65fmTvX/5+URUCselZ3mr+pNhGUgLNzuekIy/chBTfF7xspRMLMHwM lt8WDwdjXDwu1/U1SKaHltFzbAvI1ld4k7e3I5G+ZBAVsTZzKvrqhotQJbxVjGO9 kPmWk/pBsjtZOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:56 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 5/7] drm/sun4i: tcon: Support the LVDS Dual-Link Date: Wed, 29 Sep 2021 10:42:32 +0200 Message-Id: <20210929084234.1271915-6-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014258_622976_CF53095E X-CRM114-Status: GOOD ( 20.44 ) 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 e38e60faafd2..c7c94b7c6439 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 @@ -886,6 +890,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. @@ -922,6 +936,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 Wed Sep 29 08:42:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524923 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7992C433EF for ; Wed, 29 Sep 2021 08:46:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8316D61288 for ; Wed, 29 Sep 2021 08:46:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8316D61288 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=iFrSmEm6P5VFYVFR/ipxEGEtUwnPHIJPTgzRutc5EVI=; b=qM2H+Q956l/gHA 3vUXOTvrHUUlNPCMhcp/NLnIUGzFYdNf62zknajF6dmZo3QDh/a88fDHJnD2ontpxbvwazfKPmxCz eVUqrka7ns97T8flMP6Viaaai5AHNYEEf86zmam7bI/tjp+uGPHQieZMjiXEu5igCDew5oI0mu6Mk q8ARPnuBcAIm5WIuiUVdk6g9sNUP5hm885+KFLt8AYQzRqSiNjYan17VVbiHTfo6pZ00Ji8hMfVt+ wGoN4uLBgCUIbfz81CWi7ThsnYhR957PNGQlOLXX3HZCxssllaN+cMM5RB8arur+19LGfyR8L5Zic gLA5XQKTlPgHWtrqD/ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVCU-00ATvQ-Cb; Wed, 29 Sep 2021 08:44:27 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVB7-00ATRf-Dk for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:43:03 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 571613201C48; Wed, 29 Sep 2021 04:43:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 29 Sep 2021 04:43:01 -0400 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=y1we0ectZ+Ojy 3Wq8gV3g/l6x6zUkvdvYCKQ8aXDtRw=; b=ZZysxaltuMcka0Y15cVZZaV71V1zX PzBk+2bVXqlHNO3T1QLsCW/EdKaWuhJdcNjzfmTi+Gq24DiqiSpQtXVCP9jpLlC0 W8vhLP2e6fXuQ+JsNPP4TPptaLAXRsjUIPshCgT9JuzFD7tI8qSd91+Fy/YvUsd4 Hz20if0YrhP1naESidlyg2WoEYL0WtzGNfe3Zd6Ew58/u6kqtgvKLKhWod5L7n2i 2oV/VqsLhwPWUMsIljXiRQ1fGDDSJEkcD0MdECtW78Q90ocv/a+1OfTES1XYOdj5 6V7bvPRSF51QMyE3NIZ8Fl7lhK7YNIu0kylGt/B5J8w+UN4OnV3hVMceg== 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= fm3; bh=y1we0ectZ+Ojy3Wq8gV3g/l6x6zUkvdvYCKQ8aXDtRw=; b=X9B8x0kH BMtecVlJVIrzCJgIK1Q5lXWriZTlUBudfq6OtltxYQjvcV30X6kiVsyNlCFpEx43 PqRNhYcoq/2cEgOYZ03i2tmAVB0pxg4a4AvFOu//s9t+7vh+fCWk5Fec6+p+eMTM sF3Ijc9GEZTrBKOEY3TboW8oonfGPX/S/mtpMb4WxQMmSir4r3CbtmeeYeY60+3t Nvc3Q3FCAiwfNlnnjXZ6p3+01wQvETTe8UJf02Y3iYPMwxjSqqMf1YAwO/IWDZr4 F0QYdlonu/5uLHq2Gizlmu1/oLkaHxz2DmHKKnSurpGKf7Nk0US3C7FZVhvtE2v+ XNnX405TPBO3Pg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:42:59 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 6/7] drm/sun4i: tcon: Enable the A20 dual-link output Date: Wed, 29 Sep 2021 10:42:33 +0200 Message-Id: <20210929084234.1271915-7-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014301_532666_6603074D X-CRM114-Status: GOOD ( 10.72 ) 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 c7c94b7c6439..2855ff70418d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -1521,6 +1521,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 Wed Sep 29 08:42:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12524925 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7B8BC433F5 for ; Wed, 29 Sep 2021 08:47:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6A4196128E for ; Wed, 29 Sep 2021 08:47:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A4196128E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=etfQUE/SbTlqwJsIZz2/fS7IxS0nZS2v/nOU47hhmnw=; b=CMwSQQmDNxrdUQ Mwzfv9VlvUhv9tYkyX60fNACXmLe7kBJ08GcVPb4BO4+hagdv9E8rU8yiXSTahzkW4tMpzykV277f OYjQQGr6AAhv8vGxxn9gA/xiQH/VktUCke5iqGPhq3Cde6QP05AGvCGylBaF0updTwQyrhQKS2bVb CkaHFOoMrIbmusbefLmyKYUav/cr8M3u/AcDiL5paBwhHQK+Fj/zzGnVaKv6NZaDxVUzrg9WasC8S YzLt+eac3/IEM7QUe1M5sJMkiJW3gfUXa2Li0Jan2SJIiy7uElnX9sWfJ8IA5ddVs6u6hIo886vc8 95xIURLksuhlv5n9y9qA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVDB-00AUCd-4v; Wed, 29 Sep 2021 08:45:11 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVVBA-00ATSY-Au for linux-arm-kernel@lists.infradead.org; Wed, 29 Sep 2021 08:43:05 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 475103201805; Wed, 29 Sep 2021 04:43:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 29 Sep 2021 04:43:03 -0400 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=Znyc1I1rIaQbi jogTNSsg8EHL+eLhYsxmH+dwycnc84=; b=e7CemOtcLwux+XJwtoGM7KaaNcw7u 9NRETaRtoKRoLWLuUV7RVlj3sQxyPvl2c4cjYoZncRsegYmI9iatJRPoW2VXImmf zmdt86YActXTgkGf6ZOZhTm7hJlSnSKL8EDDB2ZIzT+1YkRD4NVJxNAOPZdE9vV8 Eelbh192sfB/4HFiozuty2zIhh8/WVue/uwuWxyL/cYCsTP1uvBC56/2Hkyyh/Ih whGFZtlmK33kS1pw54U3M9rcfPfHLRUE8RkcQboLbbn+j+Pmaqvmix02CHry38TC NPuIkOObY8ULFire0iT1e4Qs2u9TBYFRavDUPihJoCsAg4JyA8rphyCBQ== 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= fm3; bh=Znyc1I1rIaQbijogTNSsg8EHL+eLhYsxmH+dwycnc84=; b=KWflr6Zk +KbEc5VeuXTansAmgUdSc4KKscNEoz9nWEmEVRZd9nyACxI/cso2MFAP5h8WhMb4 YAK53qXLdnCm5Y2NTaSC4T/qsjbHe8BkQdNYRyK6rn7vZjHVGXLh6RcXeYf+aABw hpYnRnHN/lyPuUYpOPnYUoV3RphrxICAq5DcAe/rdBNwOhAgZ7BQc2X5UR8/dxdL qRj6e+mIapEJuNzSV7BQkbn6LWKgewF+0nIQBNPbu8V1QEqnzp0glPO2DA3gio4q i7BRvK/mUlfBgTz1WFdASM2X0Jvv8y3LKCyBcHyH9+NBUDyk9IVA0FDvqtBUZrXE 2O3LVzO2usQltw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekvddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepmh grgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Sep 2021 04:43:02 -0400 (EDT) From: Maxime Ripard To: Rob Herring , Frank Rowand , Chen-Yu Tsai , Maxime Ripard , =?utf-8?q?Jernej_=C5=A0krabec?= , Daniel Vetter , David Airlie , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 7/7] [DO NOT MERGE] ARM: dts: sun7i: Enable LVDS Dual-Link on the Cubieboard Date: Wed, 29 Sep 2021 10:42:34 +0200 Message-Id: <20210929084234.1271915-8-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210929084234.1271915-1-maxime@cerno.tech> References: <20210929084234.1271915-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_014304_423697_1A317D4B X-CRM114-Status: GOOD ( 10.11 ) 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>;