[coreboot] New patch to review for coreboot: 48d5cfa Lenovo ThinkPad X60: try(and fails) to turn the screen brightness on.

Denis Carikli (GNUtoo@no-log.org) gerrit at coreboot.org
Thu Feb 28 19:31:31 CET 2013


Denis Carikli (GNUtoo at no-log.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2559

-gerrit

commit 48d5cfafa914d2a93860388b2b451dda3ac12ba6
Author: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
Date:   Thu Feb 28 16:23:57 2013 +0100

    Lenovo ThinkPad X60: try(and fails) to turn the screen brightness on.
    
    The code has been taken from the result of i915tool and converted.
    
    It works when used as a SeaBIOS generated option rom but fails here.
    
    Change-Id: I45edd59e7beee1308a374075c06aa521f7eda6a5
    Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at no-log.org>
---
 src/mainboard/lenovo/x60/i915.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/mainboard/lenovo/x60/i915.c b/src/mainboard/lenovo/x60/i915.c
index 420a9fe..1e0a079 100644
--- a/src/mainboard/lenovo/x60/i915.c
+++ b/src/mainboard/lenovo/x60/i915.c
@@ -42,11 +42,16 @@
 #include <cpu/amd/mtrr.h>
 #include <cpu/x86/msr.h>
 #include "i915io.h"
+#include "i915_reg.h"
 
 enum {
 	vmsg = 1, vio = 2, vspin = 4,
 };
 
+
+#define BACKLIGHT_REFCLK_DIVISOR     128
+#define DEFAULT_BACKLIGHT_PWM_FREQ   200
+
 static int verbose = 0;
 
 static unsigned int *mmio;
@@ -72,6 +77,27 @@ static void io_i915_WRITE32(unsigned long val, unsigned long addr)
        outl(addr, addrport);
        outl(val, dataport);
 }
+u32 get_default_max_backlight(void);
+u32 get_default_max_backlight(void)
+{
+    u32 refclk_freq_mhz = 100; //hardcoded for gen3;
+    u32 max_pwm = refclk_freq_mhz * 1000000 /
+                        (BACKLIGHT_REFCLK_DIVISOR * DEFAULT_BACKLIGHT_PWM_FREQ);
+    return max_pwm;
+}
+
+void intel_panel_actually_set_backlight(unsigned long bar, u32 level);
+void intel_panel_actually_set_backlight(unsigned long bar, u32 level)
+{
+    /* hardcoded for gen3 */
+    u32 tmp;
+    printk(BIOS_SPEW, "[vga:%s], ", __func__);
+    printk(BIOS_SPEW, "set backlight PWM = %d\n", level);
+    tmp = io_i915_READ32(bar + BLC_PWM_CTL);
+    level <<= 1;
+    tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+    io_i915_WRITE32(bar + BLC_PWM_CTL, tmp | level);
+}
 
 
 /*
@@ -251,6 +277,8 @@ int i915lightup(unsigned int pphysbase,
 				(void *)graphics, 8192*1024);
 	memset((void *)graphics, 0xff, 8192*1024);
 
+	intel_panel_actually_set_backlight((unsigned long)mmio, get_default_max_backlight());
+
 	printk(BIOS_SPEW, "%ld microseconds\n", globalmicroseconds());
 	i915_init_done = 1;
 	oprom_is_loaded = 1;



More information about the coreboot mailing list