gma: Add option to keep port power after Scan_Ports()
This is useful when we only want to probe for connected displays while
another entity currently controls the outputs.
Also introduce an `All_Ports` list, that can be used when it's unknown
which ports are actually implemented (the default now, when no port
list is provided to `Scan_Ports()`).
Change-Id: I5d8e289a907fe99c673084afbce54da65ba98e9c
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18123
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma-display_probing.adb b/common/hw-gfx-gma-display_probing.adb
index 4420a66..97792cf 100644
--- a/common/hw-gfx-gma-display_probing.adb
+++ b/common/hw-gfx-gma-display_probing.adb
@@ -166,9 +166,10 @@
end Probe_Port;
procedure Scan_Ports
- (Configs : out Pipe_Configs;
- Ports : in Port_List;
- Max_Pipe : in Pipe_Index := Pipe_Index'Last)
+ (Configs : out Pipe_Configs;
+ Ports : in Port_List := All_Ports;
+ Max_Pipe : in Pipe_Index := Pipe_Index'Last;
+ Keep_Power : in Boolean := False)
is
Probe_Internal : Boolean := False;
@@ -211,7 +212,9 @@
end loop;
-- Restore power settings
- Power_And_Clocks.Power_Set_To (Cur_Configs);
+ if not Keep_Power then
+ Power_And_Clocks.Power_Set_To (Cur_Configs);
+ end if;
-- Turn panel power off if probing failed.
if Probe_Internal and not Port_Configured (Configs, Internal) then
diff --git a/common/hw-gfx-gma-display_probing.ads b/common/hw-gfx-gma-display_probing.ads
index 3d1e914..f5cd839 100644
--- a/common/hw-gfx-gma-display_probing.ads
+++ b/common/hw-gfx-gma-display_probing.ads
@@ -17,10 +17,13 @@
type Port_List_Range is range 0 .. 7;
type Port_List is array (Port_List_Range) of Port_Type;
+ All_Ports : constant Port_List :=
+ (DP1, DP2, DP3, HDMI1, HDMI2, HDMI3, Analog, Internal);
procedure Scan_Ports
- (Configs : out Pipe_Configs;
- Ports : in Port_List;
- Max_Pipe : in Pipe_Index := Pipe_Index'Last);
+ (Configs : out Pipe_Configs;
+ Ports : in Port_List := All_Ports;
+ Max_Pipe : in Pipe_Index := Pipe_Index'Last;
+ Keep_Power : in Boolean := False);
end HW.GFX.GMA.Display_Probing;