On Thu, Jan 02, 2025 at 05:36:32PM +0100, Armin Wolf wrote: > Am 29.12.24 um 20:45 schrieb Kurt Borja: > > > Split thermal features into a new DMI table to support upcoming file > > split. While at it rename quirk_entry -> alienfx_features and change > > hdmi_mux, amplifier and deepslp types to bool, because they are already > > being implicitly used as bools. > > > > Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx> > > --- > > drivers/platform/x86/dell/alienware-wmi.c | 319 ++++++++++------------ > > 1 file changed, 147 insertions(+), 172 deletions(-) > > > > diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c > > index f80e7d488b9d..b9daf22efdbe 100644 > > --- a/drivers/platform/x86/dell/alienware-wmi.c > > +++ b/drivers/platform/x86/dell/alienware-wmi.c > > @@ -113,97 +113,63 @@ 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 *quirks; > > > > > > -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, > > -}; > > - > > -static struct quirk_entry quirk_asm100 = { > > - .num_zones = 2, > > - .hdmi_mux = 1, > > - .amplifier = 0, > > - .deepslp = 0, > > - .thermal = false, > > - .gmode = false, > > -}; > > - > > -static struct quirk_entry quirk_asm200 = { > > - .num_zones = 2, > > - .hdmi_mux = 1, > > - .amplifier = 0, > > - .deepslp = 1, > > - .thermal = false, > > - .gmode = false, > > + .hdmi_mux = false, > > + .amplifier = true, > > + .deepslp = false, > > }; > > > > -static struct quirk_entry quirk_asm201 = { > > +static struct alienfx_quirks quirk_asm100 = { > > .num_zones = 2, > > - .hdmi_mux = 1, > > - .amplifier = 1, > > - .deepslp = 1, > > - .thermal = false, > > - .gmode = false, > > + .hdmi_mux = true, > > + .amplifier = false, > > + .deepslp = false, > > }; > > > > -static struct quirk_entry quirk_g_series = { > > +static struct alienfx_quirks quirk_asm200 = { > > .num_zones = 2, > > - .hdmi_mux = 0, > > - .amplifier = 0, > > - .deepslp = 0, > > - .thermal = true, > > - .gmode = true, > > + .hdmi_mux = true, > > + .amplifier = false, > > + .deepslp = true, > > }; > > > > -static struct quirk_entry quirk_x_series = { > > +static struct alienfx_quirks quirk_asm201 = { > > .num_zones = 2, > > - .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) > > @@ -240,42 +206,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { > > }, > > .driver_data = &quirk_asm201, > > }, > > - { > > - .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", > > @@ -303,60 +233,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", > > @@ -411,7 +287,7 @@ struct awcc_priv { > > > > struct alienfx_priv { > > struct platform_device *pdev; > > - struct quirk_entry *quirks; > > + struct alienfx_quirks *quirks; > > struct led_classdev global_led; > > struct color_platform colors[4]; > > u8 global_brightness; > > @@ -432,6 +308,103 @@ struct alienfx_platdata { > > > > static u8 interface; > > > > +struct awcc_quirks { > > + bool gmode; > > +}; > > + > > +static struct awcc_quirks g_series_features = { > > + .gmode = true, > > +}; > > + > > +static struct awcc_quirks x_series_features = { > > + .gmode = false, > > +}; > > + > > +static const struct dmi_system_id awcc_dmi_table[] __initconst = { > > + { > > + .ident = "Alienware m17 R5", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), > > + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), > > + }, > > + .driver_data = &x_series_features, > > + }, > > + { > > + .ident = "Alienware m18 R2", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), > > + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), > > + }, > > + .driver_data = &x_series_features, > > + }, > > + { > > + .ident = "Alienware x15 R1", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), > > + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), > > + }, > > + .driver_data = &x_series_features, > > + }, > > + { > > + .ident = "Alienware x17 R2", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), > > + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), > > + }, > > + .driver_data = &x_series_features, > > + }, > > + { > > + .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_features, > > + }, > > + { > > + .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_features, > > + }, > > + { > > + .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_features, > > + }, > > + { > > + .ident = "Dell Inc. G3 3500", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), > > + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), > > + }, > > + .driver_data = &g_series_features, > > + }, > > + { > > + .ident = "Dell Inc. G3 3590", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), > > + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), > > + }, > > + .driver_data = &g_series_features, > > + }, > > + { > > + .ident = "Dell Inc. G5 5500", > > + .matches = { > > + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), > > + DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), > > + }, > > + .driver_data = &g_series_features, > > + }, > > +}; > > + > > +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) > > { > > @@ -1013,7 +986,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof, > > { > > struct awcc_priv *priv = container_of(pprof, struct awcc_priv, pp_handler); > > > > - if (quirks->gmode) { > > + if (awcc->gmode) { > > u32 gmode_status; > > int ret; > > > > @@ -1079,7 +1052,7 @@ static int create_thermal_profile(struct wmi_device *wdev) > > if (bitmap_empty(priv->pp_handler.choices, PLATFORM_PROFILE_LAST)) > > return -ENODEV; > > > > - if (quirks->gmode) { > > + if (awcc->gmode) { > > priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = > > WMAX_THERMAL_MODE_GMODE; > > > > @@ -1319,7 +1292,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) > > struct platform_device *pdev; > > int ret; > > > > - if (quirks->thermal) { > > + if (awcc) { > > ret = alienware_awcc_setup(wdev); > > } else { > > ret = alienware_alienfx_setup(&pdata); > > @@ -1335,7 +1308,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) > > > > static void wmax_wmi_remove(struct wmi_device *wdev) > > { > > - if (quirks->thermal) > > + if (awcc) > > alienware_awcc_exit(wdev); > > else > > alienware_alienfx_exit(wdev); > > @@ -1359,6 +1332,18 @@ 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) > > + awcc = &x_series_features; > > + > > + if (force_gmode) > > + awcc = &g_series_features; > > Please add a check here if awcc is not NULL and keep "pr_warn("force_gmode requires platform profile support\n")" > if awcc is NULL. Sure! > > > Thanks, > Armin Wolf > > > + > > return wmi_driver_register(&alienware_wmax_wmi_driver); > > } > > > > @@ -1375,16 +1360,6 @@ static int __init alienware_wmi_init(void) > > 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 (wmi_has_guid(WMAX_CONTROL_GUID)) { > > interface = WMAX; > > ret = alienware_wmax_wmi_init();