platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rong Zhang <i@rong.moe>
To: Derek John Clark <derekjohn.clark@gmail.com>
Cc: "Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Armin Wolf" <W_Armin@gmx.de>, "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 3/6] platform/x86: lenovo-wmi-capdata: Add support for Capability Data 00
Date: Mon, 27 Oct 2025 01:18:07 +0800	[thread overview]
Message-ID: <e85aa61b4cf3d3dbbe5ce32a7e97a949171d1110.camel@rong.moe> (raw)
In-Reply-To: <CAFqHKT=bMLHvkcohaSNSUqxSkeFg_7aZxMVpBSbWqtsOeuT7rg@mail.gmail.com>

Hi Derek,

On Sat, 2025-10-25 at 21:55 -0700, Derek John Clark wrote:
> On Sun, Oct 19, 2025 at 2:05 PM Rong Zhang <i@rong.moe> wrote:
> > 
> > Add support for LENOVO_CAPABILITY_DATA_00 WMI data block that comes on
> > "Other Mode" enabled hardware. Provides an interface for querying if a
> > given attribute is supported by the hardware, as well as its default
> > value.
> > 
> > Signed-off-by: Rong Zhang <i@rong.moe>
> > ---
> >  .../wmi/devices/lenovo-wmi-other.rst          |  8 +++++++
> >  drivers/platform/x86/lenovo/wmi-capdata.c     | 23 ++++++++++++++++++-
> >  drivers/platform/x86/lenovo/wmi-capdata.h     |  8 +++++++
> >  3 files changed, 38 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/wmi/devices/lenovo-wmi-other.rst b/Documentation/wmi/devices/lenovo-wmi-other.rst
> > index d7928b8dfb4b5..adbd7943c6756 100644
> > --- a/Documentation/wmi/devices/lenovo-wmi-other.rst
> > +++ b/Documentation/wmi/devices/lenovo-wmi-other.rst
> > @@ -31,6 +31,14 @@ under the following path:
> > 
> >    /sys/class/firmware-attributes/lenovo-wmi-other/attributes/<attribute>/
> > 
> > +LENOVO_CAPABILITY_DATA_00
> > +-------------------------
> > +
> > +WMI GUID ``362A3AFE-3D96-4665-8530-96DAD5BB300E``
> > +
> > +The LENOVO-CAPABILITD_DATA_00 interface provides information on whether the
> > +device supports querying or setting fan speed.
> > +
> 
> There is a lot more data provided by this interface that hasn't been
> implemented yet. To avoid having to touch this too often I'd prefer if
> it were formatted similarly to the 01 interface where the opening
> paragraph is generic for the interface and the specific features that
> have been implemented in the driver are listed below that. From
> documentation, the 00 interface seems to deal with enabling or
> disabling  various hardware features that don't rely on the gamezone
> thermal mode. I'd also be okay with specifying in the change that 01
> features do rely on the gamezone thermal mode.

Makes sense. Will reword it in v2. Thanks for the suggestion and
information.

> >  LENOVO_CAPABILITY_DATA_01
> >  -------------------------
> > 
> > diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x86/lenovo/wmi-capdata.c
> > index 14175fe19247e..6927de409b09d 100644
> > --- a/drivers/platform/x86/lenovo/wmi-capdata.c
> > +++ b/drivers/platform/x86/lenovo/wmi-capdata.c
> > @@ -5,6 +5,9 @@
> >   * Lenovo Capability Data provides information on tunable attributes used by
> >   * the "Other Mode" WMI interface.
> >   *
> > + * Capability Data 00 includes if the attribute is supported by the hardware,
> > + * and the default_value. All attributes are independent of thermal modes.
> > + *
> >   * Capability Data 01 includes if the attribute is supported by the hardware,
> >   * and the default_value, max_value, min_value, and step increment. Each
> >   * attribute has multiple pages, one for each of the thermal modes managed by
> > @@ -14,7 +17,7 @@
> >   *   - Initial implementation (formerly named lenovo-wmi-capdata01)
> >   *
> >   * Copyright (C) 2025 Rong Zhang <i@rong.moe>
> > - *   - Unified implementation
> > + *   - Unified implementation for Capability Data 00 and 01
> >   */
> 
> This might be a bit verbose considering the changes are all part of
> the same series.

ACK. Will drop "for ..." in v2.

> Thanks,
> Derek

Thanks,
Rong

> > 
> >  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> > @@ -36,12 +39,14 @@
> > 
> >  #include "wmi-capdata.h"
> > 
> > +#define LENOVO_CAPABILITY_DATA_00_GUID "362A3AFE-3D96-4665-8530-96DAD5BB300E"
> >  #define LENOVO_CAPABILITY_DATA_01_GUID "7A8F5407-CB67-4D6E-B547-39B3BE018154"
> > 
> >  #define ACPI_AC_CLASS "ac_adapter"
> >  #define ACPI_AC_NOTIFY_STATUS 0x80
> > 
> >  enum lwmi_cd_type {
> > +       LENOVO_CAPABILITY_DATA_00,
> >         LENOVO_CAPABILITY_DATA_01,
> >  };
> > 
> > @@ -57,6 +62,7 @@ static const struct lwmi_cd_info {
> >         const char *name;
> >         enum lwmi_cd_type type;
> >  } lwmi_cd_table[] = {
> > +       LWMI_CD_TABLE_ITEM(LENOVO_CAPABILITY_DATA_00),
> >         LWMI_CD_TABLE_ITEM(LENOVO_CAPABILITY_DATA_01),
> >  };
> > 
> > @@ -72,6 +78,7 @@ struct cd_list {
> >         u8 count;
> > 
> >         union {
> > +               DECLARE_FLEX_ARRAY(struct capdata00, cd00);
> >                 DECLARE_FLEX_ARRAY(struct capdata01, cd01);
> >         };
> >  };
> > @@ -95,6 +102,9 @@ static int lwmi_cd_component_bind(struct device *cd_dev,
> >         struct lwmi_cd_binder *binder = data;
> > 
> >         switch (priv->list->type) {
> > +       case LENOVO_CAPABILITY_DATA_00:
> > +               binder->cd00_list = priv->list;
> > +               break;
> >         case LENOVO_CAPABILITY_DATA_01:
> >                 binder->cd01_list = priv->list;
> >                 break;
> > @@ -136,6 +146,9 @@ static const struct component_ops lwmi_cd_component_ops = {
> >                 return -EINVAL;                                                                 \
> >         }
> > 
> > +DEF_LWMI_CDXX_GET_DATA(cd00, LENOVO_CAPABILITY_DATA_00, struct capdata00);
> > +EXPORT_SYMBOL_NS_GPL(lwmi_cd00_get_data, "LENOVO_WMI_CD");
> > +
> >  DEF_LWMI_CDXX_GET_DATA(cd01, LENOVO_CAPABILITY_DATA_01, struct capdata01);
> >  EXPORT_SYMBOL_NS_GPL(lwmi_cd01_get_data, "LENOVO_WMI_CD");
> > 
> > @@ -154,6 +167,10 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv)
> >         void *p;
> > 
> >         switch (priv->list->type) {
> > +       case LENOVO_CAPABILITY_DATA_00:
> > +               p = &priv->list->cd00[0];
> > +               size = sizeof(priv->list->cd00[0]);
> > +               break;
> >         case LENOVO_CAPABILITY_DATA_01:
> >                 p = &priv->list->cd01[0];
> >                 size = sizeof(priv->list->cd01[0]);
> > @@ -199,6 +216,9 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, enum lwmi_cd_type type)
> >         count = wmidev_instance_count(priv->wdev);
> > 
> >         switch (type) {
> > +       case LENOVO_CAPABILITY_DATA_00:
> > +               list_size = struct_size(list, cd00, count);
> > +               break;
> >         case LENOVO_CAPABILITY_DATA_01:
> >                 list_size = struct_size(list, cd01, count);
> >                 break;
> > @@ -346,6 +366,7 @@ static void lwmi_cd_remove(struct wmi_device *wdev)
> >         .context = &lwmi_cd_table[_type]
> > 
> >  static const struct wmi_device_id lwmi_cd_id_table[] = {
> > +       { LWMI_CD_WDEV_ID(LENOVO_CAPABILITY_DATA_00) },
> >         { LWMI_CD_WDEV_ID(LENOVO_CAPABILITY_DATA_01) },
> >         {}
> >  };
> > diff --git a/drivers/platform/x86/lenovo/wmi-capdata.h b/drivers/platform/x86/lenovo/wmi-capdata.h
> > index 1e5fce7836cbf..a6f0cb006e745 100644
> > --- a/drivers/platform/x86/lenovo/wmi-capdata.h
> > +++ b/drivers/platform/x86/lenovo/wmi-capdata.h
> > @@ -11,6 +11,12 @@ struct component_match;
> >  struct device;
> >  struct cd_list;
> > 
> > +struct capdata00 {
> > +       u32 id;
> > +       u32 supported;
> > +       u32 default_value;
> > +};
> > +
> >  struct capdata01 {
> >         u32 id;
> >         u32 supported;
> > @@ -21,9 +27,11 @@ struct capdata01 {
> >  };
> > 
> >  struct lwmi_cd_binder {
> > +       struct cd_list *cd00_list;
> >         struct cd_list *cd01_list;
> >  };
> > 
> > +int lwmi_cd00_get_data(struct cd_list *list, u32 attribute_id, struct capdata00 *output);
> >  int lwmi_cd01_get_data(struct cd_list *list, u32 attribute_id, struct capdata01 *output);
> >  void lwmi_cd_match_add_all(struct device *master, struct component_match **matchptr);
> > 
> > --
> > 2.51.0
> > 

  reply	other threads:[~2025-10-26 17:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-19 21:04 [PATCH 0/6] platform/x86: lenovo-wmi-{capdata,other}: Add HWMON for fan speed Rong Zhang
2025-10-19 21:04 ` [PATCH 1/6] platform/x86: Rename lenovo-wmi-capdata01 to lenovo-wmi-capdata Rong Zhang
2025-10-26  4:41   ` Derek John Clark
2025-10-19 21:04 ` [PATCH 2/6] platform/x86: lenovo-wmi-{capdata,other}: Support multiple Capability Data Rong Zhang
2025-10-20  1:03   ` kernel test robot
2025-10-26  4:43   ` Derek John Clark
2025-10-19 21:04 ` [PATCH 3/6] platform/x86: lenovo-wmi-capdata: Add support for Capability Data 00 Rong Zhang
2025-10-26  4:55   ` Derek John Clark
2025-10-26 17:18     ` Rong Zhang [this message]
2025-10-19 21:04 ` [PATCH 4/6] platform/x86: lenovo-wmi-other: Add HWMON for fan speed RPM Rong Zhang
2025-10-26  5:23   ` Derek John Clark
2025-10-26 19:42     ` Rong Zhang
2025-10-26 20:19       ` Derek J. Clark
2025-10-26 23:04       ` Armin Wolf
2025-10-27 12:15         ` Rong Zhang
2025-10-19 21:04 ` [PATCH 5/6] platform/x86: lenovo-wmi-capdata: Add support for Fan Test Data Rong Zhang
2025-10-19 21:04 ` [PATCH 6/6] platform/x86: lenovo-wmi-other: Report min/max RPM and hide dummy fans Rong Zhang
2025-10-26  4:39 ` [PATCH 0/6] platform/x86: lenovo-wmi-{capdata,other}: Add HWMON for fan speed Derek John Clark
2025-10-26 17:11   ` Rong Zhang
2025-10-26 22:59     ` Armin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e85aa61b4cf3d3dbbe5ce32a7e97a949171d1110.camel@rong.moe \
    --to=i@rong.moe \
    --cc=W_Armin@gmx.de \
    --cc=derekjohn.clark@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).