Skip to content

Commit d9b2ba6

Browse files
committed
Merge tag 'platform-drivers-x86-v5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - thinkpad_acpi/ideapad-laptop: mem-leak and platform-profile fixes - panasonic-laptop: missing hotkey presses regression fix - some hardware-id additions - some other small fixes * tag 'platform-drivers-x86-v5.19-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: hp-wmi: Ignore Sanitization Mode event platform/x86: thinkpad_acpi: do not use PSC mode on Intel platforms platform/x86: thinkpad-acpi: profile capabilities as integer platform/x86: panasonic-laptop: filter out duplicate volume up/down/mute keypresses platform/x86: panasonic-laptop: don't report duplicate brightness key-presses platform/x86: panasonic-laptop: revert "Resolve hotkey double trigger bug" platform/x86: panasonic-laptop: sort includes alphabetically platform/x86: panasonic-laptop: de-obfuscate button codes ACPI: video: Change how we determine if brightness key-presses are handled platform/x86: ideapad-laptop: Add Ideapad 5 15ITL05 to ideapad_dytc_v4_allow_table[] platform/x86: ideapad-laptop: Add allow_v4_dytc module parameter platform/x86: thinkpad_acpi: Fix a memory leak of EFCH MMIO resource platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices() platform/x86: intel/pmc: Add Alder Lake N support to PMC core driver
2 parents 732f306 + 9ab762a commit d9b2ba6

File tree

8 files changed

+127
-60
lines changed

8 files changed

+127
-60
lines changed

drivers/acpi/acpi_video.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module_param(device_id_scheme, bool, 0444);
7373
static int only_lcd = -1;
7474
module_param(only_lcd, int, 0444);
7575

76+
static bool has_backlight;
7677
static int register_count;
7778
static DEFINE_MUTEX(register_count_mutex);
7879
static DEFINE_MUTEX(video_list_lock);
@@ -1222,6 +1223,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
12221223
acpi_video_device_bind(video, data);
12231224
acpi_video_device_find_cap(data);
12241225

1226+
if (data->cap._BCM && data->cap._BCL)
1227+
has_backlight = true;
1228+
12251229
mutex_lock(&video->device_list_lock);
12261230
list_add_tail(&data->entry, &video->video_device_list);
12271231
mutex_unlock(&video->device_list_lock);
@@ -2249,6 +2253,7 @@ void acpi_video_unregister(void)
22492253
if (register_count) {
22502254
acpi_bus_unregister_driver(&acpi_video_bus);
22512255
register_count = 0;
2256+
has_backlight = false;
22522257
}
22532258
mutex_unlock(&register_count_mutex);
22542259
}
@@ -2270,13 +2275,7 @@ void acpi_video_unregister_backlight(void)
22702275

22712276
bool acpi_video_handles_brightness_key_presses(void)
22722277
{
2273-
bool have_video_busses;
2274-
2275-
mutex_lock(&video_list_lock);
2276-
have_video_busses = !list_empty(&video_bus_head);
2277-
mutex_unlock(&video_list_lock);
2278-
2279-
return have_video_busses &&
2278+
return has_backlight &&
22802279
(report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
22812280
}
22822281
EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);

drivers/platform/mellanox/nvsw-sn2201.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
890890
int size)
891891
{
892892
struct mlxreg_hotplug_device *dev = devs;
893+
int ret;
893894
int i;
894895

895896
/* Create I2C static devices. */
@@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
901902
dev->nr, dev->brdinfo->addr);
902903

903904
dev->adapter = NULL;
905+
ret = PTR_ERR(dev->client);
904906
goto fail_create_static_devices;
905907
}
906908
}
@@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
914916
dev->client = NULL;
915917
dev->adapter = NULL;
916918
}
917-
return IS_ERR(dev->client);
919+
return ret;
918920
}
919921

920922
static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201,

drivers/platform/x86/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,8 @@ config PANASONIC_LAPTOP
945945
tristate "Panasonic Laptop Extras"
946946
depends on INPUT && ACPI
947947
depends on BACKLIGHT_CLASS_DEVICE
948+
depends on ACPI_VIDEO=n || ACPI_VIDEO
949+
depends on SERIO_I8042 || SERIO_I8042 = n
948950
select INPUT_SPARSEKMAP
949951
help
950952
This driver adds support for access to backlight control and hotkeys

drivers/platform/x86/hp-wmi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ enum hp_wmi_event_ids {
8989
HPWMI_BACKLIT_KB_BRIGHTNESS = 0x0D,
9090
HPWMI_PEAKSHIFT_PERIOD = 0x0F,
9191
HPWMI_BATTERY_CHARGE_PERIOD = 0x10,
92+
HPWMI_SANITIZATION_MODE = 0x17,
9293
};
9394

9495
/*
@@ -853,6 +854,8 @@ static void hp_wmi_notify(u32 value, void *context)
853854
break;
854855
case HPWMI_BATTERY_CHARGE_PERIOD:
855856
break;
857+
case HPWMI_SANITIZATION_MODE:
858+
break;
856859
default:
857860
pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data);
858861
break;

drivers/platform/x86/ideapad-laptop.c

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ static bool no_bt_rfkill;
152152
module_param(no_bt_rfkill, bool, 0444);
153153
MODULE_PARM_DESC(no_bt_rfkill, "No rfkill for bluetooth.");
154154

155+
static bool allow_v4_dytc;
156+
module_param(allow_v4_dytc, bool, 0444);
157+
MODULE_PARM_DESC(allow_v4_dytc, "Enable DYTC version 4 platform-profile support.");
158+
155159
/*
156160
* ACPI Helpers
157161
*/
@@ -871,12 +875,18 @@ static void dytc_profile_refresh(struct ideapad_private *priv)
871875
static const struct dmi_system_id ideapad_dytc_v4_allow_table[] = {
872876
{
873877
/* Ideapad 5 Pro 16ACH6 */
874-
.ident = "LENOVO 82L5",
875878
.matches = {
876879
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
877880
DMI_MATCH(DMI_PRODUCT_NAME, "82L5")
878881
}
879882
},
883+
{
884+
/* Ideapad 5 15ITL05 */
885+
.matches = {
886+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
887+
DMI_MATCH(DMI_PRODUCT_VERSION, "IdeaPad 5 15ITL05")
888+
}
889+
},
880890
{}
881891
};
882892

@@ -901,13 +911,16 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv)
901911

902912
dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
903913

904-
if (dytc_version < 5) {
905-
if (dytc_version < 4 || !dmi_check_system(ideapad_dytc_v4_allow_table)) {
906-
dev_info(&priv->platform_device->dev,
907-
"DYTC_VERSION is less than 4 or is not allowed: %d\n",
908-
dytc_version);
909-
return -ENODEV;
910-
}
914+
if (dytc_version < 4) {
915+
dev_info(&priv->platform_device->dev, "DYTC_VERSION < 4 is not supported\n");
916+
return -ENODEV;
917+
}
918+
919+
if (dytc_version < 5 &&
920+
!(allow_v4_dytc || dmi_check_system(ideapad_dytc_v4_allow_table))) {
921+
dev_info(&priv->platform_device->dev,
922+
"DYTC_VERSION 4 support may not work. Pass ideapad_laptop.allow_v4_dytc=Y on the kernel commandline to enable\n");
923+
return -ENODEV;
911924
}
912925

913926
priv->dytc = kzalloc(sizeof(*priv->dytc), GFP_KERNEL);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,6 +1911,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
19111911
X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L, &icl_reg_map),
19121912
X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &tgl_reg_map),
19131913
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &tgl_reg_map),
1914+
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &tgl_reg_map),
19141915
X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map),
19151916
X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map),
19161917
{}

drivers/platform/x86/panasonic-laptop.c

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,22 @@
119119
* - v0.1 start from toshiba_acpi driver written by John Belmonte
120120
*/
121121

122-
#include <linux/kernel.h>
123-
#include <linux/module.h>
124-
#include <linux/init.h>
125-
#include <linux/types.h>
122+
#include <linux/acpi.h>
126123
#include <linux/backlight.h>
127124
#include <linux/ctype.h>
128-
#include <linux/seq_file.h>
129-
#include <linux/uaccess.h>
130-
#include <linux/slab.h>
131-
#include <linux/acpi.h>
125+
#include <linux/i8042.h>
126+
#include <linux/init.h>
132127
#include <linux/input.h>
133128
#include <linux/input/sparse-keymap.h>
129+
#include <linux/kernel.h>
130+
#include <linux/module.h>
134131
#include <linux/platform_device.h>
135-
132+
#include <linux/seq_file.h>
133+
#include <linux/serio.h>
134+
#include <linux/slab.h>
135+
#include <linux/types.h>
136+
#include <linux/uaccess.h>
137+
#include <acpi/video.h>
136138

137139
MODULE_AUTHOR("Hiroshi Miura <[email protected]>");
138140
MODULE_AUTHOR("David Bronaugh <[email protected]>");
@@ -241,6 +243,42 @@ struct pcc_acpi {
241243
struct platform_device *platform;
242244
};
243245

246+
/*
247+
* On some Panasonic models the volume up / down / mute keys send duplicate
248+
* keypress events over the PS/2 kbd interface, filter these out.
249+
*/
250+
static bool panasonic_i8042_filter(unsigned char data, unsigned char str,
251+
struct serio *port)
252+
{
253+
static bool extended;
254+
255+
if (str & I8042_STR_AUXDATA)
256+
return false;
257+
258+
if (data == 0xe0) {
259+
extended = true;
260+
return true;
261+
} else if (extended) {
262+
extended = false;
263+
264+
switch (data & 0x7f) {
265+
case 0x20: /* e0 20 / e0 a0, Volume Mute press / release */
266+
case 0x2e: /* e0 2e / e0 ae, Volume Down press / release */
267+
case 0x30: /* e0 30 / e0 b0, Volume Up press / release */
268+
return true;
269+
default:
270+
/*
271+
* Report the previously filtered e0 before continuing
272+
* with the next non-filtered byte.
273+
*/
274+
serio_interrupt(port, 0xe0, 0);
275+
return false;
276+
}
277+
}
278+
279+
return false;
280+
}
281+
244282
/* method access functions */
245283
static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
246284
{
@@ -762,6 +800,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
762800
struct input_dev *hotk_input_dev = pcc->input_dev;
763801
int rc;
764802
unsigned long long result;
803+
unsigned int key;
804+
unsigned int updown;
765805

766806
rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY,
767807
NULL, &result);
@@ -770,20 +810,27 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
770810
return;
771811
}
772812

813+
key = result & 0xf;
814+
updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
815+
773816
/* hack: some firmware sends no key down for sleep / hibernate */
774-
if ((result & 0xf) == 0x7 || (result & 0xf) == 0xa) {
775-
if (result & 0x80)
817+
if (key == 7 || key == 10) {
818+
if (updown)
776819
sleep_keydown_seen = 1;
777820
if (!sleep_keydown_seen)
778821
sparse_keymap_report_event(hotk_input_dev,
779-
result & 0xf, 0x80, false);
822+
key, 0x80, false);
780823
}
781824

782-
if ((result & 0xf) == 0x7 || (result & 0xf) == 0x9 || (result & 0xf) == 0xa) {
783-
if (!sparse_keymap_report_event(hotk_input_dev,
784-
result & 0xf, result & 0x80, false))
785-
pr_err("Unknown hotkey event: 0x%04llx\n", result);
786-
}
825+
/*
826+
* Don't report brightness key-presses if they are also reported
827+
* by the ACPI video bus.
828+
*/
829+
if ((key == 1 || key == 2) && acpi_video_handles_brightness_key_presses())
830+
return;
831+
832+
if (!sparse_keymap_report_event(hotk_input_dev, key, updown, false))
833+
pr_err("Unknown hotkey event: 0x%04llx\n", result);
787834
}
788835

789836
static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
@@ -997,6 +1044,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
9971044
pcc->platform = NULL;
9981045
}
9991046

1047+
i8042_install_filter(panasonic_i8042_filter);
10001048
return 0;
10011049

10021050
out_platform:
@@ -1020,6 +1068,8 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
10201068
if (!device || !pcc)
10211069
return -EINVAL;
10221070

1071+
i8042_remove_filter(panasonic_i8042_filter);
1072+
10231073
if (pcc->platform) {
10241074
device_remove_file(&pcc->platform->dev, &dev_attr_cdpower);
10251075
platform_device_unregister(pcc->platform);

0 commit comments

Comments
 (0)