BeardOverflow / msi-ec

GNU General Public License v2.0
145 stars 45 forks source link

Firmware request for MSI Cyborg 15 A12VF #90

Closed heinthanth closed 6 months ago

heinthanth commented 11 months ago

Laptop model

MSI Cyborg 15 A12VF

EC firmware version

15K1IMS1.110

EC memory dump

     | _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _a _b _c _d _e _f
-----+------------------------------------------------
0x0_ | 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2_ | 00 00 00 00 00 00 00 00 0a 05 00 00 00 00 0b 1b
0x3_ | 03 09 00 0d 00 00 50 81 d2 11 88 2c c8 01 e0 00
0x4_ | 00 00 60 00 0d 11 00 00 56 10 e2 31 10 0c 00 00
0x5_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x6_ | 00 00 00 00 00 00 00 00 32 00 33 3a 41 49 4e 53
0x7_ | 64 28 26 28 2d 36 3c 44 4e 58 06 06 06 07 04 04
0x8_ | 2b 00 2b 30 35 3a 41 46 64 28 26 28 2d 36 3c 44
0x9_ | 4e 64 03 03 03 03 05 03 06 05 00 06 0f 00 00 00
0xa_ | 31 35 4b 31 49 4d 53 31 2e 31 31 30 30 38 31 30
0xb_ | 32 30 32 33 31 31 3a 31 30 3a 30 37 00 00 00 08
0xc_ | 00 00 06 22 00 00 00 00 00 cd 00 00 00 00 00 00
0xd_ | 00 00 c1 83 0d 00 04 80 00 05 00 00 00 06 00 00
0xe_ | e2 00 00 0d 11 00 00 40 01 00 00 00 00 d1 00 00
0xf_ | 00 00 70 00 2b 64 00 2b 64 00 00 00 00 01 01 00

GPU

Nvidia

Is your keyboard RGB?

No (single color)

Additional context

No response

heinthanth commented 8 months ago

I figured out these addresses: https://gist.github.com/heinthanth/7f4d527b54a845facf0c31862cee896d

glpnk commented 8 months ago

@heinthanth Ready for test and review #102

Download with

git clone -b 15K1IMS1 https://github.com/glpnk/msi-ec.git

Make and load

make
sudo make load

Thanks for your EC map analysis

My thoughts:

heinthanth commented 8 months ago

@glpnk Thank you very much for the hard works. I did quick tests and almost everything's working!

Except two things:

glpnk commented 8 months ago

@heinthanth

  1. This module not implement key events.

Try

lsmod | grep msi

This should return msi_wmi module. If not

sudo modprobe msi_wmi

For my laptop msi_wmi module is unnecessary and all key events are handled by ACPI and other Linux keyboard related drivers

  1. Wrong win-fn key swap is known but no workaround. ~Or maybe you understand it's value wrong?~ Because in default settings buttons are placed like

Ctrl | FN | WIN | alt....

and win-fn-swap change FN and WIN key codes

~So "win_key file returns right" is default~

UPD: Interesting, is it comfort in default mode? Or key swap is only one solution for comfort use?

MSI Cyborg 15 A12VF

heinthanth commented 8 months ago

I tested again!

  1. Key events work properly. I don't know what happened yesterday.
  2. Key swap is also working although value is confusing for end user ( like right for left and left for right ) - I understand the concept. But just thinking from non-dev, end-user perspective.

Comfort mode is default ( as I set balanced mode when I used Windows ). But I can switch shift modes and also swap keys.

One more thing is:

image

Does my laptop has GPU fan speed? Because I didn't see GPU RPM in MSI center and couldn't figured out the address. And as in the photo, it's 38 ( although my GPU is power down with NVIDIA prime )

glpnk commented 8 months ago

@heinthanth

  1. Great to know! Did you loaded module manually? You can run this to install.

    sudo make dkms-install

    Sometimes after kernel upgrade it may break, so you need to reinstall

    sudo make dkms-uninstall
    sudo make dkms-install
  2. Yeah, it weird. Maybe MSI software use this register as toggle and in GUI use model match or different method. @teackot What you think about adding "quirk" win-fn swapped to .fn_win_swap structure? Or not referring swap as left/right?

  3. Comfort mode could be set as default after reboot

  4. How many coolers you have? If one - GPU report same %RPM(from 0-150% if I set it correctly) like CPU. About 0 temp on GPU - seems like you GPU not used, try to load it with some program

heinthanth commented 8 months ago

@glpnk

Great! Now, I installed permanently. Thank you very much!

  1. Yeah, shift_mode is set back to comfort after reboot. Is that because BIOS overwrite it? But it's Ok, at least, now I have way to switch to turbo mode if needed.
  2. I think I have only one. Not sure :smile:
glpnk commented 8 months ago

@heinthanth By photo seems one cooler with exhaust on 2 sides, if it's true - probably you have 1 cooler.

heinthanth commented 8 months ago

Key events stop working randomly. When I press F2 ( volume down ), it acts like F2 no matter Fn-Lock is enabled or not. I suspended my laptop deeply. After wake up, they don't work anymore! But after reboot, they work again

glpnk commented 8 months ago

Can you share what returns this command? It will be useful for troubleshooting msi-wmi module

ls /sys/bus/wmi/devices/
heinthanth commented 8 months ago

@glpnk

Before deep suspend:

Screenshot from 2024-01-17 08-51-58

After deep suspend:

Screenshot from 2024-01-17 08-54-22

glpnk commented 8 months ago

Please share ls output in text without any flags

Try unloading msi-wmi kernel module and check is hotkeys are working

To unload

sudo modprobe -r msi_wmi

To load

sudo modprobe msi_wmi
heinthanth commented 8 months ago
05901221-D566-11D1-B2F0-00A0C9062910    5B3CC38A-40D9-7245-8AE6-1145B751BE3F
05901221-D566-11D1-B2F0-00A0C9062910-1  A6FEA33E-DABF-46F5-BFC8-460D961BEC9F
1F13AB7F-6220-4210-8F8E-8BB5E71EE969    ABBC0F6D-8EA1-11D1-00A0-C90629100000
2BC49DEF-7B15-4F05-8BB7-EE37B9547C0B    ABBC0F6E-8EA1-11D1-00A0-C90629100000

I tried load and unload the msi-wmi module. But still not working!

glpnk commented 8 months ago

Seems problem in some other place. Try to check input devices

cat /proc/bus/input/devices
heinthanth commented 8 months ago

Input:

I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:35/PNP0C09:00/PNP0C0D:00/input/input0
U: Uniq=
H: Handlers=event0 
B: PROP=0
B: EV=21
B: SW=1

I: Bus=0019 Vendor=0000 Product=0003 Version=0000
N: Name="Sleep Button"
P: Phys=PNP0C0E/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input1
U: Uniq=
H: Handlers=kbd event1 
B: PROP=0
B: EV=3
B: KEY=4000 0 0

I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0011 Vendor=0001 Product=0001 Version=ab83
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input3
U: Uniq=
H: Handlers=sysrq kbd leds event3 rfkill 
B: PROP=0
B: EV=120013
B: KEY=600702900000 c380287af240d001 feffffdfffcfffff fffffffffffffffe
B: MSC=10
B: LED=7

I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/LNXVIDEO:00/input/input4
U: Uniq=
H: Handlers=kbd event4 
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0

I: Bus=0019 Vendor=0000 Product=0006 Version=0000
N: Name="Video Bus"
P: Phys=LNXVIDEO/video/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:01/input/input5
U: Uniq=
H: Handlers=kbd event5 
B: PROP=0
B: EV=3
B: KEY=3e000b00000000 0 0 0

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Intel HID events"
P: Phys=
S: Sysfs=/devices/platform/INTC1070:00/input/input6
U: Uniq=
H: Handlers=kbd event6 rfkill 
B: PROP=0
B: EV=13
B: KEY=81000300000000 5000004000 1e294000000020 0
B: MSC=10

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Intel HID 5 button array"
P: Phys=
S: Sysfs=/devices/platform/INTC1070:00/input/input7
U: Uniq=
H: Handlers=kbd event7 
B: PROP=0
B: EV=13
B: KEY=2000000000000 0 0 0 0 1000000000000 0 201c000000000000 0
B: MSC=10

I: Bus=0010 Vendor=001f Product=0001 Version=0100
N: Name="PC Speaker"
P: Phys=isa0061/input0
S: Sysfs=/devices/platform/pcspkr/input/input8
U: Uniq=
H: Handlers=kbd event8 
B: PROP=0
B: EV=40001
B: SND=6

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/ACPI0011:00/gpio-keys.1.auto/input/input10
U: Uniq=
H: Handlers=event10 rfkill 
B: PROP=0
B: EV=21
B: SW=8

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input14
U: Uniq=
H: Handlers=event11 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=7"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input15
U: Uniq=
H: Handlers=event12 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=8"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input16
U: Uniq=
H: Handlers=event13 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="HDA NVidia HDMI/DP,pcm=9"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input17
U: Uniq=
H: Handlers=event14 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0018 Vendor=04f3 Product=3282 Version=0100
N: Name="ELAN0307:00 04F3:3282 Mouse"
P: Phys=i2c-ELAN0307:00
S: Sysfs=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-11/i2c-ELAN0307:00/0018:04F3:3282.0001/input/input18
U: Uniq=
H: Handlers=event15 mouse0 
B: PROP=0
B: EV=17
B: KEY=30000 0 0 0 0
B: REL=3
B: MSC=10

I: Bus=0018 Vendor=04f3 Product=3282 Version=0100
N: Name="ELAN0307:00 04F3:3282 Touchpad"
P: Phys=i2c-ELAN0307:00
S: Sysfs=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-11/i2c-ELAN0307:00/0018:04F3:3282.0001/input/input20
U: Uniq=
H: Handlers=event16 mouse1 
B: PROP=5
B: EV=1b
B: KEY=e520 10000 0 0 0 0
B: ABS=2e0800000000003
B: MSC=20

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="sof-hda-dsp Mic"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input21
U: Uniq=
H: Handlers=event17 
B: PROP=0
B: EV=21
B: SW=10

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="sof-hda-dsp Headphone"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input22
U: Uniq=
H: Handlers=event18 
B: PROP=0
B: EV=21
B: SW=4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="sof-hda-dsp HDMI/DP,pcm=3"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input23
U: Uniq=
H: Handlers=event19 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="sof-hda-dsp HDMI/DP,pcm=4"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input24
U: Uniq=
H: Handlers=event20 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="sof-hda-dsp HDMI/DP,pcm=5"
P: Phys=ALSA
S: Sysfs=/devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input25
U: Uniq=
H: Handlers=event21 
B: PROP=0
B: EV=21
B: SW=140

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="MSI WMI hotkeys"
P: Phys=wmi/input0
S: Sysfs=/devices/virtual/input/input26
U: Uniq=
H: Handlers=kbd event9 
B: PROP=0
B: EV=13
B: KEY=1000300000000 300000 e000000000000 0
B: MSC=10
glpnk commented 8 months ago

Strange, only one used GUID for msi-wmi is 5B3CC38A-40D9-7245-8AE6-1145B751BE3F but whole module useless.

Problems could be in gpio-keys or two Intel HID or in any other place

Try to find people with similar problems

Also try to unload gpio-keys when keys are works

Check troubleshooting guides for this https://github.com/torvalds/linux/blob/master/drivers/platform/x86/intel/hid.c

heinthanth commented 6 months ago

I'll close this issue as of now. Since it's almost usable. The function keys issue after deep suspend is not related to msi-ec. The same issue happens in bare minimal os too ( msi-ec module not loaded )