Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1652545pxb; Wed, 9 Feb 2022 01:15:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbFz5Dxn/bc3ek8vNbyQRD/8BZ2b84pwfNdC0D3/aBPFmfOizrvIuJ5Se3a0EOhdNA8rDr X-Received: by 2002:a17:90b:4b01:: with SMTP id lx1mr2380061pjb.158.1644398140346; Wed, 09 Feb 2022 01:15:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644398140; cv=none; d=google.com; s=arc-20160816; b=t1ci3DC31034XbUDIZ9GEA298io2AXjUIcbO4mFPdfNjVCwUx/JBu8rPBDw2wEiJln rt/KddftQfWWUZXLLdxwPTy/p1st+p3VFAFUPE5Ras0LA9H/0fYtpxjNmX7rYhhwwcjQ oDDyOXgrLZ2ncF4yrLkm2P/ZfAQHrdRGdkppUfJpniUVYHwWTp4h6v+z7Cu2Mq3FVySZ hVLfXO/CW0p3IQ+3SSci788rDw63LomOaF9zXTm4Sh7a4r9BOf0pymo5bXh79HQIEr3k QpLJx+8v5z9S76DFx51Rt6Xi9oLGVTk1qY39X4IRRZhlGHTRPqJkFe6naweTFsCeUGxy enXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=kRP2HNPEgA51ktTqz6c5mvV5tDkfXVjA3Z29dovDE7o=; b=OMO5YWER4QOhyKPlNUuUPEY75v5fLA6vY5YOQwc6kA5lQrgajyWfRKksUAPha0RBiO Ao2q5FcsNgyaHMbMPs9wux7TpcApDImIXf2lGpyZPNjPjwg3xvjfdV6xSCKkBjrt9lk1 ztpuSpT17aIdE5i8V/+An1Gf4Mq9fEPXT/y8ogSQ2cgB9mxttXyGXZQpphtBd2of3evS kPIALeyy7AN6w9GPT0cBeV6PJV+JScCTbXpDj2S01/xxrW/Hy1kBQkyCx2UA5EnkTChs c62juRgfsuqLmhiDtO2xuJaC3K1Pi7gnEexMCJrydocGIoCKq6uCdKXfieyBQXYukFj4 Lkug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hhkcVGxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f21si15876906pfc.278.2022.02.09.01.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:15:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hhkcVGxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7794EE02F6FB; Wed, 9 Feb 2022 00:54:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236681AbiBHXax (ORCPT + 99 others); Tue, 8 Feb 2022 18:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236881AbiBHXaw (ORCPT ); Tue, 8 Feb 2022 18:30:52 -0500 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AA31C061576; Tue, 8 Feb 2022 15:30:51 -0800 (PST) Received: by mail-oi1-x232.google.com with SMTP id s24so760712oic.6; Tue, 08 Feb 2022 15:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=kRP2HNPEgA51ktTqz6c5mvV5tDkfXVjA3Z29dovDE7o=; b=hhkcVGxHalmedmzlxc9moGRICBzJ+DZGGsKBwoIh5kcr2r8GF4HMTfmbOoaBffVKQx 8dsgynO2Go9iyfGpslfHDZjOelqq40tYA++bPS3SZN0vASrld9MK5BFySX6jJCJrZXGd H0ieTVx56US1ZG9dxVgV3I5YjlKA6qMrqoll62h+hvKBI6kJCzz9uYAK60wuedADnHGB H3XIeomV0fA+Fq/a4Qdu/T2ugeZjn4+FXqrfiv6MlghHDU/cJyYVTWgPfCJJGxwDjPK0 /ckgyitDp+lAkjeDHGdv5s37uNCBDeA5dDZOqoSYV2dHcor4Dfzxoxddg5rLfgtgQdtl wfOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=kRP2HNPEgA51ktTqz6c5mvV5tDkfXVjA3Z29dovDE7o=; b=SVM8Hizo+cNVJ9m2psmFHTs3d7xMt7SMX7UHpd4uHS0RdJzYSHSNdKAYFZt99mbuyW hhl+ZZzjfMaj9Y+mpSNPHkDyYD/1Uf++XrZ5m33uxjhpZm5MelCv3NO8TkLW2gSVLai+ i73+yJSims6rcHP4Ug4kWqHVa5dDD5snNnkKQ2Ygczv9nOe35xKit9W4OYtZ9gjDh+3Q +qDee3tWc0GIEqhjN0hQOgTvgOLaH/w5yDgApPNwyS1bQ+AR1fMv6GDVav50RbaxCCxA 57IU3oym8xXUfFWJvH81+UB6ewoVwKLTWYqrUCgav5jUJKM2eg2eh5XK0CatpJrkgMka I45w== X-Gm-Message-State: AOAM532vB2XowVa/4A9B75I0LsfzMXPij9NEgZeL3E38R2ccz9I7ROwx KD7zL6RYu5tJArCj9Xg3QluiEyixcqT4nA== X-Received: by 2002:a05:6808:1899:: with SMTP id bi25mr175916oib.38.1644363050765; Tue, 08 Feb 2022 15:30:50 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id y1sm6652731oad.38.2022.02.08.15.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 15:30:49 -0800 (PST) Sender: Guenter Roeck Date: Tue, 8 Feb 2022 15:30:48 -0800 From: Guenter Roeck To: Eugene Shalygin Cc: Oleksandr Natalenko , Denis Pauk , Jean Delvare , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hwmon: (asus-ec-sensors) add CPU core voltage Message-ID: <20220208233048.GA2970774@roeck-us.net> References: <20220208094244.1106312-1-eugene.shalygin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220208094244.1106312-1-eugene.shalygin@gmail.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 08, 2022 at 10:42:43AM +0100, Eugene Shalygin wrote: > A user discovered [1] the CPU Core voltage sensor, which spans 2 > registers and provides output in mV. Althroug the discovery was made > with a X470 chipset, the sensor is present in X570 (tested with C8H). > For now simply add it to each board with the CPU current sensor present. > > [1] https://github.com/zeule/asus-ec-sensors/issues/12 > > Signed-off-by: Eugene Shalygin > Tested-by: Oleksandr Natalenko > Tested-by: Denis Pauk Applied to hwmon-next. Thanks, Guenter > --- > Documentation/hwmon/asus_ec_sensors.rst | 1 + > drivers/hwmon/asus-ec-sensors.c | 29 ++++++++++++++++--------- > 2 files changed, 20 insertions(+), 10 deletions(-) > > diff --git a/Documentation/hwmon/asus_ec_sensors.rst b/Documentation/hwmon/asus_ec_sensors.rst > index 22de1b037cfb..e7e8f1640f45 100644 > --- a/Documentation/hwmon/asus_ec_sensors.rst > +++ b/Documentation/hwmon/asus_ec_sensors.rst > @@ -39,6 +39,7 @@ The driver is aware of and reads the following sensors: > 9. Readings from the "Water flow meter" header (RPM) > 10. Readings from the "Water In" and "Water Out" temperature headers > 11. CPU current > +12. CPU core voltage > > Sensor values are read from EC registers, and to avoid race with the board > firmware the driver acquires ACPI mutex, the one used by the WMI when its > diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c > index dd7b207d062f..bfac08a5dc57 100644 > --- a/drivers/hwmon/asus-ec-sensors.c > +++ b/drivers/hwmon/asus-ec-sensors.c > @@ -18,6 +18,7 @@ > * - VRM Heat Sink fan RPM > * - Water Flow fan RPM > * - CPU current > + * - CPU core voltage > */ > > #include > @@ -100,6 +101,8 @@ enum ec_sensors { > ec_sensor_temp_t_sensor, > /* VRM temperature [℃] */ > ec_sensor_temp_vrm, > + /* CPU Core voltage [mV] */ > + ec_sensor_in_cpu_core, > /* CPU_Opt fan [RPM] */ > ec_sensor_fan_cpu_opt, > /* VRM heat sink fan [RPM] */ > @@ -121,6 +124,7 @@ enum ec_sensors { > #define SENSOR_TEMP_MB BIT(ec_sensor_temp_mb) > #define SENSOR_TEMP_T_SENSOR BIT(ec_sensor_temp_t_sensor) > #define SENSOR_TEMP_VRM BIT(ec_sensor_temp_vrm) > +#define SENSOR_IN_CPU_CORE BIT(ec_sensor_in_cpu_core) > #define SENSOR_FAN_CPU_OPT BIT(ec_sensor_fan_cpu_opt) > #define SENSOR_FAN_VRM_HS BIT(ec_sensor_fan_vrm_hs) > #define SENSOR_FAN_CHIPSET BIT(ec_sensor_fan_chipset) > @@ -139,6 +143,8 @@ static const struct ec_sensor_info known_ec_sensors[] = { > [ec_sensor_temp_t_sensor] = > EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d), > [ec_sensor_temp_vrm] = EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e), > + [ec_sensor_in_cpu_core] = > + EC_SENSOR("CPU Core", hwmon_in, 2, 0x00, 0xa2), > [ec_sensor_fan_cpu_opt] = > EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0), > [ec_sensor_fan_vrm_hs] = EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2), > @@ -172,32 +178,34 @@ static const struct dmi_system_id asus_ec_dmi_table[] __initconst = { > SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "Pro WS X570-ACE", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM | > - SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), > + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, > "ROG CROSSHAIR VIII DARK HERO", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | > SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | > - SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU), > + SENSOR_FAN_CPU_OPT | SENSOR_FAN_WATER_FLOW | > + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, > "ROG CROSSHAIR VIII FORMULA", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | > SENSOR_TEMP_VRM | SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | > - SENSOR_CURR_CPU), > + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG CROSSHAIR VIII HERO", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | > SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | > SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | > - SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU), > + SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, > "ROG CROSSHAIR VIII HERO (WI-FI)", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | > SENSOR_TEMP_VRM | SENSOR_SET_TEMP_WATER | > SENSOR_FAN_CPU_OPT | SENSOR_FAN_CHIPSET | > - SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU), > + SENSOR_FAN_WATER_FLOW | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, > "ROG CROSSHAIR VIII IMPACT", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_T_SENSOR | > - SENSOR_TEMP_VRM | SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), > + SENSOR_TEMP_VRM | SENSOR_FAN_CHIPSET | > + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX B550-E GAMING", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | > SENSOR_TEMP_T_SENSOR | > @@ -205,17 +213,19 @@ static const struct dmi_system_id asus_ec_dmi_table[] __initconst = { > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX B550-I GAMING", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | > SENSOR_TEMP_T_SENSOR | > - SENSOR_TEMP_VRM | SENSOR_FAN_VRM_HS | SENSOR_CURR_CPU), > + SENSOR_TEMP_VRM | SENSOR_FAN_VRM_HS | > + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-E GAMING", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | > SENSOR_TEMP_T_SENSOR | > - SENSOR_TEMP_VRM | SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), > + SENSOR_TEMP_VRM | SENSOR_FAN_CHIPSET | > + SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-F GAMING", > SENSOR_SET_TEMP_CHIPSET_CPU_MB | > SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET), > DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-I GAMING", > SENSOR_TEMP_T_SENSOR | SENSOR_FAN_VRM_HS | > - SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), > + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE), > {} > }; > > @@ -467,7 +477,6 @@ static long scale_sensor_value(s32 value, int data_type) > switch (data_type) { > case hwmon_curr: > case hwmon_temp: > - case hwmon_in: > return value * MILLI; > default: > return value;