summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorHongyang Zhao <hongyang.zhao@thundersoft.com>2026-02-07 15:32:55 +0800
committerDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>2026-02-14 00:49:42 +0200
commite8bd92c4a0d2ee0fe8ee2b33c94dcffb3a39749b (patch)
treec56d0c4d1a6ac8b60235a115e4a859869ce4d048 /drivers/gpu
parent5ae47f510f38ba125b3bf213735f70d90a44e52b (diff)
downloadlinux-e8bd92c4a0d2ee0fe8ee2b33c94dcffb3a39749b.tar.gz
linux-e8bd92c4a0d2ee0fe8ee2b33c94dcffb3a39749b.zip
drm/bridge: lt9611: Add support for single Port B input
The LT9611 has two DSI input ports. The driver currently assumes Port A is always used for single-port configurations. However, some boards connect DSI to Port B only. Update the driver to detect which ports are populated from devicetree and configure the hardware accordingly: - If only port@1 (Port B) is populated, configure port swap (0x8303 bit 6) and byte_clk source (0x8250 bit 3:2) for Port B operation - If both ports are populated, use dual-port mode (Port A + B) - If only port@0 (Port A) is populated, use single Port A (existing behavior) Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com> Reviewed-by: Roger Shimizu <rosh@debian.org> Tested-by: Roger Shimizu <rosh@debian.org> Link: https://patch.msgid.link/20260207-rubikpi-next-20260116-v3-2-23b9aa189a3a@thundersoft.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/bridge/lontium-lt9611.c46
1 files changed, 32 insertions, 14 deletions
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 0628d8e737ab..4517aee83332 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -116,12 +116,25 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
{ 0x830a, 0x00 },
{ 0x824f, 0x80 },
{ 0x8250, 0x10 },
+ { 0x8303, 0x00 },
{ 0x8302, 0x0a },
{ 0x8306, 0x0a },
};
- if (lt9611->dsi1_node)
- reg_cfg[1].def = 0x03;
+ if (lt9611->dsi1_node) {
+ if (lt9611->dsi0_node) {
+ /* Dual port (Port A + B) */
+ reg_cfg[1].def = 0x03;
+ } else {
+ /*
+ * Single port B:
+ * - 0x8303 bit 6: port swap (1=PortB as primary)
+ * - 0x8250 bit 3:2: byte_clk source (01=PortB)
+ */
+ reg_cfg[3].def = 0x14;
+ reg_cfg[4].def = 0x40;
+ }
+ }
return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
}
@@ -202,7 +215,9 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
regmap_write(lt9611->regmap, 0x831d, pol);
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
- if (lt9611->dsi1_node) {
+
+ /* dual port: configure hact for combining two DSI inputs */
+ if (lt9611->dsi0_node && lt9611->dsi1_node) {
unsigned int hact = mode->hdisplay;
hact >>= 2;
@@ -759,7 +774,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
if (mode->hdisplay > 3840)
return MODE_BAD_HVALUE;
- if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
+ /* high resolution requires dual port (Port A + B) */
+ if (mode->hdisplay > 2000 && !(lt9611->dsi0_node && lt9611->dsi1_node))
return MODE_PANEL;
return MODE_OK;
@@ -1033,13 +1049,13 @@ static int lt9611_parse_dt(struct device *dev,
struct lt9611 *lt9611)
{
lt9611->dsi0_node = of_graph_get_remote_node(dev->of_node, 0, -1);
- if (!lt9611->dsi0_node) {
- dev_err(lt9611->dev, "failed to get remote node for primary dsi\n");
+ lt9611->dsi1_node = of_graph_get_remote_node(dev->of_node, 1, -1);
+
+ if (!lt9611->dsi0_node && !lt9611->dsi1_node) {
+ dev_err(lt9611->dev, "failed to get remote node for dsi\n");
return -ENODEV;
}
- lt9611->dsi1_node = of_graph_get_remote_node(dev->of_node, 1, -1);
-
lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, &lt9611->next_bridge);
@@ -1161,14 +1177,16 @@ static int lt9611_probe(struct i2c_client *client)
drm_bridge_add(&lt9611->bridge);
- /* Attach primary DSI */
- lt9611->dsi0 = lt9611_attach_dsi(lt9611, lt9611->dsi0_node);
- if (IS_ERR(lt9611->dsi0)) {
- ret = PTR_ERR(lt9611->dsi0);
- goto err_remove_bridge;
+ /* Attach primary DSI (directly drives or Port A in dual-port mode) */
+ if (lt9611->dsi0_node) {
+ lt9611->dsi0 = lt9611_attach_dsi(lt9611, lt9611->dsi0_node);
+ if (IS_ERR(lt9611->dsi0)) {
+ ret = PTR_ERR(lt9611->dsi0);
+ goto err_remove_bridge;
+ }
}
- /* Attach secondary DSI, if specified */
+ /* Attach secondary DSI (Port B in single or dual-port mode) */
if (lt9611->dsi1_node) {
lt9611->dsi1 = lt9611_attach_dsi(lt9611, lt9611->dsi1_node);
if (IS_ERR(lt9611->dsi1)) {