Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B15B1C43331 for ; Sun, 29 Mar 2020 09:00:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 839E420716 for ; Sun, 29 Mar 2020 09:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbgC2JAy (ORCPT ); Sun, 29 Mar 2020 05:00:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:39356 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726957AbgC2JAx (ORCPT ); Sun, 29 Mar 2020 05:00:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8889FAE4E; Sun, 29 Mar 2020 09:00:52 +0000 (UTC) Date: Sun, 29 Mar 2020 11:00:52 +0200 Message-ID: From: Takashi Iwai To: Hui Wang Cc: alsa-devel@alsa-project.org, stable@vger.kernel.org, kailang@realtek.com Subject: Re: [PATCH v2] ALSA: hda/realtek - a fake key event is triggered by running shutup In-Reply-To: <20200329082018.20486-1-hui.wang@canonical.com> References: <20200329082018.20486-1-hui.wang@canonical.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 > Cc: > Signed-off-by: Hui Wang Applied now. Thanks. Takashi