linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: Kurt Borja <kuurtb@gmail.com>, platform-driver-x86@vger.kernel.org
Cc: ilpo.jarvinen@linux.intel.com, mario.limonciello@amd.com,
	hdegoede@redhat.com, linux-kernel@vger.kernel.org,
	Dell.Client.Kernel@dell.com
Subject: Re: [PATCH 16/20] platform/x86: Add alienware-wmi.h
Date: Fri, 27 Dec 2024 05:02:32 +0100	[thread overview]
Message-ID: <50f0debc-2b73-49dc-8c52-c38203c3700d@gmx.de> (raw)
In-Reply-To: <20241221055917.10555-17-kuurtb@gmail.com>

Am 21.12.24 um 06:59 schrieb Kurt Borja:

> Add a header file for alienware-wmi with shared resources to support the
> upcoming file split.

I am OK with this, but only common definitions should be moved inside this header file.
Definitions only used by a single driver should remain inside the driver file.

Thanks,
Armin Wolf

> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
>   .../platform/x86/dell/alienware-wmi-base.c    |  93 ++--------------
>   drivers/platform/x86/dell/alienware-wmi.h     | 103 ++++++++++++++++++
>   2 files changed, 112 insertions(+), 84 deletions(-)
>   create mode 100644 drivers/platform/x86/dell/alienware-wmi.h
>
> diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c
> index 8ea08f5f8810..e8d470bbb608 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-base.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-base.c
> @@ -16,26 +16,7 @@
>   #include <linux/dmi.h>
>   #include <linux/leds.h>
>   #include <linux/wmi.h>
> -
> -#define LEGACY_CONTROL_GUID		"A90597CE-A997-11DA-B012-B622A1EF5492"
> -#define LEGACY_POWER_CONTROL_GUID	"A80593CE-A997-11DA-B012-B622A1EF5492"
> -#define WMAX_CONTROL_GUID		"A70591CE-A997-11DA-B012-B622A1EF5492"
> -
> -#define WMAX_METHOD_HDMI_SOURCE		0x1
> -#define WMAX_METHOD_HDMI_STATUS		0x2
> -#define WMAX_METHOD_BRIGHTNESS		0x3
> -#define WMAX_METHOD_ZONE_CONTROL	0x4
> -#define WMAX_METHOD_HDMI_CABLE		0x5
> -#define WMAX_METHOD_AMPLIFIER_CABLE	0x6
> -#define WMAX_METHOD_DEEP_SLEEP_CONTROL	0x0B
> -#define WMAX_METHOD_DEEP_SLEEP_STATUS	0x0C
> -#define WMAX_METHOD_THERMAL_INFORMATION	0x14
> -#define WMAX_METHOD_THERMAL_CONTROL	0x15
> -#define WMAX_METHOD_GAME_SHIFT_STATUS	0x25
> -
> -#define WMAX_THERMAL_MODE_GMODE		0xAB
> -
> -#define WMAX_FAILURE_CODE		0xFFFFFFFF
> +#include "alienware-wmi.h"
>
>   MODULE_AUTHOR("Mario Limonciello <mario.limonciello@outlook.com>");
>   MODULE_DESCRIPTION("Alienware special feature control");
> @@ -54,18 +35,6 @@ enum INTERFACE_FLAGS {
>   	WMAX,
>   };
>
> -enum LEGACY_CONTROL_STATES {
> -	LEGACY_RUNNING = 1,
> -	LEGACY_BOOTING = 0,
> -	LEGACY_SUSPEND = 3,
> -};
> -
> -enum WMAX_CONTROL_STATES {
> -	WMAX_RUNNING = 0xFF,
> -	WMAX_BOOTING = 0,
> -	WMAX_SUSPEND = 3,
> -};
> -
>   enum WMAX_THERMAL_INFORMATION_OPERATIONS {
>   	WMAX_OPERATION_SYS_DESCRIPTION		= 0x02,
>   	WMAX_OPERATION_LIST_IDS			= 0x03,
> @@ -122,7 +91,6 @@ struct quirk_entry {
>
>   static struct quirk_entry *quirks;
>
> -
>   static struct quirk_entry quirk_inspiron5675 = {
>   	.num_zones = 2,
>   	.hdmi_mux = 0,
> @@ -342,33 +310,10 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {
>
>   struct awcc_features *awcc;
>
> -struct color_platform {
> -	u8 blue;
> -	u8 green;
> -	u8 red;
> -} __packed;
> -
> -struct wmax_brightness_args {
> -	u32 led_mask;
> -	u32 percentage;
> -};
> -
>   struct wmax_basic_args {
>   	u8 arg;
>   };
>
> -struct legacy_led_args {
> -	struct color_platform colors;
> -	u8 brightness;
> -	u8 state;
> -} __packed;
> -
> -struct wmax_led_args {
> -	u32 led_mask;
> -	struct color_platform colors;
> -	u8 state;
> -} __packed;
> -
>   struct wmax_u32_args {
>   	u8 operation;
>   	u8 arg1;
> @@ -382,30 +327,10 @@ struct awcc_priv {
>   	enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
>   };
>
> -struct alienfx_priv {
> -	struct platform_device *pdev;
> -	struct led_classdev global_led;
> -	struct color_platform colors[4];
> -	u8 global_brightness;
> -	u8 lighting_control_state;
> -};
> -
> -struct alienfx_ops {
> -	int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev,
> -		       u8 location);
> -	int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev,
> -			      u8 brightness);
> -};
> -
> -struct alienfx_platdata {
> -	struct wmi_device *wdev;
> -	struct alienfx_ops ops;
> -};
> -
>   static u8 interface;
>
> -static acpi_status alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
> -					 void *in_args, size_t in_size, u32 *out_data)
> +acpi_status alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
> +				  void *in_args, size_t in_size, u32 *out_data)
>   {
>   	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
>   	struct acpi_buffer in = {in_size, in_args};
> @@ -1139,7 +1064,7 @@ static struct platform_driver platform_driver = {
>   	.probe = alienfx_probe,
>   };
>
> -static int alienware_alienfx_setup(struct alienfx_platdata *pdata)
> +int alienware_alienfx_setup(struct alienfx_platdata *pdata)
>   {
>   	struct platform_device *pdev;
>   	int ret;
> @@ -1162,7 +1087,7 @@ static int alienware_alienfx_setup(struct alienfx_platdata *pdata)
>   	return 0;
>   }
>
> -static void alienware_alienfx_exit(struct wmi_device *wdev)
> +void alienware_alienfx_exit(struct wmi_device *wdev)
>   {
>   	struct platform_device *pdev;
>
> @@ -1242,12 +1167,12 @@ static struct wmi_driver alienware_legacy_wmi_driver = {
>   	.remove = legacy_wmi_remove,
>   };
>
> -static int __init alienware_legacy_wmi_init(void)
> +int __init alienware_legacy_wmi_init(void)
>   {
>   	return wmi_driver_register(&alienware_legacy_wmi_driver);
>   }
>
> -static void __exit alienware_legacy_wmi_exit(void)
> +void __exit alienware_legacy_wmi_exit(void)
>   {
>   	wmi_driver_unregister(&alienware_legacy_wmi_driver);
>   }
> @@ -1333,7 +1258,7 @@ static struct wmi_driver alienware_wmax_wmi_driver = {
>   	.remove = wmax_wmi_remove,
>   };
>
> -static int __init alienware_wmax_wmi_init(void)
> +int __init alienware_wmax_wmi_init(void)
>   {
>   	const struct dmi_system_id *id;
>
> @@ -1350,7 +1275,7 @@ static int __init alienware_wmax_wmi_init(void)
>   	return wmi_driver_register(&alienware_wmax_wmi_driver);
>   }
>
> -static void __exit alienware_wmax_wmi_exit(void)
> +void __exit alienware_wmax_wmi_exit(void)
>   {
>   	wmi_driver_unregister(&alienware_wmax_wmi_driver);
>   }
> diff --git a/drivers/platform/x86/dell/alienware-wmi.h b/drivers/platform/x86/dell/alienware-wmi.h
> new file mode 100644
> index 000000000000..78ac10122155
> --- /dev/null
> +++ b/drivers/platform/x86/dell/alienware-wmi.h
> @@ -0,0 +1,103 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Alienware WMI special features driver
> + *
> + * Copyright (C) 2014 Dell Inc <Dell.Client.Kernel@dell.com>
> + * Copyright (C) 2024 Kurt Borja <kuurtb@gmail.com>
> + */
> +
> +#ifndef _ALIENWARE_WMI_H_
> +#define _ALIENWARE_WMI_H_
> +
> +#include <linux/leds.h>
> +#include <linux/platform_device.h>
> +#include <linux/wmi.h>
> +
> +#define LEGACY_CONTROL_GUID		"A90597CE-A997-11DA-B012-B622A1EF5492"
> +#define LEGACY_POWER_CONTROL_GUID	"A80593CE-A997-11DA-B012-B622A1EF5492"
> +#define WMAX_CONTROL_GUID		"A70591CE-A997-11DA-B012-B622A1EF5492"
> +
> +#define WMAX_METHOD_HDMI_SOURCE			0x1
> +#define WMAX_METHOD_HDMI_STATUS			0x2
> +#define WMAX_METHOD_BRIGHTNESS			0x3
> +#define WMAX_METHOD_ZONE_CONTROL		0x4
> +#define WMAX_METHOD_HDMI_CABLE			0x5
> +#define WMAX_METHOD_AMPLIFIER_CABLE		0x6
> +#define WMAX_METHOD_DEEP_SLEEP_CONTROL		0x0B
> +#define WMAX_METHOD_DEEP_SLEEP_STATUS		0x0C
> +#define WMAX_METHOD_THERMAL_INFORMATION		0x14
> +#define WMAX_METHOD_THERMAL_CONTROL		0x15
> +#define WMAX_METHOD_GAME_SHIFT_STATUS		0x25
> +
> +#define WMAX_THERMAL_MODE_GMODE			0xAB
> +
> +#define WMAX_FAILURE_CODE			0xFFFFFFFF
> +
> +enum LEGACY_CONTROL_STATES {
> +	LEGACY_RUNNING = 1,
> +	LEGACY_BOOTING = 0,
> +	LEGACY_SUSPEND = 3,
> +};
> +
> +enum WMAX_CONTROL_STATES {
> +	WMAX_RUNNING = 0xFF,
> +	WMAX_BOOTING = 0,
> +	WMAX_SUSPEND = 3,
> +};
> +
> +struct color_platform {
> +	u8 blue;
> +	u8 green;
> +	u8 red;
> +} __packed;
> +
> +struct wmax_brightness_args {
> +	u32 led_mask;
> +	u32 percentage;
> +};
> +
> +struct legacy_led_args {
> +	struct color_platform colors;
> +	u8 brightness;
> +	u8 state;
> +} __packed;
> +
> +struct wmax_led_args {
> +	u32 led_mask;
> +	struct color_platform colors;
> +	u8 state;
> +} __packed;
> +
> +struct alienfx_priv {
> +	struct platform_device *pdev;
> +	struct led_classdev global_led;
> +	struct color_platform colors[4];
> +	u8 global_brightness;
> +	u8 lighting_control_state;
> +};
> +
> +struct alienfx_ops {
> +	int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev,
> +		       u8 location);
> +	int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev,
> +			      u8 brightness);
> +};
> +
> +struct alienfx_platdata {
> +	struct wmi_device *wdev;
> +	struct alienfx_ops ops;
> +};
> +
> +acpi_status alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
> +				  void *in_args, size_t in_size, u32 *out_data);
> +
> +int alienware_alienfx_setup(struct alienfx_platdata *pdata);
> +void alienware_alienfx_exit(struct wmi_device *wdev);
> +
> +int __init alienware_legacy_wmi_init(void);
> +void __exit alienware_legacy_wmi_exit(void);
> +
> +int __init alienware_wmax_wmi_init(void);
> +void __exit alienware_wmax_wmi_exit(void);
> +
> +#endif

  reply	other threads:[~2024-12-27  4:02 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-21  5:58 [PATCH 00/20] alienware-wmi driver rework Kurt Borja
2024-12-21  5:58 ` [PATCH 01/20] alienware-wmi: Remove unnecessary check at module exit Kurt Borja
2024-12-27  0:32   ` Armin Wolf
2024-12-21  5:58 ` [PATCH 02/20] alienware-wmi: Move Lighting Control State Kurt Borja
2024-12-27  0:35   ` Armin Wolf
2024-12-27  4:32     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 03/20] alienware-wmi: Modify parse_rgb() signature Kurt Borja
2024-12-27  0:36   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 04/20] alienware-wmi: Improve hdmi_mux, amplifier and deepslp group creation Kurt Borja
2024-12-27  0:44   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 05/20] alienware-wmi: Improve rgb-zones " Kurt Borja
2024-12-27  1:04   ` Armin Wolf
2024-12-27  4:37     ` Kurt Borja
2024-12-29  0:17       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 06/20] alienware_wmi: Clean variable declaration in thermal methods Kurt Borja
2024-12-27  1:06   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 07/20] alienware-wmi: Add a state container for LED control feature Kurt Borja
2024-12-27  1:32   ` Armin Wolf
2024-12-27  4:39     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 08/20] alienware-wmi: Add WMI Drivers Kurt Borja
2024-12-27  3:21   ` Armin Wolf
2024-12-27  4:44     ` Kurt Borja
2024-12-27  4:48       ` Kurt Borja
2024-12-29  0:26       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 09/20] alienware-wmi: Add a state container for thermal control methods Kurt Borja
2024-12-27  3:26   ` Armin Wolf
2024-12-27  4:50     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 10/20] alienware-wmi: Refactor LED " Kurt Borja
2024-12-27  3:41   ` Armin Wolf
2024-12-27  4:52     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 11/20] alienware-wmi: Refactor hdmi, amplifier, deepslp methods Kurt Borja
2024-12-27  3:43   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 12/20] alienware-wmi: Refactor thermal control methods Kurt Borja
2024-12-27  3:45   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 13/20] alienware-wmi: Split DMI table Kurt Borja
2024-12-27  3:55   ` Armin Wolf
2024-12-27  4:55     ` Kurt Borja
2024-12-29  0:30       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 14/20] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Kurt Borja
2024-12-27  3:56   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 15/20] platform/x86: Rename alienware-wmi.c Kurt Borja
2024-12-27  3:57   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 16/20] platform/x86: Add alienware-wmi.h Kurt Borja
2024-12-27  4:02   ` Armin Wolf [this message]
2024-12-27  4:56     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 17/20] platform-x86: Split the alienware-wmi driver Kurt Borja
2024-12-27  4:04   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 18/20] platform/x86: dell: Modify Makefile alignment Kurt Borja
2024-12-27  4:05   ` Armin Wolf
2024-12-27  4:57     ` Kurt Borja
2024-12-29  0:31       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 19/20] platform/x86: Update alienware-wmi config entries Kurt Borja
2024-12-27  4:08   ` Armin Wolf
2024-12-27  4:59     ` Kurt Borja
2024-12-29  0:32       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 20/20] alienware-wmi: Update header and module information Kurt Borja
2024-12-27  4:08   ` Armin Wolf
2024-12-27  5:01     ` Kurt Borja
2024-12-22 23:06 ` [PATCH 00/20] alienware-wmi driver rework Armin Wolf
2024-12-25 20:25   ` Armin Wolf
2024-12-25 20:36     ` Kurt Borja

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=50f0debc-2b73-49dc-8c52-c38203c3700d@gmx.de \
    --to=w_armin@gmx.de \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kuurtb@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --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).