From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 305002868B0 for ; Thu, 15 Jan 2026 18:19:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768501191; cv=none; b=qtWGQfbyR7Td6UHDf8XsSnr8pZ19Lb2X3NSTvDm3HyzXnzMXnIO9y0YLx+BHCxc/mpDNNmoMA9UprY3iw7JLvcSWWzqsB+++IDJ4+hlbccMidbOZo6Ib/gHAS2Z2E0MuETBwl3F/t2U54eYhUM0PlwE5Z11yxKvnCNdOdPakwS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768501191; c=relaxed/simple; bh=rVr1FIBNPncHBdVCWzMeQ8z+HUnfrUVEHb3LmXficQg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=LyxyariG6qJ87DUVfWl2Lv5i6yIdFteJhnEETlx342t9yzv/BqrReKbqWH6Et9FsmtG3eTcBahrdp5o2xm8STlr+M8YChXuT58vjd6WM5rtmrCFleH2v55W6N1Vwr+fm0DsVclwtMjm0nUGqVXlMmKQ4OvS7TpEYqNW4Mbe0GDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WtVn9WNl; arc=none smtp.client-ip=209.85.217.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WtVn9WNl" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-5eeaae0289bso803955137.2 for ; Thu, 15 Jan 2026 10:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768501189; x=1769105989; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DZDpoR7a6maMnnq6q5zRScbthRouyH6j3umxLCjsFhk=; b=WtVn9WNlngOx4dZCqDtDfQNOkncOgvT67nMQ/4ujujBWspj7Di3ZA00uf8VqUTH9tV MIoqgDZmuiFeQmGsL0tzQ7ezgdq0XgRweIkgZtz2Na/ZFKmTk4Ei7P868CQ/H2raxJ+1 3uRsszo9jdIzQBKpRhTSZHaA0yQZs65Ym6drcmiE0c53OGeuhMIoVlwDnmdc4CFVuqa9 PcHT1aS7foae9jux4E4o7K54dUxndJ5+kVPqnZtm+znU0iuv9nYTKd2eNcllA+XfdQ8Y 8XZrpboVTMYzxAEH0VNUlzxnYqPTJ57aD2/qnAsDiAHZBoa81cxXqNs7kmkWi2lfhWPf duSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768501189; x=1769105989; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DZDpoR7a6maMnnq6q5zRScbthRouyH6j3umxLCjsFhk=; b=n1Sa/zsqGYPdD9vreHiFTOOlVmmJFlbZg55mcJ+hW67fE1lYqbx20IRz8rFXsR6yXO xe8SiUOaLxLWyOMWrThGLrbk0iHyv00Fd0cqUjmKUmSbG3+QwC8JTHB9NqfcOXsyzLnK aAcLj3l407KU2xnkREckjq1qzQKT4o+y1T8J6DsG2tPsAkm4KxUoq6fRliJVopzuql/T tmG23MsFE5ngX3j0lXH6NQbq2OMXDwv1AQXk80k66U2p5BRuZYpZqDMfkucqLH78DKiF KQzdeoCkUMQL3ft4iTEhRuqdxjrSGRJKH5SaxA19oPQUYOkp8oP2OmN76ml8YzL2a9WK JurQ== X-Forwarded-Encrypted: i=1; AJvYcCVGs6y0TlszHmuE+WGsr9BTZOQtv8lhUT14X15COXBnHfhIsRLjqJLtxYboZwyX+4T2kkaij4q7c+2ZzOlJeTRhGvud@vger.kernel.org X-Gm-Message-State: AOJu0Yz6RtZrgMag4NxNXKfZT6qVCFElbjFudJ+2TA9S5JFPzbw9x1Bn FyF34a+u+yz6xxfbqyCiFuO7LkmpKGr1CScN2ln+iBkgrOr0L4dsbuCE X-Gm-Gg: AY/fxX7G9tI1TvIYcZop9UM43t37NsdFRppiI1Bo9wePk1nTy/gzfCYOP1fnjSQKCpT ghjK785mCSiKAHiUXg3b4eF25jIE4MLpmXgw+SyH2awFoyrVb/mKRiagY55W2RE2el9k0UeWKZj MlBEtwLiMRKHMSnDG6D72iZ+17xLqROHs/9/bA/y+zaKiWGt/hMW9c4bJ6N1dcDSe8SjyOQXak9 a4TqexndF2+CyztWokAvlvBfoVzjozMaalzFry3xy3tM0FoEcM8EiOM69MM1Dhn/SwZxPhEZyDx PhMFbuvXtDq1nOw5eg3YV8rOwOBKGj/qxM5c16FJ9Tx6OsUMD/mjlmSM6gTCNOxjgCErxq/qyyE 34QiSpD6E+eM24jF50DjCo5dOw/F7GeGqPicQgzWUED2ziLQD0k2BDLPRgOqJ//USXg9pQbQJkV B1dw== X-Received: by 2002:a05:6102:38c9:b0:5ef:a4c9:58d3 with SMTP id ada2fe7eead31-5f1a554a33cmr254280137.20.1768501188997; Thu, 15 Jan 2026 10:19:48 -0800 (PST) Received: from localhost ([2800:bf0:82:11a2:7ac4:1f2:947b:2b6]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-947d03c29d7sm61227241.2.2026.01.15.10.19.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Jan 2026 10:19:48 -0800 (PST) Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 15 Jan 2026 13:19:41 -0500 Message-Id: Cc: "Mark Pearson" , "Armin Wolf" , "Hans de Goede" , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Guenter Roeck" , , , Subject: Re: [PATCH v9 7/7] platform/x86: lenovo-wmi-other: Add HWMON for fan reporting/tuning From: "Kurt Borja" To: "Derek J. Clark" , "Rong Zhang" , "Kurt Borja" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260114122745.986699-1-i@rong.moe> <20260114122745.986699-8-i@rong.moe> <1a9909f4083d85736a1e28067517ae0899e462f2.camel@rong.moe> <9ff2b73e30f06be69b6c0b72b91a19d766310db7.camel@rong.moe> <59A79FD4-0A1C-4FFE-B4BC-D24588785717@gmail.com> In-Reply-To: <59A79FD4-0A1C-4FFE-B4BC-D24588785717@gmail.com> On Thu Jan 15, 2026 at 12:45 PM -05, Derek J. Clark wrote: > On January 15, 2026 8:57:42 AM PST, Rong Zhang wrote: >>Hi Kurt, >> >>On Thu, 2026-01-15 at 08:58 -0500, Kurt Borja wrote: >>> On Thu Jan 15, 2026 at 8:03 AM -05, Rong Zhang wrote: >>> > Hi Kurt, >>> >=20 >>> > On Wed, 2026-01-14 at 19:16 -0500, Kurt Borja wrote: >>> > > Hi Rong, >>> > >=20 >>> > > On Wed Jan 14, 2026 at 7:27 AM -05, Rong Zhang wrote: >>> > > > Register an HWMON device for fan reporting/tuning according to >>> > > > Capability Data 00 (capdata00) and Fan Test Data (capdata_fan) pr= ovided >>> > > > by lenovo-wmi-capdata. The corresponding HWMON nodes are: >>> > > >=20 >>> > > > - fanX_enable: enable/disable the fan (tunable) >>> > > > - fanX_input: current RPM >>> > > > - fanX_max: maximum RPM >>> > > > - fanX_min: minimum RPM >>> > > > - fanX_target: target RPM (tunable) >>> > > >=20 >>> > > > Information from capdata00 and capdata_fan are used to control th= e >>> > > > visibility and constraints of HWMON attributes. Fan info from cap= data00 >>> > > > is collected on bind, while fan info from capdata_fan is collecte= d in a >>> > > > callback. Once all fan info is collected, register the HWMON devi= ce. >>> > > >=20 >>> > > > Signed-off-by: Rong Zhang >>> > > > Reviewed-by: Derek J. Clark >>> > > > --- >>> > >=20 >>> > > ... >>> > >=20 >>> > > > diff --git a/Documentation/wmi/devices/lenovo-wmi-other.rst b/Doc= umentation/wmi/devices/lenovo-wmi-other.rst >>> > > > index 821282e07d93c..bd1d733ff286d 100644 >>> > > > --- a/Documentation/wmi/devices/lenovo-wmi-other.rst >>> > > > +++ b/Documentation/wmi/devices/lenovo-wmi-other.rst >>> > > > @@ -31,6 +31,8 @@ under the following path: >>> > > > =20 >>> > > > /sys/class/firmware-attributes/lenovo-wmi-other/attributes// >>> > > > =20 >>> > > > +Additionally, this driver also exports attributes to HWMON. >>> > > > + >>> > > > LENOVO_CAPABILITY_DATA_00 >>> > > > ------------------------- >>> > > > =20 >>> > > > @@ -39,6 +41,11 @@ WMI GUID ``362A3AFE-3D96-4665-8530-96DAD5BB300= E`` >>> > > > The LENOVO_CAPABILITY_DATA_00 interface provides various informa= tion that >>> > > > does not rely on the gamezone thermal mode. >>> > > > =20 >>> > > > +The following HWMON attributes are implemented: >>> > > > + - fanX_enable: enable/disable the fan (tunable) >>> > >=20 >>> > > I was testing this series and I'm a bit confused about fanX_enable. >>> >=20 >>> > Thanks for testing! >>>=20 >>> Thanks for working on this! >>>=20 >>> >=20 >>> > > Judging by this comment and also by taking a quick look at the code= , it >>> > > looks like writting 0 to this attribute disables the fan. >>> > >=20 >>> > > This is however (per hwmon ABI documentation [1]) not how this attr= ibute >>> > > should work. IIUC, it is intended for devices which can disable the= fan >>> > > sensor, not the actual fan. > > I agree, it's just for disabling the reporting of the rpm, not for disabl= ing the fan. I didn't catch this before. > >>> >=20 >>> > Hmm, what a confusing name :-/ >>> >=20 >>> > > I fail to see how this feature is useful and I also find it dangero= us >>> > > for this to be exposed by default, considering the same could be >>> > > achieved with the relaxed module parameter, which at least tells th= e >>> > > user to be careful. >>> >=20 >>> > Makes sense. I will remove the attribute and mention such behavior in >>> > the module parameter. >>>=20 >>> Also, it would be worth to mention that writting 0 to the fanY_target >>> attribute is auto mode, right? >> >>Ah, yes. >> >>> I was testing the fanX_target attribute and it does work as intended, >>> i.e. the fan speed changes to the desired speed. However, every time I >>> write to this attribute I'm getting -EIO error and it always reads 0. >>>=20 >>> For example: >>>=20 >>> $ echo 3550 | sudo tee fan*_target >>> 3550 >>> tee: fan1_target: Input/output error >>> tee: fan2_target: Input/output error >>> $ cat fan*_target >>> 0 >>> 0 >>>=20 >>> But as I said, the fans do reach the desired speed (an approximation of >>> it): >>>=20 >>> $ cat fan*_input >>> 3500 >>> 3500 >>>=20 >>> This is a bit weird, but I haven't look in depth into it. I will find >>> some time to do it later. This happens on a 83KY (Legion 7 16IAX1) >>> laptop. >> >>I'd like to fix it in the next revision. Looking forward to your >>progress in debugging :-) >> >>It seems to me that the corresponding ACPI method did not return 1 on >>success. There should be some clues in the decompiled ASL code. Could >>you attach it in your reply? The HWMON implementation was developed >>mostly based on my understanding on the decompiled ASL code of my >>device. I'd like to check the one of your device as a cross-reference >>to see if there are more potential bugs. >> >>> As it seems that you can change the RPM in 100 increments, >> >>Yeah. That's also true on my device, but I am not sure if all devices >>with the interface behave like this. I'd prefer not making such an >>assumption. >> > > fanY_div maybe makes sense here, defaulting to the known 100 and adjustab= le with a DMI quirk table if we find devices that do 200/50/20/etc.? > >>> maybe you >>> could look into the pwmY attributes [1]. I think it is a better fit for >>> this feature because pwmY_enable allows you to select between manual an= d >>> auto fan control [2], and I believe some user-space tools already use >>> this attribute. >> >>For pwmY, I don't see the point why the kernel should adapt to >>userspace tools... If we don't have to, don't be overfit. >> >>For pwmY_enable, it is only a good choice if we adopt pwmY. It's weird >>to mix pwmY_enable and fanY_target. >> >>@Derek, may I ask for your opinion here? Should we adopt pwmY*? >> > > All the platform drivers I've written used pwmY/pwmY_enable and fanY_inpu= t for reporting speed. There is additionally a pwmY_enable mode that sets t= he fan to max speed. TBS, I think it's a fundamentally different interface. > >>> On the implementation you can use fixp_linear_interpolate() [3] to >>> convert between and from pwm duty cycle. >> >>If we adopt this, I could imagine three ways to create a PWM-RPM curve: >>(1) PWM[0,255] =3D> RPM[min,max] >>(2) PWM[0,255] =3D> RPM[0,max] >>(3) PWM[0,255] =3D> RPM[0,a_large_number] >> > > I don't believe this is canonical for pwm, normally you set a fixed speed= with pwmY, let the BIOS handle it with auto, or set to max speed with the = enable function. Fan curves would need to be under pwmY_auto_point_pwm[X|Z]= , but they're usually paired with tempY_auto_point_pwm[X|Y] to set a speed = at a given temperature, not necessary to restrict a min/max. > > Docs: https://docs.kernel.org/hwmon/sysfs-interface.html > > The nature of pwm is that a fixed pulse width determines a fixed fan spee= d. It is necessarily a single set value. If you want a range, fanY_[min|max= ] seems the way to go. > > Using pwmY* will also collide with the fan curve patch I'm adding after t= his series since newer devices have a 10 value speed Y at temp X curve buil= t into the WMI interface. Not insurmountable, but I'd rather avoid the conf= lict so we're not matching on GUID or something like that. > > Cheers, > Derek > You're right. It would not be possible to enforce limits when using pwmY*. We should stick with fanY_target, but the 0 value auto mode should be documented. --=20 Thanks, ~ Kurt