| 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 | |
| Nico Huber | a825448 | 2024-07-03 12:23:00 +0200 | [diff] [blame^] | 34 | procedure Prepare |
| 35 | (Port : in Active_Port_Type; |
| 36 | Port_Cfg : in out Port_Config; |
| 37 | Success : out Boolean) |
| 38 | is |
| 39 | begin |
| 40 | Success := True; |
| 41 | end Prepare; |
| 42 | |
| 43 | ---------------------------------------------------------------------------- |
| 44 | |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 45 | procedure Pre_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 | end Pre_On; |
| 55 | |
| 56 | procedure Post_On |
| 57 | (Pipe : in Pipe_Index; |
| 58 | Port_Cfg : in Port_Config; |
| 59 | PLL_Hint : in Word32; |
| 60 | Success : out Boolean) |
| 61 | is |
| 62 | begin |
| 63 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 64 | Success := True; |
| 65 | if Port_Cfg.Port = LVDS then |
| 66 | GMCH.LVDS.On (Port_Cfg, Pipe); |
| 67 | elsif Port_Cfg.Port = VGA then |
| 68 | GMCH.VGA.On (Pipe, Port_Cfg.Mode); |
| 69 | elsif Port_Cfg.Port in Digital_Port then |
| 70 | if Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then |
| 71 | GMCH.DP.On (Port_Cfg, Pipe, Success); |
| 72 | elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then |
| 73 | GMCH.HDMI.On (Port_Cfg, Pipe); |
| 74 | end if; |
| 75 | end if; |
| 76 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame] | 77 | Panel.On (Port_Cfg.Panel, Wait => False); |
| 78 | Panel.Backlight_On (Port_Cfg.Panel); |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 79 | end Post_On; |
| 80 | |
| 81 | ---------------------------------------------------------------------------- |
| 82 | |
| 83 | procedure Pre_Off (Port_Cfg : Port_Config) |
| 84 | is |
| 85 | begin |
| 86 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 87 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame] | 88 | Panel.Backlight_Off (Port_Cfg.Panel); |
| 89 | Panel.Off (Port_Cfg.Panel); |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 90 | end Pre_Off; |
| 91 | |
| 92 | procedure Post_Off (Port_Cfg : Port_Config) |
| 93 | is |
| 94 | begin |
| 95 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 96 | if Port_Cfg.Port = LVDS then |
| 97 | GMCH.LVDS.Off; |
| 98 | elsif Port_Cfg.Port = VGA then |
| 99 | GMCH.VGA.Off; |
| 100 | elsif Port_Cfg.Display = DP and Port_Cfg.Port in GMCH_DP_Port then |
| 101 | GMCH.DP.Off (Port_Cfg.Port); |
| 102 | elsif Port_Cfg.Display = HDMI and Port_Cfg.Port in GMCH_HDMI_Port then |
| 103 | GMCH.HDMI.Off (Port_Cfg.Port); |
| 104 | end if; |
| 105 | end Post_Off; |
| 106 | |
| 107 | ---------------------------------------------------------------------------- |
| 108 | |
| 109 | procedure Pre_All_Off |
| 110 | is |
| 111 | begin |
| 112 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 113 | |
| Nico Huber | 2bbd6e7 | 2020-01-07 18:22:59 +0100 | [diff] [blame] | 114 | for P in Valid_Panels loop |
| 115 | Panel.Backlight_Off (P); |
| 116 | Panel.Off (P); |
| 117 | end loop; |
| Arthur Heymans | 73ea032 | 2018-03-28 17:17:07 +0200 | [diff] [blame] | 118 | end Pre_All_Off; |
| 119 | |
| 120 | procedure Post_All_Off |
| 121 | is |
| 122 | begin |
| 123 | pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity)); |
| 124 | GMCH.LVDS.Off; |
| 125 | GMCH.VGA.Off; |
| 126 | GMCH.DP.All_Off; |
| 127 | GMCH.HDMI.All_Off; |
| 128 | end Post_All_Off; |
| 129 | |
| 130 | end HW.GFX.GMA.Connectors; |