[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251116131853.440863-4-kuba@szczodrzynski.pl>
Date: Sun, 16 Nov 2025 14:18:50 +0100
From: Kuba SzczodrzyĆski <kuba@...zodrzynski.pl>
To: Maxime Ripard <mripard@...nel.org>,
Samuel Holland <samuel@...lland.org>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>
Cc: David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>,
linux-arm-kernel@...ts.infradead.org,
linux-sunxi@...ts.linux.dev,
linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org,
linux-phy@...ts.infradead.org,
devicetree@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
parthiban@...umiz.com,
paulk@...-base.io
Subject: [PATCH v2 3/6] drm/sun4i: Enable LVDS output on sun20i D1s/T113
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.
Abort PHY setup/teardown early if it fails.
Signed-off-by: Kuba SzczodrzyĆski <kuba@...zodrzynski.pl>
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 38 ++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 247400785..e072ecc6d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -171,6 +171,40 @@ 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;
+
+ if (phy_init(tcon->dphy))
+ return;
+
+ if (phy_set_mode(tcon->dphy, PHY_MODE_LVDS))
+ return;
+
+ if (phy_configure(tcon->dphy, &opts))
+ return;
+
+ if (phy_power_on(tcon->dphy))
+ return;
+}
+
+static void sun20i_tcon_teardown_lvds_dphy(struct sun4i_tcon *tcon,
+ const struct drm_encoder *encoder)
+{
+ if (!tcon->quirks->has_combo_dphy || !tcon->dphy)
+ return;
+
+ if (phy_power_off(tcon->dphy))
+ return;
+
+ if (phy_exit(tcon->dphy))
+ return;
+}
+
static void sun4i_tcon_lvds_set_status(struct sun4i_tcon *tcon,
const struct drm_encoder *encoder,
bool enabled)
@@ -1550,8 +1584,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,
+ .teardown_lvds_phy = sun20i_tcon_teardown_lvds_dphy,
};
/* sun4i_drv uses this list to check if a device node is a TCON */
--
2.25.1
Powered by blists - more mailing lists