From patchwork Wed Jan 11 21:22:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Pauk X-Patchwork-Id: 42202 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3543666wrt; Wed, 11 Jan 2023 13:26:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXsE4sDiMvBvimYw8z+mn8iROKV9LayGTlTY39lTn66Oin+Uq8oNSdBCYeq7pIJLUTpae9+X X-Received: by 2002:a17:90b:3945:b0:228:cb86:1f77 with SMTP id oe5-20020a17090b394500b00228cb861f77mr7460894pjb.35.1673472374210; Wed, 11 Jan 2023 13:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673472374; cv=none; d=google.com; s=arc-20160816; b=t5jk6ZNrsv29krFIp69iHgPI/zD+ucVZB+ZyhAU0kLJHf/LnXOSKR16XsEw4rXrQ6Y uTW6Xzsz3Vrl3l3Epinf9p8hTWx8C5TTzwR+pWpCQ6S3GZDA2MY6K6xfOWdAH/Urfvwb 6Vtdq+DlKx+9RoQKBfYwbnwehvY0ge3llqvvgjrvajD4yxi/vYL67zSSTipE/7I6vUnb gzW61QuD0hgdSDkGLes9uNDQo7DstFW/p7ipLcxaTV3uD36+hGj5PC34BKLMzM4APx7r 3+ac66+5+uk2dKRiDI9ajL1v47LFQpXTX84ctLxcntfKadxjjTMHMJCSvWQ2VEi+yQX/ 73lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=QOUpXWIQZVPllnV116T2oRqJpSbva6z4Nv08AK7LaeI=; b=tq2vMCUBAB1B7Pxjt/l/ZSJIsk/fEHqhA9l44J5/H+CPC7gjNji5IEe1pisjKkjwEr nwKFwQoTO+0wZ4TFlH1j6PbMWFYyINfrKyy69qTIh61DgWdC4hOiYCH1NQHHVrvCc0Wx ZQRWWkLhm9rZG4PSE5rIMKVNQN5Mv+YXsXmeqj9ldttOqHvSZJmk8SwuiOUOtI1ThHV+ U5pSy9aPvAyUtIiQ23BHiZdpYKx8U5Cj1ajmhQ4lypVPRkFOESerfbBr9Frj9kqJQE0+ i54jqSKggCuCgrrSuatxlhj4+O5IMOOdfhsJenoEX6ws5sjm9DAmwNMQmb1ypVacvaVO FZtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=g0nLEz5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw12-20020a17090b4d0c00b002270c47059asi10821645pjb.114.2023.01.11.13.26.01; Wed, 11 Jan 2023 13:26:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=g0nLEz5w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233358AbjAKVXK (ORCPT + 99 others); Wed, 11 Jan 2023 16:23:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234134AbjAKVXH (ORCPT ); Wed, 11 Jan 2023 16:23:07 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B914BB1; Wed, 11 Jan 2023 13:23:06 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id z11so24303667ede.1; Wed, 11 Jan 2023 13:23:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QOUpXWIQZVPllnV116T2oRqJpSbva6z4Nv08AK7LaeI=; b=g0nLEz5wO+X+wh08R+6Mb6/OJbIARU4vnnbt4JtiBrWCjJplUj4O0SUm14svQDeuEN zdm1ZctfsYQuSyPtKisL3mDJp5CpJZzTmuwQi9wdkLnNOHQRVQaxA0aSgP3jgkSSG8cC DfkSd/A6ttceyGW1cReQnfbJmn7NBKLJE9wS9ZdUk7aAWVbkBAMoCsFpjKyMvGk4rSsb NEwAtK5yVuhPczii4LZH9RvfNqylxq1Dr1nkpB9qzBHwvudehW3jZNYvD50sFGG1Xa7i Ohqjn7ycfo29wsUj7AzJqkXE6K/NpwSY4HADYprLtDD0ZfdnrKObzrDwv/e8h80khtDr z0Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QOUpXWIQZVPllnV116T2oRqJpSbva6z4Nv08AK7LaeI=; b=hUvkJeW99YiFRg43o6Fyrc3W1fcgxp8ubGzWn1uGBKZX7q7OzQbIU0L1MsSUwa8l8T UBAlmUgKbPdjsyy8vU+w2T5FqMoNU+hBcvUit04+5ijgI0GTjaQ+5QgXv7j5/q8QZUWv 4k22riNJZw0W5hBt1/bodjXTF+OOAuoVsesNdXBykEpzWsk6WuweIxTncpXbXiV0X1GU StQtXul9aJt/oDouoPv2dQQHQDbn6ybk7IHANUHXIgY7b/cZfGDJaT/0YwRX2Kp78LyO ncMKIoP/kpzBx1hCVPxbTBMBm2XFaxo49I4JFSY8RauwQ/qOEc9wRUViaCjiDwoU5Up3 KmhA== X-Gm-Message-State: AFqh2kpVnO7yzv0ytNU9Qw97uH+J/y9DWZtqGNg1Kbb43U3A3Ec8IT96 q/nCKcgjdH77Zc59+9Hfx3g= X-Received: by 2002:a05:6402:3807:b0:47e:eb84:c598 with SMTP id es7-20020a056402380700b0047eeb84c598mr62442473edb.30.1673472184520; Wed, 11 Jan 2023 13:23:04 -0800 (PST) Received: from localhost.localdomain ([46.211.95.50]) by smtp.googlemail.com with ESMTPSA id s1-20020aa7cb01000000b00463b9d47e1fsm6477588edt.71.2023.01.11.13.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 13:23:03 -0800 (PST) From: Denis Pauk Cc: ahmad@khalifa.ws, chunkeey@gmail.com, greg@krypto.org, hubert.banas@gmail.com, igor@svelig.com, jaap.dehaan@freenet.de, jdelvare@suse.com, jeroen@beerstra.org, jonfarr87@gmail.com, jwp@redhat.com, kdudka@redhat.com, kernel@melin.net, kpietrzak@disroot.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux@roeck-us.net, me@rebtoor.com, metalcaedes@gmail.com, michael@theoddone.net, mikhail.v.gavrilov@gmail.com, mundanedefoliation@gmail.com, nephartyz@gmail.com, oleksandr@natalenko.name, pauk.denis@gmail.com, pehlm@pekholm.org, renedis@hotmail.com, robert@swiecki.net, sahan.h.fernando@gmail.com, sebastian.arnhold@posteo.de, sst@poczta.fm, to.eivind@gmail.com, torvic9@mailbox.org Subject: [PATCH v4 1/2] hwmon: (nct6775) Directly call ASUS ACPI WMI method Date: Wed, 11 Jan 2023 23:22:40 +0200 Message-Id: <20230111212241.7456-1-pauk.denis@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754762967929555407?= X-GMAIL-MSGID: =?utf-8?q?1754762967929555407?= New ASUS B650/B660/X670 boards firmware have not exposed WMI monitoring GUID and entrypoint method WMBD could be implemented for different device UID. Implement the direct call to entrypoint method for monitoring the device UID of B550/X570 boards. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk Co-developed-by: Ahmad Khalifa Signed-off-by: Ahmad Khalifa --- Changes: v2: Rename each_port_arg to each_device_arg Rename nct6775_find_asus_acpi to nct6775_asuswmi_device_match Remove unrequired return -EEXIST, and iterate whole list of devices Make asus_acpi_dev static v3: Restore break iteration logic in nct6775_asuswmi_device_match Add config check if ACPI disabled and acpi_device_* are undefined Pass device_id as data parameter of acpi_bus_for_each_dev v4: Hide asus_acpi_dev definition inside ifdef ACPI @all Could someone please test updated patch with B550/X570 boards? @Guenter Roeck > 0-day reported various errors. I suspect those are seen with CONFIG_ACPI=n. > Have you tried the build reported as problematic ? > > I get > > drivers/hwmon/nct6775-platform.c:122:28: error: ‘asus_acpi_dev’ defined > but not used [-Werror=unused-variable] > > 122 | static struct acpi_device *asus_acpi_dev; > > if I try to build nct6775-platform.o with W=1 and CONFIG_ACPI=n. > > Overall the #ifdefs in the driver get a bit out of hand. I think it > may be time to consolidate that. Not necessarily now, but sometime soon. Thank you, I have missed it, I have rechecked with: make W=1 CONFIG_ACPI=n CONFIG_SENSORS_NCT6775=m drivers/hwmon/ drivers/hwmon/Kconfig | 2 +- drivers/hwmon/nct6775-platform.c | 99 ++++++++++++++++++++++---------- 2 files changed, 71 insertions(+), 30 deletions(-) base-commit: b0587c87abc891e313d63946ff8c9f4939d1ea1a diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 3176c33af6c6..300ce8115ce4 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1516,7 +1516,7 @@ config SENSORS_NCT6775_CORE config SENSORS_NCT6775 tristate "Platform driver for Nuvoton NCT6775F and compatibles" depends on !PPC - depends on ACPI_WMI || ACPI_WMI=n + depends on ACPI || ACPI=n select HWMON_VID select SENSORS_NCT6775_CORE help diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index bf43f73dc835..e3c3b35c8138 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "nct6775.h" @@ -107,40 +106,50 @@ struct nct6775_sio_data { void (*sio_exit)(struct nct6775_sio_data *sio_data); }; -#define ASUSWMI_MONITORING_GUID "466747A0-70EC-11DE-8A39-0800200C9A66" +#define ASUSWMI_METHOD "WMBD" #define ASUSWMI_METHODID_RSIO 0x5253494F #define ASUSWMI_METHODID_WSIO 0x5753494F #define ASUSWMI_METHODID_RHWM 0x5248574D #define ASUSWMI_METHODID_WHWM 0x5748574D #define ASUSWMI_UNSUPPORTED_METHOD 0xFFFFFFFE +#define ASUSWMI_DEVICE_HID "PNP0C14" +#define ASUSWMI_DEVICE_UID "ASUSWMI" + +#if IS_ENABLED(CONFIG_ACPI) +/* + * ASUS boards have only one device with WMI "WMBD" method and have provided + * access to only one SuperIO chip at 0x0290. + */ +static struct acpi_device *asus_acpi_dev; +#endif static int nct6775_asuswmi_evaluate_method(u32 method_id, u8 bank, u8 reg, u8 val, u32 *retval) { -#if IS_ENABLED(CONFIG_ACPI_WMI) +#if IS_ENABLED(CONFIG_ACPI) + acpi_handle handle = acpi_device_handle(asus_acpi_dev); u32 args = bank | (reg << 8) | (val << 16); - struct acpi_buffer input = { (acpi_size) sizeof(args), &args }; - struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_object_list input; + union acpi_object params[3]; + unsigned long long result; acpi_status status; - union acpi_object *obj; - u32 tmp = ASUSWMI_UNSUPPORTED_METHOD; - - status = wmi_evaluate_method(ASUSWMI_MONITORING_GUID, 0, - method_id, &input, &output); + params[0].type = ACPI_TYPE_INTEGER; + params[0].integer.value = 0; + params[1].type = ACPI_TYPE_INTEGER; + params[1].integer.value = method_id; + params[2].type = ACPI_TYPE_BUFFER; + params[2].buffer.length = sizeof(args); + params[2].buffer.pointer = (void *)&args; + input.count = 3; + input.pointer = params; + + status = acpi_evaluate_integer(handle, ASUSWMI_METHOD, &input, &result); if (ACPI_FAILURE(status)) return -EIO; - obj = output.pointer; - if (obj && obj->type == ACPI_TYPE_INTEGER) - tmp = obj->integer.value; - if (retval) - *retval = tmp; + *retval = (u32)result & 0xFFFFFFFF; - kfree(obj); - - if (tmp == ASUSWMI_UNSUPPORTED_METHOD) - return -ENODEV; return 0; #else return -EOPNOTSUPP; @@ -1099,6 +1108,46 @@ static const char * const asus_wmi_boards[] = { "TUF GAMING Z490-PLUS (WI-FI)", }; +#if IS_ENABLED(CONFIG_ACPI) +/* + * Callback for acpi_bus_for_each_dev() to find the right device + * by _UID and _HID and return 1 to stop iteration. + */ +static int nct6775_asuswmi_device_match(struct device *dev, void *data) +{ + struct acpi_device *adev = to_acpi_device(dev); + const char *uid = acpi_device_uid(adev); + const char *hid = acpi_device_hid(adev); + + if (hid && !strcmp(hid, ASUSWMI_DEVICE_HID) && + uid && !strcmp(uid, data)) { + asus_acpi_dev = adev; + return 1; + } + + return 0; +} +#endif + +static enum sensor_access nct6775_determine_access(const char *device_uid) +{ +#if IS_ENABLED(CONFIG_ACPI) + u8 tmp; + + acpi_bus_for_each_dev(nct6775_asuswmi_device_match, (void *)device_uid); + if (!asus_acpi_dev) + return access_direct; + + /* if reading chip id via ACPI succeeds, use WMI "WMBD" method for access */ + if (!nct6775_asuswmi_read(0, NCT6775_PORT_CHIPID, &tmp) && tmp) { + pr_debug("Using Asus WMBD method of %s to access %#x chip.\n", device_uid, tmp); + return access_asuswmi; + } +#endif + + return access_direct; +} + static int __init sensors_nct6775_platform_init(void) { int i, err; @@ -1109,7 +1158,6 @@ static int __init sensors_nct6775_platform_init(void) int sioaddr[2] = { 0x2e, 0x4e }; enum sensor_access access = access_direct; const char *board_vendor, *board_name; - u8 tmp; err = platform_driver_register(&nct6775_driver); if (err) @@ -1122,15 +1170,8 @@ static int __init sensors_nct6775_platform_init(void) !strcmp(board_vendor, "ASUSTeK COMPUTER INC.")) { err = match_string(asus_wmi_boards, ARRAY_SIZE(asus_wmi_boards), board_name); - if (err >= 0) { - /* if reading chip id via WMI succeeds, use WMI */ - if (!nct6775_asuswmi_read(0, NCT6775_PORT_CHIPID, &tmp) && tmp) { - pr_info("Using Asus WMI to access %#x chip.\n", tmp); - access = access_asuswmi; - } else { - pr_err("Can't read ChipID by Asus WMI.\n"); - } - } + if (err >= 0) + access = nct6775_determine_access(ASUSWMI_DEVICE_UID); } /* From patchwork Wed Jan 11 21:22:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pauk X-Patchwork-Id: 42203 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3543791wrt; Wed, 11 Jan 2023 13:26:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXulTmCLewp55TbIyXbC4zmFPGvHIBbXih06GBLp+UeK6Pc9QGzaRhmi3wfrgyAuGgNdOv9Y X-Received: by 2002:a05:6a20:4d95:b0:b6:6cf0:2d5f with SMTP id gj21-20020a056a204d9500b000b66cf02d5fmr481283pzb.6.1673472393105; Wed, 11 Jan 2023 13:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673472393; cv=none; d=google.com; s=arc-20160816; b=Dz98rS8GspXqHonuTZtHhRbOi6L7M8nubTfbmyI5pFisF9ZbOs18f+zd6YIwyJXWd7 Lw3AinGcYsMg60rDTLGR0QckEb8GGV7qwX0a2PfGo5U1EsKADujeGSWK9Mig54EQBtLv 4gfrjHzwajv0oQR4RV7BSUC8E5XlcThgNuvcItk0BPgWjFKtqQkHRE9oeTrMUVcJrJJI KHHFI6xLiNTYX57mYY9QSbV0gbjqJ/x/nTsYnhZR92hc8cf/RSiK8s7pMnwW8WHGbcib +Z0CeLduBPKb2T5F4g6h+bT7HPy/Cp4pSHv1eT59JMJJ1e0zRMtL1qPnhAt0i9xqmMw2 oR7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=aauxthsqpHaoa/2D2bGaXqvcV3u8Km9yd6EUTM6Cz64=; b=ppUoL2LXv1tnwklVArh7I4GV7MCWP/x7Eumb0canOFGkmxw/Wsz3q2h+66gcExoeAi 37r7Awkts+4kaSrJaHK+HbPH34s3ENbAwQI93s5nne2GNu+60t+bA3jKJepD5JHA3sfx aY0RhABJPp/suCvWOBseR8EWg5yUfiCpk90krHMaW1YsX0m/3Va7OHmQj7mMb08KIYYI YIkiegnmMGUCUejniLiWw0oh4SMtHmanDIBzBzvi5XTutDMAAJ182SY963AjqNhyP27c RaJW/jxaSVI8enZila674FJBaXW8OqBrByW/v5bYTxfiXVVF3pgFMhPyq1aShLgAwewP AP1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=B0pxx2kq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r3-20020a632b03000000b004792b0801f3si16252898pgr.558.2023.01.11.13.26.20; Wed, 11 Jan 2023 13:26:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=B0pxx2kq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235452AbjAKVX0 (ORCPT + 99 others); Wed, 11 Jan 2023 16:23:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235157AbjAKVXT (ORCPT ); Wed, 11 Jan 2023 16:23:19 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F1DB3F12F; Wed, 11 Jan 2023 13:23:14 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id i9so24295093edj.4; Wed, 11 Jan 2023 13:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aauxthsqpHaoa/2D2bGaXqvcV3u8Km9yd6EUTM6Cz64=; b=B0pxx2kq/jRxxCSzYcGo4a2s2oknrtp2PsYHbB00BoY94D1SXP4+/l61vr7EnzTFUa CH5LBNA2TfsCTfydNKlz6nzbHobtqpK2jPxOvMKCmEC8Y7o4DA/s2K0GPbjcWQEIBQ8D UA1h9PJYyb1k6ax8wPETEgNeKxluXuB2nSuo7V5dQTEqWvgF7yIHqN0cthSdRcWroDbh nlI22WO5Pz0ATQUy8qbL5Jma27a9J8sJOJ1CEZEdV73yle2ncf1LdApgnfpaCNdj+7od IsfaJxuIzrPzuThQcGWHSn0B2uOmHi3oyzEf3VfDwIiFYKTdmNVwaVgJZNrlI7uQaThp L+Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aauxthsqpHaoa/2D2bGaXqvcV3u8Km9yd6EUTM6Cz64=; b=7+h4MEVgHK2+LUiyxPLSMxvhWgKnbJSg8xMgymTW6xIk8NPJd06YWAaiMxhxNiDp60 GZBIYuFz/eiD6K5tSJxzD8UbUFxScxMuZyLIc8JOv7X0X/2nini5LhLRUYeVC/jT+rAH lbsVPUY9v0UBpXfuzumIz+GgTZr5An9pQk15W+ER1oQQU5rYk2T0oaXzS38UcnqcgqKw Ne4OzFwaBT7U16N6+Cad/TYBtkrEX0xT7C4upAziPqbkL4OBYRN94+aVt49o5qzHR5CC p3wDSh44/tycOp89/U6CWznXYIH8FrKgzC1uvM419cfGM3XbbPkOuuaafmHRX7ag95cs 7g/Q== X-Gm-Message-State: AFqh2koQ3Xl47iEPijdhA1aKNEbwnFoTe+3ofKZ+66gnLn3ishwEXQf/ jO8/Geb2oYTUP68yCb7/OZI= X-Received: by 2002:a05:6402:5505:b0:499:c332:3b50 with SMTP id fi5-20020a056402550500b00499c3323b50mr7446347edb.39.1673472192766; Wed, 11 Jan 2023 13:23:12 -0800 (PST) Received: from localhost.localdomain ([46.211.95.50]) by smtp.googlemail.com with ESMTPSA id s1-20020aa7cb01000000b00463b9d47e1fsm6477588edt.71.2023.01.11.13.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 13:23:12 -0800 (PST) From: Denis Pauk Cc: ahmad@khalifa.ws, chunkeey@gmail.com, greg@krypto.org, hubert.banas@gmail.com, igor@svelig.com, jaap.dehaan@freenet.de, jdelvare@suse.com, jeroen@beerstra.org, jonfarr87@gmail.com, jwp@redhat.com, kdudka@redhat.com, kernel@melin.net, kpietrzak@disroot.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, linux@roeck-us.net, me@rebtoor.com, metalcaedes@gmail.com, michael@theoddone.net, mikhail.v.gavrilov@gmail.com, mundanedefoliation@gmail.com, nephartyz@gmail.com, oleksandr@natalenko.name, pauk.denis@gmail.com, pehlm@pekholm.org, renedis@hotmail.com, robert@swiecki.net, sahan.h.fernando@gmail.com, sebastian.arnhold@posteo.de, sst@poczta.fm, to.eivind@gmail.com, torvic9@mailbox.org Subject: [PATCH v4 2/2] hwmon: (nct6775) B650/B660/X670 ASUS boards support Date: Wed, 11 Jan 2023 23:22:41 +0200 Message-Id: <20230111212241.7456-2-pauk.denis@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230111212241.7456-1-pauk.denis@gmail.com> References: <20230111212241.7456-1-pauk.denis@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS, UPPERCASE_50_75 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754762988030434627?= X-GMAIL-MSGID: =?utf-8?q?1754762988030434627?= Boards such as: "EX-B660M-V5 PRO D4", "PRIME B650-PLUS", "PRIME B650M-A", "PRIME B650M-A AX", "PRIME B650M-A II", "PRIME B650M-A WIFI", "PRIME B650M-A WIFI II", "PRIME B660M-A D4", "PRIME B660M-A WIFI D4", "PRIME X670-P", "PRIME X670-P WIFI", "PRIME X670E-PRO WIFI", "Pro B660M-C-D4", "ProArt B660-CREATOR D4", "ProArt X670E-CREATOR WIFI", "ROG CROSSHAIR X670E EXTREME", "ROG CROSSHAIR X670E GENE", "ROG CROSSHAIR X670E HERO", "ROG MAXIMUS XIII EXTREME GLACIAL", "ROG MAXIMUS Z690 EXTREME", "ROG MAXIMUS Z690 EXTREME GLACIAL", "ROG STRIX B650-A GAMING WIFI", "ROG STRIX B650E-E GAMING WIFI", "ROG STRIX B650E-F GAMING WIFI", "ROG STRIX B650E-I GAMING WIFI", "ROG STRIX B660-A GAMING WIFI D4", "ROG STRIX B660-F GAMING WIFI", "ROG STRIX B660-G GAMING WIFI", "ROG STRIX B660-I GAMING WIFI", "ROG STRIX X670E-A GAMING WIFI", "ROG STRIX X670E-E GAMING WIFI", "ROG STRIX X670E-F GAMING WIFI", "ROG STRIX X670E-I GAMING WIFI", "ROG STRIX Z590-A GAMING WIFI II", "ROG STRIX Z690-A GAMING WIFI D4", "TUF GAMING B650-PLUS", "TUF GAMING B650-PLUS WIFI", "TUF GAMING B650M-PLUS", "TUF GAMING B650M-PLUS WIFI", "TUF GAMING B660M-PLUS WIFI", "TUF GAMING X670E-PLUS", "TUF GAMING X670E-PLUS WIFI", "TUF GAMING Z590-PLUS WIFI", have got a NCT6799D chip, but by default there's no use of it because of resource conflict with WMI method. This commit adds such boards to the monitoring list with new ACPI device UID. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk Co-developed-by: Ahmad Khalifa Signed-off-by: Ahmad Khalifa Tested-by: Jeroen Beerstra Tested-by: Slawomir Stepien --- Changes: v2: no changes v3: no changes v4: no changes drivers/hwmon/nct6775-platform.c | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c index e3c3b35c8138..baac0d569a4d 100644 --- a/drivers/hwmon/nct6775-platform.c +++ b/drivers/hwmon/nct6775-platform.c @@ -114,6 +114,7 @@ struct nct6775_sio_data { #define ASUSWMI_UNSUPPORTED_METHOD 0xFFFFFFFE #define ASUSWMI_DEVICE_HID "PNP0C14" #define ASUSWMI_DEVICE_UID "ASUSWMI" +#define ASUSMSI_DEVICE_UID "AsusMbSwInterface" #if IS_ENABLED(CONFIG_ACPI) /* @@ -1108,6 +1109,52 @@ static const char * const asus_wmi_boards[] = { "TUF GAMING Z490-PLUS (WI-FI)", }; +static const char * const asus_msi_boards[] = { + "EX-B660M-V5 PRO D4", + "PRIME B650-PLUS", + "PRIME B650M-A", + "PRIME B650M-A AX", + "PRIME B650M-A II", + "PRIME B650M-A WIFI", + "PRIME B650M-A WIFI II", + "PRIME B660M-A D4", + "PRIME B660M-A WIFI D4", + "PRIME X670-P", + "PRIME X670-P WIFI", + "PRIME X670E-PRO WIFI", + "Pro B660M-C-D4", + "ProArt B660-CREATOR D4", + "ProArt X670E-CREATOR WIFI", + "ROG CROSSHAIR X670E EXTREME", + "ROG CROSSHAIR X670E GENE", + "ROG CROSSHAIR X670E HERO", + "ROG MAXIMUS XIII EXTREME GLACIAL", + "ROG MAXIMUS Z690 EXTREME", + "ROG MAXIMUS Z690 EXTREME GLACIAL", + "ROG STRIX B650-A GAMING WIFI", + "ROG STRIX B650E-E GAMING WIFI", + "ROG STRIX B650E-F GAMING WIFI", + "ROG STRIX B650E-I GAMING WIFI", + "ROG STRIX B660-A GAMING WIFI D4", + "ROG STRIX B660-F GAMING WIFI", + "ROG STRIX B660-G GAMING WIFI", + "ROG STRIX B660-I GAMING WIFI", + "ROG STRIX X670E-A GAMING WIFI", + "ROG STRIX X670E-E GAMING WIFI", + "ROG STRIX X670E-F GAMING WIFI", + "ROG STRIX X670E-I GAMING WIFI", + "ROG STRIX Z590-A GAMING WIFI II", + "ROG STRIX Z690-A GAMING WIFI D4", + "TUF GAMING B650-PLUS", + "TUF GAMING B650-PLUS WIFI", + "TUF GAMING B650M-PLUS", + "TUF GAMING B650M-PLUS WIFI", + "TUF GAMING B660M-PLUS WIFI", + "TUF GAMING X670E-PLUS", + "TUF GAMING X670E-PLUS WIFI", + "TUF GAMING Z590-PLUS WIFI", +}; + #if IS_ENABLED(CONFIG_ACPI) /* * Callback for acpi_bus_for_each_dev() to find the right device @@ -1172,6 +1219,11 @@ static int __init sensors_nct6775_platform_init(void) board_name); if (err >= 0) access = nct6775_determine_access(ASUSWMI_DEVICE_UID); + + err = match_string(asus_msi_boards, ARRAY_SIZE(asus_msi_boards), + board_name); + if (err >= 0) + access = nct6775_determine_access(ASUSMSI_DEVICE_UID); } /*