greg@unrelenting.technology has uploaded this change for review. ( https://review.coreboot.org/c/libgfxinit/+/35869 )
Change subject: dp_info: read eDP 1.4+ DPCD link rates ......................................................................
dp_info: read eDP 1.4+ DPCD link rates
This is required for google/eve (Pixelbook), where only this new method of reporting the link rate is supported, and the Max_Link_Rate in the regular DPCD struct is 0x00. (And higher rate is required because the panel is high res.)
Change-Id: I52b4d8ad94564904854b502f300b812c41a9751a Signed-off-by: Greg V greg@unrelenting.technology --- M common/hw-gfx-dp_info.adb M common/hw-gfx-dp_info.ads M common/hw-gfx-gma-connector_info.adb 3 files changed, 86 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/libgfxinit refs/changes/69/35869/1
diff --git a/common/hw-gfx-dp_info.adb b/common/hw-gfx-dp_info.adb index d45826d..8d66dd3 100644 --- a/common/hw-gfx-dp_info.adb +++ b/common/hw-gfx-dp_info.adb @@ -86,6 +86,82 @@ end if; end Read_Caps;
+ function Read_LE16 + (Raw_Payload : DP_Defs.Aux_Payload; + Offset : DP_Defs.Aux_Payload_Index) + return Word32 + is + begin + return Shift_Left (Word32 (Raw_Payload (Offset + 1)), 8) or + Word32 (Raw_Payload (Offset)); + end Read_LE16; + + procedure Read_eDP_Rates + (Link : in out DP_Link; + Port : in T; + Success : out Boolean) + is + Data : DP_Defs.Aux_Payload; + Length : DP_Defs.Aux_Payload_Length; + Max_Rate : Word32; + + Caps_Size : constant := 3; + Rates_Size : constant := 8; + begin + pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); + + Length := Caps_Size; + Aux_Ch.Aux_Read + (Port => Port, + Address => 16#00700#, + Length => Length, + Data => Data, + Success => Success); + Success := Success and Length = Caps_Size; + + if Length = Caps_Size and Data (0) >= 16#03# then + Length := Rates_Size; + Aux_Ch.Aux_Read + (Port => Port, + Address => 16#00010#, + Length => Length, + Data => Data, + Success => Success); + Success := Success and Length = Rates_Size; + + if Length = Rates_Size then + Max_Rate := Read_LE16 (Data, 0); + if Read_LE16 (Data, 2) > Max_Rate then + Max_Rate := Read_LE16 (Data, 2); + end if; + if Read_LE16 (Data, 4) > Max_Rate then + Max_Rate := Read_LE16 (Data, 4); + end if; + if Read_LE16 (Data, 6) > Max_Rate then + Max_Rate := Read_LE16 (Data, 6); + end if; + -- convert to KHz + Max_Rate := Max_Rate * 20; + + if Max_Rate >= 540000 then + Link.Receiver_Caps.Max_Link_Rate := DP_Bandwidth_5_4; + elsif Max_Rate >= 270000 then + Link.Receiver_Caps.Max_Link_Rate := DP_Bandwidth_2_7; + elsif Max_Rate >= 162000 then + Link.Receiver_Caps.Max_Link_Rate := DP_Bandwidth_1_62; + end if; + + pragma Debug (Debug.New_Line); + pragma Debug (Debug.Put_Line ("DPCD eDP 1.4+ link rates:")); + pragma Debug (Debug.Put_Reg32 (" 0: ", Read_LE16 (Data, 0))); + pragma Debug (Debug.Put_Reg32 (" 1: ", Read_LE16 (Data, 2))); + pragma Debug (Debug.Put_Reg32 (" 2: ", Read_LE16 (Data, 4))); + pragma Debug (Debug.Put_Reg32 (" 3: ", Read_LE16 (Data, 6))); + pragma Debug (Debug.New_Line); + end if; + end if; + end Read_eDP_Rates; + procedure Minimum_Lane_Count (Link : in out DP_Link; Mode : in Mode_Type; diff --git a/common/hw-gfx-dp_info.ads b/common/hw-gfx-dp_info.ads index aa10c4c..501099f 100644 --- a/common/hw-gfx-dp_info.ads +++ b/common/hw-gfx-dp_info.ads @@ -81,6 +81,11 @@ Port : in T; Success : out Boolean);
+ procedure Read_eDP_Rates + (Link : in out DP_Link; + Port : in T; + Success : out Boolean); + procedure Preferred_Link_Setting (Link : in out DP_Link; Mode : in Mode_Type; diff --git a/common/hw-gfx-gma-connector_info.adb b/common/hw-gfx-gma-connector_info.adb index e8357be..a014edd 100644 --- a/common/hw-gfx-gma-connector_info.adb +++ b/common/hw-gfx-gma-connector_info.adb @@ -51,6 +51,11 @@ Port => DP_Port, Success => Success); if Success then + DP_Info.Read_eDP_Rates + (Link => Port_Cfg.DP, + Port => DP_Port, + Success => Success); + DP_Info.Preferred_Link_Setting (Link => Port_Cfg.DP, Mode => Port_Cfg.Mode,