aymanbagabas / Huawei-WMI

Huawei WMI laptop extras linux driver
GNU General Public License v2.0
228 stars 15 forks source link

Huawei Matebook D15 AMD R7 from 2020 #40

Closed krysopath closed 2 years ago

krysopath commented 4 years ago

battery thresholds and external microphone

I recently purchased Matebook D15 and am really glad you pioneered support. Most features do work right out of the box. I am missing control over battery thresholds, and an issue with my external microphone audio jack.

To Reproduce battery Steps to reproduce the behavior:

  1. run 5.4.0-42-generic in ubuntu 20.04
  2. Try to set battery charging thresholds in /sys/class/power_supply
  3. device does not expose that interface via kernel sysfs

Expected behavior

I want to set charging thresholds via sysfs interface to have less wear on the battery.

To Reproduce audio Steps to reproduce the behavior:

  1. run 5.4.0-42-generic in ubuntu 20.04
  2. Plug a external headset
  3. pulseaudio will continue to record with internal microphone, as no external input is recognized

Expected behavior I want to use external input source when plugging in external headset via that jack.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop: Linux porta 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux with ubuntu focal 20.04

[...]
processor   : 7
vendor_id   : AuthenticAMD
cpu family  : 23
model       : 24
model name  : AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
stepping    : 1
microcode   : 0x8108109
cpu MHz     : 1330.778
cache size  : 512 KB
physical id : 0
siblings    : 8
core id     : 3
cpu cores   : 4
apicid      : 7
initial apicid  : 7
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb hw_pstate sme ssbd sev ibpb vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 xsaves clzero irperf xsaveerptr arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif overflow_recov succor smca
bugs        : sysret_ss_attrs null_seg spectre_v1 spectre_v2 spec_store_bypass
bogomips    : 4591.32
TLB size    : 2560 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 43 bits physical, 48 bits virtual
power management: ts ttp tm hwpstate eff_freq_ro [13] [14]

the wmi related modules:

$ lsmod |grep wmi
snd_rawmidi            36864  1 snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
wmi_bmof               16384  0
snd                    90112  27 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,snd_soc_core,snd_pcm,snd_rawmidi
huawei_wmi             16384  0
ledtrig_audio          16384  3 snd_hda_codec_generic,huawei_wmi,snd_hda_codec_realtek
sparse_keymap          16384  1 huawei_wmi
wmi                    32768  2 huawei_wmi,wmi_bmof

dmesg.log

alsa-info: http://alsa-project.org/db/?f=6e2af66bedb483f0f613cae40382c90a4d590efa

lspci.txt

Additional context I can help and will dedicate time if this behavior can be fixed via a contribution. Give me directions for more specific debug output.

aymanbagabas commented 4 years ago

Could you please provide an acpi dump? Refer to https://01.org/linux-acpi/utilities for more information.

krysopath commented 4 years ago

Installed acpica-tools via apt.

$ sudo acpidump > acpi-tables.out
$ sha256sum acpi-tables.out 
775424a87f8e12e3f4047e8050237a9396465b1b268552d25268939433a5944c  acpi-tables.out

gzipped to satisfy github contraints.

acpi-tables.out.gz

krysopath commented 4 years ago

I also updated
lspci.txt by running it with uid 0. Now includes Capabilities for each device.

krysopath commented 4 years ago

Can I help by further remote command execution or via learning how acpi actually does work?

aymanbagabas commented 3 years ago

Can you upload the output of dmidecode > dmidecode.txt

krysopath commented 3 years ago

dmidecode.txt.gz

aymanbagabas commented 3 years ago

Could you please try building the module from the source and report what files get exposed under /sys/devices/platform/huawei-wmi/

krysopath commented 2 years ago
$ modinfo huawei_wmi
filename:       /lib/modules/5.4.0-89-generic/extra/huawei-wmi.ko
license:        GPL v2
description:    Huawei WMI laptop extras driver
author:         Ayman Bagabas <ayman.bagabas@gmail.com>
alias:          wmi:ABBC0F5B-8EA1-11D1-A000-C90629100000
srcversion:     9EE027D22741953CF93ADF0
alias:          wmi:ABBC0F5C-8EA1-11D1-A000-C90629100000
alias:          wmi:59142400-C6A3-40fa-BADB-8A2652834100
depends:        ledtrig-audio,wmi,sparse-keymap
retpoline:      Y
name:           huawei_wmi
vermagic:       5.4.0-89-generic SMP mod_unload modversions 
parm:           battery_reset:Reset battery charge values to (0-0) before disabling it using (0-100) (bint)
parm:           report_brightness:Report brightness keys. (bint)

$ tree /sys/devices/platform/huawei-wmi/
/sys/devices/platform/huawei-wmi/
├── charge_control_thresholds
├── driver -> ../../../bus/platform/drivers/huawei-wmi
├── driver_override
├── fn_lock_state
├── input
│   └── input8
│       ├── capabilities
│       │   ├── abs
│       │   ├── ev
│       │   ├── ff
│       │   ├── key
│       │   ├── led
│       │   ├── msc
│       │   ├── rel
│       │   ├── snd
│       │   └── sw
│       ├── device -> ../../../huawei-wmi
│       ├── event7
│       │   ├── dev
│       │   ├── device -> ../../input8
│       │   ├── power
│       │   │   ├── async
│       │   │   ├── autosuspend_delay_ms
│       │   │   ├── control
│       │   │   ├── runtime_active_kids
│       │   │   ├── runtime_active_time
│       │   │   ├── runtime_enabled
│       │   │   ├── runtime_status
│       │   │   ├── runtime_suspended_time
│       │   │   └── runtime_usage
│       │   ├── subsystem -> ../../../../../../class/input
│       │   └── uevent
│       ├── id
│       │   ├── bustype
│       │   ├── product
│       │   ├── vendor
│       │   └── version
│       ├── modalias
│       ├── name
│       ├── phys
│       ├── power
│       │   ├── async
│       │   ├── autosuspend_delay_ms
│       │   ├── control
│       │   ├── runtime_active_kids
│       │   ├── runtime_active_time
│       │   ├── runtime_enabled
│       │   ├── runtime_status
│       │   ├── runtime_suspended_time
│       │   └── runtime_usage
│       ├── properties
│       ├── subsystem -> ../../../../../class/input
│       ├── uevent
│       └── uniq
├── leds
│   └── platform::micmute
│       ├── brightness
│       ├── device -> ../../../huawei-wmi
│       ├── max_brightness
│       ├── power
│       │   ├── async
│       │   ├── autosuspend_delay_ms
│       │   ├── control
│       │   ├── runtime_active_kids
│       │   ├── runtime_active_time
│       │   ├── runtime_enabled
│       │   ├── runtime_status
│       │   ├── runtime_suspended_time
│       │   └── runtime_usage
│       ├── subsystem -> ../../../../../class/leds
│       ├── trigger
│       └── uevent
├── modalias
├── power
│   ├── async
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_kids
│   ├── runtime_active_time
│   ├── runtime_enabled
│   ├── runtime_status
│   ├── runtime_suspended_time
│   └── runtime_usage
├── subsystem -> ../../../bus/platform
└── uevent

19 directories, 66 files
sermart1234 commented 2 years ago

I'll try test on Huawei Matebook D15 with 3700U

sermart1234 commented 2 years ago

@krysopath please test this https://github.com/aymanbagabas/Huawei-WMI/issues/55#issuecomment-1025651920

sermart1234 commented 2 years ago

@krysopath if you set "0 0" or "0 100" in charge_control_thresholds then it turn on smart charge https://github.com/aymanbagabas/Huawei-WMI/issues/55#issuecomment-1028953673

krysopath commented 2 years ago

@sermart1234 @aymanbagabas

Still not working is pulseaudios recording device change, when a microphone jack is plugged into the laptop, but I was able to verify smart charge device node working. Thank you all. <3

Now my battery can breathe a bit more freely with the 55% capacity it has left.

Is it feasible to solve the audio jack problem here as well?

sermart1234 commented 2 years ago

@krysopath test please https://github.com/aymanbagabas/Huawei-WMI/pull/64