Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp461806pxb; Sat, 10 Apr 2021 08:18:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz16ZLPSpu0qrbTOFpdLK6/UDth5pwpV/k7oSu8EI7z6noNRqiVLvdYlVUoTsGX0GNKiH4 X-Received: by 2002:a63:5766:: with SMTP id h38mr10192902pgm.250.1618067932586; Sat, 10 Apr 2021 08:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618067932; cv=none; d=google.com; s=arc-20160816; b=fVc2VEesbBtd93efxS7AE3BxIHyY3YG8TH2ybBPcrVmvrRxhOINjCNz74WEFS7Yde+ CXgABYCiUCynsUKQu19FWKGGhmvuTH/0+k3VFRfGQyiyE0iy6bK9pwKTYFqqf3RtmvDz FKeNCKxmjRDsamfEZOL1oqvOmmlvKlI4RNWMIeqDI4XWGNzsZAX9XJ0m+cY0+L9Ar9cs aX9oCqftrGSQFdYfzpuFZZA0WIdBbY1ohC9OnCXR20iuHxn0Tkgs0b20cyHh1OIeNiNR QlGY1MQiHLnFrYYQR9ESX01uyhS68ZfFzmMdRkDF9HjqFfqZW/LF6CTSQx+1BpNZtX7Z UkvQ== 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=A4/cYC0UOb1c2Eadie+wrxMS0F5PkKrtRmBw6cRr1u4=; b=qqy6Bt8bRZczuD82LFthyqZsbMG36kXfn68VTvu4Cwhi3lRBFXFfTRIFFIqYE2DnEo cFDi084HH70AnLEXsjB9z4H6vP79tvNc5TQD1J+Unhjf+8w0G6vzdMByWIAZJlpQaMo+ jWO51WSFGDLg4xBoanrla/A95MUcqPJdCppfP4OUpXaqJjV44Kl8CJZPdI28nlVZC3b3 BGpBEG2wlvehJYVlHoCzwRdLwAp7s/mmtdha+5abviKkKQSlOZEmdx9hPSq5rhDzr/vl sMrv8BjObLZ7xVpfDz/2m7XrXhECnAEu0yvMCqU0sFDCJfOQlDEg0YuS9CYi4R+wuupy 40cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IE1A5K4m; 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 e5si7552738pgf.328.2021.04.10.08.18.27; Sat, 10 Apr 2021 08:18:52 -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=IE1A5K4m; 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 S234836AbhDJPPi (ORCPT + 99 others); Sat, 10 Apr 2021 11:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234392AbhDJPPg (ORCPT ); Sat, 10 Apr 2021 11:15:36 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06FE2C06138A; Sat, 10 Apr 2021 08:15:22 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id w31-20020a9d36220000b02901f2cbfc9743so8565291otb.7; Sat, 10 Apr 2021 08:15:22 -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=A4/cYC0UOb1c2Eadie+wrxMS0F5PkKrtRmBw6cRr1u4=; b=IE1A5K4mw53txlL56DkvTyZLpHZWsSDNNXw3z/Qfy4McWklAqYd5tsui8OlEuiV2dv Hy2u1TJi7pRXytiirrbcJTaZT1ydRNJYzoK2qhRy6tofI/n9yvCFKkuLtJGxWESJSSRi N1EzL9oRSB2O7cKDsACtiw2591nruVty/N1ZaOmLErjEb2Q3B4uoAscD3DrQzvm/tRXs KoFXNOiDnwtRnA47Xg+V5VfqVfXHoz9DgFANpwcyp8GZoPEJVptYb1IPB76lEmsCSVUu 2VxL3UaMMIE3Pl+9WZB0Q4MaH1I6o3chqiTN+ytIvmrPa5xiWfqOpKvGOVuDDWziYqrp nsAw== 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=A4/cYC0UOb1c2Eadie+wrxMS0F5PkKrtRmBw6cRr1u4=; b=bQ6CxtCrFHF1LwaFjt0fWVTaGm9dNy81QP7FMk+jAnZhop4XNKqU0OnJ103kBuLalj h+9Jc/TiYySxYw0Ujnyt+DYXIM25u9shBSi2YVcIJsktxpqZYLaeDjihONIuWv/+Psno 8FplAaaCEBY/qZxSG8X8BgcTfDeS7Vk3aqJxUNnrv08p3fhKbOfqpJ2u5dHfXSQu9Gto 9r7i+DZFCDqgCj6a6aCxs9lgUizgXTYnQWe6iCBWI9Cev8c36H07WCqdNinQC4GQPuo0 YtdjeaMIKy3HZiYna//igOJEhuVQDgIG3LqkZVtDkDfvcziBuzs9C5H9NMf05LGWwqYJ upWg== X-Gm-Message-State: AOAM531hDvh6D4uqa/zHYaziKLEcmEi4ZtvMNHMOV30XwxFKZqYtWFF7 9sm2pa2s5eKTXC4EH8qv9Rc= X-Received: by 2002:a05:6830:15d2:: with SMTP id j18mr16921118otr.75.1618067721425; Sat, 10 Apr 2021 08:15:21 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id c2sm1340671otf.66.2021.04.10.08.15.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Apr 2021 08:15:20 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH v3] 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: <117cadef-c1cb-d66a-15f8-ce50d596be4b@redhat.com> <20210410144021.138035-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 VHGMNJ3MwXlrEFPXaYJgibcg6brM6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qYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <3d974a64-14a6-2347-ac1a-666d1b8d6eef@roeck-us.net> Date: Sat, 10 Apr 2021 08:15:18 -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: <20210410144021.138035-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 7:40 AM, Thomas Weißschuh wrote: > Changes since v1: > * Incorporate feedback from Barnabás Pőcze > * Use a WMI driver instead of a platform driver > * Let the kernel manage the driver lifecycle > * Fix errno/ACPI error confusion > * Fix resource cleanup > * Document reason for integer casting > > Changes since v2: > * Style cleanups > * Test for usability during probing > * DMI-based whitelist > * CC hwmon maintainers > > -- >8 -- > > Tested with a X570 I Aorus Pro Wifi. > 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 > --- > MAINTAINERS | 6 + > drivers/platform/x86/Kconfig | 11 ++ > drivers/platform/x86/Makefile | 1 + > drivers/platform/x86/gigabyte-wmi.c | 194 ++++++++++++++++++++++++++++ > 4 files changed, 212 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..fb4e6d4c1823 > --- /dev/null > +++ b/drivers/platform/x86/gigabyte-wmi.c > @@ -0,0 +1,194 @@ > +// 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 Style: #definenamevalue but of course that is Hans' call. > + > +static bool force_load; > +module_param(force_load, bool, 0); > +MODULE_PARM_DESC(force_load, "Force loading on non-whitelisted platform"); > + > +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; That should be checked in gigabyte_wmi_hwmon_is_visible(); that is what that function is for. > + *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 0444; > +} > + > +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 int gigabyte_wmi_validate_sensor_presence(struct wmi_device *wdev) > +{ > + int working_sensors = 0, i; > + long temp; > + > + for (i = 0; i < NUM_TEMPERATURE_SENSORS; i++) { > + if (!gigabyte_wmi_temperature(wdev, i, &temp)) > + working_sensors++; > + } > + return working_sensors ? 0 : -ENODEV; > +} > + > +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; > + int ret; > + > + if (!dmi_check_system(gigabyte_wmi_known_working_platforms)) { > + if (force_load) > + dev_warn(&wdev->dev, "Forcing loading on non-whitelisted platform"); > + else > + return -ENODEV; Style: if (!force_load) return -ENODEV; dev_warn(&wdev->dev, "Forcing loading on non-whitelisted platform"); > + } > + > + ret = gigabyte_wmi_validate_sensor_presence(wdev); > + if (ret) { > + dev_info(&wdev->dev, "No temperature sensors usable"); Normally one does not display a message if a probe function returns -ENODEV, unless it is an error, to avoid polluting the kernel log. > + return ret; > + } > + > + 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 >