Open Okazakee opened 1 year ago
So, using this will enable both tweeters and normal woofers w/out tlp just using systemd, confirm?
Same fix as the wiki page, just simpler.
Just a note on the wiki guide. I'm not sure why tlp is necessary same for the wake from suspend script as this can be done with the systemd unit as well and more compatible with some immutable distros (silverblue for example)
Disabling the power management is still required. then just add a single unit file in systemd:
[Unit] Description=yoga7 bass speaker on After=graphical.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target [Service] ExecStart=/bin/bash -c '/usr/sbin/i2cset -y 3 0x48 0x2 0 && /usr/sbin/i2cset -y 3 0x48 0x3 0' [Install] WantedBy=graphical.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
enabling it then it works as expected.
Thank you :) Just changed it in the wiki
What needs to be done upstream for this to be working out of the box?
Hello guys, I am pleased to announce that after the audio fix, all speakers work correctly and I've also found a useful repo with few pulseaudio presets to use with EasyEffects. God bless pipewire.
Using the custom preset gets me a really good audio experience even under linux finally.
Here's what you have to do:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/JackHack96/PulseEffects-Presets/master/install.sh)"
.Make sure to enable easyeffects and profiles on boot Hope this gets injected in the wiki :)
To clarify, I think this issue should be kept open until an official kernel fix or something that avoids the use of the current hack is introduced.
that helps a lot. Thanks !
Hello guys, I am pleased to announce that after the audio fix, all speakers work correctly and I've also found a useful repo with few pulseaudio presets to use with EasyEffects. God bless pipewire.
Using the custom preset gets me a really good audio experience even under linux finally.
Here's what you have to do:
1. Install **Easyeffects** with the store (be sure to update to **ver 6.3.0**, i had some strange behaviour). 2. Install "**Advanced Auto Gain**" profile from this [repo](https://github.com/JackHack96/EasyEffects-Presets) using the command `bash -c "$(curl -fsSL https://raw.githubusercontent.com/JackHack96/PulseEffects-Presets/master/install.sh)"`. 3. Open EasyEffects and load auto gain profile.
Make sure to enable easyeffects and profiles on boot Hope this gets injected in the wiki :)
what setting did you use, I still have to use Analog Stereo Duplex/Output, can't use the Analog Surround 4.0 Output. If I test all speakers it works but the audio playing from a media source doesn't want to play from all speakers if I use Analog Surround 4.0 Output
Weird, I only have a single device showing in gnome, before and after the fix...
Weird, I only have a single device showing in gnome, before and after the fix...
what device is it just Hi-Fi Quality Music? That's what I used to have until I turned off ucm in the wire plumber config for pipewire
Hello peeps! I'm a bit confused. For me max. 2 speakers will work at the same time. Also messing with i2cset changes the output speakers but if the audio stream is interrupted it changes back to the tweeters and I have to run the i2cset command again.
This is why I'm hesitant to label the audio issues as fixed. Am I the only one with those issues and it's just my system that is messed up in some way(then I'll change readme oc) or does anyone else have the same problems?
P.S. I'm on kernel 6.1.6, fedora
Edit: Listening a little closer I'm pretty sure(not certain tho) that not max. 2 speakers work, but that the woofers work with one tweeter(only the right one)(3 total). Which is weird? Also in the settings only a dual stereo speaker setup gets detected (Gnome & KDE) ("Hifi Quality Music") as well.
Hello peeps! I'm a bit confused. For me max. 2 speakers will work at the same time. Also messing with i2cset changes the output speakers but if the audio stream is interrupted it changes back to the tweeters and I have to run the i2cset command again.
This is why I'm hesitant to label the audio issues as fixed. Am I the only one with those issues and it's just my system that is messed up in some way(then I'll change readme oc) or does anyone else have the same problems?
P.S. I'm on kernel 6.1.6, fedora
Edit: Listening a little closer I'm pretty sure(not certain tho) that not max. 2 speakers work, but that the woofers work with one tweeter(only the right one)(3 total). Which is weird? Also in the settings only a dual stereo speaker setup gets detected (Gnome & KDE) ("Hifi Quality Music") as well.
You can fix the reset issue by setting i2cset -y (ADAPTER FOR AMP, usually 3) 0x48 0x30 0x99
I diffed all the registers with what they are set on Windows to find that one.
Note that the i2c adapter id still seem not to be deterministic and can be different when you boot.
It seems to work for me, thank you very much :)
So basically I want to execute
/usr/sbin/i2cset -y 3 0x48 0x2 0 && /usr/sbin/i2cset -y 3 0x48 0x3 0 && /usr/sbin/i2cset -y 3 0x48 0x30 0x99
with the systemd service.. or is there a better solution? Idk a lot about that kinda stuff so i wanna ask before maybe adding it to the wiki..
I suggest to add that workaround in the wiki if someone else can't use the default one
It seems to work for me, thank you very much :) So basically I want to execute
/usr/sbin/i2cset -y 3 0x48 0x2 0 && /usr/sbin/i2cset -y 3 0x48 0x3 0 && /usr/sbin/i2cset -y 3 0x48 0x30 0x99
with the systemd service.. or is there a better solution? Idk a lot about that kinda stuff so i wanna ask before maybe adding it to the wiki..
This also works but only when I'm in Analog stereo duplex but not well when I'm in Analog Surround 4.0
Hi, I just installed Ubuntu 22.04 to my Yoga 7 14ARB7 and want to note that the speakers don't work even after upgrading kernel to 6.1.9. Executing /usr/sbin/i2cset -y 3 0x48 0x2 0 && /usr/sbin/i2cset -y 3 0x48 0x3 0 && /usr/sbin/i2cset -y 3 0x48 0x30 0x99
works like a charm though. Thx!
Will /usr/sbin/i2cset -y 3 0x48 0x2 0 && /usr/sbin/i2cset -y 3 0x48 0x3 0 && /usr/sbin/i2cset -y 3 0x48 0x30 0x99
also work for Lenovo Yoga S940-14IIL with Intel Core™ i7-1065G7 and Fedora Workstation 37 or are different values needed?
I tried running it, but I got Error: Write failed
.
So I tried some more things today. Following https://github.com/agasecond/QemuDumpHDAVerbs got me further than other repositories. Passing in with vfio-pci:
33:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]
Gets both speakers and headphones to show up in Windows 11. Installed drivers makes the HDA verbs show up. Awesome! But, it never made sound. No matter what i pass in, speaker or headset, will make it output audio i can hear. I may upload some HDA verbs from what i have gotten here, but they may be corrupt and not hold any value at all.
Notably, it will start with error about
qemu-system-x86_64: vfio: Cannot reset device 0000:33:00.6, depends on group 16 which is not owned.
qemu-system-x86_64: vfio: Cannot reset device 0000:33:00.6, depends on group 16 which is not owned.
From my understanding, this is due to the device being linked to the VGA device.
33:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt [Radeon 680M] [1002:1681] (rev c1)
I sadly dont think we can pass-trough the whole internal GPU as well.
HDA verbs that may be corrupt: bootup-shutdown.txt messing-with-audio-settings.txt
It's worth noting that the
14IAL7
which is just the Intel version of the14ARB7
already have a quirk for this including HDA verbs, I tried enabling it through kernel parameters without much luck. Since it shares the same chassis, codec and audio specs I would expect it to be the same. One guess is that the issue may have been the DSP w/ AMD Raphael not really being supported with kernel 6.0 which I tested with (Not sure if this could be related, i don't know the linux audio codec stack). Otherwise there could be differences in hardware, but I would find that weird.I checked the subsystem id of the ALC287 codec in the 14ARB7 which has
0x17aa3870
and it is just one value over the 14IAL7 with0x17aa3869
seen in this patch adding the quirk for that model https://www.spinics.net/lists/alsa-devel/msg146221.htmlI don't have a good setup for doing kernel development, but if anyone else wants to continue, this is where i ended my research into it.
Is this still worth trying? I've got a setup working for building custom Debian kernels to patch my SSD issues kernel side, I can give this a try if it's worth it.
@stuarthayhurst You don't know how much I envy you for that patch working lmao
It's worth noting that the
14IAL7
which is just the Intel version of the14ARB7
already have a quirk for this including HDA verbs, I tried enabling it through kernel parameters without much luck. Since it shares the same chassis, codec and audio specs I would expect it to be the same. One guess is that the issue may have been the DSP w/ AMD Raphael not really being supported with kernel 6.0 which I tested with (Not sure if this could be related, i don't know the linux audio codec stack). Otherwise there could be differences in hardware, but I would find that weird. I checked the subsystem id of the ALC287 codec in the 14ARB7 which has0x17aa3870
and it is just one value over the 14IAL7 with0x17aa3869
seen in this patch adding the quirk for that model https://www.spinics.net/lists/alsa-devel/msg146221.html I don't have a good setup for doing kernel development, but if anyone else wants to continue, this is where i ended my research into it.Is this still worth trying? I've got a setup working for building custom Debian kernels to patch my SSD issues kernel side, I can give this a try if it's worth it.
Did not work when I messed with it, and I don't think we can compare the devices directly as they have different drivers for the amp on Windows (14ARB7 compared to 14IAL7).
Personally I just ended up butchering the driver for the amp in the kernel to set the same registers as the Windows driver does and using ACPI instead of a DTB. I did not have patience to deal with Digital Audio Interface linking in the ALSA stack and just set it to always be enabled. If you want to mess with DAI linking it seems like the correct place to link it would be here.
In short a proper upstreamable fix would probably need these following things:
I've never worked with the audio stack, and I've done very little with kernel development, but I know some of the basics at least? I'll see if I can get any of that working when I have some more time.
So i worked a bit on this on the side, applying the i2c
commands and playing with @Myaats own patchset for the kernel.
Audio works correctly, it seems to act like windows with Dolby Atmos turned off. One thing that is interesting of note, is that the audio only comes up to about 30-35%
of what Windows can, and gets completely beaten if Dolby Atmos gets turned on.
This had me a bit stumped until i read this post by Hector Martin, who is currently working on audio support for the Apple M1's. https://social.treehouse.systems/@marcan/109917995005981968
In short, Apple essentially overclocks their speaker system quite heavily with a software controlled gain.
There is currently work for Apple's audio driver to use a tool named speakersafetyd
to do this trick on Linux as well. https://github.com/chadmed/speakersafetyd/ (NOTE: this tool is not applicable to us, so dont try to use it)
While i have not researched this extensively, it would line up with how impossible it has been trying to pass trough the audio chip with QEMU with the traditional patches, and the strange CORB messages that the audio driver constantly seems to give out. All slowly gaining upwards over time, like it is trying to turn something up is my guess now?
Maybe Dolby Atmos is not just an EQ?
@Myaats have you found anything that could indicate power or temperature of the speaker system?
@Myaats have you found anything that could indicate power or temperature of the speaker system?
Only for the subwoofers, but that is all handled by the TAS2563 amp. The datasheet lists speaker thermal, over-excursion and various other protection features.
I don't think comparing to the new Macs makes much sense as Apple likes to move stuff from hardware to software. If I recall correctly even their flash storage is just flash chips without a dedicated storage controller in-between.
I've never worked with the audio stack, and I've done very little with kernel development, but I know some of the basics at least? I'll see if I can get any of that working when I have some more time.
The main issue is not so much how to apply this in the kernel, but rather how strangely the audio acts when put into a virtual machine or pass-trough state. To prove that we have set all the relevant registers we should have a full capture of the driver setting up the chip itself, but nobody that i know of has been able to do that yet.
We do have some steps like 0x48 0x2
to turn on the bass speakers which was found early on through a manual approach. Then we have @Myaats awesome efforts, who found a way to reboot the machine quickly enough to not have the audio chip reset itself after being first booted into linux. Where other options such as 0x48 0x30 0x99
was found to essentially "persist" the audio-configuration when plugging in/out the 3.5mm jack.
There is also the recent revelation above that the driver may be a lot more complex than the typical speaker drivers, using overclocking to achieve the loudness on Windows, which may need some rather advanced technical knowledge or manuals to figure out how to do.
Using i2cset -y 3 0x48 0x2 0 && i2cset -y 3 0x48 0x3 0 && i2cset -y 3 0x48 0x30 0x99
in a systemd module is probably what is the best way forwards for individuals today to have some decent, but safe volume on Linux.
For the up-streaming and further development, i am not sure. This has ended up being much more complex of a driver than i first expected. First step is honestly just figuring out a way to dump or follow the verbs being written, either linux with passthrough or something Windows side (which i do not think exists).
Was PB_CFG1 (i2c 0x03) also 0x00 in windows? How do you dump the i2c in windows?
A firmware can be uploaded to the TAS2563. I think the windows driver just uploads a firmware based on the dolby profile. The "firmware" is a speaker tuning file (https://www.ti.com/lit/an/slaa765/slaa765.pdf). I think we can extract the speaker tuning file(s) from the windows driver and upload it and get the same characteristics.
Was PB_CFG1 (i2c 0x03) also 0x00 in windows? How do you dump the i2c in windows?
I dumped the registers inside Linux after managing to hot-reboot, something that did not reset the amp. Then I diffed with the default registers I got after doing a full shutdown. PB_CFG1 was 0x20 in this dump which is the reset value per the datasheet.
A firmware can be uploaded to the TAS2563. I think the windows driver just uploads a firmware based on the dolby profile. The "firmware" is a speaker tuning file (https://www.ti.com/lit/an/slaa765/slaa765.pdf). I think we can extract the speaker tuning file(s) from the windows driver and upload it and get the same characteristics.
I already tried applying https://lkml.org/lkml/2020/6/9/802 and loading the firmware inside the Windows driver package, but changing to any of the DSP programs or configurations made no noticeable difference in audio for me. You can find a copy of the diff I used here.
I also managed a hot-reboot (disable the i2c device in windows before restart). With the firmware in Linux it sounds like in windows without dolby.
It turned out there is some difference in the left-right amp registers. I've made a script to restore them.
i2cset -y 3 0x4c 0x08 0x5a # TDM_CFG2
i2cset -y 3 0x4d 0x08 0x6a
i2cset -y 3 0x4c 0x0a 0xf3 # TDM_CFG4
i2cset -y 3 0x4d 0x0a 0x93
i2cset -y 3 0x4c 0x0b 0x42 # TDM_CFG5
i2cset -y 3 0x4d 0x0b 0x46
i2cset -y 3 0x4c 0x0c 0x40 # TDM_CFG6
i2cset -y 3 0x4d 0x0c 0x44
i2cset -y 3 0x48 0x30 0x99 # INT & CLK CFG
i2cset -y 3 0x48 0x33 0xd4 # BOOST_CFG1
i2cset -y 3 0x48 0x35 0xa4 # BOOST_CFG3
i2cset -y 3 0x4c 0x36 0x0b # ?
i2cset -y 3 0x4d 0x36 0x0c
i2cset -y 3 0x48 0x38 0x21 # ?
i2cset -y 3 0x48 0x3c 0x58 # ?
i2cset -y 3 0x48 0x40 0xb6 # BST_ILIM_CFG0
i2cset -y 3 0x4c 0x46 0x04 # ASI2_CONFIG3
i2cset -y 3 0x4d 0x46 0x05
i2cset -y 3 0x4c 0x47 0xb1 # ?
i2cset -y 3 0x4d 0x47 0xb0
i2cset -y 3 0x48 0x02 0x00 # PWR_CTL
It doesn't load the firmware so please do not use it too loudly.
I checked that the amp power downs (software) automatically after the music stopped. (it sets the INT_LTCH3[7] (Interrupt due to DEVICE POWER DOWN) to 1)
The DAI link may not be necessary.
I'll try to load the firmware from userspace.
I also managed a hot-reboot (disable the i2c device in windows before restart). With the firmware in Linux it sounds like in windows without dolby.
It turned out there is some difference in the left-right amp registers. I've made a script to restore them.
i2cset -y 3 0x4c 0x08 0x5a # TDM_CFG2 i2cset -y 3 0x4d 0x08 0x6a i2cset -y 3 0x4c 0x0a 0xf3 # TDM_CFG4 i2cset -y 3 0x4d 0x0a 0x93 i2cset -y 3 0x4c 0x0b 0x42 # TDM_CFG5 i2cset -y 3 0x4d 0x0b 0x46 i2cset -y 3 0x4c 0x0c 0x40 # TDM_CFG6 i2cset -y 3 0x4d 0x0c 0x44 i2cset -y 3 0x48 0x30 0x99 # INT & CLK CFG i2cset -y 3 0x48 0x33 0xd4 # BOOST_CFG1 i2cset -y 3 0x48 0x35 0xa4 # BOOST_CFG3 i2cset -y 3 0x4c 0x36 0x0b # ? i2cset -y 3 0x4d 0x36 0x0c i2cset -y 3 0x48 0x38 0x21 # ? i2cset -y 3 0x48 0x3c 0x58 # ? i2cset -y 3 0x48 0x40 0xb6 # BST_ILIM_CFG0 i2cset -y 3 0x4c 0x46 0x04 # ASI2_CONFIG3 i2cset -y 3 0x4d 0x46 0x05 i2cset -y 3 0x4c 0x47 0xb1 # ? i2cset -y 3 0x4d 0x47 0xb0 i2cset -y 3 0x48 0x02 0x00 # PWR_CTL
It doesn't load the firmware so please do not use it too loudly.
I checked that the amp power downs (software) automatically after the music stopped. (it sets the INT_LTCH3[7] (Interrupt due to DEVICE POWER DOWN) to 1)
The DAI link may not be necessary.
I'll try to load the firmware from userspace.
Thanks but it doesn't fix the issue when you switch to Surround Sound 4.0
I also managed a hot-reboot (disable the i2c device in windows before restart). With the firmware in Linux it sounds like in windows without dolby.
It turned out there is some difference in the left-right amp registers. I've made a script to restore them.
i2cset -y 3 0x4c 0x08 0x5a # TDM_CFG2 i2cset -y 3 0x4d 0x08 0x6a i2cset -y 3 0x4c 0x0a 0xf3 # TDM_CFG4 i2cset -y 3 0x4d 0x0a 0x93 i2cset -y 3 0x4c 0x0b 0x42 # TDM_CFG5 i2cset -y 3 0x4d 0x0b 0x46 i2cset -y 3 0x4c 0x0c 0x40 # TDM_CFG6 i2cset -y 3 0x4d 0x0c 0x44 i2cset -y 3 0x48 0x30 0x99 # INT & CLK CFG i2cset -y 3 0x48 0x33 0xd4 # BOOST_CFG1 i2cset -y 3 0x48 0x35 0xa4 # BOOST_CFG3 i2cset -y 3 0x4c 0x36 0x0b # ? i2cset -y 3 0x4d 0x36 0x0c i2cset -y 3 0x48 0x38 0x21 # ? i2cset -y 3 0x48 0x3c 0x58 # ? i2cset -y 3 0x48 0x40 0xb6 # BST_ILIM_CFG0 i2cset -y 3 0x4c 0x46 0x04 # ASI2_CONFIG3 i2cset -y 3 0x4d 0x46 0x05 i2cset -y 3 0x4c 0x47 0xb1 # ? i2cset -y 3 0x4d 0x47 0xb0 i2cset -y 3 0x48 0x02 0x00 # PWR_CTL
It doesn't load the firmware so please do not use it too loudly.
I checked that the amp power downs (software) automatically after the music stopped. (it sets the INT_LTCH3[7] (Interrupt due to DEVICE POWER DOWN) to 1)
The DAI link may not be necessary.
I'll try to load the firmware from userspace.
This works quite well, and doesn't seem to need the power management to be disabled to work either. Easyeffects doesn't seem to significantly improve the sound anymore though.
The work to upstream the firmware loading patches seems to have stalled after the developer working on it left Texas Instruments, so we'd have to prompt them or do it, or try it ourselves :/
This command works well on Ubuntu, but on Manjaro Gnome I get an error: Error: Could not open file /dev/i2c-3 or /dev/i2c/3 : No such file or directory
. This doesn't tell me anything, what can I do to fix this?
This command works well on Ubuntu, but on Manjaro Gnome I get an error:
Error: Could not open file /dev/i2c-3 or /dev/i2c/3 : No such file or directory
. This doesn't tell me anything, what can I do to fix this?
You need to add i2c to your initramfs
I'm not sure if this is the correct way to do it, but I am also using Manjaro and had the same problem with i2c not working. I fixed it by adding i2c-dev
to /etc/modules-load.d/modules.conf
and rebooting.
Hello guys, I am pleased to announce that after the audio fix, all speakers work correctly and I've also found a useful repo with few pulseaudio presets to use with EasyEffects. God bless pipewire.
Using the custom preset gets me a really good audio experience even under linux finally.
Here's what you have to do:
1. Install **Easyeffects** with the store (be sure to update to **ver 6.3.0**, i had some strange behaviour). 2. Install "**Advanced Auto Gain**" profile from this [repo](https://github.com/JackHack96/EasyEffects-Presets) using the command `bash -c "$(curl -fsSL https://raw.githubusercontent.com/JackHack96/PulseEffects-Presets/master/install.sh)"`. 3. Open EasyEffects and load auto gain profile.
Make sure to enable easyeffects and profiles on boot Hope this gets injected in the wiki :)
thanks
I upgraded to Kernel 6.4.0rc2-1 today and out of curiosity I decided to disable the i2c-workaround to see what happens. Even after rebooting, waking from standby, shutting down completely and booting again, the sound seems to be fine. In fact it seems the maximum volume is now quite a bit higher as well.
Can someone confirm this?
It could be related to the merged MIPI SoundWire support for AMD chipsets?
I will still need to try this out myself, but seems promising.
Just tested 6.4.0-rc4
and cannot get it to work. Bass speakers are turned off without any configuration.
EDIT: I might have forgotten to enable AMD Soundwire. :sweat_smile: I need to try again.
@Akinzekeel Can you tell us which flavor of kernel this is? Custom, Debian Sid, Fedora Rawhide, etc?
It's Manjaro. I updated the kernel through the Manjaro-settings kernel menu
Can you run aplay --list-devices
and show the output of sudo lspci -v
?
~ aplay --list-devices
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: Generic [HD-Audio Generic], Gerät 3: HDMI 0 [HDMI 0]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: Generic [HD-Audio Generic], Gerät 7: HDMI 1 [HDMI 1]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: Generic [HD-Audio Generic], Gerät 8: HDMI 2 [HDMI 2]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 1: Generic_1 [HD-Audio Generic], Gerät 0: ALC287 Analog [ALC287 Analog]
Sub-Geräte: 0/1
Sub-Gerät #0: subdevice #0
lspci output is quite long, so I attached it as txt file: lspci.txt
I cant see anything unique in there, can you try the following for me?
sudo systool -vm snd_hda_intel
sudo systool -vm snd_pci_acp6x
lsmod | grep '^snd_'
Yeah your device is not loading in snd_soc_tas2562
compared to mine. Have you set up anything like options snd_hda_intel
before?
You can try a grep "snd_" /etc/modprobe.d/*
but i dont know if it would be exhaustive.
I don't think I set up anything with snd_hda_intel
before. /etc/modprobe.d/
only contains alsa-base.conf
, and that file is empty.
Yeah your device is not loading in
snd_soc_tas2562
compared to mine. Have you set up anything likeoptions snd_hda_intel
before?You can try a
grep "snd_" /etc/modprobe.d/*
but i dont know if it would be exhaustive.
snd_soc_tas2562
only works for you because you copied the patch I wrote to add ACPI support and just hard set the correct registers
I removed it from my configuration, so that patch is no longer present. I did however accidentally leave the module enabled, so it seems to have started loading the incorrect tas driver from linux itself. I will disable it and try again.
FWIW I have two 14ARB7's both running Manjaro (with kernel 6.4rc2-1 as of today) and sound seems to work fine on both of them so far without the i2c workaround. I can of course be mistaken, but I do feel like I would remember applying the ACPI patch on both devices.
I must say its most strange, as it does not work on my end. This will be very verbose, but my last idea would be a sudo modprobe -c
output. Should list every configuration and option currently on the system. If i cant see a difference there, i must say I would be a bit stumped how to proceed further.
any news on 4 functioning speakers? There was a problem with pins connection not recognised by kernel or something like that.