From patchwork Fri Nov 29 19:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888928 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 35EB71A257A; Fri, 29 Nov 2024 19:34:13 +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=1732908856; cv=none; b=JNA7+wxKdY/aMp6w0YJFixPM4aqdzhFO3Sn6eRTdrEQs+cKsmSwm4b6Fp522j16twKfLkOxqp+sU5A4xXT/KfrWvMbAq9BsMpLyyizsAsz1VZ3ntzmaBR9DvrvbFE8D0dt2sDfGOITQMKnq0EBExrMlZKMkYWq9QuuJe8m7b3bE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732908856; c=relaxed/simple; bh=bvFbxc5P++9Gag+zgAYbv6WxVb4HNe8omEWI00cWw4M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=W+8OOhkQBe4cV3bO6QHYYqDOQtoAxadUH1lNBVYDLHw85vZM3lfvB/MzOdWLK2fca0pwFS9i1Fjv35TAl9yQk5Jr26DJj1X0/+f0wnQ7aENzdD5JyjTAjfEUGta62fy5jiavZXht2ylUDYq9k+HLne1/QDnTyVS2gjkT0Me+QqQ= 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=QNeiGMQC; 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="QNeiGMQC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732908846; x=1733513646; 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=QNeiGMQCYSmh3160HEiZrqA7zIwl0sh+f8zm+XP0xf5YTtPvxUJ55Dogiz8RSy+i Ix1w5Ub8+5pItwm2JmP3t0GE/1q0wWfusNAD7QX+uTt4wh+E+YkvsJtpMTzGqJ6Ja JF4+SJ120SW1ZJm8zRshCtpWhNPQssO6V/1TtcmNjDeLLQmpvfgj3G8ERVFJwPch+ ISci7JK8LHAEFXHe9+lATJZoA2q+FpAp+5TfBaJNjLAHHTxXxlPeBrGu7oWDa/8I2 910ZcrIm6Oq/NZnJTPcSMeKxXypDoG91wKQofraZL2r56RstmETNBsn0fpN+UmBY1 0VwM8z6QK15D8ZfIJA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0X8o-1teOMr3HVc-014EA0; Fri, 29 Nov 2024 20:34:06 +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 v3 1/5] platform/x86: acer-wmi: Add support for Acer PH14-51 Date: Fri, 29 Nov 2024 20:33:55 +0100 Message-Id: <20241129193359.8392-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129193359.8392-1-W_Armin@gmx.de> References: <20241129193359.8392-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:nv/KsnFBKmcenTntND5dcJ8srL6zsPEwhXU97BWYZ6fArV7Lq15 0HxVjCB+EAgGTJFMvOoc7boBaMGanxON3YioaCETLuLR2iA/TxfG8FG+19mXH+TIOL9/KU0 cidy6+azoqr+YXAh9zxbGOeA6KlpKg+47Zb06Rwo8TjO8qKYtcg9IqPV08Cl8boi+cowqGn XDZTXy4AX+JWpC4AIuwSA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:RL5E4/NIqao=;vIZ78XE3k9MMa4niA7qQLULTFS3 sfEWnkQgTHqcapfq7cvG55/ue59PKKjeAFGXn9ncNMsRVlxYPp0+ZiOTeP+ygJADC855wLnv8 HxvpR6ZfAWlbofo7gBxmNvyRK6YVg7lUgyTwkm1bpKuCyJ8H9RhzwDOYVyBKpb/6WGLqXCWkS ahJcwGMb+ogwJujd6WyJwCNI6proFu2qw5a2QfZFZJR7uy+hFK7CJTK9Gfn1Z9KfwGqQWV2ei vAVNVjgbD1/ozupHZH7JAb8+Gr9KwseuAimyGHbHZzmajrSk3vILDpers+lZaHKx7C5o3uJ8W ldycWkctiZtGZAuQ3ecEdLuSOGYb4RvJysHJ1R2h6NB+GZweZdgLqLb/OPkGGZuL/xtXgHeTc Wvdgf4wC2ZRYYXcviMV+qysJt0Bqju40polVLPvAkZjO/6Rxo7RLKKKQN0tLkKdqOqKapSrio rQVdHTvab6ep/W3NyIez1UEfFeI6IEQkXj1+xqvIJxEkbcL2Pc31bckgwNZOX1E9VvgLQ69yS Q3zltcCsf+uw10GIDwkMOlX292lH3kqjdhjEzV6uS3R2kqtBcbokKrCVxG2UeRI/Ns6myaIk9 FTn1LtoDobZpmOHFeU2VwKADMjd2nGpUUwbf4fkEPO/vEanIQ3MG85hvX1L9/E8FGP+ENBSof Z8EV3MYfZBs3XJ0yinrl8uMkk1po3GZkSxxnKD8Pw7fxV2qD/nA54CcrvahUFe7+RtaCvv6SL hdiS32EfHz4EultNMtqN8Sff89+kNzrAgfqImYfq8ChpNb61vDkWdvxne5VI1z5odB80t5WFw 6o27haHLXFtTTvWT6MjtA9xFKimpHy7CJmwFmfmqwjmaaba/nZpolG5hteGUPAMHZL0Z2Qe2Q xxl0FymETtmQRW/z+qF57VPYQrb8NDT4I/whtixWTTlseiiMCm+vfWXDCQsS3/WTcGFoaDEyo LgtBSkkMZm+33ahmqRF04gBzAdLdEZJnzpgcJ+W0gGYiSOm+Ugp8a9FAPKZq8a115v7VEwtPL XQbZ/Q41Z55reaSifOGB3VOh2zJ4sPDXFCm76AJJYv58bpSKOYsBgxaOwZT9rOmLVjhJA0K2g 5swBczYYi+ghkBUf1iI7XA2usD3QFm 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 Fri Nov 29 19:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888929 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 E1A8B1A4F0A; Fri, 29 Nov 2024 19:34:16 +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=1732908858; cv=none; b=kNQLtLw2VHOuJkCFVlw8nTRCSOEn3ks4fAQo0G2o39kZ4mYk3gBGVZavrrZ9PX5xI69kBJnIAhBPPfCQqmwEkGpw3kGukUFuX6+OYyzTsfd/JFVDpgGuuGYAJT8TzIb9IuRJO0seP+pXJgwnlGnhS4vys349dNRTh8K2c/n+hUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732908858; c=relaxed/simple; bh=dz5zS6kB5edcWn2Vs0OGpGrGB8qow0mRIbMXAAwJx2c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IQp3bUyEbUn8UHydIYmU6kC+vi3GBZP0REni3KJuye88l7ar5T7BePs4/bUAEuawBYIjdSDrjuEgZ0YsEZHLxnYjxMiDiSLoajzxzG8/ARa2yFrI9q+yzvZZ5Ys/lkgNxw5R6u395uYguioswjOiUcFW24nX/XKipHscqyEYMWc= 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=pMtlXOvi; 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="pMtlXOvi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732908848; x=1733513648; 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=pMtlXOviVuP/0c/VZE3BmWlfr8BSGfpa88JdMdPTdi8Ak0LALIUK0t/ldk3+N5Os zj5BkFIcQO+vUQ46wbQvvN1TM7wTc6v5CSYjhNCocgIc3RjIrunRnfUQfN1grPIra 4y7M3dJp1NbWvX8G5clOzxA+G20+txIveS3R9kkqT5kz2cGXSVNNqpjY/uIh0/XBe /aU4rZFEXDRrqY7Qrg5pm83Yeox0jh27kMOLXapqrFpqaQUGTM7NbRlrTso3EIiuC PHcml5WiJQ+GrH0PaBKOoLnGb/hm5dGWoQhO9/brh0HOU/+eDO9Ta7HmGjf4I+kBL 5NijFCaUceI8j7a/Lg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Ml6mE-1tyBKe1qWa-00bZpw; Fri, 29 Nov 2024 20:34:08 +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 v3 2/5] platform/x86: acer-wmi: Rename ACER_CAP_FAN_SPEED_READ Date: Fri, 29 Nov 2024 20:33:56 +0100 Message-Id: <20241129193359.8392-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129193359.8392-1-W_Armin@gmx.de> References: <20241129193359.8392-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:CxxXdM/g/JJe86yHe7miFfeHVmzZyNrAK6s1Mxlh6wdbYs4BDRS ZRTzrz/bKpbaj1MIrSbBSl6YEG4Vr5BA2JySYrEft+051JTkYrBGYdd8c+s+mgSOr/Fi5UU 5SIMhxHzscBf2rmOq22Xu44fqOy88Q7SuULavF7/wbP2CSyGG2QXarEJ7ahpxUrXjjfGhAX VSJEN1eFPUBern0O4s5Aw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:y3hhQITfx6o=;iTHL1kidGw47cGdYyI9Z6CRUeHN ORaWGBW9TP/NErwupKaPAAhjSlxywEXBxsKprGrVaOlAxQZHOfZnvCIOXgwSLtzex1dEdYPHy aCOlLTLmgEbTIi38yD3oKCx6EIGwEsVNIy8/6iAMsMvlP2Eq0DuPyDhMVgVkrEaqdf+3x5pnM T/gW5xw5iiARHOfmo7I2O/F4O77Yp9x3154w+Loq9opbqblazjDATT3Dkb91F7EUS6KDWmo2L EAsoN3i1oUkABme4tVHH3y1bIJSxE24yjmNbh5dzFWe/XOsPE+M8s58e1ufpIOBub/x5ifClo Y86yVTsnW6WUIR68jfcBVMPvkMBQhMkecaqfSu0IkrSW3rnEm9F9oZAetbpIxm1baE1hbG0++ Lq/2DyCQwtaq8lXNQZ8xbT7fFlWS5NZ+a71YxvQMWQrz9dAWPB6PkYEOPj/e0DLN06ppkUKlV DD8VyvOP/h02uvl1TDavb3FCkc2EdRVfBt6aYOJRRxK2nzntGGZcnc1OkraxAuIivFLCRQROT firCR3sQFOL0hvRzr2pKQA2/+i0enpzmUo4u62oyWsv7bnwWCH6yslKltinIh2Iz7bMwACIxG 5ZGba/yHORrG976swKgu4FP5w8xiNpyjcpMggMoUYvtZWgOcDkieaKeAbGI5/1Ru2NvermQGg Oj87HAOqyj4OQnSZtHBahBHPe2JTM5X4wVcZlTztR+OYTlLzq0Kz7ExVSKKTxuoNE+xcfFHoS 8lwOvalkD3TQomGmCtJAgrss0Qdn2A63vkgS5ANJ7d/r7jg2albr+GXnPqlnrkh84vODBtiWy Ie0JWsSDHN0bapzU9hUCwXzgrTug8zzL448hEafB6AHeH3yiynOfIQFJfx6FZZH1kxcH+AQRS CDl2c27irjDgC2IaZn3etzp2iiPeeboc1x5432tu1DVt1vZrMUNUHI4tdVfwTMq0dFAZC9CQm UDBtUPLXWXIawbgux//HbpyQYUkul5fcbynLa1l6PQyVx7Rfbj1h6AePVp9bOKuLxTSrzKbt8 lj4TqvQs9Jqmhf71ImRHRl7cDY4y0+nlbnI25aiwGryXTiU9a5Sb0mBbTj28KG4LIrli/N4z+ K9CAW7+ziXv74HaiEonf3+BygsDBpb 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 Fri Nov 29 19:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888930 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 5E6AC1A7265; Fri, 29 Nov 2024 19:34:18 +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=1732908860; cv=none; b=uCI+jVI+hXh5b6y6rGF2ilZAwB/DaMJBEP2ybTicEKAtavckCQJnE7Ryw04F7wcSKYU5/O2Ei35iwzJhJ/2SER5+rquAPwxoo6lOqa7/Lmkh2WU+p3wbUJLxhArEPpHs6KcHwj/HSu5a0g6v9V/UwPJN+jhCcQCILvgWXHmtZS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732908860; c=relaxed/simple; bh=thiL7JmTLfsENiBP/KBz5mSFajlQALp5FP2zNwkO3Bk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LQy0k9un4JQU/hKHN06jJUelOgF2v4WziQTkAbSt6QSKpQGa1k9b5A7U1wWfeah3yn8kDUOrGv/7HVjSQAWrzW8frtXhRrQzOTItzCaBFt0UHWn8bExakBr8V0LvfQ9NRxtBYlZbJbBaBBbG4ZGgZ54wm3I8/YOOz4lZ71R6Suk= 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=rh5Y2Aet; 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="rh5Y2Aet" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732908851; x=1733513651; i=w_armin@gmx.de; bh=fBN2K/XG1TLM9Y04maO4oJdMREklf0rnqTe45Gebmd4=; 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=rh5Y2AetpcTQCE4SScQ6XxySxYKn8euAwGICC3ZW1UWLspiVICOe3S/ihhcdltoO gegluzlfc5AzmXMuThKISDAk88Z58Gyi9PJ9ltilOBo8JuW60i5SDocfyPs05qren f4r+jNIquelhwOua/IcZIzmHw1ro4ixuX6vMCW9Yinjl5GoEBVNyVPRPnP+ZoQRjy 4WpYxH8RHt8wxpB3UvLyXt90p9yI8vXWMp1FDzz+0FfLwOoqbI6I6/RXip049LWdv ZkoRENJB0Q5e/PdYLddAvNS09c88NVjH/TgNpbc7PHDkWEu7kvX2Zmb9I8C1mfNXJ HYj348AeDSXYbeVaPw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MQMuR-1t4Eb52O49-00RRzW; Fri, 29 Nov 2024 20:34:11 +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 v3 3/5] platform/x86: acer-wmi: Improve error handling when reading gaming system information Date: Fri, 29 Nov 2024 20:33:57 +0100 Message-Id: <20241129193359.8392-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129193359.8392-1-W_Armin@gmx.de> References: <20241129193359.8392-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:2vWT3UPwM0kOLQ7ERmaQ+ZznNn1ZJh9q8k2QkTqp6tsLi03yQI7 BloU9QRyNyfms+4THZDTRm5PdbgdGBe3LbSFShx/Erui7Kxb0a+ZEB/kk3dVnfwBCEntTZf CIIbPezXt/CSx+1JzpDmYdm4idwSOBEmQ3p4rmgaeLmXX95Dq/H45RAKmX4CEsaViRkqUWo JQFoRHyei5e0DfJ301M/g== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UJAIDd1I5hc=;UrlrYwMIFYk7CQrStcgUTbv4fBR SdWLZR8D/dIoV40I3zeyQ4MuEkxqEjHGGozFwqbdq8zCiOmwS5+M5TwCEzqiUkSO4eVlzqB6r taFuwJ3hmQU2ASPCgwp1Z8RoAp7XjgLuFrN+gnWjqBer+tk4cep6/r6g3JkviHD5rPDLWirYS hXAow5ALYeMQmq/OL5sBdmL3uNetwZCENITN0ICC9Y2x6EGIYiqE++ZClmjDCsBNneRcLXIsu fZ4SH2sZE1HVgN62cvDAg0fRke1kJwZjLl7But9Pplt8JCz08gtdXCF6rHZAI5h17w7DUNUGX Xl3RR34dcPuwYoK9XAM/1niA3zCPVa11u2b049Xw4bhAUBi/xBir7gzfQqo2w/xq8S62wWe01 lNc+V8q43tEJp0bRbUEsbhRJmCyrtDg+g9U5Jv8B1Fo1ZOx1uxu3JGjZEB/z9DlZHSuOdEpL3 QRDORreru1sSobHKAPQ1z3GHmOL7y+/X6kXbNzANaAmHzi0fdxeLQz7vUYuOGq6bJKK6vZVYd Fm3GtA6q/+dQJ6MUoTz6N0/Q9xlW4K65MwfGmDmSnk4Q7zLbeqdHkAaMy7//9BRUIVstztmAX kssxTJ1CD8lIpg/HyMpSSct4UN/eL+lko/GZl9suHHb0H9ySVNK9RpId/mSNKOTtCwgnSd4vV NbHjfKYcDZkOOsCcM6u84JDZhfDF6yVYMyWY76QJnOgtIxETOgpu9QujBYgMBP0KLF0Pv7wiF rqWdk5dXY2sSqwXGLrwMkVheqwVXiJ6pyq7mnD0cgQoVOJD1h8+nJ2SCdjr7rbbitDeex0wtf GCTNIa99K1vCOp1Dydk7E8Yvr5EO2LVno2056m4EOGHRdRd8JhWJqRduyOnLrylWYxiLtYgPk zqOQsvVVwv+QkiLriDZLh0xNKHo9skLOMcls8kj/FfXUI3JgwCdiwcAH0s5phBYzvFO5sMpwT XPD30uhp8vHgxZJPv7Liy3nxMxSRZmE9que8cdGE2hzIHPAJa84iYWKHN+2uXhqV5x5QWjT93 g//IRoJCf1FM3XloyMkXFA3fAhUEqeP9ys32Y66Zbl9XtM/0SFW+WJBG3AjeOztTAmNc7iKvy o66nyyZz3WNHb9bcjLQ6wmnlbyMI8C 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..ac4500f33b8c 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_ULL(7, 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, &fanspeed); + 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 Fri Nov 29 19:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888931 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 3E5E31A256B; Fri, 29 Nov 2024 19:34:19 +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=1732908862; cv=none; b=V45pq8Hpk8BFhMSbCBnA+HVNVzmsR7xWLZDZbG3W1wjwTwwzeAX8k2qSG4/G3nOH9bc+Oq4rHLK3LcE/VzXuGdYuuoxYuDxH8iDb3QP0d3OGHnOb3Ql8cvJZ23QN3pOyzPvsMlhFbmWuboybiYPsMTdCeGbMnFj2p5tH7d5vjAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732908862; c=relaxed/simple; bh=GQjVcCIr/0IA5545qmgRVzt+JIneduevB9BxTt+Nq1U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SV94k0v9X6MH2Qjqd1a0p2qoQxC3/zOq/aMyWP+uOLfejQ+NFuAq9ptsu1QDW0D2X5k9KyGE9mh0sEAIbTR5eW9vrrs5Emt9JhTTlMQ7JYjgELRTdGspYOrUOe+Es5VqtKRd71HEHR2Q6rrcyvDpT9zyOpQlZ6OHp+HflO9jpG8= 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=LcZDsUtz; 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="LcZDsUtz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732908853; x=1733513653; i=w_armin@gmx.de; bh=vAOIOi0xlHXftrBt/pbZu0/b/mF+loyRuZxpSlsLR1Y=; 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=LcZDsUtzqpbcHRrW+DPJ6PTnzac1eti6FQenVkMLFgC2b9p/VzGC6XN9iTKQZ4CK MhLPcfkxRId8jbJtNSOPLKz08gc7QdB2MTd5wvJq7LcHxs2/huE+Ui0FdDQIHpvjg 4tq+BQAzhD93ibiVvhhLOLQsouDd8MLEUR8cXShDKuJNnhfI5bMKRXvYRcLS4vOx6 wzczN9i0uFHFxD9MSaDqijb0WHZ8TL6Ja4cYdaeY2dxmIrwoK4SAtN/FNCQtQNEad E7IrRoFgpkn71tFz0v9KNWuezmJvMXtwIXev4dGYzrmAWozPrzLDq6+vtzW4sPNPa nPg+7DWjSxNv+ABJeg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MDhlV-1tQl7b30wp-000sCa; Fri, 29 Nov 2024 20:34:13 +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 v3 4/5] platform/x86: acer-wmi: Implement proper hwmon support Date: Fri, 29 Nov 2024 20:33:58 +0100 Message-Id: <20241129193359.8392-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129193359.8392-1-W_Armin@gmx.de> References: <20241129193359.8392-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:H+Ez4nj6lraIK9MBdQ4M7/It/xWTnled57pSmieOftLLVi5lvWM Cdw+IpqM0uvVXWZf5njGM2GFZVFQbcrKf/BtfnmJsulBN8QaK5LyaUEgCW/6CX4H1O/yToP NQiwu2JfLclKtHFyJXotYPC0KTdwj7hr2fCNb64CZ11cmExOTRiVzeou/EaylAFo/JlJeeF Bj8g8xNe+Wx44OmnZH2tw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:MZ8SNlbuP2M=;1LBbKM+egVLysEKF6+20GcIt7IG OTSpk0R4v0u6ABsWKRl2vRG+RS/4hgJNeecQ0YPMxQmFdO3mMtXFbc20tzeb6gQ/f7eK5ItTw gM7lFDVjYOVyhaeTP4p5aO2nLdQcy7n2PPTzMs9NtMwryrs0uH1+YABDNnMov5/7HPCBHVwXG QC8A3Stpo4mLDjXvnqgJnSTOja1mPtOKYDW4iqZ+TjXkzEQzH02T3CFAyXb4r0kNnket6YK+E GaIhSEJJSs339++eKKQdFNfpoh4cTKzp+38muGFav4/FB96FmiJtjkkiZTWfDspO5NsJCng5G LYCbc34a+PNk8ciLpgVTd0yDkOTY4fREyNRqSfou7UYAkA4RkT1BG+eCRcKstlDC0X6i5sV50 7CtgPPuzHvRBdyPUYJPDucGGpOvUvHalc0osybQfkFySkKeQ1CC7Dlyk8VLBeGiP9BqA/UYyu ltCs17m1TLMZN1TmakxSwdgvB2IRfuafA9Jc8NDOMWIziKw+uBJjc9wy4yX/GY4r7Jm0XK5e4 jtWkkTEqTEbFORu62D1XvXAzsbUvqvAVecg2ZxTJPc92HP6Hl7CXJ11JqTUVmJ9dorutyXMaO SUodC8KLaDID6rcsBnSHLpfLg1B26ejQq+kLrT9mDYX6XL0Wmh+icKrnj7z01y8+df9rIPfuf 01KmlYUfK4Vlwx3l2jT4B1xomQ/NDM96ICFfk/yNjl1LayNUJPkw9crSjoGB0bJ0PfMJJ5pcj ITASLjh0BFU+aX9GHC9pnvLn8EHMoqsbuL7ogdKUdDGQ20hMacL+Zsck0Rfogx4tqF0bCRHpU ttbw0QadNk7Y38nnvfDWWDtCVCWzwNt2Y6NZ7aYlOsLD8i7wjzMyQL7j6jtXKBVvz2gvjeGkq H5jllzPHPp1gm/2p7bQ0rLFjPGwD/JKsZLk2EPLDKAu7DFeon9bakXnjZwZRezSLGmKY3mTBU bxsXPEAVWnMJ5c7Ok3ntvJhYvEWdvk+Co28067sGxyxWN4wi/hZt3RdcUJcSHMagdSWUn34iW OR6HBfyrKar3Us8vOb5OyCBjg59R4d9JZLr+LGwLd1Y6eYKRTdggExU1W21T5nSVbMpb1qUCf NWnNpXokm9CGx9TlcH+15lXp+rNW1O 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 | 114 ++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 34 deletions(-) -- 2.39.5 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index ac4500f33b8c..2c1ea6155bd3 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,10 @@ MODULE_LICENSE("GPL"); #define ACER_PREDATOR_V4_THERMAL_PROFILE_EC_OFFSET 0x54 #define ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK GENMASK_ULL(7, 0) -#define ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK GENMASK(20, 8) +#define ACER_PREDATOR_V4_RETURN_STATUS_BIT_MASK GENMASK_ULL(7, 0) +#define ACER_PREDATOR_V4_SENSOR_INDEX_BIT_MASK GENMASK_ULL(15, 8) +#define ACER_PREDATOR_V4_SENSOR_READING_BIT_MASK GENMASK_ULL(23, 8) +#define ACER_PREDATOR_V4_SUPPORTED_SENSORS_BIT_MASK GENMASK_ULL(39, 24) /* * Acer ACPI method GUIDs @@ -99,9 +103,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 +284,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 +1792,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, &fanspeed); - if (ret < 0) - return ret; - - return FIELD_GET(ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK, fanspeed); -} - /* * Predator series turbo button */ @@ -2688,43 +2680,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 +2776,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 Fri Nov 29 19:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13888932 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 366681AA1E2; Fri, 29 Nov 2024 19:34:22 +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=1732908865; cv=none; b=swZJ79GvmqythW1WWsY+8I9BYYxTQlxWZTtHHiQeKwAxtHItCNbC1KdSCqNc/t6AkULHRR8Z3zregzCdAq7KYl4Lw1CkWOVMr8WGvV9aQfjwLcZoqovxLJ1qsxr08EOuLPRXCsy7L6+ZNnGojOqjSvJN9SujfJRdDWbB+tX6+eQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732908865; c=relaxed/simple; bh=05k/9UcKLbPpUNI20HD7zkO4ItYfXtjrurnHnRktDT0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=OMFco7jnANTMbGvubcW/xXoA4zvFmdNswItkP1+rMnfHqti8enGx0iyobYqCbSVGPvTQTK8Qkb8JulryhOqURndvgo01wzGrscbWtlWuGJNR/oZjpNIwRaCXhtG4Zyc0LtgAwLG5PLCPcLQqaYKe0Q98XQqCqJwUTq1bDcG7irs= 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=bgBid7pt; 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="bgBid7pt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1732908855; x=1733513655; i=w_armin@gmx.de; bh=t6ZQnbK0ISvkSX2rlaJconU2QD2RLMH+szPFATosBag=; 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=bgBid7ptiT+N4bWNNQuiH3LrXUL6rGxMTNmvfwlOxxJgiW3UCY6+tgDN/6uzlqkP bTw5veVkw4p0DsWXbzbwT9jHCAHvY9P2Nyo/Na5LDst3ADyFHWWddTGz/NcGK5JV/ XvrM6mszwfazZFVqPKJzIBYbjSrgCvnHi3FngAQFUAFc07kGwy1QQcRQEXBMvxL9k mHFpucpHhkYIhrV6z2a4+Po722CGSppYTGYo8AArfUNA6zclN+PYCqUU9nWUjdzlQ HIZP0iyqo7aI23nyWC9H97CgUuk00WJtoqkYuyrvi6Rjcujg/IpOxBDH0qNeN42zI rm6JiHQK3c+1HWPV4w== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([141.30.226.119]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MIdeR-1tVh460pE5-0020HT; Fri, 29 Nov 2024 20:34:15 +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 v3 5/5] platform/x86: acer-wmi: Ignore AC events Date: Fri, 29 Nov 2024 20:33:59 +0100 Message-Id: <20241129193359.8392-6-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241129193359.8392-1-W_Armin@gmx.de> References: <20241129193359.8392-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:9cYNdBGfOHpmRWvfy6JWc9X2lD6GF7p6JT/rfTMaHN30+qnNXPA mFzkoarIAX07Lijj60s29W1bReT9rdEzNjLV8FaDAXkCsiJgHCj4c/WtAfW+bMxh/Peayqi AmdS8TKvZmAJSJHX9/VHILeq+Pvzp7/LRuDDmA340G6PwygbRfbPz9xcVTv2dnAeEfdYn7T l1xOCj/BHgqTwIUk17zRQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:ssdQnrYdjhg=;0cVrCF3VkamVbuGtLsEIPvOT+aS tGRDcCYMKpjqvKwv0HDBYFJzxPYXf4bQaoZiMePMzSBjaYm6asVPGPxn4wVarO0wr6hxhfr9e TP1GJFgDP6IdZkkqaJlamkY+ymhA2BYLeR0cqMdzKItlTix1Wo7ffAoqfaNnMHh1PAw4afyT9 BMkvSMK3X+xxd+0URrdpsVBITh3bEeNYT1vnzcIgHn0EfkmX71I6lKioVQi395uS/4t0wFqbk 3NIrALImcp9JRuwFwr96yOCG5rHYNQ48T0G4odKqKmA8EGj+fDCxFzHV2YV7JK/hI+yNwbbU7 XfHKR97uZvZ0XfplMa7CfrHovDjIQPzO9TDwRdWH5wKlHfyz/KKycYa9hNb/xabs5tyRXfuZf CRkVdYnEXXl6Xw6RphwFmReArZHchLtHX3ctyp38mLAYIK8lb8i+T/WYXVmMwnYI4pNnUrTxc 2AYgvkaFsX0vIdKUk4God4pxPIUY+3DPu4KPDAjQDUfNQt4Mul8/vhjvVLGkcPTgPp5+frAD3 prJBhaaGsGzVYTyv8TfzFcOiFdBAUXPBsVGZNqIZ//WanB3bnKZHn8DYSPhN8lM5gz23MkF3G /KNJjK6c+mjYeVxVGvvBbv2LD+MjLSnara/3AvbyK5BnqJ55rBnRyxmLpvn4W0kntX5dmdaj1 5nfaP0vdUCCo9/RYQOu0TsspfSwkliF/ez1BFqTu16B4PWcKBp3PWKVv6RRi6+uRysAlHkdSl 0r0GAgcW+aRziYZrQGcokjH9HFQQOX2i3FzAd0taO1D4Hxj6LhduGkJDBpJre9hvhf4Qu0VMo Kw4nxxCpXu8tFL20xLQ/eHCn5jv979G0becQ9UFGD2BqoiOCKe+8RVDdUq7xyVDHP4LVC5b8p ECE4x2t1Lk80PPp+77ZlpgNRVh1qFmcrI2JioypB71x2PRPGz8yY5iPS6GDyMBsLcDG+JAoZH oMxYzESlwajJqd/rcZjwYDc7pB/9iztWllkKuCweIH4exH0CAYQGnktTQhst9Oe8OZVW6zqNd Uni+LckXvX6BJB+AUduuWrfPpUn15GS5MdWaDAGhWUrjJ8Im2a0/cBonGmkMGiJxqk9eBUXBa 5slMJ3+dV5W2MTSZDtebNkBU0GFerI 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 2c1ea6155bd3..18fc706ea752 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -100,6 +100,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 { @@ -2305,6 +2306,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);