From patchwork Mon Jan 9 13:35:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Pauk X-Patchwork-Id: 40874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2162296wrt; Mon, 9 Jan 2023 05:42:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXspoO6+0SKwb2OEYlDFvi/FCLWezuCy6tzlcecfqDjWW8/HPAKtSvDLUnRjgtXMBtWzBkkn X-Received: by 2002:a17:902:d716:b0:193:3450:33ff with SMTP id w22-20020a170902d71600b00193345033ffmr2968373ply.6.1673271769852; Mon, 09 Jan 2023 05:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673271769; cv=none; d=google.com; s=arc-20160816; b=frc4obuiLUp0BMvKTIE6dopyiRCtv5mjeK5PIeZmAwLGmq72AUUC7tSJ4fitPeWGlh RF5Y2AnduD6IrrVg1wD8U2+gN2qxfvK/jSs4Nr0/l+4KizDrO2iBXVLz9bGFoqyI803r hNeiUeNYRZ99H1XDE7SoaOCAKMvHMqeVhMuC3Cmwwdlra+HyM0VHggT9qRdLFjyav9Cb Y1H8Oj0nErkxa9eyLHvmQ4Xlpy29SLVwPLaH50s37PBhG9tEJBBYbBHz7NuqDuATNd0k GGEtWA1mVGDOz2LE9C6KKoAQ/9T2nEtBm28SDaORQHrL1W/mVOJslxCM+8Oy8yfdf+Ez AJMQ== 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=UcQHq5l0wpBjI+AxrKEaHx72O2ku65M7tu8mRiPq9ms=; b=ZCB58GBbgvqCx2vsUk39osz4e3W4fCcdJhZzHa7ZSJwBIhuWsD4xu2z1ZauzdAm8HS PZF3lJChAeeDOk+wwQB5p7HtVXAhOR5MHhXPlHemndijaD+vjI/VD0VAmFhg2PKkG0Tc brCAemspaQFwnfztBae6B6ByZ/PFpV5jWe/22MowxYdYkWgsL+vu1n4oN97MBcR1S3J9 3RvSZtRlmjj3JheLGL3+wgcnlhtYfh7oIBW99zzrmsO6+j1UD4ZKwcj0iozyE0ZMoCFo 1KtPkQ0BshC6r1WAJ9D5+F4fYNoIqdqeuztowONW6/6I979Ri85/Tzd8/yv41GDnLlES EUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=R37BRnLr; 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 126-20020a630284000000b0049973629492si9790570pgc.536.2023.01.09.05.42.35; Mon, 09 Jan 2023 05:42:49 -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=R37BRnLr; 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 S231126AbjAINj1 (ORCPT + 99 others); Mon, 9 Jan 2023 08:39:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237367AbjAINia (ORCPT ); Mon, 9 Jan 2023 08:38:30 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF991392F7; Mon, 9 Jan 2023 05:36:18 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id ud5so20150611ejc.4; Mon, 09 Jan 2023 05:36:18 -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=UcQHq5l0wpBjI+AxrKEaHx72O2ku65M7tu8mRiPq9ms=; b=R37BRnLrURr51HoEOBwZgPNTFhrBBnEi0ZKJgN0A3WdBrLqegypW2eCr5y7RUOCbB8 MyPbFJeTO2oPzmtNZhouHcgWLRNko0/1CuH+eMI8KfZT4PllyIluO0k1tivUMMs1EQbz XmYrzrL4IhLqVFM+H/hih3Oie1W0XeKJbaudSrRvsy8lM96PdQZxXWCk/VPG3giZZFeS j4N2g/53Iby/mzChLwG9vI5wRykvjN1YmPwS2vM0rm3VJa0UZ11+MgEJ/VwpR0A/IKwL OavtL1eSIto/IFnl53cnSGgO1bgUEg7XzCzwl4FTIyGTgc+zq+adZKZvsaXfE7zTpot6 zIlQ== 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=UcQHq5l0wpBjI+AxrKEaHx72O2ku65M7tu8mRiPq9ms=; b=K9UiMJ5kUnOHSzKZPu4xloqYRamMcoaKBBuwUTk2L9xNOPWm03mKIgLH/bZP5ze9hI S+pMJuWnC5lUE1vTze4o3Ge3abJHkxNiX7TVg/Cb7YEAGKxy3dYgzz9Vb6itRLNYa2zg gFO2GGq6RgIfwCd9D+FFqfUlgAf4btp8dW7oXtd5LnQZwMxcBxVXcOVuzBJRNrP3nBeD oC60FgFw1EJ80OHPZ6RPcbHrOY9E/piy3dOc0qdPCt6lRmo9Ytz4MqF9peWOZ2lP42Xj VwjNjw5GtdVt63eohfCb1YQbGA7TxI6WRHsF94xnUhxGOhhlLhpk3z0maqRFecQZFwEW hZ0w== X-Gm-Message-State: AFqh2koB9ihHEt0dKdvb5dsxG8KDQp9raWIVKUY9q47gqDVUhPuMO8lR RDqt8PhsOL5fgLHogHknpybP0JcgzGpAew== X-Received: by 2002:a17:906:9c8e:b0:7c1:4a3a:dc97 with SMTP id fj14-20020a1709069c8e00b007c14a3adc97mr68688573ejc.0.1673271376849; Mon, 09 Jan 2023 05:36:16 -0800 (PST) Received: from localhost.localdomain ([46.211.15.47]) by smtp.googlemail.com with ESMTPSA id e20-20020a170906249400b0084d4cb00f0csm812918ejb.99.2023.01.09.05.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 05:36:16 -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, sefoci9222@rerunway.com, sst@poczta.fm, to.eivind@gmail.com, torvic9@mailbox.org Subject: [PATCH 1/2] hwmon: (nct6775) Directly call ASUS ACPI WMI method Date: Mon, 9 Jan 2023 15:35:35 +0200 Message-Id: <20230109133536.5720-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?1754552619425259996?= X-GMAIL-MSGID: =?utf-8?q?1754552619425259996?= 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 --- drivers/hwmon/Kconfig | 2 +- drivers/hwmon/nct6775-platform.c | 100 ++++++++++++++++++++++--------- 2 files changed, 72 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..7f5b430e1e2c 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,44 @@ 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" + +struct acpi_device *asus_acpi_dev; 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; - - kfree(obj); + *retval = (u32)result & 0xFFFFFFFF; - if (tmp == ASUSWMI_UNSUPPORTED_METHOD) - return -ENODEV; return 0; #else return -EOPNOTSUPP; @@ -1099,6 +1102,53 @@ static const char * const asus_wmi_boards[] = { "TUF GAMING Z490-PLUS (WI-FI)", }; +struct each_port_arg { + struct acpi_device *adev; + const char *match; +}; + +/* + * Callback for acpi_bus_for_each_dev() to find the + * right device by _UID and _HID and stop. + * return is an error to exit the loop + */ +static int nct6775_find_asus_acpi(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); + struct each_port_arg *arg = data; + + if (hid && !strcmp(hid, ASUSWMI_DEVICE_HID) && + uid && !strcmp(uid, arg->match)) { + arg->adev = adev; + return -EEXIST; + } + + return 0; +} + +static enum sensor_access nct6775_determine_access(const char *device_uid) +{ + struct each_port_arg arg; + u8 tmp; + + arg.match = device_uid; + acpi_bus_for_each_dev(nct6775_find_asus_acpi, &arg); + if (!arg.adev) + return access_direct; + + asus_acpi_dev = arg.adev; + /* if reading chip id via ACPI succeeds, use WMI "WMBD" method for access */ + if (!nct6775_asuswmi_read(0, NCT6775_PORT_CHIPID, &tmp) && tmp) { + pr_info("Using Asus ACPI to access %#x chip.\n", tmp); + return access_asuswmi; + } + + pr_err("Can't read ChipID by Asus ACPI %s device.\n", device_uid); + return access_direct; +} + static int __init sensors_nct6775_platform_init(void) { int i, err; @@ -1109,7 +1159,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 +1171,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 Mon Jan 9 13:35:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Pauk X-Patchwork-Id: 40873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2162294wrt; Mon, 9 Jan 2023 05:42:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXtEV40WKqTgO46oWFyNhy0icLKzzFU96rHbMZxLfwlLDuHrU8N6x9Howz0lzSd2ml4zm4AR X-Received: by 2002:a05:6a21:339b:b0:ad:c97f:1c1b with SMTP id yy27-20020a056a21339b00b000adc97f1c1bmr97699397pzb.0.1673271769558; Mon, 09 Jan 2023 05:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673271769; cv=none; d=google.com; s=arc-20160816; b=sRuHNpM0HCPmJ4VZGFafx9SSE1/POBa3YAVwGdXN5Ox89v83fWbhupc0d7bCWm64RX u3eAnT4RtlX6iAbXI+8oaWu9CCvnt+lwU4weGdZIYNSwoI7dC3JCnmOFVhbhlABRwRkI N+EO8AvVbJYzElJR//h/Ve1fJdgL62rLHRSQDVyI1Om6N1JSdlEloSyh1WDwVp4Bjlfb Tp0cdS3dOZsBp0i3b/r04Zpb6w6MYmrL3GA9uKcRq2O0IcpBqXaOZeiDb3ymjf4KyNQL +a9T7qZma8oJmIT9aTnr/qLgIRrai4vlzg6Awn/Lyx+Sa5V/GsHNW2n8VXChmZAM13dp VAhA== 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=1Mu9hDSbTzRMUgvFYdQZZOFApJrrdYnBaeGTuNYeU5c=; b=gRSZFbdxnuLNW8B1g/ESpi6Odl1X4w6Fri4CuUxNKYWMc+uxcfEgsH5wuzQ9P8zace c6CwZ7LJFejFc9rLDyfSy86R/JpWX7hIMW6IIYGwh1QwH9XM4a1HAVIbEdUnKjDB0v8O qQEFdmBTKwdVS92fWilyDX303oSp2qytc0HuJliZLRAqzK3RE2WeUlgkFuxBtAd0ufmr KzuqK9zUTIVH8lxY9x+ngMsJ7ly14fn9OlP2bOaxlWw7Zkn/w/IYJsgxGlLDmanvzPqk 5XqEsyQKEI1s73qsweZeS+tN3vXl/41nCn1uym2Oq7r/1uqvB6bWEtL+YpLreOdCE7Be hVJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b="Mi/nEJIf"; 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 x24-20020a63db58000000b00477b0e028e2si9701566pgi.810.2023.01.09.05.42.35; Mon, 09 Jan 2023 05:42:49 -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="Mi/nEJIf"; 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 S237060AbjAINji (ORCPT + 99 others); Mon, 9 Jan 2023 08:39:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237474AbjAINir (ORCPT ); Mon, 9 Jan 2023 08:38:47 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99C533AB09; Mon, 9 Jan 2023 05:36:39 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id v10so11288682edi.8; Mon, 09 Jan 2023 05:36:39 -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=1Mu9hDSbTzRMUgvFYdQZZOFApJrrdYnBaeGTuNYeU5c=; b=Mi/nEJIfVqoxaA2Fvj3l8Z9FQxKpYg0BswYPQdjDG3BvBZQOSOL3XYJzXRgOWRyhPQ 2bvmaT2KDd+5ldvoWVFcqDb+CvNe5QXIQGNcwseNBK+bw9rk9tI0YNBXQqigq+s9xaz5 AblefvhwNMOV8DhqC2lqZDiCmpLDn1jsEAF/ZG2N3tnzC3vTjjNc/qGHGdJSNKgmSqdy dq63IU2+pSv803Fy1HBYDEZ/I6o9HGYq4ytG/YktgTYiEeQssKetF0j7qpfzLk0GOYgK Yl8xfVDoALC6nYAoCZzSTvCb8NJjV4k0dN6EsWCKLRchhnJx+UvyjvQlEh7cm2W6nls5 S2Bw== 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=1Mu9hDSbTzRMUgvFYdQZZOFApJrrdYnBaeGTuNYeU5c=; b=KDsWmsIGqthPmAOVMZ6VAjrXjjfAb43kFZSEsBG6NembqsGJeVjQ/3BdjdkwFe+BJX 2naoc1EUHxp/ZO7I2D9dpxgZCKb+wGSAMViv3zgXoROki/W0irt7unvRtwAyDeReoMdi hjCiu7a+FYbiL59raio+6HSmJt813ESu/ZOxGnjSPliqAu+bj4UTGoKia0yChvZcVBJY ohaXZiRBRKM4t2BL7ea+l0zmaVcz7ZWaFM2AUDN5VtYohyzCxG1HGOaMF1V6EqOaR37t w0IdcMqc7X9WR1ijiyvmiN7Dqp8pIpS+21oJbe8h8GxGSz7yTv5qJKgutWSKSk+i8wjx 6dSw== X-Gm-Message-State: AFqh2kqXfxCL9aYnSMZL4Nn/eMRLsNs4P3vssBc3xEEKciDPUXMD8mU/ wj8aeT6PAL6tsSAz+GBI8gI= X-Received: by 2002:a05:6402:f05:b0:45c:834b:f28c with SMTP id i5-20020a0564020f0500b0045c834bf28cmr57783370eda.9.1673271392633; Mon, 09 Jan 2023 05:36:32 -0800 (PST) Received: from localhost.localdomain ([46.211.15.47]) by smtp.googlemail.com with ESMTPSA id e20-20020a170906249400b0084d4cb00f0csm812918ejb.99.2023.01.09.05.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jan 2023 05:36:32 -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, sefoci9222@rerunway.com, sst@poczta.fm, to.eivind@gmail.com, torvic9@mailbox.org Subject: [PATCH 2/2] hwmon: (nct6775) B650/B660/X670 ASUS boards support Date: Mon, 9 Jan 2023 15:35:36 +0200 Message-Id: <20230109133536.5720-2-pauk.denis@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109133536.5720-1-pauk.denis@gmail.com> References: <20230109133536.5720-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 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?1754552619070700069?= X-GMAIL-MSGID: =?utf-8?q?1754552619070700069?= 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 nct6775 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 --- B650/B660/X670 boards use NCT6799D and code is checked with https://patchwork.kernel.org/project/linux-hwmon/patch/20221228135744.281752-1-linux@roeck-us.net/ Feedback form Jeroen Beerstra https://bugzilla.kernel.org/show_bug.cgi?id=204807#c282 nct6799-isa-0290 Adapter: ISA adapter in0: 1.37 V (min = +0.00 V, max = +1.74 V) in1: 1000.00 mV (min = +0.00 V, max = +0.00 V) ALARM in2: 3.39 V (min = +0.00 V, max = +0.00 V) ALARM in3: 3.34 V (min = +0.00 V, max = +0.00 V) ALARM in4: 1.02 V (min = +0.00 V, max = +0.00 V) ALARM in5: 1.03 V (min = +0.00 V, max = +0.00 V) ALARM in6: 752.00 mV (min = +0.00 V, max = +0.00 V) ALARM in7: 3.39 V (min = +0.00 V, max = +0.00 V) ALARM in8: 3.30 V (min = +0.00 V, max = +0.00 V) ALARM in9: 1.67 V (min = +0.00 V, max = +0.00 V) ALARM in10: 560.00 mV (min = +0.00 V, max = +0.00 V) ALARM in11: 560.00 mV (min = +0.00 V, max = +0.00 V) ALARM in12: 1.03 V (min = +0.00 V, max = +0.00 V) ALARM in13: 496.00 mV (min = +0.00 V, max = +0.00 V) ALARM in14: 424.00 mV (min = +0.00 V, max = +0.00 V) ALARM fan1: 755 RPM (min = 0 RPM) fan2: 819 RPM (min = 0 RPM) fan3: 712 RPM (min = 0 RPM) fan4: 0 RPM (min = 0 RPM) fan5: 674 RPM (min = 0 RPM) fan7: 0 RPM (min = 0 RPM) SYSTIN: +31.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor CPUTIN: +36.5°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor AUXTIN0: +39.5°C sensor = thermistor AUXTIN1: +19.0°C sensor = thermistor AUXTIN2: +20.0°C sensor = thermistor AUXTIN3: +73.0°C sensor = thermistor PECI Agent 0 Calibration: +54.0°C PCH_CHIP_CPU_MAX_TEMP: +0.0°C PCH_CHIP_TEMP: +0.0°C PCH_CPU_TEMP: +0.0°C TSI0_TEMP: +64.5°C intrusion0: ALARM intrusion1: ALARM beep_enable: disabled --- 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 7f5b430e1e2c..b0c6958809b9 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" struct acpi_device *asus_acpi_dev; @@ -1102,6 +1103,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", +}; + struct each_port_arg { struct acpi_device *adev; const char *match; @@ -1173,6 +1220,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); } /*