From patchwork Thu Nov 28 14:51:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888101 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F4EB2233A; Thu, 28 Nov 2024 14:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805487; cv=none; b=OdwrU4+1ptOCTsMESsAFSF/7xi4nHGJr41mg6NaquhXwt4uiqPy9FSDczIVWo7PJ/mX3nxl2TadHHUq0DE70TXcrVUqrOhy0Kyp53eKvDhjIBziYGFNOLQUmb1dzSwuUoYc3pb/I0a7n5Jriqc1+c6QcRY2Uu82tM51SjqNph2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805487; c=relaxed/simple; bh=bvFbxc5P++9Gag+zgAYbv6WxVb4HNe8omEWI00cWw4M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RoiQkghhzPE6NFeZrr+4dclg7Y6pcVlUy7Puh8nISxnwTBPcQt5glDr9jZr8XY9LEBKyA1EBSn6XtMCuz0XWB6rsQP9hLLMP6Nr0DbjgkNAXZT1pXk2hjA7J2S7z1PGwzp7e/IkWC54Nb1AItWagXJKPdmBMQt0vPP0Xt7Nolpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=bGJsTKGj; arc=none smtp.client-ip=212.227.15.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="bGJsTKGj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732805478; x=1733410278; i=w_armin@gmx.de; bh=LDc/EFycTFB282lPDii06kaNXf50E69nOVsxqUvjg/Y=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=bGJsTKGjmY+0kCOq+9kc5X+VxmXG5KhK/LfJ7TdHyMP94AMk+0F48LAhkJoEINum MLP6eIpGbmR+BQO0t5fxuHDpx5totaM+KdkoElin3XUNU1iBFjjH+bUktw1IZOE0n TuGL9L8RmDfyvf4UUIzvrQLSyQuhTR0zcA32r6myrrCjtOv5vITWTsLnJ849OoAyt w6h0BDJpJCKa9Jk92H8U+qzSmA922WH/6YcZ5hyyaw60tSPhoshpFsmIE8D/xWbzX zDLLr26QcttR/gXO2BbWA5LMCNKrjVsPMb+CXWTBElk6+8RPPf3md4Uc7vkejo3Gi BNwS7I5G2i3LKnMnfw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.dip.tu-dresden.de ([141.76.179.133]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MdNY2-1tpjd80Fwu-00jFSQ; Thu, 28 Nov 2024 15:51:18 +0100 From: Armin Wolf To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] platform/x86: acer-wmi: Add support for Acer PH14-51 Date: Thu, 28 Nov 2024 15:51:00 +0100 Message-Id: <20241128145104.13538-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241128145104.13538-1-W_Armin@gmx.de> References: <20241128145104.13538-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:MAxcacE9xM95uXVke8cyHuvbZxSPna3aU4UclLg9j4oOTNcc13o wfz+KxYPvPAAddj3fN6k07Vus82wTwyX+qyau8y6BnpGErqygGuuhu1N4t8RVedADUrO7wO ZmwZV5s6QWE3wH09FuI1a0sEM5rO8kq0tBXIgo2DmvOmcMaF8dFabl/zjf70IscmvEppX6N auS2oDTardU8kicnSzhEg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:rWrJipU/XM0=;QgfxeM1LDWcbTmBcjr+r0tgIGcg 108n6GSeofJHxY1R2KtwbEJ9icADtSRl62XxHHIs2G8RfDKVK1+GbPjMBtoMIVwKIfpJ+/8/4 vXhmlfYIMzIDC8NcwwdSYMcAOztYHVzsJkdciYfTAInCidfWzwryp7WYZgaG0ovmYpWN1B5Lr QhMpZ6LKok5RkHqEtvWlU40PEKc2ALUbDHGvBZfmISP5IbQaxalKWKTYzrYopRmq1ybYahGLx U8nK2tp60f7KBERcUk9QMH0aMZK8iuQ/IEySVI373JaoZybpNMrs7L+7F2ktKV4vVTxXNZF/K P6uszRlHFhbhbOeEFlE4JDi2b8rkCH0aMtZaBgGme4iYRcH6PfQDJGYY0vFdLk5b8un7htd8t TfSm0GQJSTJnPFm5J8kKi2G+zcfHf+GG3RD5Qdy3mZmI9ffaOsXsN3guC6Tv5oOGOmcTl/rAW ozzwB0ZhBufP5BFQ9LHflivyECBCOV8UQ1Nk9RmIcPBERriuDkmGNNhPZ9P2Zf/dDTMkLCMXa 8Gmm0CwZ98PxVZERirNfIjSv7Io5i7n9D8eRtfFbXJHEKUc6rgTPmhRalaTJZVq6ixB9A5Yh5 Zk2plO03mTPUcT9wP0VrlAS9SeOV1eejRfTlAc3xk8aLSQP3w1X7FQLmxsJOBtN6SN2PPy9ZS pNvYoQ+3MFhtcZ7B+z8eSGs+7QxJBifjtwGCL4laB1MNecjLRJmCe+BvVEO1SK6Wg3yYWYHts 7TP2ENheU9C1SrznnDs3EkezDir74oAB9qLcuY8WIBCxH6VSXMzvOJv95R33UrDxA6cHxCn35 W8rEFySf+je2q/KHCQmp0xL/34IWdbJfy9tSlkiA6pIqObGIJT8IYaEaMb8ZdvUlRJyXIG/Z7 i4UeiCJExHBXNP/I3McVLMywRYzMLz8yHaXLqSswL9cTqS/Fgr/P01TnwZWqoxoL5suV/KjEh JdWdqdOuCgvitVnDi1ndGnhuGUrzJT/KrU4TSaxcQNSFDoKnxuyqsrcUuhC+8+NylBn3TwXQU sqRVqmXD2r6VAtQhAuFA/BSqGc1VL1mNqGPrZKsDHsF+t9WdbVSDh1H/7LCn7Erh3q4LXvSrk qFARIqKKi4vqZO2oonpk14ER7xPQJs Add the Acer Predator PT14-51 to acer_quirks to provide support for the turbo button and predator_v4 hwmon interface. Reported-by: Rayan Margham Closes: https://lore.kernel.org/platform-driver-x86/CACzB==6tUsCnr5musVMz-EymjTUCJfNtKzhMFYqMRU_h=kydXA@mail.gmail.com Signed-off-by: Armin Wolf --- drivers/platform/x86/acer-wmi.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index d09baa3d3d90..5cff538ee67f 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -393,6 +393,13 @@ static struct quirk_entry quirk_acer_predator_ph315_53 = { .gpu_fans = 1, }; +static struct quirk_entry quirk_acer_predator_pt14_51 = { + .turbo = 1, + .cpu_fans = 1, + .gpu_fans = 1, + .predator_v4 = 1, +}; + static struct quirk_entry quirk_acer_predator_v4 = { .predator_v4 = 1, }; @@ -600,6 +607,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = { }, .driver_data = &quirk_acer_predator_v4, }, + { + .callback = dmi_matched, + .ident = "Acer Predator PT14-51", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Predator PT14-51"), + }, + .driver_data = &quirk_acer_predator_pt14_51, + }, { .callback = set_force_caps, .ident = "Acer Aspire Switch 10E SW3-016", From patchwork Thu Nov 28 14:51:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888102 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E64785C603; Thu, 28 Nov 2024 14:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805489; cv=none; b=Dx1wx4pwMECA4npn+Kx12Laz1PMm6mXLn79r8HKBEYNVdyOVPbenOB9jJAJjTH+ROJqD1YYHF3ZwwJCMZjpY4ImrigjlEbuTJZkioiJj+egb3fZ1YAbOaGR91qhWz8r+vGuTLT40/LULoot3BQXanMzYz7E0caoFOjgfk4nFN3c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805489; c=relaxed/simple; bh=dz5zS6kB5edcWn2Vs0OGpGrGB8qow0mRIbMXAAwJx2c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m5VM6XMN3Ni+ruYCY9k/6aOsOwR0ussJ0a1E/JHEM8swxAFVJKry4l/jbYakkiAWB3iczs6dDr4vIfTd9Rr5Qo1fDO6DDkMSEAhXMr6lPY2F87FmhouiEDDd9hFlCzglmVRiLG8GoJfG15vebKt9QcbGMFlN2v2MR/PAjdmmMAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=hyyAdrMS; arc=none smtp.client-ip=212.227.15.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="hyyAdrMS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732805479; x=1733410279; i=w_armin@gmx.de; bh=UP050hPGANPERFI8S6uX7fXmxD8vqSI87oyADFw+R4g=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=hyyAdrMSVZGOlc+BKtn1RMPNKtkowh6QxY7vmCEUc/vHkWcEN4ZRxxd4oDR25TIh Iu92M+HlqpL7pMVz2gV+tL+86wplTvuMsmV3vB3J//UfC8WfRK4NchRHd42/PYG2w x2BsM+aoC3OttueSZq+mGghTas9iA5VlTYzO4YSL5C4jS94NBwIXL56ZSF9wC+4Um fz6mlWYH/CpKavd0AWdy58ifhnmU+5eglSx2lILdQK/xIlPeajY63DkxJpHco82H5 wONqNJkwNmpyOZXXPs4tAjCnixzgv6NsjEoSQuIshRMKP3xiwIOfLKt43o+QNwNjO B98osS8t03nJMjSX8w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.dip.tu-dresden.de ([141.76.179.133]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M72oH-1tKpGS1Iit-00CXmR; Thu, 28 Nov 2024 15:51:19 +0100 From: Armin Wolf To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] platform/x86: acer-wmi: Rename ACER_CAP_FAN_SPEED_READ Date: Thu, 28 Nov 2024 15:51:01 +0100 Message-Id: <20241128145104.13538-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241128145104.13538-1-W_Armin@gmx.de> References: <20241128145104.13538-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:js5JNUM+2F15uXqWEhk241vSMEczGV4uMI9NgEsvup2ZbRh0rQN +6EByMf4ud4E+3/Z78Jjpdu2d7nYGsS0b6zb+i2eqxvMoR1CyourS1TMKk1TXGyj/L8dLsq LyR2Nn8WXPsxYDL3Lhlmfd2U5aEcXfLY4s71M6y/IgkWO9UoVBBC3NCP2Ku58CuW4vQ3NbE AGq0vpaV/GUa7SttOMGqw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:4EEHqvNxkaM=;NXU6i1BAbdftIYgMNVMrDMySVXD VGf9dfgHay6WES7FlyrAdtEJxesTHs1PB0/vNvH1UyJfJOljswv0ONn2PWZW2tcrgpfPyUYgr tt6h8zJSpIGqKmY7sVwwi/FJTDl17Jo9CQIRmJf3xcWqYUX4c+2wP7P8kcigQ7LNGNE3+O3UK IIBjQUrD0aX/zhFipSE6GreahEr+G5ScCLri5ZYLBwOwkFX0M4Jyc7NuaM+N0L9JkBeG2viIY kW+nSlRb0+ZPmtSI4HOjFIKoGQBBfJfFY4xWoArYeG5CGw7uLx3EBMeAaTHasdu4KV+oURJo1 R8zNLYEJqYxNU6tbE54trNZsYe7wbkbsGAGN/bmrDEabQ37Vh0Co+y3OwjElrIx4s3xIr7a6A ucLNL8xVn3PpVp/8HQCPVXa6uyFVrNl+s5VOlMe6e7RsuUO9c1SXj+4VqVLYCP1yslCyE0sCq bSuD5cMac5j2NZ47qL19dM0cnDOc8yv3h3qLf25/rLqCKuTTLFyH/H528VcDqyJ3hJYFlO3u0 Ql9Acpw8zCj2+H+X9D+EcRZQvJVM5Kif2tzTaYyy6groxNbb0Prd23c0y46kJnFbP/an/w9Bv ef8iDUPXmOIMIsPugKDwrJudPmRjgMjcNHgwGjRQ1K0N5v8B0CRJ2j9R+Zxyolq0JyP/7Rp/0 4sofDnHA1vm4U6laQq2NxuWyXs9oU9fpyH8z7MNlLUoW9w/Ouyk9wm2Hsxikt21qKTyEbthnY 84qnsdFTmJxtJKoA05bg1MKI3pucfeJtQ+de4uCigghdq/r/+VbA1XbF+dmkeKztgdAIh/S21 GPZGHDLjvROEtPEBbZO7XiSI6CmKDvO8FrJt2Qqd06IRlxKAwlE+UsNkmtM3nLDJYYj2nQT1H o3BRAbMy2gQxKiCbigDIKBLVLRflzLXDW3N5c11yyiF5kLNpAIjZyAtE7cDCbGRpIZJsTLFsf liQzrFN6VYEkxedecj1Se0bcH2Zr9+eNgNlPGYcA75zQ8ecVstyEmVY3P8LEeVc5AvUL+DH0e Y2TI2CtWnx3lGJoJUMmj9XqAC58/YQ7SpytC5L86NQac20mgagbjaM6ipES8PE6fTM42qjH5d fd0IMFMaiqPKYGRMl2Sdk02gytKgxn Rename ACER_CAP_FAN_SPEED_READ to ACER_CAP_HWMON to prepare for upcoming changes in the hwmon handling code. Signed-off-by: Armin Wolf --- drivers/platform/x86/acer-wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 5cff538ee67f..dd57787466b9 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -246,7 +246,7 @@ struct hotkey_function_type_aa { #define ACER_CAP_TURBO_LED BIT(8) #define ACER_CAP_TURBO_FAN BIT(9) #define ACER_CAP_PLATFORM_PROFILE BIT(10) -#define ACER_CAP_FAN_SPEED_READ BIT(11) +#define ACER_CAP_HWMON BIT(11) /* * Interface type flags @@ -358,7 +358,7 @@ static void __init set_quirks(void) if (quirks->predator_v4) interface->capability |= ACER_CAP_PLATFORM_PROFILE | - ACER_CAP_FAN_SPEED_READ; + ACER_CAP_HWMON; } static int __init dmi_matched(const struct dmi_system_id *dmi) @@ -2551,7 +2551,7 @@ static int acer_platform_probe(struct platform_device *device) goto error_platform_profile; } - if (has_cap(ACER_CAP_FAN_SPEED_READ)) { + if (has_cap(ACER_CAP_HWMON)) { err = acer_wmi_hwmon_init(); if (err) goto error_hwmon; From patchwork Thu Nov 28 14:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888103 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ABC71B6D0A; Thu, 28 Nov 2024 14:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805491; cv=none; b=lkXDvQCIgLs9ygNZplSOwLekJrEBRlZA3j592ba5y2WwEkl+VxnPwcSx4w3dLrg3UkFNwQrkL16r9ayWeFO+SNqtDvI5ThgQTcAmNAs8WK70xPovVlPYmA0BS4gf5+zE4yGAEm6oLtEtni+L4JGPg26T2fUAsACNenUnW6Dgehc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805491; c=relaxed/simple; bh=4yOdeZ6/wzBKklmkjBXqdD7C82LJbavp7/vhxJqYYSc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e1ktdViCtRuhBa48PWDbXP59N4kC1Z0VUxxb299Um5A/8yz4o6WJqMbeHtIvzr0SR1LvNAvqIeOdh8mtTQ5Nj7nQtOEfhz6QVmplawZzN+IL7V01ik9n6mWzaM8ihgYwovZS0QKPB+tDpEHTxuzqkpLnAXpVOeqsDjPGdXfcsNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=W/twMklP; arc=none smtp.client-ip=212.227.17.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="W/twMklP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732805480; x=1733410280; i=w_armin@gmx.de; bh=+qpjumcm0obWOM8nAsXUgn5JYFFO1BSRr65px7Uw1ME=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=W/twMklP6qs8caMcS9GVa9PrZy/er5k6a4rzfuWVsSwcg3HWCgRTMu3gxcFwLUvO FL7klT4AuaPHt4dWMgpiWEZS3Ccq9AY4Mx1pW/wrMPLGiJS2yxeJnZbtrNjdo3qsN Urg+kDJNk85LEGxWhAM99p6Q9swukDEHfTXU/2kuR2jmnSHPHRfyLwJXgJeojszhM 9C3bczdWQ2txS8BAviCjiF+AaAAE0/+FaiFW813uAwX0dGelDQT3HFPZU8R5BpWcz da6SIY9tqDpHA9RVUi1ekFQf6dFCqx6dnvEh/Ddolxy/LEG3FWkeopW+JGEj3XMdS C/s4MgU0SSX4b8HS6A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.dip.tu-dresden.de ([141.76.179.133]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Ml6qC-1txTvA34qS-00kdWB; Thu, 28 Nov 2024 15:51:20 +0100 From: Armin Wolf To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] platform/x86: acer-wmi: Improve error handling when reading gaming system information Date: Thu, 28 Nov 2024 15:51:02 +0100 Message-Id: <20241128145104.13538-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241128145104.13538-1-W_Armin@gmx.de> References: <20241128145104.13538-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:W06au7PbS+bRuiXFOm1vZthqp+ga97B2Fhg7QGhQOR3KTz8p59u V0L7tGYR/gJleEnpsX9z63GrXX+6IpC452PYI8Yuu+watlkZL32thVeQ94cxNNWIHqxix6Y 3OjxGydFrzgIvHSgtVX0tGZsg8Y2q50OvRIf+4AbVCEE7EadpujHZhV5kHL2w+CZNAk9N5P YGntSh1o2tlzilvH5Uufw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:bSt8VMM2dKI=;JwnTo0/mKJj6//QkZSq0PK1LGZF FSRgNs91Pq7gS06MXT9554ltYRK7+gCzobUl554k347GyVBFi3K6vdXe5kyj3XQoh8RoMZ9S0 FZ0VvoLllmrrHlHsL+90ynrHfyPXQm7nGmsxY+LNzvi7eFUhnBWWDlqr9GI+og4tYtyafRVn5 XzV3OPI1AWJRUDXdOI3uOGFySIdLtoHXFIkaIYQs0Fxcu6tXU2Z9eU6Dq/gX7Z2jrADE+R2z9 w1PGUbaCi3GMWlGfH8tn2DR0gsLza1hYDtOcTHt8lBijzsdY6HCdToQLFkjfY13wO3v3nMkXl rA89n3EB348SeASPiX16NRnxvQhgN82XKADJ1gjtLuPxWdVvvCUh18czNtTqxFk80i1/IBlUQ pGNj4nl9hPCDPbF3XGY8wTZfDF8iLbG5yN+rJrUOX1GufD+0A+Rrjuv1dFgRh7pLuTTEjqELV mX+DAY1MqXBw7aYR83nMcQW/N7PfJviEcP9PhE5QWgpRwBlawKj/taGo5jhKUxkobb0G9H6g+ kXyo4BGZvcEsDaLNFHNZzq4fR/yeU8ioZ/23nqc9wugG3BcztHa9gAbsq9mnhtIPhy+qeqI+E /D2/RdzDBpZyO6/aSqRPCx/BSlZYLgyx06967E6S/zaAKiM4DMaN+lxQLvd6y6UZaOTk+7yDO +THxGKYyGzodljvZB0lHHAtW06eW1fD5Jp33HhZKMaYZs4sPbRYbthQSmONerBtmkcGZz/pQ0 X/NCFSanqfisms0c+rDBZ6J8SmULUg+7lhtcrqxqdVpw4Ov5J/ByAoiQjyyAoYXAzxpuuEc6R NN1/fYq95hK7E+WgM48aePADMVVDGb1cg1CnTWvEdEuiOUP9FA11JHTTiDRmLn2dPjqrm5a2j Vpgz0nvMPvFB2EKYjf8s2GatlJda7qeBH3zSNnGQgm+TnrVBGo2x3omo8iBZzAyCWcp+4qb7Q V+1fb7wOXKx9wrAcKyZBQkGiN+VntPqiPZuYeJyDXohgIjNwhsX9ea+XWTeENw0YVboDNiOeI UM5K6znPBPsKj4/GsZjXQAdEwnwiaU8Awyt13pVL0d45GgEMhJi98Jom63pPVR8QQSk51T6cR SfSSKl0Y+uNlvCxkAcGJNp3hOErJGI If a call to ACER_WMID_GET_GAMING_SYS_INFO_METHODID fails, the lower 8 bits will be non-zero. Introduce a helper function to check this and use it when reading gaming system information. Signed-off-by: Armin Wolf --- drivers/platform/x86/acer-wmi.c | 55 +++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 19 deletions(-) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index dd57787466b9..fcea017f0796 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -70,6 +70,7 @@ MODULE_LICENSE("GPL"); #define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54 +#define ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK GENMASK(8, 0) #define ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK GENMASK(20, 8) /* @@ -1513,6 +1514,24 @@ static acpi_status WMID_gaming_get_u64(u64 *value, u32 cap) return status; } +static int WMID_gaming_get_sys_info(u32 command, u64 *out) +{ + acpi_status status; + u64 result; + + status = WMI_gaming_execute_u64(ACER_WMID_GET_GAMING_SYS_INFO_METHODID, command, &result); + if (ACPI_FAILURE(status)) + return -EIO; + + /* The return status must be zero for the operation to have succeeded */ + if (FIELD_GET(ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK, result)) + return -EIO; + + *out = result; + + return 0; +} + static void WMID_gaming_set_fan_mode(u8 fan_mode) { /* fan_mode = 1 is used for auto, fan_mode = 2 used for turbo*/ @@ -1762,22 +1781,23 @@ static int acer_gsensor_event(void) static int acer_get_fan_speed(int fan) { - if (quirks->predator_v4) { - acpi_status status; - u64 fanspeed; + u64 fanspeed; + u32 command; + int ret; - status = WMI_gaming_execute_u64( - ACER_WMID_GET_GAMING_SYS_INFO_METHODID, - fan == 0 ? ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED : - ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED, - &fanspeed); + if (!quirks->predator_v4) + return -EOPNOTSUPP; - if (ACPI_FAILURE(status)) - return -EIO; + if (fan == 0) + command = ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED; + else + command = ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED; - return FIELD_GET(ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK, fanspeed); - } - return -EOPNOTSUPP; + ret = WMID_gaming_get_sys_info(command, &fan_speed); + if (ret < 0) + return ret; + + return FIELD_GET(ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK, fanspeed); } /* @@ -1942,12 +1962,9 @@ static int acer_thermal_profile_change(void) return err; /* Check power source */ - status = WMI_gaming_execute_u64( - ACER_WMID_GET_GAMING_SYS_INFO_METHODID, - ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC); - - if (ACPI_FAILURE(status)) - return -EIO; + err = WMID_gaming_get_sys_info(ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS, &on_AC); + if (err < 0) + return err; switch (current_tp) { case ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO: From patchwork Thu Nov 28 14:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888104 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAC292233A; Thu, 28 Nov 2024 14:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.22 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805493; cv=none; b=jwNBbIPCHi1JWRMmst95HutnvFkPp49oSFLQ8MAWafgDhBmPfe4F+IUwcd8Pl4UrthjM2xSkjCMaaoHsfhcoXD7iijoceq+YB82pLwZ3tFb0tEDMTPGumjB/QHK+kZxNlzqRBOdYQHIYOvlrLzKHOSWKGshlXVnlhQddXVVOjiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805493; c=relaxed/simple; bh=jA/RYuJuXv2Kcbxr/tarWpJfHkpKlsndR+/8Rf8rxAc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eKzJG/lOVFO6TadpQRvAeaBj1s73twx1heoo4dt/2ok4Hcaz4vTqTQuIiUfHCgexJMakssOBdJVtt0FkcB2ENtQDuvt9NVcnNmlmd0Z8GPMPhsb1BlHJCIVWbQZbmqjaIs2qh6JzYGPzKLJJrCRa7rhjwG9AWVtMHU2HQFc9NPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=MLEC0lt7; arc=none smtp.client-ip=212.227.17.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="MLEC0lt7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732805482; x=1733410282; i=w_armin@gmx.de; bh=w9XMGh+DU+TKMHDIPn2YAPDqHS7ou5ajkWr6SnoQXWQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=MLEC0lt78mPqH9Ed6phnbZ9Iq24envJpPGUZWNH/TgLGNj67nFGwwQDOO709UD2a 60vkNPQcJvFc3y1oyVj4PsOJSEMU1TvN+8hHoe9U5tVZJZGZ2PXurhF0tv1NzHJB8 lKdJHOrCsVgmiXMBzHQnnmLHwk8K8yUF+rdQNgRT4fu8pD5f766s3A3FhL99vAKFO v4yl1cxcPt3iicduk2RtZK6ilT0PydmaTxyGRvNnP0nszDPJOHlQWJ9WnEpO6Y/zP Av10K24iT5mKczXZ8bpNiaDAdhuay+EVE8WqpJ1/E4JvY7M30ggDfRgMTjoiI5d/x AGFJZhXKys3Pvac/6A== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.dip.tu-dresden.de ([141.76.179.133]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1McYCb-1tovDT1KkX-00ieTw; Thu, 28 Nov 2024 15:51:22 +0100 From: Armin Wolf To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] platform/x86: acer-wmi: Implement proper hwmon support Date: Thu, 28 Nov 2024 15:51:03 +0100 Message-Id: <20241128145104.13538-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241128145104.13538-1-W_Armin@gmx.de> References: <20241128145104.13538-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:LofgK/zvLEhUQ9+gMCmd49ZNnWI81B4x+9RUlKeQ8b5wsrXl2Fj mN8EM3hCEsN09EyQoACSjWTRxYf4FhRNMcVJl+ib6448fk8/AXG7X6aNP0EISvBtqIpugOl tIyUd+LFykH0GZ4GF9gtMH+Vjo0M1KyAkxMIzbKacwCCx9DROCw7cQzxqj9ltXoaGhughvH m7JQU6i1ypGdSt4VlaNkw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:YlDLqZ4l6GE=;LqEsfvBFMj6MdIdwV0LZB0s7mas LS0/SlHTIJp8OG5sEWrC3uvfCwH8q1Z4hTiRoXPGt66uJzNc+1WfJm96jFT+PPyVoDpJn7VRG 5r8tZaV/6AjiFUOgYtwRQwv3GmlRX7S0pJsafshLsIWB5NEr6VdSM+ITov4Wk/FiApnBEd1E3 6TXfGMX+J4a8ITlJZFzDl+QFYBa3AFH8nMpZw4gkY0nY6sdxTBw6LF4rTmyBNbcn+jjyiJ7h7 /ql3JDXBbRkK31cI7u4Qh8bZ7zeuO0XK53xegwAUUQSzMAxk0Led1bKgPxtNOOUZptau66wWw xW4ogLXuteEMpyTR2jy35Xa5XXH01yXYoCN16z8Xnj8QJKnuEVpwLIpeEuhcbC8/H0O5VKzZp SAkRn5o1WBPu9S4ESYP38wRSiGOoxr/Xr5yWv1ePw5axUsb0n+xA6NibH0BI+si53WZLoAYSP ETZlI1JAH1eA7FjUE2sVWQD5FpUcUDZ2b+QOab/vMustTZ7VuGaXp4k34cFe8d7BMzlZAyBIy R/HREHJjYhSYc3RbKdbehnTKBXjHH3BZh+0TgyKjwz0AkaHTEhxT87dluXm7XrIvrWpweUwJE g/0X1Z9gxuoF3dOEvLCTqM1tmtYczKnr3x3Q+yP6MzsJI4kUiFQ69saIixLtbjCtv9SZQZmRO zHXCfh+sANHx0tEhNolJvGM626Yfm1AxRDoAZd/Lh/BL573ZbDzmUwndJae5gpWdLKTDN/86g z2O/NiwF4ZSW+T4H5fELqPeWZP2TLb8kpkrqdTV/6TpcyedLK5Jyp4S2WEB78w67ubR/Ycm2M aZJth8vxyehaA7VTgOJeHaBnI6s++6JDuHRRt5ddeOUmKYnc6C7wUSjv+/+b1UpJs6CUCkt0N XYrZsMVlyOpjtCX1PmD2dhmlGTqaBUXoOwtUomooPROo6kEaIHcccP2UXp8OdjGiRGNP4648V I4+P+1zH0eEQtqM8DXw1musst2ZiBkOk7uqsznu/x3ckScB+UcIm6PMmTRI4hg62wzlKbXQ9G 5VfuaY3UPH4KWTVD5Ejb6RBfnkj8rvdc8dB3gEv0nZegkFlkLThXAUE+s9ahJtMdbk9OABAB4 vXDwkaEj773j01WlXwRoX8KN1gp+ND After looking at the ACPI AML code, it seems that the command 0x0000 used with ACER_WMID_GET_GAMING_SYS_INFO_METHODID returns a bitmap of all supported sensor indices available through the 0x0001 command. Those sensor indices seem to include both temperature and fan speed sensors, with only the fan speed sensors being currently supported. Use the output of this new command to implement reliable sensor detection. This fixes detection of fans which do not spin during probe, as fans are currently being ignored if their speed is 0. Also add support for the new temperature sensor ids. Signed-off-by: Armin Wolf --- drivers/platform/x86/acer-wmi.c | 113 ++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 34 deletions(-) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index fcea017f0796..e2615ab3fd25 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -30,6 +30,7 @@ #include #include #include +#include #include MODULE_AUTHOR("Carlos Corbacho"); @@ -71,7 +72,9 @@ MODULE_LICENSE("GPL"); #define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54 #define ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK GENMASK(8, 0) -#define ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK GENMASK(20, 8) +#define ACER_PREDATOR_V4_SENSOR_INDEX_BIT_MASK GENMASK(16, 8) +#define ACER_PREDATOR_V4_SENSOR_READING_BIT_MASK GENMASK(24, 8) +#define ACER_PREDATOR_V4_SUPPORTED_SENSORS_BIT_MASK GENMASK(40, 24) /* * Acer ACPI method GUIDs @@ -99,9 +102,17 @@ enum acer_wmi_event_ids { }; enum acer_wmi_predator_v4_sys_info_command { - ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS = 0x02, - ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED = 0x0201, - ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED = 0x0601, + ACER_WMID_CMD_GET_PREDATOR_V4_SUPPORTED_SENSORS = 0x0000, + ACER_WMID_CMD_GET_PREDATOR_V4_SENSOR_READING = 0x0001, + ACER_WMID_CMD_GET_PREDATOR_V4_BAT_STATUS = 0x0002, +}; + +enum acer_wmi_predator_v4_sensor_id { + ACER_WMID_SENSOR_CPU_TEMPERATURE = 0x01, + ACER_WMID_SENSOR_CPU_FAN_SPEED = 0x02, + ACER_WMID_SENSOR_EXTERNAL_TEMPERATURE_2 = 0x03, + ACER_WMID_SENSOR_GPU_FAN_SPEED = 0x06, + ACER_WMID_SENSOR_GPU_TEMPERATURE = 0x0A, }; static const struct key_entry acer_wmi_keymap[] __initconst = { @@ -272,6 +283,7 @@ static u16 commun_func_bitmap; static u8 commun_fn_key_number; static bool cycle_gaming_thermal_profile = true; static bool predator_v4; +static u64 supported_sensors; module_param(mailled, int, 0444); module_param(brightness, int, 0444); @@ -1779,27 +1791,6 @@ static int acer_gsensor_event(void) return 0; } -static int acer_get_fan_speed(int fan) -{ - u64 fanspeed; - u32 command; - int ret; - - if (!quirks->predator_v4) - return -EOPNOTSUPP; - - if (fan == 0) - command = ACER_WMID_CMD_GET_PREDATOR_V4_CPU_FAN_SPEED; - else - command = ACER_WMID_CMD_GET_PREDATOR_V4_GPU_FAN_SPEED; - - ret = WMID_gaming_get_sys_info(command, &fan_speed); - if (ret < 0) - return ret; - - return FIELD_GET(ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK, fanspeed); -} - /* * Predator series turbo button */ @@ -2688,43 +2679,86 @@ static void __init create_debugfs(void) &interface->debug.wmid_devices); } +static const enum acer_wmi_predator_v4_sensor_id acer_wmi_temp_channel_to_sensor_id[] = { + [0] = ACER_WMID_SENSOR_CPU_TEMPERATURE, + [1] = ACER_WMID_SENSOR_GPU_TEMPERATURE, + [2] = ACER_WMID_SENSOR_EXTERNAL_TEMPERATURE_2, +}; + +static const enum acer_wmi_predator_v4_sensor_id acer_wmi_fan_channel_to_sensor_id[] = { + [0] = ACER_WMID_SENSOR_CPU_FAN_SPEED, + [1] = ACER_WMID_SENSOR_GPU_FAN_SPEED, +}; + static umode_t acer_wmi_hwmon_is_visible(const void *data, enum hwmon_sensor_types type, u32 attr, int channel) { + enum acer_wmi_predator_v4_sensor_id sensor_id; + const u64 *supported_sensors = data; + switch (type) { + case hwmon_temp: + sensor_id = acer_wmi_temp_channel_to_sensor_id[channel]; + break; case hwmon_fan: - if (acer_get_fan_speed(channel) >= 0) - return 0444; + sensor_id = acer_wmi_fan_channel_to_sensor_id[channel]; break; default: return 0; } + if (*supported_sensors & BIT(sensor_id - 1)) + return 0444; + return 0; } static int acer_wmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { + u64 command = ACER_WMID_CMD_GET_PREDATOR_V4_SENSOR_READING; + u64 result; int ret; switch (type) { + case hwmon_temp: + command |= FIELD_PREP(ACER_PREDATOR_V4_SENSOR_INDEX_BIT_MASK, + acer_wmi_temp_channel_to_sensor_id[channel]); + + ret = WMID_gaming_get_sys_info(command, &result); + if (ret < 0) + return ret; + + result = FIELD_GET(ACER_PREDATOR_V4_SENSOR_READING_BIT_MASK, result); + *val = result * MILLIDEGREE_PER_DEGREE; + return 0; case hwmon_fan: - ret = acer_get_fan_speed(channel); + command |= FIELD_PREP(ACER_PREDATOR_V4_SENSOR_INDEX_BIT_MASK, + acer_wmi_fan_channel_to_sensor_id[channel]); + + ret = WMID_gaming_get_sys_info(command, &result); if (ret < 0) return ret; - *val = ret; - break; + + *val = FIELD_GET(ACER_PREDATOR_V4_SENSOR_READING_BIT_MASK, result); + return 0; default: return -EOPNOTSUPP; } - - return 0; } static const struct hwmon_channel_info *const acer_wmi_hwmon_info[] = { - HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, HWMON_F_INPUT), NULL + HWMON_CHANNEL_INFO(temp, + HWMON_T_INPUT, + HWMON_T_INPUT, + HWMON_T_INPUT + ), + HWMON_CHANNEL_INFO(fan, + HWMON_F_INPUT, + HWMON_F_INPUT + ), + NULL }; static const struct hwmon_ops acer_wmi_hwmon_ops = { @@ -2741,9 +2775,20 @@ static int acer_wmi_hwmon_init(void) { struct device *dev = &acer_platform_device->dev; struct device *hwmon; + u64 result; + int ret; + + ret = WMID_gaming_get_sys_info(ACER_WMID_CMD_GET_PREDATOR_V4_SUPPORTED_SENSORS, &result); + if (ret < 0) + return ret; + + /* Return early if no sensors are available */ + supported_sensors = FIELD_GET(ACER_PREDATOR_V4_SUPPORTED_SENSORS_BIT_MASK, result); + if (!supported_sensors) + return 0; hwmon = devm_hwmon_device_register_with_info(dev, "acer", - &acer_platform_driver, + &supported_sensors, &acer_wmi_hwmon_chip_info, NULL); From patchwork Thu Nov 28 14:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888105 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 032441BC065; Thu, 28 Nov 2024 14:51:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805493; cv=none; b=pWBNDBqPsWx+RTlYRSYPYiv/vmSr+iP1sbDsqUdJ1Gepr9bFKUPIUPZfEjAT0ds3H58BKgxIgjRWAw5KuFG8kexhnVxRB6+UFkTzuNRuOp9iOZG1s5CnKeGalFCnOU9HDWp3EGLKAV6kKhKsuOmjdFFIFGTCAJi1LrpvBbwdJj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732805493; c=relaxed/simple; bh=gykNvCSx5PNdnquYd1VHSOHJ/RJXek/+SRQGOnywt8g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rLD5Z+Sowf7iShHEmNWf1MuQa1u0QS2nqZaaFh1XB+XPfFSmIwutH9Ahm+tHXYF9VN2sECxAf1LoyRkl3esbFqi2bNTYE89ehe4Tdoikqm8UsX3AT6m5dMYoz6m5Eb0RfFBOivtEzV9+aglS/6tGqFXJ4Xjs2FrMAuIduOUHkz0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=D+FnNRBW; arc=none smtp.client-ip=212.227.15.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="D+FnNRBW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732805483; x=1733410283; i=w_armin@gmx.de; bh=3FZ63viKN++1lQdM4gtxY4u7uvshhkYMJ8O/He4ViR8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=D+FnNRBWHNXjzqzTBcEAfSQZTVXeC/iWgYCJ2S7SEsGtd2turGz8zSdeAw4yvPMj aZuW+TtFHsj/THpZsVmpLDQqfxQUgIo8yH3na9nDDkBakiYYh45F+CQatY6HKBmIa zImXZsCszXJkpChQI2JgaEfrn4VYAlXSHaEUHs4f/1ux1hVyIlCm64eSTo0/ykb0F mEvB5y6mlZmH19SjBS/oXp1DFVRVSiZ0uLCZhcoStl7+xBAcKP/ToZsgvawlEvXiM +tOLFqpQw1zT+LTUvEv1YkwAh7izE2imK0ODfLFGEDoD11i1Xt3ywyoi9wqykgfAG Q12f+qe8V7eLTQ2qHQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.dip.tu-dresden.de ([141.76.179.133]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N4hvR-1tixqO0k4t-00wgD3; Thu, 28 Nov 2024 15:51:23 +0100 From: Armin Wolf To: jlee@suse.com, farhan.anwar8@gmail.com, rayanmargham4@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] platform/x86: acer-wmi: Ignore AC events Date: Thu, 28 Nov 2024 15:51:04 +0100 Message-Id: <20241128145104.13538-6-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241128145104.13538-1-W_Armin@gmx.de> References: <20241128145104.13538-1-W_Armin@gmx.de> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:9JE+u2lwO4nazIYjTlKhrNT+5oryEjBXMWQ/cAzxt49Qx9C6Nlt inb7zXz/tCB+DVqMfigMiyjbAFwEITx/ftJd1Z1jxALdGkH8Kge1gaFqFXNe6LoVUzQfEhh 61z+7/znONM9JtC+FtW95I1yaBrk1jU4QIzLAArltGL70hFWOlEiOEC+EAz//jubjBQC/tm u85mzzGeaDkJ65aQkV2FQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:pvv8qCmfjLI=;W8MP2m9MVtyZubtmPdQfYJC3RYK S4CC5VwnEkA+F81KVGALVFyEBY2XQbmAfLCfSTuChp1XD5NSx7UhP21ZT4P15uViHaiUSQt62 Kr6pi7XdgifDRZJIsXbWcY2kcrMplFOwu89PN+BU6xt7w6KzAIIwq5FAykmblz/9yPUGG/plJ rdUMDjvdHeYUuxBqPENtcdOJd1rFZzpCQlD/nngwK1kQQc3hx9RJxkdwrpm4+Xa4Y05RPjL0Y K0Zn5RCQjpc6GMlEuEv7/utAjUMy9L8UTSY0tRNwNEgw/rCpyv5BWa4PXxUTOmgAM89GhE46r W21Y3DMlPqKviGDFdiCU2KXvO2EjyrdMrYZphbic03/h3XhqdbSxxpTBAQN1V6J7448dUjcNH QjriHUdqWR47Gd4uVAnVU/h1GjxQaKuEmu9RVyozUi2w9TM4h/KutMqRrxEJO7uQMKVIo9AOe roNUsOzcOlIC7TUFJKpqMDJNkhE/quxaiGjYgiBwQ0p8Gf3pF66eArphBqemYIJSX8a4XdNMW +r4VzT42p1mJNFutStOdR+bZFaezHQGdRBQlj5jkl+njDAilkIguWz1ejSNMaCXrtVENWvm9h eKnQDfCZiP7AqtiJUHl1JtgZ4u3lpAcDvuSfpDbk9tGJDrvmkbw/4H/2ikPov+e7W0aYEwno/ NfaJFqZBvOLOMmVgd5nDSEJ+4daPnTgrEbew2WobwYVbvRdpD7WGujbBidPvF1N36ZjRszKpQ qkd7WCFWJrSOCWZVorscsZMJB53wPVmmGhJAGNUk9p/JT0vZk+0BwHetT7MsYx+TOSf4Pm+Pt 3mCcZT/bIHFJJny/9RGZrGooPkOQAEBalpsGVJfl3RVGQv2i1h/4yHRZvk9oP38No0R5FlWi2 EGAoSYhceoqNZLNzNHoYNBcpyzgteajamoeCwhMA0dpMaa9PPQUnQkfz7rSdUImsoL/DzFj2l LGRKVSZsccU8MQJfPqdy/7lN6GK50zYlmBOuXHmlI8dVNeDseJkG8KHntLAV0N6SBKx/J08Rs XCBi/RapowDiZkC0ZhhUuQil2HojIjZ0t4XWoimdahHkpbE1Ezj/E2qrN4NDTFwzmKeULbFq6 dgRbKaIxjxuXfpJnPSwFJQ2/gIPSgU On the Acer Swift SFG14-41, the events 8 - 1 and 8 - 0 are printed on AC connect/disconnect. Ignore those events to avoid spamming the kernel log with error messages. Reported-by: Farhan Anwar Closes: https://lore.kernel.org/platform-driver-x86/2ffb529d-e7c8-4026-a3b8-120c8e7afec8@gmail.com Reviewed-by: Ilpo Järvinen Signed-off-by: Armin Wolf --- drivers/platform/x86/acer-wmi.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index e2615ab3fd25..cbd1c473a45b 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -99,6 +99,7 @@ enum acer_wmi_event_ids { WMID_HOTKEY_EVENT = 0x1, WMID_ACCEL_OR_KBD_DOCK_EVENT = 0x5, WMID_GAMING_TURBO_KEY_EVENT = 0x7, + WMID_AC_EVENT = 0x8, }; enum acer_wmi_predator_v4_sys_info_command { @@ -2304,6 +2305,9 @@ static void acer_wmi_notify(union acpi_object *obj, void *context) if (return_value.key_num == 0x5 && has_cap(ACER_CAP_PLATFORM_PROFILE)) acer_thermal_profile_change(); break; + case WMID_AC_EVENT: + /* We ignore AC events here */ + break; default: pr_warn("Unknown function number - %d - %d\n", return_value.function, return_value.key_num);