From 564103f4cc8aa4ca747d7d1bdf5f4e56efb53478 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Wed, 11 Jan 2017 15:33:07 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/18121 Tested-by: Nico Huber Reviewed-by: Arthur Heymans --- common/hw-gfx-gma.adb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index e1964fa050..616a170cf7 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -201,8 +201,19 @@ is 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 @@ is then Disable_Output (Pipe, Cur_Config); Cur_Config.Port := Disabled; + Update_Power; end if; end if; end; @@ -246,10 +258,7 @@ is 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 @@ is 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;