Hello Nico,
I have tested the backlight control with hardware similar to the UP squared
board with LVDS panel on eDP via eDP2LVDS bridge.
The backlight control most needs two signals on the connector for the TFT
panel.
The Backlight Enable Pin and the Backlight PWM Pin. I use the Panel Control 1
set pins for that.
I patched the libgfxinit routines in the following manner:
"common\hw-gfx-gma-panel.adb"
procedure Backlight_On (Panel : Panel_Control) is
begin
if Panel not in Valid_Panels then
return;
end if;
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
if Config.Has_New_Backlight_Control then
Registers.Set_Mask
(Register => BLC (Panel).CTL,
Mask => BXT_BLC_PWM_CTL_ENABLE);
-- else -- ka changed to set PP_CONTROL Bit for
backlight enable also which is most needed
end if;
Registers.Set_Mask
(Register => PP (Panel).CONTROL,
Mask => PCH_PP_CONTROL_BACKLIGHT_ENABLE);
--end if; --
ka removed
end Backlight_On;
procedure Backlight_Off (Panel : Panel_Control) is
begin
if Panel not in Valid_Panels then
return;
end if;
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
if Config.Has_New_Backlight_Control then
Registers.Unset_Mask
(Register => BLC (Panel).CTL,
Mask => BXT_BLC_PWM_CTL_ENABLE);
--else --
ka removed
end if;
-- ka added
Registers.Unset_Mask
(Register => PP (Panel).CONTROL,
Mask => PCH_PP_CONTROL_BACKLIGHT_ENABLE);
--end if;
-- ka removed
end Backlight_Off;
procedure Set_Backlight (Panel : Panel_Control; Freq : Word32; Level :
Word32) is --ka add Freq parameter for PWM frequency
begin
if Panel not in Valid_Panels then
return;
end if;
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
if Config.Has_New_Backlight_Control then
Registers.Write (BLC (Panel).FREQ, Freq);
-- ka added to set PWM frequency and duty level
Registers.Write (BLC (Panel).DUTY, Level);
else
Registers.Unset_And_Set_Mask
(Register => Registers.BLC_PWM_CPU_CTL,
Mask_Unset => CPU_BLC_PWM_DATA_BL_DUTY_CYC_MASK,
Mask_Set => Level);
end if;
end Set_Backlight;
"common\haswell_shared\hw-gfx-gma-connectors.adb"
procedure Post_On
(Pipe : in Pipe_Index;
Port_Cfg : in Port_Config;
PLL_Hint : in Word32;
Success : out Boolean)
is
LEVEL : Word32;
FREQ : Word32;
begin
pragma Debug (Debug.Put_Line (GNAT.Source_Info.Enclosing_Entity));
if Port_Cfg.Port in Digital_Port then
DDI.Post_On (Port_Cfg);
FREQ := 100000;
-- ka set PWM frequency to 192Hz
LEVEL := 90000;
-- ka set PWM duty level to 90%
Panel.Set_Backlight (Port_Cfg.Panel, FREQ, LEVEL); -- ka call
function to set PWM frequency and duty level
Panel.Backlight_On (Port_Cfg.Panel);
Success := True;
else
Success := False; -- Should not happen
end if;
end Post_On;
This works fine for me.
But your latest patch seems to do this also.
But I need an example how to configure this in the devicetree to understand the
function.
Kind regards,
Wolfgang
-----Ursprüngliche Nachricht-----
Von: Nico Huber [mailto:[email protected]]
Gesendet: Freitag, 24. April 2020 21:47
An: Wolfgang Kamp - datakamp <[email protected]>; [email protected]
Betreff: Re: [coreboot] libgfxinit: Panel Backlight with Apollo Lake (Broxton)
Hello Wolfgang,
On 21.04.20 16:50, Wolfgang Kamp - datakamp wrote:
> I found out that the panel backlight enable function in libgfxinit for
> Broxton platform (Intel x5-E3940) will not work for me.
> The Backlight Enabling Sequence Description in the Intel document Doc Ref #
> IHD-OS-BXT-Vol 7-05.17 says:
> 1. Set frequency and duty cycle in BLC_PWM_FREQ Frequency and BLC_PWM_DUTY
> Duty Cycle.
> 2. Enable PWM output and set polarity in BLC_PWM_CTL PWM Enable and PWM
> Polarity.
> It is also necessary to set Bit 2 in the PP_CONTROL register to "1" to enable
> Backlight Power.
did you confirm this additional step by testing? I have only tested one board
so far. It uses the second set of panel registers and I can control the PWM
output just fine _without_ touching PP_CONTROL.
>
> In "hw-gfx-gma-panel.adb" in the function Backlight_On only
> BXT_BLC_PWM_CTL_ENABLE will be set and PP_CONTROL setting is excluded through
> the If statement.
> Also I can't find any call of the Set_Backlight function and I'm missing the
> setting of the PWM frequency divider in this function. Most panels will work
> with 200Hz PWM.
`libgfxinit` is not designed as firmware and expects that board/panel specific
settings are already performed by the firmware. I have just pushed a patch [1]
to add the missing configuration in coreboot. It needs to be configured in the
devicetree.
Hope that helps,
Nico
[1] https://review.coreboot.org/c/coreboot/+/40694
_______________________________________________
coreboot mailing list -- [email protected]
To unsubscribe send an email to [email protected]