summaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/gma.adb
blob: 43fc7b28a797711a6dcaf62705eb7b22d5fbd6df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
-- SPDX-License-Identifier: GPL-2.0-only

with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;

use HW.GFX.GMA;

package body GMA is

   function read_edid
     (raw_edid :    out HW.GFX.EDID.Raw_EDID_Data;
      port     : in     Interfaces.C.int)
      return Interfaces.C.int
   is
      use type Interfaces.C.int;
      success : Boolean := true;
   begin
      if port not in Active_Port_Type'Pos (Active_Port_Type'First)
                     .. Active_Port_Type'Pos (Active_Port_Type'Last)
      then
         raw_edid := (others => 0);
         return -2;
      else
         if not HW.GFX.GMA.Is_Initialized then
            HW.GFX.GMA.Initialize (Success => success);
         end if;
         if success then
            HW.GFX.GMA.Display_Probing.Read_EDID
              (raw_edid, Active_Port_Type'Val (port), success);
         end if;
         if success then
            return 0;
         else
            return -1;
         end if;
      end if;
   end read_edid;

end GMA;