Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/51134 )
Change subject: f ......................................................................
f
Change-Id: Id66a9ad07f102480b9ee3bf9087c02d0516f1c7b Signed-off-by: Angel Pons th3fanbus@gmail.com --- M common/hw-gfx-dp_info.adb 1 file changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/34/51134/1
diff --git a/common/hw-gfx-dp_info.adb b/common/hw-gfx-dp_info.adb index 4d7c13e..6e87dba 100644 --- a/common/hw-gfx-dp_info.adb +++ b/common/hw-gfx-dp_info.adb @@ -72,6 +72,48 @@ end loop; end Write_Lspcon_Mode;
+ procedure Detect_Dual_Mode (Port : in T; Success : out Boolean) + is + Length : I2C.Transfer_Length := 16; + Buffer : I2C.Transfer_Data; + Adp_Id : Word8; + begin + Time.U_Delay (1000); + Aux_Ch.I2C_Read + (Port => Port, + Address => 16#40#, + Length => Length, + Data => Buffer, + Success => Success); + if not Success then + pragma Debug (Debug.Put_Line ("Could not read dual-mode HDMI ID.")); + return; + end if; + if Length /= 16 then + pragma Debug (Debug.Put ("Unexpected length in dual-mode HDMI ID read: ")); + pragma Debug (Debug.Put_Line (Length'Image)); + return; + end if; + pragma Debug (Debug.Put ("Dual-mode HDMI ID: ")); + for Idx in 0 .. 15 loop + pragma Debug (Debug.Put_Word8 (Buffer (Idx))); + end loop; + pragma Debug (Debug.New_Line); + Aux_Ch.I2C_Read_Byte + (Port => Port, + Address => 16#40#, + Offset => 16#10#, + Value => Adp_Id, + Success => Success); + if not Success then + pragma Debug (Debug.Put_Line ("Could not read dual-mode adaptor ID.")); + return; + end if; + pragma Debug (Debug.Put ("Dual-mode adaptor ID: ")); + pragma Debug (Debug.Put_Word8 (Adp_Id)); + pragma Debug (Debug.New_Line); + end Detect_Dual_Mode; + procedure Set_Lspcon_To_Pcon_Mode (Port : in T; Success : out Boolean) is Wanted_Mode : constant Word8 := LSPCON_MODE_PCON; @@ -149,6 +191,12 @@ begin pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
+ Detect_Dual_Mode (Port, Success); + + if not Success then + pragma Debug (Debug.Put_Line ("Could not detect dual mode.")); + end if; + Set_Lspcon_To_Pcon_Mode (Port, Success);
if not Success then