Message ID | 20230630053552.976579-6-luke@ljones.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10128742vqr; Thu, 29 Jun 2023 22:58:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyZKX+63nnBP9kSZBZTGp1vbCP3e0AjZQGYTglUpBMy2y8SPN239rgzKtwqncbdGie5QIX X-Received: by 2002:a17:902:e485:b0:1b8:2a4d:3e91 with SMTP id i5-20020a170902e48500b001b82a4d3e91mr1289938ple.6.1688104691548; Thu, 29 Jun 2023 22:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688104691; cv=none; d=google.com; s=arc-20160816; b=pORI6c5+Ir7tyHvgmBS73d5SZJQW2PPBqiNu/RleeDqZsVwY3ZWZH5ju644NQjtJu+ QwMfsEFw9rAPqZgnQmoR+1Ey7uxeQe04+zllM5cfL/YD15oLMVdAWW0QMbCv6rxDGUdE MBU5iX2lu6BFYgO9g95XGdEReYgMQaGhDgObVAACKbJkrIQ331PrGSVtcURA2V1NXoJq gAdZJG+GBQdLx/YVMU02TH9IF4Cly6S0MZNpB2PmHixjACCxIjQivA/b1riiVGsavkKJ 4sG+X3LatYetm1TsX+Kj0WapFr/mQfll0xT0iBD1ryjrpnnh108y9liEe8aIpmfKUTZP gAeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=WjHn4wz/GuX8KDH05sd8J20E91CWXekfUEtps2Qbx48=; fh=52RqnqzHFu3c3gS8VqgRtcRPBRgGlf5eGe8HkjfR8FI=; b=uwVJB2KWUHlTLw422RKZwX6hRpMioJFJPu3cryp0PA6c6lE01G06augUzWVLhgIix8 Ok9GRL7HXqxI597/p6xCMZO1mw4WpZTInvywewDXkPLGtpW5OT86o6nETga9bcnexqS0 fcMWPZQQbkNWOd3akpB6el5zdlbuU011QRfzcmxF2i27QcBLcNiAdRbujbcmUbkxCjQW oIO+wgKzOdKuzrHSfkcvF1zHm1fbGWJJH755XX2kQcydaeHkbHXiq4xypAv4ftSAIJMG xP+/NpQPTMZICM02t/C3VP+E37TIJ5nCMz60usI+MU+Ld8cPKJmBRjM4x9dpvYU0Dqqr 52ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=JWcUCCIS; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="T/9pJ2v0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a1709029a4600b001b84335fb90si3424599plv.286.2023.06.29.22.57.56; Thu, 29 Jun 2023 22:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=JWcUCCIS; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="T/9pJ2v0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbjF3Fgd (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Fri, 30 Jun 2023 01:36:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjF3Fga (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 30 Jun 2023 01:36:30 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C213583; Thu, 29 Jun 2023 22:36:28 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 67DF5320098A; Fri, 30 Jun 2023 01:36:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 30 Jun 2023 01:36:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1688103386; x= 1688189786; bh=WjHn4wz/GuX8KDH05sd8J20E91CWXekfUEtps2Qbx48=; b=J WcUCCIS5J1t+gZGsr2ijLzP0SE/Exlm/L9hnHVeD+lpMJjIDpMP36/ELGeAImXYY 8Xy/MAm4lSa+NXn2k57vrGiwj7I+Z8EXPfHJhSsOVZ6NtcDjxQSq+pjxQQ2Sitaj EcNVp0t2jETclke54KJyoBTLLF0sfrol5fBznisK4j1Pw6DVxRMzYknSYu9QOhOZ k1lfdXQlTbsrqHiZt/c2VVWlhCiOK6SbRCuWwAQ4F5ipFDHH2DJ1YbtMfhnlt9Bg J965T3RR+MGQMj8F3QtrgTMIwjtumXeaCdX0SW8cfeMSm1rc2RdiGtBu3jFVBFqv aNgoMJh1zmqMeg90SFohA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1688103386; x= 1688189786; bh=WjHn4wz/GuX8KDH05sd8J20E91CWXekfUEtps2Qbx48=; b=T /9pJ2v0xHan1XGn0MGoCVzFYRYv/6RoZH5atx2uJaXx0HI1vFYqTZI7pwf9a5fQF rciaZc/j5OqoTXK+OalOF1f5CEmzuiJkBOiNTH9NfIKOjL4sUaJDrooiBHD0iJIX JTRP28R8trl/69ZjrlOA1wI69afU8tipxVlduexTpWi6mP6z89ufMGcC5hD4tlP2 83Vk9mhYaxov/SMVdWR4wjhm5mLv2O8/HRYV6/qacM0rn0+M627fvfYk/7aNOSy2 5Kpjlf975vVSAB+JB5iOELsA59iuLl/ypxZywuJVOw/HNYSIsn2DBapd8Tw/LdTm +KvQZd1Oquh/t/QyEmCmw== X-ME-Sender: <xms:2mmeZNdVtKJt5mdl8E_ehNbX80AXL48YCHOEK7m81T0vJo4R_7ffRw> <xme:2mmeZLPSESiryARhSikoX151B7IGaWf1e-hgqRJBED9_c6ROaAyWqfdAyKdqFZudP Ox1boU-G880LdVnxhM> X-ME-Received: <xmr:2mmeZGjgR4GFbuU8SKg7a_P8jOC27Fotxn75Nua8MngP_pQxYVcRiW2rsPSG> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtdehgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgepvden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: <xmx:2mmeZG9o-_PedS8WzKcYYF2hPl0361FrtV9fzGQFyHNz3SuYb6T8yg> <xmx:2mmeZJv1doaW89utdZA6U8eVs29ULzs9DvWGkyxiyn3hXH-eKhIwWQ> <xmx:2mmeZFFxGndGRCo77I0UDLp5VerepOD7NGIy50uoWKmnTC2yuFH6wA> <xmx:2mmeZK9vsdu6afrQ-EGGewqwQkivxoWC56hT9HkecbEB-CM2Qevotw> Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 30 Jun 2023 01:36:23 -0400 (EDT) From: "Luke D. Jones" <luke@ljones.dev> To: hdegoede@redhat.com Cc: corentin.chary@gmail.com, acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, markgross@kernel.org, jdelvare@suse.com, linux@roeck-us.net, "Luke D. Jones" <luke@ljones.dev> Subject: [PATCH v2 5/8] platform/x86: asus-wmi: don't allow eGPU switching if eGPU not connected Date: Fri, 30 Jun 2023 17:35:49 +1200 Message-ID: <20230630053552.976579-6-luke@ljones.dev> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230630053552.976579-1-luke@ljones.dev> References: <20230630053552.976579-1-luke@ljones.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770106065157250672?= X-GMAIL-MSGID: =?utf-8?q?1770106065157250672?= |
Series |
platform/x86: asus-wmi:
|
|
Commit Message
Luke Jones
June 30, 2023, 5:35 a.m. UTC
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>
---
drivers/platform/x86/asus-wmi.c | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
Hi, On 6/30/23 07:35, Luke D. Jones wrote: > 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> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > drivers/platform/x86/asus-wmi.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > 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);
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);