diff mbox

ASoC: Intel: Fix block is enabled multiple times issue

Message ID 1414675312-7667-1-git-send-email-yang.jie@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jie, Yang Oct. 30, 2014, 1:21 p.m. UTC
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 <yang.jie@intel.com>
---
 sound/soc/intel/sst-firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Oct. 30, 2014, 1:41 p.m. UTC | #1
On Thu, Oct 30, 2014 at 09:21:52PM +0800, Jie Yang wrote:
> 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.

Applied, thanks.
Jie, Yang Oct. 31, 2014, 2:23 a.m. UTC | #2
> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Thursday, October 30, 2014 9:42 PM
> To: Jie, Yang
> Cc: alsa-devel@alsa-project.org; Girdwood, Liam R
> Subject: Re: [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
> 
> On Thu, Oct 30, 2014 at 09:21:52PM +0800, Jie Yang wrote:
> > 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.
> 
> Applied, thanks.
[Keyon] thanks, Mark. BTW, can you share your rule about which branch do you apply patches on usually?
I ask this because I can't find applied patch on any branch(topic/intel, for-next, for-linus, fix/core, fix/intel...). :(
Mark Brown Oct. 31, 2014, 10:20 a.m. UTC | #3
On Fri, Oct 31, 2014 at 02:23:38AM +0000, Jie, Yang wrote:

> > Applied, thanks.

> [Keyon] thanks, Mark. BTW, can you share your rule about which branch do you apply patches on usually?
> I ask this because I can't find applied patch on any branch(topic/intel, for-next, for-linus, fix/core, fix/intel...). :(

It's on topic/intel.
diff mbox

Patch

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,