| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 1 | -- |
| 2 | -- Copyright (C) 2017 secunet Security Networks AG |
| 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 |
| 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| 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 | |
| 15 | with HW.GFX.GMA.Config; |
| 16 | |
| 17 | package body HW.GFX.GMA.Connectors.DDI.Buffers |
| 18 | is |
| 19 | |
| 20 | subtype Skylake_HDMI_Range is DDI_HDMI_Buf_Trans_Range range 0 .. 10; |
| 21 | |
| 22 | type HDMI_Buf_Trans is record |
| 23 | Trans1 : Word32; |
| 24 | Trans2 : Word32; |
| 25 | end record; |
| 26 | type HDMI_Buf_Trans_Array is array (Skylake_HDMI_Range) of HDMI_Buf_Trans; |
| 27 | |
| 28 | ---------------------------------------------------------------------------- |
| 29 | |
| 30 | Skylake_Trans_EDP : constant Buf_Trans_Array := |
| 31 | (16#0000_0018#, 16#0000_00a8#, |
| 32 | 16#0000_4013#, 16#0000_00a9#, |
| 33 | 16#0000_7011#, 16#0000_00a2#, |
| 34 | 16#0000_9010#, 16#0000_009c#, |
| 35 | 16#0000_0018#, 16#0000_00a9#, |
| 36 | 16#0000_6013#, 16#0000_00a2#, |
| 37 | 16#0000_7011#, 16#0000_00a6#, |
| 38 | 16#0000_0018#, 16#0000_00ab#, |
| 39 | 16#0000_7013#, 16#0000_009f#, |
| 40 | 16#0000_0018#, 16#0000_00df#); |
| 41 | |
| 42 | Skylake_U_Trans_EDP : constant Buf_Trans_Array := |
| 43 | (16#0000_0018#, 16#0000_00a8#, |
| 44 | 16#0000_4013#, 16#0000_00a9#, |
| 45 | 16#0000_7011#, 16#0000_00a2#, |
| 46 | 16#0000_9010#, 16#0000_009c#, |
| 47 | 16#0000_0018#, 16#0000_00a9#, |
| 48 | 16#0000_6013#, 16#0000_00a2#, |
| 49 | 16#0000_7011#, 16#0000_00a6#, |
| 50 | 16#0000_2016#, 16#0000_00ab#, |
| 51 | 16#0000_5013#, 16#0000_009f#, |
| 52 | 16#0000_0018#, 16#0000_00df#); |
| 53 | |
| 54 | Skylake_Trans_DP : constant Buf_Trans_Array := |
| 55 | (16#0000_2016#, 16#0000_00a0#, |
| 56 | 16#0000_5012#, 16#0000_009b#, |
| 57 | 16#0000_7011#, 16#0000_0088#, |
| 58 | 16#8000_9010#, 16#0000_00c0#, |
| 59 | 16#0000_2016#, 16#0000_009b#, |
| 60 | 16#0000_5012#, 16#0000_0088#, |
| 61 | 16#8000_7011#, 16#0000_00c0#, |
| 62 | 16#0000_2016#, 16#0000_00df#, |
| 63 | 16#8000_5012#, 16#0000_00c0#, |
| 64 | others => 0); |
| 65 | |
| 66 | Skylake_U_Trans_DP : constant Buf_Trans_Array := |
| 67 | (16#0000_201b#, 16#0000_00a2#, |
| 68 | 16#0000_5012#, 16#0000_0088#, |
| 69 | 16#8000_7011#, 16#0000_00cd#, |
| 70 | 16#8000_9010#, 16#0000_00c0#, |
| 71 | 16#0000_201b#, 16#0000_009d#, |
| 72 | 16#8000_5012#, 16#0000_00c0#, |
| 73 | 16#8000_7011#, 16#0000_00c0#, |
| 74 | 16#0000_2016#, 16#0000_0088#, |
| 75 | 16#8000_5012#, 16#0000_00c0#, |
| 76 | others => 0); |
| 77 | |
| 78 | Skylake_Trans_HDMI : constant HDMI_Buf_Trans_Array := |
| 79 | ((16#0000_0018#, 16#0000_00ac#), |
| 80 | (16#0000_5012#, 16#0000_009d#), |
| 81 | (16#0000_7011#, 16#0000_0088#), |
| 82 | (16#0000_0018#, 16#0000_00a1#), |
| 83 | (16#0000_0018#, 16#0000_0098#), |
| 84 | (16#0000_4013#, 16#0000_0088#), |
| 85 | (16#8000_6012#, 16#0000_00cd#), |
| 86 | (16#0000_0018#, 16#0000_00df#), |
| 87 | (16#8000_3015#, 16#0000_00cd#), |
| 88 | (16#8000_3015#, 16#0000_00c0#), |
| 89 | (16#8000_0018#, 16#0000_00c0#)); |
| 90 | |
| 91 | ---------------------------------------------------------------------------- |
| 92 | |
| 93 | procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port) |
| 94 | is |
| 95 | DDIA_Low_Voltage_Swing : constant Boolean := |
| 96 | Config.EDP_Low_Voltage_Swing and then Port = DIGI_A; |
| 97 | |
| 98 | HDMI_Trans : constant Skylake_HDMI_Range := |
| 99 | (if Config.DDI_HDMI_Buffer_Translation in Skylake_HDMI_Range |
| 100 | then Config.DDI_HDMI_Buffer_Translation |
| 101 | else Config.Default_DDI_HDMI_Buffer_Translation); |
| 102 | begin |
| 103 | Trans := |
| Nico Huber | 67cf6d8 | 2018-06-09 18:48:11 +0200 | [diff] [blame] | 104 | (if not Config.Is_ULT then |
| 105 | (if DDIA_Low_Voltage_Swing |
| 106 | then Skylake_Trans_EDP |
| 107 | else Skylake_Trans_DP) |
| 108 | else |
| 109 | (if DDIA_Low_Voltage_Swing |
| 110 | then Skylake_U_Trans_EDP |
| 111 | else Skylake_U_Trans_DP)); |
| Nico Huber | 18ff0c1 | 2017-06-12 15:41:31 +0200 | [diff] [blame] | 112 | if not DDIA_Low_Voltage_Swing then |
| 113 | Trans (18) := Skylake_Trans_HDMI (HDMI_Trans).Trans1; |
| 114 | Trans (19) := Skylake_Trans_HDMI (HDMI_Trans).Trans2; |
| 115 | end if; |
| 116 | end Translations; |
| 117 | |
| 118 | end HW.GFX.GMA.Connectors.DDI.Buffers; |