From patchwork Tue May 31 05:45:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiChieh Chuang X-Patchwork-Id: 9143285 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 901EE60761 for ; Tue, 31 May 2016 05:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 787892810E for ; Tue, 31 May 2016 05:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CDE427DA9; Tue, 31 May 2016 05:45:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DE3627DA9 for ; Tue, 31 May 2016 05:45:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 43EF2265684; Tue, 31 May 2016 07:45:56 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 506D02654D0; Tue, 31 May 2016 07:45:49 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8855D2654D8; Tue, 31 May 2016 07:45:47 +0200 (CEST) Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by alsa0.perex.cz (Postfix) with ESMTP id B2F882651D5 for ; Tue, 31 May 2016 07:45:39 +0200 (CEST) Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1019085419; Tue, 31 May 2016 13:45:33 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Tue, 31 May 2016 13:45:32 +0800 Message-ID: <1464673532.31906.2.camel@mtkswgap22> From: Kai Chieh Chuang To: Date: Tue, 31 May 2016 13:45:32 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: broonie@kernel.org Subject: [alsa-devel] DPCM: skip DAPM_STREAM_STOP event to BE, if still used by other FE X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Let me illustrate the system first. FE1 -----+----> BE | FE2 -----+ When there is multi-FE stream to a single BE, the BE will receive SND_SOC_DAPM_STREAM_STOP if one of the FE shutdown. However, the BE is stilled used by another, this will let BE cpu_dai and codec_dai think they are inactive. The later power check will go wrong. I have check the latest linux version, and didn't find any related change. The following is my change to address this, and will re-send a formal patch if it's ok. } Sincerely, Kai Chieh diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 70e8088..9c2d159 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -163,6 +163,13 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir, dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", be->dai_link->name, event, dir); + /* don't sent stop event if this BE is used by other FE */ + if (event == SND_SOC_DAPM_STREAM_STOP && + be->dpcm[dir].users >= 1) { + pr_warn("kc, %s(), be->dai_link->name %s skip stop event\n", __func__, be->dai_link->name); + continue; + } + snd_soc_dapm_stream_event(be, dir, event);