Bug 217873

Summary: Lenovo Ideapad Slim 3 AMD 7520U - Keyboard & Trackpad not working with multiple Kernel versions.
Product: ACPI Reporter: Paul Spedding (paul.spedding)
Component: Config-InterruptsAssignee: acpi_config-interrupts
Status: NEW ---    
Severity: high CC: camilo272001, ivodd, mail, miguelssm, p0lloc, victor.bonnelle
Priority: P3    
Hardware: AMD   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:
Attachments: Dmesg Output
demidecode
journalctl log
syslog
acpi-test
dmesg output
acpidump decomplied DSDT
acpidump decompiled DSDT
Kernel log

Description Paul Spedding 2023-09-05 17:08:20 UTC
Created attachment 305039 [details]
Dmesg Output

So I have a Lenovo IdeaPad Slim 3. I have tried Kernels 6.1 6.4 and 6.5.1 none of which has worked or helped in anyway. the issue is the same for all.

The keyboard/touchpad works in the UEFI/Boot upstages but as soon as I hit Plymouth's password screen to unlock the LUKS partition they keyboard and touchpad stop working there.

It does seem some of the Function keys work to turn volume and brightness up or down just not the rest of the keyboard.

I have read the other threads related to Lenovo ACPI keyboard/touchpad not working and none of the fixes work for this pretty new machine. 

Below is some of the logs from kernel version 6.5.1 Stable.
Comment 1 Paul Spedding 2023-09-05 17:09:24 UTC
Created attachment 305040 [details]
demidecode
Comment 2 Paul Spedding 2023-09-05 17:09:50 UTC
Created attachment 305041 [details]
journalctl log
Comment 3 Paul Spedding 2023-09-05 17:10:13 UTC
Created attachment 305042 [details]
syslog
Comment 4 Paul Spedding 2023-09-05 17:10:31 UTC
Created attachment 305043 [details]
acpi-test
Comment 5 Paul Spedding 2023-09-05 17:12:13 UTC
If you need any more logs or readouts please let me know.
Comment 6 Rob Whalley 2023-09-06 21:24:06 UTC
We have this same model of laptop and the same issue (this bug was listed as a possible duplicate when I was creating a bug report). In addition to the information above, we have tried updating to the latest BIOS but this does not help. 

After selecting a boot option, the keyboard and touchpad are not detected on a Lenovo IdeaPad Slim 3 15AMN8 laptop. Tested with various distros, various kernels, kernel options suggested by internet searches of users with similar problems, but with no change in behaviour. The keyboard and touchpad work in the BIOS, so they aren't faulty. The recent changes to the mainline kernel around IRQ overrides doesn't seem to have made any difference (see also 217394, amongst others).

Information below is from a fresh install of OpenSUSE Tumbleweed with mainline kernel 6.5.1-1.gd232ff6-default

evtest only shows "Ideapad extra buttons", which may explain why the brightness buttons work:
 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Video Bus
/dev/input/event1:      Logitech K400 Plus
/dev/input/event2:      Lid Switch
/dev/input/event3:      Power Button
/dev/input/event4:      Ideapad extra buttons
/dev/input/event5:      PC Speaker
/dev/input/event6:      HD-Audio Generic HDMI/DP,pcm=3
/dev/input/event7:      HD-Audio Generic HDMI/DP,pcm=7
/dev/input/event8:      HDA Digital PCBeep
/dev/input/event9:      HD-Audio Generic Mic
/dev/input/event10:     HD-Audio Generic Headphone
Select the device event number [0-10]:


grep -v /sys/class/dmi/id/*

/sys/class/dmi/id/bios_release:1.32
/sys/class/dmi/id/bios_vendor:LENOVO
/sys/class/dmi/id/bios_version:L1CN32WW
/sys/class/dmi/id/board_asset_tag:No Asset Tag
/sys/class/dmi/id/board_name:LNVNB161216
grep: /sys/class/dmi/id/board_serial: Permission denied
/sys/class/dmi/id/board_vendor:LENOVO
/sys/class/dmi/id/board_version:NO DPK
/sys/class/dmi/id/chassis_asset_tag:No Asset Tag
grep: /sys/class/dmi/id/chassis_serial: Permission denied
/sys/class/dmi/id/chassis_type:10
/sys/class/dmi/id/chassis_vendor:LENOVO
/sys/class/dmi/id/chassis_version:IdeaPad Slim 3 15AMN8
/sys/class/dmi/id/ec_firmware_release:1.32
/sys/class/dmi/id/modalias:dmi:bvnLENOVO:bvrL1CN32WW:bd06/14/2023:br1.32:efr1.32:svnLENOVO:pn82XQ:pvrIdeaPadSlim315AMN8:rvnLENOVO:rnLNVNB161216:rvrNODPK:cvnLENOVO:ct10:cvrIdeaPadSlim315AMN8:skuLENOVO_MT_82XQ_BU_idea_FM_IdeaPadSlim315AMN8:
grep: /sys/class/dmi/id/power: Is a directory
/sys/class/dmi/id/product_family:IdeaPad Slim 3 15AMN8
/sys/class/dmi/id/product_name:82XQ
grep: /sys/class/dmi/id/product_serial: Permission denied
/sys/class/dmi/id/product_sku:LENOVO_MT_82XQ_BU_idea_FM_IdeaPad Slim 3 15AMN8
grep: /sys/class/dmi/id/product_uuid: Permission denied
/sys/class/dmi/id/product_version:IdeaPad Slim 3 15AMN8
grep: /sys/class/dmi/id/subsystem: Is a directory
/sys/class/dmi/id/sys_vendor:LENOVO
/sys/class/dmi/id/uevent:MODALIAS=dmi:bvnLENOVO:bvrL1CN32WW:bd06/14/2023:br1.32:efr1.32:svnLENOVO:pn82XQ:pvrIdeaPadSlim315AMN8:rvnLENOVO:rnLNVNB161216:rvrNODPK:cvnLENOVO:ct10:cvrIdeaPadSlim315AMN8:skuLENOVO_MT_82XQ_BU_idea_FM_IdeaPadSlim315AMN8:

Please find attached copies of the output from dmesg and the output of:
sudo acpidump -b
iasl -d dsdt.dat

As Paul says above, please let me know if you need any further information.
Comment 7 Rob Whalley 2023-09-06 21:25:34 UTC
Created attachment 305055 [details]
dmesg output
Comment 8 Rob Whalley 2023-09-06 21:31:30 UTC
Created attachment 305056 [details]
acpidump decomplied DSDT
Comment 9 Rob Whalley 2023-09-06 21:35:41 UTC
Created attachment 305057 [details]
acpidump decompiled DSDT
Comment 10 Miguel SSM 2023-09-07 07:18:34 UTC
Created attachment 305060 [details]
Kernel log

Kernel log from a new installation. Ubuntu 23.04 lunar-lobster
Comment 11 Miguel SSM 2023-09-07 07:18:44 UTC
I have the same issue as described above. Please tell me I don't need to reject this nice machine!!
Comment 12 Paul Spedding 2023-09-12 14:38:41 UTC
(In reply to Miguel SSM from comment #11)
> I have the same issue as described above. Please tell me I don't need to
> reject this nice machine!!

Agreed, great price considering it's the latest Gen CPU. right now they are paperweights.
Comment 13 p0lloc 2023-09-15 19:08:15 UTC
Same issue here! Tried mixing pretty much every i8042 kernel parameter and the only thing I found slightly working was "i8042.direct i8042.dumbkbd i8042.noloop i8042.nopnp". This causes an extreme input delay (15 seconds to 1 minute per key press) but at least something happens. dumbkbd only seems necessary to map to the correct keys. If I omit it, all keys show up as a comma instead.
Comment 14 Rob Whalley 2023-09-21 12:59:05 UTC
Well, I'm stumped. Using the latest version of the file from https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/acpi/resource.c that includes some simplification / consolidation, have tried patching drivers/acpi/resource.c to add the vendor and board name to either irq1_level_low_skip_override or irq1_edge_low_force_override...

/*
 * DMI matches for boards where the DSDT specifies the kbd IRQ as
 * level active-low and using the override changes this to rising edge,
 * stopping the keyboard from working.
 */
static const struct dmi_system_id irq1_level_low_skip_override[] = {

...

/*
 * DMI matches for AMD Zen boards where the DSDT specifies the kbd IRQ
 * as falling edge and this must be overridden to rising edge,
 * to have a working keyboard.
 */
static const struct dmi_system_id irq1_edge_low_force_override[] = {

...

static const struct irq_override_cmp override_table[] = {
	{ irq1_level_low_skip_override, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0, false },
	{ irq1_edge_low_force_override, 1, ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_LOW, 1, true },
};


The six override values map to dmi_system_id, irq, triggering, polarity, shareable, override (see irq_override_cmp). This page was useful in broadly understanding the differences in high/low/edge/level triggering: https://wiki.osdev.org/MADT

The information from the decompiled DSDT (PNP0303) attached previously looks like it might match irq1_edge_low_force_override...

IRQ (Edge, ActiveLow, Shared, )
                            {1}

This is the very simple patch added, pretty much a copy of 
the "PCSpecialist Elimina Pro 16 M" quirk from bug 217394:

+	{
+		/*
+		 * Lenovo IdeaPad Slim 3 15AMN8
+		 *
+		 * Matching on board-name.
+		 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_BOARD_NAME, "LNVNB161216"),
+		},
+	},

With the laptop identifiers added to irq1_edge_low_force_override, the dmesg output included:

ACPI: IRQ 1 override to edge, high(!)

So, at least it was possible to say the patch had an effect, albeit not one that resulted in a fix. Various combinations of the pci / acpi kernel parameters were tried without any luck, both in patched and unpatched states:
https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt

Confirmed p0lloc's combination of parameters do the same here.
Comment 15 Victor Bonnelle 2023-09-27 11:10:40 UTC
A friend has this issue as well on the same laptop. As you mentionned, "i8042.direct i8042.dumbkbd i8042.noloop i8042.nopnp" makes the keyboard work but with a huge input delay, and it also writes the character hundreds of times (even if I only pressed the key without holding it).
Comment 16 Victor Bonnelle 2023-09-27 11:11:59 UTC
We tried the code linked below, but it does nothing.
https://blog.yjl.im/2010/08/disable-laptop-ps2-at-keyboard-i8042.html
Comment 17 p0lloc 2023-10-03 14:30:43 UTC
I also tried patching drivers/acpi/resource.c with various combinations of level/edge, shareability and override, to no avail (except for the "IRQ override to" message). It seems that "i8042.direct i8042.noloop i8042.nopnp" MUST be present for i8042 to even create a "AT Raw Set 2 keyboard" input. No input "port" is ever created otherwise. They are also necessary for "AUX port at ..." to show up. 

I was wrong about the dumbkbd option, correct keys are getting through, but only after 10-20 commas. Could these be "handshake" messages that are being misinterpreted as key presses? 

Excuse my lack of knowledge on this topic, but has this even been confirmed to be an IRQ issue? Is it the IRQ mismatch that prevents i8042 from communicating with the keyboard to create the correct input ports? Is this a bug in i8042 itself? Would love if someone knowledgeable could chime in.
Comment 18 Rob Whalley 2023-11-02 15:12:45 UTC
I had no expectation that it would, but just to confirm the new BIOS version (L1CN33WW) does not seem to resolve the problem with the keyboard / trackpad being unresponsive post-GRUB.
Comment 19 Ivo 2023-12-02 19:42:39 UTC
I had the same issue with a Lenovo ideapad slim 3 15AMN8.

With the live image from ubuntu 23.10.1 or 22.04.3, the keyboard and trackpad don't work. However, there have been some recent changes to https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/drivers/acpi/resource.c
so I tried with kernel 6.6.3 from https://kernel.ubuntu.com/mainline/, and with that, the keyboard and trackpad DO work, so it seems (some of) the recent changes fix the issue.

Note that I didn't have to use any of the boot options (i8042.*) to make it work.
Comment 20 Victor Bonnelle 2023-12-03 17:54:46 UTC
It also works on the latest Debian testing kernel, that is, version 6.5.10. Thank you for the update.
Comment 21 Rob Whalley 2023-12-05 15:43:41 UTC
Thanks Ivo, much appreciated - the latest kernel works for me too. It took me a while to find, but I think this was fixed under this bug report about a month ago: https://bugzilla.kernel.org/show_bug.cgi?id=218003

Looking at p0lloc's comment on 218003 (13th October), he references this bug report... if only Bugzilla cross-referenced issues automatically like GitHub does, but unfortunately it doesn't work that way.

The comment from Hans de Goede states that it should be fixed on kernels 6.5.10 and later, which matches the report given by Victor above.