summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2017-11-04 20:13:22 +0100
committerMartin Roth <martinroth@google.com>2017-12-20 16:52:06 +0000
commite07e39098aaac1c0be80bae6447b04de530da949 (patch)
treee4eabc60cc1b997aeae2ab9c5972f561d13a56e3 /src
parent35325e1688a74756c90bd5e30ef6f07f0172e85f (diff)
drvs/lenovo/hybrid_graphics/romstage: Fix dGPU activation
While the older boards use a GPIO that has no state, the newer boards' PMH7 does have a state, that even remains after reboot. Don't assume default values in PMH7 and instead always program it. Fixes dGPU doesn't show up when switching from integrated to discrete GPU. The workaround of removing all power is no longer necessary. Change-Id: I30ec19e13269cb254e51ad1fab3b10ad1a49e86e Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/22341 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/lenovo/hybrid_graphics/romstage.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/drivers/lenovo/hybrid_graphics/romstage.c b/src/drivers/lenovo/hybrid_graphics/romstage.c
index 9009c5841a..8814916872 100644
--- a/src/drivers/lenovo/hybrid_graphics/romstage.c
+++ b/src/drivers/lenovo/hybrid_graphics/romstage.c
@@ -76,20 +76,31 @@ void early_hybrid_graphics(bool *enable_igd, bool *enable_peg)
}
/*
- * Need to do power handling here as we know there's a dGPU to
- * turn off. Support GPIO and Thinker1.
+ * Need to do power handling here as we know there's a dGPU.
+ * Support GPIO and Thinker1.
*/
- if (!*enable_peg) {
- if (config->has_dgpu_power_gpio) {
+ if (config->has_dgpu_power_gpio) {
+ if (*enable_peg)
+ set_gpio(config->dgpu_power_gpio,
+ !config->dgpu_power_off_lvl);
+ else
set_gpio(config->dgpu_power_gpio,
config->dgpu_power_off_lvl);
- } else if (config->has_thinker1) {
+ } 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
- } else {
- printk(BIOS_ERR, "Hybrid graphics:"
- " FIXME: dGPU power not disabled !\n");
}
+ } else {
+ printk(BIOS_ERR, "Hybrid graphics:"
+ " FIXME: dGPU power handling not implemented\n");
}
}