Evgeny Zinoviev has uploaded this change for review. ( https://review.coreboot.org/28393
Change subject: mb/lenovo: Dual Graphics for xx20/xx30 ThinkPads ......................................................................
mb/lenovo: Dual Graphics for xx20/xx30 ThinkPads
Add CMOS option that allows to use both integrated and discrete GPU.
Change-Id: I8842fef0fa1235eb91abf6b7e655ed4d8598adc7 Signed-off-by: Evgeny Zinoviev me@ch1p.com --- M src/mainboard/lenovo/t420/cmos.layout M src/mainboard/lenovo/t420/romstage.c M src/mainboard/lenovo/t420s/cmos.layout M src/mainboard/lenovo/t420s/romstage.c M src/mainboard/lenovo/t430/cmos.layout M src/mainboard/lenovo/t430/romstage.c M src/mainboard/lenovo/t430s/cmos.default M src/mainboard/lenovo/t430s/cmos.layout M src/mainboard/lenovo/t430s/romstage.c M src/mainboard/lenovo/t520/romstage.c M src/mainboard/lenovo/t530/cmos.layout M src/mainboard/lenovo/t530/romstage.c 12 files changed, 39 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/28393/1
diff --git a/src/mainboard/lenovo/t420/cmos.layout b/src/mainboard/lenovo/t420/cmos.layout index 5a9e570..f55c203 100644 --- a/src/mainboard/lenovo/t420/cmos.layout +++ b/src/mainboard/lenovo/t420/cmos.layout @@ -129,6 +129,7 @@ 11 6 224M 12 0 Integrated Only 12 1 Discrete Only +12 2 Dual Graphics 13 0 Disable 13 1 AC and battery 13 2 AC only diff --git a/src/mainboard/lenovo/t420/romstage.c b/src/mainboard/lenovo/t420/romstage.c index 36e83a3..bef2562 100644 --- a/src/mainboard/lenovo/t420/romstage.c +++ b/src/mainboard/lenovo/t420/romstage.c @@ -30,6 +30,9 @@
early_hybrid_graphics(&igd, &peg);
+ if (peg && igd) + return; + /* Hide disabled devices */ reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); diff --git a/src/mainboard/lenovo/t420s/cmos.layout b/src/mainboard/lenovo/t420s/cmos.layout index f395c0c..2be55f6 100644 --- a/src/mainboard/lenovo/t420s/cmos.layout +++ b/src/mainboard/lenovo/t420s/cmos.layout @@ -129,6 +129,7 @@ 11 6 224M 12 0 Integrated Only 12 1 Discrete Only +12 2 Dual Graphics 13 0 Disable 13 1 AC and battery 13 2 AC only diff --git a/src/mainboard/lenovo/t420s/romstage.c b/src/mainboard/lenovo/t420s/romstage.c index 55011cf2..be8052c 100644 --- a/src/mainboard/lenovo/t420s/romstage.c +++ b/src/mainboard/lenovo/t420s/romstage.c @@ -32,6 +32,9 @@
early_hybrid_graphics(&igd, &peg);
+ if (peg && igd) + return; + /* Hide disabled devices */ reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); diff --git a/src/mainboard/lenovo/t430/cmos.layout b/src/mainboard/lenovo/t430/cmos.layout index 2b687c2..1b50e7f 100644 --- a/src/mainboard/lenovo/t430/cmos.layout +++ b/src/mainboard/lenovo/t430/cmos.layout @@ -128,6 +128,7 @@ 11 6 224M 12 0 Integrated Only 12 1 Discrete Only +12 2 Dual Graphics 13 0 Disable 13 1 AC and battery 13 2 AC only diff --git a/src/mainboard/lenovo/t430/romstage.c b/src/mainboard/lenovo/t430/romstage.c index 94679df..90d0886 100644 --- a/src/mainboard/lenovo/t430/romstage.c +++ b/src/mainboard/lenovo/t430/romstage.c @@ -30,6 +30,9 @@
early_hybrid_graphics(&igd, &peg);
+ if (peg && igd) + return; + /* Hide disabled devices */ reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); diff --git a/src/mainboard/lenovo/t430s/cmos.default b/src/mainboard/lenovo/t430s/cmos.default index 979f132..6e61dae 100644 --- a/src/mainboard/lenovo/t430s/cmos.default +++ b/src/mainboard/lenovo/t430s/cmos.default @@ -13,4 +13,5 @@ sticky_fn=Disable trackpoint=Enable backlight=Both +hybrid_graphics_mode=Integrated Only usb_always_on=Disable diff --git a/src/mainboard/lenovo/t430s/cmos.layout b/src/mainboard/lenovo/t430s/cmos.layout index 538e624..eac168f 100644 --- a/src/mainboard/lenovo/t430s/cmos.layout +++ b/src/mainboard/lenovo/t430s/cmos.layout @@ -76,7 +76,8 @@
# coreboot config options: northbridge 432 3 e 11 gfx_uma_size -#435 5 r 0 unused +435 2 e 13 hybrid_graphics_mode +#437 3 r 0 unused 440 8 h 0 volume
# SandyBridge MRC Scrambler Seed values @@ -128,6 +129,8 @@ 12 0 Disable 12 1 AC and battery 12 2 AC only +13 0 Integrated Only +13 2 Dual Graphics
# ----------------------------------------------------------------- checksums diff --git a/src/mainboard/lenovo/t430s/romstage.c b/src/mainboard/lenovo/t430s/romstage.c index 3f6d9f2..de9e944 100644 --- a/src/mainboard/lenovo/t430s/romstage.c +++ b/src/mainboard/lenovo/t430s/romstage.c @@ -15,12 +15,16 @@ * GNU General Public License for more details. */
+#include <option.h> +#include <delay.h> #include <arch/byteorder.h> #include <arch/io.h> #include <device/pci_def.h> #include <console/console.h> #include <northbridge/intel/sandybridge/raminit_native.h> #include <southbridge/intel/bd82x6x/pch.h> +#include <drivers/lenovo/hybrid_graphics/chip.h> +#include <ec/lenovo/pmh7/pmh7.h>
void pch_enable_lpc(void) { @@ -64,6 +68,17 @@ }
void mainboard_early_init(int s3resume) { + enum hybrid_graphics_req mode = HYBRID_GRAPHICS_INTEGRATED; + get_option(&mode, "hybrid_graphics_mode"); + + if (mode == HYBRID_GRAPHICS_INTEGRATED) { + const size_t power_en = !!(pmh7_register_read(0x50) & 0x08); + if (power_en) { + pmh7_register_clear_bit(0x50, 7); // DGPU_RST + udelay(100); + pmh7_register_clear_bit(0x50, 3); // DGPU_PWR + } + } }
void mainboard_config_superio(void) diff --git a/src/mainboard/lenovo/t520/romstage.c b/src/mainboard/lenovo/t520/romstage.c index 328ae37..4fcd651 100644 --- a/src/mainboard/lenovo/t520/romstage.c +++ b/src/mainboard/lenovo/t520/romstage.c @@ -42,6 +42,9 @@
early_hybrid_graphics(&igd, &peg);
+ if (peg && igd) + return; + /* Hide disabled devices */ reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD); diff --git a/src/mainboard/lenovo/t530/cmos.layout b/src/mainboard/lenovo/t530/cmos.layout index 9a099f5..3400a4d 100644 --- a/src/mainboard/lenovo/t530/cmos.layout +++ b/src/mainboard/lenovo/t530/cmos.layout @@ -129,6 +129,7 @@ 11 6 224M 12 0 Integrated Only 12 1 Discrete Only +12 2 Dual Graphics 13 0 Disable 13 1 AC and battery 13 2 AC only diff --git a/src/mainboard/lenovo/t530/romstage.c b/src/mainboard/lenovo/t530/romstage.c index ba7a229..88e07c1 100644 --- a/src/mainboard/lenovo/t530/romstage.c +++ b/src/mainboard/lenovo/t530/romstage.c @@ -34,6 +34,9 @@
early_hybrid_graphics(&igd, &peg);
+ if (peg && igd) + return; + /* Hide disabled devices */ reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);