From patchwork Thu Oct 30 13:21:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jie, Yang" X-Patchwork-Id: 5197651 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ADC34C11AC for ; Thu, 30 Oct 2014 13:23:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B9D3B20219 for ; Thu, 30 Oct 2014 13:23:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2AEDE20179 for ; Thu, 30 Oct 2014 13:23:31 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E2D06265191; Thu, 30 Oct 2014 14:23:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E7FF3260602; Thu, 30 Oct 2014 14:23:18 +0100 (CET) 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 5BA9A26060C; Thu, 30 Oct 2014 14:23:18 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 701B1260602 for ; Thu, 30 Oct 2014 14:23:08 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 30 Oct 2014 06:21:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="408488962" Received: from keyon-u1310.sh.intel.com ([10.239.13.7]) by FMSMGA003.fm.intel.com with ESMTP; 30 Oct 2014 06:13:30 -0700 From: Jie Yang To: broonie@kernel.org Date: Thu, 30 Oct 2014 21:21:52 +0800 Message-Id: <1414675312-7667-1-git-send-email-yang.jie@intel.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, liam.r.girdwood@intel.com Subject: [alsa-devel] [PATCH] ASoC: Intel: Fix block is enabled multiple times issue 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP During FW parsing and loading, block_list_prepare() may be called for each raw data block copying and this may made the hsw_block_enable() called mutiple times, which increase block->users many times. The result of this is hsw_block_disable() can't power gated the related block when trying to free the blocks during suspend, and the power gating status also confused. Here check the block user status, only calling enable() for those blocks who has no user yet. Remember that this works correctlly on current case, where there are enough SRAM memory so different module won't share a memory block. For further usage, we may need restructure the struct sst_mem_block to save the module list who is using it. Signed-off-by: Jie Yang --- sound/soc/intel/sst-firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c index 35788ad..c451398 100644 --- a/sound/soc/intel/sst-firmware.c +++ b/sound/soc/intel/sst-firmware.c @@ -149,7 +149,7 @@ static int block_list_prepare(struct sst_dsp *dsp, /* enable each block so that's it'e ready for data */ list_for_each_entry(block, block_list, module_list) { - if (block->ops && block->ops->enable) { + if (block->ops && block->ops->enable && !block->users) { ret = block->ops->enable(block); if (ret < 0) { dev_err(dsp->dev,