From 384e9aed8c477922c960e2cbd429bd3a15b371de Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 30 Aug 2018 02:18:48 +0300 Subject: 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 Reviewed-on: https://review.coreboot.org/28393 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) --- src/mainboard/lenovo/t430s/cmos.default | 1 + src/mainboard/lenovo/t430s/cmos.layout | 3 ++- src/mainboard/lenovo/t430s/romstage.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src/mainboard/lenovo/t430s') diff --git a/src/mainboard/lenovo/t430s/cmos.default b/src/mainboard/lenovo/t430s/cmos.default index 979f132863..3e1f130ce4 100644 --- a/src/mainboard/lenovo/t430s/cmos.default +++ b/src/mainboard/lenovo/t430s/cmos.default @@ -13,4 +13,5 @@ fn_ctrl_swap=Disable sticky_fn=Disable trackpoint=Enable backlight=Both +enable_dual_graphics=Disable usb_always_on=Disable diff --git a/src/mainboard/lenovo/t430s/cmos.layout b/src/mainboard/lenovo/t430s/cmos.layout index 538e624350..97d97ed349 100644 --- a/src/mainboard/lenovo/t430s/cmos.layout +++ b/src/mainboard/lenovo/t430s/cmos.layout @@ -76,7 +76,8 @@ entries # coreboot config options: northbridge 432 3 e 11 gfx_uma_size -#435 5 r 0 unused +435 1 e 1 enable_dual_graphics +#436 4 r 0 unused 440 8 h 0 volume # SandyBridge MRC Scrambler Seed values diff --git a/src/mainboard/lenovo/t430s/romstage.c b/src/mainboard/lenovo/t430s/romstage.c index 3f6d9f2836..633ba3f142 100644 --- a/src/mainboard/lenovo/t430s/romstage.c +++ b/src/mainboard/lenovo/t430s/romstage.c @@ -15,12 +15,14 @@ * GNU General Public License for more details. */ +#include #include #include #include #include #include #include +#include void pch_enable_lpc(void) { @@ -64,6 +66,22 @@ void mainboard_get_spd(spd_raw_data *spd, bool id_only) { } void mainboard_early_init(int s3resume) { + u8 enable_peg; + if (get_option(&enable_peg, "enable_dual_graphics") != CB_SUCCESS) + enable_peg = 0; + + bool power_en = pmh7_dgpu_power_state(); + + if (enable_peg != power_en) + pmh7_dgpu_power_enable(!power_en); + + if (!enable_peg) { + // Hide disabled dGPU device + u32 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN); + reg32 &= ~DEVEN_PEG10; + + pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32); + } } void mainboard_config_superio(void) -- cgit v1.2.3