Skip to content

Commit dd6cbcc

Browse files
committed
Merge tag 'platform-drivers-x86-v6.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Ilpo Järvinen: - acer-wmi: Stop using ACPI bitmap for platform profile choices - amd/hfi: Fix pcct_tbl leak - amd/pmc: Add TUXEDO IB Pro Gen10 AMD to spurious 8042 quirks - asus-wmi: - Fix registration races - Fix ROG button mapping, tablet mode on ASUS ROG Z13 - Support more keys on ExpertBook B9 - hp-wmi: Add support for Fn+P hotkey - intel/pmc: Add Bartlett Lake support - intel/power-domains: Use topology_logical_package_id() for package ID * tag 'platform-drivers-x86-v6.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86/intel: power-domains: Use topology_logical_package_id() for package ID platform/x86: acer-wmi: Stop using ACPI bitmap for platform profile choices platform/x86: hp-wmi: Add support for Fn+P hotkey platform/x86/intel/pmc: Add Bartlett Lake support to intel_pmc_core platform/x86: asus-wmi: Fix racy registrations platform/x86/amd/pmc: Add TUXEDO IB Pro Gen10 AMD to spurious 8042 quirks list platform/x86: asus-wmi: map more keys on ExpertBook B9 platform/x86: asus-wmi: Fix ROG button mapping, tablet mode on ASUS ROG Z13 platform/x86: asus-wmi: Remove extra keys from ignore_key_wlan quirk platform/x86/amd: hfi: Fix pcct_tbl leak in amd_hfi_metadata_parser()
2 parents e9eaca6 + aa28991 commit dd6cbcc

File tree

9 files changed

+74
-72
lines changed

9 files changed

+74
-72
lines changed

drivers/platform/x86/acer-wmi.c

Lines changed: 12 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ enum acer_wmi_predator_v4_oc {
129129
enum acer_wmi_gaming_misc_setting {
130130
ACER_WMID_MISC_SETTING_OC_1 = 0x0005,
131131
ACER_WMID_MISC_SETTING_OC_2 = 0x0007,
132+
/* Unreliable on some models */
132133
ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES = 0x000A,
133134
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE = 0x000B,
134135
};
@@ -794,9 +795,6 @@ static bool platform_profile_support;
794795
*/
795796
static int last_non_turbo_profile = INT_MIN;
796797

797-
/* The most performant supported profile */
798-
static int acer_predator_v4_max_perf;
799-
800798
enum acer_predator_v4_thermal_profile {
801799
ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET = 0x00,
802800
ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED = 0x01,
@@ -2014,7 +2012,7 @@ acer_predator_v4_platform_profile_set(struct device *dev,
20142012
if (err)
20152013
return err;
20162014

2017-
if (tp != acer_predator_v4_max_perf)
2015+
if (tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
20182016
last_non_turbo_profile = tp;
20192017

20202018
return 0;
@@ -2023,55 +2021,14 @@ acer_predator_v4_platform_profile_set(struct device *dev,
20232021
static int
20242022
acer_predator_v4_platform_profile_probe(void *drvdata, unsigned long *choices)
20252023
{
2026-
unsigned long supported_profiles;
2027-
int err;
2024+
set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
2025+
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
2026+
set_bit(PLATFORM_PROFILE_BALANCED, choices);
2027+
set_bit(PLATFORM_PROFILE_QUIET, choices);
2028+
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
20282029

2029-
err = WMID_gaming_get_misc_setting(ACER_WMID_MISC_SETTING_SUPPORTED_PROFILES,
2030-
(u8 *)&supported_profiles);
2031-
if (err)
2032-
return err;
2033-
2034-
/* Iterate through supported profiles in order of increasing performance */
2035-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_ECO, &supported_profiles)) {
2036-
set_bit(PLATFORM_PROFILE_LOW_POWER, choices);
2037-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
2038-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_ECO;
2039-
}
2040-
2041-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET, &supported_profiles)) {
2042-
set_bit(PLATFORM_PROFILE_QUIET, choices);
2043-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
2044-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_QUIET;
2045-
}
2046-
2047-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED, &supported_profiles)) {
2048-
set_bit(PLATFORM_PROFILE_BALANCED, choices);
2049-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
2050-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
2051-
}
2052-
2053-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE, &supported_profiles)) {
2054-
set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, choices);
2055-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
2056-
2057-
/* We only use this profile as a fallback option in case no prior
2058-
* profile is supported.
2059-
*/
2060-
if (last_non_turbo_profile < 0)
2061-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_PERFORMANCE;
2062-
}
2063-
2064-
if (test_bit(ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO, &supported_profiles)) {
2065-
set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
2066-
acer_predator_v4_max_perf = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
2067-
2068-
/* We need to handle the hypothetical case where only the turbo profile
2069-
* is supported. In this case the turbo toggle will essentially be a
2070-
* no-op.
2071-
*/
2072-
if (last_non_turbo_profile < 0)
2073-
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
2074-
}
2030+
/* Set default non-turbo profile */
2031+
last_non_turbo_profile = ACER_PREDATOR_V4_THERMAL_PROFILE_BALANCED;
20752032

20762033
return 0;
20772034
}
@@ -2108,27 +2065,23 @@ static int acer_thermal_profile_change(void)
21082065
if (cycle_gaming_thermal_profile) {
21092066
platform_profile_cycle();
21102067
} else {
2111-
/* Do nothing if no suitable platform profiles where found */
2112-
if (last_non_turbo_profile < 0)
2113-
return 0;
2114-
21152068
err = WMID_gaming_get_misc_setting(
21162069
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, &current_tp);
21172070
if (err)
21182071
return err;
21192072

2120-
if (current_tp == acer_predator_v4_max_perf)
2073+
if (current_tp == ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
21212074
tp = last_non_turbo_profile;
21222075
else
2123-
tp = acer_predator_v4_max_perf;
2076+
tp = ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO;
21242077

21252078
err = WMID_gaming_set_misc_setting(
21262079
ACER_WMID_MISC_SETTING_PLATFORM_PROFILE, tp);
21272080
if (err)
21282081
return err;
21292082

21302083
/* Store last profile for toggle */
2131-
if (current_tp != acer_predator_v4_max_perf)
2084+
if (current_tp != ACER_PREDATOR_V4_THERMAL_PROFILE_TURBO)
21322085
last_non_turbo_profile = current_tp;
21332086

21342087
platform_profile_notify(platform_profile_device);

drivers/platform/x86/amd/hfi/hfi.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,25 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev,
385385
amd_hfi_data->pcct_entry = pcct_entry;
386386
pcct_ext = (struct acpi_pcct_ext_pcc_slave *)pcct_entry;
387387

388-
if (pcct_ext->length <= 0)
389-
return -EINVAL;
388+
if (pcct_ext->length <= 0) {
389+
ret = -EINVAL;
390+
goto out;
391+
}
390392

391393
amd_hfi_data->shmem = devm_kzalloc(amd_hfi_data->dev, pcct_ext->length, GFP_KERNEL);
392-
if (!amd_hfi_data->shmem)
393-
return -ENOMEM;
394+
if (!amd_hfi_data->shmem) {
395+
ret = -ENOMEM;
396+
goto out;
397+
}
394398

395399
pcc_chan->shmem_base_addr = pcct_ext->base_address;
396400
pcc_chan->shmem_size = pcct_ext->length;
397401

398402
/* parse the shared memory info from the PCCT table */
399403
ret = amd_hfi_fill_metadata(amd_hfi_data);
400404

405+
out:
406+
/* Don't leak any ACPI memory */
401407
acpi_put_table(pcct_tbl);
402408

403409
return ret;

drivers/platform/x86/amd/pmc/pmc-quirks.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,20 @@ static const struct dmi_system_id fwbug_list[] = {
248248
DMI_MATCH(DMI_PRODUCT_NAME, "Lafite Pro V 14M"),
249249
}
250250
},
251+
{
252+
.ident = "TUXEDO InfinityBook Pro 14/15 AMD Gen10",
253+
.driver_data = &quirk_spurious_8042,
254+
.matches = {
255+
DMI_MATCH(DMI_BOARD_NAME, "XxHP4NAx"),
256+
}
257+
},
258+
{
259+
.ident = "TUXEDO InfinityBook Pro 14/15 AMD Gen10",
260+
.driver_data = &quirk_spurious_8042,
261+
.matches = {
262+
DMI_MATCH(DMI_BOARD_NAME, "XxKK4NAx_XxSP4NAx"),
263+
}
264+
},
251265
{}
252266
};
253267

drivers/platform/x86/asus-nb-wmi.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ static struct quirk_entry quirk_asus_ignore_fan = {
147147
};
148148

149149
static struct quirk_entry quirk_asus_zenbook_duo_kbd = {
150-
.ignore_key_wlan = true,
150+
.key_wlan_event = ASUS_WMI_KEY_IGNORE,
151+
};
152+
153+
static struct quirk_entry quirk_asus_z13 = {
154+
.key_wlan_event = ASUS_WMI_KEY_ARMOURY,
155+
.tablet_switch_mode = asus_wmi_kbd_dock_devid,
151156
};
152157

153158
static int dmi_matched(const struct dmi_system_id *dmi)
@@ -539,6 +544,15 @@ static const struct dmi_system_id asus_quirks[] = {
539544
},
540545
.driver_data = &quirk_asus_zenbook_duo_kbd,
541546
},
547+
{
548+
.callback = dmi_matched,
549+
.ident = "ASUS ROG Z13",
550+
.matches = {
551+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
552+
DMI_MATCH(DMI_PRODUCT_NAME, "ROG Flow Z13"),
553+
},
554+
.driver_data = &quirk_asus_z13,
555+
},
542556
{},
543557
};
544558

@@ -618,6 +632,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
618632
{ KE_KEY, 0x93, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + DVI */
619633
{ KE_KEY, 0x95, { KEY_MEDIA } },
620634
{ KE_KEY, 0x99, { KEY_PHONE } }, /* Conflicts with fan mode switch */
635+
{ KE_KEY, 0X9D, { KEY_FN_F } },
621636
{ KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
622637
{ KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
623638
{ KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
@@ -632,10 +647,13 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
632647
{ KE_IGNORE, 0xC0, }, /* External display connect/disconnect notification */
633648
{ KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
634649
{ KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
650+
{ KE_KEY, 0xCA, { KEY_F13 } }, /* Noise cancelling on Expertbook B9 */
651+
{ KE_KEY, 0xCB, { KEY_F14 } }, /* Fn+noise-cancel */
635652
{ KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
636653
{ KE_IGNORE, 0xCF, }, /* AC mode */
637654
{ KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */
638655
{ KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */
656+
{ KE_KEY, ASUS_WMI_KEY_ARMOURY, { KEY_PROG3 } },
639657
{ KE_END, 0},
640658
};
641659

@@ -655,11 +673,9 @@ static void asus_nb_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
655673
if (atkbd_reports_vol_keys)
656674
*code = ASUS_WMI_KEY_IGNORE;
657675
break;
658-
case 0x5D: /* Wireless console Toggle */
659-
case 0x5E: /* Wireless console Enable */
660-
case 0x5F: /* Wireless console Disable */
661-
if (quirks->ignore_key_wlan)
662-
*code = ASUS_WMI_KEY_IGNORE;
676+
case 0x5F: /* Wireless console Disable / Special Key */
677+
if (quirks->key_wlan_event)
678+
*code = quirks->key_wlan_event;
663679
break;
664680
}
665681
}

drivers/platform/x86/asus-wmi.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5088,16 +5088,22 @@ static int asus_wmi_probe(struct platform_device *pdev)
50885088

50895089
asus_s2idle_check_register();
50905090

5091-
return asus_wmi_add(pdev);
5091+
ret = asus_wmi_add(pdev);
5092+
if (ret)
5093+
asus_s2idle_check_unregister();
5094+
5095+
return ret;
50925096
}
50935097

50945098
static bool used;
5099+
static DEFINE_MUTEX(register_mutex);
50955100

50965101
int __init_or_module asus_wmi_register_driver(struct asus_wmi_driver *driver)
50975102
{
50985103
struct platform_driver *platform_driver;
50995104
struct platform_device *platform_device;
51005105

5106+
guard(mutex)(&register_mutex);
51015107
if (used)
51025108
return -EBUSY;
51035109

@@ -5120,6 +5126,7 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
51205126

51215127
void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
51225128
{
5129+
guard(mutex)(&register_mutex);
51235130
asus_s2idle_check_unregister();
51245131

51255132
platform_device_unregister(driver->platform_device);

drivers/platform/x86/asus-wmi.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/i8042.h>
1919

2020
#define ASUS_WMI_KEY_IGNORE (-1)
21+
#define ASUS_WMI_KEY_ARMOURY 0xffff01
2122
#define ASUS_WMI_BRN_DOWN 0x2e
2223
#define ASUS_WMI_BRN_UP 0x2f
2324

@@ -40,7 +41,7 @@ struct quirk_entry {
4041
bool wmi_force_als_set;
4142
bool wmi_ignore_fan;
4243
bool filter_i8042_e1_extended_codes;
43-
bool ignore_key_wlan;
44+
int key_wlan_event;
4445
enum asus_wmi_tablet_switch_mode tablet_switch_mode;
4546
int wapf;
4647
/*

drivers/platform/x86/hp/hp-wmi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ enum hp_wmi_event_ids {
122122
HPWMI_BATTERY_CHARGE_PERIOD = 0x10,
123123
HPWMI_SANITIZATION_MODE = 0x17,
124124
HPWMI_CAMERA_TOGGLE = 0x1A,
125+
HPWMI_FN_P_HOTKEY = 0x1B,
125126
HPWMI_OMEN_KEY = 0x1D,
126127
HPWMI_SMART_EXPERIENCE_APP = 0x21,
127128
};
@@ -981,6 +982,9 @@ static void hp_wmi_notify(union acpi_object *obj, void *context)
981982
key_code, 1, true))
982983
pr_info("Unknown key code - 0x%x\n", key_code);
983984
break;
985+
case HPWMI_FN_P_HOTKEY:
986+
platform_profile_cycle();
987+
break;
984988
case HPWMI_OMEN_KEY:
985989
if (event_data) /* Only should be true for HP Omen */
986990
key_code = event_data;

drivers/platform/x86/intel/pmc/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
16251625
X86_MATCH_VFM(INTEL_RAPTORLAKE_P, &tgl_l_pmc_dev),
16261626
X86_MATCH_VFM(INTEL_RAPTORLAKE, &adl_pmc_dev),
16271627
X86_MATCH_VFM(INTEL_RAPTORLAKE_S, &adl_pmc_dev),
1628+
X86_MATCH_VFM(INTEL_BARTLETTLAKE, &adl_pmc_dev),
16281629
X86_MATCH_VFM(INTEL_METEORLAKE_L, &mtl_pmc_dev),
16291630
X86_MATCH_VFM(INTEL_ARROWLAKE, &arl_pmc_dev),
16301631
X86_MATCH_VFM(INTEL_ARROWLAKE_H, &arl_h_pmc_dev),

drivers/platform/x86/intel/tpmi_power_domains.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int tpmi_get_logical_id(unsigned int cpu, struct tpmi_cpu_info *info)
178178

179179
info->punit_thread_id = FIELD_GET(LP_ID_MASK, data);
180180
info->punit_core_id = FIELD_GET(MODULE_ID_MASK, data);
181-
info->pkg_id = topology_physical_package_id(cpu);
181+
info->pkg_id = topology_logical_package_id(cpu);
182182
info->linux_cpu = cpu;
183183

184184
return 0;

0 commit comments

Comments
 (0)