From patchwork Tue Dec 10 00:16:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13900544 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (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 08C23635; Tue, 10 Dec 2024 00:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789833; cv=none; b=gpaAVo+PCtpv7Y1f8Xkj6iwkxEERF+hlhBTEJplLPl886ynDMxbNRGIc9/OaaVuDKAbPTC+iwtJjHNPJnJkU7NfWil+ULBz5zh4nn8f0PqPjD35wT/DhXLAnMiDD6eT/jg2x/KoM1OrmDp7dzMcFe8Vj9fDGQ2aXCdKCEsFlxxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789833; c=relaxed/simple; bh=w8PL8xxnxxYhfjStXYwd8Cyyx6b7jZdtJLncxdh1dsw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=s0MmVCPWkOfjl5sXYhvYztBUcY6kiQkv566kUt1ruqGGcOZ+k5iuMIROC3MhA0XrqtYO7hLU8dddNW0Tt8EhYCMCQEIYyp5VWj25Zx36VZf4x6btOmBab6LjZSZdJ3liF0GxdZqOC6xyRIcHW+w5QP9kpsw9X3wpSmAl131wRgU= 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=KsO25G4G; arc=none smtp.client-ip=212.227.17.20 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="KsO25G4G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1733789824; x=1734394624; i=w_armin@gmx.de; bh=gCOj+xJwVV00bzuAA7053ZW1ofwq96/t2R3OAQyBSAE=; 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=KsO25G4GZMYYARzSk5/uYGMvHgZLOKsAFsdGcKta4mPV2eo/zuI7atwKbRbjTu2q X4P8X1CU8w56KYr+3Dcico8vd3kFIRtPk3Suv3jAkDRTux4sL+8MDBVuboQtHenlE AawFa15IlB1Fd9FbinvOfP4ny8YbnSmgAIoou+Bg1T11RWvfLcKs9RKoT95ztVECp JlDQ6BjmYcqBfbaY4Nkscn5cWigtgRuIoplwiR2tW6pFyKk7WqvDmmYCF3Xa5wjMe 9vyTvPfqeZ9FjARnfH8DaW0En/YbPhSqlz0PiCe+RJGq7G41FgndhNY5eY8ieId9h eQRiXiAZq6Hs+qQcnQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([91.14.230.110]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mnaof-1u1KTi28N3-00c1kL; Tue, 10 Dec 2024 01:17:03 +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, kuurtb@gmail.com Subject: [PATCH v4 1/5] platform/x86: acer-wmi: Add support for Acer PH14-51 Date: Tue, 10 Dec 2024 01:16:53 +0100 Message-Id: <20241210001657.3362-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210001657.3362-1-W_Armin@gmx.de> References: <20241210001657.3362-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:3knchs1Dc7BsInfSEmVfkqEtYOVgJxXVK+KcU0GitjD08neQyG4 A1HL2K7tVxrr5oQV/OWGMC40FEpN60JfwI0Nqyp5oJ29rx+CDFXvNzcr7Y2bi9MSq2oqiQf wK5OImItfkdzhGpLBVNb1MAUce06zNvMUjdmZIaEEXfNPiP9BvaHagKnK6dBHZZLPUO8Drw Mxaozwpd99Uva6Awl5Y1Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:c6G4skQDPkw=;E11znX+t5noiEc4/uuFSs8TgqY5 uUD2pBriQnCKxSEFlmOISqvxZcQMXd7SWtgM9qDmtxCba+tki9119ZJy8Zh6KSfFZ1R9g7kIO g6mZMOlnXXJC11I4kD5I7jhBM3Sj/7jogsahEJBV9hxQM8QKnVhE6f/ZozvvzhHw6rDtYzf+V 4itjLv/r5q+FUuI9c0hQBnWG518iUsVOGkrq/R941JN8XDVC2iUNuOVzAagsOHhcQq2L+3D/0 YWyXZTDEFUmVp/rLEZWvxRZw60S3lPQ4ENOgecZsb7ajPpxoTZdcDAP3P2n1n7OYA3hcv+dw+ DX4ylmoC3To/tmaMxyHN62TwTRjIC7NmrR5/IR16UsslHfl0ARwPSdOPteGiV8amsiX9ak+nz aRV9TB6+vOWq/eNMc60juctZ3xMvBu9RrB+JJbx0Cw9IuuiM2Ob3uhdBYYNCRCYI2qypPYGtR IrP1CJFIx4Ema5oWsCqEm9LN3MhhIqOW2PInTP2uWK/LevvNjIQIqPUbtio9mbo4B1UTq9SGY 6wlMQCl4ZQEp0Z5WhTntqwpli+peHLDgHuZaolPKCAn7lzOl550PMRPXWC49w464rDPvECbYk 42d1jf4ddc2zyYo/MsSrvBly2IK94FH5pcuwUy6trQEah7Ij43nPjKhZ7ydTZIVW/5LuKgKU3 A1FEC6/uFy+0rk4i8x8l1McDSOV5iFEKUJ6nGjV0K/V7wYAZcv9Eh9/F9Qt7DZJtsR+cIKA9m W8XVlHQPCMQHSzxHiIQwPV5KF2XGnUd0Wr3prxvvRxhOp8C7iDMDY8UyheVKu38BzoWVaXoyM K9sqJal5NVIBvF7ALbDh6N0XwLLfYLazKo/ZAjkeWsPglpmmseDJrLfGv/DUFpuxjHvKGn7Td o1WdnrYw3k63t2v6FIwiaR6QNBZm/ofPzu0kKBsWaXzruuEfpkDKNf3uOOjukm7Z9FFOMW7cv 26BS7OQcCY74910ElA6EIWG4jRcPGIqfvprOj+RO2U6ZpoCkQQnIe0u5f66x4YerKLlv1u35Q HZnrNVN9I95Ejweht89heSzwDxsc3Jm67tzl5NvnN1Qz6gX7rSEi5wfV624VenGBlMDvJB2zp dDA1lUqV1wHuYC/d1iCvyqKVlYZuSu 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 Tested-by: Rayan Margham Signed-off-by: Armin Wolf Reviewed-by: Kurt Borja --- 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 Tue Dec 10 00:16:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13900546 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 9C12022092; Tue, 10 Dec 2024 00:17:13 +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=1733789838; cv=none; b=fi2ZKOcZVHy5cQyrjDvvJZ4w00r514tyYVNsETVqkcwIoOAhoLRchxomniYTpZJjfwYFEpQMIuU2AjOTZ3RG8D5LGsnu8goAFMoaaZ/nSl9l/PpqexWgpgS8wC/o6PW/mL/wB3WJmhvvmkRq972ZMUJvwFFB70c37MhW7A3f2xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789838; c=relaxed/simple; bh=v+sXfz1oM7wXmwoHIze+M52VRroFDA8ocPKQT4ya83U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KgjG3XIyvlwkeM9+QK51KvLGC9ppj+EcYwH8g5pmlBIN1MemjBmdqP1/ovIhlhFhVGwwO4GFK+6C3t8+F5HkevUCZR1Hq8+uDxCAwiFRjZ2M75fxEdWzg1alFKkFkjCBpPeBUy3sdUEvNIUTFi2RmGcJmlueqgHzbRbB4BTxtxs= 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=jHEe/Jcc; 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="jHEe/Jcc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1733789825; x=1734394625; i=w_armin@gmx.de; bh=6AZZ9ZIj8Gv1TL0afhlCyYIVoAXwvnQSYV6fyId62+U=; 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=jHEe/JccWPzfVtbTZSgw5cNA8AKTyBjgGU0BcG5yI7n8B35nH6kd/K/tRaj1b4qg ssGnxYK2pNzk1zhPT/lZU013u/gCUTrs5vpnpHy4HXtiHaROaSyfAH0JX6Okv91Cu qAZXnGx6Bn8P0GxP9KuPg8GMaicv513qW7iEpG/j2/hScK7TvhoD+pfLUAnQUVqJX d1m0vVfmjj5vYdUlnUUMkhtDYzkz4m+wNcewA8FcOYn/wT1aHwRSLBR62LmjEftzk dsvgW+uwjBbyUqPfAJxwTY4DEoqFafF3l2kZ9xJASes1IUIOobp/VijQaDRubRHUd KwBXpmjrbOWZxZKtGA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([91.14.230.110]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N3KPq-1tkcWh1tw2-00uNuv; Tue, 10 Dec 2024 01:17:05 +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, kuurtb@gmail.com Subject: [PATCH v4 2/5] platform/x86: acer-wmi: Rename ACER_CAP_FAN_SPEED_READ Date: Tue, 10 Dec 2024 01:16:54 +0100 Message-Id: <20241210001657.3362-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210001657.3362-1-W_Armin@gmx.de> References: <20241210001657.3362-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:/9K+nQ0rQIcNAzYw+vbKh3op/m08fYp0qv5Zh/tbl7Ru7pBsfkr srRPBO3xyk2l4+z+0BJtDgSA1J73TsIRnYCviy0wfc4MJMol69ac0bXpdWM3/Y5Y4yQBavA LA9++0TGeep1T06WuQxRxLmrcemfEWwGmgTvlePMoxnxa/OOzBy7Cqa8IaqSoxHee2q+hl1 sQoPvAAhJ+iezULmadNQA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:2TRRqFzabrA=;8w8O1SJrm6uPbtqYD/7rDnB4uD6 8UFRXE7zwUgLPrRlvN9jbK2FWAypLXTPGTRowNYPwRuA15q8oGUFiOD9beG7eqyxIOJmKJGHy PplgI4HQVRghcCOe69xy6LXFXopHgO8DjWICrLRUdnnqq1w6RY/AzlnCroBzkh5vqYRunZRjA 9uWUp7Pjn+LTC6dZxmGrQnlKvnkd13TUpmpw0Dvzf++KcJCpYFijXPPNFA9Mrnhxl1eoGDwEE XtZgH+BBr7wygnP0vE/DJyohNUqWbv8uwhLK+y0pdFn3kKlNuhR5q/iloJ2YaRW/wqgcyIG9t xuNBfiGqeX662JsqneRRVyh5qEVPmqgctDnyqqQIaVZ1sVPmYr/4zq4EaIY2OTvz1CFYYMWcO 0BF67463QCiu6EfUfh99g3rsL1BKytmqA3VeEdD579wIHBayBbXYWvoAAMO/i/o1V02oEwUTr WTciptRj1xrV5mAIE7GPLioZS7k9jpQQeEsPmOihIt+uaAFgXESwtdZbqKbUf/Iqgu1qoFa7n lihSA9PG2WM5RQfKBxzW4DfNnS0Bu9EgnWfVctrofxYwmFef3kbs/ADR9PqIg8nUUQ7vZA/MQ KhjDjwDHGB1BJkD5XFg53T0A0RfuFrxJkNuNkHDRMuXSovVsrXPy0/ei+Go3EPKV4olzLazg8 08DrNfH9uC3WeDfqXlo8DH6IU6tvh35eC5OxAlV5w0Z/wFI9x14GxAfb1M707FBf8hWDodewI sLfAYT4RM9yuXQd8AcND5QYGQ3CN/3/9lYCmVEEKqLMJmlXxstUycbz/WsX/Ew6BZta46bjjW GJUQB01RnsKm3fcJD/sUSSete+XiX4DjQyKgIMCDU4hZOdzz9WuRmD9O1i865Bg5QyHQ4Tmw6 Pst3Qa04Zdb9YKY1fUn+9d2KLd1YU4YYOPdEfqZiPJYmvVWNKgGegsuQLrDjITUQBWsPkRAqx e8dUmjmh0+rBYNdv7NGiWsUutW2u7FcghXW7VCIHL0tAj5vkKyWijmHBqCrR9T/oFQ1UxN1xW hd5WyPxzoq/RbynHOIIotPsDxko1k/yWiOyFBam4Za37sXbll1+4azpbOc6OucWQfonkQK6Y5 rva30adqLTZMKkZjMcknIL3tn+h7cI Rename ACER_CAP_FAN_SPEED_READ to ACER_CAP_HWMON to prepare for upcoming changes in the hwmon handling code. Tested-by: Rayan Margham Signed-off-by: Armin Wolf Reviewed-by: Kurt Borja --- 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 Tue Dec 10 00:16: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: 13900545 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 9C0F2208A7; Tue, 10 Dec 2024 00:17:15 +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=1733789838; cv=none; b=fpVrloovIoQj8/HVi/1qGZkzXoUNm8pPSNvp6GPWoRjJM/O+ihCHeTPM5RqNC+e+UbYA4sNll8AV9a1jyyRc4vuXoS1T3CZbRdYBPDTQhK7V1kjia+xCVSkhgIN9A8a1qTw9XA4OW4bwGeaBSZSstfst5o6gz+JFoB0EYXtFViQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789838; c=relaxed/simple; bh=LR1g7gIxaoVx0dTzeqGsXrg7xhhuaGHVl2rTR06y5Xg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LUsUiX5/IOC278Lhjjg9NM0Yye6BLnK1qiM/zn2NPZp2hCLF0aPTYg0OXC+EJBN7XK6h795IUW91NnHmXBovtKVbyjPrJo+RILa6SZd0KY3MBTrPLacMpCOp0gHm3oNzILqAlORPA8ACz389HEP4k+pevJsTWwAzbgCgjAaY1x0= 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=Pof5zVH5; 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="Pof5zVH5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1733789828; x=1734394628; i=w_armin@gmx.de; bh=9sHqBJzy5pd/TkZFigEltiiGQPEFM5EM5zZ5JqmZL9M=; 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=Pof5zVH5RE1fEtjDaYCSM8slpt8UDXiLSe5e5jcqIiKID4OAIfCkRnYNC90AnVtX Io1nWyYG3c+o8EHyp+n8MDiKV8yrDVy92n3xwHeeG/5R8WceZQ9UiG4g/NihT6W4H dRtOodUc8vcO/0Ge6qjnMIqgG+kpD5gjE6sWt9g7TixVdQf6lr44Co79EO9icJ+47 AOj+Lqw+qbOTIIyTlK2j8oIG1lZjFkl2w6JKoYZudiM9j3E/LDE680zBv+v9cLyg1 2uqf7q1qqBR7d9Ko1CKxeOaIPZI+Q6UZPArXlxo9MYBXg3uf8vS3/EMzHSi78qpPf 9PErmEDVNsngh7cLKw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([91.14.230.110]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYeMt-1t6u870U43-00WWof; Tue, 10 Dec 2024 01:17: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, kuurtb@gmail.com Subject: [PATCH v4 3/5] platform/x86: acer-wmi: Improve error handling when reading gaming system information Date: Tue, 10 Dec 2024 01:16:55 +0100 Message-Id: <20241210001657.3362-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210001657.3362-1-W_Armin@gmx.de> References: <20241210001657.3362-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:1mBd5hO5y1A45BeCH74sK3ta+g6b8CGloSWiUXcLe9zmenWCCFr cLq/TPA0JjXQ1Nl+E0hTxk7PFC+P/Tz8adOiV3JFOuO9dvkSr5bPEJeg+ISKDsJ+1usDEy/ B7l4Wge7A9+bfxdPgyYQzyxw21T+sVnkXPQV74L5tOSfJFuOIi5EHtI0Vw/bO9MvQ3iCjsD RPmkJW0tc6/T3Hesg1GdQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:H1pY/+q2f7I=;h1xA4HPQAyXpghXWIbep1qi4tfT ixZT7wjVq8l1uHMRKNvbhnYgk1ziUVjOhGGAlfV07znVINs5gekHOA6dvIc7oBSyjlOxU5mej mSEeEOPOdZCFVVvJXsS+Ga9xgEnuBfjS3KYHe9a809yw1EMLc5k9Yh3x8uQxGdBka8rMVcA2z zc2DuD271xgGhogSFZWheqGCgumqehoANUAtjm8IbSfgUDZnkK5Gv2mjgqe98jfBWSTB9PJ4G x5pg95SugVc/ehdtbLEF4DBD8QZ7oeUYfsKIeRVa7Wg8KPd5tod3o0On+0cAosmSPJLnOwvaE m0VlOLVw2dssvt18VXBUc3yNBCTLocjTzHUYnCFKMVupAN5uWgEpLcRHyI2G2tAkyGHXt9fal 450h2ToDSe/JIDR8nZC+3YHV7I8q9rl12wUQMvO8MG2NxWE16Bq60KVNyuWx5zEixnQ89VKjz 5H0IQJdxV18dPQsgXqrjUpmujsBdDOmb01R5mG+kzjgClxcxS7+JqLoszWmwYUTNBCh+4BkyO kP99gGHfLX0c68ZZ7H1ASOF41BE33equaSbScwL+j/0S398GMSxvjx5BddW/tkaUpBD6TqgaZ Aac2PSzBwvA+MElqv67i+h6Oce2fTz1fSGb2AaWgYIMvzcGTZN/BunHLMNMFIgA6t3B5H0IlZ r1HtOtbCGB5OsV0iNCJgcHIqkBJzexueAdmmvLVIrJoIDSrox2xK/04+PfRRFdpIcylbCEVJT 09kI3EIf3rTMZ8bIUF2jDoUJy23CbbDREZ92+36y1MdtwjDVFyKqerpDFYB7YcIpvLT5uziG/ hXDqbBDCUIDYvn91XNeSoUN+cdw+moGkstvm/tsYIaRSOoJSIdzdwtdzg7EJ1qbHeEH4htjBs YHvxkeEl0IJzFporSaXtD09bm/v6Y/NUHnggR1727n1eCXwSTqFbOuimo3EGdc4eYpQ4uWITx N9jq3bzFJvbMFRaiC3dAYGdW+D08xk03Mcc//FAmobG64llRSMldVvIgM/pcaDokbS6JJS0NT ozWb6mRxQCXJSynE5O1oLeJeqHNZZH6fzcL+s2u3ZPE6TI4Dc9AQpRcFHlU9TDSPKfSCkoFrW jjr1fyfQe9jsE067kT1UQs7IFCu4A0 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. Tested-by: Rayan Margham Signed-off-by: Armin Wolf Reviewed-by: Kurt Borja --- 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 Tue Dec 10 00:16: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: 13900547 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 7AF532B9BC; Tue, 10 Dec 2024 00:17:17 +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=1733789839; cv=none; b=nb2nIT6UsznTHBX6vjD5J5/q2AujXXuoDkN84dNi1dKGEVYix7xThy14tmYogLFCEC8X3itCxXZyKjhDjZWVie+d+wEkXB1smsy/JPXGXJ4K66fhXSJEhKp23EyLeN59SvlwIeVa2w4lF2ELBa1dXSR6QoNBSaJf6fwCPF8R6yQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789839; c=relaxed/simple; bh=r34yAgF017ih7tX/p3FGTkzlRWDgi+IjA6+NdmVcPUs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ifGFB/++JjDkeQ0ePQmLhxGVHfjHNUI7i0rsWl/obmoBU6d96Zx9Ld5PVGn5RXrpuQJWQKJ3n4mjcNSanWkSsYlMO10LIgA1/fo/ULG9qamvQJP6gQk1WvN1/yRiAyD9T8N3As9fZawWuTQUkfLus9oQNN7HP9+U6asB+DrCwtw= 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=XyCiVBjv; 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="XyCiVBjv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1733789830; x=1734394630; i=w_armin@gmx.de; bh=WdbwHUb6mfi2wigqcDZ1jvoMmwZIaUUy0vonFZSHUtU=; 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=XyCiVBjvJQqH5XUBQbA5NWlYFyi+YTGO4PirhGYT5V3hh14pimcbEWkcBN5SWi/d RxKq01qELfTdBPFr6iBk3Ig11FWO8q4bbXEAEeEoIb+1jjMK1VJvahKaC5X7CTdu/ ubITH7tlElHpSlk83BcbkgUSJfY5GGsn9sr3moDm+brgEXd4Vc+ct/r2xn1UBRzxQ xbqO3CsUeJ7wI5Asp2EEHrdAqzYDwANXU9WWTKLEuqxGEX7IXiUoYzh3I9kwC8xES XHcXKzpAJue7dKyOzX/1BIKEpSLfF4tModAFvX27M3CQar2AmEuOC5ltwCs18g/Gg 8nZoTQQs1gSn7Dhwdw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([91.14.230.110]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MEm6F-1tQcqE3bVz-005j78; Tue, 10 Dec 2024 01:17:10 +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, kuurtb@gmail.com Subject: [PATCH v4 4/5] platform/x86: acer-wmi: Implement proper hwmon support Date: Tue, 10 Dec 2024 01:16:56 +0100 Message-Id: <20241210001657.3362-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210001657.3362-1-W_Armin@gmx.de> References: <20241210001657.3362-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:MuCak7G+WIcPOqA/yi+NaU98YghsrzkDud2jg2B+j/25C9PK63x WpnLdojNZoLyLMiCIIxOOuYv+K5ctyvADDLOasteYzyaRmDA5/Rq3AFXmflpDoV0ay9gY1s pfDD2Yvx651JtfM6gjs//a6HeLwfT0YPHXPSSpY2KLCNq8x85oHMNZ7pQCuxBPhlb//0pgl aD2rK+09SLWv0STxCVthg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:8O4kST7heOk=;T/kr6LDhRUC5CR6Z5X4qyDclFrF zC8bifg8vV0x7HemKtXF4DWSOUbA1N3l5PgA4cKJlQeAvpvThmErdQ/D+JIaTn9BZ8aEfxv2B 9i4KNErnSUj/RssK9SykSDkeK2JLvMSWAtoYs6bhzogb5RoCVp0q+9a3N1nt8oszbxIacammA heuMxbwfiPoeAxkAAPW2BJ2X25c10E1DlR+WaSmnNnfDCjPtma/31cXr3B0pisHYay/CWW4vA rs9ky2BVOsIJHS/6bn0W3ItQCdkx7OivmBviludu8KitlRhvjVt+h9SjhV8d3n1uJDXAbyh0d 1juPOMFgyyTt5xbzdpLeWE0fWYuKW2V8CfFpKTbzSzxqES7oFdKpZgFob72OMd7OKKKXjImN6 wpzjvaOJ3SCFJ2a/w6Pb0kYQ1lycR+zMc2dyaDK4VyZw933oCIXkqgVC7cEbfRRhNSwlOKs5h vECo7b7P8fIoiYC+FxRnzinVbjgHfqnAnNgEGUhvmoiD6bddnc3WRhkVtoBqNyWJZcfrP1Tsa jrtvREIsBgJRrqeJTWX13u8MeZM3o4khLhQAqacbIOhs9uoJyGUqBMEOc5mmwlnoWhEdm6pIW xTDFPzNNmn5ELeJraudMIP/HenVSQElLagu4JFM2Mt/tx7wl6h3EbNIabBmdF1DRT6aND1usV jq4oM3q9NsWykWyc7e4fUEUeGkPjHhW5YQzJmCTQey/SxjTtG2bZC9WV6njdg5ZpHfTqhV1o/ iRE9xBnXK11pFEat4jgH5oTSfz9G/7681MhJeMKY4XFvuZvkO5tPWGjdw2oBM3yu3/a+zpXB/ Js8r+Qa3xwxJv4urBTecCH8YJ2xDYWMkCNMX7HtTOi7+Oi0YAGxS2xwnNawpzLxDJlU263map nF4kJ4Kc5znHKb0uwIoMj3joYI9K6RnAGbltZGfcgnM3XVQ03NyVgGYCDy6+0xWc7W/XHvMIx hKdCyl20EgnYiEzsOX3Er5XK5L6EtI3F0yYYycSs517qTeIe5ZWZIwTVNfCOHMrenZxc+AeVR TTbXaeC+KojQD5Ei5GDEFadiWVhIuA93VYdjvnb//ZR+XV79hCWgKJREgrTB2uAKS+4cuUnTd fdb3Bwv86On2cuZJv51oIMfpiN5+jf 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. Tested-by: Rayan Margham 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 ac4500f33b8c..aad8eb0ddae5 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_ULL(7, 0) -#define ACER_PREDATOR_V4_FAN_SPEED_READ_BIT_MASK GENMASK(20, 8) +#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 +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, &fanspeed); - 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 Tue Dec 10 00:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 13900548 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 9132870812; Tue, 10 Dec 2024 00:17:20 +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=1733789843; cv=none; b=Q/0LSKBwqLFM6phQQl1S9qlLxpjAVIhOpT4HJBV7wj2vKKsrN4bOZNhCpqoqYZ1HEzoX7rZWt/IAFn5Ub+g1BekCMrSbz5o57AzgEIfOXM+OYLDChGn415lwxaI35LU6bTstAHe8cdFdwWLlI8BcMiMQkWvhALTg0pIros1JgCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733789843; c=relaxed/simple; bh=PyFUiziYEU81rlXyeFc86BFSQplMEMqj/jZmq9uqG3c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=cRYAv32DbW1NVoeTtWYk8pbnH7GXIruC0R2AvssgrjxVZEEC4S/kt61/MaeCN26Z8wvWIbAT8YYoYLTgnYJnEcHpCMXCVy4mVWLn8CNnqtYv2Emel+KefYDGHiBr+GCpJ0anBkb5kKYEATBGYQh+Zdz7VVjw2SFZfmm9/SQqbM0= 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=pO8xBJbD; 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="pO8xBJbD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1733789831; x=1734394631; i=w_armin@gmx.de; bh=ynwFX715WAOy4YH4tt/nVds0p82RcqbxW0WOwCF/3VI=; 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=pO8xBJbD0nIrlmKOwROLUe7l4bbv9Vc2JLQUZ5wA9haXfsNBLnudTkXM83tMHSja u0LWlmqE3sKa+/UchMDPICrHd/2d4u0rK8yk9e1VtdZedwcn7KrrK3HiYn531ZUtd YC+vtrZ82IH8hHofbEelq3nzjC3DeVhCKyg43tBFRvoLCfQuQGcmw/9ukboihVELB o4gLchxvejPp3YXGy2JowZ+cslZjly8LlDHlG/UG3IamMzzYnBzgNcuAurQ5x8hgo /AG8oDIVa1ChNqvABag6ZmZRCkl53aFV0r4Soswdsl8zkfcB3WbXZpxzhEP7RoC9W 8UmuWh8FGHbjLe6q5Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-inspiron.fritz.box ([91.14.230.110]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhD2Y-1tovxd2VTW-00q6f3; Tue, 10 Dec 2024 01:17: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, kuurtb@gmail.com Subject: [PATCH v4 5/5] platform/x86: acer-wmi: Ignore AC events Date: Tue, 10 Dec 2024 01:16:57 +0100 Message-Id: <20241210001657.3362-6-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241210001657.3362-1-W_Armin@gmx.de> References: <20241210001657.3362-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:L2DgElR4FB2QZWQAU3j3F3+wSr6FYXUKneUIoMs7EIjl1l4eUYJ 1lxIekj71yrR04bjVIa/8pWP03cfHfWBVY5Mz5ZibakKuNhZyXb4zabuunGLyQLnF5UMvMm +m0jwWIt0dPShm9NAzDuLgphnyJtT+yVvo+1+FgmhYCsrQyGNjwL30ZlAutZhE8356bUw0/ U895s56M3m80gDY+WHdPA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:SsX9P+I93T0=;iQRSMHcgUDof341DwH07ZlGnhe7 SIyOeuQFIViEF2/MccnfSzv9S11dKmD1K11okrwow2xRpMKyFqOS1+tKygcnsIMLPBnlVbVgR Uk48SDmi5WMaJ1iamxxPUppwk6KNkWeMc2tsRcFBjL1ra9BZSUhyYTdeV7uM8JCeVifvuvWZu +FEbqN8XdkYLnRQWMvgoo83Ny+bm2oB0e0mwx+gJ5XfIj0PjU6oRtEBw45a3Y1NYe/fzlTsWU vFrTb9BELt9s3RMKwEabhXOvXTUClbXqlt4E5IbrixmVuukX8hiDgh29a/3GWsC96lOXsee5X j6bpC85uaF6YwQdxllBBQWq9ymAxylZifSEs/3aSeXfCno2u+PJNrLMqMgTH5whJSADgGdQgH iiISog/Fe4/SqQIoOEiJ0wttH0twjWfq0QvX+RAqxePlJ1bFR4t9CHpCTz4uIH3sUxLMQYPJk E0RKhD4TVnIkksEYLhhSYmgWXIjPVoM2FHPy68NivlOyDgtDWqtTHoUK1QAkhI2PrrNiXnmSd pH38Bun+xruzKdor2WYtz2lhs8gq566qbp7/NWvexF5O0FHv/37OdLjVf17S+F7cKBPNywRrn 6MsoOTlc0LofIg/0OUmGV07sxxDKJWgUjXR6xhLhwKojmtRs5xnMUUhDfIHs3crWenuGdZu+y d1XmC9RFd8JnwaXhNcZhf1pEpdjLT8M7DY/AH98d7x3ZLpz/cF6KdJgYjeiVxmmoV41bLKxis repYUXrYTDnbpWhdlLwMj/aWCKP5eb/UdyHDVz+S6LO5lRL2N3stqNlxw8N3Uy08xrvI0T3yv hJ8qOBsso+Bw852J18FQDfN5U2+aRHoGM0AgvabFbluntz/kr5QEdZtk8pTGzVf/dAW4ilvKK vG8rLmeqocWWgmLqcTTiqPB0i+Ykvs7X6F+nlXpbcMV0i78+oC/czbGt852Jrh1etmlwuZtM5 eU8wWAysXI2ccSTpcRqIS+SSNNEbxlBXl/Yj8K0FGwx2ymvYg9TvQ8RiqdVYjpMqFKcVwL8EQ f4UMMVqEvvLnuDHgfxd5SmzVt8Q7pDg5lliaSMGQZs4rExxE44y8mnoEk4lVjTJWnp8iombE/ 2qh5fWa45KsD3HXWSuUKovr0bO3VGh 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 Tested-by: Rayan Margham 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 aad8eb0ddae5..ef26ec8d90ea 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);