Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp733923pxb; Sat, 10 Apr 2021 18:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqC6zYKBnCuWppxO7sCerQjcJseP/99ksspCzNhkuajhj9+tiHuzCL027+lUmUcMjg6oSC X-Received: by 2002:a63:da0a:: with SMTP id c10mr20050228pgh.255.1618102805292; Sat, 10 Apr 2021 18:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618102805; cv=none; d=google.com; s=arc-20160816; b=M4diGgtPngCODoF0AoNL5Qt5gd/e4pDaRIe6aR955WoE8APQlaES3Mf5ZlSlvDTb+/ TpEimjUdquA4GSUsVFgLumd+l4RHxk1tiQtQKGj8r+qNDC+8TcJKsYMb0vL0qqZoLGvH GjT5oXUVzTJtQ7ATBxVk+b1vc7uuuu7scu3VuDSNQQ44sVujm3Xr34tZTu0/iISYcp7s StDGujRAOPy0hEL76r/ndnvV8CPVW8lJFURnnGtw3yAMn4JF877P2GlBgIRDqjl9hkgU RTTqxeJ3exC+sGmKyTW2S8FPEFI/3mNOOyiwUhR4zBs+mR8TvgB+VmMrDTkPBV79XvKk kKfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=KC+a1c/bPuTK+Simj27kp4/h8f5lo5Z0yzUDUkZXRWc=; b=bwK2Xw3H14nMa1Ste1D15W7zMve7xNPJOpSOPY4CDSKJt2/dB0VCdgH9Puv5ef+2Xk fcVnyzb9vue+7Bd9XbQMkaOWMErSCi7l5scf43HsaNbRKRh6s492Hb+OUzEGzwUBjGRU x7U5ciuIm7FjDkcDLpkO0pxxBIU0V882Zh/jgpmZCQQwIAx1/ZFrnIyYMUfITcUN3hvE j3ydYpEaSErATgUdyHUFhMxrFKwmU+OgjYUBghmcgkvh1+XK+eiwocW7NX/C1gQEOF4n JoJ3D1s7nfFOVgwTqspyoUEew885G7KtHQD7nZVNxm+2oSC5PgcR4DE2sj3AHTTds8FG y+pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnwH1O7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si9831997pjl.20.2021.04.10.17.59.37; Sat, 10 Apr 2021 18:00:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tnwH1O7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234991AbhDKA6y (ORCPT + 99 others); Sat, 10 Apr 2021 20:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234944AbhDKA6w (ORCPT ); Sat, 10 Apr 2021 20:58:52 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E926C06138B; Sat, 10 Apr 2021 17:58:35 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id k25so9882814oic.4; Sat, 10 Apr 2021 17:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KC+a1c/bPuTK+Simj27kp4/h8f5lo5Z0yzUDUkZXRWc=; b=tnwH1O7CJx6UBfa1K3gnoYrReXslnppjSjKoOHT3bLn2KmPKYNvRIzKYvieTi2xvP6 hJOnliZcz2dFCvNvhbvwHqbha2U4vxWAuafDf9/AUDNO2umIoX/o0wIZAAslmDyAV+35 lX81B9Y9zuOKuJ0hM/2DxQWBbSUaN1dIJT+KQDbfHftNp4SRIa78C/Y1jg3ZTwABQmAM 97M5K+rHfLhz63HRVpEGwfOXkBBBWZP835TBKd5zHFaqPClBkb4ZSSVdeyOwpxA9wIVD S3j9f2eGW8Etb1cX5CdLVy8oPGgd8JR+5fib1QLv9L4oH4AhBx4cnLDyLHrgQ9mqxdXA 2nug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=KC+a1c/bPuTK+Simj27kp4/h8f5lo5Z0yzUDUkZXRWc=; b=dK9/SEGgf1j30KGQAkWa+v1m/TkkIMkk8KYJjL2fBx/1+lywaChs2XEP4UqZC1duDk OI86vamxkaWMUFDqVW62VmYOQWamRPNMXjEQKbVsKdatIsGji8lkAjgLwWgYZTPQ+Cf9 w3iWzRmJzPiNGKdYgHuk/3kOfHeXjWkoGWt0ziOj533eNWUy6kJEqRkBjOHdXuO91gUf 2a2Oa4SpB5Q37dBKor0QHfQFbN3QIlyQgyp9IuGV5mSV+iGmwW2fjqguucvUq0eMCODO l6pxHxaPHTEE7z1C9JSYGsAtGHU1uXV5OQvYn8CoIklxJcgOpyG61oygVHJq8jayC24H SM7Q== X-Gm-Message-State: AOAM530wOmNRh0tooBXGOGX3TKvfYsmJq3ZcH0rRI4f3q34lb5Je3Vwy 21Kvke8+EbQV8iT9Bk2sf9yKIxBUJ0k= X-Received: by 2002:aca:af93:: with SMTP id y141mr6048249oie.70.1618102714650; Sat, 10 Apr 2021 17:58:34 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id k9sm1646245ots.24.2021.04.10.17.58.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Apr 2021 17:58:34 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH v4] platform/x86: add Gigabyte WMI temperature driver To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= , platform-driver-x86@vger.kernel.org, Mark Gross , Hans de Goede , linux-kernel@vger.kernel.org, =?UTF-8?Q?Barnab=c3=a1s_P=c5=91cze?= , Jean Delvare , linux-hwmon@vger.kernel.org Cc: Matthew Garrett References: <6a096978-67ad-6def-6ed0-9ad38a460e95@redhat.com> <20210410181856.144988-1-linux@weissschuh.net> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy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++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <9d22b45f-738b-923b-4954-ef2d573be1c4@roeck-us.net> Date: Sat, 10 Apr 2021 17:58:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210410181856.144988-1-linux@weissschuh.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/10/21 11:18 AM, Thomas Weißschuh wrote: > Changes since v3: > * Completely hide unusable sensors > * Expose force_load parameter read-only via sysfs > * Naming > * Style cleanups > > -- >8 -- > > Tested with > * X570 I Aorus Pro Wifi (rev 1.0) > * B550M DS3H > * B550 Gaming X V2 (rev.1.x) > * Z390 I AORUS PRO WIFI (rev. 1.0) > > The mainboard contains an ITE IT8688E chip for management. > This chips is also handled by drivers/hwmon/i87.c but as it is also used > by the firmware itself it needs an ACPI driver. > > Unfortunately not all sensor registers are handled by the firmware and even > less are exposed via WMI. > > Signed-off-by: Thomas Weißschuh Good enough, though you may want to improve your description. Reviewed-by: Guenter Roeck FWIW, on B450 AORUS M: gigabyte-wmi DEADBEEF-2001-0000-00A0-C90629100000: Forcing load on unknown platform gigabyte-wmi DEADBEEF-2001-0000-00A0-C90629100000: No temperature sensors usable Wonder who came up with that GUID. > --- Change log and everything that is not supposed to show up in the git history is supposed to go here. Guenter > MAINTAINERS | 6 + > drivers/platform/x86/Kconfig | 11 ++ > drivers/platform/x86/Makefile | 1 + > drivers/platform/x86/gigabyte-wmi.c | 195 ++++++++++++++++++++++++++++ > 4 files changed, 213 insertions(+) > create mode 100644 drivers/platform/x86/gigabyte-wmi.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index d92f85ca831d..9c10cfc00fe8 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -7543,6 +7543,12 @@ F: Documentation/filesystems/gfs2* > F: fs/gfs2/ > F: include/uapi/linux/gfs2_ondisk.h > > +GIGABYTE WMI DRIVER > +M: Thomas Weißschuh > +L: platform-driver-x86@vger.kernel.org > +S: Maintained > +F: drivers/platform/x86/gigabyte-wmi.c > + > GNSS SUBSYSTEM > M: Johan Hovold > S: Maintained > diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig > index ad4e630e73e2..96622a2106f7 100644 > --- a/drivers/platform/x86/Kconfig > +++ b/drivers/platform/x86/Kconfig > @@ -123,6 +123,17 @@ config XIAOMI_WMI > To compile this driver as a module, choose M here: the module will > be called xiaomi-wmi. > > +config GIGABYTE_WMI > + tristate "Gigabyte WMI temperature driver" > + depends on ACPI_WMI > + depends on HWMON > + help > + Say Y here if you want to support WMI-based temperature reporting on > + Gigabyte mainboards. > + > + To compile this driver as a module, choose M here: the module will > + be called gigabyte-wmi. > + > config ACERHDF > tristate "Acer Aspire One temperature and fan driver" > depends on ACPI && THERMAL > diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile > index 60d554073749..1621ebfd04fd 100644 > --- a/drivers/platform/x86/Makefile > +++ b/drivers/platform/x86/Makefile > @@ -15,6 +15,7 @@ obj-$(CONFIG_INTEL_WMI_THUNDERBOLT) += intel-wmi-thunderbolt.o > obj-$(CONFIG_MXM_WMI) += mxm-wmi.o > obj-$(CONFIG_PEAQ_WMI) += peaq-wmi.o > obj-$(CONFIG_XIAOMI_WMI) += xiaomi-wmi.o > +obj-$(CONFIG_GIGABYTE_WMI) += gigabyte-wmi.o > > # Acer > obj-$(CONFIG_ACERHDF) += acerhdf.o > diff --git a/drivers/platform/x86/gigabyte-wmi.c b/drivers/platform/x86/gigabyte-wmi.c > new file mode 100644 > index 000000000000..c17e51fcf000 > --- /dev/null > +++ b/drivers/platform/x86/gigabyte-wmi.c > @@ -0,0 +1,195 @@ > +// SPDX-License-Identifier: GPL-2.0-or-later > +/* > + * Copyright (C) 2021 Thomas Weißschuh > + */ > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > +#include > +#include > +#include > +#include > +#include > + > +#define GIGABYTE_WMI_GUID "DEADBEEF-2001-0000-00A0-C90629100000" > +#define NUM_TEMPERATURE_SENSORS 6 > + > +static bool force_load; > +module_param(force_load, bool, 0444); > +MODULE_PARM_DESC(force_load, "Force loading on unknown platform"); > + > +static u8 usable_sensors_mask; > + > +enum gigabyte_wmi_commandtype { > + GIGABYTE_WMI_BUILD_DATE_QUERY = 0x1, > + GIGABYTE_WMI_MAINBOARD_TYPE_QUERY = 0x2, > + GIGABYTE_WMI_FIRMWARE_VERSION_QUERY = 0x4, > + GIGABYTE_WMI_MAINBOARD_NAME_QUERY = 0x5, > + GIGABYTE_WMI_TEMPERATURE_QUERY = 0x125, > +}; > + > +struct gigabyte_wmi_args { > + u32 arg1; > +}; > + > +static int gigabyte_wmi_perform_query(struct wmi_device *wdev, > + enum gigabyte_wmi_commandtype command, > + struct gigabyte_wmi_args *args, struct acpi_buffer *out) > +{ > + const struct acpi_buffer in = { > + .length = sizeof(*args), > + .pointer = args, > + }; > + > + acpi_status ret = wmidev_evaluate_method(wdev, 0x0, command, &in, out); > + > + if ACPI_FAILURE(ret) > + return -EIO; > + > + return 0; > +} > + > +static int gigabyte_wmi_query_integer(struct wmi_device *wdev, > + enum gigabyte_wmi_commandtype command, > + struct gigabyte_wmi_args *args, u64 *res) > +{ > + union acpi_object *obj; > + struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; > + int ret; > + > + ret = gigabyte_wmi_perform_query(wdev, command, args, &result); > + if (ret) > + return ret; > + obj = result.pointer; > + if (obj && obj->type == ACPI_TYPE_INTEGER) > + *res = obj->integer.value; > + else > + ret = -EIO; > + kfree(result.pointer); > + return ret; > +} > + > +static int gigabyte_wmi_temperature(struct wmi_device *wdev, u8 sensor, long *res) > +{ > + struct gigabyte_wmi_args args = { > + .arg1 = sensor, > + }; > + u64 temp; > + acpi_status ret; > + > + ret = gigabyte_wmi_query_integer(wdev, GIGABYTE_WMI_TEMPERATURE_QUERY, &args, &temp); > + if (ret == 0) { > + if (temp == 0) > + return -ENODEV; > + *res = (s8)temp * 1000; // value is a signed 8-bit integer > + } > + return ret; > +} > + > +static int gigabyte_wmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type, > + u32 attr, int channel, long *val) > +{ > + struct wmi_device *wdev = dev_get_drvdata(dev); > + > + return gigabyte_wmi_temperature(wdev, channel, val); > +} > + > +static umode_t gigabyte_wmi_hwmon_is_visible(const void *data, enum hwmon_sensor_types type, > + u32 attr, int channel) > +{ > + return usable_sensors_mask & BIT(channel) ? 0444 : 0; > +} > + > +static const struct hwmon_channel_info *gigabyte_wmi_hwmon_info[] = { > + HWMON_CHANNEL_INFO(temp, > + HWMON_T_INPUT, > + HWMON_T_INPUT, > + HWMON_T_INPUT, > + HWMON_T_INPUT, > + HWMON_T_INPUT, > + HWMON_T_INPUT), > + NULL > +}; > + > +static const struct hwmon_ops gigabyte_wmi_hwmon_ops = { > + .read = gigabyte_wmi_hwmon_read, > + .is_visible = gigabyte_wmi_hwmon_is_visible, > +}; > + > +static const struct hwmon_chip_info gigabyte_wmi_hwmon_chip_info = { > + .ops = &gigabyte_wmi_hwmon_ops, > + .info = gigabyte_wmi_hwmon_info, > +}; > + > +static u8 gigabyte_wmi_detect_sensor_usability(struct wmi_device *wdev) > +{ > + int i; > + long temp; > + u8 r = 0; > + > + for (i = 0; i < NUM_TEMPERATURE_SENSORS; i++) { > + if (!gigabyte_wmi_temperature(wdev, i, &temp)) > + r |= BIT(i); > + } > + return r; > +} > + > +static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { > + { .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "B550 GAMING X V2"), > + }}, > + { .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "B550M DS3H"), > + }}, > + { .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Z390 I AORUS PRO WIFI-CF"), > + }}, > + { .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "X570 I AORUS PRO WIFI"), > + }}, > + { } > +}; > + > +static int gigabyte_wmi_probe(struct wmi_device *wdev, const void *context) > +{ > + struct device *hwmon_dev; > + > + if (!dmi_check_system(gigabyte_wmi_known_working_platforms)) { > + if (!force_load) > + return -ENODEV; > + dev_warn(&wdev->dev, "Forcing load on unknown platform"); > + } > + > + usable_sensors_mask = gigabyte_wmi_detect_sensor_usability(wdev); > + if (!usable_sensors_mask) { > + dev_info(&wdev->dev, "No temperature sensors usable"); > + return -ENODEV; > + } > + > + hwmon_dev = devm_hwmon_device_register_with_info(&wdev->dev, "gigabyte_wmi", wdev, > + &gigabyte_wmi_hwmon_chip_info, NULL); > + > + return PTR_ERR_OR_ZERO(hwmon_dev); > +} > + > +static const struct wmi_device_id gigabyte_wmi_id_table[] = { > + { GIGABYTE_WMI_GUID, NULL }, > + { } > +}; > + > +static struct wmi_driver gigabyte_wmi_driver = { > + .driver = { > + .name = "gigabyte-wmi", > + }, > + .id_table = gigabyte_wmi_id_table, > + .probe = gigabyte_wmi_probe, > +}; > +module_wmi_driver(gigabyte_wmi_driver); > + > +MODULE_DEVICE_TABLE(wmi, gigabyte_wmi_id_table); > +MODULE_AUTHOR("Thomas Weißschuh "); > +MODULE_DESCRIPTION("Gigabyte WMI temperature Driver"); > +MODULE_LICENSE("GPL"); > > base-commit: 144c79ef33536b4ecb4951e07dbc1f2b7fa99d32 >