Add support to switch LSPCON modes
LSPCON is a level shifter and protocol converter chip. It is principally
used to convert DisplayPort into HDMI 2.0, since some Intel iGPUs do not
have native HDMI 2.0 support. The chip defaults to LS mode, in which the
display engine has to generate an HDMI-protocol signal, which the LSPCON
converts from DisplayPort signal levels to HDMI signal levels.
Add code to detect LSPCON chips and put them in protocol-converter mode.
This way, the LSPCON behaves like a regular DisplayPort sink. This needs
to be done before any DPCD accesses, because the LSPCON does not respond
to DPCD accesses in level-shifter mode.
Tested on Purism Librem Mini v1 (WHL-U), HDMI port can now light up.
Change-Id: Idfa9bdff47a6591000cd5092d64a4cd4f8dbdc8d
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/51133
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/common/hw-gfx-dp_dual_mode.ads b/common/hw-gfx-dp_dual_mode.ads
new file mode 100644
index 0000000..3f4dd45
--- /dev/null
+++ b/common/hw-gfx-dp_dual_mode.ads
@@ -0,0 +1,27 @@
+--
+-- Copyright (C) 2021 Angel Pons <th3fanbus@gmail.com>
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+
+with HW.GFX.DP_Aux_Ch;
+
+private generic
+
+ type T (<>) is limited private;
+
+ with package Aux_Ch is new DP_Aux_Ch (T => T, others => <>);
+
+package HW.GFX.DP_Dual_Mode is
+
+ procedure Switch_LSPCON (Port : in T);
+
+end HW.GFX.DP_Dual_Mode;