[coreboot-gerrit] Patch set updated for coreboot: nb/gm45/gma.c: Compute BLC_PWM_CTL value from PWM frequency
Arthur Heymans (arthur@aheymans.xyz)
gerrit at coreboot.org
Mon Nov 28 13:42:11 CET 2016
Arthur Heymans (arthur at aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17597
-gerrit
commit 5450ab8cc30375d92870992f1410f0f704941841
Author: Arthur Heymans <arthur at aheymans.xyz>
Date: Thu Nov 24 13:23:05 2016 +0100
nb/gm45/gma.c: Compute BLC_PWM_CTL value from PWM frequency
This allows to set the backlight PWM frequency and the
duty cycle in the devicetree instead of using a plain BLC_PWM_CTL
value.
Change-Id: I4d9a555ac7ea5605712c1fcda994a6fcabf9acf3
Signed-off-by: Arthur Heymans <arthur at aheymans.xyz>
---
src/northbridge/intel/gm45/chip.h | 2 ++
src/northbridge/intel/gm45/gma.c | 21 +++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/northbridge/intel/gm45/chip.h b/src/northbridge/intel/gm45/chip.h
index 836d6bb..2307d53 100644
--- a/src/northbridge/intel/gm45/chip.h
+++ b/src/northbridge/intel/gm45/chip.h
@@ -26,6 +26,8 @@ struct northbridge_intel_gm45_config {
u16 gpu_panel_power_backlight_off_delay; /* Tx time sequence */
u8 gpu_panel_power_cycle_delay; /* T4 time sequence */
struct i915_gpu_controller_info gfx;
+ u32 pwm_freq;
+ u32 duty_cycle;
/*
* Maximum PCI mmio size in MiB.
diff --git a/src/northbridge/intel/gm45/gma.c b/src/northbridge/intel/gm45/gma.c
index 3e9f508..37ba4cb 100644
--- a/src/northbridge/intel/gm45/gma.c
+++ b/src/northbridge/intel/gm45/gma.c
@@ -629,6 +629,19 @@ static u32 get_cdclk(struct device *const dev)
}
}
+static u32 freq_to_blc_pwm_ctl(struct device *const dev,
+ u16 pwm_freq, u16 duty_perc)
+{
+ u32 blc_mod;
+
+ blc_mod = get_cdclk(dev) / (128 * pwm_freq);
+
+ if (duty_perc <= 100)
+ return (blc_mod << 16) | (blc_mod * duty_perc / 100);
+ else
+ return (blc_mod << 16) | blc_mod;
+}
+
static void gma_pm_init_post_vbios(struct device *const dev)
{
const struct northbridge_intel_gm45_config *const conf = dev->chip_info;
@@ -661,10 +674,14 @@ static void gma_pm_init_post_vbios(struct device *const dev)
/* Enable Backlight */
gtt_write(BLC_PWM_CTL2, (1 << 31));
- if (conf->gfx.backlight == 0)
+ reg32 = 100;
+ if (conf->duty_cycle != 0)
+ reg32 = conf->duty_cycle;
+ if (conf->pwm_freq == 0)
gtt_write(BLC_PWM_CTL, 0x06100610);
else
- gtt_write(BLC_PWM_CTL, conf->gfx.backlight);
+ gtt_write(BLC_PWM_CTL, freq_to_blc_pwm_ctl(dev,
+ conf->pwm_freq, reg32));
}
static void gma_func0_init(struct device *dev)
More information about the coreboot-gerrit
mailing list