Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21788963rwd; Thu, 29 Jun 2023 23:02:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlHG8Ia5hEswUxzpqXaXPJ5RQfBMdQmmfZ1RfadrjR64Pps73GWebesI6TfG3i8YO+dm373u X-Received: by 2002:a05:6a21:6da4:b0:121:e573:3680 with SMTP id wl36-20020a056a216da400b00121e5733680mr1847525pzb.62.1688104943955; Thu, 29 Jun 2023 23:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688104943; cv=none; d=google.com; s=arc-20160816; b=ZjQe6DR/9IQjbAMLToIrMGpBoPeK8dQPdlmFKibNvvwb6/cEjB1drbpAzILCqQpaxW 97+Nvx9og06ZavLGzWDjptra8VZUvpyTCBegcqCIeyMIUKxy2oHenpcFHIyWid5CzhBu OhfpsVLuIs4X1OL3pQMZYo+n0w+bZ+alGFdy+YMOXwxA1Zoc0DV2/20hkU3p9qrYykvE V2MWLGLMiMVTSLYIjCpNIuKYl8iDmTTcSLgdFw3pMiPojD45B4M7mheC2KDCzgZsitD6 HRthmC02NIYjpHudw/DspdtrTwGhlJM5EhoN3aftdiuEByJ2PQTi2vwvVi9x1lPbnBPG yevA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a634c11000000b0055384255b9bsi10891301pga.24.2023.06.29.23.02.09; Thu, 29 Jun 2023 23:02:23 -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 S232235AbjF3Fgd (ORCPT + 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 ); 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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrtdehgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpedfnfhukhgvucffrdculfhonhgvshdfuceolhhukhgvsehl jhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgfetfedugfetudeuheetjefhue fggfelleetvdevtefhueeujeefvdegleevhefgnecuvehluhhsthgvrhfuihiivgepvden ucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljhhonhgvshdruggvvh X-ME-Proxy: 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" 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" 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 2.41.0