blob: 3ce807e53e57c4ce32aa71ff5f5fb02beab02835 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
Nico Huberaf9cc9e2017-01-09 13:11:32 +01002-- Copyright (C) 2015-2017 secunet Security Networks AG
Nico Huber83693c82016-10-08 22:17:55 +02003--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
Nico Huber83693c82016-10-08 22:17:55 +020015with HW.GFX.GMA.Config;
16with HW.GFX.GMA.Panel;
Nico Huber83693c82016-10-08 22:17:55 +020017with HW.GFX.GMA.DP_Info;
Nico Huber83693c82016-10-08 22:17:55 +020018
19with HW.Debug;
20with GNAT.Source_Info;
21
22package body HW.GFX.GMA.Connector_Info is
23
Nico Huber995436b2016-11-20 02:21:51 +010024 procedure Preferred_Link_Setting
25 (Port_Cfg : in out Port_Config;
26 Success : out Boolean)
Nico Huber83693c82016-10-08 22:17:55 +020027 is
Nico Huber995436b2016-11-20 02:21:51 +010028 DP_Port : constant GMA.DP_Port :=
Nico Huber83693c82016-10-08 22:17:55 +020029 (if Port_Cfg.Port = DIGI_A then
30 DP_A
31 else
32 (case Port_Cfg.PCH_Port is
33 when PCH_DP_B => DP_B,
34 when PCH_DP_C => DP_C,
35 when PCH_DP_D => DP_D,
Nico Huber995436b2016-11-20 02:21:51 +010036 when others => GMA.DP_Port'First));
Nico Huber83693c82016-10-08 22:17:55 +020037 begin
38 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
39
40 if Port_Cfg.Display = DP then
41 if Port_Cfg.Port = DIGI_A then
42 if GMA.Config.Use_PP_VDD_Override then
43 Panel.VDD_Override;
44 else
45 Panel.On;
46 end if;
47 end if;
48
49 DP_Info.Read_Caps
50 (Link => Port_Cfg.DP,
Nico Huber995436b2016-11-20 02:21:51 +010051 Port => DP_Port,
Nico Huber83693c82016-10-08 22:17:55 +020052 Success => Success);
53 if Success then
Greg V3d3452f2019-10-08 02:05:05 +030054 DP_Info.Read_eDP_Rates
55 (Link => Port_Cfg.DP,
56 Port => DP_Port);
57
Nico Huber83693c82016-10-08 22:17:55 +020058 DP_Info.Preferred_Link_Setting
59 (Link => Port_Cfg.DP,
60 Mode => Port_Cfg.Mode,
61 Success => Success);
Nico Huberaf9cc9e2017-01-09 13:11:32 +010062 pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP));
Nico Huber83693c82016-10-08 22:17:55 +020063 end if;
64 else
65 Success := True;
66 end if;
67 end Preferred_Link_Setting;
68
69 procedure Next_Link_Setting
70 (Port_Cfg : in out Port_Config;
71 Success : out Boolean)
72 is
73 begin
74 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
75
76 if Port_Cfg.Display = DP then
77 DP_Info.Next_Link_Setting
78 (Link => Port_Cfg.DP,
79 Mode => Port_Cfg.Mode,
80 Success => Success);
Nico Huberaf9cc9e2017-01-09 13:11:32 +010081 pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP));
Nico Huber83693c82016-10-08 22:17:55 +020082 else
83 Success := False;
84 end if;
85 end Next_Link_Setting;
86
87 ----------------------------------------------------------------------------
88
89 function Default_BPC (Port_Cfg : Port_Config) return HW.GFX.BPC_Type
90 is
91 begin
92 return
93 (if Port_Cfg.Port = DIGI_A or
Arthur Heymans5d08a932018-03-28 17:00:18 +020094 (Port_Cfg.Is_FDI and Port_Cfg.PCH_Port = PCH_LVDS) or
95 Port_Cfg.Port = LVDS
Nico Huber83693c82016-10-08 22:17:55 +020096 then 6
97 else 8);
98 end Default_BPC;
99
100end HW.GFX.GMA.Connector_Info;