gma: Re-structure TC port types
The `USBC1_DP/_HDMI' names did not draw an accurate picture. If
they are implemented as legacy ports (for HDMI always the case),
they don't show as USBC in schematics, the OS or anywhere else.
We also couldn't tell if a `USBCx_DP' was implemented as legacy
or USB-C.
We split them by actual, physical connector type now: HDMI, DP,
and USBC (for DP-Alt mode). The `_TCx' suffixes should provide
an idea where they are connected to a socket or SoC.
Tiger Lake and seemingly Alder Lake use the first 4 TC register
sets only. Hence we keep only 4 respective TC ports for now.
Also, as any of the 3 Combo-PHYs (DP1..3) can be used as eDP, we
map that to the port, that is used with the first set of panel-
control lines. This should hopefully match most board designs.
Change-Id: If9755fe8e1f9252e6e77e22fe910964ad3c3743b
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/456
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/hw-gfx-gma-config_helpers.adb b/common/hw-gfx-gma-config_helpers.adb
index 3b55968..014d1b2 100644
--- a/common/hw-gfx-gma-config_helpers.adb
+++ b/common/hw-gfx-gma-config_helpers.adb
@@ -26,6 +26,12 @@
Port : Active_Port_Type)
return GPU_Port
is
+ function Combo_PHY (Port : Port_Type) return GPU_Port is
+ (case Port is
+ when HDMI1 | DP1 => DIGI_A,
+ when HDMI2 | DP2 => DIGI_B,
+ when HDMI3 | DP3 => DIGI_C,
+ when others => LVDS); -- n/a, actually
begin
return
(case Config.Gen is
@@ -54,18 +60,15 @@
when Secondary => DIGI_C,
when Tertiary => DIGI_D)),
when Tigerlake =>
- (case Port is
- when eDP => DIGI_A,
- when HDMI1 | DP1 => DIGI_A,
- when HDMI2 | DP2 => DIGI_B,
- when HDMI3 | DP3 => DIGI_C,
- when USBC1_DP | USBC1_HDMI => DDI_TC1,
- when USBC2_DP | USBC2_HDMI => DDI_TC2,
- when USBC3_DP | USBC3_HDMI => DDI_TC3,
- when USBC4_DP | USBC4_HDMI => DDI_TC4,
- when USBC5_DP | USBC5_HDMI => DDI_TC5,
- when USBC6_DP | USBC6_HDMI => DDI_TC6,
- when others => LVDS), -- n/a, actually
+ (case Port is
+ when DP_TC1 | HDMI_TC1 | USBC1 => DDI_TC1,
+ when DP_TC2 | HDMI_TC2 | USBC2 => DDI_TC2,
+ when DP_TC3 | HDMI_TC3 | USBC3 => DDI_TC3,
+ when DP_TC4 | HDMI_TC4 | USBC4 => DDI_TC4,
+ when eDP =>
+ Combo_PHY (Config.Panel_Ports (Panel_1)),
+ when others =>
+ Combo_PHY (Port)),
when others => -- everything but VGA directly on CPU
(case Port is
when LVDS => LVDS, -- n/a, actually
@@ -83,21 +86,20 @@
return
(if Config.Has_Type_C_Ports
then
- (case Port is
- when HDMI1 => PCH_HDMI_A,
- when HDMI2 => PCH_HDMI_B,
- when HDMI3 => PCH_HDMI_C,
- when USBC1_HDMI | USBC1_DP => PCH_TC1,
- when USBC2_HDMI | USBC2_DP => PCH_TC2,
- when USBC3_HDMI | USBC3_DP => PCH_TC3,
- when USBC4_HDMI | USBC4_DP => PCH_TC4,
- when USBC5_HDMI | USBC5_DP => PCH_TC5,
- when USBC6_HDMI | USBC6_DP => PCH_TC6,
- when others => PCH_LVDS) -- n/a, actually
+ (case To_GPU_Port (Pipe_Index'First, Port) is
+ when DIGI_A => PCH_HDMI_A,
+ when DIGI_B => PCH_HDMI_B,
+ when DIGI_C => PCH_HDMI_C,
+ when DDI_TC1 => PCH_TC1,
+ when DDI_TC2 => PCH_TC2,
+ when DDI_TC3 => PCH_TC3,
+ when DDI_TC4 => PCH_TC4,
+ when DDI_TC5 => PCH_TC5,
+ when DDI_TC6 => PCH_TC6,
+ when others => PCH_LVDS) -- n/a, actually
else
(case Port is
when LVDS => PCH_LVDS,
- when eDP => PCH_LVDS, -- n/a, actually
when Analog => PCH_DAC,
when HDMI1 => PCH_HDMI_B,
when HDMI2 => PCH_HDMI_C,
@@ -113,15 +115,12 @@
begin
return Display_Type'
(case Port is
- when LVDS => LVDS,
- when eDP => DP,
- when Analog => VGA,
- when HDMI1 .. HDMI3 => HDMI,
- when DP1 .. DP3 => DP,
- when USBC1_DP | USBC2_DP | USBC3_DP |
- USBC4_DP | USBC5_DP | USBC6_DP => DP,
- when USBC1_HDMI | USBC2_HDMI | USBC3_HDMI |
- USBC4_HDMI | USBC5_HDMI | USBC6_HDMI => HDMI);
+ when LVDS => LVDS,
+ when eDP => DP,
+ when Analog => VGA,
+ when Physical_HDMI_Ports'Range => HDMI,
+ when Physical_DP_Ports'Range => DP,
+ when Physical_USBC_Ports'Range => DP);
end To_Display_Type;
function To_Panel (Port : Active_Port_Type) return Panel_Control