Lenovo Legion/Yoga Slim 7 speaker output
Cameron Berkenpas
cam at neo-zeon.de
Tue Jun 22 21:17:31 CEST 2021
Hello,
I'm working on a patch to get audio output working on the speakers of
the Lenovo Legion/Yoga Slim 7 laptops:
https://bugzilla.kernel.org/attachment.cgi?id=297559&action=diff
Please let me know if this isn't the right place for these types of
questions.
Both of these laptops have ALC287's that both seem to need some codec
initialization to get the speakers working. For both laptops, the specs
report ALC3306, but Linux on both systems reports that it's an ALC287,
and looking at the PCI ID's on Windows agrees that it's an ALC287.
This is my first time working on such a patch, and I'm having a
headphone related problem:
1. When plugging headphones into the audio jack, I get sound on the
headphones as expected. I see that the speakers are muted and the
headphones are unmuted as expected in alsamixer.
2. When I unplug the headphones, I can no longer get speaker output.
Monitoring alsamixer, I observe that unplugging the headphones results
in the speakers being unmuted and the headphones are muted as expected.
However, I am unable to get speaker output in this case.
3. If I plug in the headphones, don't play any sound, and then unplug
the headphones, I see the same behavior in alsamixer, BUT speaker output
still works.
4. If I apply the initialization verbs via hda-verb (the same verbs that
I'm using in my patch), speaker output works again.
5. If speaker output is no longer working (due to #2), putting the
laptop to sleep and resuming fixes the speakers. The code in the kernel
seems to call the sound card's init again so this makes sense.
In short, it seems I need to re-initialize the speakers when the
headphones are unplugged. Studying sound/pci/hda/patch_realtek.c,
there's alc_headset_mode_unplugged(), but as there's currently no case
for 0x10ec0287 at all. I'm not sure adding in a case that re-initializes
makes sense if the vast majority of ALC287's don't need to when
headphones are unplugged. It seems none of the other cards, at least as
far as I can tell, do a re-init when headphones are unplugged either.
They just seem to setup some pins and coefficients for the most part if
anything at all.
How can I re-init the speakers when headphones are unplugged
specifically for these specific models? The initial-initialization is
only done for these laptops, I'm just unclear what, if any, mechanism
there is for initialization on headphone unplugs?
Thanks!
-Cameron
More information about the Alsa-devel
mailing list