blob: 79c42a026a5a0a29e8d5fdfbe1c05b7a2ae15664 [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;
Angel Pons8d5c24d2021-03-01 15:59:58 +010017with HW.GFX.GMA.DP_Dual_Mode;
Nico Huber83693c82016-10-08 22:17:55 +020018with HW.GFX.GMA.DP_Info;
Nico Huber83693c82016-10-08 22:17:55 +020019
20with HW.Debug;
21with GNAT.Source_Info;
22
23package body HW.GFX.GMA.Connector_Info is
24
Nico Huber995436b2016-11-20 02:21:51 +010025 procedure Preferred_Link_Setting
26 (Port_Cfg : in out Port_Config;
27 Success : out Boolean)
Nico Huber83693c82016-10-08 22:17:55 +020028 is
Nico Huber995436b2016-11-20 02:21:51 +010029 DP_Port : constant GMA.DP_Port :=
Tim Wawrzynczak24748f32022-09-09 10:54:05 -060030 (if Config.Has_Type_C_Ports
31 then
32 (case Port_Cfg.Port is
33 when DIGI_A => DP_A,
34 when DIGI_B => DP_B,
35 when DIGI_C => DP_C,
36 when DDI_TC1 => DP_D,
37 when DDI_TC2 => DP_E,
38 when DDI_TC3 => DP_F,
39 when DDI_TC4 => DP_G,
40 when DDI_TC5 => DP_H,
41 when DDI_TC6 => DP_I,
42 when others => GMA.DP_Port'First)
Nico Huber83693c82016-10-08 22:17:55 +020043 else
Tim Wawrzynczak24748f32022-09-09 10:54:05 -060044 (if Port_Cfg.Port = DIGI_A then
45 DP_A
46 else
47 (case Port_Cfg.PCH_Port is
48 when PCH_DP_B => DP_B,
49 when PCH_DP_C => DP_C,
50 when PCH_DP_D => DP_D,
51 when others => GMA.DP_Port'First)));
Nico Huber83693c82016-10-08 22:17:55 +020052 begin
53 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
54
55 if Port_Cfg.Display = DP then
Nico Huber2bbd6e72020-01-07 18:22:59 +010056 if GMA.Config.Use_PP_VDD_Override then
57 Panel.VDD_Override (Port_Cfg.Panel);
58 else
59 Panel.On (Port_Cfg.Panel);
Nico Huber83693c82016-10-08 22:17:55 +020060 end if;
61
Angel Pons8d5c24d2021-03-01 15:59:58 +010062 DP_Dual_Mode.Switch_LSPCON (DP_Port);
63
Nico Huber83693c82016-10-08 22:17:55 +020064 DP_Info.Read_Caps
65 (Link => Port_Cfg.DP,
Nico Huber995436b2016-11-20 02:21:51 +010066 Port => DP_Port,
Nico Huber83693c82016-10-08 22:17:55 +020067 Success => Success);
68 if Success then
Greg V3d3452f2019-10-08 02:05:05 +030069 DP_Info.Read_eDP_Rates
70 (Link => Port_Cfg.DP,
71 Port => DP_Port);
72
Nico Huber83693c82016-10-08 22:17:55 +020073 DP_Info.Preferred_Link_Setting
74 (Link => Port_Cfg.DP,
75 Mode => Port_Cfg.Mode,
76 Success => Success);
Nico Huberaf9cc9e2017-01-09 13:11:32 +010077 pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP));
Nico Huber83693c82016-10-08 22:17:55 +020078 end if;
79 else
80 Success := True;
81 end if;
82 end Preferred_Link_Setting;
83
84 procedure Next_Link_Setting
85 (Port_Cfg : in out Port_Config;
86 Success : out Boolean)
87 is
88 begin
89 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
90
91 if Port_Cfg.Display = DP then
92 DP_Info.Next_Link_Setting
93 (Link => Port_Cfg.DP,
94 Mode => Port_Cfg.Mode,
95 Success => Success);
Nico Huberaf9cc9e2017-01-09 13:11:32 +010096 pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP));
Nico Huber83693c82016-10-08 22:17:55 +020097 else
98 Success := False;
99 end if;
100 end Next_Link_Setting;
101
102 ----------------------------------------------------------------------------
103
104 function Default_BPC (Port_Cfg : Port_Config) return HW.GFX.BPC_Type
105 is
106 begin
107 return
108 (if Port_Cfg.Port = DIGI_A or
Arthur Heymans5d08a932018-03-28 17:00:18 +0200109 (Port_Cfg.Is_FDI and Port_Cfg.PCH_Port = PCH_LVDS) or
110 Port_Cfg.Port = LVDS
Nico Huber83693c82016-10-08 22:17:55 +0200111 then 6
112 else 8);
113 end Default_BPC;
114
115end HW.GFX.GMA.Connector_Info;