diff options
author | Luke D. Jones <luke@ljones.dev> | 2023-06-30 07:35:49 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-07-12 17:01:51 +0200 |
commit | d49f4d1a30ac656e65f3fc3609893256da0b9a31 (patch) | |
tree | b5e667f5752c6ce1ee89918bb9d4fd556dc7e931 /drivers/platform/x86/asus-wmi.c | |
parent | platform/x86: asus-wmi: add WMI method to show if egpu connected (diff) | |
download | linux-d49f4d1a30ac656e65f3fc3609893256da0b9a31.tar.xz linux-d49f4d1a30ac656e65f3fc3609893256da0b9a31.zip |
platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected
Check the ASUS_WMI_DEVID_EGPU_CONNECTED method for eGPU connection
before allowing the ASUS_WMI_DEVID_EGPU method to run.
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230630053552.976579-6-luke@ljones.dev
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 0c8a4a46b121..821addb284d7 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -693,6 +693,15 @@ static ssize_t egpu_enable_store(struct device *dev, if (enable > 1) return -EINVAL; + err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); + if (err < 0) + return err; + if (err < 1) { + err = -ENODEV; + pr_warn("Failed to set egpu disable: %d\n", err); + return err; + } + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result); if (err) { pr_warn("Failed to set egpu disable: %d\n", err); |