mbox series

[v2,0/2] platform/x86: dell: Add new dell-wmi-ddv driver

Message ID 20220927204521.601887-1-W_Armin@gmx.de (mailing list archive)
Headers show
Series platform/x86: dell: Add new dell-wmi-ddv driver | expand

Message

Armin Wolf Sept. 27, 2022, 8:45 p.m. UTC
This patch series adds a new driver for a WMI interface found in
many newer Dell machines. This interface allows to read battery
properties like temperature and the ePPID (Dell-specific), while
also providing fan and thermal sensor information.

The interface does support multiple batteries which are indentified
by an "index", which appears to be the battery ACPI UID. Since
the interface also appears to omit any bounts checking of the
index, the ACPI battery hook mechanism is used to discover batteries.

Since the information returned when querying fan/thermal sensor
information is currently unknown, a debugfs entry is created to
allow for easier reverse engineering. The interface is likely
to be replaced by a proper hwmon interface in the future.

Since the driver can potentially be instantiated multiple times,
the ACPI battery hook mechanism had to be extended.

The first patch passes a pointer to the battery hook to the
hook callbacks, so that they can access instance-specific data
with container_of().

The second patch finally adds the new driver. It was called
dell-wmi-ddv since the interface is called "DDV" by Dell software,
likely meaning "Dell Data Vault".

The driver was tested, together with the changes made to the
ACPI battery driver, on a Dell Inspiron 3505. Other drivers
already using the battery hook mechanism where changed as well,
but could only be compile-tested due to missing hardware.

---
Changes in v2:
- Significantly lower the amount of changes being made to the
acpi battery driver
- drop unnecessary ABI description of the temp attribute
- return 0 when a unsupported battery is found to avoid being
unloaded

Armin Wolf (2):
  ACPI: battery: Pass battery hook pointer to hook callbacks
  platform/x86: dell: Add new dell-wmi-ddv driver

 .../ABI/testing/debugfs-dell-wmi-ddv          |  21 +
 .../ABI/testing/sysfs-platform-dell-wmi-ddv   |   7 +
 MAINTAINERS                                   |   7 +
 drivers/acpi/battery.c                        |   8 +-
 drivers/platform/x86/asus-wmi.c               |   4 +-
 drivers/platform/x86/dell/Kconfig             |  13 +
 drivers/platform/x86/dell/Makefile            |   1 +
 drivers/platform/x86/dell/dell-wmi-ddv.c      | 361 ++++++++++++++++++
 drivers/platform/x86/huawei-wmi.c             |   4 +-
 drivers/platform/x86/lg-laptop.c              |   4 +-
 drivers/platform/x86/system76_acpi.c          |   4 +-
 drivers/platform/x86/thinkpad_acpi.c          |   4 +-
 drivers/platform/x86/toshiba_acpi.c           |   4 +-
 drivers/platform/x86/wmi.c                    |   1 +
 include/acpi/battery.h                        |   4 +-
 15 files changed, 429 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/ABI/testing/debugfs-dell-wmi-ddv
 create mode 100644 Documentation/ABI/testing/sysfs-platform-dell-wmi-ddv
 create mode 100644 drivers/platform/x86/dell/dell-wmi-ddv.c

--
2.30.2

Comments

Hans de Goede Sept. 28, 2022, 9:52 a.m. UTC | #1
Hi,

On 9/27/22 22:45, Armin Wolf wrote:
> This patch series adds a new driver for a WMI interface found in
> many newer Dell machines. This interface allows to read battery
> properties like temperature and the ePPID (Dell-specific), while
> also providing fan and thermal sensor information.
> 
> The interface does support multiple batteries which are indentified
> by an "index", which appears to be the battery ACPI UID. Since
> the interface also appears to omit any bounts checking of the
> index, the ACPI battery hook mechanism is used to discover batteries.
> 
> Since the information returned when querying fan/thermal sensor
> information is currently unknown, a debugfs entry is created to
> allow for easier reverse engineering. The interface is likely
> to be replaced by a proper hwmon interface in the future.
> 
> Since the driver can potentially be instantiated multiple times,
> the ACPI battery hook mechanism had to be extended.
> 
> The first patch passes a pointer to the battery hook to the
> hook callbacks, so that they can access instance-specific data
> with container_of().
> 
> The second patch finally adds the new driver. It was called
> dell-wmi-ddv since the interface is called "DDV" by Dell software,
> likely meaning "Dell Data Vault".
> 
> The driver was tested, together with the changes made to the
> ACPI battery driver, on a Dell Inspiron 3505. Other drivers
> already using the battery hook mechanism where changed as well,
> but could only be compile-tested due to missing hardware.
> 
> ---
> Changes in v2:
> - Significantly lower the amount of changes being made to the
> acpi battery driver
> - drop unnecessary ABI description of the temp attribute
> - return 0 when a unsupported battery is found to avoid being
> unloaded
> 
> Armin Wolf (2):
>   ACPI: battery: Pass battery hook pointer to hook callbacks
>   platform/x86: dell: Add new dell-wmi-ddv driver

Thanks.

The new version looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Rafael, from my POV this can be merged through either your
tree or mine. Feel free to merge this through your tree,
or please give your Ack for merging through mine
(assuming you are ok with the changes of course).

Regards,

Hans
Andy Shevchenko Sept. 28, 2022, 10:48 a.m. UTC | #2
On Wed, Sep 28, 2022 at 11:52:51AM +0200, Hans de Goede wrote:
> On 9/27/22 22:45, Armin Wolf wrote:
> > This patch series adds a new driver for a WMI interface found in
> > many newer Dell machines. This interface allows to read battery
> > properties like temperature and the ePPID (Dell-specific), while
> > also providing fan and thermal sensor information.
> > 
> > The interface does support multiple batteries which are indentified
> > by an "index", which appears to be the battery ACPI UID. Since
> > the interface also appears to omit any bounts checking of the
> > index, the ACPI battery hook mechanism is used to discover batteries.
> > 
> > Since the information returned when querying fan/thermal sensor
> > information is currently unknown, a debugfs entry is created to
> > allow for easier reverse engineering. The interface is likely
> > to be replaced by a proper hwmon interface in the future.
> > 
> > Since the driver can potentially be instantiated multiple times,
> > the ACPI battery hook mechanism had to be extended.
> > 
> > The first patch passes a pointer to the battery hook to the
> > hook callbacks, so that they can access instance-specific data
> > with container_of().
> > 
> > The second patch finally adds the new driver. It was called
> > dell-wmi-ddv since the interface is called "DDV" by Dell software,
> > likely meaning "Dell Data Vault".
> > 
> > The driver was tested, together with the changes made to the
> > ACPI battery driver, on a Dell Inspiron 3505. Other drivers
> > already using the battery hook mechanism where changed as well,
> > but could only be compile-tested due to missing hardware.
> > 
> > ---
> > Changes in v2:
> > - Significantly lower the amount of changes being made to the
> > acpi battery driver
> > - drop unnecessary ABI description of the temp attribute
> > - return 0 when a unsupported battery is found to avoid being
> > unloaded
> > 
> > Armin Wolf (2):
> >   ACPI: battery: Pass battery hook pointer to hook callbacks
> >   platform/x86: dell: Add new dell-wmi-ddv driver
> 
> Thanks.
> 
> The new version looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> for the series.
> 
> Rafael, from my POV this can be merged through either your
> tree or mine. Feel free to merge this through your tree,
> or please give your Ack for merging through mine
> (assuming you are ok with the changes of course).

I gave some comments, but it's up to you if they have to be addressed now or as
a follow up.
Hans de Goede Sept. 28, 2022, 11:37 a.m. UTC | #3
Hi,

On 9/28/22 12:48, Andy Shevchenko wrote:
> On Wed, Sep 28, 2022 at 11:52:51AM +0200, Hans de Goede wrote:
>> On 9/27/22 22:45, Armin Wolf wrote:
>>> This patch series adds a new driver for a WMI interface found in
>>> many newer Dell machines. This interface allows to read battery
>>> properties like temperature and the ePPID (Dell-specific), while
>>> also providing fan and thermal sensor information.
>>>
>>> The interface does support multiple batteries which are indentified
>>> by an "index", which appears to be the battery ACPI UID. Since
>>> the interface also appears to omit any bounts checking of the
>>> index, the ACPI battery hook mechanism is used to discover batteries.
>>>
>>> Since the information returned when querying fan/thermal sensor
>>> information is currently unknown, a debugfs entry is created to
>>> allow for easier reverse engineering. The interface is likely
>>> to be replaced by a proper hwmon interface in the future.
>>>
>>> Since the driver can potentially be instantiated multiple times,
>>> the ACPI battery hook mechanism had to be extended.
>>>
>>> The first patch passes a pointer to the battery hook to the
>>> hook callbacks, so that they can access instance-specific data
>>> with container_of().
>>>
>>> The second patch finally adds the new driver. It was called
>>> dell-wmi-ddv since the interface is called "DDV" by Dell software,
>>> likely meaning "Dell Data Vault".
>>>
>>> The driver was tested, together with the changes made to the
>>> ACPI battery driver, on a Dell Inspiron 3505. Other drivers
>>> already using the battery hook mechanism where changed as well,
>>> but could only be compile-tested due to missing hardware.
>>>
>>> ---
>>> Changes in v2:
>>> - Significantly lower the amount of changes being made to the
>>> acpi battery driver
>>> - drop unnecessary ABI description of the temp attribute
>>> - return 0 when a unsupported battery is found to avoid being
>>> unloaded
>>>
>>> Armin Wolf (2):
>>>   ACPI: battery: Pass battery hook pointer to hook callbacks
>>>   platform/x86: dell: Add new dell-wmi-ddv driver
>>
>> Thanks.
>>
>> The new version looks good to me:
>>
>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>>
>> for the series.
>>
>> Rafael, from my POV this can be merged through either your
>> tree or mine. Feel free to merge this through your tree,
>> or please give your Ack for merging through mine
>> (assuming you are ok with the changes of course).
> 
> I gave some comments, but it's up to you if they have to be addressed now or as
> a follow up.

I have answered a couple of your comments.

What remains is very small / trivial. So IMHO this can go in as
is and then a follow-up patch can be done to address your remaining
comments. Armin, can you do a follow-up patch addressing Andy's
remaining comments please?

I guess it also depends on Rafael and if Rafael is ok with taking
this for 6.1 or if this is going to be 6.2 material.

If this is going to be delayed till 6.2, then we can squash in
the follow-up patch while merging.

Regards,

Hans