platform/x86: alienware-wmi driver rework
Subsystems (2)
Kurt Borja
maintainerv10 cover platform/x86: alienware-wmi driver rework
Hi all,
One more correction. I apologize for the noise!
~ Kurt
---
[11/14]
- Fix .driver_data of Alienware m16 R1 AMD
v9: https://lore.kernel.org/platform-driver-x86/[email protected]/
Kurt Borja (14):
platform/x86: alienware-wmi: Add a state container for LED control
feature
platform/x86: alienware-wmi: Add WMI Drivers
platform/x86: alienware-wmi: Add a state container for thermal control
methods
platform/x86: alienware-wmi: Refactor LED control methods platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods platform/x86: alienware-wmi: Refactor thermal control methods platform/x86: alienware-wmi: Split DMI table
MAINTAINERS: Update ALIENWARE WMI DRIVER entry platform/x86: Rename alienware-wmi.c
platform/x86: Add alienware-wmi.h
platform/x86: Split the alienware-wmi driver
platform/x86: dell: Modify Makefile alignment platform/x86: Update alienware-wmi config entries platform/x86: alienware-wmi: Update header and module information
MAINTAINERS | 4 +- drivers/platform/x86/dell/Kconfig | 30 +- drivers/platform/x86/dell/Makefile | 45 +- .../platform/x86/dell/alienware-wmi-base.c | 491 +++++++ .../platform/x86/dell/alienware-wmi-legacy.c | 95 ++ .../platform/x86/dell/alienware-wmi-wmax.c | 768 ++++++++++ drivers/platform/x86/dell/alienware-wmi.c | 1249 ----------------- drivers/platform/x86/dell/alienware-wmi.h | 117 ++ 8 files changed, 1523 insertions(+), 1276 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi-base.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-legacy.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-wmax.c delete mode 100644 drivers/platform/x86/dell/alienware-wmi.c create mode 100644 drivers/platform/x86/dell/alienware-wmi.h
base-commit: e75394bbf4838857f57b6c5d00f1e56c46cd6c11
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 1/14 platform/x86: alienware-wmi: Add a state container for LED control feature
Add a state container for the "alienware-wmi" platform device and initialize it on the new alienfx_probe(). Migrate all LED control functions to use this state container to support upcoming file split.
Additionally move the led_classdev registration to the platform driver probe and make it device managed.
Drop alienware_zone_init() and alienware_zone_exit() because they are no longer needed and mimic the quirks->num_zone > 0 check by failing the platform device probe.
--- drivers/platform/x86/dell/alienware-wmi.c | 125 ++++++++++++---------- 1 file changed, 68 insertions(+), 57 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +68 -57
@@ -413,13 +413,18 @@ struct wmax_u32_args {u8 arg3; }; +struct alienfx_priv { +struct platform_device *pdev; +struct led_classdev global_led; +struct color_platform colors[4 ]; +u8 global_brightness; +u8 lighting_control_state; +}; +static struct platform_device *platform_device; -static struct color_platform colors[4 ];static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST ];static u8 interface; -static u8 lighting_control_state; -static u8 global_brightness;/* * Helpers used for zone control
@@ -451,7 +456,7 @@ static int parse_rgb(const char *buf, struct color_platform *colors)/* * Individual RGB zone control */ -static int alienware_update_led (u8 location) +static int alienware_update_led (struct alienfx_priv *priv,u8 location) {int method_id;acpi_status status;
@@ -461,21 +466,21 @@ static int alienware_update_led(u8 location)struct wmax_led_args wmax_basic_args;if (interface ==WMAX ) { wmax_basic_args.led_mask =1 << location; - wmax_basic_args.colors = colors[location]; - wmax_basic_args.state = lighting_control_state; + wmax_basic_args.colors = priv->colors[location]; + wmax_basic_args.state = priv->lighting_control_state; guid =WMAX_CONTROL_GUID ; method_id =WMAX_METHOD_ZONE_CONTROL ; input.length =sizeof (wmax_basic_args); input.pointer = &wmax_basic_args; }else { - legacy_args.colors = colors[location]; - legacy_args.brightness = global_brightness; + legacy_args.colors = priv->colors[location]; + legacy_args.brightness = priv->global_brightness; legacy_args.state =0 ; -if (lighting_control_state ==LEGACY_BOOTING || - lighting_control_state ==LEGACY_SUSPEND ) { +if (priv->lighting_control_state ==LEGACY_BOOTING || + priv->lighting_control_state ==LEGACY_SUSPEND ) { guid =LEGACY_POWER_CONTROL_GUID ; - legacy_args.state = lighting_control_state; + legacy_args.state = priv->lighting_control_state; }else guid =LEGACY_CONTROL_GUID ; method_id = location +1 ;
@@ -494,22 +499,26 @@ static int alienware_update_led(u8 location)static ssize_t zone_show (struct device *dev,struct device_attribute *attr,char *buf,u8 location) { +struct alienfx_priv *priv =dev_get_drvdata (dev); +struct color_platform *colors = &priv->colors[location]; +return sprintf (buf,"red: %d, green: %d, blue: %d\n" , - colors[location].red, colors[location].green, - colors[location].blue); + colors->red, colors->green, colors->blue); }static ssize_t zone_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count,u8 location) { +struct alienfx_priv *priv =dev_get_drvdata (dev); +struct color_platform *colors = &priv->colors[location];int ret; - ret =parse_rgb (buf, &colors[location]); + ret =parse_rgb (buf, colors);if (ret)return ret; - ret =alienware_update_led (location); + ret =alienware_update_led (priv, location);return ret ? ret : count; }
@@ -577,9 +586,11 @@ static ssize_t lighting_control_state_show(struct device *dev,struct device_attribute *attr, char *buf) { -if (lighting_control_state ==LEGACY_BOOTING ) + struct alienfx_priv *priv = dev_get_drvdata(dev); + +if (priv->lighting_control_state ==LEGACY_BOOTING )return sysfs_emit (buf,"[booting] running suspend\n" ); -else if (lighting_control_state ==LEGACY_SUSPEND ) +else if (priv->lighting_control_state ==LEGACY_SUSPEND )return sysfs_emit (buf,"booting running [suspend]\n" );return sysfs_emit (buf,"booting [running] suspend\n" );
@@ -589,6 +600,7 @@ static ssize_t lighting_control_state_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { + struct alienfx_priv *priv = dev_get_drvdata(dev);u8 val;if (strcmp (buf,"booting\n" ) ==0 )
@@ -600,9 +612,9 @@ static ssize_t lighting_control_state_store(struct device *dev,else val =WMAX_RUNNING ; - lighting_control_state = val; + priv->lighting_control_state = val;pr_debug ("alienware-wmi: updated control state to %d\n" , - lighting_control_state); + priv->lighting_control_state);return count; }
@@ -662,46 +674,26 @@ static int wmax_brightness(int brightness)static void global_led_set (struct led_classdev *led_cdev,enum led_brightness brightness) { + struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, + global_led);int ret; - global_brightness = brightness; + + priv->global_brightness = brightness; +if (interface ==WMAX ) ret =wmax_brightness (brightness);else - ret =alienware_update_led (0 ); + ret =alienware_update_led (priv,0 );if (ret)pr_err ("LED brightness update failed\n" ); }static enum led_brightness global_led_get (struct led_classdev *led_cdev) { -return global_brightness; -} - -static struct led_classdev global_led = { - .brightness_set = global_led_set, - .brightness_get = global_led_get, - .name ="alienware::global_brightness" , -}; + struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, + global_led); -static int alienware_zone_init (struct platform_device *dev) -{ -if (interface ==WMAX ) { - lighting_control_state =WMAX_RUNNING ; - }else if (interface ==LEGACY ) { - lighting_control_state =LEGACY_RUNNING ; - } - global_led.max_brightness =0x0F ; - global_brightness = global_led.max_brightness; - -return led_classdev_register (&dev->dev, &global_led); -} - -static void alienware_zone_exit (struct platform_device *dev) -{ -if (!quirks->num_zones) -return ; - -led_classdev_unregister (&global_led); +return priv->global_brightness; } static acpi_status alienware_wmax_command(void *in_args, size_t in_size,
@@ -1157,6 +1149,33 @@ static int create_thermal_profile(struct platform_device *platform_device)/* * Platform Driver */ +static int alienfx_probe (struct platform_device *pdev) +{ +struct alienfx_priv *priv; + +if (!quirks->num_zones) +return -ENODEV ; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +if (interface ==WMAX ) + priv->lighting_control_state =WMAX_RUNNING ; +else + priv->lighting_control_state =LEGACY_RUNNING ; + + priv->pdev = pdev; + priv->global_led.name ="alienware::global_brightness" ; + priv->global_led.brightness_set = global_led_set; + priv->global_led.brightness_get = global_led_get; + priv->global_led.max_brightness =0x0F ; + priv->global_brightness = priv->global_led.max_brightness; +platform_set_drvdata (pdev, priv); + +return devm_led_classdev_register (&pdev->dev, &priv->global_led); +} +static const struct attribute_group *alienfx_groups[] = { &zone_attribute_group, &hdmi_attribute_group,
@@ -1170,6 +1189,7 @@ static struct platform_driver platform_driver = { .name = "alienware-wmi", .dev_groups = alienfx_groups, }, + .probe = alienfx_probe, };static int __init alienware_wmi_init (void )
@@ -1217,16 +1237,8 @@ static int __init alienware_wmi_init(void) goto fail_prep_thermal_profile; } -if (quirks->num_zones >0 ) { - ret =alienware_zone_init (platform_device); -if (ret) - goto fail_prep_zones; - } -return 0 ; -fail_prep_zones: -alienware_zone_exit (platform_device); fail_prep_thermal_profile:platform_device_del (platform_device); fail_platform_device2:
@@ -1241,7 +1253,6 @@ module_init(alienware_wmi_init); static void __exit alienware_wmi_exit(void) { -alienware_zone_exit (platform_device);platform_device_unregister (platform_device);platform_driver_unregister (&platform_driver); }
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 2/14 platform/x86: alienware-wmi: Add WMI Drivers
In reply to Kurt BorjaAdd WMI drivers for LEGACY and WMAX devices.
This involves moving the platform device registration to a helper function that is now called from the driver's preferred WMI device driver probe. In the case of the WMAX this is done only if !quirks->thermal because the newer WMAX interface doesn't support any of the LED features of this driver. This also eliminates the need to check for quirks->num_zones > 0 inside alienfx_probe().
Only one WMI driver is registered on module initialization to prevent registering a duplicate platform device.
Additionally, create_thermal_profile() now takes wmi_device * instead of platform_device *.
--- drivers/platform/x86/dell/alienware-wmi.c | 177 ++++++++++++++++------ 1 file changed, 134 insertions(+), 43 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +134 -43
@@ -15,6 +15,7 @@#include <linux/platform_profile.h> #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"
@@ -39,8 +40,6 @@MODULE_AUTHOR ("Mario Limonciello <[email protected]>" );MODULE_DESCRIPTION ("Alienware special feature control" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("wmi:" LEGACY_CONTROL_GUID ); -MODULE_ALIAS ("wmi:" WMAX_CONTROL_GUID );static bool force_platform_profile;module_param_unsafe (force_platform_profile, bool,0 );
@@ -421,7 +420,10 @@ struct alienfx_priv {u8 lighting_control_state; }; -static struct platform_device *platform_device; +struct alienfx_platdata { +struct wmi_device *wdev; +}; +static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST ];static u8 interface;
@@ -801,7 +803,7 @@ static DEVICE_ATTR_RW(source);static bool hdmi_group_visible (struct kobject *kobj) { -return quirks->hdmi_mux; +return interface ==WMAX && quirks->hdmi_mux; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (hdmi);
@@ -848,7 +850,7 @@ static DEVICE_ATTR_RO(status);static bool amplifier_group_visible (struct kobject *kobj) { -return quirks->amplifier; +return interface ==WMAX && quirks->amplifier; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (amplifier);
@@ -917,7 +919,7 @@ static DEVICE_ATTR_RW(deepsleep);static bool deepsleep_group_visible (struct kobject *kobj) { -return quirks->deepslp; +return interface ==WMAX && quirks->deepslp; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (deepsleep);
@@ -1136,11 +1138,11 @@ static const struct platform_profile_ops awcc_platform_profile_ops = { .profile_set = thermal_profile_set, }; -static int create_thermal_profile (struct platform_device *platform_device) +static int create_thermal_profile (struct wmi_device *wdev) {struct device *ppdev; - ppdev =devm_platform_profile_register (&platform_device->dev,"alienware-wmi" , + ppdev =devm_platform_profile_register (&wdev->dev,"alienware-wmi" ,NULL , &awcc_platform_profile_ops);return PTR_ERR_OR_ZERO (ppdev);
@@ -1153,9 +1155,6 @@ static int alienfx_probe(struct platform_device *pdev) {struct alienfx_priv *priv; -if (!quirks->num_zones) -return -ENODEV ; - priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
@@ -1192,18 +1191,118 @@ static struct platform_driver platform_driver = { .probe = alienfx_probe, }; -static int __init alienware_wmi_init (void ) +static void alienware_alienfx_remove (void *data) { +struct platform_device *pdev = data; + +platform_device_unregister (pdev); +} + +static int alienware_alienfx_setup (struct alienfx_platdata *pdata) +{ +struct device *dev = &pdata->wdev->dev; +struct platform_device *pdev;int ret; -if (wmi_has_guid (LEGACY_CONTROL_GUID )) - interface =LEGACY ; -else if (wmi_has_guid (WMAX_CONTROL_GUID )) - interface =WMAX ; -else { -pr_warn ("alienware-wmi: No known WMI GUID found\n" ); -return -ENODEV ; - } + pdev =platform_device_register_data (NULL ,"alienware-wmi" , +PLATFORM_DEVID_NONE , pdata, +sizeof (*pdata)); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); + +dev_set_drvdata (dev, pdev); + ret =devm_add_action_or_reset (dev, alienware_alienfx_remove, pdev); +if (ret) +return ret; + +return 0 ; +} + +/* +* Legacy WMI driver +*/ +static int legacy_wmi_probe (struct wmi_device *wdev,const void *context) +{ +struct alienfx_platdata pdata = { + .wdev = wdev, + }; + +return alienware_alienfx_setup (&pdata); +} + +static const struct wmi_device_id alienware_legacy_device_id_table[] = { + {LEGACY_CONTROL_GUID ,NULL }, + { }, +}; +MODULE_DEVICE_TABLE (wmi, alienware_legacy_device_id_table); + +static struct wmi_driver alienware_legacy_wmi_driver = { + .driver = { + .name ="alienware-wmi-alienfx" , + .probe_type =PROBE_PREFER_ASYNCHRONOUS , + }, + .id_table = alienware_legacy_device_id_table, + .probe = legacy_wmi_probe, + .no_singleton = true, +}; + +static int __init alienware_legacy_wmi_init (void ) +{ +return wmi_driver_register (&alienware_legacy_wmi_driver); +} + +static void __exit alienware_legacy_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_legacy_wmi_driver); +} + +/* +* WMAX WMI driver +*/ +static int wmax_wmi_probe (struct wmi_device *wdev,const void *context) +{ +struct alienfx_platdata pdata = { + .wdev = wdev, + }; +int ret; + +if (quirks->thermal) + ret =create_thermal_profile (wdev); +else + ret =alienware_alienfx_setup (&pdata); + +return ret; +} + +static const struct wmi_device_id alienware_wmax_device_id_table[] = { + {WMAX_CONTROL_GUID ,NULL }, + { }, +}; +MODULE_DEVICE_TABLE (wmi, alienware_wmax_device_id_table); + +static struct wmi_driver alienware_wmax_wmi_driver = { + .driver = { + .name ="alienware-wmi-wmax" , + .probe_type =PROBE_PREFER_ASYNCHRONOUS , + }, + .id_table = alienware_wmax_device_id_table, + .probe = wmax_wmi_probe, + .no_singleton = true, +}; + +static int __init alienware_wmax_wmi_init (void ) +{ +return wmi_driver_register (&alienware_wmax_wmi_driver); +} + +static void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +} + +static int __init alienware_wmi_init (void ) +{ +int ret;dmi_check_system (alienware_quirks);if (quirks ==NULL )
@@ -1220,32 +1319,20 @@ static int __init alienware_wmi_init(void) } ret =platform_driver_register (&platform_driver); -if (ret) - goto fail_platform_driver; - platform_device =platform_device_alloc ("alienware-wmi" ,PLATFORM_DEVID_NONE ); -if (!platform_device) { - ret = -ENOMEM ; - goto fail_platform_device1; - } - ret =platform_device_add (platform_device); -if (ret) - goto fail_platform_device2; +if (ret <0 ) +return ret; -if (quirks->thermal) { - ret =create_thermal_profile (platform_device); -if (ret) - goto fail_prep_thermal_profile; +if (wmi_has_guid (WMAX_CONTROL_GUID )) { + interface =WMAX ; + ret =alienware_wmax_wmi_init (); + }else { + interface =LEGACY ; + ret =alienware_legacy_wmi_init (); } -return 0 ; +if (ret <0 ) +platform_driver_unregister (&platform_driver); -fail_prep_thermal_profile: -platform_device_del (platform_device); -fail_platform_device2: -platform_device_put (platform_device); -fail_platform_device1: -platform_driver_unregister (&platform_driver); -fail_platform_driver:return ret; }
@@ -1253,7 +1340,11 @@ module_init(alienware_wmi_init); static void __exit alienware_wmi_exit(void) { -platform_device_unregister (platform_device); +if (interface ==WMAX ) +alienware_wmax_wmi_exit (); +else +alienware_legacy_wmi_exit (); +platform_driver_unregister (&platform_driver); }
Signature · 1 line
2.48.1
Re: [PATCH v10 02/14] platform/x86: alienware-wmi: Add WMI Drivers
Quoted 14 lines · Kurt Borja
Add WMI drivers for LEGACY and WMAX devices.
This involves moving the platform device registration to a helper function that is now called from the driver's preferred WMI device driver probe. In the case of the WMAX this is done only if
!quirks->thermalbecause the newer WMAX interface doesn't support any of the LED features of this driver. This also eliminates the need to check forquirks->num_zones > 0insidealienfx_probe().Only one WMI driver is registered on module initialization to prevent registering a duplicate platform device.
Additionally,
create_thermal_profile()now takeswmi_device* instead ofplatform_device*.
...
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi.c +6
-0+static int alienware_alienfx_setup (struct alienfx_platdata *pdata) +{ +struct device *dev = &pdata->wdev->dev; +struct platform_device *pdev;int ret; + pdev = platform_device_register_data(NULL, "alienware-wmi", + PLATFORM_DEVID_NONE, pdata,
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1218
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi.c +10
-0+ sizeof(*pdata)); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); + +dev_set_drvdata (dev, pdev); + ret =devm_add_action_or_reset (dev, alienware_alienfx_remove, pdev); +if (ret) +return ret; + +return 0 ;
return devm_add_action_or_reset(...);
Quoted 1 line
+}
...
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1234
Quoted 2 lines
drivers/platform/x86/dell/alienware-wmi.c +2
-0+static const struct wmi_device_id alienware_legacy_device_id_table[] = { + {LEGACY_CONTROL_GUID ,NULL },
Drop that ' , NULL' part, it makes an additional burden if the type of the driver_data is ever changed.
Review
Quoted 1 line
(quoted diff) +1
-0+ { },
No comma in the terminator entries.
Quoted 1 line
+};
...
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1280
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +4
-0+static const struct wmi_device_id alienware_wmax_device_id_table[] = { + {WMAX_CONTROL_GUID ,NULL }, + { }, +};
Ditto.
...
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1301
Quoted 9 lines
drivers/platform/x86/dell/alienware-wmi.c +9
-0+static int __init alienware_wmax_wmi_init (void ) +{ +return wmi_driver_register (&alienware_wmax_wmi_driver); +} + +static void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}
I believe we have module_wmi_driver() which can be used after the split (haven't checked those patches yet).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 02/14] platform/x86: alienware-wmi: Add WMI Drivers
Quoted 24 lines · Andy Shevchenko
Quoted 14 lines · Kurt Borja
Add WMI drivers for LEGACY and WMAX devices.
This involves moving the platform device registration to a helper function that is now called from the driver's preferred WMI device driver probe. In the case of the WMAX this is done only if
!quirks->thermalbecause the newer WMAX interface doesn't support any of the LED features of this driver. This also eliminates the need to check forquirks->num_zones > 0insidealienfx_probe().Only one WMI driver is registered on module initialization to prevent registering a duplicate platform device.
Additionally,
create_thermal_profile()now takeswmi_device* instead ofplatform_device*....
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +4
-0+static int alienware_alienfx_setup (struct alienfx_platdata *pdata) +{ +struct device *dev = &pdata->wdev->dev; +struct platform_device *pdev;int ret;
Quoted 14 lines
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1218
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi.c +12
-0+ pdev =platform_device_register_data (NULL ,"alienware-wmi" , +PLATFORM_DEVID_NONE , pdata, +sizeof (*pdata)); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); + +dev_set_drvdata (dev, pdev); + ret =devm_add_action_or_reset (dev, alienware_alienfx_remove, pdev); +if (ret) +return ret; + +return 0 ;return devm_add_action_or_reset(...);
Right!
Quoted 10 lines
Quoted 2 lines
+}
...
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1234
Quoted 2 lines
drivers/platform/x86/dell/alienware-wmi.c +2
-0+static const struct wmi_device_id alienware_legacy_device_id_table[] = { + {LEGACY_CONTROL_GUID ,NULL },Drop that ' , NULL' part, it makes an additional burden if the type of the
driver_datais ever changed.
Makes sense.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ { },No comma in the terminator entries.
Makes sense.
Quoted 14 lines
Quoted 2 lines
+};
...
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1280
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +4
-0+static const struct wmi_device_id alienware_wmax_device_id_table[] = { + {WMAX_CONTROL_GUID ,NULL }, + { }, +};Ditto.
...
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1301
Quoted 9 lines
drivers/platform/x86/dell/alienware-wmi.c +9
-0+static int __init alienware_wmax_wmi_init (void ) +{ +return wmi_driver_register (&alienware_wmax_wmi_driver); +} + +static void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}I believe we have
module_wmi_driver()which can be used after the split (haven't checked those patches yet).
This module has two WMI drivers, so I believe this can't be used.
Signature · 1 line
~ Kurt
Re: [PATCH v10 02/14] platform/x86: alienware-wmi: Add WMI Drivers
Quoted 2 lines · Kurt Borja
Quoted 1 line · Andy Shevchenko
On Fri, Feb 07, 2025 at 10:45:58AM -0500, Kurt Borja wrote:
...
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +4
-0+static int __init alienware_wmax_wmi_init (void ) +{ +return wmi_driver_register (&alienware_wmax_wmi_driver); +}Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi.c static struct platform_driver platform_driver = { · line 1301
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi.c +5
-0+ +static void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}I believe we have
module_wmi_driver()which can be used after the split (haven't checked those patches yet).
Quoted 1 line
This module has two WMI drivers, so I believe this can't be used.
Even after the split?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerPATCH v10 3/14 platform/x86: alienware-wmi: Add a state container for thermal control methods
In reply to Kurt BorjaRefactor all thermal control methods to use the newly defined awcc_priv state container instead of global variables. While at it, rename create_thermal_profile() to awcc_platform_profile_init() and introduce alienware_awcc_setup() to set up the "AWCC" WMI device driver data.
--- drivers/platform/x86/dell/alienware-wmi.c | 50 ++++++++++++++++++----- 1 file changed, 39 insertions(+), 11 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +39 -11
@@ -412,6 +412,12 @@ struct wmax_u32_args {u8 arg3; }; +struct awcc_priv { +struct wmi_device *wdev; +struct device *ppdev; +enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST ]; +}; +struct alienfx_priv {struct platform_device *pdev;struct led_classdev global_led;
@@ -424,8 +430,6 @@ struct alienfx_platdata {struct wmi_device *wdev; }; -static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST ]; -static u8 interface;/*
@@ -1060,6 +1064,8 @@ static int thermal_profile_get(struct device *dev,static int thermal_profile_set (struct device *dev,enum platform_profile_option profile) { +struct awcc_priv *priv =dev_get_drvdata (dev); +if (quirks->gmode) {u32 gmode_status;int ret;
@@ -1080,12 +1086,13 @@ static int thermal_profile_set(struct device *dev, } } -return wmax_thermal_control (supported_thermal_profiles[profile]); +return wmax_thermal_control (priv->supported_thermal_profiles[profile]); }static int thermal_profile_probe (void *drvdata,unsigned long *choices) {enum platform_profile_option profile; +struct awcc_priv *priv = drvdata;enum wmax_thermal_mode mode;u8 sys_desc[4 ];u32 first_mode;
@@ -1114,7 +1121,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) mode = out_data &WMAX_THERMAL_MODE_MASK ; profile = wmax_mode_to_platform_profile[mode]; - supported_thermal_profiles[profile] = out_data; + priv->supported_thermal_profiles[profile] = out_data;set_bit (profile, choices); }
@@ -1123,7 +1130,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices)return -ENODEV ;if (quirks->gmode) { - supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE ] = + priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE ] =WMAX_THERMAL_MODE_GMODE ;set_bit (PLATFORM_PROFILE_PERFORMANCE , choices);
@@ -1138,14 +1145,35 @@ static const struct platform_profile_ops awcc_platform_profile_ops = { .profile_set = thermal_profile_set, }; -static int create_thermal_profile (struct wmi_device *wdev) +static int awcc_platform_profile_init (struct wmi_device *wdev) { -struct device *ppdev; +struct awcc_priv *priv =dev_get_drvdata (&wdev->dev); + + priv->ppdev =devm_platform_profile_register (&wdev->dev,"alienware-wmi" , + priv, &awcc_platform_profile_ops); + +return PTR_ERR_OR_ZERO (priv->ppdev); +} - ppdev =devm_platform_profile_register (&wdev->dev,"alienware-wmi" , -NULL , &awcc_platform_profile_ops); +static int alienware_awcc_setup (struct wmi_device *wdev) +{ +struct awcc_priv *priv; +int ret; + + priv =devm_kzalloc (&wdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; -return PTR_ERR_OR_ZERO (ppdev); + priv->wdev = wdev; +dev_set_drvdata (&wdev->dev, priv); + +if (quirks->thermal) { + ret =awcc_platform_profile_init (wdev); +if (ret) +return ret; + } + +return 0 ; }/*
@@ -1267,7 +1295,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)int ret;if (quirks->thermal) - ret =create_thermal_profile (wdev); + ret =alienware_awcc_setup (wdev);else ret =alienware_alienfx_setup (&pdata);
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 4/14 platform/x86: alienware-wmi: Refactor LED control methods
In reply to Kurt BorjaBoth WMI devices handled by this module specify a distinct interface for LED control. Previously this module handled this by dynamically adapting arguments passed to wmi_evaluate_method() based on the interface global variable.
To avoid the use of global variables, and enable the migration to non-deprecated WMI methods, let the WMI drivers define upd_led and upd_brightness operations, which completely replace alienware_update_led() and wmax_brightness().
Also define alienware_wmi_command(), which serves as a wrapper for wmidev_evaluate_method(). This new method is very similar to alienware_wmax_command() but is WMI device agnostic.
--- drivers/platform/x86/dell/alienware-wmi.c | 166 ++++++++++++++-------- 1 file changed, 104 insertions(+), 62 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +104 -62
@@ -10,6 +10,7 @@#include <linux/acpi.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/platform_profile.h>
@@ -426,12 +427,43 @@ struct alienfx_priv {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 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}; +acpi_status ret; + + ret =wmidev_evaluate_method (wdev,0 , method_id, &in, out_data ? &out :NULL ); +if (ACPI_FAILURE (ret)) +return -EIO ; + + union acpi_object *obj __free(kfree) = out.pointer; + +if (out_data) { +if (obj && obj->type ==ACPI_TYPE_INTEGER ) + *out_data = (u32 )obj->integer.value; +else +return -ENOMSG ; + } + +return 0 ; +} +/* * Helpers used for zone control */
@@ -462,46 +494,6 @@ static int parse_rgb(const char *buf, struct color_platform *colors)/* * Individual RGB zone control */ -static int alienware_update_led (struct alienfx_priv *priv,u8 location) -{ -int method_id; -acpi_status status; -char *guid; -struct acpi_buffer input; -struct legacy_led_args legacy_args; -struct wmax_led_args wmax_basic_args; -if (interface ==WMAX ) { - wmax_basic_args.led_mask =1 << location; - wmax_basic_args.colors = priv->colors[location]; - wmax_basic_args.state = priv->lighting_control_state; - guid =WMAX_CONTROL_GUID ; - method_id =WMAX_METHOD_ZONE_CONTROL ; - - input.length =sizeof (wmax_basic_args); - input.pointer = &wmax_basic_args; - }else { - legacy_args.colors = priv->colors[location]; - legacy_args.brightness = priv->global_brightness; - legacy_args.state =0 ; -if (priv->lighting_control_state ==LEGACY_BOOTING || - priv->lighting_control_state ==LEGACY_SUSPEND ) { - guid =LEGACY_POWER_CONTROL_GUID ; - legacy_args.state = priv->lighting_control_state; - }else - guid =LEGACY_CONTROL_GUID ; - method_id = location +1 ; - - input.length =sizeof (legacy_args); - input.pointer = &legacy_args; - } -pr_debug ("alienware-wmi: guid %s method %d\n" , guid, method_id); - - status =wmi_evaluate_method (guid,0 , method_id, &input,NULL ); -if (ACPI_FAILURE (status)) -pr_err ("alienware-wmi: zone set failure: %u\n" , status); -return ACPI_FAILURE (status); -} -static ssize_t zone_show (struct device *dev,struct device_attribute *attr,char *buf,u8 location) {
@@ -518,13 +510,14 @@ static ssize_t zone_store(struct device *dev, struct device_attribute *attr, {struct alienfx_priv *priv =dev_get_drvdata (dev);struct color_platform *colors = &priv->colors[location]; +struct alienfx_platdata *pdata =dev_get_platdata (dev);int ret; ret =parse_rgb (buf, colors);if (ret)return ret; - ret =alienware_update_led (priv, location); + ret = pdata->ops.upd_led (priv, pdata->wdev, location);return ret ? ret : count; }
@@ -660,36 +653,17 @@ static struct attribute_group zone_attribute_group = {/* * LED Brightness (Global) */ -static int wmax_brightness (int brightness) -{ -acpi_status status; -struct acpi_buffer input; -struct wmax_brightness_args args = { - .led_mask =0xFF , - .percentage = brightness, - }; - input.length =sizeof (args); - input.pointer = &args; - status =wmi_evaluate_method (WMAX_CONTROL_GUID ,0 , -WMAX_METHOD_BRIGHTNESS , &input,NULL ); -if (ACPI_FAILURE (status)) -pr_err ("alienware-wmi: brightness set failure: %u\n" , status); -return ACPI_FAILURE (status); -} -static void global_led_set (struct led_classdev *led_cdev,enum led_brightness brightness) { struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, global_led); +struct alienfx_platdata *pdata =dev_get_platdata (&priv->pdev->dev);int ret; priv->global_brightness = brightness; -if (interface ==WMAX ) - ret =wmax_brightness (brightness); -else - ret =alienware_update_led (priv,0 ); + ret = pdata->ops.upd_brightness (priv, pdata->wdev, brightness);if (ret)pr_err ("LED brightness update failed\n" ); }
@@ -1249,10 +1223,49 @@ static int alienware_alienfx_setup(struct alienfx_platdata *pdata)/* * Legacy WMI driver */ +static int legacy_wmi_update_led (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 location) +{ +struct legacy_led_args legacy_args = { + .colors = priv->colors[location], + .brightness = priv->global_brightness, + .state =0 , + }; +struct acpi_buffer input; +acpi_status status; + +if (legacy_args.state !=LEGACY_RUNNING ) { + legacy_args.state = priv->lighting_control_state; + + input.length =sizeof (legacy_args); + input.pointer = &legacy_args; + + status =wmi_evaluate_method (LEGACY_POWER_CONTROL_GUID ,0 , + location +1 , &input,NULL ); +if (ACPI_FAILURE (status)) +return -EIO ; + +return 0 ; + } + +return alienware_wmi_command (wdev, location +1 , &legacy_args, +sizeof (legacy_args),NULL ); +} + +static int legacy_wmi_update_brightness (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 brightness) +{ +return legacy_wmi_update_led (priv, wdev,0 ); +} +static int legacy_wmi_probe (struct wmi_device *wdev,const void *context) {struct alienfx_platdata pdata = { .wdev = wdev, + .ops = { + .upd_led = legacy_wmi_update_led, + .upd_brightness = legacy_wmi_update_brightness, + }, };return alienware_alienfx_setup (&pdata);
@@ -1287,10 +1300,39 @@ static void __exit alienware_legacy_wmi_exit(void)/* * WMAX WMI driver */ +static int wmax_wmi_update_led (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 location) +{ +struct wmax_led_args in_args = { + .led_mask =1 << location, + .colors = priv->colors[location], + .state = priv->lighting_control_state, + }; + +return alienware_wmi_command (wdev,WMAX_METHOD_ZONE_CONTROL , &in_args, +sizeof (in_args),NULL ); +} + +static int wmax_wmi_update_brightness (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 brightness) +{ +struct wmax_brightness_args in_args = { + .led_mask =0xFF , + .percentage = brightness, + }; + +return alienware_wmi_command (wdev,WMAX_METHOD_BRIGHTNESS , &in_args, +sizeof (in_args),NULL ); +} +static int wmax_wmi_probe (struct wmi_device *wdev,const void *context) {struct alienfx_platdata pdata = { .wdev = wdev, + .ops = { + .upd_led = wmax_wmi_update_led, + .upd_brightness = wmax_wmi_update_brightness, + }, };int ret;
Signature · 1 line
2.48.1
Re: [PATCH v10 04/14] platform/x86: alienware-wmi: Refactor LED control methods
Quoted 13 lines · Kurt Borja
Both WMI devices handled by this module specify a distinct interface for LED control. Previously this module handled this by dynamically adapting arguments passed to
wmi_evaluate_method()based on theinterfaceglobal variable.To avoid the use of global variables, and enable the migration to non-deprecated WMI methods, let the WMI drivers define
upd_ledandupd_brightnessoperations, which completely replacealienware_update_led()andwmax_brightness().Also define
alienware_wmi_command(), which serves as a wrapper forwmidev_evaluate_method(). This new method is very similar toalienware_wmax_command()but is WMI device agnostic.
...
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_priv { · line 455
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi.c +12
-0+static 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}; +acpi_status ret; + + ret =wmidev_evaluate_method (wdev,0 , method_id, &in, out_data ? &out :NULL ); +if (ACPI_FAILURE (ret)) +return -EIO ; + + union acpi_object *obj __free(kfree) = out.pointer;
Actually we have ACPI_FREE(), but it's not big deal (as of today) to use kfree().
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_priv { · line 459
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c +3
-0+if (out_data) { +if (obj && obj->type ==ACPI_TYPE_INTEGER ) + *out_data = (u32 )obj->integer.value;
Unneeded casting.
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +6
-0+else +return -ENOMSG ; + } + +return 0 ; +}
...
drivers/platform/x86/dell/alienware-wmi.c static int alienware_alienfx_setup(struct alienfx_platdata *pdata) · line 1237
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+if (legacy_args.state !=LEGACY_RUNNING ) {
With inverted conditional and duplicated line it will all look better.
Quoted 15 lines
drivers/platform/x86/dell/alienware-wmi.c +15
-0+ legacy_args.state = priv->lighting_control_state; + + input.length =sizeof (legacy_args); + input.pointer = &legacy_args; + + status =wmi_evaluate_method (LEGACY_POWER_CONTROL_GUID ,0 , + location +1 , &input,NULL ); +if (ACPI_FAILURE (status)) +return -EIO ; + +return 0 ; + } + +return alienware_wmi_command (wdev, location +1 , &legacy_args, +sizeof (legacy_args),NULL );
...
drivers/platform/x86/dell/alienware-wmi.c static void __exit alienware_legacy_wmi_exit(void) · line 1320
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi.c +5
-0+static int wmax_wmi_update_brightness (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 brightness) +{ +struct wmax_brightness_args in_args = { + .led_mask =0xFF ,
GENMASK()?
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +6
-0+ .percentage = brightness, + }; + +return alienware_wmi_command (wdev,WMAX_METHOD_BRIGHTNESS , &in_args, +sizeof (in_args),NULL ); +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 04/14] platform/x86: alienware-wmi: Refactor LED control methods
Quoted 32 lines · Andy Shevchenko
Quoted 13 lines · Kurt Borja
Both WMI devices handled by this module specify a distinct interface for LED control. Previously this module handled this by dynamically adapting arguments passed to
wmi_evaluate_method()based on theinterfaceglobal variable.To avoid the use of global variables, and enable the migration to non-deprecated WMI methods, let the WMI drivers define
upd_ledandupd_brightnessoperations, which completely replacealienware_update_led()andwmax_brightness().Also define
alienware_wmi_command(), which serves as a wrapper forwmidev_evaluate_method(). This new method is very similar toalienware_wmax_command()but is WMI device agnostic....
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_priv { · line 455
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi.c +12
-0+static 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}; +acpi_status ret; + + ret =wmidev_evaluate_method (wdev,0 , method_id, &in, out_data ? &out :NULL ); +if (ACPI_FAILURE (ret)) +return -EIO ; + + union acpi_object *obj __free(kfree) = out.pointer;Actually we have
ACPI_FREE(), but it's not big deal (as of today) to usekfree().
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_priv { · line 459
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c +3
-0+if (out_data) { +if (obj && obj->type ==ACPI_TYPE_INTEGER ) + *out_data = (u32 )obj->integer.value;Unneeded casting.
Ack.
Quoted 10 lines
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi.c +6
-0+else +return -ENOMSG ; + } + +return 0 ; +}...
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c static int alienware_alienfx_setup(struct alienfx_platdata *pdata) · line 1237
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+if (legacy_args.state !=LEGACY_RUNNING ) {With inverted conditional and duplicated line it will all look better.
Ack.
Quoted 19 lines
Quoted 16 lines
drivers/platform/x86/dell/alienware-wmi.c +15
-0+ legacy_args.state = priv->lighting_control_state; + + input.length =sizeof (legacy_args); + input.pointer = &legacy_args; + + status =wmi_evaluate_method (LEGACY_POWER_CONTROL_GUID ,0 , + location +1 , &input,NULL ); +if (ACPI_FAILURE (status)) +return -EIO ; + +return 0 ; + } + +return alienware_wmi_command (wdev, location +1 , &legacy_args, +sizeof (legacy_args),NULL );...
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi.c static void __exit alienware_legacy_wmi_exit(void) · line 1320
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi.c +5
-0+static int wmax_wmi_update_brightness (struct alienfx_priv *priv, +struct wmi_device *wdev,u8 brightness) +{ +struct wmax_brightness_args in_args = { + .led_mask =0xFF ,
GENMASK()?
Ack.
Quoted 7 lines
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi.c +6
-0+ .percentage = brightness, + }; + +return alienware_wmi_command (wdev,WMAX_METHOD_BRIGHTNESS , &in_args, +sizeof (in_args),NULL ); +}
Kurt Borja
maintainerPATCH v10 5/14 platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods
In reply to Kurt BorjaRefactor show/store methods for hdmi, amplifier, deepslp sysfs groups to use alienware_wmi_command() instead of alienware_wmax_command() which uses deprecated WMI methods.
--- drivers/platform/x86/dell/alienware-wmi.c | 76 ++++++++++++----------- 1 file changed, 40 insertions(+), 36 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +40 -36
@@ -711,53 +711,55 @@ static acpi_status alienware_wmax_command(void *in_args, size_t in_size,static ssize_t cable_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args in_args = { .arg =0 , }; -acpi_status status;u32 out_data; +int ret; - status = -alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_HDMI_CABLE , &out_data); -if (ACPI_SUCCESS (status)) { + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_HDMI_CABLE , + &in_args,sizeof (in_args), &out_data); +if (!ret) {if (out_data ==0 )return sysfs_emit (buf,"[unconnected] connected unknown\n" );else if (out_data ==1 )return sysfs_emit (buf,"unconnected [connected] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI cable status: %d\n" , status); + +pr_err ("alienware-wmi: unknown HDMI cable status: %d\n" , ret);return sysfs_emit (buf,"unconnected connected [unknown]\n" ); }static ssize_t source_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args in_args = { .arg =0 , }; -acpi_status status;u32 out_data; +int ret; - status = -alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_HDMI_STATUS , &out_data); - -if (ACPI_SUCCESS (status)) { + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_HDMI_STATUS , + &in_args,sizeof (in_args), &out_data); +if (!ret) {if (out_data ==1 )return sysfs_emit (buf,"[input] gpu unknown\n" );else if (out_data ==2 )return sysfs_emit (buf,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status); + +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , ret);return sysfs_emit (buf,"input gpu [unknown]\n" ); }static ssize_t source_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args args; -acpi_status status; +int ret;if (strcmp (buf,"gpu\n" ) ==0 ) args.arg =1 ;
@@ -767,12 +769,11 @@ static ssize_t source_store(struct device *dev, struct device_attribute *attr, args.arg =3 ;pr_debug ("alienware-wmi: setting hdmi to %d : %s" , args.arg, buf); - status =alienware_wmax_command (&args,sizeof (args), -WMAX_METHOD_HDMI_SOURCE ,NULL ); + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_HDMI_SOURCE , &args, +sizeof (args),NULL ); +if (ret <0 ) +pr_err ("alienware-wmi: HDMI toggle failed: results: %u\n" , ret); -if (ACPI_FAILURE (status)) -pr_err ("alienware-wmi: HDMI toggle failed: results: %u\n" , - status);return count; }
@@ -805,22 +806,23 @@ static const struct attribute_group hdmi_attribute_group = {static ssize_t status_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args in_args = { .arg =0 , }; -acpi_status status;u32 out_data; +int ret; - status = -alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_AMPLIFIER_CABLE , &out_data); -if (ACPI_SUCCESS (status)) { + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_AMPLIFIER_CABLE , + &in_args,sizeof (in_args), &out_data); +if (!ret) {if (out_data ==0 )return sysfs_emit (buf,"[unconnected] connected unknown\n" );else if (out_data ==1 )return sysfs_emit (buf,"unconnected [connected] unknown\n" ); } -pr_err ("alienware-wmi: unknown amplifier cable status: %d\n" , status); + +pr_err ("alienware-wmi: unknown amplifier cable status: %d\n" , ret);return sysfs_emit (buf,"unconnected connected [unknown]\n" ); }
@@ -850,15 +852,16 @@ static const struct attribute_group amplifier_attribute_group = {static ssize_t deepsleep_show (struct device *dev,struct device_attribute *attr,char *buf) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args in_args = { .arg =0 , }; -acpi_status status;u32 out_data; +int ret; - status =alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_DEEP_SLEEP_STATUS , &out_data); -if (ACPI_SUCCESS (status)) { + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_STATUS , + &in_args,sizeof (in_args), &out_data); +if (!ret) {if (out_data ==0 )return sysfs_emit (buf,"[disabled] s5 s5_s4\n" );else if (out_data ==1 )
@@ -866,15 +869,17 @@ static ssize_t deepsleep_show(struct device *dev, struct device_attribute *attr,else if (out_data ==2 )return sysfs_emit (buf,"disabled s5 [s5_s4]\n" ); } -pr_err ("alienware-wmi: unknown deep sleep status: %d\n" , status); + +pr_err ("alienware-wmi: unknown deep sleep status: %d\n" , ret);return sysfs_emit (buf,"disabled s5 s5_s4 [unknown]\n" ); }static ssize_t deepsleep_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) { +struct alienfx_platdata *pdata =dev_get_platdata (dev);struct wmax_basic_args args; -acpi_status status; +int ret;if (strcmp (buf,"disabled\n" ) ==0 ) args.arg =0 ;
@@ -884,12 +889,11 @@ static ssize_t deepsleep_store(struct device *dev, struct device_attribute *attr args.arg =2 ;pr_debug ("alienware-wmi: setting deep sleep to %d : %s" , args.arg, buf); - status =alienware_wmax_command (&args,sizeof (args), -WMAX_METHOD_DEEP_SLEEP_CONTROL ,NULL ); + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_CONTROL , + &args,sizeof (args),NULL ); +if (!ret) +pr_err ("alienware-wmi: deep sleep control failed: results: %u\n" , ret); -if (ACPI_FAILURE (status)) -pr_err ("alienware-wmi: deep sleep control failed: results: %u\n" , - status);return count; }
Signature · 1 line
2.48.1
Re: [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods
Quoted 3 lines · Kurt Borja
Refactor show/store methods for hdmi, amplifier, deepslp sysfs groups to use
alienware_wmi_command()instead ofalienware_wmax_command()which uses deprecated WMI methods.
...
drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size, · line 730
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: unknown HDMI cable status: %d\n" , ret);
Rather introduce pr_fmt() and drop all these prefixes.
Review
Quoted 1 line
(quoted diff) +1
-0+ if (!ret) {
Traditional patter is to check for errors:
if (ret) {
...do error handling...
}drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size,
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +0
-0if (out_data ==1 )return sysfs_emit (buf,"[input] gpu unknown\n" );else if (out_data ==2 )
Redundant 'else'.
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +2
-1return sysfs_emit (buf,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status); + +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , ret);return sysfs_emit (buf,"input gpu [unknown]\n" );
...
Quoted 1 line
if (
strcmp(buf, "gpu\n")== 0)
Wow! This should be fixed to use sysfs_streq()
...
drivers/platform/x86/dell/alienware-wmi.c static ssize_t source_store(struct device *dev, struct device_attribute *attr, · line 775
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: HDMI toggle failed: results: %u\n" , ret);
pr_fmt()
...
drivers/platform/x86/dell/alienware-wmi.c static const struct attribute_group hdmi_attribute_group = { · line 825
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: unknown amplifier cable status: %d\n" , ret);
Ditto.
Also note, if you have a struct device available, use the respective dev_*() macros instead.
...
Quoted 1 line
if (
strcmp(buf, "disabled\n")== 0)
sysfs_streq() / sysfs_match_string() — whatever suits better.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods
Quoted 10 lines · Andy Shevchenko
Quoted 3 lines · Kurt Borja
Refactor show/store methods for hdmi, amplifier, deepslp sysfs groups to use
alienware_wmi_command()instead ofalienware_wmax_command()which uses deprecated WMI methods....
drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size, · line 730
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: unknown HDMI cable status: %d\n" , ret);Rather introduce
pr_fmt()and drop all these prefixes.
This was not introduced by me so it probably requires a different patch.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ if (!ret) {Traditional patter is to check for errors:
I wanted to change as little as possible the original function, as in my opinion this would require a different patch.
Quoted 32 lines
if (ret) { ...do error handling... }drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size,
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +0
-0if (out_data ==1 )return sysfs_emit (buf,"[input] gpu unknown\n" );else if (out_data ==2 )Redundant 'else'.
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +2
-1return sysfs_emit (buf,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status); + +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , ret);return sysfs_emit (buf,"input gpu [unknown]\n" );...
Quoted 1 line
if (
strcmp(buf, "gpu\n")== 0)Wow! This should be fixed to use
sysfs_streq()...
drivers/platform/x86/dell/alienware-wmi.c static ssize_t source_store(struct device *dev, struct device_attribute *attr, · line 775
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: HDMI toggle failed: results: %u\n" , ret);
pr_fmt()
Quoted 8 lines
...
drivers/platform/x86/dell/alienware-wmi.c static const struct attribute_group hdmi_attribute_group = { · line 825
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: unknown amplifier cable status: %d\n" , ret);Ditto.
Also note, if you have a struct device available, use the respective dev_*() macros instead.
Same as above, this was not my line to begin with so I left it as is.
Quoted 6 lines
...
Quoted 1 line
if (
strcmp(buf, "disabled\n")== 0)
sysfs_streq()/sysfs_match_string()— whatever suits better.
I can send fixes for these tho. IMO this requiere different patches.
Signature · 1 line
~ Kurt
Re: [PATCH v10 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods
Quoted 2 lines · Kurt Borja
Quoted 1 line · Andy Shevchenko
On Fri, Feb 07, 2025 at 10:46:01AM -0500, Kurt Borja wrote:
...
Quoted 5 lines
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size, · line 730
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi.c +1
-0+pr_err ("alienware-wmi: unknown HDMI cable status: %d\n" , ret);Rather introduce
pr_fmt()and drop all these prefixes.This was not introduced by me so it probably requires a different patch.
Sure, it's just a side note comment.
...
Quoted 6 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ if (!ret) {Traditional patter is to check for errors:
I wanted to change as little as possible the original function, as in my opinion this would require a different patch.
Why? This change touches the lines, it's still needs careful checking despite changes in it. But I can understand your line of thinking here. So, then consider separate patch.
Quoted 18 lines
Quoted 18 lines
if (ret) { ...do error handling... }drivers/platform/x86/dell/alienware-wmi.c static acpi_status alienware_wmax_command(void *in_args, size_t in_size,
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi.c +0
-0if (out_data ==1 )return sysfs_emit (buf,"[input] gpu unknown\n" );else if (out_data ==2 )Redundant 'else'.
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi.c +2
-1return sysfs_emit (buf,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status); + +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , ret);return sysfs_emit (buf,"input gpu [unknown]\n" );
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerPATCH v10 6/14 platform/x86: alienware-wmi: Refactor thermal control methods
In reply to Kurt BorjaRefactor thermal control methods to use alienware_wmi_command() instead of alienware_wmax_command().
Drop alienware_wmax_command() as there is no more users left.
--- drivers/platform/x86/dell/alienware-wmi.c | 88 ++++++++--------------- 1 file changed, 30 insertions(+), 58 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +30 -58
@@ -676,34 +676,6 @@ static enum led_brightness global_led_get(struct led_classdev *led_cdev)return priv->global_brightness; } -static acpi_status alienware_wmax_command (void *in_args,size_t in_size, -u32 command,u32 *out_data) -{ -acpi_status status; -union acpi_object *obj; -struct acpi_buffer input; -struct acpi_buffer output; - - input.length = in_size; - input.pointer = in_args; -if (out_data) { - output.length =ACPI_ALLOCATE_BUFFER ; - output.pointer =NULL ; - status =wmi_evaluate_method (WMAX_CONTROL_GUID ,0 , - command, &input, &output); -if (ACPI_SUCCESS (status)) { - obj = (union acpi_object *)output.pointer; -if (obj && obj->type ==ACPI_TYPE_INTEGER ) - *out_data = (u32 )obj->integer.value; - } -kfree (output.pointer); - }else { - status =wmi_evaluate_method (WMAX_CONTROL_GUID ,0 , - command, &input,NULL ); - } -return status; -} -/* * The HDMI mux sysfs node indicates the status of the HDMI input mux. * It can toggle between standard system GPU output and HDMI input.
@@ -943,7 +915,8 @@ static bool is_wmax_thermal_code(u32 code)return false; } -static int wmax_thermal_information (u8 operation,u8 arg,u32 *out_data) +static int wmax_thermal_information (struct wmi_device *wdev,u8 operation, +u8 arg,u32 *out_data) {struct wmax_u32_args in_args = { .operation = operation,
@@ -951,14 +924,12 @@ static int wmax_thermal_information(u8 operation, u8 arg, u32 *out_data) .arg2 = 0, .arg3 = 0, }; -acpi_status status; - - status =alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_THERMAL_INFORMATION , - out_data); +int ret; -if (ACPI_FAILURE (status)) -return -EIO ; + ret =alienware_wmi_command (wdev,WMAX_METHOD_THERMAL_INFORMATION , + &in_args,sizeof (in_args), out_data); +if (ret <0 ) +return ret;if (*out_data ==WMAX_FAILURE_CODE )return -EBADRQC ;
@@ -966,7 +937,7 @@ static int wmax_thermal_information(u8 operation, u8 arg, u32 *out_data)return 0 ; } -static int wmax_thermal_control (u8 profile) +static int wmax_thermal_control (struct wmi_device *wdev,u8 profile) {struct wmax_u32_args in_args = { .operation =WMAX_OPERATION_ACTIVATE_PROFILE ,
@@ -974,15 +945,13 @@ static int wmax_thermal_control(u8 profile) .arg2 = 0, .arg3 = 0, }; -acpi_status status;u32 out_data; +int ret; - status =alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_THERMAL_CONTROL , - &out_data); - -if (ACPI_FAILURE (status)) -return -EIO ; + ret =alienware_wmi_command (wdev,WMAX_METHOD_THERMAL_CONTROL , + &in_args,sizeof (in_args), &out_data); +if (ret) +return ret;if (out_data ==WMAX_FAILURE_CODE )return -EBADRQC ;
@@ -990,7 +959,8 @@ static int wmax_thermal_control(u8 profile)return 0 ; } -static int wmax_game_shift_status (u8 operation,u32 *out_data) +static int wmax_game_shift_status (struct wmi_device *wdev,u8 operation, +u32 *out_data) {struct wmax_u32_args in_args = { .operation = operation,
@@ -998,14 +968,12 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data) .arg2 = 0, .arg3 = 0, }; -acpi_status status; - - status =alienware_wmax_command (&in_args,sizeof (in_args), -WMAX_METHOD_GAME_SHIFT_STATUS , - out_data); +int ret; -if (ACPI_FAILURE (status)) -return -EIO ; + ret =alienware_wmi_command (wdev,WMAX_METHOD_GAME_SHIFT_STATUS , + &in_args,sizeof (in_args), out_data); +if (ret <0 ) +return ret;if (*out_data ==WMAX_FAILURE_CODE )return -EOPNOTSUPP ;
@@ -1016,10 +984,11 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data)static int thermal_profile_get (struct device *dev,enum platform_profile_option *profile) { +struct awcc_priv *priv =dev_get_drvdata (dev);u32 out_data;int ret; - ret =wmax_thermal_information (WMAX_OPERATION_CURRENT_PROFILE , + ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_CURRENT_PROFILE ,0 , &out_data);if (ret <0 )
@@ -1048,7 +1017,8 @@ static int thermal_profile_set(struct device *dev,u32 gmode_status;int ret; - ret =wmax_game_shift_status (WMAX_OPERATION_GET_GAME_SHIFT_STATUS , + ret =wmax_game_shift_status (priv->wdev, +WMAX_OPERATION_GET_GAME_SHIFT_STATUS , &gmode_status);if (ret <0 )
@@ -1056,7 +1026,8 @@ static int thermal_profile_set(struct device *dev,if ((profile ==PLATFORM_PROFILE_PERFORMANCE && !gmode_status) || (profile !=PLATFORM_PROFILE_PERFORMANCE && gmode_status)) { - ret =wmax_game_shift_status (WMAX_OPERATION_TOGGLE_GAME_SHIFT , + ret =wmax_game_shift_status (priv->wdev, +WMAX_OPERATION_TOGGLE_GAME_SHIFT , &gmode_status);if (ret <0 )
@@ -1064,7 +1035,8 @@ static int thermal_profile_set(struct device *dev, } } -return wmax_thermal_control (priv->supported_thermal_profiles[profile]); +return wmax_thermal_control (priv->wdev, + priv->supported_thermal_profiles[profile]); }static int thermal_profile_probe (void *drvdata,unsigned long *choices)
@@ -1077,7 +1049,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices)u32 out_data;int ret; - ret =wmax_thermal_information (WMAX_OPERATION_SYS_DESCRIPTION , + ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_SYS_DESCRIPTION ,0 , (u32 *) &sys_desc);if (ret <0 )return ret;
@@ -1085,7 +1057,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) first_mode = sys_desc[0 ] + sys_desc[1 ];for (u32 i =0 ; i < sys_desc[3 ]; i++) { - ret =wmax_thermal_information (WMAX_OPERATION_LIST_IDS , + ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_LIST_IDS , i + first_mode, &out_data);if (ret == -EIO )
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 7/14 platform/x86: alienware-wmi: Split DMI table
In reply to Kurt BorjaSplit thermal features into a new DMI table to support upcoming file split. While at it:
Rename quirk_entry -> alienfx_quirks,
Rename quirks -> alienfx
and change hdmi_mux, amplifier and deepslp types to bool, because they are already being implicitly used as bools.
--- drivers/platform/x86/dell/alienware-wmi.c | 363 +++++++++++----------- 1 file changed, 175 insertions(+), 188 deletions(-)
drivers/platform/x86/dell/alienware-wmi.c +175 -188
@@ -114,102 +114,68 @@ static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_ [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, }; -struct quirk_entry { +struct alienfx_quirks {u8 num_zones; -u8 hdmi_mux; -u8 amplifier; -u8 deepslp; -bool thermal; -bool gmode; +bool hdmi_mux; +bool amplifier; +bool deepslp; }; -static struct quirk_entry *quirks; +static struct alienfx_quirks *alienfx; -static struct quirk_entry quirk_inspiron5675 = { +static struct alienfx_quirks quirk_inspiron5675 = { .num_zones =2 , - .hdmi_mux =0 , - .amplifier =0 , - .deepslp =0 , - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_unknown = { +static struct alienfx_quirks quirk_unknown = { .num_zones =2 , - .hdmi_mux =0 , - .amplifier =0 , - .deepslp =0 , - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_x51_r1_r2 = { +static struct alienfx_quirks quirk_x51_r1_r2 = { .num_zones =3 , - .hdmi_mux =0 , - .amplifier =0 , - .deepslp =0 , - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_x51_r3 = { +static struct alienfx_quirks quirk_x51_r3 = { .num_zones =4 , - .hdmi_mux =0 , - .amplifier =1 , - .deepslp =0 , - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = true, + .deepslp = false, }; -static struct quirk_entry quirk_asm100 = { +static struct alienfx_quirks quirk_asm100 = { .num_zones =2 , - .hdmi_mux =1 , - .amplifier =0 , - .deepslp =0 , - .thermal = false, - .gmode = false, + .hdmi_mux = true, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_asm200 = { +static struct alienfx_quirks quirk_asm200 = { .num_zones =2 , - .hdmi_mux =1 , - .amplifier =0 , - .deepslp =1 , - .thermal = false, - .gmode = false, + .hdmi_mux = true, + .amplifier = false, + .deepslp = true, }; -static struct quirk_entry quirk_asm201 = { +static struct alienfx_quirks quirk_asm201 = { .num_zones =2 , - .hdmi_mux =1 , - .amplifier =1 , - .deepslp =1 , - .thermal = false, - .gmode = false, -}; - -static struct quirk_entry quirk_g_series = { - .num_zones =0 , - .hdmi_mux =0 , - .amplifier =0 , - .deepslp =0 , - .thermal = true, - .gmode = true, -}; - -static struct quirk_entry quirk_x_series = { - .num_zones =0 , - .hdmi_mux =0 , - .amplifier =0 , - .deepslp =0 , - .thermal = true, - .gmode = false, + .hdmi_mux = true, + .amplifier = true, + .deepslp = true, };static int __init dmi_matched (const struct dmi_system_id *dmi) { - quirks = dmi->driver_data; + alienfx = dmi->driver_data;return 1 ; }
@@ -241,51 +207,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_asm201, }, - { - .callback = dmi_matched, - .ident = "Alienware m16 R1 AMD", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m16 R1 AMD"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware m17 R5", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware m18 R2", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware x15 R1", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware x17 R2", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), - }, - .driver_data = &quirk_x_series, - }, { .callback = dmi_matched, .ident = "Alienware X51 R1",
@@ -313,60 +234,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_x51_r3, }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5510", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5511", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5515", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G3 3500", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G3 3590", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G5 5500", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), - DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), - }, - .driver_data = &quirk_g_series, - }, { .callback = dmi_matched, .ident = "Dell Inc. Inspiron 5675",
@@ -441,6 +308,116 @@ struct alienfx_platdata {static u8 interface; +struct awcc_quirks { +bool pprof; +bool gmode; +}; + +static struct awcc_quirks g_series_quirks = { + .pprof = true, + .gmode = true, +}; + +static struct awcc_quirks generic_quirks = { + .pprof = true, + .gmode = false, +}; + +static struct awcc_quirks empty_quirks; + +static const struct dmi_system_id awcc_dmi_table[]__initconst = { + { + .ident ="Alienware m16 R1 AMD" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Alienware m16 R1 AMD" ), + }, + .driver_data = &generic_quirks, + }, + { + .ident ="Alienware m17 R5" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Alienware m17 R5 AMD" ), + }, + .driver_data = &generic_quirks, + }, + { + .ident ="Alienware m18 R2" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Alienware m18 R2" ), + }, + .driver_data = &generic_quirks, + }, + { + .ident ="Alienware x15 R1" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Alienware x15 R1" ), + }, + .driver_data = &generic_quirks, + }, + { + .ident ="Alienware x17 R2" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Alienware" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Alienware x17 R2" ), + }, + .driver_data = &generic_quirks, + }, + { + .ident ="Dell Inc. G15 5510" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Dell G15 5510" ), + }, + .driver_data = &g_series_quirks, + }, + { + .ident ="Dell Inc. G15 5511" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Dell G15 5511" ), + }, + .driver_data = &g_series_quirks, + }, + { + .ident ="Dell Inc. G15 5515" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Dell G15 5515" ), + }, + .driver_data = &g_series_quirks, + }, + { + .ident ="Dell Inc. G3 3500" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"G3 3500" ), + }, + .driver_data = &g_series_quirks, + }, + { + .ident ="Dell Inc. G3 3590" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"G3 3590" ), + }, + .driver_data = &g_series_quirks, + }, + { + .ident ="Dell Inc. G5 5500" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"G5 5500" ), + }, + .driver_data = &g_series_quirks, + }, +}; + +static 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) {
@@ -623,7 +600,7 @@ static DEVICE_ATTR_RW(lighting_control_state);static umode_t zone_attr_visible (struct kobject *kobj,struct attribute *attr,int n) { -if (n < quirks->num_zones +1 ) +if (n < alienfx->num_zones +1 )return attr->mode;return 0 ;
@@ -631,7 +608,7 @@ static umode_t zone_attr_visible(struct kobject *kobj,static bool zone_group_visible (struct kobject *kobj) { -return quirks->num_zones >0 ; +return alienfx->num_zones >0 ; }DEFINE_SYSFS_GROUP_VISIBLE (zone);
@@ -754,7 +731,7 @@ static DEVICE_ATTR_RW(source);static bool hdmi_group_visible (struct kobject *kobj) { -return interface ==WMAX && quirks->hdmi_mux; +return interface ==WMAX && alienfx->hdmi_mux; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (hdmi);
@@ -802,7 +779,7 @@ static DEVICE_ATTR_RO(status);static bool amplifier_group_visible (struct kobject *kobj) { -return interface ==WMAX && quirks->amplifier; +return interface ==WMAX && alienfx->amplifier; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (amplifier);
@@ -873,7 +850,7 @@ static DEVICE_ATTR_RW(deepsleep);static bool deepsleep_group_visible (struct kobject *kobj) { -return interface ==WMAX && quirks->deepslp; +return interface ==WMAX && alienfx->deepslp; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (deepsleep);
@@ -1013,7 +990,7 @@ static int thermal_profile_set(struct device *dev, {struct awcc_priv *priv =dev_get_drvdata (dev); -if (quirks->gmode) { +if (awcc->gmode) {u32 gmode_status;int ret;
@@ -1079,7 +1056,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices)if (bitmap_empty (choices,PLATFORM_PROFILE_LAST ))return -ENODEV ; -if (quirks->gmode) { +if (awcc->gmode) { priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE ] =WMAX_THERMAL_MODE_GMODE ;
@@ -1117,7 +1094,7 @@ static int alienware_awcc_setup(struct wmi_device *wdev) priv->wdev = wdev;dev_set_drvdata (&wdev->dev, priv); -if (quirks->thermal) { +if (awcc->pprof) { ret =awcc_platform_profile_init (wdev);if (ret)return ret;
@@ -1312,7 +1289,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) };int ret; -if (quirks->thermal) +if (awcc) ret =alienware_awcc_setup (wdev);else ret =alienware_alienfx_setup (&pdata);
@@ -1338,6 +1315,26 @@ static struct wmi_driver alienware_wmax_wmi_driver = {static int __init alienware_wmax_wmi_init (void ) { +const struct dmi_system_id *id; + + id =dmi_first_match (awcc_dmi_table); +if (id) + awcc = id->driver_data; + +if (force_platform_profile) { +if (!awcc) + awcc = &empty_quirks; + + awcc->pprof = true; + } + +if (force_gmode) { +if (awcc) + awcc->gmode = true; +else +pr_warn ("force_gmode requires platform profile support\n" ); + } +return wmi_driver_register (&alienware_wmax_wmi_driver); }
@@ -1351,18 +1348,8 @@ static int __init alienware_wmi_init(void)int ret;dmi_check_system (alienware_quirks); -if (quirks ==NULL ) - quirks = &quirk_unknown; - -if (force_platform_profile) - quirks->thermal = true; - -if (force_gmode) { -if (quirks->thermal) - quirks->gmode = true; -else -pr_warn ("force_gmode requires platform profile support\n" ); - } +if (!alienfx) + alienfx = &quirk_unknown; ret =platform_driver_register (&platform_driver);if (ret <0 )
Signature · 1 line
2.48.1
Re: [PATCH v10 07/14] platform/x86: alienware-wmi: Split DMI table
Quoted 8 lines · Kurt Borja
Split thermal features into a new DMI table to support upcoming file split. While at it:
Rename
quirk_entry->alienfx_quirks,
Rename quirks -> alienfxand change
hdmi_mux, amplifier and deepslp types to bool, because they are already being implicitly used as bools.
...
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_platdata { · line 313
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c +3
-0+struct awcc_quirks { +bool pprof; +bool gmode;
Wouldn't it be better to have them as bitfields?
unsigned int pprof:1; ...
On 5th quirk (if ever happens) this will gain memory.
Quoted 1 line
+};
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 07/14] platform/x86: alienware-wmi: Split DMI table
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Kurt Borja
Split thermal features into a new DMI table to support upcoming file split. While at it:
Rename
quirk_entry->alienfx_quirks,
Rename quirks -> alienfxand change
hdmi_mux, amplifier and deepslp types to bool, because they are already being implicitly used as bools.
Quoted 7 lines
...
drivers/platform/x86/dell/alienware-wmi.c struct alienfx_platdata { · line 313
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.c +3
-0+struct awcc_quirks { +bool pprof; +bool gmode;Wouldn't it be better to have them as bitfields?
Yes, I like this.
Quoted 7 lines
unsigned int pprof:1; ...On 5th quirk (if ever happens) this will gain memory.
Quoted 1 line
+};
Signature · 1 line
~ Kurt
Kurt Borja
maintainerPATCH v10 8/14 MAINTAINERS: Update ALIENWARE WMI DRIVER entry
In reply to Kurt BorjaDell has been inactive in its maintainership role of this driver since around 2021. Due to this, add myself as a maintainer and update path to support upcoming changes.
--- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
MAINTAINERS +3 -1
@@ -792,10 +792,12 @@ F: Documentation/admin-guide/perf/alibaba_pmu.rst F: drivers/perf/alibaba_uncore_drw_pmu.c ALIENWARE WMI DRIVER +M: Kurt Borja <[email protected]> +L: [email protected] L: [email protected] S: Maintained F: Documentation/wmi/devices/alienware-wmi.rst -F: drivers/platform/x86/dell/alienware-wmi.c +F: drivers/platform/x86/dell/alienware-wmi* ALLEGRO DVT VIDEO IP CORE DRIVER M: Michael Tretter <[email protected]>
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 9/14 platform/x86: Rename alienware-wmi.c
In reply to Kurt BorjaRename alienware-wmi to support upcoming split.
---
drivers/platform/x86/dell/Makefile | 1 +
.../platform/x86/dell/{alienware-wmi.c => alienware-wmi-base.c} | 0
2 files changed, 1 insertion(+)
rename drivers/platform/x86/dell/{alienware-wmi.c => alienware-wmi-base.c} (100%)drivers/platform/x86/dell/Makefile +1 -0
@@ -5,6 +5,7 @@ # obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o +alienware-wmi-objs := alienware-wmi-base.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
drivers/platform/x86/dell/alienware-wmi-base.c renamed from drivers/platform/x86/dell/alienware-wmi.c +0 -0
Signature · 1 line
2.48.1
Re: [PATCH v10 09/14] platform/x86: Rename alienware-wmi.c
Quoted 1 line · Kurt Borja
Rename alienware-wmi to support upcoming split.
(the change that is caught by my eye and induced this review session)
...
Quoted 2 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
+alienware-wmi-objs := alienware-wmi-base.o
objs is incorrect! Please use correct y instead.
Quoted 3 lines
obj-$(CONFIG_DCDBAS) += dcdbas.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 09/14] platform/x86: Rename alienware-wmi.c
Hi Andy,
Thank you for your review!
Quoted 11 lines · Andy Shevchenko
Quoted 1 line · Kurt Borja
Rename alienware-wmi to support upcoming split.
(the change that is caught by my eye and induced this review session)
...
Quoted 2 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
+alienware-wmi-objs := alienware-wmi-base.oobjs is incorrect! Please use correct y instead.
I want to understand what is exactly wrong here. This objs pattern is used a lot in this file, so I just copied it. For example [1].
Is it wrong to do it here for a single file? Is it wrong to do it at all?
My goal is to split the file, but link it all together in a single module.
[1] https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14
Signature · 1 line
~ Kurt
Quoted 4 lines
Quoted 4 lines
obj-$(CONFIG_DCDBAS) += dcdbas.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
Re: [PATCH v10 09/14] platform/x86: Rename alienware-wmi.c
Quoted 5 lines · Kurt Borja
Quoted 4 lines · Andy Shevchenko
Quoted 1 line · Kurt Borja
Rename alienware-wmi to support upcoming split.
(the change that is caught by my eye and induced this review session)
...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
+alienware-wmi-objs := alienware-wmi-base.oobjs is incorrect! Please use correct y instead.
I want to understand what is exactly wrong here. This
objspattern is used a lot in this file, so I just copied it. For example [1].
It doesn't mean it's a good pattern to copy.
Quoted 2 lines
Is it wrong to do it here for a single file? Is it wrong to do it at all?
If the compilation unit is in-kernel unit (either built-in or a module) the -y should be used, for the user space tools which are build inside the kernel the -objs should be used. This all implied in the respective documentation.
Quoted 4 lines
My goal is to split the file, but link it all together in a single module.
[1] https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerPATCH v10 10/14 platform/x86: Add alienware-wmi.h
In reply to Kurt BorjaAdd a header file for alienware-wmi with shared resources to support the upcoming file split.
--- .../platform/x86/dell/alienware-wmi-base.c | 100 ++++-------------- drivers/platform/x86/dell/alienware-wmi.h | 92 ++++++++++++++++ 2 files changed, 114 insertions(+), 78 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi.h
drivers/platform/x86/dell/alienware-wmi-base.c +22 -78
@@ -17,10 +17,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
@@ -50,23 +47,6 @@ static bool force_gmode;module_param_unsafe (force_gmode, bool,0 );MODULE_PARM_DESC (force_gmode,"Forces G-Mode when performance profile is selected" ); -enum INTERFACE_FLAGS { -LEGACY , -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 ,
@@ -114,15 +94,7 @@ 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 *alienfx; - +struct alienfx_quirks *alienfx;static struct alienfx_quirks quirk_inspiron5675 = { .num_zones =2 ,
@@ -246,12 +218,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;
@@ -286,27 +252,7 @@ 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; +u8 alienware_interface;struct awcc_quirks {bool pprof;
@@ -418,8 +364,8 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = {static 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};
@@ -583,7 +529,7 @@ static ssize_t lighting_control_state_store(struct device *dev, val =LEGACY_BOOTING ; else if (strcmp(buf, "suspend\n") == 0) val =LEGACY_SUSPEND ; - else if (interface == LEGACY) + else if (alienware_interface == LEGACY) val =LEGACY_RUNNING ; else val =WMAX_RUNNING ;
@@ -731,7 +677,7 @@ static DEVICE_ATTR_RW(source);static bool hdmi_group_visible (struct kobject *kobj) { -return interface ==WMAX && alienfx->hdmi_mux; +return alienware_interface ==WMAX && alienfx->hdmi_mux; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (hdmi);
@@ -741,7 +687,7 @@ static struct attribute *hdmi_attrs[] = { NULL, }; -static const struct attribute_group hdmi_attribute_group = { +const struct attribute_group wmax_hdmi_attribute_group = { .name ="hdmi" , .is_visible =SYSFS_GROUP_VISIBLE (hdmi), .attrs = hdmi_attrs,
@@ -779,7 +725,7 @@ static DEVICE_ATTR_RO(status);static bool amplifier_group_visible (struct kobject *kobj) { -return interface ==WMAX && alienfx->amplifier; +return alienware_interface ==WMAX && alienfx->amplifier; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (amplifier);
@@ -788,7 +734,7 @@ static struct attribute *amplifier_attrs[] = { NULL, }; -static const struct attribute_group amplifier_attribute_group = { +const struct attribute_group wmax_amplifier_attribute_group = { .name ="amplifier" , .is_visible =SYSFS_GROUP_VISIBLE (amplifier), .attrs = amplifier_attrs,
@@ -850,7 +796,7 @@ static DEVICE_ATTR_RW(deepsleep);static bool deepsleep_group_visible (struct kobject *kobj) { -return interface ==WMAX && alienfx->deepslp; +return alienware_interface ==WMAX && alienfx->deepslp; }DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE (deepsleep);
@@ -859,7 +805,7 @@ static struct attribute *deepsleep_attrs[] = { NULL, }; -static const struct attribute_group deepsleep_attribute_group = { +const struct attribute_group wmax_deepsleep_attribute_group = { .name ="deepsleep" , .is_visible =SYSFS_GROUP_VISIBLE (deepsleep), .attrs = deepsleep_attrs,
@@ -1114,7 +1060,7 @@ static int alienfx_probe(struct platform_device *pdev)if (!priv)return -ENOMEM ; -if (interface ==WMAX ) +if (alienware_interface ==WMAX ) priv->lighting_control_state =WMAX_RUNNING ;else priv->lighting_control_state =LEGACY_RUNNING ;
@@ -1132,9 +1078,7 @@ static int alienfx_probe(struct platform_device *pdev)static const struct attribute_group *alienfx_groups[] = { &zone_attribute_group, - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, +WMAX_DEV_GROUPS NULL };
@@ -1153,7 +1097,7 @@ static void alienware_alienfx_remove(void *data)platform_device_unregister (pdev); } -static int alienware_alienfx_setup (struct alienfx_platdata *pdata) +int alienware_alienfx_setup (struct alienfx_platdata *pdata) {struct device *dev = &pdata->wdev->dev;struct platform_device *pdev;
@@ -1240,12 +1184,12 @@ static struct wmi_driver alienware_legacy_wmi_driver = { .no_singleton = true, }; -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); }
@@ -1313,7 +1257,7 @@ static struct wmi_driver alienware_wmax_wmi_driver = { .no_singleton = true, }; -static int __init alienware_wmax_wmi_init (void ) +int __init alienware_wmax_wmi_init (void ) {const struct dmi_system_id *id;
@@ -1338,7 +1282,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); }
@@ -1356,10 +1300,10 @@ static int __init alienware_wmi_init(void)return ret;if (wmi_has_guid (WMAX_CONTROL_GUID )) { - interface =WMAX ; + alienware_interface =WMAX ; ret =alienware_wmax_wmi_init (); }else { - interface =LEGACY ; + alienware_interface =LEGACY ; ret =alienware_legacy_wmi_init (); }
@@ -1373,7 +1317,7 @@ module_init(alienware_wmi_init); static void __exit alienware_wmi_exit(void) { -if (interface ==WMAX ) +if (alienware_interface ==WMAX )alienware_wmax_wmi_exit ();else alienware_legacy_wmi_exit ();
drivers/platform/x86/dell/alienware-wmi.h new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH v10 10/14] platform/x86: Add alienware-wmi.h
Quoted 2 lines · Kurt Borja
Add a header file for alienware-wmi with shared resources to support the upcoming file split.
...
drivers/platform/x86/dell/alienware-wmi-base.c static int alienfx_probe(struct platform_device *pdev) · line 1082
Quoted 7 lines
static const struct
attribute_group*alienfx_groups[] = {drivers/platform/x86/dell/alienware-wmi-base.c +1
-3&zone_attribute_group, - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, +WMAX_DEV_GROUPS NULL
I don't like this change as it makes code harder to understand (at one glance you can't answer the question "what are the groups that being listed here?".
Quoted 1 line
};
...
drivers/platform/x86/dell/alienware-wmi.h line 14
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.h new file +3
-0+#include <linux/leds.h> +#include <linux/platform_device.h> +#include <linux/wmi.h>
This should follow IWYU principle, now it looks like random stuff which this header does *not* use.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Ilpo Järvinen
maintainerRe: [PATCH v10 10/14] platform/x86: Add alienware-wmi.h
Quoted 6 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Add a header file for alienware-wmi with shared resources to support the upcoming file split.
...
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi-base.c static int alienfx_probe(struct platform_device *pdev) · line 1082
Quoted 7 lines
static const struct
attribute_group*alienfx_groups[] = {drivers/platform/x86/dell/alienware-wmi-base.c +1
-3&zone_attribute_group, - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, +WMAX_DEV_GROUPS NULLI don't like this change as it makes code harder to understand (at one glance you can't answer the question "what are the groups that being listed here?".
Over having #ifdeffery here, I've no problem whatsoever with it (and in fact I suggested goingthis way). It's pretty much boilerplate anyway having to list them yet in another place.
Signature · 1 line
i.
Re: [PATCH v10 10/14] platform/x86: Add alienware-wmi.h
Quoted 4 lines · Ilpo Järvinen
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Add a header file for alienware-wmi with shared resources to support the upcoming file split.
...
Quoted 11 lines
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi-base.c static int alienfx_probe(struct platform_device *pdev) · line 1082
Quoted 7 lines
static const struct
attribute_group*alienfx_groups[] = {drivers/platform/x86/dell/alienware-wmi-base.c +1
-3&zone_attribute_group, - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, +WMAX_DEV_GROUPS NULLI don't like this change as it makes code harder to understand (at one glance you can't answer the question "what are the groups that being listed here?".
Quoted 3 lines
Over having #ifdeffery here, I've no problem whatsoever with it (and in fact I suggested goingthis way). It's pretty much boilerplate anyway having to list them yet in another place.
As I said in the reply to the cover letter subthread this is not my main concern anyway. Let it be then.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 10/14] platform/x86: Add alienware-wmi.h
In reply to Andy ShevchenkoQuoted 19 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Add a header file for alienware-wmi with shared resources to support the upcoming file split.
...
drivers/platform/x86/dell/alienware-wmi-base.c static int alienfx_probe(struct platform_device *pdev) · line 1082
Quoted 7 lines
static const struct
attribute_group*alienfx_groups[] = {drivers/platform/x86/dell/alienware-wmi-base.c +1
-3&zone_attribute_group, - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, +WMAX_DEV_GROUPS NULLI don't like this change as it makes code harder to understand (at one glance you can't answer the question "what are the groups that being listed here?".
Quoted 1 line
};
Quoted 8 lines
...
drivers/platform/x86/dell/alienware-wmi.h line 14
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi.h new file +3
-0+#include <linux/leds.h> +#include <linux/platform_device.h> +#include <linux/wmi.h> This should follow IWYU principle, now it looks like random stuff which this header does *not* use.
I will check these.
Signature · 1 line
~ Kurt
Kurt Borja
maintainerPATCH v10 11/14 platform/x86: Split the alienware-wmi driver
In reply to Kurt BorjaSplit alienware-wmi WMI drivers into different files. This is done seamlessly by copying and pasting, however some blocks are reordered.
--- drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/alienware-wmi-base.c | 839 ------------------ .../platform/x86/dell/alienware-wmi-legacy.c | 95 ++ .../platform/x86/dell/alienware-wmi-wmax.c | 768 ++++++++++++++++ 4 files changed, 865 insertions(+), 839 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi-legacy.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-wmax.c
drivers/platform/x86/dell/Makefile +2 -0
@@ -6,6 +6,8 @@ obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o alienware-wmi-objs := alienware-wmi-base.o +alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
drivers/platform/x86/dell/alienware-wmi-base.c +0 -839
876 lines not on this page · raw message
drivers/platform/x86/dell/alienware-wmi-legacy.c new file +95 -0
95 lines not on this page · raw message
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +768 -0
768 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver
Quoted 2 lines · Kurt Borja
Split alienware-wmi WMI drivers into different files. This is done seamlessly by copying and pasting, however some blocks are reordered.
...
drivers/platform/x86/dell/Makefile line 10
Quoted 4 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
alienware-wmi-objs := alienware-wmi-base.odrivers/platform/x86/dell/Makefile +2
-0+alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.o
Oh my... it's even inconsistent!
...
drivers/platform/x86/dell/alienware-wmi-legacy.c line 10
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-legacy.c new file +3
-0+#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/wmi.h>
Too little headers are being included. At very quick glance a dozen or so is missing...
Quoted 1 line
+#include "
alienware-wmi.h"
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 316
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+static struct attribute *hdmi_attrs[] = { + &dev_attr_cable.attr, + &dev_attr_source.attr, +NULL ,
No comma in the terminator entry.
Quoted 1 line
+};
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 364
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+static struct attribute *amplifier_attrs[] = { + &dev_attr_status.attr, +NULL , +};
Ditto.
...
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +7
-0+{ +struct alienfx_platdata *pdata =dev_get_platdata (dev); +struct wmax_basic_args in_args = { + .arg =0 , + }; +u32 out_data; +int ret;
drivers/platform/x86/dell/alienware-wmi-wmax.c line 394
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +10
-0+ + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_STATUS , + &in_args,sizeof (in_args), &out_data); +if (!ret) { +if (out_data ==0 ) +return sysfs_emit (buf,"[disabled] s5 s5_s4\n" ); +else if (out_data ==1 ) +return sysfs_emit (buf,"disabled [s5] s5_s4\n" ); +else if (out_data ==2 ) +return sysfs_emit (buf,"disabled s5 [s5_s4]\n" );
The whole code inherited same issues like redundant 'else'. Please, refactor.
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+ } + +pr_err ("alienware-wmi: unknown deep sleep status: %d\n" , ret); +return sysfs_emit (buf,"disabled s5 s5_s4 [unknown]\n" ); +}
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 413
Quoted 13 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +13
-0+static ssize_t deepsleep_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct alienfx_platdata *pdata =dev_get_platdata (dev); +struct wmax_basic_args args; +int ret; + +if (strcmp (buf,"disabled\n" ) ==0 ) + args.arg =0 ; +else if (strcmp (buf,"s5\n" ) ==0 ) + args.arg =1 ; +else + args.arg =2 ;
sysfs_match_string()
drivers/platform/x86/dell/alienware-wmi-wmax.c line 423
Quoted 11 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +10
-0+pr_debug ("alienware-wmi: setting deep sleep to %d : %s" , args.arg, buf); + + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_CONTROL , + &args,sizeof (args),NULL ); +if (!ret) +pr_err ("alienware-wmi: deep sleep control failed: results: %u\n" , ret); + +return count; +} +
Redundant blank line.
Quoted 1 line
+static
DEVICE_ATTR_RW(deepsleep);
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 434
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +3
-0+static struct attribute *deepsleep_attrs[] = { + &dev_attr_deepsleep.attr, +NULL ,
No comma.
Quoted 1 line
+};
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 463
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if ((code &WMAX_THERMAL_TABLE_MASK ) ==WMAX_THERMAL_TABLE_USTT && + (code &WMAX_THERMAL_MODE_MASK ) <=THERMAL_MODE_USTT_LOW_POWER ) +return true; + +return false;
return ...
but if you wish, this one is okay.
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 601
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +12
-0+static int thermal_profile_probe (void *drvdata,unsigned long *choices) +{ +enum platform_profile_option profile; +struct awcc_priv *priv = drvdata; +enum wmax_thermal_mode mode; +u8 sys_desc[4 ]; +u32 first_mode; +u32 out_data; +int ret; + + ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_SYS_DESCRIPTION , +0 , (u32 *) &sys_desc);
How do you guarantee an alignment? Yes, it might be good for the specific hardware, but in general this is broken code.
drivers/platform/x86/dell/alienware-wmi-wmax.c line 607
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if (ret <0 ) +return ret; + + first_mode = sys_desc[0 ] + sys_desc[1 ]; +for (u32 i =0 ; i < sys_desc[3 ]; i++) {
Why u32? unsigned int looks more natural here.
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +7
-0+ ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_LIST_IDS , + i + first_mode, &out_data); + +if (ret == -EIO ) +return ret; + +if (ret == -EBADRQC )
drivers/platform/x86/dell/alienware-wmi-wmax.c line 624
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +9
-0+break ; + +if (!is_wmax_thermal_code (out_data)) +continue ; + + mode = out_data &WMAX_THERMAL_MODE_MASK ; + profile = wmax_mode_to_platform_profile[mode]; + priv->supported_thermal_profiles[profile] = out_data; +set_bit (profile, choices);
Do you need it to be atomic?
Quoted 14 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +14
-0+ } + +if (bitmap_empty (choices,PLATFORM_PROFILE_LAST )) +return -ENODEV ; + +if (awcc->gmode) { + priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE ] = +WMAX_THERMAL_MODE_GMODE ; + +set_bit (PLATFORM_PROFILE_PERFORMANCE , choices); + } + +return 0 ; +}
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 726
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +3
-0+static const struct wmi_device_id alienware_wmax_device_id_table[] = { + {WMAX_CONTROL_GUID ,NULL }, + { },
No comma.
Quoted 1 line
+};
...
Quoted 19 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +19
-0+int __init alienware_wmax_wmi_init (void ) +{ +const struct dmi_system_id *id; + + id =dmi_first_match (awcc_dmi_table); +if (id) + awcc = id->driver_data; + +if (force_platform_profile) { +if (!awcc) + awcc = &empty_quirks; + + awcc->pprof = true; + } + +if (force_gmode) { +if (awcc) + awcc->gmode = true; +else
drivers/platform/x86/dell/alienware-wmi-wmax.c line 768
Quoted 10 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +10
-0+pr_warn ("force_gmode requires platform profile support\n" ); + } + +return wmi_driver_register (&alienware_wmax_wmi_driver); +} + +void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}
Why not moving these boilerplate to ->probe() and use module_wmi_driver()?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Split alienware-wmi WMI drivers into different files. This is done seamlessly by copying and pasting, however some blocks are reordered.
Quoted 8 lines
...
drivers/platform/x86/dell/Makefile line 10
Quoted 4 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
alienware-wmi-objs := alienware-wmi-base.odrivers/platform/x86/dell/Makefile +2
-0+alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.oOh my... it's even inconsistent!
Again, this is an already used pattern:
https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14
I add configuration entries later. Is the order of the changes wrong? or is it the entire approach? Do other modules here need a fix?
Quoted 9 lines
...
drivers/platform/x86/dell/alienware-wmi-legacy.c line 10
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-legacy.c new file +3
-0+#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/wmi.h> Too little headers are being included. At very quick glance a dozen or so is missing...
Ack.
Quoted 11 lines
Quoted 2 lines
+#include "
alienware-wmi.h"...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 316
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+static struct attribute *hdmi_attrs[] = { + &dev_attr_cable.attr, + &dev_attr_source.attr, +NULL ,No comma in the terminator entry.
Ack.
Quoted 25 lines
Quoted 2 lines
+};
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 364
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+static struct attribute *amplifier_attrs[] = { + &dev_attr_status.attr, +NULL , +};Ditto.
...
Quoted 11 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +11
-0+{ +struct alienfx_platdata *pdata =dev_get_platdata (dev); +struct wmax_basic_args in_args = { + .arg =0 , + }; +u32 out_data; +int ret; + + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_STATUS , + &in_args,sizeof (in_args), &out_data); +if (!ret) {
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 394
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +6
-0+if (out_data ==0 ) +return sysfs_emit (buf,"[disabled] s5 s5_s4\n" ); +else if (out_data ==1 ) +return sysfs_emit (buf,"disabled [s5] s5_s4\n" ); +else if (out_data ==2 ) +return sysfs_emit (buf,"disabled s5 [s5_s4]\n" );The whole code inherited same issues like redundant 'else'. Please, refactor.
This is not my code, so a separate patch would be needed.
Quoted 9 lines
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+ } + +pr_err ("alienware-wmi: unknown deep sleep status: %d\n" , ret); +return sysfs_emit (buf,"disabled s5 s5_s4 [unknown]\n" ); +}...
Quoted 15 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 413
Quoted 13 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +13
-0+static ssize_t deepsleep_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct alienfx_platdata *pdata =dev_get_platdata (dev); +struct wmax_basic_args args; +int ret; + +if (strcmp (buf,"disabled\n" ) ==0 ) + args.arg =0 ; +else if (strcmp (buf,"s5\n" ) ==0 ) + args.arg =1 ; +else + args.arg =2 ;
sysfs_match_string()
Same as above.
Quoted 37 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 423
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +10
-0+pr_debug ("alienware-wmi: setting deep sleep to %d : %s" , args.arg, buf); + + ret =alienware_wmi_command (pdata->wdev,WMAX_METHOD_DEEP_SLEEP_CONTROL , + &args,sizeof (args),NULL ); +if (!ret) +pr_err ("alienware-wmi: deep sleep control failed: results: %u\n" , ret); + +return count; +} +Redundant blank line.
Quoted 1 line
+static
DEVICE_ATTR_RW(deepsleep);...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 434
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +3
-0+static struct attribute *deepsleep_attrs[] = { + &dev_attr_deepsleep.attr, +NULL ,No comma.
Quoted 1 line
+};
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 463
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if ((code &WMAX_THERMAL_TABLE_MASK ) ==WMAX_THERMAL_TABLE_USTT && + (code &WMAX_THERMAL_MODE_MASK ) <=THERMAL_MODE_USTT_LOW_POWER ) +return true; + +return false;return ...
Quoted 1 line
but if you wish, this one is okay.
This was done for readibility. Also this would require a different patch.
Quoted 18 lines
...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 601
Quoted 12 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +12
-0+static int thermal_profile_probe (void *drvdata,unsigned long *choices) +{ +enum platform_profile_option profile; +struct awcc_priv *priv = drvdata; +enum wmax_thermal_mode mode; +u8 sys_desc[4 ]; +u32 first_mode; +u32 out_data; +int ret; + + ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_SYS_DESCRIPTION , +0 , (u32 *) &sys_desc);How do you guarantee an alignment? Yes, it might be good for the specific hardware, but in general this is broken code.
This is a good question. I'm not really sure how to fix this tho. Is it fine to just pass a __packed struct? Also this would require another patch.
Quoted 26 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 607
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if (ret <0 ) +return ret; + + first_mode = sys_desc[0 ] + sys_desc[1 ]; +for (u32 i =0 ; i < sys_desc[3 ]; i++) {Why u32? unsigned int looks more natural here.
Quoted 15 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +15
-0+ ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_LIST_IDS , + i + first_mode, &out_data); + +if (ret == -EIO ) +return ret; + +if (ret == -EBADRQC ) +break ; + +if (!is_wmax_thermal_code (out_data)) +continue ; + + mode = out_data &WMAX_THERMAL_MODE_MASK ; + profile = wmax_mode_to_platform_profile[mode]; + priv->supported_thermal_profiles[profile] = out_data;
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 624
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +1
-0+set_bit (profile, choices);Do you need it to be atomic?
I don't think so. choices belongs to this thread only.
Quoted 51 lines
Quoted 15 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +14
-0+ } + +if (bitmap_empty (choices,PLATFORM_PROFILE_LAST )) +return -ENODEV ; + +if (awcc->gmode) { + priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE ] = +WMAX_THERMAL_MODE_GMODE ; + +set_bit (PLATFORM_PROFILE_PERFORMANCE , choices); + } + +return 0 ; +}...
drivers/platform/x86/dell/alienware-wmi-wmax.c line 726
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +3
-0+static const struct wmi_device_id alienware_wmax_device_id_table[] = { + {WMAX_CONTROL_GUID ,NULL }, + { },No comma.
Quoted 1 line
+};
...
Quoted 23 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +23
-0+int __init alienware_wmax_wmi_init (void ) +{ +const struct dmi_system_id *id; + + id =dmi_first_match (awcc_dmi_table); +if (id) + awcc = id->driver_data; + +if (force_platform_profile) { +if (!awcc) + awcc = &empty_quirks; + + awcc->pprof = true; + } + +if (force_gmode) { +if (awcc) + awcc->gmode = true; +else +pr_warn ("force_gmode requires platform profile support\n" ); + } + +return wmi_driver_register (&alienware_wmax_wmi_driver);
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 768
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +6
-0+} + +void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}Why not moving these boilerplate to ->probe() and use
module_wmi_driver()?
This 3 files are a single module and it has two WMI drivers so this can't be used.
Signature · 1 line
~ Kurt
Re: [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver
Quoted 2 lines · Kurt Borja
Quoted 1 line · Andy Shevchenko
On Fri, Feb 07, 2025 at 10:46:07AM -0500, Kurt Borja wrote:
...
Quoted 7 lines
Quoted 6 lines
drivers/platform/x86/dell/Makefile line 10
Quoted 4 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
alienware-wmi-objs := alienware-wmi-base.odrivers/platform/x86/dell/Makefile +2
-0+alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.oOh my... it's even inconsistent!
Quoted 6 lines
Again, this is an already used pattern:
https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14I add configuration entries later. Is the order of the changes wrong? or is it the entire approach? Do other modules here need a fix?
Again, it doesn't mean it's correct.
Maybe other modules also need that, I don't remember, but you may git log --no-merges --author="Andy" --grep objs to see changes I made in the past.
...
Quoted 11 lines
Quoted 9 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 394
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +7
-0+if (!ret) { +if (out_data ==0 ) +return sysfs_emit (buf,"[disabled] s5 s5_s4\n" ); +else if (out_data ==1 ) +return sysfs_emit (buf,"disabled [s5] s5_s4\n" ); +else if (out_data ==2 ) +return sysfs_emit (buf,"disabled s5 [s5_s4]\n" );The whole code inherited same issues like redundant 'else'. Please, refactor.
This is not my code, so a separate patch would be needed.
Okay!
...
Quoted 10 lines
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 413
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +6
-0+if (strcmp (buf,"disabled\n" ) ==0 ) + args.arg =0 ; +else if (strcmp (buf,"s5\n" ) ==0 ) + args.arg =1 ; +else + args.arg =2 ;
sysfs_match_string()Same as above.
Same as above :-)
...
Quoted 8 lines
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 463
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if ((code &WMAX_THERMAL_TABLE_MASK ) ==WMAX_THERMAL_TABLE_USTT && + (code &WMAX_THERMAL_MODE_MASK ) <=THERMAL_MODE_USTT_LOW_POWER ) +return true; + +return false;return ...
Quoted 4 lines
Quoted 1 line
but if you wish, this one is okay.
This was done for readibility. Also this would require a different patch.
No need, I'm fine with the current approach, just to show the alternatives.
...
Quoted 9 lines
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 601
Quoted 2 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +2
-0+ ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_SYS_DESCRIPTION , +0 , (u32 *) &sys_desc);How do you guarantee an alignment? Yes, it might be good for the specific hardware, but in general this is broken code.
This is a good question. I'm not really sure how to fix this tho. Is it fine to just pass a
__packedstruct? Also this would require another patch.
Usual approach here is to use one of get_unaligned_le32(), get_unaligned_be32() depending on the byte ordering.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+ if (ret < 0) + return ret;
...
Quoted 5 lines
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 624
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +1
-0+set_bit (profile, choices);Do you need it to be atomic?
I don't think so.
choicesbelongs to this thread only.
So, __set_bit() will suffice then.
...
Quoted 9 lines
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 768
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}Why not moving these boilerplate to ->probe() and use
module_wmi_driver()?This 3 files are a single module and it has two WMI drivers so this can't be used.
Can it be split to two separate modules then?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerRe: [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver
Hi Andy,
Quoted 17 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Quoted 1 line · Andy Shevchenko
On Fri, Feb 07, 2025 at 10:46:07AM -0500, Kurt Borja wrote:
...
Quoted 11 lines
Quoted 6 lines
drivers/platform/x86/dell/Makefile line 10
Quoted 4 lines
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
alienware-wmi-objs := alienware-wmi-base.odrivers/platform/x86/dell/Makefile +2
-0+alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.oOh my... it's even inconsistent!
Again, this is an already used pattern:
https://elixir.bootlin.com/linux/v6.14-rc2/source/drivers/platform/x86/dell/Makefile#L14
Quoted 7 lines
Quoted 2 lines
I add configuration entries later. Is the order of the changes wrong? or is it the entire approach? Do other modules here need a fix?
Again, it doesn't mean it's correct.
Maybe other modules also need that, I don't remember, but you may
git log --no-merges --author="Andy" --grep objsto see changes I made in the past.
Sorry!
Everything made more sense after reading the docs and checking your commits.
I submitted a patch fixing this. Thank you for pointing it out!
Quoted 69 lines
...
Quoted 11 lines
Quoted 9 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 394
Quoted 7 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +7
-0+if (!ret) { +if (out_data ==0 ) +return sysfs_emit (buf,"[disabled] s5 s5_s4\n" ); +else if (out_data ==1 ) +return sysfs_emit (buf,"disabled [s5] s5_s4\n" ); +else if (out_data ==2 ) +return sysfs_emit (buf,"disabled s5 [s5_s4]\n" );The whole code inherited same issues like redundant 'else'. Please, refactor.
This is not my code, so a separate patch would be needed.
Okay!
...
Quoted 10 lines
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 413
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +6
-0+if (strcmp (buf,"disabled\n" ) ==0 ) + args.arg =0 ; +else if (strcmp (buf,"s5\n" ) ==0 ) + args.arg =1 ; +else + args.arg =2 ;
sysfs_match_string()Same as above.
Same as above :-)
...
Quoted 8 lines
Quoted 8 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 463
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +5
-0+if ((code &WMAX_THERMAL_TABLE_MASK ) ==WMAX_THERMAL_TABLE_USTT && + (code &WMAX_THERMAL_MODE_MASK ) <=THERMAL_MODE_USTT_LOW_POWER ) +return true; + +return false;return ...Quoted 4 lines
Quoted 1 line
but if you wish, this one is okay.
This was done for readibility. Also this would require a different patch.
No need, I'm fine with the current approach, just to show the alternatives.
...
Quoted 9 lines
Quoted 5 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 601
Quoted 2 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +2
-0+ ret =wmax_thermal_information (priv->wdev,WMAX_OPERATION_SYS_DESCRIPTION , +0 , (u32 *) &sys_desc);How do you guarantee an alignment? Yes, it might be good for the specific hardware, but in general this is broken code.
This is a good question. I'm not really sure how to fix this tho. Is it fine to just pass a
__packedstruct? Also this would require another patch.Usual approach here is to use one of
get_unaligned_le32(),get_unaligned_be32()depending on the byte ordering.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +2
-0+ if (ret < 0) + return ret;...
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 624
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +1
-0+set_bit (profile, choices);Do you need it to be atomic?
I don't think so.
choicesbelongs to this thread only.So,
__set_bit()will suffice then.
For some reason I thought set_bit was the non-atomic one. This is good to know.
Quoted 10 lines
...
Quoted 7 lines
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 768
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}Why not moving these boilerplate to ->probe() and use
module_wmi_driver()?
Quoted 4 lines
Quoted 2 lines
This 3 files are a single module and it has two WMI drivers so this can't be used.
Can it be split to two separate modules then?
These two WMI drivers share a lot of features on old alienware models. Hence why I decided to link them together. IMO this bit of boilerplate is a fair tradeoff.
Thank you again for your feedback. I was completely unaware of some things you pointed out. I will implement your suggestions soon.
Signature · 1 line
~ Kurt
Re: [PATCH v10 11/14] platform/x86: Split the alienware-wmi driver
Quoted 4 lines · Kurt Borja
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Kurt Borja
Quoted 1 line · Andy Shevchenko
On Fri, Feb 07, 2025 at 10:46:07AM -0500, Kurt Borja wrote:
...
Quoted 10 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 624
Quoted 1 line
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +1
-0+set_bit (profile, choices);Do you need it to be atomic?
I don't think so.
choicesbelongs to this thread only.So,
__set_bit()will suffice then.For some reason I thought
set_bitwas the non-atomic one. This is good to know.
JFYI it is an old agreement that foo() is the locked (atomic) version of __foo(), but this agreement is broken in many cases nowadays (in many drivers :( unfortunately).
...
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c line 768
Quoted 4 lines
drivers/platform/x86/dell/alienware-wmi-wmax.c new file +4
-0+void __exit alienware_wmax_wmi_exit(void) +{ +wmi_driver_unregister (&alienware_wmax_wmi_driver); +}Why not moving these boilerplate to ->probe() and use
module_wmi_driver()?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
This 3 files are a single module and it has two WMI drivers so this can't be used.
Can it be split to two separate modules then?
These two WMI drivers share a lot of features on old alienware models. Hence why I decided to link them together. IMO this bit of boilerplate is a fair tradeoff.
It can be split to three files, common parts, mod1, mod2.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerPATCH v10 12/14 platform/x86: dell: Modify Makefile alignment
In reply to Kurt BorjaAdd one more TAB to each line to support upcoming changes.
--- drivers/platform/x86/dell/Makefile | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-)
drivers/platform/x86/dell/Makefile +24 -24
@@ -4,27 +4,27 @@ # Dell x86 Platform-Specific Drivers # -obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o -alienware-wmi-objs := alienware-wmi-base.o -alienware-wmi-y += alienware-wmi-legacy.o -alienware-wmi-y += alienware-wmi-wmax.o -obj-$(CONFIG_DCDBAS) += dcdbas.o -obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o -obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o -obj-$(CONFIG_DELL_RBU) += dell_rbu.o -obj-$(CONFIG_DELL_PC) += dell-pc.o -obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o -dell-smbios-objs := dell-smbios-base.o -dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o -dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o -obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o -obj-$(CONFIG_DELL_SMO8800) += dell-lis3lv02d.o -obj-$(CONFIG_DELL_UART_BACKLIGHT) += dell-uart-backlight.o -obj-$(CONFIG_DELL_WMI) += dell-wmi.o -dell-wmi-objs := dell-wmi-base.o -dell-wmi-$(CONFIG_DELL_WMI_PRIVACY) += dell-wmi-privacy.o -obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o -obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o -obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o -obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o -obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o +alienware-wmi-objs := alienware-wmi-base.o +alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.o +obj-$(CONFIG_DCDBAS) += dcdbas.o +obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o +obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o +obj-$(CONFIG_DELL_RBU) += dell_rbu.o +obj-$(CONFIG_DELL_PC) += dell-pc.o +obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o +dell-smbios-objs := dell-smbios-base.o +dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o +dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o +obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o +obj-$(CONFIG_DELL_SMO8800) += dell-lis3lv02d.o +obj-$(CONFIG_DELL_UART_BACKLIGHT) += dell-uart-backlight.o +obj-$(CONFIG_DELL_WMI) += dell-wmi.o +dell-wmi-objs := dell-wmi-base.o +dell-wmi-$(CONFIG_DELL_WMI_PRIVACY) += dell-wmi-privacy.o +obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o +obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o +obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o +obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o +obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/
Signature · 1 line
2.48.1
Re: [PATCH v10 12/14] platform/x86: dell: Modify Makefile alignment
Quoted 1 line · Kurt Borja
Add one more TAB to each line to support upcoming changes.
Fix the objs to be y!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerPATCH v10 13/14 platform/x86: Update alienware-wmi config entries
In reply to Kurt BorjaAdd config entries for each WMI driver managed by the alienware-wmi module to be able to conditionally compile them.
--- drivers/platform/x86/dell/Kconfig | 30 +++++++++++++++++++---- drivers/platform/x86/dell/Makefile | 4 +-- drivers/platform/x86/dell/alienware-wmi.h | 25 +++++++++++++++++++ 3 files changed, 52 insertions(+), 7 deletions(-)
drivers/platform/x86/dell/Kconfig +25 -5
@@ -18,15 +18,35 @@ config ALIENWARE_WMI tristate "Alienware Special feature control" default m depends on ACPI + depends on ACPI_WMI + depends on DMI depends on LEDS_CLASS depends on NEW_LEDS - depends on ACPI_WMI + help + This is a driver for controlling Alienware WMI driven features. + + On legacy devices, it exposes an interface for controlling the AlienFX + zones on Alienware machines that don't contain a dedicated + AlienFX USB MCU such as the X51 and X51-R2. + + On newer devices, it exposes the AWCC thermal control interface through + known Kernel APIs. + +config ALIENWARE_WMI_LEGACY + bool "Alienware Legacy WMI device driver" + default y + depends on ALIENWARE_WMI + help + Legacy Alienware WMI driver with AlienFX LED control capabilities. + +config ALIENWARE_WMI_WMAX + bool "Alienware WMAX WMI device driver" + default y + depends on ALIENWARE_WMI select ACPI_PLATFORM_PROFILE help - This is a driver for controlling Alienware BIOS driven - features. It exposes an interface for controlling the AlienFX - zones on Alienware machines that don't contain a dedicated AlienFX - USB MCU such as the X51 and X51-R2. + Alienware WMI driver with AlienFX LED, HDMI, amplifier, deep sleep and + AWCC thermal control capabilities. config DCDBAS tristate "Dell Systems Management Base Driver"
drivers/platform/x86/dell/Makefile +2 -2
@@ -6,8 +6,8 @@ obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o alienware-wmi-objs := alienware-wmi-base.o -alienware-wmi-y += alienware-wmi-legacy.o -alienware-wmi-y += alienware-wmi-wmax.o +alienware-wmi-$(CONFIG_ALIENWARE_WMI_LEGACY) += alienware-wmi-legacy.o +alienware-wmi-$(CONFIG_ALIENWARE_WMI_WMAX) += alienware-wmi-wmax.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
drivers/platform/x86/dell/alienware-wmi.h +25 -0
@@ -75,9 +75,21 @@ int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,int alienware_alienfx_setup (struct alienfx_platdata *pdata); +#if IS_ENABLED (CONFIG_ALIENWARE_WMI_LEGACY )int __init alienware_legacy_wmi_init (void ); void __exit alienware_legacy_wmi_exit(void); +#else +static inline int alienware_legacy_wmi_init (void ) +{ +return -ENODEV ; +} + +static inline void alienware_legacy_wmi_exit (void ) +{ +} +#endif +#if IS_ENABLED (CONFIG_ALIENWARE_WMI_WMAX )extern const struct attribute_group wmax_hdmi_attribute_group;extern const struct attribute_group wmax_amplifier_attribute_group;extern const struct attribute_group wmax_deepsleep_attribute_group;
@@ -88,5 +100,18 @@ extern const struct attribute_group wmax_deepsleep_attribute_group;int __init alienware_wmax_wmi_init (void ); void __exit alienware_wmax_wmi_exit(void); +#else +#define WMAX_DEV_GROUPS + +static inline int alienware_wmax_wmi_init (void ) +{ +return -ENODEV ; +} + + +static inline void alienware_wmax_wmi_exit (void ) +{ +} +#endif #endif
Signature · 1 line
2.48.1
Kurt Borja
maintainerPATCH v10 14/14 platform/x86: alienware-wmi: Update header and module information
In reply to Kurt BorjaUpdate module header and description. Additionally add myself as a module author.
--- drivers/platform/x86/dell/alienware-wmi-base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/dell/alienware-wmi-base.c +3 -1
@@ -1,8 +1,9 @@// SPDX-License-Identifier: GPL-2.0-or-later /* -* Alienware AlienFX control +* Alienware special feature control * * Copyright (C) 2014 Dell Inc <[email protected]> +* Copyright (C) 2025 Kurt Borja <[email protected]> */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
@@ -16,6 +17,7 @@#include "alienware-wmi.h" MODULE_AUTHOR ("Mario Limonciello <[email protected]>" ); +MODULE_AUTHOR ("Kurt Borja <[email protected]>" );MODULE_DESCRIPTION ("Alienware special feature control" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.48.1
Quoted 1 line · Kurt Borja
One more correction. I apologize for the noise!
Applied to review-ilpo-next. Thanks.
Signature · 1 line
i.
Quoted 43 lines
~ Kurt
---
[11/14]
- Fix .driver_data of Alienware m16 R1 AMDv9: https://lore.kernel.org/platform-driver-x86/[email protected]/
Kurt Borja (14):
platform/x86: alienware-wmi: Add a state container for LED control
feature
platform/x86: alienware-wmi: Add WMI Drivers
platform/x86: alienware-wmi: Add a state container for thermal control
methods
platform/x86: alienware-wmi: Refactor LED control methods platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods platform/x86: alienware-wmi: Refactor thermal control methods platform/x86: alienware-wmi: Split DMI table
MAINTAINERS: Update ALIENWARE WMI DRIVER entry platform/x86: Renamealienware-wmi.c
platform/x86: Addalienware-wmi.h
platform/x86: Split the alienware-wmi driver
platform/x86: dell: ModifyMakefilealignment platform/x86: Update alienware-wmi config entries platform/x86: alienware-wmi: Update header and module informationMAINTAINERS | 4 +- drivers/platform/x86/dell/Kconfig | 30 +- drivers/platform/x86/dell/Makefile | 45 +- .../platform/x86/dell/alienware-wmi-base.c | 491 +++++++ .../platform/x86/dell/alienware-wmi-legacy.c | 95 ++ .../platform/x86/dell/alienware-wmi-wmax.c | 768 ++++++++++ drivers/platform/x86/dell/alienware-wmi.c | 1249 ----------------- drivers/platform/x86/dell/alienware-wmi.h | 117 ++ 8 files changed, 1523 insertions(+), 1276 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi-base.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-legacy.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-wmax.c delete mode 100644 drivers/platform/x86/dell/alienware-wmi.c create mode 100644 drivers/platform/x86/dell/alienware-wmi.hbase-commit:
e75394bbf4838857f57b6c5d00f1e56c46cd6c11
Kurt Borja
maintainerQuoted 5 lines · Ilpo Järvinen
Quoted 1 line · Kurt Borja
One more correction. I apologize for the noise!
Applied to review-ilpo-next. Thanks.
Thank you so much for reviewing this, Ilpo :)
--
~ Kurt
Quoted 8 lines · Kurt Borja
Quoted 5 lines · Ilpo Järvinen
Quoted 1 line · Kurt Borja
One more correction. I apologize for the noise!
Applied to review-ilpo-next. Thanks.
Thank you so much for reviewing this, Ilpo :)
Please address my concerns in the followup patches.
(Main concern is abuse of objs, others are more like cleanups to improve
readability and maintenance)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Kurt Borja
maintainerHi all,
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Kurt Borja
Quoted 4 lines · Ilpo Järvinen
Quoted 1 line · Kurt Borja
One more correction. I apologize for the noise!
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Applied to review-ilpo-next. Thanks.
Thank you so much for reviewing this, Ilpo :)
Please address my concerns in the followup patches.
(Main concern is abuse of objs, others are more like cleanups to improve
readability and maintenance)
I agree with most of your coments. Some require additional patches tho, which is fine but are outside the scope of this series. I still have a lot of doubts about how to proceed with the Makefile stuff, I don't understand the root of the problem and a lot of drivers already do this so I'm a bit confused.
Ilpo, how should we proceed here? I see this series has not hit linux-next so, is it fine to send a v11 incorporating Andy's comments? Obviously after understanding the Makefile problems.
Also with all this fixes problems I'm having seconds thoughts about splitting the file (patch 11). I'd also like to know your opinion on that, Ilpo.
Thank you again for your review Andy!
Signature · 1 line
~ Kurt