Currently on Indexed and MMIO systems, the system can't change GPU's on runtime, as the display is not trained on the secondary GPU, to combat this, we add a module parameter to configure the boot GPU, so users can change to iGPU or dGPU via reboot.
Signed-off-by: Atharva Tiwari <[email protected]> --- drivers/platform/x86/apple-gmux.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 637b3b216..6a9580f27 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -109,6 +109,10 @@ struct apple_gmux_config { char *name; }; +static int boot_gpu = -1; +module_param(boot_gpu, int, 0); +MODULE_PARM_DESC(boot_gpu, "Configure the boot gpu (-1 = auto, 0 = iGPU, 1 = dGPU)"); + #define GMUX_INTERRUPT_ENABLE 0xff #define GMUX_INTERRUPT_DISABLE 0x00 @@ -1215,6 +1219,11 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) gmux_enable_interrupts(gmux_data, 1); gmux_read_switch_state(gmux_data); + if (boot_gpu == 0) + gmux_switchto(VGA_SWITCHEROO_IGD); + else if (boot_gpu == 1) + gmux_switchto(VGA_SWITCHEROO_DIS); + /* * Retina MacBook Pros cannot switch the panel's AUX separately * and need eDP pre-calibration. They are distinguishable from -- 2.55.0
