Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp422672rdh; Thu, 23 Nov 2023 07:32:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+aT/ARFHZTLCBUhlD5WG7sVbP2PDpkJ0O2vOSBm5lpzX3ts4noitm+UWKCl7Wc5FDfuCI X-Received: by 2002:a05:6a20:28a0:b0:187:15e2:fe02 with SMTP id q32-20020a056a2028a000b0018715e2fe02mr5028582pzf.13.1700753547317; Thu, 23 Nov 2023 07:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700753547; cv=none; d=google.com; s=arc-20160816; b=oj/kH6oems4NWljRLKYnRCv+HpobTFbIcVyjSqy1o1dequld3dbE7RL2gAZlQZhpvC uWiUdb7jwZmgqbBh+Qxha4AhZ6vVNmniZVAHOxBmuN3xi7XPYmWTwpVrtdokCX6QZB1m 8aZembj8wH71CxBGSvq20LtBOPH4mqRq/hwy44lHSqSWgKV5gZ2giQ3/fufi1N2lOQFv +MYkNvG+AwfbClX7maK4K8Yw/gjp+BElQXCer1TM3AJ951RvIoxpEsCqJ7ckR7Wk05m6 ES1UR1T5qQF9Z26ev9NMA8YwKu7KP/6aG9OeCQ/L8D2feHfsZWQjOWOhJvaAqFXoOG5O UJwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=EnoWchx6X0iuu6cQSGI8oMemxNbBA1WKT7KGiisQCd8=; fh=lSaBC4B3jl0ANBjfy/jQBLRemTsjl2w0r+2uuWd12Ks=; b=K0Ndc1AxuQOgn//MTr9D0ghQ75EhTJAPQYjlb5ktMmR9h6w18ji65S/46FzOGf9Skd lQfPgPOpC6Gtq+Sl8XxcpVN3r5FsrkKMwsV3oYfoA7dM6ROUWVCryCXzAPARQ09ABnqb ommwx+5NrN582Je/aLSI4t+yGyaqisjjP3OQ2roIqveC56rgSeY8N9owc64c5zzRpBkm Xk7HRbaAQhpYLq/JuH+rOx0KjvOfHEyrZzix+ii1voe+zmOuyUC8fEpmdMVdvPdBYLbr JCtr3UsIGCb7ZQ8DgHYQtF3bNRsWGcUmIvSIqVjEph848/vuPSlvt9szFnKjxTXRU3xb /xqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hqrjk+ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id a2-20020a63e402000000b005be1e555473si1511822pgi.574.2023.11.23.07.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 07:32:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hqrjk+ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E15D882696D6; Thu, 23 Nov 2023 07:32:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346126AbjKWPb4 (ORCPT + 99 others); Thu, 23 Nov 2023 10:31:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346230AbjKWPbi (ORCPT ); Thu, 23 Nov 2023 10:31:38 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80DA010C8; Thu, 23 Nov 2023 07:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700753434; x=1732289434; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=wf42AL/tv0Fj/STvDq+UcPvgDOY05tysJaWbd/9145E=; b=Hqrjk+jiyfN8HamNPWp0k6xmrsveyLqNEM3lm/RDkms2oFbzQa5atP/D z94HbW6A+kVl93JOuL9o44bYWQhy6bFi6ypQCBpB59Q6DZwRdOexDmOdF bV2nIdbwGB57uCdAOh6EBJ9X/Xwv5Hkp5pi28F+QJjfaZXFJsG8UxfOxx adkHPmRfeak1Dj0bsccl7oMOevf6Vz2FrzeR0yLdJJEfwQAXm9MDEz6KY paJC6LZIh7hnRF/3lQo94M7IyTJLMh+FJwVA/DdmZJP+dzfNDnsPdi0pd EzXhi6BSjPbRVgHyyiPG7cnvuGq86FVYAZimpX4cm9JTlsXkMDdpfm7GL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="5431839" X-IronPort-AV: E=Sophos;i="6.04,222,1695711600"; d="scan'208";a="5431839" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 07:30:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,222,1695711600"; d="scan'208";a="15698967" Received: from mstrobel-mobl.ger.corp.intel.com ([10.252.40.70]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 07:30:26 -0800 Date: Thu, 23 Nov 2023 17:30:23 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: SungHwan Jung cc: Hans de Goede , "Lee, Chun-Yi" , Jean Delvare , Guenter Roeck , platform-driver-x86@vger.kernel.org, LKML , linux-hwmon@vger.kernel.org Subject: Re: [PATCH v3 2/2] platform/x86: acer-wmi: add fan speed monitoring for Predator PHN16-71 In-Reply-To: <20231123152229.4920-3-onenowy@gmail.com> Message-ID: References: <20231123152229.4920-1-onenowy@gmail.com> <20231123152229.4920-3-onenowy@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 07:32:25 -0800 (PST) On Fri, 24 Nov 2023, SungHwan Jung wrote: > Support CPU and GPU fan speed monitoring through WMI for Predator > PHN16-71. > > This patch depends on patch "platform/x86: acer-wmi: Add platform > profile and mode key support for Predator PHN16-71" > > "select ACPI_VIDEO" cause recursive dependency and it is not recommended > to use "select" for visible symbol, "select" has changed to "depends on". > > Signed-off-by: SungHwan Jung > --- > drivers/platform/x86/Kconfig | 3 +- > drivers/platform/x86/acer-wmi.c | 98 ++++++++++++++++++++++++++++++++- > 2 files changed, 99 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig > index 7e69fdacc..33ddb644e 100644 > --- a/drivers/platform/x86/Kconfig > +++ b/drivers/platform/x86/Kconfig > @@ -177,7 +177,8 @@ config ACER_WMI > depends on INPUT > depends on RFKILL || RFKILL = n > depends on ACPI_WMI > - select ACPI_VIDEO > + depends on HWMON > + depends on ACPI_VIDEO > select INPUT_SPARSEKMAP > select LEDS_CLASS > select NEW_LEDS > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c > index e3650dce0..f2f3b1c45 100644 > --- a/drivers/platform/x86/acer-wmi.c > +++ b/drivers/platform/x86/acer-wmi.c > static const struct key_entry acer_wmi_keymap[] __initconst = { > @@ -241,6 +244,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) It would be nice to align these with tabs. > @@ -1722,6 +1727,25 @@ static int acer_gsensor_event(void) > return 0; > } > > +static int acer_get_fan_speed(int fan) > +{ > + if (quirks->predator_v4) { > + acpi_status status; > + u64 fanspeed; > + > + 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 (ACPI_FAILURE(status)) > + return -EIO; > + return fanspeed >> 8; Define a named field using GENMASK() and use FIELD_GET() ? -- i.