Skip to content

Instantly share code, notes, and snippets.

@BXZ
Last active August 17, 2023 11:53
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BXZ/48cd8173807676a1402cf4bc7928c0c0 to your computer and use it in GitHub Desktop.
Save BXZ/48cd8173807676a1402cf4bc7928c0c0 to your computer and use it in GitHub Desktop.
Configuring and unmuting subwoofer/LFE on Lenovo Ideapad Y700

Good news, everyone! There exists a predefined quirk in the linux kernel that we can as of version 5.15 apply to our laptops that will automatically manage the muting and unmuting of the LFE properly. For older kernel versions you'll have to use the old solution below (or patch and build the kernel driver yourself). We just have to create/edit the following files:

/lib/firmware/hda-jack-retask.fw
/etc/modprobe.d/hda-jack-retask.conf

first off the hda-jack-retask.fw file should contain the following:

[codec]
0x10ec0235 0x17aa3826 0

[model]
103c:86c7

[pincfg]
0x17 0x90170111

There's a chance your subsystem id is different, the id can be found using cat /sys/class/sound/hwC0D0/subsystem_id Now we simply have to apply this patch by putting the following in hda-jack-retask.conf :

options snd-hda-intel patch=hda-jack-retask.fw

DONE! That's it. 2.1 output and no more popping like in the old solution even with power save enabled. Details on the patch format can be found here https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html If you're curious what quirk is applied search for ALC274_FIXUP_HP_ENVY_GPIO in sound/pci/hda/patch_realtek.c in the kernel source code.

You might still want to look into any upmixning in PulseAudio/PipeWire or what have you. Using a Stereo profile and EasyEffects as mentioned at the bottom of the old solution is still the simplest solution I've found so far. Check out the comments for EasyEffects configs from other users.

---OLD SOLUTION---

A little while ago I finally figured out how to get the LFE working on my y700 laptop. If you've already messed with hdajackretask you just have to slightly modify the following two files:

/lib/firmware/hda-jack-retask.fw
/etc/modprobe.d/hda-jack-retask.conf

first off the hda-jack-retask.fw file should look something like this:

[codec]
0x10ec0235 0x17aa3826 0

[pincfg]
0x17 0x90170111

[verb]
0x01 0x0716 0x04
0x01 0x0717 0x04
0x01 0x0715 0x04

the pincfg section assigns LFE to node 0x17. The verb section enables GPIO pin 2 on the Realtek chip and disables the external mute circuit.

This is enought to get the LFE working BUT because the external mute circuit is permanently off every time the driver module enters and exits power saving mode there will be a loud pop, this needs to be fixed in the actual driver module but we can circumvent it for now by disabling power saving in the hda-jack-retask.conf file like so:

options snd-hda-intel power_save=0 power_save_controller=N patch=hda-jack-retask.fw

Note that there will still be a pop at boot/shutdown and suspend/resume. That is all I had to do to get everything working, any and all feedback is appreciated.

I'll add my PulseEffects EasyEffects profile below, it improves the sound quality a bit, it's not as good as on windows but it's something. Just make sure the profile selected for the sound card in PulseAudio is a "Stereo" profile and not a "2.1" one.

{
"output": {
"autogain": {
"target": -21.0
},
"bass_enhancer": {
"amount": 16.0,
"blend": 0.0,
"floor": 100.0,
"floor-active": true,
"harmonics": 10.0,
"input-gain": 0.0,
"output-gain": 0.0,
"scope": 200.0
},
"blocklist": [
"pulseeffects_sink"
],
"limiter": {
"asc": true,
"asc-level": 0.5,
"auto-level": true,
"input-gain": 0.0,
"limit": 0.0,
"lookahead": 2.0,
"output-gain": 0.0,
"oversampling": 4,
"release": 8.0
},
"plugins_order": [
"autogain",
"bass_enhancer",
"limiter"
]
}
}
@zb2oby
Copy link

zb2oby commented Jan 29, 2021

It works like a charm ! on my side there were a lot of "pincfg" entry. after some tests if i remove these lines and just add the 0x17 the sound is so weird. So, i've only updated the existing 0x17 0x90170150 line to 0x17 0x90170151 and added the "verb" section and it works perfectly.
Thanks for the trick !

@BXZ
Copy link
Author

BXZ commented Jan 29, 2021

It works like a charm ! on my side there were a lot of "pincfg" entry. after some tests if i remove these lines and just add the 0x17 the sound is so weird. So, i've only updated the existing 0x17 0x90170150 line to 0x17 0x90170151 and added the "verb" section and it works perfectly.
Thanks for the trick !

Happy to help. What other pincfg entries do you have? I'd love to test if they make my sound better too and if so I'll add them to the gist.

@zb2oby
Copy link

zb2oby commented Jan 29, 2021

here my entire hda-jack-retask.fw :

[codec]
0x10ec0235 0x17aa3829 0

[pincfg]
0x12 0x90a60140
0x14 0x90170110
0x17 0x90170151
0x18 0x411111f0
0x19 0x04a11030
0x1a 0x411111f0
0x1b 0x90170150
0x1d 0x40f79a2d
0x1e 0x411111f0
0x21 0x04211020

[model]
auto

[verb]
0x01 0x716 0x04
0x01 0x717 0x04
0x01 0x715 0x04

@RomioDiver
Copy link

Man, it works! I have been using this laptop with arch linux for 4 years. I didn't even hope that someday I would hear how the subwoofer worked. Thank you very much!

@BXZ
Copy link
Author

BXZ commented Jan 29, 2021

I've done some testing now and I couldn't tell the difference, I checked with hda-verb and these pincfg's excluding 0x17 of course seem to be the default ones, at least on my machine. I did notice that I placed LFE in channel group 5 instead of 1 as used by the front speakers, I don't think this makes any difference but I'll update the gist just for consistency.

@ausiasbcn
Copy link

ausiasbcn commented Feb 16, 2021

First of all I would like to thank you for your help, finally the sub-woofer is working.
In my case I have some problems and I would like to share them with you. Unfortunately the audio is "popping" on startup, I've tried everything but I still have the problem and the audio quality is a little bit poor compared with windows , It looks like the speaker loose the bass effect when the sub-woofer is working, how can I improve the audio quality? I've tried with pulseeffect with no success. Can you give me some advice? Thank you.

Lenovo IdeaPad Y700 15ISK System Info

Operating System: Linux Mint 20.1
Kernel: Linux 5.4.0-65-generic
Architecture: x86-64

Alsa version
Advanced Linux Sound Architecture Driver Version k5.4.0-65-generic.

Pulseaudio version
pulseaudio 13.99.1

Content of /etc/modprobe.d/hda-jack-retask.conf:
options snd-hda-intel power_save=0 power_save_controller=N patch=hda-jack-retask.fw

Content of /lib/firmware/hda-jack-retask.fw:

[codec]
0x10ec0235 0x17aa3826 0

[pincfg]
0x17 0x90170111

[verb]
0x01 0x0716 0x04
0x01 0x0717 0x04
0x01 0x0715 0x04

I have tried the following setting too

Configuration of hda-jack-retask.fw just with 0x17 0x90170151:

code [codec]
0x10ec0235 0x17aa3826 0

[pincfg]
0x17 0x90170151

[verb]
0x01 0x0716 0x04
0x01 0x0717 0x04
0x01 0x0715 0x04

Configuration of hda-jack-retask.fw with 0x17 0x90170151

[codec]
0x10ec0235 0x17aa3829 0

[pincfg]
0x12 0x90a60140
0x14 0x90170110
0x17 0x90170151
0x18 0x411111f0
0x19 0x04a11030
0x1a 0x411111f0
0x1b 0x90170150
0x1d 0x40f79a2d
0x1e 0x411111f0
0x21 0x04211020


[verb]
0x01 0x716 0x04
0x01 0x717 0x04
0x01 0x715 0x04

Configuration of hda-jack-retask.fw with 0x17 0x90170111

[codec]
0x10ec0235 0x17aa3829 0

[pincfg]
0x12 0x90a60140
0x14 0x90170110
0x17 0x90170111
0x18 0x411111f0
0x19 0x04a11030
0x1a 0x411111f0
0x1b 0x90170150
0x1d 0x40f79a2d
0x1e 0x411111f0
0x21 0x04211020


[verb]
0x01 0x716 0x04
0x01 0x717 0x04
0x01 0x715 0x04

@BXZ
Copy link
Author

BXZ commented Feb 16, 2021

You're welcome @ausiasbcn, and I'll try my best to help you.
First off, there will always be a pop at the boot and shutdown, that's only fixable in kernel code, if it's popping at the start and end of any sound being played then the power save settings didn't take for some reason. Make sure hda-jack-retask.conf is the only file in /etc/modprobe.d/ that contains the line options snd-hda-intel...
If everything seems fine there then the only other thing I can think of is if there's anything in the kernel parameters so could you post the output of cat /proc/cmdline? I also don't know if PulseAudio does anything to the power save settings because I'm on PipeWire myself.
As for the audio quality I'm using PulseEffects and I'll add my current preset to the gist, just make sure that the Analog Stereo Duplex sound card profile is selected in PulseAudio and not a Analog Surround 2.1 Output profile (or any other for that matter). The sound won't be as good as on windows but it should be a clear improvement.

@ausiasbcn
Copy link

The audio is popping on startup or when the pc comes back from suspension.
I'm actually using Analog Stereo Duplex

  • Checking if hda-jack-retask.conf is the only file in /etc/modprobe.d/ that contains the line options snd-hda-intel...
    results for grep -rnw '/etc/modprobe.d/' -e 'options snd-hda-intel':
    /etc/modprobe.d/hda-jack-retask.conf:1:options snd-hda-intel power_save=0 power_save_controller=N patch=hda-jack-retask.fw

  • results for cat /proc/cmdline:
    BOOT_IMAGE=/boot/vmlinuz-5.4.0-65-generic root=UUID=a460ec73-2b03-4466-860f-8279cd34fcb2 ro quiet splash

@BXZ
Copy link
Author

BXZ commented Feb 16, 2021

Ah yes, it pops on suspend and resume too, forgot about that. That has to be fixed in the kernel code but hopefully a developer that know how to do that sees this and implements it, for now this is the best we got.

@ausiasbcn
Copy link

Understood, thank you again.

@hossamdash
Copy link

hossamdash commented Feb 21, 2021

Thank you a lot!! works on my baby y70015isk quite well.
A couple of things i wanted to say that might be interesting, in regards to you setting the sound to stereo and not 2.1, even in windows 10 where there is an official driver for the sound card, it's still recognized as a stereo speaker and not a 2.1 - although there is a different slider for the bass inside the sound settings -. and the second thing is about the popping sound, when i first got this laptop it had the same issue of popping sound in windows 10, and not only did it pop on boot, it also popped when ever a sound output got activated, it later got fixed by a driver update.
hoping you would look into optimizing the pulseeffects preset file more now that the subwoofer is working as all previous files that people put up for this laptop were calibrated without it.

@hossamdash
Copy link

hossamdash commented Feb 21, 2021

you should consider submitting this here in the arch wiki
https://wiki.archlinux.org/index.php/Laptop/Lenovo#Lenovo_IdeaPad_Y700

@perceval22
Copy link

Thank you very much, it's finally working. Without you I would never have found the solution. Thank you very much!

@BXZ
Copy link
Author

BXZ commented Mar 22, 2021

you should consider submitting this here in the arch wiki
https://wiki.archlinux.org/index.php/Laptop/Lenovo#Lenovo_IdeaPad_Y700

Sorry for not replying sooner. I've been busy with work and will be for quite some time so anyone's free to post this wherever they want so more people will see it, no need to even link back but would be appreciated. It's not like I have a monopoly on the solution ^^"

@BXZ
Copy link
Author

BXZ commented Mar 22, 2021

Thank you very much, it's finally working. Without you I would never have found the solution. Thank you very much!

You're welcome, I was actually close to this solution a few years ago, if only I had realized I could control the GPIO this way, I felt quite stupid when I finally realized. ^^

@OpneMind
Copy link

OpneMind commented Jun 5, 2022

Hello
Easy activiting Analog Surround 2.1 Output profile:

1- Run
cp /etc/pulse/daemon.conf ~ / .config / pulse / daemon.conf

2- Edit ~ / .config / pulse / daemon.conf

; remixing-produce-lfe = no
; remixing-consume-lfe = no

to

** remixing-produce-lfe = yes
remixing-consume-lfe = yes **

3- Run
pulseaudio -k

In normal mode audio play by subwoofer and speakers without splitting. if you want split audio frequency for speaker and subwoofer, you can split frequency by lfe-crossover-freq:
remixing-produce-lfe = yes
remixing-consume-lfe = yes
** lfe-crossover-freq = 200 ** -> subwoofer freq filter

This sent freq below 200hz to subwoofer and above 200hz to normal speaker.

@BXZ Thank you very much

@mohamad228
Copy link

hi i have a problem
my woofer make a clicking sound while my laptop booting or first i played music
how to fix that

@BXZ
Copy link
Author

BXZ commented Jun 5, 2022

hi i have a problem my woofer make a clicking sound while my laptop booting or first i played music how to fix that

This is related to the sound card going into power save mode with the external amp enabled, adding power_save=0 power_save_controller=N as mentioned in the gist should fix the problem for when playing music.
This will not fix the clicking when booting though.

@BXZ
Copy link
Author

BXZ commented Jun 5, 2022

@OpneMind
Very interesting, I'm using Pipewire but they should have something similar.

@krasmazov483
Copy link

krasmazov483 commented Aug 19, 2022

Thanks for detailing what worked for you @BXZ!! Unfortunately none of the methods you listed is working for me on my Y700 with Nobara 36 (Fedora). Maybe something to do with newer kernels since I'm currently on 5.18.

I also tried setting up LFE on Pipewire, but it also doesn't work. On KDE's audio settings it only lists 2 speakers independently of what I set with either the Pipewire config, your instructions or both. And testing with any music even putting my ear on the subwoofer I can't hear anything from there.

If anyone can help I would be really grateful.

EDIT: GOT IT WORKING

The problem is that the firmware configuration at the top of this Gist doesn't work anymore for my laptop for some reason, be it a region difference or model revision. With the help of a user on the GlouriousEggroll's ProtonGE/Nobara Discord I tried to make it work with hdajackretask alone by enabling either the 0x17 or the 0x1b pins, which unfortunately didn't work, but led me to find a solution:

Comparing the firmware on the top of this Gist with the one generated by hdajackretask I noticed a few numbers were different, so I pasted the contents from here but using the numbers generated by the program, and voilà, it works perfectly now.

The result is this hda-jack-retask.fw file:

[codec]
0x10ec0235 0x17aa3827 0

[model]
103c:86c7

[pincfg]
0x17 0x90170111

NOTE: I originally had 0x17 0x90170151 instead of 0x17 0x90170111 under [pincfg] but since I couldn't hear any difference I decided to go with OP's value.

EDIT2: EASYEFFECTS CONFIGURATION

At first I manually added the effects that appear in OP's config with the same values, but ended up tweaking it a bit. If you're interested in what I did, here it is:

In Output > Effects:

  1. Add AutoGain:
    • OP's Target: -21,0 dB
    • My Target: -15,0 dB
  2. Add Bass Enhancer:
    • OP's Amount: 16,0 dB | Harmonics: 10,0 | Scope: 200Hz | Floor: 100Hz
    • My Amount: 4,0 dB | Harmonics: 10,0 | Scope: 200Hz | Floor: 100Hz
  3. Add Limiter (this effect changed since the config has been posted, the settings below are as close as I could get):
    • NOTE: I have since posting this decided to remove the Limiter from my config since I couldn't hear any difference with or without it, but I'm still leaving it here in case anyone wants to use it.
    • OP's SC PreAmp: 0,5 dB | Lookahead: 2,00 ms | Release: 8,00 ms | Limit: 0,00 dB | Auto Leveling: ON
    • My SC PreAmp: 0,5 dB | Lookahead: 2,00 ms | Release: 8,00 ms | Limit: 0,00 dB | Auto Leveling: OFF

Basically all I did was reduce the Bass Enhancer from 16 dB to 9 dB as I think OP's value gave the speakers excessive bass, muffling the mids and the treble too much, and I also reduced the negative gain so the volume is not as low. If you notice distortion or crackling it's probably best to lower the Auto Gain even more (as in decreasing from -13 to -14 for example), but so far I haven't noticed any, even at 100% volume.

Also, the BIGGEST CHANGE I did was to turn Auto Leveling OFF, as when it is on, it will make adjustments on the fly when any sound is playing and will just make everything sound horrible, increasing and decreasing frequencies all the time.

Tip: Don't forget to enable Easyeffects to run in the background on startup by enabling it on the program's settings. Also save the effects to a Preset on the top left corner and enable Preset Autoloading of the one you created on the PipeWire Tab, this way every time you restart your laptop it always loads the EQ for the Speakers.

@BXZ
Copy link
Author

BXZ commented Aug 22, 2022

@Khrona98 Glad you got it working. I don't remember how I got the [codec] ids originally but turns out they should match the output of cat /sys/class/sound/hwC0D0/{vendor_id,subsystem_id} (not sure if it's always hwC0D0). Given that you have a different subsystem id Lenovo must've made a hardware/firmware revision at some point or maybe it's a region thing, who know. as for the [pincfg] the only difference is channel group 5 vs 1, no clue how or even if that affects anything but I doubt it. I'll try out your easyeffects config and I'll add something to the gist to help avoid this problem in the future.

@krasmazov483
Copy link

Given that you have a different subsystem id Lenovo must've made a hardware/firmware revision at some point or maybe it's a region thing, who know.

It's possible it is a regional thing. I got my Y700 on Portugal when I was in a trip with my family, so maybe there's a difference between american and european versions or a hardware revision like you said.

as for the [pincfg] the only difference is channel group 5 vs 1, no clue how or even if that affects anything but I doubt it. I'll try out your easyeffects config and I'll add something to the gist to help avoid this problem in the future.

I'll test to see if it makes any difference and report back here. Also, please tell me what you think of my tweaked EQ config, would love to hear if it makes any improvement or not 😄

@krasmazov483
Copy link

krasmazov483 commented Aug 25, 2022

So, I tested the channel group on [pincfg] and both 0x17 0x90170111 and 0x17 0x90170151 work. I couldn't hear a difference between them but I decided to go with your config for this one @BXZ.

I also tweaked my EasyEffects config some more:

  • I don't really know much about audio so I don't know what exactly the Limiter is supposed to do, but since I couldn't hear any difference with or without it in multiples songs I decided to remove it;
  • I also changed the AutoGain value again, this time from -12,0 dB to -15,0 dB as the volume was a bit too loud for my taste and I encountered a few issues with the sound just "exploding";
  • And I also reduced the Bass Enhancer from 12,0 dB to 4,0 dB as there was still to much bass for my liking.

I believe I have finally found the settings I like the most with EasyEffects. I'll update my original comment to reflect these changes.

EDIT (24/09/22): I decided to not use Easyeffects for the speakers, after some more testing not matter what I did it would end up muddying the other frequencies too much for me. Using the Convolver effect to target specific bass frequencies would probably yield better results than the Bass Enhancer effect does, but I'm not knowledgeable enough about audio to do it right now. I'll update it here if I end up messing with it.

@krasmazov483
Copy link

krasmazov483 commented Jan 4, 2023

Last update hopefully: using the default settings after enabling the subwoofer was bugging me a lot, it turns out it is because both left and right sounds were coming from the subwoofer alongside the main speakers. Changing the sound profile to 2.1 analog stereo in the Audio Settings of KDE made it so only the low frequencies go through the subwoofer.

You can test everything is working in 2 ways, first is through the "Test" button on KDE's Audio Settings page where you can click on subwoofer and it will play audio correctly, and secondly by playing music and verifying that the subwoofer is being used (both by getting it close to your ear and by touching it since you can feel the vibrations).

Furthermore, I changed the low frequencies cutout in PipeWire so it grabs a little more frequencies than the default configuration:

$HOME/.config/pipewire/pipewire-pulse.conf.d/10-lfe-pulse.conf

 stream.properties = {
    channelmix.lfe-cutoff = 210
}

$HOME/.config/pipewire/client.conf.d/10-lfe-pulse.conf (symlink of the previous file, so same contents, don't know if is really needed tho)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment