gma: Rework power handling in Update_Outputs()
We should also reevaluate power settings, when we only disabled pipes
and didn't enable any new outputs.
Change-Id: Ia81454bdeb770359b1d95e02f6f3d75e76584857
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18121
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index e1964fa..616a170 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -201,8 +201,19 @@
end if;
end Check_HPD;
- Did_Power_Up : Boolean := False;
+ Power_Changed : Boolean := False;
Old_Configs : Pipe_Configs;
+
+ -- Only called when we actually tried to change something
+ -- so we don't congest the log with unnecessary messages.
+ procedure Update_Power
+ is
+ begin
+ if not Power_Changed then
+ Power_And_Clocks.Power_Up (Old_Configs, Configs);
+ Power_Changed := True;
+ end if;
+ end Update_Power;
begin
Old_Configs := Cur_Configs;
@@ -222,6 +233,7 @@
then
Disable_Output (Pipe, Cur_Config);
Cur_Config.Port := Disabled;
+ Update_Power;
end if;
end if;
end;
@@ -246,10 +258,7 @@
end if;
if Success then
- if not Did_Power_Up then
- Power_And_Clocks.Power_Up (Old_Configs, Configs);
- Did_Power_Up := True;
- end if;
+ Update_Power;
Enable_Output (Pipe, New_Config, Success);
end if;
@@ -267,7 +276,7 @@
end;
end loop;
- if Did_Power_Up then
+ if Power_Changed then
Power_And_Clocks.Power_Down (Old_Configs, Configs, Cur_Configs);
end if;
end Update_Outputs;