Giter VIP home page Giter VIP logo

yoga9-linux's Introduction

Linux on the Lenovo Yoga9 14IAP7

I've recently bought a Lenovo Yoga9 14IAP7 to run Linux on without knowing what would work. I looked into the various nitpicks that were bugging me. After some messing with the kernel I'm really happy with my device.

Problems OOTB

There were some obvious problems when first installing Linux on this device:

  1. The bass speakers don't work (only sound from the tinny tweeters)
  2. Various function keys don't emit any input event's ('Lenovo Support', 'Lenovo Favorite', 'Virtual Background', 'Sound Profile', 'Darkmode Toggle' and the brightness keys)
  3. Wayland Desktop Environments experience show graphical artifacts on some screen updates.
  4. Hibernating the Laptop breaks the sound after resume.

Solutions

I found solutions for most of them:

  1. The bass speakers fix is mainlined (5.19 I think)
  2. The function keys:
  3. The graphical glitches seem to be related to Intel's PSR (Panel Self Refresh) implementation. So I disabled it for now using /etc/modprobe.d/i915.conf. This may increase the idle power consumption, so I still hope for a more proper solution.

Extra Features

Digging into the ACPI DSDT and Intel ISH custom sensors revealed some more features which are sometimes only available via Lenovo Vantage on Windows.

  • The Laptop has a USB-C quick-charge setting which is controlled by an ACPI function. The Bugzilla has an issue for this.
  • The Laptop has a WMI device which reports the 'usage mode'. The usage mode indicates whether the convertible is used as a Laptop, Tent, Tablet or Drawboard. The 0007-Add-IdeaPad-Usage-Mode-driver.patch can emit a SW_TABLET_MODE switch event to automatically enable the on-screen-keyboard and screen-auto-rotation in some desktop environments (e.g. KDE Plasma & GNOME). This should preferably be fixed in iio-sensor-proxy using the hinge sensor data. There is now an equivalent upstream driver for the tablet mode switch in the linux kernel.
  • There are a lot of special sensors built in next to the camera. These can be used to get the proximity from the screen and ambient light brightness. Lenovo calls this collection of sensors 'Lenovo Intelligent Sensing' and exposes them as 'custom' Intel ISH HID sensors to the system. The ambient light sensor above the keyboard is also responsible fot the automatic keyboard backlight setting. It does not seem to do anything in Windows with regard to automatic screen brightness. I introduced some patches to make the HPD (Human Presence Detection) and ALS work.
  • The ACPI can also control the keyboard backlight setting (Off/Low/High/Auto) but I have not written a patch for that yet. Initial support has been merged into Linux 6.6, Linux 6.7 or 6.8 should contain a working driver for the keyboard backlight control from the operating system.

Bug Reports

I found a lot of useful information and patches in these threads:

  • bass speakers
    Many thanks to all the people sharing their knowledge and readily testing my patch!
  • brightness keys
    Many thanks to both the reporter with god-like ACPI debugging skills and the kernel developer spending his time on fixing the issue!

Other Devices

The AMD models have different audio problems than the intel models, check the Bugzilla issue mentioned above.

If you think that the audio fixup may also work for your device, you can apply the patches yourself and add something like /etc/modprobe.d/snd.conf (without the comments) to the force the fixup on your hardware.

License

This repository contains patches, which are either derivative work targeting a specific already licensed source, i.e. parts of the Linux kernel, or introduce new parts to the Linux kernel. These patches fall thus, if not explicitly stated otherwise, under the license of the source they are targeting, or if they introduce new code, the license they explicitly specify inside of the patch. Please refer to the specific patch and source in question for further information. License texts can be obtained at https://github.com/torvalds/linux/tree/master/LICENSES.

Any other contents of this repository created by me shall be licensed under the MIT license included herein.

yoga9-linux's People

Contributors

pjungkamp avatar

Stargazers

Łaurent ʘ❢Ŧ Ŧough avatar John Carlo Manuel avatar slimxfir avatar Peter avatar Willian Wang avatar guilherme Silva Toledo avatar Dmitry Ben avatar Vladimir avatar Vince avatar skilo avatar  avatar Sander Grandia avatar  avatar Sirio Pablo avatar Radu Potop avatar  avatar  avatar Kerrim Abd El-Hamed avatar Amir B avatar Daniel Phillips avatar Michael Woods avatar Rou avatar Cristian Di Carlo avatar Chen Sun avatar  avatar Brandon Doornbos avatar Saverio Miroddi avatar Sofie avatar Melvin Strobl avatar Leonardo Mascarenhas avatar Barun Acharya avatar  avatar Jiří P. avatar  avatar  avatar  avatar

Watchers

Alex Winkler avatar Gervasio Perez avatar mmjee avatar  avatar Peter avatar  avatar  avatar

yoga9-linux's Issues

Yoga 7 14IAL7

It seems that the sound patch for Yoga 9 works also for Yoga 7 14IAL7, only the device ID needs to be added (0x17aa, 0x3869). I tested it on my Yoga 7 as a DKMS module and it works (Arch Linux 5.19). There was no need to blacklist any modules or pass any module options, only sof-firmware package needed to be installed.

Would you be ok with me publishing the DMKS module on GitHub as an interim solution, until your patches make it to next kernel version? Or alternatively would you be willing to add DKMS packaging to this repo (anything to avoid recompiling the kernel on every update :) )?

Thank you very much for providing these patches.

Patch not working on Lenovo Yoga 7 Gen 7 AMD (14ARB7)

I'm opening this issue just for reference (in case somebody with the same device is looking for a solution).

I've tried to force the bass speaker fix on my device (Yoga 7 Gen 7 AMD (14ARB7)), but it didn't yield any effect:

# rebooted after this change
#
sudo tee /etc/modprobe.d/snd.conf <<CONF
options snd_intel_dspcfg dsp_driver=1
options snd_hda_intel model=alc287-yoga9-bass-spk-pin
CONF

This has been tested on a v6.0-rc7 kernel, without any patch (actually, I've applied the mic fix, which I think should not be in conflict), since I've seen that the patches in this repository have been upstreamed.

Cannot control speaker volume on Yoga Pro 7 14AHP9 (AMD, Realtek ALC287)

Hi,
I just bought a Yoga Pro 7 14AHP9 which has a Realtek ALC287 controller. Everything works just fine sound-wise (maybe thanks to your work?) except for one small detail: the speaker volume control has no effect, the effective volume remains at 100% regardless of the set value EDIT: the volume goes from 0 to 100% in the first few pixels of the slider.
Headphone volume control works fine.

I tried setting the volume via pipewire (-pulse) and directly in alsamixer. The PCM volume slider does control the volume, but not the Speaker slider.

By any chance do you have any insight on this small issue?

alsa-info.txt

Problem when applying patch with Yoga7

Thank you for starting this fix/doc

I would like to know if I need to install a specific package before applying this patch?
Could you please help me?
I'm trying to apply the 0007-ALSA-hda-realtek-Add-quirk-for-Yoga-devices.patch I have the following message:

can't find file to patch at input line 18
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 85136309b3efe5a54167cdfbb9f1a3abab116929 Mon Sep 17 00:00:00 2001
|From: Philipp Jungkamp <[email protected]>
|Date: Sat, 30 Jul 2022 21:33:16 +0200
|Subject: [PATCH 7/9] ALSA: hda/realtek: Add quirk for Yoga devices
|
|The Lenovo Yoga 7 16IAP7 uses the same ALC287 codec setup as the
|Lenovo Yoga 9 14IAP7.
|
|Signed-off-by: Philipp Jungkamp <[email protected]>
|---
| sound/pci/hda/patch_realtek.c | 1 +
| 1 file changed, 1 insertion(+)
|
|diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
|index 6c4e9994d99c..94768ce71ece 100644
|--- a/sound/pci/hda/patch_realtek.c
|+++ b/sound/pci/hda/patch_realtek.c
--------------------------

OS: EndeavourOS Linux x86_64
Host: 82QE Yoga 7 14IAL7
Kernel: 5.19.6-arch1-1

Thanks again! :)

Keyboard backlight patch

Posting here for broader visibility. I've got a patch written with @PJungkamp's help to get the keyboard backlight patch working. I've tested it on my 14ARB7, but that behaves slightly differently.

What I'm looking is for anyone with a modern Yoga laptop, where the keyboard has off / low / high / auto modes, to test my kernel patch on their system. /sys/class/leds/platform::kbd_backlight/brightness should report the current brightness (0->2), and writing 0->2 to it should set the brightness accordingly.

Patch: v5-0001-platform-x86-ideapad-laptop-Add-support-for-keyboard.patch.txt

If someone can verify it works for keyboard backlights with an auto mode, I'll send it upstream, hopefully in time for Linux 6.6.

Thanks!

Yoga 9i (2024) 14IMH9 bass speakers not working

Just received a new 2024 Yoga 9i 14IMH9, and everything is working on Linux except the bass speakers. Applying the kernel parameter options snd-sof-intel-hda-common hda_model=alc287-yoga9-bass-spk-pin did not resolve the issue.

Upon further investigation, it looks like this new model uses a Cirrus CSC3551 amplifier, which seems to require some patching for it to work on Linux.

Ideapad usage mode patch did not work on Yoga 7 14ACN6

I took the https://github.com/PJungkamp/yoga9-linux/blob/main/kernel-patches/0005-Add-IdeaPad-Usage-Mode-driver.patch and made it a dkms module and installed it, after that I could see the usage mode device in evtest but it did not emit any events on switching device modes and hence gnome also did not detect when switching to tablet mode.
I had submitted the module to arch aur at https://aur.archlinux.org/packages/ideapad-wmi-usage-mode-dkms-git, just an fyi.

Same issue with Lenovo Yoga Pro 9 14IRP8

Hi.

I really appreciate your work. I have the same issue with the speakers on the 2023 model of the Pro 9. I already tried to fix it by applying https://github.com/PJungkamp/yoga9-linux/blob/main/config/etc/modprobe.d/snd.conf. But apparently, the speakers are wired a bit differently.

What steps do you recommend to get this working? I'm asking because you already fixed it before the fix was applied to the mainline.

[qdrop@qdrop-fedora-pro9i ~]$ neofetch
             .',;::::;,'.                qdrop@qdrop-fedora-pro9i 
         .';:cccccccccccc:;,.            ------------------------ 
      .;cccccccccccccccccccccc;.         OS: Fedora Linux 38 (Workstation Edition) x86_64 
    .:cccccccccccccccccccccccccc:.       Host: 83BU Yoga Pro 9 14IRP8 
  .;ccccccccccccc;.:dddl:.;ccccccc;.     Kernel: 6.2.14-300.fc38.x86_64 
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.    Uptime: 26 mins 
.:ccccccccccccc;KMMc;cc;xMMc:ccccccc:.   Packages: 2129 (rpm), 32 (flatpak) 
,cccccccccccccc;MMM.;cc;;WW::cccccccc,   Shell: bash 5.2.15 
:cccccccccccccc;MMM.;cccccccccccccccc:   Resolution: 3440x1440 
:ccccccc;oxOOOo;MMM0OOk.;cccccccccccc:   DE: GNOME 44.1 
cccccc:0MMKxdd:;MMMkddc.;cccccccccccc;   WM: Mutter 
ccccc:XM0';cccc;MMM.;cccccccccccccccc'   WM Theme: Adwaita 
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;    Theme: Adwaita [GTK2/3] 
ccccc;0MNc.ccc.xMMd:ccccccccccccccc;     Icons: Adwaita [GTK2/3] 
cccccc;dNMWXXXWM0::cccccccccccccc:,      Terminal: gnome-terminal 
cccccccc;.:odl:.;cccccccccccccc:,.       CPU: 13th Gen Intel i9-13905H (20) @ 5.200GHz 
:cccccccccccccccccccccccccccc:'.         GPU: NVIDIA GeForce RTX 4060 Max-Q / Mobile 
.:cccccccccccccccccccccc:;,..            GPU: Intel Raptor Lake-P [Iris Xe Graphics] 
  '::cccccccccccccc::;,.                 Memory: 5412MiB / 31818MiB 

WMI driver emits KEY_UNKNOWN

Thanks for these patches.
The WMI driver emits KEY_UNKNOWN if you press the fn+esc the second time.
The

+	{ KE_IGNORE,	0x03 },

fixes that.

All 7 patches work great!

New custom compilation of linux-xanmod-edge with all 7 patches work on 16IAP7
I updated my github for that, later i will update mainline kernel too
I hope all them will become modules very soon in coming kernel release
Thank you!

Little guide for the pathing process

Hello Philipp,
Thank you very much for putting together the necessary fixes in patches!
I've just received my Yoga and I'm trying to fix all problems.
I don't have enough experience in linux to be sure that I doing that correctly, so can you update your readme and write some useful information about how to patch linux kernel in our case ?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.