blob: 6ab755b9e45a38851bd17b03c0c7742e9a47568a [file] [log] [blame]
Nico Huber18ff0c12017-06-12 15:41:31 +02001--
Nico Huber25fdb152019-02-17 15:54:39 +01002-- Copyright (C) 2017, 2019 secunet Security Networks AG
Nico Huber18ff0c12017-06-12 15:41:31 +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
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
15with HW.GFX.GMA.Config;
16
17package body HW.GFX.GMA.Connectors.DDI.Buffers
18is
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
Nico Huber25fdb152019-02-17 15:54:39 +010054 Skylake_Y_Trans_EDP : constant Buf_Trans_Array :=
55 (16#0000_0018#, 16#0000_00a8#,
56 16#0000_4013#, 16#0000_00ab#,
57 16#0000_7011#, 16#0000_00a4#,
58 16#0000_9010#, 16#0000_00df#,
59 16#0000_0018#, 16#0000_00aa#,
60 16#0000_6013#, 16#0000_00a4#,
61 16#0000_7011#, 16#0000_009d#,
62 16#0000_0018#, 16#0000_00a0#,
63 16#0000_6012#, 16#0000_00df#,
64 16#0000_0018#, 16#0000_008a#);
65
Nico Huber18ff0c12017-06-12 15:41:31 +020066 Skylake_Trans_DP : constant Buf_Trans_Array :=
67 (16#0000_2016#, 16#0000_00a0#,
68 16#0000_5012#, 16#0000_009b#,
69 16#0000_7011#, 16#0000_0088#,
70 16#8000_9010#, 16#0000_00c0#,
71 16#0000_2016#, 16#0000_009b#,
72 16#0000_5012#, 16#0000_0088#,
73 16#8000_7011#, 16#0000_00c0#,
74 16#0000_2016#, 16#0000_00df#,
75 16#8000_5012#, 16#0000_00c0#,
76 others => 0);
77
78 Skylake_U_Trans_DP : constant Buf_Trans_Array :=
79 (16#0000_201b#, 16#0000_00a2#,
80 16#0000_5012#, 16#0000_0088#,
81 16#8000_7011#, 16#0000_00cd#,
82 16#8000_9010#, 16#0000_00c0#,
83 16#0000_201b#, 16#0000_009d#,
84 16#8000_5012#, 16#0000_00c0#,
85 16#8000_7011#, 16#0000_00c0#,
86 16#0000_2016#, 16#0000_0088#,
87 16#8000_5012#, 16#0000_00c0#,
88 others => 0);
89
Nico Huber25fdb152019-02-17 15:54:39 +010090 Skylake_Y_Trans_DP : constant Buf_Trans_Array :=
91 (16#0000_0018#, 16#0000_00a2#,
92 16#0000_5012#, 16#0000_0088#,
93 16#8000_7011#, 16#0000_00cd#,
94 16#8000_9010#, 16#0000_00c0#,
95 16#0000_0018#, 16#0000_009d#,
96 16#8000_5012#, 16#0000_00c0#,
97 16#8000_7011#, 16#0000_00c0#,
98 16#0000_0018#, 16#0000_0088#,
99 16#8000_5012#, 16#0000_00c0#,
100 others => 0);
101
Nico Huber18ff0c12017-06-12 15:41:31 +0200102 Skylake_Trans_HDMI : constant HDMI_Buf_Trans_Array :=
103 ((16#0000_0018#, 16#0000_00ac#),
104 (16#0000_5012#, 16#0000_009d#),
105 (16#0000_7011#, 16#0000_0088#),
106 (16#0000_0018#, 16#0000_00a1#),
107 (16#0000_0018#, 16#0000_0098#),
108 (16#0000_4013#, 16#0000_0088#),
109 (16#8000_6012#, 16#0000_00cd#),
110 (16#0000_0018#, 16#0000_00df#),
111 (16#8000_3015#, 16#0000_00cd#),
112 (16#8000_3015#, 16#0000_00c0#),
113 (16#8000_0018#, 16#0000_00c0#));
114
Nico Huber25fdb152019-02-17 15:54:39 +0100115 Skylake_Y_Trans_HDMI : constant HDMI_Buf_Trans_Array :=
116 ((16#0000_0018#, 16#0000_00a1#),
117 (16#0000_5012#, 16#0000_00df#),
118 (16#8000_7011#, 16#0000_00cb#),
119 (16#0000_0018#, 16#0000_00a4#),
120 (16#0000_0018#, 16#0000_009d#),
121 (16#0000_4013#, 16#0000_0080#),
122 (16#8000_6013#, 16#0000_00c0#),
123 (16#0000_0018#, 16#0000_008a#),
124 (16#8000_3015#, 16#0000_00c0#),
125 (16#8000_3015#, 16#0000_00c0#),
126 (16#8000_0018#, 16#0000_00c0#));
127
Nico Huber18ff0c12017-06-12 15:41:31 +0200128 ----------------------------------------------------------------------------
129
130 procedure Translations (Trans : out Buf_Trans_Array; Port : Digital_Port)
131 is
132 DDIA_Low_Voltage_Swing : constant Boolean :=
133 Config.EDP_Low_Voltage_Swing and then Port = DIGI_A;
134
135 HDMI_Trans : constant Skylake_HDMI_Range :=
136 (if Config.DDI_HDMI_Buffer_Translation in Skylake_HDMI_Range
137 then Config.DDI_HDMI_Buffer_Translation
138 else Config.Default_DDI_HDMI_Buffer_Translation);
139 begin
140 Trans :=
Nico Huber25fdb152019-02-17 15:54:39 +0100141 (if Config.Is_ULX then
Nico Huber67cf6d82018-06-09 18:48:11 +0200142 (if DDIA_Low_Voltage_Swing
Nico Huber25fdb152019-02-17 15:54:39 +0100143 then Skylake_Y_Trans_EDP
144 else Skylake_Y_Trans_DP)
145 elsif Config.Is_ULT then
Nico Huber67cf6d82018-06-09 18:48:11 +0200146 (if DDIA_Low_Voltage_Swing
147 then Skylake_U_Trans_EDP
Nico Huber25fdb152019-02-17 15:54:39 +0100148 else Skylake_U_Trans_DP)
149 else
150 (if DDIA_Low_Voltage_Swing
151 then Skylake_Trans_EDP
152 else Skylake_Trans_DP));
Nico Huber18ff0c12017-06-12 15:41:31 +0200153 if not DDIA_Low_Voltage_Swing then
Nico Huber25fdb152019-02-17 15:54:39 +0100154 if Config.Is_ULX then
155 Trans (18) := Skylake_Y_Trans_HDMI (HDMI_Trans).Trans1;
156 Trans (19) := Skylake_Y_Trans_HDMI (HDMI_Trans).Trans2;
157 else
158 Trans (18) := Skylake_Trans_HDMI (HDMI_Trans).Trans1;
159 Trans (19) := Skylake_Trans_HDMI (HDMI_Trans).Trans2;
160 end if;
Nico Huber18ff0c12017-06-12 15:41:31 +0200161 end if;
162 end Translations;
163
164end HW.GFX.GMA.Connectors.DDI.Buffers;