Add a header file for alienware-wmi with shared resources to support the
upcoming file split.
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
.../platform/x86/dell/alienware-wmi-base.c | 68 +++-------------
drivers/platform/x86/dell/alienware-wmi.h | 78 +++++++++++++++++++
2 files changed, 87 insertions(+), 59 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 b9daf22efdbe..a268193ad2a1 100644
--- a/drivers/platform/x86/dell/alienware-wmi-base.c
+++ b/drivers/platform/x86/dell/alienware-wmi-base.c
@@ -16,10 +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"
+#include "alienware-wmi.h"
#define WMAX_METHOD_HDMI_SOURCE 0x1
#define WMAX_METHOD_HDMI_STATUS 0x2
@@ -54,18 +51,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,
@@ -113,16 +98,8 @@ static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_
[THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE,
};
-struct alienfx_quirks {
- u8 num_zones;
- bool hdmi_mux;
- bool amplifier;
- bool deepslp;
-};
-
static struct alienfx_quirks *quirks;
-
static struct alienfx_quirks quirk_inspiron5675 = {
.num_zones = 2,
.hdmi_mux = false,
@@ -245,12 +222,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = {
{}
};
-struct color_platform {
- u8 blue;
- u8 green;
- u8 red;
-} __packed;
-
struct wmax_brightness_args {
u32 led_mask;
u32 percentage;
@@ -285,27 +256,6 @@ struct awcc_priv {
enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
};
-struct alienfx_priv {
- struct platform_device *pdev;
- struct alienfx_quirks *quirks;
- 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;
struct awcc_quirks {
@@ -405,8 +355,8 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {
struct awcc_quirks *awcc;
-static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
- void *in_args, size_t in_size, u32 *out_data)
+int 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 +1089,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 +1112,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 = dev_get_drvdata(&wdev->dev);
@@ -1242,12 +1192,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);
}
@@ -1330,7 +1280,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;
@@ -1347,7 +1297,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..dccbf4f95da0
--- /dev/null
+++ b/drivers/platform/x86/dell/alienware-wmi.h
@@ -0,0 +1,78 @@
+/* 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"
+
+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 alienfx_quirks {
+ u8 num_zones;
+ bool hdmi_mux;
+ bool amplifier;
+ bool deepslp;
+};
+
+struct color_platform {
+ u8 blue;
+ u8 green;
+ u8 red;
+} __packed;
+
+struct alienfx_priv {
+ struct platform_device *pdev;
+ struct alienfx_quirks *quirks;
+ 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;
+};
+
+int 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
--
2.47.1
Am 29.12.24 um 20:45 schrieb Kurt Borja:
> Add a header file for alienware-wmi with shared resources to support the
> upcoming file split.
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> .../platform/x86/dell/alienware-wmi-base.c | 68 +++-------------
> drivers/platform/x86/dell/alienware-wmi.h | 78 +++++++++++++++++++
> 2 files changed, 87 insertions(+), 59 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 b9daf22efdbe..a268193ad2a1 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-base.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-base.c
> @@ -16,10 +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"
> +#include "alienware-wmi.h"
>
> #define WMAX_METHOD_HDMI_SOURCE 0x1
> #define WMAX_METHOD_HDMI_STATUS 0x2
> @@ -54,18 +51,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,
> @@ -113,16 +98,8 @@ static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_
> [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE,
> };
>
> -struct alienfx_quirks {
> - u8 num_zones;
> - bool hdmi_mux;
> - bool amplifier;
> - bool deepslp;
> -};
> -
> static struct alienfx_quirks *quirks;
>
> -
> static struct alienfx_quirks quirk_inspiron5675 = {
> .num_zones = 2,
> .hdmi_mux = false,
> @@ -245,12 +222,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = {
> {}
> };
>
> -struct color_platform {
> - u8 blue;
> - u8 green;
> - u8 red;
> -} __packed;
> -
> struct wmax_brightness_args {
> u32 led_mask;
> u32 percentage;
> @@ -285,27 +256,6 @@ struct awcc_priv {
> enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST];
> };
>
> -struct alienfx_priv {
> - struct platform_device *pdev;
> - struct alienfx_quirks *quirks;
> - 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;
>
> struct awcc_quirks {
> @@ -405,8 +355,8 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {
>
> struct awcc_quirks *awcc;
>
> -static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
> - void *in_args, size_t in_size, u32 *out_data)
> +int 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 +1089,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 +1112,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 = dev_get_drvdata(&wdev->dev);
>
> @@ -1242,12 +1192,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);
> }
> @@ -1330,7 +1280,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;
>
> @@ -1347,7 +1297,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..dccbf4f95da0
> --- /dev/null
> +++ b/drivers/platform/x86/dell/alienware-wmi.h
> @@ -0,0 +1,78 @@
> +/* 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"
> +
> +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 alienfx_quirks {
> + u8 num_zones;
> + bool hdmi_mux;
> + bool amplifier;
> + bool deepslp;
> +};
> +
> +struct color_platform {
> + u8 blue;
> + u8 green;
> + u8 red;
> +} __packed;
> +
> +struct alienfx_priv {
> + struct platform_device *pdev;
> + struct alienfx_quirks *quirks;
> + 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;
> +};
> +
> +int 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
© 2016 - 2025 Red Hat, Inc.