Skip to content

Commit

Permalink
platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luke D. Jones authored and Hans de Goede committed Jul 12, 2023
1 parent d4eca58 commit d49f4d1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/platform/x86/asus-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d49f4d1

Please sign in to comment.