Skip to content

Commit 4628142

Browse files
lucasdemarchimattrope
authored andcommitted
drm/i915/rkl: provide port/phy mapping for vbt
RKL uses the DDI A, DDI B, DDI USBC1, DDI USBC2 from the DE point of view, so all DDI/pipe/transcoder register use these indexes to refer to them. Combo phy and IO functions follow another namespace that we keep as "enum phy". The VBT in theory would use the DE point of view, but that does not happen in practice. Provide a table to convert the child devices to the "correct" port numbering we use. Now this is the output we get while reading the VBT: DDIA: [drm:intel_bios_port_aux_ch [i915]] using AUX A for port A (VBT) [drm:intel_dp_init_connector [i915]] Adding DP connector on [ENCODER:275:DDI A] [drm:intel_hdmi_init_connector [i915]] Adding HDMI connector on [ENCODER:275:DDI A] [drm:intel_hdmi_init_connector [i915]] Using DDC pin 0x1 for port A (VBT) DDIB: [drm:intel_bios_port_aux_ch [i915]] using AUX B for port B (platform default) [drm:intel_hdmi_init_connector [i915]] Adding HDMI connector on [ENCODER:291:DDI B] [drm:intel_hdmi_init_connector [i915]] Using DDC pin 0x2 for port B (VBT) DDI USBC1: [drm:intel_bios_port_aux_ch [i915]] using AUX D for port D (VBT) [drm:intel_dp_init_connector [i915]] Adding DP connector on [ENCODER:295:DDI D] [drm:intel_hdmi_init_connector [i915]] Adding HDMI connector on [ENCODER:295:DDI D] [drm:intel_hdmi_init_connector [i915]] Using DDC pin 0x3 for port D (VBT) DDI USBC2: [drm:intel_bios_port_aux_ch [i915]] using AUX E for port E (VBT) [drm:intel_dp_init_connector [i915]] Adding DP connector on [ENCODER:306:DDI E] [drm:intel_hdmi_init_connector [i915]] Adding HDMI connector on [ENCODER:306:DDI E] [drm:intel_hdmi_init_connector [i915]] Using DDC pin 0x9 for port E (VBT) Cc: Clinton Taylor <Clinton.A.Taylor@intel.com> Cc: Aditya Swarup <aditya.swarup@intel.com> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200603211529.3005059-7-matthew.d.roper@intel.com
1 parent e95e797 commit 4628142

File tree

1 file changed

+51
-21
lines changed

1 file changed

+51
-21
lines changed

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

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,37 +1619,67 @@ static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin)
16191619
return 0;
16201620
}
16211621

1622-
static enum port dvo_port_to_port(u8 dvo_port)
1622+
static enum port __dvo_port_to_port(int n_ports, int n_dvo,
1623+
const int port_mapping[][3], u8 dvo_port)
16231624
{
1624-
/*
1625-
* Each DDI port can have more than one value on the "DVO Port" field,
1626-
* so look for all the possible values for each port.
1627-
*/
1628-
static const int dvo_ports[][3] = {
1629-
[PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1},
1630-
[PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1},
1631-
[PORT_C] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1},
1632-
[PORT_D] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1},
1633-
[PORT_E] = { DVO_PORT_CRT, DVO_PORT_HDMIE, DVO_PORT_DPE},
1634-
[PORT_F] = { DVO_PORT_HDMIF, DVO_PORT_DPF, -1},
1635-
[PORT_G] = { DVO_PORT_HDMIG, DVO_PORT_DPG, -1},
1636-
};
16371625
enum port port;
16381626
int i;
16391627

1640-
for (port = PORT_A; port < ARRAY_SIZE(dvo_ports); port++) {
1641-
for (i = 0; i < ARRAY_SIZE(dvo_ports[port]); i++) {
1642-
if (dvo_ports[port][i] == -1)
1628+
for (port = PORT_A; port < n_ports; port++) {
1629+
for (i = 0; i < n_dvo; i++) {
1630+
if (port_mapping[port][i] == -1)
16431631
break;
16441632

1645-
if (dvo_port == dvo_ports[port][i])
1633+
if (dvo_port == port_mapping[port][i])
16461634
return port;
16471635
}
16481636
}
16491637

16501638
return PORT_NONE;
16511639
}
16521640

1641+
static enum port dvo_port_to_port(struct drm_i915_private *dev_priv,
1642+
u8 dvo_port)
1643+
{
1644+
/*
1645+
* Each DDI port can have more than one value on the "DVO Port" field,
1646+
* so look for all the possible values for each port.
1647+
*/
1648+
static const int port_mapping[][3] = {
1649+
[PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 },
1650+
[PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 },
1651+
[PORT_C] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 },
1652+
[PORT_D] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 },
1653+
[PORT_E] = { DVO_PORT_CRT, DVO_PORT_HDMIE, -1 },
1654+
[PORT_F] = { DVO_PORT_HDMIF, DVO_PORT_DPF, -1 },
1655+
[PORT_G] = { DVO_PORT_HDMIG, DVO_PORT_DPG, -1 },
1656+
};
1657+
/*
1658+
* Bspec lists the ports as A, B, C, D - however internally in our
1659+
* driver we keep them as PORT_A, PORT_B, PORT_D and PORT_E so the
1660+
* registers in Display Engine match the right offsets. Apply the
1661+
* mapping here to translate from VBT to internal convention.
1662+
*/
1663+
static const int rkl_port_mapping[][3] = {
1664+
[PORT_A] = { DVO_PORT_HDMIA, DVO_PORT_DPA, -1 },
1665+
[PORT_B] = { DVO_PORT_HDMIB, DVO_PORT_DPB, -1 },
1666+
[PORT_C] = { -1 },
1667+
[PORT_D] = { DVO_PORT_HDMIC, DVO_PORT_DPC, -1 },
1668+
[PORT_E] = { DVO_PORT_HDMID, DVO_PORT_DPD, -1 },
1669+
};
1670+
1671+
if (IS_ROCKETLAKE(dev_priv))
1672+
return __dvo_port_to_port(ARRAY_SIZE(rkl_port_mapping),
1673+
ARRAY_SIZE(rkl_port_mapping[0]),
1674+
rkl_port_mapping,
1675+
dvo_port);
1676+
else
1677+
return __dvo_port_to_port(ARRAY_SIZE(port_mapping),
1678+
ARRAY_SIZE(port_mapping[0]),
1679+
port_mapping,
1680+
dvo_port);
1681+
}
1682+
16531683
static void parse_ddi_port(struct drm_i915_private *dev_priv,
16541684
struct display_device_data *devdata,
16551685
u8 bdb_version)
@@ -1659,7 +1689,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv,
16591689
bool is_dvi, is_hdmi, is_dp, is_edp, is_crt;
16601690
enum port port;
16611691

1662-
port = dvo_port_to_port(child->dvo_port);
1692+
port = dvo_port_to_port(dev_priv, child->dvo_port);
16631693
if (port == PORT_NONE)
16641694
return;
16651695

@@ -2603,10 +2633,10 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
26032633
aux_ch = AUX_CH_B;
26042634
break;
26052635
case DP_AUX_C:
2606-
aux_ch = AUX_CH_C;
2636+
aux_ch = IS_ROCKETLAKE(dev_priv) ? AUX_CH_D : AUX_CH_C;
26072637
break;
26082638
case DP_AUX_D:
2609-
aux_ch = AUX_CH_D;
2639+
aux_ch = IS_ROCKETLAKE(dev_priv) ? AUX_CH_E : AUX_CH_D;
26102640
break;
26112641
case DP_AUX_E:
26122642
aux_ch = AUX_CH_E;

0 commit comments

Comments
 (0)