From patchwork Tue May 24 05:06:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "srv_kaichieh.chaung" X-Patchwork-Id: 9132785 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 A6B0160761 for ; Tue, 24 May 2016 05:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95183281E3 for ; Tue, 24 May 2016 05:07:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89CB628289; Tue, 24 May 2016 05:07:05 +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 2E4E5281E3 for ; Tue, 24 May 2016 05:07:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BD25D26145E; Tue, 24 May 2016 07:07:01 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 912282605EF; Tue, 24 May 2016 07:06:59 +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 6B435260631; Tue, 24 May 2016 07:06:58 +0200 (CEST) Received: from mailgw01.mediatek.com (unknown [210.61.82.183]) by alsa0.perex.cz (Postfix) with ESMTP id 93C05260568 for ; Tue, 24 May 2016 07:06:50 +0200 (CEST) Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1974198726; Tue, 24 May 2016 13:06:43 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Tue, 24 May 2016 13:06:30 +0800 Message-ID: <1464066390.30335.1.camel@mtkswgap22> From: srv_kaichieh.chaung To: Date: Tue, 24 May 2016 13:06:30 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: kaichieh.chuang@mediatek.com 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);