PJungkamp / yoga9-linux

Linux patches, scripts and similar to make the most of my Lenovo Yoga9 14IAP7
MIT License
36 stars 2 forks source link

Same issue with Lenovo Yoga Pro 9 14IRP8 #11

Open qdrop17 opened 1 year ago

qdrop17 commented 1 year ago

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 
PJungkamp commented 1 year ago

I captured the driver initialization sequence from a Windows VM. Then I replayed the initialization using the alsa-utils, bisecting the 2000 "verbs" (commands used in the HDA protocol) until I found the minimum required to get the speakers working. This took me two weeks of messing with qemu from random git repos online, reading the HDA standard to understand what I'm working with and a lot of trial and error. A lot of that was pretty useless in the end as there are a lot of similar cases documented online.

Did you check out this thread on the kernel bugzilla? https://bugzilla.kernel.org/show_bug.cgi?id=208555

There are a lot of great hints buried between all those reports, mine included. (lately a lot about AMD versions of these laptops, just skim through it to find hints on Intel versions)

If you want to start tinkering check this post. https://docs.kernel.org/sound/hd-audio/notes.html

Newer intel platforms use the snd-sof driver instead of the snd-hda-intel one, the sof driver is required for mic support but does not have all the debugging capabilities of the snd-hda-intel one.

Start by reading up on other peoples experiences, then check out documentation on the kernel driver and debugging facilities. Try to use patch files and sysfs attributes to replicate the fixes for other laptops. Pay special attention to the pin configuration and hda-verbs for initialization.

Only then start tinkering with the kernel when you've got some initial success. Search for the patch_realtek.c file in the kernel sources, where all the fixes for realtek codecs reside.

You can contact me by mail to get more details!

glebpinigin commented 11 months ago

Hi!

I have faced the similar problem with Lenovo Yoga Pro 7 14IRH8. It was unable to control speaker volume using ALSA with sof-firmware. Sometimes volume control accidentally appeared after configuring Bluetooth headset but it was very unstable.

The final solution I used is quiet similar to this repo's. Just one line in snd.conf: options snd-sof-intel-hda-common hda_model=alc287-yoga9-bass-spk-pin

I have found the solution here, and mine setup's behavior is the same. However I use newer 6.2 kernel version shipped with arch.

This is not the exact same problem as yours, but it is nearby. Hopefully, my comment will be helpful to someone.

PJungkamp commented 11 months ago

Nice to know that there's a way to apply the hda model parameter to the snd-sof based drivers. I should probably take this up into this repo. The legacy driver non-hda-sof driver was already unable to handle the microphone of my model. I don't know whether the standard snd-hda-intel driver is working at all for newer devices.

@glebpinigin Thank you for sharing!

sherwoodinc commented 11 months ago

Hi! thanks @glebpinigin for the tip! I got my mic and bass speakers working properly now!!

diver864 commented 9 months ago

As another owner of the Lenovo Yoga 9 14IRPB, I want to add _Herzlichen Dank!__ to @PJungkamp and the others who contribute this great work, and test. (My Yoga died yesterday - some kind of no-charge/no-power/no-boot situation. Until that is repaired, I won't be able to test.) It had been running 23.04 quite well, excluding the issues discussed here.

wangwillian0 commented 9 months ago

I got my speakers working at Manjaro, with linux 6.6.

I don't know if both are needed, so it would be useful to know what is exactly needed.

Also, I'm using KDE and the speakers only work if I first switch to "Play HiFi quality Music" profile, and I can only control the volume with the "Pro Audio" profile. Not sure how can I fix it and if this issue happens with Gnome too, so please tell me if you try it.

Finally, I think the repository https://github.com/darinpp/yoga-slim-7 contains useful things that would probably be helpful here (I'm almost sure the binary firmware there is from the same source).

btw, @PJungkamp how are you using the HPD sensor?

PJungkamp commented 9 months ago

The HPD sensor is a very simple HID sensor that I had been able to monitor using the hid-sensor-prox driver but a regression in Linux 6.6 an beyond broke hid-sensor-custom which is needed to find the sensor device... so with current kernels you're out of luck.

My goal was to have the HPD sensor be easily accessible using iio-sensor-proxy, but issues with the hid-sensor-prox code upstream and some internals in iio-sensor-proxy where a breaking change postponed MR had come to bite me.

I currently don't have too much time. Maybe I'll get back to it between semesters.

wangwillian0 commented 8 months ago

So the commits https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?h=sound-6.8-rc7&id=c1947ce61ff4cd4de2fe5f72423abedb6dc83011 and https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?h=sound-6.8-rc7&id=0ac32a396e4f41e88df76ce2282423188a2d2ed0 that are gonna be in 6.8, 6.7.9 and 6.6.21 should fix completely the sound issue with 14IRP8, including the weak sound and lack of volume control.

About the sensor, I think some patch was recently merged and your script find_sensors.fish is showing the sensor information strings again in 6.7.4 and 6.8. I still don't understand how to integrate iio-sensor-proxy, though. I enabled the one with the VL53L1_HOD sensor writing 1 manually to the enable_sensor file and succeeded to read the HPD data using your rust program. Is it the way to enable it or iio-sensor-proxy is supposed to do it? what about the other sensors in the list, like Lenovo ST HPD v201 Sensor and VL53L1?

PJungkamp commented 7 months ago

Well iio-sensor-proxy is something that I haven't worked on in almost 2 years...

It became quite tiresome to integrate the changes there and while all the code there's no ETA for it being upstreamed (and it might have rotted away over the last year or so...).

But I'm still using my fork of iio-sensor-proxy right now and auto-brightness is working well.

https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/364/commits

glebpinigin commented 1 month ago

Apparently after update to 6.8 kernel solution with editing snd.conf stopped working for me. Update to 6.10 didn't fix anything. My laptop version is Yoga Pro 7 14IRH8.

jo-tud commented 1 month ago

I have the Yoga Pro 9 16IMH9, the device in alsa-info is 17aa:3811 and unfortunately the solution described above doesn't work