]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ALSA: hda/realtek - a fake key event is triggered by running shutup
authorHui Wang <hui.wang@canonical.com>
Sun, 29 Mar 2020 08:20:18 +0000 (16:20 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sun, 29 Mar 2020 08:41:22 +0000 (10:41 +0200)
commit476c02e0b4fd9071d158f6a1a1dfea1d36ee0ffd
tree318de011e95075573427e00bc0d8ddf9dbc4ffc4
parentf5a88b0accc24c4a9021247d7a3124f90aa4c586
ALSA: hda/realtek - a fake key event is triggered by running shutup

On the Lenovo X1C7 machines, after we plug the headset, the rt_resume()
and rt_suspend() of the codec driver will be called periodically, the
driver can't stay in the rt_suspend state even users doen't use the
sound card.

Through debugging, I found  when running rt_suspend(), it will call
alc225_shutup(), in this function, it will change 3k pull down control
by alc_update_coef_idx(codec, 0x4a, 0, 3 << 10), this will trigger a
fake key event and that event will resume the codec, when codec
suspend agin, it will trigger the fake key event one more time, this
process will repeat.

If disable the key event before changing the pull down control, it
will not trigger fake key event. It also needs to restore the pull
down control and re-enable the key event, otherwise the system can't
get key event when codec is in rt_suspend state.

Also move some functions ahead of alc225_shutup(), this can save the
function declaration.

Fixes: 76f7dec08fd6 (ALSA: hda/realtek - Add Headset Button supported for ThinkPad X1)
Cc: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20200329082018.20486-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_realtek.c