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"
]
}
}
@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