diff mbox series

[1/5] platform/x86: dell-ddv: Add support for interface version 3

Message ID 20230126194021.381092-2-W_Armin@gmx.de (mailing list archive)
State Handled Elsewhere
Headers show
Series platform/x86: dell-ddv: Various driver updates | expand

Commit Message

Armin Wolf Jan. 26, 2023, 7:40 p.m. UTC
While trying to solve a bugreport on bugzilla, i learned that
some devices (for example the Dell XPS 17 9710) provide a more
recent DDV WMI interface (version 3).
Since the new interface version just adds an additional method,
no code changes are necessary apart from whitelisting the version.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/dell/dell-wmi-ddv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--
2.30.2

Comments

Hans de Goede Jan. 30, 2023, 3:05 p.m. UTC | #1
Hi,

On 1/26/23 20:40, Armin Wolf wrote:
> While trying to solve a bugreport on bugzilla, i learned that
> some devices (for example the Dell XPS 17 9710) provide a more
> recent DDV WMI interface (version 3).
> Since the new interface version just adds an additional method,
> no code changes are necessary apart from whitelisting the version.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>

Thank you for your patch, I've applied this patch 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.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans

> ---
>  drivers/platform/x86/dell/dell-wmi-ddv.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
> index 2bb449845d14..9cb6ae42dbdc 100644
> --- a/drivers/platform/x86/dell/dell-wmi-ddv.c
> +++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
> @@ -26,7 +26,8 @@
> 
>  #define DRIVER_NAME	"dell-wmi-ddv"
> 
> -#define DELL_DDV_SUPPORTED_INTERFACE 2
> +#define DELL_DDV_SUPPORTED_VERSION_MIN	2
> +#define DELL_DDV_SUPPORTED_VERSION_MAX	3
>  #define DELL_DDV_GUID	"8A42EA14-4F2A-FD45-6422-0087F7A7E608"
> 
>  #define DELL_EPPID_LENGTH	20
> @@ -49,6 +50,7 @@ enum dell_ddv_method {
>  	DELL_DDV_BATTERY_RAW_ANALYTICS_START	= 0x0E,
>  	DELL_DDV_BATTERY_RAW_ANALYTICS		= 0x0F,
>  	DELL_DDV_BATTERY_DESIGN_VOLTAGE		= 0x10,
> +	DELL_DDV_BATTERY_RAW_ANALYTICS_A_BLOCK	= 0x11, /* version 3 */
> 
>  	DELL_DDV_INTERFACE_VERSION		= 0x12,
> 
> @@ -340,7 +342,7 @@ static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context)
>  		return ret;
> 
>  	dev_dbg(&wdev->dev, "WMI interface version: %d\n", version);
> -	if (version != DELL_DDV_SUPPORTED_INTERFACE)
> +	if (version < DELL_DDV_SUPPORTED_VERSION_MIN || version > DELL_DDV_SUPPORTED_VERSION_MAX)
>  		return -ENODEV;
> 
>  	data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL);
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/dell/dell-wmi-ddv.c b/drivers/platform/x86/dell/dell-wmi-ddv.c
index 2bb449845d14..9cb6ae42dbdc 100644
--- a/drivers/platform/x86/dell/dell-wmi-ddv.c
+++ b/drivers/platform/x86/dell/dell-wmi-ddv.c
@@ -26,7 +26,8 @@ 

 #define DRIVER_NAME	"dell-wmi-ddv"

-#define DELL_DDV_SUPPORTED_INTERFACE 2
+#define DELL_DDV_SUPPORTED_VERSION_MIN	2
+#define DELL_DDV_SUPPORTED_VERSION_MAX	3
 #define DELL_DDV_GUID	"8A42EA14-4F2A-FD45-6422-0087F7A7E608"

 #define DELL_EPPID_LENGTH	20
@@ -49,6 +50,7 @@  enum dell_ddv_method {
 	DELL_DDV_BATTERY_RAW_ANALYTICS_START	= 0x0E,
 	DELL_DDV_BATTERY_RAW_ANALYTICS		= 0x0F,
 	DELL_DDV_BATTERY_DESIGN_VOLTAGE		= 0x10,
+	DELL_DDV_BATTERY_RAW_ANALYTICS_A_BLOCK	= 0x11, /* version 3 */

 	DELL_DDV_INTERFACE_VERSION		= 0x12,

@@ -340,7 +342,7 @@  static int dell_wmi_ddv_probe(struct wmi_device *wdev, const void *context)
 		return ret;

 	dev_dbg(&wdev->dev, "WMI interface version: %d\n", version);
-	if (version != DELL_DDV_SUPPORTED_INTERFACE)
+	if (version < DELL_DDV_SUPPORTED_VERSION_MIN || version > DELL_DDV_SUPPORTED_VERSION_MAX)
 		return -ENODEV;

 	data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL);