From bc0588e482b1320d5739900b00a45033f5b587f4 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 21 Jul 2020 12:17:19 +0200 Subject: [PATCH] gma: Export backlight control interface Change-Id: I5a157d7849124fd3b4cca8f9de1d605092fd3c5e Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/43668 Tested-by: Nico Huber Reviewed-by: Angel Pons --- common/hw-gfx-gma.adb | 34 ++++++++++++++++++++++++++++++++++ common/hw-gfx-gma.ads | 18 ++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb index d1ae1a0..851686e 100644 --- a/common/hw-gfx-gma.adb +++ b/common/hw-gfx-gma.adb @@ -402,6 +402,40 @@ is ---------------------------------------------------------------------------- + procedure Backlight_On (Port : Active_Port_Type) + with + Refined_Global => (In_Out => Registers.Register_State) + is + begin + Panel.Backlight_On (Config_Helpers.To_Panel (Port)); + end Backlight_On; + + procedure Backlight_Off (Port : Active_Port_Type) + with + Refined_Global => (In_Out => Registers.Register_State) + is + begin + Panel.Backlight_Off (Config_Helpers.To_Panel (Port)); + end Backlight_Off; + + procedure Set_Brightness (Port : Active_Port_Type; Level : Word32) + with + Refined_Global => (In_Out => Registers.Register_State) + is + begin + Panel.Set_Backlight (Config_Helpers.To_Panel (Port), Level); + end Set_Brightness; + + procedure Get_Max_Brightness (Port : Active_Port_Type; Level : out Word32) + with + Refined_Global => (In_Out => Registers.Register_State) + is + begin + Panel.Get_Max_Backlight (Config_Helpers.To_Panel (Port), Level); + end Get_Max_Brightness; + + ---------------------------------------------------------------------------- + procedure Initialize (Write_Delay : in Word64 := 0; Clean_State : in Boolean := False; diff --git a/common/hw-gfx-gma.ads b/common/hw-gfx-gma.ads index 5c63942..afd1512 100644 --- a/common/hw-gfx-gma.ads +++ b/common/hw-gfx-gma.ads @@ -169,6 +169,24 @@ is ---------------------------------------------------------------------------- + procedure Backlight_On (Port : Active_Port_Type) + with + Global => (In_Out => Device_State); + + procedure Backlight_Off (Port : Active_Port_Type) + with + Global => (In_Out => Device_State); + + procedure Set_Brightness (Port : Active_Port_Type; Level : Word32) + with + Global => (In_Out => Device_State); + + procedure Get_Max_Brightness (Port : Active_Port_Type; Level : out Word32) + with + Global => (In_Out => Device_State); + + ---------------------------------------------------------------------------- + procedure Write_GTT (GTT_Page : GTT_Range; Device_Address : GTT_Address_Type;