blob: 5ca7c9be10c274d3a434afa81f408b5652a0af8c [file] [log] [blame]
Arthur Heymans73ea0322018-03-28 17:17:07 +02001--
2-- Copyright (C) 2015-2016 secunet Security Networks AG
3-- Copyright (C) 2016 Nico Huber <nico.h@gmx.de>
4--
5-- This program is free software; you can redistribute it and/or modify
6-- it under the terms of the GNU General Public License as published by
7-- the Free Software Foundation; either version 2 of the License, or
8-- (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-- GNU General Public License for more details.
14--
15
16with HW.GFX.GMA.Config;
17with HW.GFX.GMA.Panel;
18with HW.GFX.GMA.GMCH.VGA;
19with HW.GFX.GMA.GMCH.LVDS;
20with HW.GFX.GMA.GMCH.HDMI;
21with HW.GFX.GMA.GMCH.DP;
22
23with HW.Debug;
24with GNAT.Source_Info;
25
26package body HW.GFX.GMA.Connectors
27is
28
29 procedure Post_Reset_Off is null;
30 procedure Initialize is null;
31
32 function Is_Internal (Port_Cfg : Port_Config) return Boolean
33 is
34 begin
35 return Port_Cfg.Port = LVDS;
36 end Is_Internal;
37
38 ----------------------------------------------------------------------------
39
40 procedure Pre_On
41 (Pipe : in Pipe_Index;
42 Port_Cfg : in Port_Config;
43 PLL_Hint : in Word32;
44 Success : out Boolean)
45 is
46 begin
47 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
48 Success := True;
49 end Pre_On;
50
51 procedure Post_On
52 (Pipe : in Pipe_Index;
53 Port_Cfg : in Port_Config;
54 PLL_Hint : in Word32;
55 Success : out Boolean)
56 is
57 begin
58 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
59 Success := True;
60 if Port_Cfg.Port = LVDS then
61 GMCH.LVDS.On (Port_Cfg, Pipe);
62 elsif Port_Cfg.Port = VGA then
63 GMCH.VGA.On (Pipe, Port_Cfg.Mode);
64 elsif Port_Cfg.Port in Digital_Port then
65 if Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then
66 GMCH.DP.On (Port_Cfg, Pipe, Success);
67 elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then
68 GMCH.HDMI.On (Port_Cfg, Pipe);
69 end if;
70 end if;
71
72 if Is_Internal (Port_Cfg) then
73 Panel.On (Wait => False);
74 Panel.Backlight_On;
75 end if;
76 end Post_On;
77
78 ----------------------------------------------------------------------------
79
80 procedure Pre_Off (Port_Cfg : Port_Config)
81 is
82 begin
83 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
84
85 if Is_Internal (Port_Cfg) then
86 Panel.Backlight_Off;
87 Panel.Off;
88 end if;
89 end Pre_Off;
90
91 procedure Post_Off (Port_Cfg : Port_Config)
92 is
93 begin
94 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
95 if Port_Cfg.Port = LVDS then
96 GMCH.LVDS.Off;
97 elsif Port_Cfg.Port = VGA then
98 GMCH.VGA.Off;
99 elsif Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then
100 GMCH.DP.Off (Port_Cfg.Port);
101 elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then
102 GMCH.HDMI.Off (Port_Cfg.Port);
103 end if;
104 end Post_Off;
105
106 ----------------------------------------------------------------------------
107
108 procedure Pre_All_Off
109 is
110 begin
111 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
112
113 Panel.Backlight_Off;
114 Panel.Off;
115 end Pre_All_Off;
116
117 procedure Post_All_Off
118 is
119 begin
120 pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
121 GMCH.LVDS.Off;
122 GMCH.VGA.Off;
123 GMCH.DP.All_Off;
124 GMCH.HDMI.All_Off;
125 end Post_All_Off;
126
127end HW.GFX.GMA.Connectors;