diff options
author | Evgeny Zinoviev <me@ch1p.com> | 2018-08-30 02:18:48 +0300 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-09-05 10:04:20 +0000 |
commit | 384e9aed8c477922c960e2cbd429bd3a15b371de (patch) | |
tree | fd46db5b106df1a26c6e6fd5e93d1e1569924733 /src/drivers/lenovo/hybrid_graphics | |
parent | ce1af8b0bf8569ad2d0ebc7bc7b0babe1579c7f2 (diff) |
mb/lenovo: Support dual graphics for xx20/xx30 ThinkPads
Add CMOS option that allows to use both integrated and discrete GPU.
Tested on ThinkPad W530.
Change-Id: I8842fef0fa1235eb91abf6b7e655ed4d8598adc7
Signed-off-by: Evgeny Zinoviev <me@ch1p.com>
Reviewed-on: https://review.coreboot.org/28393
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/lenovo/hybrid_graphics')
-rw-r--r-- | src/drivers/lenovo/hybrid_graphics/romstage.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/drivers/lenovo/hybrid_graphics/romstage.c b/src/drivers/lenovo/hybrid_graphics/romstage.c index 8814916872..35cb384301 100644 --- a/src/drivers/lenovo/hybrid_graphics/romstage.c +++ b/src/drivers/lenovo/hybrid_graphics/romstage.c @@ -20,7 +20,6 @@ #include <southbridge/intel/common/gpio.h> #include <ec/lenovo/pmh7/pmh7.h> #include <console/console.h> -#include <delay.h> #include "hybrid_graphics.h" #include "chip.h" @@ -87,18 +86,9 @@ void early_hybrid_graphics(bool *enable_igd, bool *enable_peg) set_gpio(config->dgpu_power_gpio, config->dgpu_power_off_lvl); } else if (config->has_thinker1) { - const size_t power_en = !!(pmh7_register_read(0x50) & 0x08); - if (*enable_peg && !power_en) { - pmh7_register_clear_bit(0x50, 7); // DGPU_RST - pmh7_register_set_bit(0x50, 3); // DGPU_PWR - mdelay(10); - pmh7_register_set_bit(0x50, 7); // DGPU_RST - mdelay(50); - } else if (!*enable_peg && power_en) { - pmh7_register_clear_bit(0x50, 7); // DGPU_RST - udelay(100); - pmh7_register_clear_bit(0x50, 3); // DGPU_PWR - } + bool power_en = pmh7_dgpu_power_state(); + if (*enable_peg != power_en) + pmh7_dgpu_power_enable(!power_en); } else { printk(BIOS_ERR, "Hybrid graphics:" " FIXME: dGPU power handling not implemented\n"); |