Skip to content

Commit 0ea9178

Browse files
committed
drm/i915/dsi: fix VBT send packet port selection for ICL+
The VBT send packet port selection was never updated for ICL+ where the 2nd link is on port B instead of port C as in VLV+ DSI. First, single link DSI needs to use the configured port instead of relying on the VBT sequence block port. Remove the hard-coded port C check here and make it generic. For reference, see commit f915084 ("drm/i915: Changes related to the sequence port no for") for the original VLV specific fix. Second, the sequence block port number is either 0 or 1, where 1 indicates the 2nd link. Remove the hard-coded port C here for 2nd link. (This could be a "find second set bit" on DSI ports, but just check the two possible options.) Third, sanity check the result with a warning to avoid a NULL pointer dereference. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5984 Cc: stable@vger.kernel.org # v4.19+ Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220520094600.2066945-1-jani.nikula@intel.com (cherry picked from commit 08c59dd)
1 parent 0696172 commit 0ea9178

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

drivers/gpu/drm/i915/display/intel_dsi_vbt.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,25 @@ struct i2c_adapter_lookup {
125125
#define ICL_GPIO_DDPA_CTRLCLK_2 8
126126
#define ICL_GPIO_DDPA_CTRLDATA_2 9
127127

128-
static enum port intel_dsi_seq_port_to_port(u8 port)
128+
static enum port intel_dsi_seq_port_to_port(struct intel_dsi *intel_dsi,
129+
u8 seq_port)
129130
{
130-
return port ? PORT_C : PORT_A;
131+
/*
132+
* If single link DSI is being used on any port, the VBT sequence block
133+
* send packet apparently always has 0 for the port. Just use the port
134+
* we have configured, and ignore the sequence block port.
135+
*/
136+
if (hweight8(intel_dsi->ports) == 1)
137+
return ffs(intel_dsi->ports) - 1;
138+
139+
if (seq_port) {
140+
if (intel_dsi->ports & PORT_B)
141+
return PORT_B;
142+
else if (intel_dsi->ports & PORT_C)
143+
return PORT_C;
144+
}
145+
146+
return PORT_A;
131147
}
132148

133149
static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
@@ -149,15 +165,10 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
149165

150166
seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
151167

152-
/* For DSI single link on Port A & C, the seq_port value which is
153-
* parsed from Sequence Block#53 of VBT has been set to 0
154-
* Now, read/write of packets for the DSI single link on Port A and
155-
* Port C will based on the DVO port from VBT block 2.
156-
*/
157-
if (intel_dsi->ports == (1 << PORT_C))
158-
port = PORT_C;
159-
else
160-
port = intel_dsi_seq_port_to_port(seq_port);
168+
port = intel_dsi_seq_port_to_port(intel_dsi, seq_port);
169+
170+
if (drm_WARN_ON(&dev_priv->drm, !intel_dsi->dsi_hosts[port]))
171+
goto out;
161172

162173
dsi_device = intel_dsi->dsi_hosts[port]->device;
163174
if (!dsi_device) {

0 commit comments

Comments
 (0)