platform/x86: wmi: Add subsystem documentation
Armin Wolf
maintainerv2 cover platform/x86: wmi: Add subsystem documentation
Currently, there is no recent documentation available for writing WMI drivers using the modern bus-based interface. This leads to developers using the deprecated GUID-based interface when developing new drivers, causing issues with notification handling when multiple WMI devices sharing the same notification ID are present. There is also no way for WMI drivers to add device specific documentation at the moment.
Add documentation for the WMI subsystem to solve those issues. The device specific documentation currently onyl include documentation for the wmi-bmof driver, but more is expected to follow.
---
Changes in v2:
- spelling fixes
- tell readers that MOF means Managed Object Format
- 80-cloumn limit
Armin Wolf (4):
platform/x86: wmi: Add kernel doc comments platform/x86: wmi: Mark GUID-based WMI interface as deprecated platform/x86: wmi: Add documentation
platform/x86: wmi: Add device specific documentation
.../ABI/stable/sysfs-platform-wmi-bmof | 7 ++ Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 +++++++++++++++++++ Documentation/wmi/devices/index.rst | 22 +++++ Documentation/wmi/devices/wmi-bmof.rst | 25 +++++ Documentation/wmi/index.rst | 19 ++++ MAINTAINERS | 9 ++ drivers/platform/x86/Kconfig | 4 +- drivers/platform/x86/wmi.c | 63 +++++++++--- include/linux/wmi.h | 41 +++++++- 12 files changed, 289 insertions(+), 20 deletions(-) create mode 100644 Documentation/ABI/stable/sysfs-platform-wmi-bmof create mode 100644 Documentation/driver-api/wmi.rst create mode 100644 Documentation/wmi/acpi-interface.rst create mode 100644 Documentation/wmi/devices/index.rst create mode 100644 Documentation/wmi/devices/wmi-bmof.rst create mode 100644 Documentation/wmi/index.rst
--
2.30.2
Armin Wolf
maintainerPATCH v2 1/4 platform/x86: wmi: Add kernel doc comments
Add kernel doc comments useful for documenting the functions/structs used to interact with the WMI driver core.
--- drivers/platform/x86/wmi.c | 51 +++++++++++++++++++++++++++++++------- include/linux/wmi.h | 41 +++++++++++++++++++++++++++--- 2 files changed, 80 insertions(+), 12 deletions(-)
drivers/platform/x86/wmi.c +42 -9
@@ -248,7 +248,9 @@ static acpi_status get_event_data(const struct wmi_block *wblock, struct acpi_bu* @wdev: A wmi bus device from a driver * @length: Required buffer size * -* Allocates memory needed for buffer, stores the buffer size in that memory +* Allocates memory needed for buffer, stores the buffer size in that memory. +* +* Return: 0 on success or a negative error code for failure. */ int set_required_buffer_size (struct wmi_device *wdev,u64 length) {
@@ -269,7 +271,9 @@ EXPORT_SYMBOL_GPL(set_required_buffer_size);* @in: Buffer containing input for the method call * @out: Empty buffer to return the method results * -* Call an ACPI-WMI method +* Call an ACPI-WMI method, the caller must free @out. +* +* Return: acpi_status signaling success or error. */ acpi_status wmi_evaluate_method (const char *guid_string,u8 instance,u32 method_id,const struct acpi_buffer *in,struct acpi_buffer *out)
@@ -294,7 +298,9 @@ EXPORT_SYMBOL_GPL(wmi_evaluate_method);* @in: Buffer containing input for the method call * @out: Empty buffer to return the method results * -* Call an ACPI-WMI method +* Call an ACPI-WMI method, the caller must free @out. +* +* Return: acpi_status signaling success or error. */ acpi_status wmidev_evaluate_method (struct wmi_device *wdev,u8 instance,u32 method_id,const struct acpi_buffer *in,struct acpi_buffer *out)
@@ -411,7 +417,9 @@ static acpi_status __query_block(struct wmi_block *wblock, u8 instance,* @instance: Instance index * @out: Empty buffer to return the contents of the data block to * -* Return the contents of an ACPI-WMI data block to a buffer +* Query a ACPI-WMI block, the caller must free @out. +* +* Return: ACPI object containing the content of the WMI block. */ acpi_status wmi_query_block (const char *guid_string,u8 instance,struct acpi_buffer *out)
@@ -427,6 +435,15 @@ acpi_status wmi_query_block(const char *guid_string, u8 instance, }EXPORT_SYMBOL_GPL (wmi_query_block); +/** +* wmidev_block_query - Return contents of a WMI block +* @wdev: A wmi bus device from a driver +* @instance: Instance index +* +* Query an ACPI-WMI block, the caller must free the result. +* +* Return: ACPI object containing the content of the WMI block. +*/ union acpi_object *wmidev_block_query (struct wmi_device *wdev,u8 instance) {struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -445,7 +462,9 @@ EXPORT_SYMBOL_GPL(wmidev_block_query);* @instance: Instance index * @in: Buffer containing new values for the data block * -* Write the contents of the input buffer to an ACPI-WMI data block +* Write the contents of the input buffer to an ACPI-WMI data block. +* +* Return: acpi_status signaling success or error. */ acpi_status wmi_set_block (const char *guid_string,u8 instance,const struct acpi_buffer *in)
@@ -555,6 +574,8 @@ static void wmi_notify_debug(u32 value, void *context)* @data: Data to be returned to handler when event is fired * * Register a handler for events sent to the ACPI-WMI mapper device. +* +* Return: acpi_status signaling success or error. */ acpi_status wmi_install_notify_handler(const char *guid, wmi_notify_handler handler,
@@ -597,6 +618,8 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler);* @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * * Unregister handler for events sent to the ACPI-WMI mapper device. +* +* Return: acpi_status signaling success or error. */ acpi_status wmi_remove_notify_handler (const char *guid) {
@@ -641,9 +664,11 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler);* wmi_get_event_data - Get WMI data associated with an event * * @event: Event to find -* @out: Buffer to hold event data. out->pointer should be freed with kfree() +* @out: Buffer to hold event data +* +* Get extra data associated with an WMI event, the caller needs to free @out. * -* Returns extra data associated with an event in WMI. +* Return: acpi_status signaling success or error. */ acpi_status wmi_get_event_data (u32 event,struct acpi_buffer *out) {
@@ -664,7 +689,9 @@ EXPORT_SYMBOL_GPL(wmi_get_event_data);* wmi_has_guid - Check if a GUID is available * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * -* Check if a given GUID is defined by _WDG +* Check if a given GUID is defined by _WDG. +* +* Return: True if GUID is available, false otherwise. */ bool wmi_has_guid (const char *guid_string) {
@@ -678,7 +705,7 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);* * Find the _UID of ACPI device associated with this WMI GUID. * -* Return: The ACPI _UID field value or NULL if the WMI GUID was not found +* Return: The ACPI _UID field value or NULL if the WMI GUID was not found. */ char *wmi_get_acpi_device_uid (const char *guid_string) {
@@ -1454,6 +1481,12 @@ int __must_check __wmi_driver_register(struct wmi_driver *driver, }EXPORT_SYMBOL (__wmi_driver_register); +/** +* wmi_driver_unregister() - Unregister a WMI driver +* @driver: WMI driver to unregister +* +* Unregisters a WMI driver from the WMI bus. +*/ void wmi_driver_unregister (struct wmi_driver *driver) {driver_unregister (&driver->driver);
include/linux/wmi.h +38 -3
71 lines not on this page · raw message
--
2.30.2
Re: [PATCH v2 1/4] platform/x86: wmi: Add kernel doc comments
Hi--
Quoted 9 lines · Armin Wolf
Add kernel doc comments useful for documenting the functions/structs used to interact with the WMI driver core.
Signed-off-by Armin Wolf <[email protected]>--- drivers/platform/x86/wmi.c | 51 +++++++++++++++++++++++++++++++------- include/linux/wmi.h | 41 +++++++++++++++++++++++++++--- 2 files changed, 80 insertions(+), 12 deletions(-)
thanks.
Signature · 1 line
~Randy
Armin Wolf
maintainerPATCH v2 2/4 platform/x86: wmi: Mark GUID-based WMI interface as deprecated
In reply to Armin WolfThe WMI driver core supports a more mordern bus-based interface for interacting with WMI devices. The older GUID-based interface depends on each WMI GUID and notification id being unique on a given system, which turned out is not the case.
Mark the older interface as deprecated since new WMI drivers should use the bus-based interface to avoid this issues.
--- drivers/platform/x86/wmi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/wmi.c +6 -6
@@ -264,7 +264,7 @@ int set_required_buffer_size(struct wmi_device *wdev, u64 length)EXPORT_SYMBOL_GPL (set_required_buffer_size);/** -* wmi_evaluate_method - Evaluate a WMI method +* wmi_evaluate_method - Evaluate a WMI method (deprecated) * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * @instance: Instance index * @method_id: Method ID to call
@@ -457,7 +457,7 @@ union acpi_object *wmidev_block_query(struct wmi_device *wdev, u8 instance)EXPORT_SYMBOL_GPL (wmidev_block_query);/** -* wmi_set_block - Write to a WMI block +* wmi_set_block - Write to a WMI block (deprecated) * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * @instance: Instance index * @in: Buffer containing new values for the data block
@@ -568,7 +568,7 @@ static void wmi_notify_debug(u32 value, void *context) }/** -* wmi_install_notify_handler - Register handler for WMI events +* wmi_install_notify_handler - Register handler for WMI events (deprecated) * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * @handler: Function to handle notifications * @data: Data to be returned to handler when event is fired
@@ -614,7 +614,7 @@ acpi_status wmi_install_notify_handler(const char *guid,EXPORT_SYMBOL_GPL (wmi_install_notify_handler);/** -* wmi_remove_notify_handler - Unregister handler for WMI events +* wmi_remove_notify_handler - Unregister handler for WMI events (deprecated) * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * * Unregister handler for events sent to the ACPI-WMI mapper device.
@@ -661,7 +661,7 @@ acpi_status wmi_remove_notify_handler(const char *guid)EXPORT_SYMBOL_GPL (wmi_remove_notify_handler);/** -* wmi_get_event_data - Get WMI data associated with an event +* wmi_get_event_data - Get WMI data associated with an event (deprecated) * * @event: Event to find * @out: Buffer to hold event data
@@ -700,7 +700,7 @@ bool wmi_has_guid(const char *guid_string)EXPORT_SYMBOL_GPL (wmi_has_guid);/** -* wmi_get_acpi_device_uid() - Get _UID name of ACPI device that defines GUID +* wmi_get_acpi_device_uid() - Get _UID name of ACPI device that defines GUID (deprecated) * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba * * Find the _UID of ACPI device associated with this WMI GUID.
--
2.30.2
Re: [PATCH v2 2/4] platform/x86: wmi: Mark GUID-based WMI interface as deprecated
Quoted 11 lines · Armin Wolf
The WMI driver core supports a more mordern bus-based interface for interacting with WMI devices. The older GUID-based interface depends on each WMI GUID and notification id being unique on a given system, which turned out is not the case.
Mark the older interface as deprecated since new WMI drivers should use the bus-based interface to avoid this issues.Signed-off-by Armin Wolf <[email protected]>--- drivers/platform/x86/wmi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
thanks.
Signature · 1 line
~Randy
Armin Wolf
maintainerPATCH v2 3/4 platform/x86: wmi: Add documentation
In reply to Armin WolfAdd documentation for the WMI subsystem. The documentation describes both the ACPI WMI interface and the driver API for interacting with the WMI driver core. The information regarding the ACPI interface was retrieved from the Ubuntu kernel references and the Windows driver samples available on GitHub. The documentation is supposed to help driver developers writing WMI drivers, as many modern machines designed to run Windows provide an ACPI WMI interface.
--- Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 ++++++++++++++++++++++++++++ Documentation/wmi/index.rst | 18 ++++++ MAINTAINERS | 2 + 6 files changed, 139 insertions(+) create mode 100644 Documentation/driver-api/wmi.rst create mode 100644 Documentation/wmi/acpi-interface.rst create mode 100644 Documentation/wmi/index.rst
Documentation/driver-api/index.rst +1 -0
@@ -113,6 +113,7 @@ available subsections can be seen below. xillybus zorro hte/index + wmi .. only:: subproject and html
Documentation/driver-api/wmi.rst new file +21 -0
@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +WMI Driver API +============== + +The WMI driver core supports a more modern bus-based interface for interacting +with WMI devices, and an older GUID-based interface. The latter interface is +considered to be deprecated, so new WMI drivers should generally avoid it since +it has some issues with multiple WMI devices and events sharing the same GUIDs +and/or notification IDs. The modern bus-based interface instead maps each +WMI device to a :c:type:`struct wmi_device <wmi_device>`, so it supports +WMI devices sharing GUIDs and/or notification IDs. Drivers can then register +a :c:type:`struct wmi_driver <wmi_driver>`, which will be bound to compatible +WMI devices by the driver core. + +.. kernel-doc:: include/linux/wmi.h + :internal: + +.. kernel-doc:: drivers/platform/x86/wmi.c + :export:
Documentation/subsystem-apis.rst +1 -0
@@ -57,3 +57,4 @@ needed). scheduler/index mhi/index peci/index + wmi/index
Documentation/wmi/acpi-interface.rst new file +96 -0
96 lines not on this page · raw message
Documentation/wmi/index.rst new file +18 -0
@@ -0,0 +1,18 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============= +WMI Subsystem +============= + +.. toctree:: + :maxdepth: 1 + + acpi-interface + +.. only:: subproject and html + + + Indices + ======= + + * :ref:`genindex`
MAINTAINERS +2 -0
@@ -449,6 +449,8 @@ F: include/linux/acpi_viot.h ACPI WMI DRIVER L: [email protected] S: Orphan +F: Documentation/driver-api/wmi.rst +F: Documentation/wmi/ F: drivers/platform/x86/wmi.c F: include/uapi/linux/wmi.h
--
2.30.2
Re: [PATCH v2 3/4] platform/x86: wmi: Add documentation
Hi--
Quoted 36 lines · Armin Wolf
Add documentation for the WMI subsystem. The documentation describes both the ACPI WMI interface and the driver API for interacting with the WMI driver core. The information regarding the ACPI interface was retrieved from the Ubuntu kernel references and the Windows driver samples available on GitHub. The documentation is supposed to help driver developers writing WMI drivers, as many modern machines designed to run Windows provide an ACPI WMI interface.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 ++++++++++++++++++++++++++++ Documentation/wmi/index.rst | 18 ++++++ MAINTAINERS | 2 + 6 files changed, 139 insertions(+) create mode 100644 Documentation/driver-api/wmi.rst create mode 100644 Documentation/wmi/acpi-interface.rst create mode 100644 Documentation/wmi/index.rstDocumentation/driver-api/wmi.rst new file +8
-0@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +WMI Driver API +============== + +The WMI driver core supports a more modern bus-based interface for interacting +with WMI devices, and an older GUID-based interface. The latter interface is
Documentation/driver-api/wmi.rst line 18
Quoted 10 lines
Documentation/driver-api/wmi.rst new file +10
-0+considered to be deprecated, so new WMI drivers should generally avoid it since +it has some issues with multiple WMI devices and events sharing the same GUIDs +and/or notification IDs. The modern bus-based interface instead maps each +WMI device to a :c:type:`struct wmi_device <wmi_device>`, so it supports +WMI devices sharing GUIDs and/or notification IDs. Drivers can then register +a :c:type:`struct wmi_driver <wmi_driver>`, which will be bound to compatible +WMI devices by the driver core. + +.. kernel-doc:: include/linux/wmi.h + :internal:
There are no kernel-doc comments in include/linux/wmi.h, so this causes a kernel-doc warning:
../include/linux/wmi.h:1: warning: no structured comments found
Otherwise this all looks good.
thanks.
Signature · 1 line
~Randy
Re: [PATCH v2 3/4] platform/x86: wmi: Add documentation
Hi All,
Armin thank you very mich for the WMI documentation work, this is much appreciated!
Quoted 53 lines · Randy Dunlap
Hi--
Quoted 36 lines · Armin Wolf
Add documentation for the WMI subsystem. The documentation describes both the ACPI WMI interface and the driver API for interacting with the WMI driver core. The information regarding the ACPI interface was retrieved from the Ubuntu kernel references and the Windows driver samples available on GitHub. The documentation is supposed to help driver developers writing WMI drivers, as many modern machines designed to run Windows provide an ACPI WMI interface.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 ++++++++++++++++++++++++++++ Documentation/wmi/index.rst | 18 ++++++ MAINTAINERS | 2 + 6 files changed, 139 insertions(+) create mode 100644 Documentation/driver-api/wmi.rst create mode 100644 Documentation/wmi/acpi-interface.rst create mode 100644 Documentation/wmi/index.rstDocumentation/driver-api/wmi.rst new file +8
-0@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +WMI Driver API +============== + +The WMI driver core supports a more modern bus-based interface for interacting +with WMI devices, and an older GUID-based interface. The latter interface isDocumentation/driver-api/wmi.rst line 18
Quoted 10 lines
Documentation/driver-api/wmi.rst new file +10
-0+considered to be deprecated, so new WMI drivers should generally avoid it since +it has some issues with multiple WMI devices and events sharing the same GUIDs +and/or notification IDs. The modern bus-based interface instead maps each +WMI device to a :c:type:`struct wmi_device <wmi_device>`, so it supports +WMI devices sharing GUIDs and/or notification IDs. Drivers can then register +a :c:type:`struct wmi_driver <wmi_driver>`, which will be bound to compatible +WMI devices by the driver core. + +.. kernel-doc:: include/linux/wmi.h + :internal:There are no kernel-doc comments in
include/linux/wmi.h, so this causes a kernel-doc warning:
Quoted 3 lines
../include/linux/wmi.h:1: warning: no structured comments foundOtherwise this all looks good.
So what is the plan here, is there something we can do to fix this new warning and should I expect a v3? Or shall I merge this as is ?
Regards,
Hans
Quoted 6 lines
Tested-by Randy Dunlap <[email protected]>Acked-by Randy Dunlap <[email protected]>thanks.
Armin Wolf
maintainerRe: [PATCH v2 3/4] platform/x86: wmi: Add documentation
Am 25.04.23 um 18:30 schrieb Hans de Goede:
Quoted 59 lines
Hi All,
Armin thank you very mich for the WMI documentation work, this is much appreciated!
Quoted 53 lines · Randy Dunlap
Hi--
Quoted 35 lines · Armin Wolf
Add documentation for the WMI subsystem. The documentation describes both the ACPI WMI interface and the driver API for interacting with the WMI driver core. The information regarding the ACPI interface was retrieved from the Ubuntu kernel references and the Windows driver samples available on GitHub. The documentation is supposed to help driver developers writing WMI drivers, as many modern machines designed to run Windows provide an ACPI WMI interface.
Signed-off-by Armin Wolf <[email protected]>--- Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 ++++++++++++++++++++++++++++ Documentation/wmi/index.rst | 18 ++++++ MAINTAINERS | 2 + 6 files changed, 139 insertions(+)create mode 100644
Documentation/driver-api/wmi.rstcreate mode 100644Documentation/wmi/acpi-interface.rstcreate mode 100644Documentation/wmi/index.rstDocumentation/driver-api/wmi.rst new file +8
-0@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +WMI Driver API +============== + +The WMI driver core supports a more modern bus-based interface for interacting +with WMI devices, and an older GUID-based interface. The latter interface isDocumentation/driver-api/wmi.rst line 18
Quoted 10 lines
Documentation/driver-api/wmi.rst new file +10
-0+considered to be deprecated, so new WMI drivers should generally avoid it since +it has some issues with multiple WMI devices and events sharing the same GUIDs +and/or notification IDs. The modern bus-based interface instead maps each +WMI device to a :c:type:`struct wmi_device <wmi_device>`, so it supports +WMI devices sharing GUIDs and/or notification IDs. Drivers can then register +a :c:type:`struct wmi_driver <wmi_driver>`, which will be bound to compatible +WMI devices by the driver core. + +.. kernel-doc:: include/linux/wmi.h + :internal:There are no kernel-doc comments in
include/linux/wmi.h, so this causes a kernel-doc warning:
../include/linux/wmi.h:1: warning: no structured comments found
Quoted 8 lines
Quoted 1 line
Otherwise this all looks good.
So what is the plan here, is there something we can do to fix this new warning and should I expect a v3? Or shall I merge this as is ?
Regards,
Hans
I did a complete rebuild of the documentation on my machine, and this error message did not appear. Also include/linux/wmi.h does include kernel-doc comments for macros like wmi_driver_register(), so i do not know why this warning is issued by sphinx.
Armin Wolf
Quoted 8 lines
Quoted 8 lines
Tested-by Randy Dunlap <[email protected]>Acked-by Randy Dunlap <[email protected]>thanks.
Randy Dunlap
reviewerRe: [PATCH v2 3/4] platform/x86: wmi: Add documentation
Quoted 65 lines · Armin Wolf
Am 25.04.23 um 18:30 schrieb Hans de Goede:
Quoted 63 lines
Hi All,
Armin thank you very mich for the WMI documentation work, this is much appreciated!
Quoted 51 lines · Randy Dunlap
Hi--
Quoted 35 lines · Armin Wolf
Add documentation for the WMI subsystem. The documentation describes both the ACPI WMI interface and the driver API for interacting with the WMI driver core. The information regarding the ACPI interface was retrieved from the Ubuntu kernel references and the Windows driver samples available on GitHub. The documentation is supposed to help driver developers writing WMI drivers, as many modern machines designed to run Windows provide an ACPI WMI interface.
Signed-off-by Armin Wolf <[email protected]>---
Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++++ Documentation/subsystem-apis.rst | 1 +Documentation/wmi/acpi-interface.rst| 96 ++++++++++++++++++++++++++++ Documentation/wmi/index.rst | 18 ++++++ MAINTAINERS | 2 +6 files changed, 139 insertions(+)create mode 100644
Documentation/driver-api/wmi.rstcreate mode 100644Documentation/wmi/acpi-interface.rstcreate mode 100644Documentation/wmi/index.rstDocumentation/driver-api/wmi.rst new file +8
-0@@ -0,0 +1,21 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============== +WMI Driver API +============== + +The WMI driver core supports a more modern bus-based interface for interacting +with WMI devices, and an older GUID-based interface. The latter interface isDocumentation/driver-api/wmi.rst line 18
Quoted 10 lines
Documentation/driver-api/wmi.rst new file +10
-0+considered to be deprecated, so new WMI drivers should generally avoid it since +it has some issues with multiple WMI devices and events sharing the same GUIDs +and/or notification IDs. The modern bus-based interface instead maps each +WMI device to a :c:type:`struct wmi_device <wmi_device>`, so it supports +WMI devices sharing GUIDs and/or notification IDs. Drivers can then register +a :c:type:`struct wmi_driver <wmi_driver>`, which will be bound to compatible +WMI devices by the driver core. + +.. kernel-doc:: include/linux/wmi.h + :internal:There are no kernel-doc comments in
include/linux/wmi.h, so this causes a kernel-doc warning:Quoted 3 lines
../include/linux/wmi.h:1: warning: no structured comments foundOtherwise this all looks good.
So what is the plan here, is there something we can do to fix this new warning and should I expect a v3? Or shall I merge this as is ?
Quoted 8 lines
Quoted 4 lines
Regards,
Hans
I did a complete rebuild of the documentation on my machine, and this error message did not appear. Also
include/linux/wmi.hdoes include kernel-doc comments for macros likewmi_driver_register(), so i do not know why this warning is issued by sphinx.
OK, Hans, go ahead and merge it as is.
Thanks.
Signature · 1 line
~Randy
Armin Wolf
maintainerPATCH v2 4/4 platform/x86: wmi: Add device specific documentation
In reply to Armin WolfAdd a place for device-specific documentation of WMI drivers. The first entry is documentation for the wmi-bmof driver, with additional documentation being expected to follow.
--- .../ABI/stable/sysfs-platform-wmi-bmof | 7 ++++++ Documentation/wmi/devices/index.rst | 22 ++++++++++++++++ Documentation/wmi/devices/wmi-bmof.rst | 25 +++++++++++++++++++ Documentation/wmi/index.rst | 1 + MAINTAINERS | 7 ++++++ drivers/platform/x86/Kconfig | 4 +-- 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/stable/sysfs-platform-wmi-bmof create mode 100644 Documentation/wmi/devices/index.rst create mode 100644 Documentation/wmi/devices/wmi-bmof.rst
Documentation/ABI/stable/sysfs-platform-wmi-bmof new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/bus/wmi/devices/05901221-D566-11D1-B2F0-00A0C9062910[-X]/bmof +Date: Jun 2017 +KernelVersion: 4.13 +Description: + Binary MOF metadata used to decribe the details of available ACPI WMI interfaces. + + See Documentation/wmi/devices/wmi-bmof.rst for details.
Documentation/wmi/devices/index.rst new file +22 -0
@@ -0,0 +1,22 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============================= +Driver-specific Documentation +============================= + +This section provides information about various devices supported by +the Linux kernel, their protocols and driver details. + +.. toctree:: + :maxdepth: 1 + :numbered: + :glob: + + * + +.. only:: subproject and html + + Indices + ======= + + * :ref:`genindex`
Documentation/wmi/devices/wmi-bmof.rst new file +25 -0
@@ -0,0 +1,25 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +============================== +WMI embedded Binary MOF driver +============================== + +Introduction +============ + +Many machines embed WMI Binary MOF (Managed Object Format) metadata used to +describe the details of their ACPI WMI interfaces. The data can be decoded +with tools like `bmfdec <https://github.com/pali/bmfdec>`_ to obtain a +human readable WMI interface description, which is useful for developing +new WMI drivers. + +The Binary MOF data can be retrieved from the ``bmof`` sysfs attribute of the +associated WMI device. Please note that multiple WMI devices containing Binary +MOF data can exist on a given system. + +WMI interface +============= + +The Binary MOF WMI device is identified by the WMI GUID ``05901221-D566-11D1-B2F0-00A0C9062910``. +The Binary MOF can be obtained by doing a WMI data block query. The result is +then returned as an ACPI buffer with a variable size.
Documentation/wmi/index.rst +1 -0
@@ -8,6 +8,7 @@ WMI Subsystem :maxdepth: 1 acpi-interface + devices/index .. only:: subproject and html
MAINTAINERS +7 -0
@@ -22556,6 +22556,13 @@ L: [email protected] S: Odd fixes F: drivers/net/wireless/wl3501* +WMI BINARY MOF DRIVER +L: [email protected] +S: Orphan +F: Documentation/ABI/stable/sysfs-platform-wmi-bmof +F: Documentation/wmi/devices/wmi-bmof.rst +F: drivers/platform/x86/wmi-bmof.c + WOLFSON MICROELECTRONICS DRIVERS L: [email protected] S: Supported
drivers/platform/x86/Kconfig +2 -2
@@ -43,8 +43,8 @@ config WMI_BMOF default ACPI_WMI help Say Y here if you want to be able to read a firmware-embedded - WMI Binary MOF data. Using this requires userspace tools and may be - rather tedious. + WMI Binary MOF (Managed Object Format) data. Using this requires + userspace tools and may be rather tedious. To compile this driver as a module, choose M here: the module will be called wmi-bmof.
--
2.30.2
Re: [PATCH v2 4/4] platform/x86: wmi: Add device specific documentation
Quoted 5 lines · Armin Wolf
Add a place for device-specific documentation of WMI drivers. The first entry is documentation for the wmi-bmof driver, with additional documentation being expected to follow.
Signed-off-by Armin Wolf <[email protected]>
Quoted 11 lines
--- .../ABI/stable/sysfs-platform-wmi-bmof | 7 ++++++ Documentation/wmi/devices/index.rst | 22 ++++++++++++++++ Documentation/wmi/devices/wmi-bmof.rst | 25 +++++++++++++++++++ Documentation/wmi/index.rst | 1 + MAINTAINERS | 7 ++++++ drivers/platform/x86/Kconfig | 4 +-- 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/stable/sysfs-platform-wmi-bmof create mode 100644 Documentation/wmi/devices/index.rst create mode 100644 Documentation/wmi/devices/wmi-bmof.rst
thank.
Signature · 1 line
~Randy
Hi Armin,
Quoted 9 lines · Armin Wolf
Currently, there is no recent documentation available for writing WMI drivers using the modern bus-based interface. This leads to developers using the deprecated GUID-based interface when developing new drivers, causing issues with notification handling when multiple WMI devices sharing the same notification ID are present. There is also no way for WMI drivers to add device specific documentation at the moment.
Add documentation for the WMI subsystem to solve those issues. The device specific documentation currently onyl include documentation for the wmi-bmof driver, but more is expected to follow.
Thank you for your patch series, I've applied this series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Patches which are added to review-hans now are intended for the next rc1. This branch will get rebased to the next rc1 when it is out and after the rebasing the contents of review-hans will be pushed to the platform-drivers-x86/for-next branch.
Regards,
Hans
Quoted 35 lines
---
Changes in v2:
- spelling fixes
- tell readers that MOF means Managed Object Format
- 80-cloumn limitArmin Wolf (4):
platform/x86: wmi: Add kernel doc comments platform/x86: wmi: Mark GUID-based WMI interface as deprecated platform/x86: wmi: Add documentation
platform/x86: wmi: Add device specific documentation.../ABI/stable/sysfs-platform-wmi-bmof | 7 ++ Documentation/driver-api/index.rst | 1 + Documentation/driver-api/wmi.rst | 21 ++++ Documentation/subsystem-apis.rst | 1 + Documentation/wmi/acpi-interface.rst | 96 +++++++++++++++++++ Documentation/wmi/devices/index.rst | 22 +++++ Documentation/wmi/devices/wmi-bmof.rst | 25 +++++ Documentation/wmi/index.rst | 19 ++++ MAINTAINERS | 9 ++ drivers/platform/x86/Kconfig | 4 +- drivers/platform/x86/wmi.c | 63 +++++++++--- include/linux/wmi.h | 41 +++++++- 12 files changed, 289 insertions(+), 20 deletions(-) create mode 100644 Documentation/ABI/stable/sysfs-platform-wmi-bmof create mode 100644 Documentation/driver-api/wmi.rst create mode 100644 Documentation/wmi/acpi-interface.rst create mode 100644 Documentation/wmi/devices/index.rst create mode 100644 Documentation/wmi/devices/wmi-bmof.rst create mode 100644 Documentation/wmi/index.rst--
2.30.2