All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
@ 2014-10-30 13:21 Jie Yang
  2014-10-30 13:41 ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jie Yang @ 2014-10-30 13:21 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, liam.r.girdwood

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(-)

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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
  2014-10-30 13:21 [PATCH] ASoC: Intel: Fix block is enabled multiple times issue Jie Yang
@ 2014-10-30 13:41 ` Mark Brown
  2014-10-31  2:23   ` Jie, Yang
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2014-10-30 13:41 UTC (permalink / raw)
  To: Jie Yang; +Cc: alsa-devel, liam.r.girdwood


[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
  2014-10-30 13:41 ` Mark Brown
@ 2014-10-31  2:23   ` Jie, Yang
  2014-10-31 10:20     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jie, Yang @ 2014-10-31  2:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Girdwood, Liam R



> -----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...). :(

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
  2014-10-31  2:23   ` Jie, Yang
@ 2014-10-31 10:20     ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-10-31 10:20 UTC (permalink / raw)
  To: Jie, Yang; +Cc: alsa-devel, Girdwood, Liam R


[-- Attachment #1.1: Type: text/plain, Size: 333 bytes --]

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.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
  2014-10-22  3:07 Jie Yang
@ 2014-10-22  9:26 ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2014-10-22  9:26 UTC (permalink / raw)
  To: Jie Yang; +Cc: alsa-devel, liam.r.girdwood


[-- Attachment #1.1: Type: text/plain, Size: 527 bytes --]

On Wed, Oct 22, 2014 at 11:07:58AM +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.

This doesn't apply against either fix/intel or topic/intel, please
check and resend.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ASoC: Intel: Fix block is enabled multiple times issue
@ 2014-10-22  3:07 Jie Yang
  2014-10-22  9:26 ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Jie Yang @ 2014-10-22  3:07 UTC (permalink / raw)
  To: broonie, liam.r.girdwood; +Cc: alsa-devel

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(-)

diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index f2f1d5f..db60398 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -80,7 +80,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,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-10-31 10:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 13:21 [PATCH] ASoC: Intel: Fix block is enabled multiple times issue Jie Yang
2014-10-30 13:41 ` Mark Brown
2014-10-31  2:23   ` Jie, Yang
2014-10-31 10:20     ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2014-10-22  3:07 Jie Yang
2014-10-22  9:26 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.