From patchwork Fri Feb 21 16:17:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Kuba_Szczodrzy=C5=84ski?= X-Patchwork-Id: 13985927 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 A9B86C021B5 for ; Fri, 21 Feb 2025 16:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=U2i+tFSML7sT+8AM5vIWnSdSP/UjJ3mmCMahXU8/Uc0=; b=VKK5/KKZiL9526x41PFUlK/YFW bdBASiSBWLl0+Ev8qlEPjS+S6OCsYjQGPpF+daRcbQ5T43xH7sg0sTooUiDHZxq74X+BXPAXplJqs frT7GErUkUKBgMbQ9lpCa/79BxViuxedhkvi/3h4vE3kBIT/dWgEYe3Zmv+TxKDKBBDCtVJqVWVNG tWfBGfpkkMFvTWUvjBWKATHMxUi6Dx9WHXT1jo0Y6mCybiuZYwSSfiEx7rNpthIZTy6XE/2cUXZbl VNUoS8AzILDBOUQvPNuR6ER9OdfyF1HHCFgFGIBKvkCWk3lxfbQdU7AxxLUXDf6niPKX8ypHCoAGq kjqDyB1Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlVpC-00000006AIy-1qsl; Fri, 21 Feb 2025 16:24:26 +0000 Received: from s2.avantea.pl ([46.242.128.95]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlVj3-000000068Jk-2Xkz; Fri, 21 Feb 2025 16:18:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=szczodrzynski.pl; s=x; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=U2i+tFSML7sT+8AM5vIWnSdSP/UjJ3mmCMahXU8/Uc0=; b=p1pGOIC5KroF7U+KU+hMlEUo2p gChyrkqBaGtW4djBrZcHJhS7RQ5U87eV3gBR0dq7UttRIsAgWjI6xO3/nqnC4b+SKV8QeQEBlaB3C swS5I8XmqwD65u1uZ9rcwEblo7RAuCroiAnfp0t7tPZKL+1upBfmtIkjLuwF8ZS3GvYJaQ9jwfoN5 CCLk37otP528jmLS1hF5EZyU/apPvK46QKaH91zhQGFWYWoJi+yJyZaNvqPB6CudOEUmG2EMT+YR0 ErHfYDXNJIrtLZWcnMSLIQ7bghLo3J6Ot8WpQ1lEID/GBdBcllqj5ifmla+CDnOoy0piCwj3LFNtu 7/aU6zCQ==; Received: from [62.171.184.96] (helo=buildhost.contaboserver.net) by s2.avantea.pl with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96-58-g4e9ed49f8) (envelope-from ) id 1tlViv-00AOLX-34; Fri, 21 Feb 2025 17:17:58 +0100 From: =?utf-8?q?Kuba_Szczodrzy=C5=84ski?= To: Maxime Ripard , Samuel Holland , Chen-Yu Tsai , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: David Airlie , Simona Vetter , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 3/5] drm/sun4i: Enable LVDS output on sun20i D1s/T113 Date: Fri, 21 Feb 2025 17:17:49 +0100 Message-Id: <20250221161751.1278049-4-kuba@szczodrzynski.pl> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250221161751.1278049-1-kuba@szczodrzynski.pl> References: <20250221161751.1278049-1-kuba@szczodrzynski.pl> MIME-Version: 1.0 X-Authenticated-Id: kuba@szczodrzynski.pl X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_081805_802983_7E7CD6E7 X-CRM114-Status: GOOD ( 11.17 ) 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 D1s/T113 needs to use the combo D-PHY to enable LVDS output. Enable LVDS support in the TCON and configure it using the PHY. Signed-off-by: Kuba SzczodrzyƄski --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index ccf335a61..58230a552 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -171,6 +171,30 @@ static void sun6i_tcon_setup_lvds_phy(struct sun4i_tcon *tcon, SUN6I_TCON0_LVDS_ANA0_EN_DRVD(val)); } +static void sun20i_tcon_setup_lvds_dphy(struct sun4i_tcon *tcon, + const struct drm_encoder *encoder) +{ + union phy_configure_opts opts = { }; + + if (!tcon->quirks->has_combo_dphy || !tcon->dphy) + return; + + phy_init(tcon->dphy); + phy_set_mode(tcon->dphy, PHY_MODE_LVDS); + phy_configure(tcon->dphy, &opts); + phy_power_on(tcon->dphy); +} + +static void sun20i_tcon_disable_lvds_dphy(struct sun4i_tcon *tcon, + const struct drm_encoder *encoder) +{ + if (!tcon->quirks->has_combo_dphy || !tcon->dphy) + return; + + phy_power_off(tcon->dphy); + phy_exit(tcon->dphy); +} + static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, bool enabled) @@ -1550,8 +1574,12 @@ static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = { static const struct sun4i_tcon_quirks sun20i_d1_lcd_quirks = { .has_channel_0 = true, + .has_combo_dphy = true, + .supports_lvds = true, .dclk_min_div = 1, .set_mux = sun8i_r40_tcon_tv_set_mux, + .setup_lvds_phy = sun20i_tcon_setup_lvds_dphy, + .disable_lvds_phy = sun20i_tcon_disable_lvds_dphy, }; /* sun4i_drv uses this list to check if a device node is a TCON */