From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A7B9C433E0 for ; Fri, 19 Feb 2021 14:02:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 D208464EBD for ; Fri, 19 Feb 2021 14:02:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D208464EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+Fxo+Yk7QJ8WtYlW0RXx1rX1Bvh1RC3m6aGLM5Q76KQ=; b=GeBg+pFAWZiEjOw7hlkQUebFz 7Ns8gHDi1tFuZof03Q/Gs3K4zGj5l/5MUHBf/7O8F1ySyuO1Tn9I9afK1bB5Bk10Xcldl36zlgJh+ lDVU+IGz96j3po8wAvHCjiz1gqUP/He311A/pwmEAZwOWyq3eRiqAWATLCvHIuqeAP32UFiszzCHW 7Zxn+HUyV0v82bF0eVjl3hsDxrir5aEQksrBBL4P9dmV6gpe5qTYfVhUHuPYrA2rY2cX5CDUiYm+N +TeGem7fCLZBUoHI3VANZJDMH7P541TitOCVfY5ASrV+DWAscilTVp4lhT7SAI5XHMCnY3xRKAiAT TIUfpHmlg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lD6KN-0008Cw-Fd; Fri, 19 Feb 2021 14:00:15 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lD6Jx-00083R-6W for linux-arm-kernel@lists.infradead.org; Fri, 19 Feb 2021 13:59:51 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id D747D8A2; Fri, 19 Feb 2021 08:59:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 19 Feb 2021 08:59:47 -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=fm2; bh=56Q7VGWJxuS+2 zJzR/vJpArneG2/6DQUpAmi2c91b+8=; b=NDr8thfvJ44ylJJK6E2HHD2CcbIvi voSJQGRTAGO02QGJWG88da9RfO0DZakztW9SVIZ+TRm4sz/U9LcdSaxPFcJvSMcS Lkm38UWdwCDPOBBSEtzVIAce1rwxNZY0jxYyMhRczc5SGsiLwhHl+yFAy3XDCkJw 9/GRrRP2PjY0wLxb++SYVk0TcPBfn4CF5ltixP+hLknEoTYNDHXx6sBg+B8jis1f CkILQFYwC/BXlzj1AkcHiM58F6/0x47xuUTRxViHFJ7zuRelktw+5E+NXVcoho1G 5NQlI2w2iwvardj5i05lF/26osZzejJjxz6ZzIf3GWfKAyG71DmzCOSFQ== 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= fm2; bh=56Q7VGWJxuS+2zJzR/vJpArneG2/6DQUpAmi2c91b+8=; b=CV+86p6s /PS9c5+tSJHUcSs8ikosi+NbUWoDfBlr5/jjii4Or8UnF+MbI4QVOUzBYqK8+XXs VCtoHXFJDPkPJh8QfWgJeyX5NVReAg3AcRj1FAus+6c57uhOUnfufrTt4eHSoYvY Rpgkv7hxYPWoBrU2iGnlT7wmfUoMLV3hcsy7SJcwLb0g6zkKmFJhbHHxuXdnJNbM oR8r8lR8DHFdhX6VPO3hJRD5WIcAWLgpmCttcK03fgee0GkzW3na1MlRq+DAGraW wv69UW7mP75RysoPHwOPl35kL3J59LYdUq4teZkrZ9pPgZaSFX0l5nkl3K/2s5Ns 1AyL5unm9OJwOA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrjeeigdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucfkphepledtrdekledrieekrdejieenucevlhhushhtvghrufhiiigvpedunecurf grrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 455AB24005C; Fri, 19 Feb 2021 08:59:46 -0500 (EST) From: Maxime Ripard To: Laurent Pinchart , Chen-Yu Tsai , Maxime Ripard , Jernej Skrabec , Rob Herring , Frank Rowand , Daniel Vetter , David Airlie Subject: [PATCH v4 5/7] drm/sun4i: tcon: Support the LVDS Dual-Link Date: Fri, 19 Feb 2021 14:59:32 +0100 Message-Id: <20210219135934.618684-6-maxime@cerno.tech> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210219135934.618684-1-maxime@cerno.tech> References: <20210219135934.618684-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210219_085949_356427_6FA7135C X-CRM114-Status: GOOD ( 18.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 32757175f86b..005c37831eb6 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 @@ -903,6 +907,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. @@ -939,6 +953,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 ee555318e3c2..f6a589828f94 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) @@ -280,6 +281,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 */ -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel