Skip to content

Commit 43ccca5

Browse files
committed
FROMLIST: drm/bridge: lontium-lt9611c: Add DSI port selection via DT property
Some board designs connect only DSI port B, or both DSI ports A and B, to the LT9611C. Add support for a 'lontium,port-select' DT property that allows the board DTS to specify which DSI port(s) the chip should use: 0 = PORT_SELECT_A (default, single DSI port A) 1 = PORT_SELECT_B (single DSI port B) 2 = PORT_SELECT_AB (dual DSI ports A+B) When the property is absent the driver defaults to PORT_SELECT_A (0), preserving backward compatibility with existing DTS files. The selected port is programmed into the chip via lt9611c_select_port() during probe, after the chip ID has been verified. Link: https://patch.msgid.link/20260611-lt9611-b4-send-v1-4-42abbcd3bb1e@oss.qualcomm.com Signed-off-by: Mohit Dsor <mohit.dsor@oss.qualcomm.com>
1 parent 4533b86 commit 43ccca5

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

drivers/gpu/drm/bridge/lontium-lt9611c.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ enum lt9611_chip_type {
4141
CHIP_LT9611UXD,
4242
};
4343

44+
enum lt9611c_PORT_SELECT {
45+
PORT_SELECT_A = 0,
46+
PORT_SELECT_B = 1,
47+
PORT_SELECT_AB = 2,
48+
};
49+
4450
struct lt9611c {
4551
struct device *dev;
4652
struct i2c_client *client;
@@ -60,6 +66,8 @@ struct lt9611c {
6066
enum lt9611_chip_type chip_type;
6167
/* HDMI cable connection status */
6268
bool hdmi_connected;
69+
/* Selected DSI port configuration */
70+
int selected_port;
6371
};
6472

6573
DECLARE_CRC8_TABLE(lt9611c_crc8_table);
@@ -115,6 +123,31 @@ static int lt9611c_read_write_flow(struct lt9611c *lt9611c, u8 *params,
115123
return_count);
116124
}
117125

126+
static int lt9611c_select_port(struct lt9611c *lt9611c, int port_select)
127+
{
128+
int ret;
129+
u8 set_port_select_cmd[6] = {0x57, 0x4d, 0x31, 0x3a, 0x01, 0xc0};
130+
u8 set_port_select_ret[5];
131+
132+
if (port_select == PORT_SELECT_B) {
133+
set_port_select_cmd[5] = 0x40;
134+
} else if (port_select == PORT_SELECT_AB) {
135+
set_port_select_cmd[4] = 0x02;
136+
set_port_select_cmd[5] = 0xd0;
137+
} else if (port_select != PORT_SELECT_A) {
138+
return -EINVAL;
139+
}
140+
141+
ret = lt9611c_read_write_flow(lt9611c, set_port_select_cmd,
142+
ARRAY_SIZE(set_port_select_cmd),
143+
set_port_select_ret,
144+
ARRAY_SIZE(set_port_select_ret));
145+
if (ret < 0 || set_port_select_ret[4] == 0)
146+
return ret < 0 ? ret : -EIO;
147+
148+
return 0;
149+
}
150+
118151
static void lt9611c_config_parameters(struct lt9611c *lt9611c)
119152
{
120153
const struct reg_sequence seq_write_paras[] = {
@@ -923,6 +956,10 @@ static int lt9611c_parse_dt(struct device *dev,
923956

924957
lt9611c->dsi1_node = of_graph_get_remote_node(dev->of_node, 1, -1);
925958

959+
if (of_property_read_u32(dev->of_node, "lontium,port-select",
960+
&lt9611c->selected_port))
961+
lt9611c->selected_port = 0;
962+
926963
return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, &lt9611c->bridge.next_bridge);
927964
}
928965

@@ -1069,6 +1106,10 @@ static int lt9611c_probe(struct i2c_client *client)
10691106

10701107
lt9611c_reset(lt9611c);
10711108

1109+
ret = lt9611c_select_port(lt9611c, lt9611c->selected_port);
1110+
if (ret < 0)
1111+
dev_err(lt9611c->dev, "failed to select port %d\n", lt9611c->selected_port);
1112+
10721113
lt9611c_lock(lt9611c);
10731114

10741115
ret = lt9611c_read_chipid(lt9611c);

0 commit comments

Comments
 (0)