| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 1 | -- |
| Nico Huber | af9cc9e | 2017-01-09 13:11:32 +0100 | [diff] [blame] | 2 | -- Copyright (C) 2015-2017 secunet Security Networks AG |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 3 | -- |
| 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 Huber | 125a29e | 2016-10-18 00:23:54 +0200 | [diff] [blame] | 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 8 | -- |
| 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 Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 15 | with HW.GFX.GMA.Config; |
| 16 | with HW.GFX.GMA.Panel; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 17 | with HW.GFX.GMA.DP_Info; |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 18 | |
| 19 | with HW.Debug; |
| 20 | with GNAT.Source_Info; |
| 21 | |
| 22 | package body HW.GFX.GMA.Connector_Info is |
| 23 | |
| Nico Huber | 995436b | 2016-11-20 02:21:51 +0100 | [diff] [blame] | 24 | procedure Preferred_Link_Setting |
| 25 | (Port_Cfg : in out Port_Config; |
| 26 | Success : out Boolean) |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 27 | is |
| Nico Huber | 995436b | 2016-11-20 02:21:51 +0100 | [diff] [blame] | 28 | DP_Port : constant GMA.DP_Port := |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 29 | (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 Huber | 995436b | 2016-11-20 02:21:51 +0100 | [diff] [blame] | 36 | when others => GMA.DP_Port'First)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 37 | begin |
| 38 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 39 | |
| 40 | if Port_Cfg.Display = DP then |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame] | 41 | if GMA.Config.Use_PP_VDD_Override then |
| 42 | Panel.VDD_Override (Port_Cfg.Panel); |
| 43 | else |
| 44 | Panel.On (Port_Cfg.Panel); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 45 | end if; |
| 46 | |
| 47 | DP_Info.Read_Caps |
| 48 | (Link => Port_Cfg.DP, |
| Nico Huber | 995436b | 2016-11-20 02:21:51 +0100 | [diff] [blame] | 49 | Port => DP_Port, |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 50 | Success => Success); |
| 51 | if Success then |
| Greg V | 3d3452f | 2019-10-08 02:05:05 +0300 | [diff] [blame] | 52 | DP_Info.Read_eDP_Rates |
| 53 | (Link => Port_Cfg.DP, |
| 54 | Port => DP_Port); |
| 55 | |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 56 | DP_Info.Preferred_Link_Setting |
| 57 | (Link => Port_Cfg.DP, |
| 58 | Mode => Port_Cfg.Mode, |
| 59 | Success => Success); |
| Nico Huber | af9cc9e | 2017-01-09 13:11:32 +0100 | [diff] [blame] | 60 | pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 61 | end if; |
| 62 | else |
| 63 | Success := True; |
| 64 | end if; |
| 65 | end Preferred_Link_Setting; |
| 66 | |
| 67 | procedure Next_Link_Setting |
| 68 | (Port_Cfg : in out Port_Config; |
| 69 | Success : out Boolean) |
| 70 | is |
| 71 | begin |
| 72 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 73 | |
| 74 | if Port_Cfg.Display = DP then |
| 75 | DP_Info.Next_Link_Setting |
| 76 | (Link => Port_Cfg.DP, |
| 77 | Mode => Port_Cfg.Mode, |
| 78 | Success => Success); |
| Nico Huber | af9cc9e | 2017-01-09 13:11:32 +0100 | [diff] [blame] | 79 | pragma Debug (Success, DP_Info.Dump_Link_Setting (Port_Cfg.DP)); |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 80 | else |
| 81 | Success := False; |
| 82 | end if; |
| 83 | end Next_Link_Setting; |
| 84 | |
| 85 | ---------------------------------------------------------------------------- |
| 86 | |
| 87 | function Default_BPC (Port_Cfg : Port_Config) return HW.GFX.BPC_Type |
| 88 | is |
| 89 | begin |
| 90 | return |
| 91 | (if Port_Cfg.Port = DIGI_A or |
| Arthur Heymans | 5d08a93 | 2018-03-28 17:00:18 +0200 | [diff] [blame] | 92 | (Port_Cfg.Is_FDI and Port_Cfg.PCH_Port = PCH_LVDS) or |
| 93 | Port_Cfg.Port = LVDS |
| Nico Huber | 83693c8 | 2016-10-08 22:17:55 +0200 | [diff] [blame] | 94 | then 6 |
| 95 | else 8); |
| 96 | end Default_BPC; |
| 97 | |
| 98 | end HW.GFX.GMA.Connector_Info; |