Skip to content

right-0903/linux-gaokun

Repository files navigation

Huawei Matebook E Go (8cx Gen 3)

This repository contains workarounds for the Huawei Matebook E Go (8cx Gen 3) to support Linux.

This project mainly refers to the following projects:

  • jhovold: x13s downstream linux maintainer, upstream support for sc8280xp platform and x13s device.
  • steev: x13s downstream linux maintainer.
  • linaro team: initial arm64 EC support(C630), and UCSI driver based on arm64 EC.
  • Nikita Travkin: anoter arm64 EC driver.
  • aymanbagabas: Huawei laptop wmi driver.
  • NewWheat: yet anoter arm64 EC driver, and help from him.
  • chenxuecong2 & matalama80td3l: initial device tree for the Huawei Matebook E Go.
  • White: Dispcc and DPU fixes. hid over i2c fixes.

Upstream Progress

Initial dt support will land on 6.14.(landed)

Initial EC support will land on 6.15.(landed)

Initial UCSI support will land on 6.16.(landed)

WIP to make dsi panel land on 7.1

Disclaimer

I am just an amateur, a Linux noob, not educated with formal CS courses. You should never believe what I say below, except this sentence. I am not responsible for your actions; you do this all at your own risk!

Kernel

Use mainline with recommended patches. (My AUR here)

Kernel parameter: clk_ignore_unused pd_ignore_unused arm64.nopauth efi=noruntime

Prebuilt Bianry

See release.

User and password are both alarm and both root.

Feature Support

Refer to this as well. If you want to see some spoilers, check this.

Feature Status Note
Audio works see below
Backlight works dcs dimming, backlihgt ic should be i2c4 @??
Battery works For more attributes, check /sys/class/power_supply/gaokun-ec-battery/*
Bluetooth works Adding board file for wifi will improve RF performance
Camera x
CPUfreq works
Display works
Display sensors untested for rotation detect, light detect, etc. slpi and fastrpc
EC works Battery and adapter status, wmi, ucsi, modern standby
EFI variables works
Fingerprint reader x FTE7001, gpio185
GPU works Freedreno 690(FD690), vulkan-freedreno for vulkan support.
Hibernation x
Keyboard & Touchpad works
Keyboard fn keys partial Assistant key(between F6 and F7), WIFI key(F9), and Manager key(F10), they don't work.
Lid works
NVMe SSD works
PCIe (x4) works
Power key works
Remoteproc works adsp, cdsp
RTC works
Suspend works s2idle
Thermal sensors works
Touchscreen over i2c partial see below
Touchscreen over spi partial resolution is low temporarily, it requires algorithm to handle raw frame data
TPM x
USB works
USB-PD works fast charging(45W+) supported with UCSI EC driver
USB-C DisplayPort Alt Mode works it may be broken nowadays (untested since ~6.14)
Video acceleration untested see below
Virtualisation x
Volumn keys works
Watchdog partial One in sc8280xp works, another in EC not
Wi-Fi works see below
WMI related features partial charging control, FN lock, smart charge, thermal sensors and so on

Altmode

Caution

Recently, UCSI subsystem is buggy for this tablet. Chances are that failed to boot(auto reboot). Only plug into Type-C ports after booting up.

Addition: UCSI failed to register in 6.14, no sure about future (I don't own this device anymore, no fix from me)

Support 2-lane only for now(only half of clocks are enabled), Johan mentioned this also, but we don't require insert orientation.

In default, the bandwidth of per lane is limited to 5.4Gbps(HBR2, DisplayPort 1.2 or later). If you want to a higher limit, set this.

...
&mdss0_dp0_out {
...
        link-frequencies = /bits/ 64 <1620000000 2700000000 5400000000 8100000000>;
...
};
...

According to the dcoument of Windows Dev Kit 2023, USB-C ports support 8.1Gbps per lane(HBR3, DisplayPort 1.3 or later).

In my case, the monitor supports DisplayPort 1.1 with 2.7Gbps per lane, data rate is 4.32Gbps(8b10b coding), basically, it means I can only use 1920x1080@60Hz. However, if we tweak the timings(at your risks), we can support a decent resolution with a rich timings, 24bpp with 2048(+180H.Blanking)x1280(+60V.Blanking)@60hz $\approx$ 4.30Gbps. If the bandwidth limit is exceeded, your bpp will be degraded to 18 (or lower?) to make actual bandwidth under the limit.

If you encounter the following, reboot, it is rare, but still possible.

gaokun_ucsi.ucsi gaokun_ec.ucsi.0: error -ETIMEDOUT: PPM init failed
gaokun_ucsi.ucsi gaokun_ec.ucsi.0: con1: failed to register alt modes

If there is no issue now, let's plug in wait for seconds.

Note: if you plug out when there is no other video output device(logical), replug will not work.

Audio

Recently, use the X13s' profile.
sed -i 's/LENOVO.*ThinkPad X13s.*/LENOVO.*ThinkPad X13s.*|HUAWEI.*MateBook E.*\"/' /usr/share/alsa/ucm2/Qualcomm/sc8280xp/sc8280xp.conf

Battery

Charging control

echo '72' /sys/class/power_supply/gaokun-ec-battery/smart_charge_delay

echo '40' /sys/class/power_supply/gaokun-ec-battery/charge_control_start_threshold

echo '70' /sys/class/power_supply/gaokun-ec-battery/charge_control_end_threshold

echo '0/1' /sys/class/power_supply/gaokun-ec-battery/battery_adaptive_charge

That means plugged in after 72 hours, charging level is limited to 70%.

When the laptop is just connected to a power adapter, it starts charging until the battery level reaches 70% if the battery level is lower than 70%, or the battery level does not increase if the battery level is 70% or higher. This is normal.

When the power adapter is always connected, the laptop starts charging if its battery level is lower than 40%, and stops charging when the battery level reaches 70%.

Further explanation, check Huawei support page

The values would not be saved after you shut down and plugged out, you can use udev to set the default values, like

ACTION=="add", SUBSYSTEM=="power_supply", KERNEL=="gaokun-ec-battery", ATTR{smart_charge_delay}="0", ATTRS{charge_control_start_threshold}="45", ATTRS{charge_control_end_threshold}="50", ATTRS{battery_adaptive_charge}="1"

Camera

  • front camera sensor: hi846(cci2, gpio12: cci_i2c_sda, gpio13: cci_i2c_scl, CAMCC_MCLK3_CLK: 24MHz, gpio17, reset: gpio15)
  • rear camera sensor: s5k3l6(cci1, gpio10: cci_i2c_sda, gpio11: cci_i2c_scl, CAMCC_MCLK4_CLK: 24MHz, gpio6, reset: gpio7)

Front sensor can be probed, no camera video.

The rear sensor can't be detected.

Display

Power sequence is not fully taken into account yet, this will increase power consume slightly when suspended. gpio(0,1,8,20,24,52,53,...): gpio0 is backlight enable pin, gpioset -c 4 0=1/0, backlight turn on/off, gpio 52. 53, (vsp/avdd, vsn/avee), more infomation, check here.

Addition: Some patches are first proposed by matalama80td3l at here. I verified and completed them.

Touchscreen

insights

This IC is located at @0x48 @0x49 of i2c4. Their HID interfaces are @0x4f @0x50 respectively. We can confirm @0x48 with 0x4f are for touchscreen. @0x49 with @0x50 may be for stylus.

In DSDT. gpio174 is used to determinate the transfer mode. Low will return SPI device as active, high will return I2C hid device(@0x4f) as active, only if it is high, these i2c hid interfaces will be exposed in i2c4.

In practical, we should set gpio174 before firmware reload(reload will auto trigger internally after TS reset(gpio99), display reset(gpio38) may trigger TS reset internally.) After that, set gpio174 to any state is safe.

When the firmware was reloaded and the TS IRQ(gpio175) is triggered, if we set gpio174 low previously, we can read raw tx-rx data via SPI; if we set gpio174 high previously, we can read HID packets via I2C.

To check:

  • handle HID packets via I2C.
  • read chip id via I2C.
  • [] read raw tx-rx data via I2C.
  • handle raw tx-rx data via SPI.
  • [] read HID packets via SPI.

hid over i2c

Intermittent touch when swiping. non-HLOS use this, such as BIOS configuration.

FN Lock

echo 0/1 > /sys/devices/platform/soc@0/ac0000.geniqup/a9c000.i2c/i2c-15/15-0038/fn_lock
0: disable the fn key(hotkey first, such as press F1 to decrease brightness)
1: enable the fn key(function key first), you can only trigger hotkey with Fn + F1-12
BTW, you can press Fn key(light on) to reverse it temporarily.

Thermal Sensors from EC

I don't know these sensors for which devices, but you can read them
sensors

gaokun_ec_hwmon-i2c-15-38
Adapter: Geni-I2C
temp1:        +47.4°C
...
temp20:       +25.9°C

SLPI

SLPI(Sensor Low Power Island), more details.

Fastrpc reference.

Video acceleration

The firmware can be loaded. It supports v4l2_m2m, never tested it.

Wi-Fi

Use the script,

extract all files from the board file(remote one),

./ath11k-bdencoder -e board-2.bin

edit board-2.json, let us use x13s one calibration data,

...
"board": [
...
            {
                "names": [
                    "bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=0108,qmi-chip-id=2,qmi-board-id=255,variant=HW_GK3"
                ],
                "data": "bus=pci,vendor=17cb,device=1103,subsystem-vendor=17cb,subsystem-device=0108,qmi-chip-id=2,qmi-board-id=140,variant=LE_X13S.bin"
            },
...
]
...

regenerate it,

./ath11k-bdencoder -c board-2.json

About

Device tree and kernel module for display & EC on HUAWEI Matebook E Go

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors