Bug 218901
Summary: | LG Gram Laptop Extra Features not working on 2024 models (16Z90S) | ||
---|---|---|---|
Product: | Drivers | Reporter: | Agathe Boutmy (agathe) |
Component: | Platform_x86 | Assignee: | drivers_platform_x86 (drivers_platform_x86) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | ghostwind, matan, W_Armin |
Priority: | P3 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 6.9,6.9.2,6.10-rc1 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
acpidump
Prototype kernel module Prototype kernel module v2 Prototype kernel module v3 Prototype kernel module v4 Function key row Prototype wireless kotkey driver Prototype lg-laptop driver v5 Prototype wireless kotkey driver v2 DMESG DUMP 2 |
Description
Agathe Boutmy
2024-05-27 16:48:02 UTC
Can you share the output of "acpidump"? Created attachment 306358 [details]
acpidump
Comment on attachment 306358 [details]
acpidump
here is the acpidump, i wanted to join it to the initial report but couldn't figure out how to install it at first on Manjaro, I just realized it was part of acpica
It seems that the LGEX0820 device used by this driver is not mapped at \XINI, but rather at \_SB.XINI. This should normally cause no problems, but it seems that the driver is not using the ACPI driver model. Can you compile and load kernel modules on this device? (In reply to Armin Wolf from comment #4) > It seems that the LGEX0820 device used by this driver is not mapped at > \XINI, but rather at \_SB.XINI. This should normally cause no problems, but > it seems that the driver is not using the ACPI driver model. > > Can you compile and load kernel modules on this device? Yes, it's basically a new installation, if something breaks I can reinstall it completely with no issue so I can test whatever is needed on it. (In reply to Armin Wolf from comment #4) Did you have a specific kernel module in mind? I think i will send you an modified lg-laptop module for testing. Before i do that, i have some questions for you: 1. Does /sys/bus/platform/devices/LGEX0820:00/ exist? 2. What is the content of /sys/bus/acpi/devices/LGEX0820:00/status ? (In reply to Armin Wolf from comment #7) > I think i will send you an modified lg-laptop module for testing. > Before i do that, i have some questions for you: > > 1. Does /sys/bus/platform/devices/LGEX0820:00/ exist? Yes! > 2. What is the content of /sys/bus/acpi/devices/LGEX0820:00/status ? 31 Created attachment 306399 [details]
Prototype kernel module
This modified lg-laptop kernel module should work on you device.
You can compile it by executing the following commands inside the unpacked directory:
1. make
2. sudo modprobe -r lg-laptop
3. sudo insmode lg-laptop.ko
Can you check that everything works now? (In reply to Armin Wolf from comment #10) > Can you check that everything works now? I wasn't able to load the module with insmod, I'm getting an unknown module error. dmesg lists the Unknown symbols as ``` [ 5954.414920] lg_laptop: Unknown symbol sparse_keymap_entry_from_scancode (err -2) [ 5954.414956] lg_laptop: Unknown symbol sparse_keymap_report_entry (err -2) [ 5954.415000] lg_laptop: Unknown symbol sparse_keymap_setup (err -2) ``` I couldn't figure how to fix it so I modprobed it instead: 1. zstd lg-laptop.ko 2. sudo cp -f lg-laptop.ko.zst /usr/lib/modules/$(uname -r)/kernel/drivers/platform/x86/ 3. sudo depmod 4. sudo modprobe lg-laptop I think it's properly loaded now, however it does not work, I still have the input output error when trying to read /sys/class/power_supply/BAT0/charge_control_end_threshold and I don't know whether that is normal but /sys/devices/platform/lg-laptop/ no longer exists. I do have /sys/bus/platform/devices/lg-laptop/battery_care_limit however which also returns an Input/Output Error. On the dmesg side I have now: [ 24.393457] lg-laptop lg-laptop: WMAB: call failed when trying to cat one or the other. Did you unload the old module first? Or does dmesg show any ACPI errors? Created attachment 306402 [details]
Prototype kernel module v2
I made a mistake when calling the ACPI methods, can you try again?
(In reply to Armin Wolf from comment #12) > Did you unload the old module first? yes > Or does dmesg show any ACPI errors? There is one that was already present before that I didn't mention because after a little research it seemed to be unrelated, I'll post it here just in case: [ 10.843998] ACPI Error: No handler for Region [XIN1] (00000000f9e347f6) [UserDefinedRegion] (20240322/evregion-130) [ 10.844003] ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20240322/exfldio-261) [ 10.844007] ACPI Error: Aborting method \_SB.PC00.LPCB.H_EC.DPTF.SNRD due to previous error (AE_NOT_EXIST) (20240322/psparse-529) [ 10.844010] ACPI Error: Aborting method \_SB.IETM.SEN2._TMP due to previous error (AE_NOT_EXIST) (20240322/psparse-529) > I made a mistake when calling the ACPI methods, can you try again? It works! (I think, I now longer have an input output error on battery care limit and I have been able to set it to 80% and it seems to stop properly charging if I believe what the power management service included with Manjaro is saying) The other files are also correctly readable. The 3 FN keys FN-F1, FN-F6, FN-F9 don't seem to do anything but strangely FN-F5 works (which it did before) maybe it's handled differently by the driver. I just rebooted to check if the bios was now correctly saving the 80% charge max value and it does, so it seems to be good on that end. The /sys/devices/platform/lg-laptop/ folder is still missing so maybe that's related to the issue with the 3 not working FN-keys. Writing directly in /sys/bus/platform/devices/lg-laptop/reader_mode does not seem to do anything, /sys/bus/platform/devices/lg-laptop/fn_lock however works. I'm unsure whether fan_mode works or not. I'm going to turn off the laptop and check if usb_charge works. usb_charge works properly! Created attachment 306403 [details]
Prototype kernel module v3
This should fix the missing /sys/devices/platform/lg-laptop/ directory. Can you test again please?
Regarding the FN-keys: i think this is a different problem. As soon as the lg-laptop module works on your device, we can focus on getting you FN-keys to work. New module works, the directory is now present. I was having an issue with the v2 that didn't happen immediately, the wifi kept deactivating and the bluetooth activating. It only stopped after unloading the lg-laptop module. It does not seem to be happening with the v3 at least for now. Could it be that one of the FN-keys acts as some sort of airplane mode hotkey? (In reply to Armin Wolf from comment #22) > Could it be that one of the FN-keys acts as some sort of airplane mode > hotkey? I'm not sure, it kept happening after rebooting and without pressing anything Oh no, seems like we need to do a bit more reverse-engineering Does dmesg report any debug messages like "Type: XX Eventcode: 0xXX"? If yes, then please send me the output of dmesg after pressing the FN-keys. Should the wifi issue happen again, please send me the dmesg output too. I just added the maintainer of the lg-laptop driver to the CC list. Maybe he can help with reverse-engineering. (In reply to Armin Wolf from comment #25) > Does dmesg report any debug messages like "Type: XX Eventcode: 0xXX"? > > If yes, then please send me the output of dmesg after pressing the FN-keys. > Should the wifi issue happen again, please send me the dmesg output too. Yes, here they are: FN key pressed: [ 8437.457099] lg_laptop: Type: 1 Eventcode: 0x30010000 FN key released: [ 8469.382650] lg_laptop: Type: 1 Eventcode: 0x30010001 // also happens when pressing and after releasing FN-F1..4 (twice when releasing since 2 keys are being released I guess) FN-F1: [ 8491.979548] lg_laptop: Type: 1 Eventcode: 0xf070002 FN-F2: [ 8545.037702] lg_laptop: Type: 1 Eventcode: 0x9000087 FN-F3: [ 8561.170853] lg_laptop: Type: 1 Eventcode: 0x9000086 FN-F4: [ 8642.087767] lg_laptop: Type: 1 Eventcode: 0x10300100 FN-F5 has a different behaviour than the previous four: Here is the full list of code sent when pressing them: [ 8737.235169] lg_laptop: Type: 1 Eventcode: 0x30010000 // here only fn is pressed [ 8739.068108] lg_laptop: event guid 2 [ 8739.068163] lg_laptop: Type: 1 Eventcode: 0x30010001 // fn held and F5 pressed [ 8739.091282] lg_laptop: event guid 2 [ 8739.091331] lg_laptop: Type: 1 Eventcode: 0x30020000 [ 8739.117827] lg_laptop: event guid 2 [ 8739.117872] lg_laptop: Type: 1 Eventcode: 0x30020001 [ 8739.145947] lg_laptop: event guid 0 [ 8739.146019] lg_laptop: Type: 1 Eventcode: 0x74 [ 8739.231070] lg_laptop: event guid 2 [ 8739.231127] lg_laptop: Type: 1 Eventcode: 0x30010001 //both key released [ 8740.811039] lg_laptop: event guid 2 [ 8740.811101] lg_laptop: Type: 1 Eventcode: 0x30010001 FN-F6: [ 8938.295301] lg_laptop: Type: 1 Eventcode: 0xf000002 //behaves like F1..F4 FN-F7 doesn't seem to have a unique code, here's what I get (it does what it's supposed to though): [ 9016.134096] lg_laptop: event guid 2 [ 9016.134153] lg_laptop: Type: 1 Eventcode: 0x30010000 [ 9017.160755] lg_laptop: event guid 2 [ 9017.160813] lg_laptop: Type: 1 Eventcode: 0x30010001 [ 9017.183855] lg_laptop: event guid 2 [ 9017.183905] lg_laptop: Type: 1 Eventcode: 0x30020000 [ 9017.210594] lg_laptop: event guid 2 [ 9017.210644] lg_laptop: Type: 1 Eventcode: 0x30020001 [ 9017.260458] lg_laptop: event guid 2 [ 9017.260507] lg_laptop: Type: 1 Eventcode: 0x30010001 [ 9017.537250] lg_laptop: event guid 2 [ 9017.537335] lg_laptop: Type: 1 Eventcode: 0x30010001 FN-F8, the keyboard brightness control key seems to be the one starting a loop of disconnecting the wifi and activating bluetooth, pressing it once leads to having to deactivate the module if I want to return to a stable state, here's the output: [ 9104.362389] lg_laptop: Type: 1 Eventcode: 0x30010000 [ 9106.929029] lg_laptop: event guid 2 [ 9106.929083] lg_laptop: Type: 1 Eventcode: 0x30010001 [ 9106.952201] lg_laptop: event guid 2 [ 9106.955362] lg_laptop: Type: 1 Eventcode: 0x10000000 [ 9107.059296] lg_laptop: event guid 2 [ 9107.059390] lg_laptop: Type: 1 Eventcode: 0x30010001 [ 9107.799205] ACPI: \_SB_.XINI: notify: 192 [ 9107.821281] wlp0s20f3: deauthenticating from 68:3f:7d:36:0b:15 by local choice (Reason: 3=DEAUTH_LEAVING) [ 9108.098842] lg_laptop: event guid 2 [ 9108.098888] lg_laptop: Type: 1 Eventcode: 0x30010001 [ 9108.815812] ACPI: \_SB_.XINI: notify: 192 [ 9108.829467] iwlwifi 0000:00:14.3: WRT: Invalid buffer destination [ 9108.985519] iwlwifi 0000:00:14.3: Not valid error log pointer 0x0024B5C0 for RT uCode [ 9108.985633] iwlwifi 0000:00:14.3: WFPM_UMAC_PD_NOTIFICATION: 0x1f [ 9108.985651] iwlwifi 0000:00:14.3: WFPM_LMAC2_PD_NOTIFICATION: 0x1f [ 9108.985658] iwlwifi 0000:00:14.3: WFPM_AUTH_KEY_0: 0x80 [ 9108.985666] iwlwifi 0000:00:14.3: CNVI_SCU_SEQ_DATA_DW9: 0x0 [ 9108.986425] iwlwifi 0000:00:14.3: RFIm is deactivated, reason = 4 [ 9112.617854] wlp0s20f3: authenticate with 68:3f:7d:36:0b:15 (local address=e4:c7:67:24:ee:74) [ 9112.618541] wlp0s20f3: send auth to 68:3f:7d:36:0b:15 (try 1/3) [ 9112.648263] wlp0s20f3: authenticated [ 9112.648833] wlp0s20f3: associate with 68:3f:7d:36:0b:15 (try 1/3) [ 9112.652551] wlp0s20f3: RX AssocResp from 68:3f:7d:36:0b:15 (capab=0x1511 status=0 aid=74) [ 9112.655106] wlp0s20f3: associated [ 9112.668475] wlp0s20f3: Limiting TX power to 23 (23 - 0) dBm as advertised by 68:3f:7d:36:0b:15 [ 9114.722923] lg_laptop: event guid 2 [ 9114.722982] lg_laptop: Type: 1 Eventcode: 0x30010000 [ 9114.899608] ACPI: \_SB_.XINI: notify: 192 My understanding of what happens looking at dmesg in follow mode is that it sends the even once when pressing FN-F8 and then any keyboard use after that sends the event again (fn key or not) which means any input results in the network connecting or disconnecting. It doesn't turn airplane mode on though. FN-F9: [ 9658.815309] lg_laptop: Type: 1 Eventcode: 0xf020000 FN-F10..12 same behaviour as FN-F7 which makes me think this is handled somewhere which would make sense since it's not a functionnality exclusive to the LG Gram. I think i found the culprit, the driver does not check which notification codes it receives and just blindly assumes that its an rfkill notification. I will try to fix this tomorrow. Created attachment 306408 [details]
Prototype kernel module v4
I have removed the airplane mode hotkey handling from the driver, can you test again if the wifi issues are resolved now?
Can you also send me the output of dmesg after pressing FN+F8? I am curious if the strange ACPI events are still happening.
(In reply to Armin Wolf from comment #29) > Created attachment 306408 [details] > Prototype kernel module v4 > > I have removed the airplane mode hotkey handling from the driver, can you > test again if the wifi issues are resolved now? Yes, it no longers deactivate the wifi. > Can you also send me the output of dmesg after pressing FN+F8? I am curious > if the strange ACPI events are still happening. it is still happening: here is the output once I press FN+F8: [26146.735205] lg_laptop: event guid 2 [26146.735305] lg_laptop: Type: 1 Eventcode: 0x30010000 [26148.031450] lg_laptop: event guid 2 [26148.031517] lg_laptop: Type: 1 Eventcode: 0x30010001 [26148.054930] lg_laptop: event guid 2 [26148.058063] lg_laptop: Type: 1 Eventcode: 0x10000000 [26148.141362] lg_laptop: event guid 2 [26148.141429] lg_laptop: Type: 1 Eventcode: 0x30010001 [26148.301453] lg_laptop: event guid 2 [26148.301518] lg_laptop: Type: 1 Eventcode: 0x30010001 [26148.324300] ACPI: \_SB_.XINI: notify: 192 [26150.350874] ACPI: \_SB_.XINI: notify: 192 [26151.363858] ACPI: \_SB_.XINI: notify: 192 [26152.380376] ACPI: \_SB_.XINI: notify: 192 it keeps sending the acpi event with any key press. It also doesn't look like the FN+F8 is able to change the keyboard lightning anymore. Does this mean that before loading the new lg-laptop driver, you where able to control the keyboard backlight with FN+F8? (In reply to Armin Wolf from comment #32) > Does this mean that before loading the new lg-laptop driver, you where able > to control the keyboard backlight with FN+F8? I think I might have tested it too quickly. It works, I just don't have the HUD anymore when using it. It also looks like the ACPI event is only sent when the keyboard lights are on. My intuition is that it is used to tell the system to keep them on as long as the keyboard is being used? So when you disable the keyboard backlight, the ACPI 192 events stop? (In reply to Armin Wolf from comment #34) > So when you disable the keyboard backlight, the ACPI 192 events stop? Yes. And I think the hud issue might have been because the laptop was in hibernation before I tried, after a reboot it seems to work properly (hibernation seems to break sound as well but I think I found a workaround). Which HUD you are referring to exactly? (In reply to Armin Wolf from comment #36) > Which HUD you are referring to exactly? The KDE (i think it's part of it anyway) on screen display. I thought it might have been an event not being sent but I think it's just hibernation messing some things up in that case so it's unrelated. Ok, in this case i will prepare the necessary patches for upstreaming lg-laptop support for your device. Does you device have an airplane mode/rfkill button? Created attachment 306409 [details]
Function key row
It does, on FN-F6, I've added a picture for reference.
Created attachment 306410 [details]
Prototype wireless kotkey driver
If this rfkill button does not work out-of-the-box with the new lg-laptop driver, then please test this kernel module.
(In reply to Armin Wolf from comment #40) > Created attachment 306410 [details] > Prototype wireless kotkey driver > > If this rfkill button does not work out-of-the-box with the new lg-laptop > driver, then please test this kernel module. It seems to work great with this module inserted! Created attachment 306424 [details]
Prototype lg-laptop driver v5
Final prototype of the lg-laptop driver for upstreaming.
Created attachment 306425 [details]
Prototype wireless kotkey driver v2
Final prototype of the wireless-hotkey driver for upstreaming.
Can you test if both modules work on your machine? I just want to verify that the changes which i am going to send upstream are correct. (In reply to Armin Wolf from comment #44) > Can you test if both modules work on your machine? I just want to verify > that the changes which i am going to send upstream are correct. I just tested both, as far as I can tell they both work without issue, dmesg isn't complaining. I can correctly write and read the files in /sys/devices/platform/lg-laptop as well. Regarding the reader_mode one, it might be very subtle, I can't see it at all (I'm colourblind but not in the colour range it's supposed to affect) but my partner who works as an artist and is very peculiar about colour choices and nuances tells me the display is slightly pinkish when writing 1 to it so it might just be an issue of it being a very subtle reader mode. FN-F9 doesn't seem to affect that tho. I will look at the code later, but regarding the reader mode: In models after 2017 (I am not sure about the exact years) reader mode only controls the reader mode led. The firmware does not change the color temperature, as it does in 2017 and older models. I guess that whatever changes pressing FN-F9 happen in windows are done by installed LG software. (In reply to Matan Ziv-Av from comment #46) > I will look at the code later, but regarding the reader mode: > > In models after 2017 (I am not sure about the exact years) reader mode only > controls the reader mode led. The firmware does not change the color > temperature, as it does in 2017 and older models. > > I guess that whatever changes pressing FN-F9 happen in windows are done by > installed LG software. ok, that would make sense. It's not a big deal anyway since night mode exist. The necessary patches are now upstreamed an will likely be released with kernel 6.11. Alright, the necessary patches are already included in kernel 6.10 and will also be backported to kernel 6.9, 6.6 and 6.1 thanks to the stable team. You might close this bug report as fixed then. (In reply to Armin Wolf from comment #50) > You might close this bug report as fixed then. done, thanks a bunch for the patch :) I'm having another issue with some thermal stuff not being handled properly now (it's generating a lot of spam in dmesg) but I don't think this is directly related as this wasn't happening when testing the module, I'll open a new issue when I have the time. I think i found a solution for you thermal dmesg spam problems, see https://bugzilla.kernel.org/show_bug.cgi?id=219075 for more details. Created attachment 306693 [details]
DMESG DUMP 2
Here you go. I also had to manually "battery", "sparse_keymap" and "wmi" before the module would load
please ignore the above post. wrong ticket |