On Sun, 29 Mar 2020 10:20:18 +0200, Hui Wang wrote: > > 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@xxxxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> > Signed-off-by: Hui Wang <hui.wang@xxxxxxxxxxxxx> Applied now. Thanks. Takashi