Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp76087pxh; Tue, 9 Nov 2021 07:33:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG1hWWM7Qoz3/NVw2wVlhJnyUaCIrMmPPg0yBnOj4BJomTvU5mcY/sgZFPqzPKEkbvefx9 X-Received: by 2002:a5e:d602:: with SMTP id w2mr5561323iom.121.1636471998520; Tue, 09 Nov 2021 07:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636471998; cv=none; d=google.com; s=arc-20160816; b=YmAuRMJfZbdRXwdhywxLZz5uBvR8+MYkZyVWQkeuHwyvTXtLZXOwIeRPmWJyejdajO JubPrLUsrozmjrOs1JQHUozYl6TZUf1nm3TbPObLPE8Bd1NpIHqtkgebKqSyEdjpbTsc wko6OWAj/Dt4vwuHNbPCQbbHoNrF99qZzlr9EQHYyPK15oWsbZCaCft9DCHPCtsocdVo vYybKd2x4tTyCxk5Uvdvz54eOGbmW+IBKxC07wZgeE1VFg4cZk8yYIzvPYefGduwREm2 k2QQYFRsxcaAvoEyq1gtep8OLL1WH58Audg5wWG+C77NuZR9KxkUC6ruvPrilC/VUu5V VZpw== 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 :dkim-signature:dkim-signature; bh=ehBF5Wy69Bh/kZkJ7uMIKe19bB8uwhbi/yToEkQuFGM=; b=AmiTUxzJFK30GghQ95he2Ude2jYI0eVe3+iJkVuoZq4nNAOudibUDr9KZm4HBYNKDm VhM7/DDQecUYJA+jjd0JSSoccUOfie+z1hTwzdrFfb/jTIe5j0Sgb0t63bVkRgJG18Jo CQZtDkQjv32kng7w6xJUaSPl6vZQYk2l32J9FGAcU28XGUt3KO63UcVdZPrYh8tuEWAU 4K1rEls0CepRN2hRTo8yGz7lrxc6f9XGzjahUjciD7xbBl2pQUYOSBzQkmCIkyEww7ZA lh/7pTTCsikeaxEG2NF9YdNY4xdVz+fFqukHOdIx/Maf9r4hVveNcf7YUF1OueyPntFu sD4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nakato.io header.s=fm2 header.b=EpINqzgd; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=HLCkzNR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si39665695ilv.53.2021.11.09.07.33.02; Tue, 09 Nov 2021 07:33:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nakato.io header.s=fm2 header.b=EpINqzgd; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=HLCkzNR6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243959AbhKIIO0 (ORCPT + 99 others); Tue, 9 Nov 2021 03:14:26 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52815 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235389AbhKIIOZ (ORCPT ); Tue, 9 Nov 2021 03:14:25 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A071A5C01FE; Tue, 9 Nov 2021 03:11:39 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 09 Nov 2021 03:11:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nakato.io; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ehBF5Wy69Bh/k ZkJ7uMIKe19bB8uwhbi/yToEkQuFGM=; b=EpINqzgd9hrt+Ss+BZ5cHFTjQISNo djS56qf80j18n50zDKGEVSQ8B4RctOiAGMB/bjmxTvafxxZoQkI9BDGE0zrToHZ4 4zftXLfhrvE8njxmJL7oi1oE5uEzdeEEfF+TsJbF+w/kgwwKKerw/caJjwk0YHwK vrPkfcvfelAPcEIiEg1W/DpCgL7NMKf1JU8H0EE7/2xpolcwedP0/yT5DozV9ovM vzH9dgiXtFq8kDGzA9qveM8pZjr2M3OtNK5XnIaI0b3XfALLAp/i3reS2bMkqNag KYvA62hvI1yTJWRlZ/mrTgrNwX4kO5aUaPvsnw1MYQQ/EgfQtCJieTsQg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ehBF5Wy69Bh/kZkJ7uMIKe19bB8uwhbi/yToEkQuFGM=; b=HLCkzNR6 06opqwLsHnbYCSod2Ccg2uuXBi5glOZAgC9l1MDChXvEcYe/Z1RCn5fd8VVbXbsv Sh8pLqUbF4nmhJK0xmxk+fTV37QOERaiTPkhYT64/NQS3QNwLnznbOPrh+seQCoC 2cwxPE9CF19dMqA7YIgKE6qb/grJKnBssWUv0YAVc4sLlG4QIU4lWSWJie5DiXGg PH6+UhwxVvDJHh/NX+gp16bfBsQYUHBuje+9RfiedyEViZU/f7As+0Uf8jjp2J+U lYw/vgPRctv7jTwKs9n3jpTDNaTsndvlu1km+laC/xCVjNDgzyxiIayUyQwQ7ilw KAT/QxwTloLS0A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudefgdduudduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurggthhhi ucfmihhnghcuoehnrghkrghtohesnhgrkhgrthhordhioheqnecuggftrfgrthhtvghrnh epudeftefhteegkedtuedvteeihfetffduudeludekkedthfdtfeduieehjefghffhnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepnhgrkhgrth hosehnrghkrghtohdrihho X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Nov 2021 03:11:35 -0500 (EST) From: Sachi King To: Chen Yu , Hans de Goede , Mark Gross , Maximilian Luz , Dmitry Torokhov , Andy Shevchenko Cc: Sachi King , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] platform/surface: surfacepro3_button: don't load on amd variant Date: Tue, 9 Nov 2021 19:11:25 +1100 Message-Id: <20211109081125.41410-2-nakato@nakato.io> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211109081125.41410-1-nakato@nakato.io> References: <20211109081125.41410-1-nakato@nakato.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The AMD variant of the Surface Laptop report 0 for their OEM platform revision. The Surface devices that require the surfacepro3_button driver do not have the _DSM that gets the OEM platform revision. If the method does not exist, load surfacepro3_button. Fixes: 64dd243d7356 ("platform/x86: surfacepro3_button: Fix device check") Co-developed-by: Maximilian Luz Signed-off-by: Maximilian Luz Signed-off-by: Sachi King --- drivers/platform/surface/surfacepro3_button.c | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c index 242fb690dcaf..30eea54dbb47 100644 --- a/drivers/platform/surface/surfacepro3_button.c +++ b/drivers/platform/surface/surfacepro3_button.c @@ -149,7 +149,8 @@ static int surface_button_resume(struct device *dev) /* * Surface Pro 4 and Surface Book 2 / Surface Pro 2017 use the same device * ID (MSHW0040) for the power/volume buttons. Make sure this is the right - * device by checking for the _DSM method and OEM Platform Revision. + * device by checking for the _DSM method and OEM Platform Revision DSM + * function. * * Returns true if the driver should bind to this device, i.e. the device is * either MSWH0028 (Pro 3) or MSHW0040 on a Pro 4 or Book 1. @@ -157,30 +158,11 @@ static int surface_button_resume(struct device *dev) static bool surface_button_check_MSHW0040(struct acpi_device *dev) { acpi_handle handle = dev->handle; - union acpi_object *result; - u64 oem_platform_rev = 0; // valid revisions are nonzero - - // get OEM platform revision - result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID, - MSHW0040_DSM_REVISION, - MSHW0040_DSM_GET_OMPR, - NULL, ACPI_TYPE_INTEGER); - - /* - * If evaluating the _DSM fails, the method is not present. This means - * that we have either MSHW0028 or MSHW0040 on Pro 4 or Book 1, so we - * should use this driver. We use revision 0 indicating it is - * unavailable. - */ - - if (result) { - oem_platform_rev = result->integer.value; - ACPI_FREE(result); - } - - dev_dbg(&dev->dev, "OEM Platform Revision %llu\n", oem_platform_rev); - return oem_platform_rev == 0; + // make sure that OEM platform revision DSM call does not exist + return !acpi_check_dsm(handle, &MSHW0040_DSM_UUID, + MSHW0040_DSM_REVISION, + BIT(MSHW0040_DSM_GET_OMPR)); } -- 2.33.0