| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 1 | -- |
| 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 | |
| 16 | with HW.GFX.GMA.Config; |
| 17 | with HW.GFX.GMA.Panel; |
| 18 | with HW.GFX.GMA.GMCH.VGA; |
| 19 | with HW.GFX.GMA.GMCH.LVDS; |
| 20 | with HW.GFX.GMA.GMCH.HDMI; |
| 21 | with HW.GFX.GMA.GMCH.DP; |
| 22 | |
| 23 | with HW.Debug; |
| 24 | with GNAT.Source_Info; |
| 25 | |
| 26 | package body HW.GFX.GMA.Connectors |
| 27 | is |
| 28 | |
| 29 | procedure Post_Reset_Off is null; |
| 30 | procedure Initialize is null; |
| 31 | |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 32 | ---------------------------------------------------------------------------- |
| 33 | |
| 34 | procedure Pre_On |
| 35 | (Pipe : in Pipe_Index; |
| 36 | Port_Cfg : in Port_Config; |
| 37 | PLL_Hint : in Word32; |
| 38 | Success : out Boolean) |
| 39 | is |
| 40 | begin |
| 41 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 42 | Success := True; |
| 43 | end Pre_On; |
| 44 | |
| 45 | procedure Post_On |
| 46 | (Pipe : in Pipe_Index; |
| 47 | Port_Cfg : in Port_Config; |
| 48 | PLL_Hint : in Word32; |
| 49 | Success : out Boolean) |
| 50 | is |
| 51 | begin |
| 52 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 53 | Success := True; |
| 54 | if Port_Cfg.Port = LVDS then |
| 55 | GMCH.LVDS.On (Port_Cfg, Pipe); |
| 56 | elsif Port_Cfg.Port = VGA then |
| 57 | GMCH.VGA.On (Pipe, Port_Cfg.Mode); |
| 58 | elsif Port_Cfg.Port in Digital_Port then |
| 59 | if Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then |
| 60 | GMCH.DP.On (Port_Cfg, Pipe, Success); |
| 61 | elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then |
| 62 | GMCH.HDMI.On (Port_Cfg, Pipe); |
| 63 | end if; |
| 64 | end if; |
| 65 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame^] | 66 | Panel.On (Port_Cfg.Panel, Wait => False); |
| 67 | Panel.Backlight_On (Port_Cfg.Panel); |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 68 | end Post_On; |
| 69 | |
| 70 | ---------------------------------------------------------------------------- |
| 71 | |
| 72 | procedure Pre_Off (Port_Cfg : Port_Config) |
| 73 | is |
| 74 | begin |
| 75 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 76 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame^] | 77 | Panel.Backlight_Off (Port_Cfg.Panel); |
| 78 | Panel.Off (Port_Cfg.Panel); |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 79 | end Pre_Off; |
| 80 | |
| 81 | procedure Post_Off (Port_Cfg : Port_Config) |
| 82 | is |
| 83 | begin |
| 84 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 85 | if Port_Cfg.Port = LVDS then |
| 86 | GMCH.LVDS.Off; |
| 87 | elsif Port_Cfg.Port = VGA then |
| 88 | GMCH.VGA.Off; |
| 89 | elsif Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then |
| 90 | GMCH.DP.Off (Port_Cfg.Port); |
| 91 | elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then |
| 92 | GMCH.HDMI.Off (Port_Cfg.Port); |
| 93 | end if; |
| 94 | end Post_Off; |
| 95 | |
| 96 | ---------------------------------------------------------------------------- |
| 97 | |
| 98 | procedure Pre_All_Off |
| 99 | is |
| 100 | begin |
| 101 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 102 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame^] | 103 | for P in Valid_Panels loop |
| 104 | Panel.Backlight_Off (P); |
| 105 | Panel.Off (P); |
| 106 | end loop; |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 107 | end Pre_All_Off; |
| 108 | |
| 109 | procedure Post_All_Off |
| 110 | is |
| 111 | begin |
| 112 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 113 | GMCH.LVDS.Off; |
| 114 | GMCH.VGA.Off; |
| 115 | GMCH.DP.All_Off; |
| 116 | GMCH.HDMI.All_Off; |
| 117 | end Post_All_Off; |
| 118 | |
| 119 | end HW.GFX.GMA.Connectors; |