Skip to contentSkip to conversation

OMAP3: MCBSP: Suspend/resume failure fix

PATCH In review Jane Wang 6 participants 16 messages Nov 13, 2009 – Dec 28, 2009

Subsystems (4)
lore
Share & tools
lore

Jane Wang

author
#0 lore raw

PATCH 1/2 OMAP3: MCBSP: Suspend/resume failure fix

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

2. In addition, reconfigure McBSP, this is needed when systerm comes out of OFF state.

---
 arch/arm/plat-omap/include/mach/mcbsp.h |    2 ++
 arch/arm/plat-omap/mcbsp.c              |   27 +++++++++++++++++++++++++++
 sound/soc/omap/omap-mcbsp.c             |   14 ++++++++++++--
 3 files changed, 41 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
index e0d6eca..94e1c66 100644
@@ -440,6 +440,8 @@ static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
 #endif
 int omap_mcbsp_request(unsigned int id);
 void omap_mcbsp_free(unsigned int id);
+void omap_mcbsp_disable_fclk(unsigned int id);
+void omap_mcbsp_enable_fclk(unsigned int id);
 void omap_mcbsp_start(unsigned int id, int tx, int rx);
 void omap_mcbsp_stop(unsigned int id, int tx, int rx);
 void omap_mcbsp_xmit_word(unsigned int id, u32 word);
arch/arm/plat-omap/mcbsp.c +27 -0
index e664b91..bfe3c61 100644
@@ -459,6 +459,33 @@ int omap_mcbsp_request(unsigned int id)
 }
 EXPORT_SYMBOL(omap_mcbsp_request);
 
+void omap_mcbsp_disable_fclk(unsigned int id)
+{
+	struct omap_mcbsp *mcbsp;
+
+	if (!omap_mcbsp_check_valid_id(id)) {
+		printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+		return;
+	}
+	mcbsp = id_to_mcbsp_ptr(id);
+	clk_disable(mcbsp->fclk);
+}
+EXPORT_SYMBOL(omap_mcbsp_disable_fclk);
+
+
+void omap_mcbsp_enable_fclk(unsigned int id)
+{
+	struct omap_mcbsp *mcbsp;
+
+	if (!omap_mcbsp_check_valid_id(id)) {
+		printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+		return;
+	}
+	mcbsp = id_to_mcbsp_ptr(id);
+	clk_enable(mcbsp->fclk);
+}
+EXPORT_SYMBOL(omap_mcbsp_enable_fclk);
+
 void omap_mcbsp_free(unsigned int id)
 {
 	struct omap_mcbsp *mcbsp;
sound/soc/omap/omap-mcbsp.c +12 -2
index 45be942..e56b5ff 100644
@@ -229,18 +229,28 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		mcbsp_data->active++;
 		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
 		break;
+	case SNDRV_PCM_TRIGGER_RESUME:
+		mcbsp_data->active++;
+		omap_mcbsp_enable_fclk(mcbsp_data->bus_id);
+		omap_mcbsp_config(mcbsp_data->bus_id,
+					&mcbsp_data->regs);
+		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
+		break;
 
 	case SNDRV_PCM_TRIGGER_STOP:
-	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		omap_mcbsp_stop(mcbsp_data->bus_id, play, !play);
 		mcbsp_data->active--;
 		break;
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+		omap_mcbsp_stop(mcbsp_data->bus_id, play, !play);
+		omap_mcbsp_disable_fclk(mcbsp_data->bus_id);
+		mcbsp_data->active--;
+		break;
 	default:
 		err = -EINVAL;
 	}
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 7 lines · Jane Wang

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

2. In addition, reconfigure McBSP, this is needed when systerm comes out of OFF state.

There is no need to resend your patches this iften - please allow at least a week or so for review. You only need to repost if addressing comments or it looks like the patch got missed.

Quoted 99 lines

---
arch/arm/plat-omap/include/mach/mcbsp.h | 2 ++
arch/arm/plat-omap/mcbsp.c | 27 ++++++++++++++++++++++
+++++
sound/soc/omap/omap-mcbsp.c | 14 ++++++++++++--

3 files changed, 41 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
index e0d6eca..94e1c66 100644
@@ -440,6 +440,8 @@ static inline int omap_mcbsp_get_dma_op_mode 
 (unsigned int id) { return 0; }
 #endif
 int omap_mcbsp_request(unsigned int id);
 void omap_mcbsp_free(unsigned int id);
+void omap_mcbsp_disable_fclk(unsigned int id);
+void omap_mcbsp_enable_fclk(unsigned int id);
 void omap_mcbsp_start(unsigned int id, int tx, int rx);
 void omap_mcbsp_stop(unsigned int id, int tx, int rx);

void omap_mcbsp_xmit_word(unsigned int id, u32 word);

arch/arm/plat-omap/mcbsp.c +27 -0
index e664b91..bfe3c61 100644
@@ -459,6 +459,33 @@ int omap_mcbsp_request(unsigned int id)
 }
 EXPORT_SYMBOL(omap_mcbsp_request);
 
+void omap_mcbsp_disable_fclk(unsigned int id)
+{
+    struct omap_mcbsp *mcbsp;
+
+    if (!omap_mcbsp_check_valid_id(id)) {
+        printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+        return;
+    }
+    mcbsp = id_to_mcbsp_ptr(id);
+    clk_disable(mcbsp->fclk);
+}
+EXPORT_SYMBOL(omap_mcbsp_disable_fclk);
+
+
+void omap_mcbsp_enable_fclk(unsigned int id)
+{
+    struct omap_mcbsp *mcbsp;
+
+    if (!omap_mcbsp_check_valid_id(id)) {
+        printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+        return;
+    }
+    mcbsp = id_to_mcbsp_ptr(id);
+    clk_enable(mcbsp->fclk);
+}
+EXPORT_SYMBOL(omap_mcbsp_enable_fclk);
+
 void omap_mcbsp_free(unsigned int id)
 {
   struct omap_mcbsp *mcbsp;
sound/soc/omap/omap-mcbsp.c +12 -2
index 45be942..e56b5ff 100644
@@ -229,18 +229,28 @@ static int omap_mcbsp_dai_trigger(struct  
 snd_pcm_substream *substream, int cmd,
 
   switch (cmd) {
   case SNDRV_PCM_TRIGGER_START:
-    case SNDRV_PCM_TRIGGER_RESUME:
   case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
       mcbsp_data->active++;
       omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
       break;
+    case SNDRV_PCM_TRIGGER_RESUME:
+        mcbsp_data->active++;
+        omap_mcbsp_enable_fclk(mcbsp_data->bus_id);
+        omap_mcbsp_config(mcbsp_data->bus_id,
+                    &mcbsp_data->regs);
+        omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
+        break;
 
   case SNDRV_PCM_TRIGGER_STOP:
-    case SNDRV_PCM_TRIGGER_SUSPEND:
   case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
       omap_mcbsp_stop(mcbsp_data->bus_id, play, !play);
       mcbsp_data->active--;
       break;
+    case SNDRV_PCM_TRIGGER_SUSPEND:
+        omap_mcbsp_stop(mcbsp_data->bus_id, play, !play);
+        omap_mcbsp_disable_fclk(mcbsp_data->bus_id);
+        mcbsp_data->active--;
+        break;
   default:
       err = -EINVAL;
   }
Signature · 1 line
1.5.4.3
author
#2 lore raw
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:alsa-devel-bounces@alsa- project.org] On Behalf Of Mark Brown
Sent: Friday, November 13, 2009 11:49 AM
To: Wang, Jane
Cc: [email protected]; [email protected]; [email protected]; Wang, Jane
Subject: Re: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

Quoted 6 lines · Jane Wang

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

Quoted 8 lines
Quoted 3 lines

2. In addition, reconfigure McBSP, this is needed when systerm comes out of OFF state.

There is no need to resend your patches this iften - please allow at least a week or so for review. You only need to repost if addressing comments or it looks like the patch got missed.

Sorry for sending this again. Something is not set correctly with my git send-email. The email did not reach the mailing lists, it only reached people in cc.

#3 lore raw
Quoted 24 lines · Jane
Quoted 24 lines

-----Original Message-----
From: [email protected] [mailto:alsa-devel-bounces@alsa- project.org] On Behalf Of Mark Brown
Sent: Friday, November 13, 2009 11:49 AM
To: Wang, Jane
Cc: [email protected]; [email protected]; [email protected]; Wang, Jane
Subject: Re: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

Quoted 9 lines · Jane Wang

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

2. In addition, reconfigure McBSP, this is needed when systerm comes out of OFF state.

Quoted 8 lines
Quoted 4 lines

There is no need to resend your patches this iften - please allow at least a week or so for review. You only need to repost if addressing comments or it looks like the patch got missed.

Sorry for sending this again. Something is not set correctly with my git send-email. The email did not reach the mailing lists, it only reached people in cc.

No, your posts are making it through to the lists just fine. Note that alsa-devel is moderated for non-subscribers

#4 lore raw
In reply to Jane Wang

Hi

Quoted 7 lines · On Fri, 13 Nov 2009 11:39:47 -0600 Jane Wang <[email protected]> wrote:

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

2. In addition, reconfigure McBSP, this is needed when systerm comes out of OFF state.

...

Quoted 8 lines
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
@@ -440,6 +440,8 @@ static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
 #endif
 int omap_mcbsp_request(unsigned int id);
 void omap_mcbsp_free(unsigned int id);
+void omap_mcbsp_disable_fclk(unsigned int id);
+void omap_mcbsp_enable_fclk(unsigned int id);

...

Quoted 9 lines
sound/soc/omap/omap-mcbsp.c +0 -1
@@ -229,18 +229,28 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd,
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		mcbsp_data->active++;

sound/soc/omap/omap-mcbsp.c static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, · line 243

Quoted 10 lines
sound/soc/omap/omap-mcbsp.c +7 -0
 		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
 		break;
+	case SNDRV_PCM_TRIGGER_RESUME:
+		mcbsp_data->active++;
+		omap_mcbsp_enable_fclk(mcbsp_data->bus_id);
+		omap_mcbsp_config(mcbsp_data->bus_id,
+					&mcbsp_data->regs);
+		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
+		break;
 

For me this looks more like a simple workaround for the audio case than comprehensive implementation to McBSP OFF mode context save/restore. My thoughts:

1. McBSP clock management partially moved out of low-level driver
2. McBSP client must do the context restore

I do know that arch/arm/plat-omap/mcbsp.c enables the clocks in omap_mcbsp_request, I don't know do some API or feature there really require clocks (or McBSP itself) to be active just after the request time but I would look that path instead (even it is more complicated).

If no API or feature would require active McBSP block before the omap_mcbsp_start call, then the clock management could be done inside the omap_mcbsp_start/-stop functions.

Also context save/restore operations belongs more to PM callbacks of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown whenever it is idle.

I think it's worth to look McBSP register cache concept [1] from Janusz Krzysztofik would it help all of this context save/restore operations.

Signature · 3 lines
Jarkko

1. http://www.spinics.net/lists/linux-omap/msg16720.html
#5 lore raw
Quoted 60 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Jarkko Nikula
Sent: Saturday, November 14, 2009 1:50 PM
To: Wang, Jane
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

Hi

Quoted 6 lines · On Fri, 13 Nov 2009 11:39:47 -0600 Jane Wang <[email protected]> wrote:

McBSP fucntional clock is not disabled when suspend is triggerd which prevents PER domain entering target low-power state. To fix the problem:

1. Disable/enable McBSP functional clock for suspend/resume.

2. In addition, reconfigure McBSP, this is needed when systerm comes out

of OFF state.

Quoted 1 line

...

arch/arm/plat-omap/include/mach/mcbsp.h static inline int

Quoted 3 lines
arch/arm/plat-omap/include/mach/mcbsp.h +0 -0
@@ -440,6 +440,8 @@ static inline int

omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }

Quoted 5 lines
arch/arm/plat-omap/include/mach/mcbsp.h +2 -0
 #endif
 int omap_mcbsp_request(unsigned int id);
 void omap_mcbsp_free(unsigned int id);
+void omap_mcbsp_disable_fclk(unsigned int id);
+void omap_mcbsp_enable_fclk(unsigned int id);

...

sound/soc/omap/omap-mcbsp.c static int omap_mcbsp_dai_trigger(struct

Quoted 3 lines
sound/soc/omap/omap-mcbsp.c +0 -0
@@ -229,18 +229,28 @@ static int omap_mcbsp_dai_trigger(struct

snd_pcm_substream *substream, int cmd,

Quoted 6 lines
sound/soc/omap/omap-mcbsp.c +0 -1
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		mcbsp_data->active++;

sound/soc/omap/omap-mcbsp.c static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, · line 243

Quoted 10 lines
sound/soc/omap/omap-mcbsp.c +7 -0
 		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
 		break;
+	case SNDRV_PCM_TRIGGER_RESUME:
+		mcbsp_data->active++;
+		omap_mcbsp_enable_fclk(mcbsp_data->bus_id);
+		omap_mcbsp_config(mcbsp_data->bus_id,
+					&mcbsp_data->regs);
+		omap_mcbsp_start(mcbsp_data->bus_id, play, !play);
+		break;
 

For me this looks more like a simple workaround for the audio case than comprehensive implementation to McBSP OFF mode context save/restore. My thoughts:

1. McBSP clock management partially moved out of low-level driver
2. McBSP client must do the context restore

Quoted 8 lines

I do know that arch/arm/plat-omap/mcbsp.c enables the clocks in omap_mcbsp_request, I don't know do some API or feature there really require clocks (or McBSP itself) to be active just after the request time but I would look that path instead (even it is more complicated).

If no API or feature would require active McBSP block before the omap_mcbsp_start call, then the clock management could be done inside the omap_mcbsp_start/-stop functions.

[Aggarwal, Anuj] I tried doing that but it didn't work because before _start, we need to call set_hw_params which configures mcbsp, for which clocks are required.

Quoted 5 lines

Also context save/restore operations belongs more to PM callbacks of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown whenever it is idle.

[Aggarwal, Anuj] I am sorry I couldn't understand that. Did you mean that PM hooks can be added in the mcbsp driver which can be registered and called As and when required? Any reference driver for this, if my understanding is correct?

Quoted 3 lines

I think it's worth to look McBSP register cache concept [1] from Janusz Krzysztofik would it help all of this context save/restore operations.

[Aggarwal, Anuj] I tried these two patches on omap3 evm but they didn't work for me. The system doesn't go to the suspend state when I do:
echo mem > /sys/power/state
And the culprits were core (think sdma) and per domain. I tried disabling the mcbsp i/f clock as well but it didn't help. On mcbsp register dump, I couldn't find the sysconfig register getting configured. Could that be the root cause?

Quoted 10 lines

--
Jarkko

1. http://www.spinics.net/lists/linux-omap/msg16720.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#6 lore raw
Quoted 12 lines
Quoted 4 lines

Also context save/restore operations belongs more to PM callbacks of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown whenever it is idle.

[Aggarwal, Anuj] I am sorry I couldn't understand that. Did you mean that PM hooks can be added in the mcbsp driver which can be registered and called
As and when required? Any reference driver for this, if my understanding is correct?

Quoted 3 lines

I think it's worth to look McBSP register cache concept [1] from Janusz Krzysztofik would it help all of this context save/restore operations.

Quoted 7 lines

[Aggarwal, Anuj] I tried these two patches on omap3 evm but they didn't work for me. The system doesn't go to the suspend state when I do:
echo mem > /sys/power/state
And the culprits were core (think sdma) and per domain. I tried disabling the mcbsp i/f clock as well but it didn't help. On mcbsp register dump, I couldn't find the sysconfig register getting configured. Could that be the root cause?

Did you include this patch?
http://git.kernel.org/?p=linux/kernel/git/broonie/sound-2.6.git;a=commit;h=9da65a99e5e6a074c586474961dbf560e439df50

Without this patch, omap_stop_dma() did not disable DMA channel.

Regards,

-Jane

#7 lore raw
In reply to Aggarwal, Anuj
Quoted 8 lines · Anuj
Quoted 3 lines

If no API or feature would require active McBSP block before the omap_mcbsp_start call, then the clock management could be done inside the omap_mcbsp_start/-stop functions.

[Aggarwal, Anuj] I tried doing that but it didn't work because before _start, we need to call set_hw_params which configures mcbsp, for which clocks are required.

Quoted 1 line

First modification to .../plat-omap/mcbsp.c could be just a patch which keeps the
clocks on only when needed. I.e. keep them disabled when returning from request
and activate them only when accessing the McBSP registers or when it is running.

But that said, I don't know are there some use case or API which requires active
clocks after request so that should be checked.

Quoted 11 lines
Quoted 4 lines

Also context save/restore operations belongs more to PM callbacks of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown whenever it is idle.

[Aggarwal, Anuj] I am sorry I couldn't understand that. Did you mean that PM hooks can be added in the mcbsp driver which can be registered and called
As and when required? Any reference driver for this, if my understanding is correct?

Quoted 1 line

Yep, the PM hooks in .../plat-omap/mcbsp.c should take care of saving the McBSP registers before going into suspend or restore them back when resuming.
This would be second patch after the clock change patch.

The comment about dynamic PM was an idea that if McBSP could be unpowered whenever it's not running and do the resume only when calling omap_mcbsp_start.
But that would be some future improvements after basic suspend/resume functionality.

Quoted 10 lines

I think it's worth to look McBSP register cache concept [1] from Janusz

Quoted 1 line

Krzysztofik would it help all of this context save/restore operations.

[Aggarwal, Anuj] I tried these two patches on omap3 evm but they didn't work for me. The system doesn't go to the suspend state when I do:
echo mem > /sys/power/state
And the culprits were core (think sdma) and per domain. I tried disabling the mcbsp i/f clock as well but it didn't help. On mcbsp register dump, I couldn't find the sysconfig register getting configured. Could that be the root cause?

Does it go into suspend if the audio is not running (i.e. McBSP not requested) or
if you don't even compile the McBSP support? I haven't looked are there checks
for active clocks in PM core but PM is easier to start with bare minimum and to
see that system can do suspend/resume and then add more features one by one.

Signature · 1 line
Jarkko
#8 lore raw
Quoted 57 lines · Jarkko Nikula
Quoted 8 lines · Anuj
Quoted 3 lines

If no API or feature would require active McBSP block before the omap_mcbsp_start call, then the clock management could be done inside the omap_mcbsp_start/-stop functions.

[Aggarwal, Anuj] I tried doing that but it didn't work because before _start, we need to call set_hw_params which configures mcbsp, for which clocks are required.

Quoted 1 line

First modification to .../plat-omap/mcbsp.c could be just a patch which keeps the
clocks on only when needed. I.e. keep them disabled when returning from request
and activate them only when accessing the McBSP registers or when it is running.

But that said, I don't know are there some use case or API which requires active
clocks after request so that should be checked.

Quoted 11 lines
Quoted 4 lines

Also context save/restore operations belongs more to PM callbacks of .../plat-omap/mcbsp.c. Or probably that can be done also dynamically inside the omap_mcbsp_start/-stop for keeping the whole McBSP shutdown whenever it is idle.

[Aggarwal, Anuj] I am sorry I couldn't understand that. Did you mean that PM hooks can be added in the mcbsp driver which can be registered and called
As and when required? Any reference driver for this, if my understanding is correct?

Quoted 1 line

Yep, the PM hooks in .../plat-omap/mcbsp.c should take care of saving the McBSP registers before going into suspend or restore them back when resuming.
This would be second patch after the clock change patch.

The comment about dynamic PM was an idea that if McBSP could be unpowered whenever it's not running and do the resume only when calling omap_mcbsp_start.
But that would be some future improvements after basic suspend/resume functionality.

Quoted 10 lines

I think it's worth to look McBSP register cache concept [1] from Janusz

Quoted 1 line

Krzysztofik would it help all of this context save/restore operations.

[Aggarwal, Anuj] I tried these two patches on omap3 evm but they didn't work for me. The system doesn't go to the suspend state when I do:
echo mem > /sys/power/state
And the culprits were core (think sdma) and per domain. I tried disabling the mcbsp i/f clock as well but it didn't help. On mcbsp register dump, I couldn't find the sysconfig register getting configured. Could that be the root cause?

Quoted 7 lines

Does it go into suspend if the audio is not running (i.e. McBSP not requested) or
if you don't even compile the McBSP support? I haven't looked are there checks
for active clocks in PM core but PM is easier to start with bare minimum and to
see that system can do suspend/resume and then add more features one by one.

[Anuj] Yes, w/o audio, it goes into suspend neatly.
After going through the entire patch series "[PATCHv5 00/20] OMAP ASoC changes in DMA utilization", which I missed earlier, I found that the sysfs entry dma_op_mode can be toggled among element/frame/threshold, by default which is element hence not allowing the mcbsp driver to go into idle state. I changed that at run time and after that I am able to hit the suspend
state while playing back audio (at least the log doesn't
show that the system is not able to hit suspend).
My question is: is sysfs the only way to choose threshold or can it be made as default? I could not see that happening in the code so thinking of the possible reason of choosing not to do so. Because the user who wants to hit suspend will not like to issue driver specific commands. Any specific reason of not doing that by default?

Quoted 8 lines

--
Jarkko
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Signature · 2 lines
Best Regards,
Anuj Aggarwal
#9 lore raw
Quoted 6 lines · On Thursday 19 November 2009 21:48:26 ext Anuj Aggarwal wrote:

[Anuj] Yes, w/o audio, it goes into suspend neatly.
After going through the entire patch series "[PATCHv5 00/20] OMAP ASoC changes in DMA utilization", which I missed earlier, I found that the sysfs entry dma_op_mode can be toggled among element/frame/threshold, by default which is element hence not allowing the mcbsp driver to go into idle state. I changed that at run time and after that I am able to hit

Quoted 8 lines

the suspend
state while playing back audio (at least the log doesn't
show that the system is not able to hit suspend).
My question is: is sysfs the only way to choose threshold or can it be made
as default? I could not see that happening in the code so thinking of the possible reason of choosing not to do so. Because the user who wants to hit suspend will not like to issue driver specific commands. Any specific reason of not doing that by default?

It is not selected as default on OMAP3, since it is a new feature, and we don't want to change the behavior of the audio. If the reports are positive regarding to the threshold mode, than we can make it as default on OMAP3, at least that is the plan AFAIK.
In some cases the element mode is desirable over the threshold mode, and probably there are additional modes can be implemented for other cases, hence the sysfs interface is really useful feature.

Back than there were quite a bit of discussion here about the threshold mode: in the original series the threshold mode was the default, but we decided to not to do that before others have the chance to test it. We have been using the threshold mode without issues internally, so it should be really stable, but it is still a new mode, which can break other implementations.

So please test the threshold mode in your HW, and report if it is working there OK, if we have enough positive feedbacks, than we can make it as default.

Signature · 1 line
Péter
#10 lore raw
Quoted 10 lines · On Fri, 20 Nov 2009 09:51:13 +0200 Peter Ujfalusi <[email protected]>…
Quoted 5 lines

My question is: is sysfs the only way to choose threshold or can it be made
as default? I could not see that happening in the code so thinking of the possible reason of choosing not to do so. Because the user who wants to hit suspend will not like to issue driver specific commands. Any specific reason of not doing that by default?

It is not selected as default on OMAP3, since it is a new feature, and we don't want to change the behavior of the audio. If the reports are positive regarding to the threshold mode, than we can make it as default on OMAP3, at least that is the plan AFAIK.

Yep. Currently we want to keep DMA behaviour consistent across the OMAPs and McBSP ports since the large internal FIFO is found only from McBSP2 on OMAP3.

This is good finding that you have found that it's the audio preventing the suspend and the threshold transfer mode can make it hit better.

But anyway, I'm afraid that threshold mode doesn't help to create robust suspend. Threshold allow the DMA and core to be mode in idle between the FIFO fills and probably that's why suspend might work during these idle periods. For robust implementation there must be explicit code stopping and resuming all activity gracefully so that it can hit the suspend also if the fill is happening or if using another transfer mode.

Signature · 1 line
Jarkko
#11 lore raw
Quoted 21 lines · ext Jarkko Nikula
Quoted 10 lines · On Fri, 20 Nov 2009 09:51:13 +0200 Peter Ujfalusi <[email protected]>…
Quoted 5 lines

My question is: is sysfs the only way to choose threshold or can it be made
as default? I could not see that happening in the code so thinking of the possible reason of choosing not to do so. Because the user who wants to hit suspend will not like to issue driver specific commands. Any specific reason of not doing that by default?

It is not selected as default on OMAP3, since it is a new feature, and we don't want to change the behavior of the audio. If the reports are positive regarding to the threshold mode, than we can make it as default on OMAP3, at least that is the plan AFAIK.

Yep. Currently we want to keep DMA behaviour consistent across the OMAPs and McBSP ports since the large internal FIFO is found only from McBSP2 on OMAP3.

This is good finding that you have found that it's the audio preventing the suspend and the threshold transfer mode can make it hit better.

Quoted 9 lines

But anyway, I'm afraid that threshold mode doesn't help to create robust suspend. Threshold allow the DMA and core to be mode in idle between the FIFO fills and probably that's why suspend might work during these idle periods. For robust implementation there must be explicit code stopping and resuming all activity gracefully so that it can hit the suspend also if the fill is happening or if using another transfer mode.

Looking at the very original patch, I don't know how things could get into deep sleep by disabling the fclk only... need to disable the iclk also. In threshold mode, HW autogates the iclk, so you may be just "lucky".

One may want to be aware of this also:

http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commitdiff;h=72cc6d715d5b018e2cff4adb68966855850d4e77

I think it's an undocumented feature.

- Eero

#12 lore raw
Quoted 32 lines · Eero Nurkkala
Quoted 21 lines · ext Jarkko Nikula
Quoted 10 lines · On Fri, 20 Nov 2009 09:51:13 +0200 Peter Ujfalusi <[email protected]>…
Quoted 5 lines

My question is: is sysfs the only way to choose threshold or can it be made as default? I could not see that happening in the code so thinking of the possible reason of choosing not to do so. Because the user who wants to hit suspend will not like to issue driver specific commands. Any specific reason of not doing that by default?

It is not selected as default on OMAP3, since it is a new feature, and we don't want to change the behavior of the audio. If the reports are positive regarding to the threshold mode, than we can make it as default on OMAP3, at least that is the plan AFAIK.

Yep. Currently we want to keep DMA behaviour consistent across the OMAPs and McBSP ports since the large internal FIFO is found only from McBSP2 on OMAP3.

This is good finding that you have found that it's the audio preventing the suspend and the threshold transfer mode can make it hit better.

Quoted 9 lines

But anyway, I'm afraid that threshold mode doesn't help to create robust suspend. Threshold allow the DMA and core to be mode in idle between the FIFO fills and probably that's why suspend might work during these idle periods. For robust implementation there must be explicit code stopping and resuming all activity gracefully so that it can hit the suspend also if the fill is happening or if using another transfer mode.

Quoted 4 lines

Looking at the very original patch, I don't know how things could get into deep sleep by disabling the fclk only... need to disable the iclk also. In threshold mode, HW autogates the iclk, so you may be just "lucky".

[Anuj] No, I am not :(. I had to modify the original patch to include the disable part for the ICLK too. Without that, I was not able to hit retention.
I will try to do some further regression on OMAP3 EVM and post my findings. As of now, audio is working fine with these patches + ICLK modification.

Quoted 5 lines

One may want to be aware of this also:

http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commitdiff;h=72cc6d715d5b018e2cff4adb68966855850d4e77

Quoted 9 lines

I think it's an undocumented feature.

- Eero

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw
Quoted 10 lines
Quoted 4 lines

Looking at the very original patch, I don't know how things could get into deep sleep by disabling the fclk only... need to disable the iclk also. In threshold mode, HW autogates the iclk, so you may be just "lucky".

[Anuj] No, I am not :(. I had to modify the original patch to include the disable part for the ICLK too. Without that, I was not able to hit retention.
I will try to do some further regression on OMAP3 EVM and post my findings. As of now, audio is working fine with these patches + ICLK modification.

[Aggarwal, Anuj] After further testing, I found that there is some problem in the capture path. While capturing in background, if I tried to do suspend, capture fails after a few seconds giving;
arecord: pcm_read:1617: read error: Input/output error
This I was discussing in another thread (*) for AIC23/AM3517 on NFS but now I realized after finishing my tests that this behavior is common for both omap3530/twl4030 and am3517/aic23. Moreover, the problem doesn't depend on the underlying file system - both NFS and ramdisk produce the same error.
To make matter worse, if suspend/resume is tried while audio loopback is running, system just hangs. Even telnet to the evm doesn't work. So the audio capture path, from suspend/resume point of view, definitely needs some more time.
I will continue debugging at my end. But pointers are always welcome.

*) http://www.mail-archive.com/[email protected]/msg19845.html

Quoted 8 lines
Quoted 4 lines

One may want to be aware of this also:

http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-

2.6.git;a=commitdiff;h=72cc6d715d5b018e2cff4adb68966855850d4e77

Quoted 3 lines

I think it's an undocumented feature.

#14 lore raw
In reply to Anuj Aggarwal
Quoted 20 lines

-----Original Message-----
From: Aggarwal, Anuj
Sent: Monday, November 30, 2009 5:21 PM
To: [email protected]
Cc: ext Jarkko Nikula; [email protected]; Wang, Jane; [email protected]; Ujfalusi Peter (Nokia-D/Tampere); [email protected]
Subject: RE: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume failure fix

Quoted 10 lines
Quoted 4 lines

Looking at the very original patch, I don't know how things could get into deep sleep by disabling the fclk only... need to disable the iclk also. In threshold mode, HW autogates the iclk, so you may be just "lucky".

[Anuj] No, I am not :(. I had to modify the original patch to include the disable part for the ICLK too. Without that, I was not able to hit retention.
I will try to do some further regression on OMAP3 EVM and post my findings. As of now, audio is working fine with these patches + ICLK modification.

Quoted 16 lines

[Aggarwal, Anuj] After further testing, I found that there is some problem in the capture path. While capturing in background, if I tried to do suspend, capture fails after a few seconds giving;
arecord: pcm_read:1617: read error: Input/output error
This I was discussing in another thread (*) for AIC23/AM3517 on NFS but now
I realized after finishing my tests that this behavior is common for both omap3530/twl4030 and am3517/aic23. Moreover, the problem doesn't depend on the underlying file system - both NFS and ramdisk produce the same error.
To make matter worse, if suspend/resume is tried while audio loopback is running, system just hangs. Even telnet to the evm doesn't work.
So the audio capture path, from suspend/resume point of view, definitely needs some more time.
I will continue debugging at my end. But pointers are always welcome.

[Aggarwal, Anuj] I think I found one possible root cause of the hang which is observed if suspend/resume is tried while audio loopback is going on.

soc_suspend() calls snd_pcm_suspend_all() which calls snd_pcm_suspend() for all the substreams in the pcm->streams[]. On debugging, I found that I am not able to come out of snd_pcm_suspend_all(). I think this API needs some fix as the comment also suggests:
FIXME: the open/close code should lock this as well

Could this be the root cause of this hang? Any pointers on what needs to be fixed?

#15 lore raw
Quoted 48 lines
Quoted 8 lines

-----Original Message-----
From: Aggarwal, Anuj
Sent: Monday, November 30, 2009 5:21 PM
To: [email protected]
Cc: ext Jarkko Nikula; [email protected]; Wang, Jane; [email protected]; Ujfalusi Peter (Nokia-D/Tampere); [email protected]
Subject: RE: [alsa-devel] [PATCH 1/2] OMAP3: MCBSP: Suspend/resume

failure

Quoted 3 lines

fix

Quoted 1 line
Quoted 1 line

Looking at the very original patch, I don't know how things could

get

Quoted 1 line
Quoted 1 line
Quoted 1 line

into deep sleep by disabling the fclk only... need to disable the

iclk

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

also. In threshold mode, HW autogates the iclk, so you may be just "lucky".

[Anuj] No, I am not :(. I had to modify the original patch to include the disable part for the ICLK too. Without that, I was not able to hit retention.
I will try to do some further regression on OMAP3 EVM and post my findings. As of now, audio is working fine with these patches + ICLK modification.

Quoted 16 lines

[Aggarwal, Anuj] After further testing, I found that there is some problem in the capture path. While capturing in background, if I tried to do suspend, capture fails after a few seconds giving;
arecord: pcm_read:1617: read error: Input/output error
This I was discussing in another thread (*) for AIC23/AM3517 on NFS but now
I realized after finishing my tests that this behavior is common for both omap3530/twl4030 and am3517/aic23. Moreover, the problem doesn't depend on the underlying file system - both NFS and ramdisk produce the same error.
To make matter worse, if suspend/resume is tried while audio loopback is running, system just hangs. Even telnet to the evm doesn't work.
So the audio capture path, from suspend/resume point of view, definitely needs some more time.
I will continue debugging at my end. But pointers are always welcome.

[Aggarwal, Anuj] I think I found one possible root cause of the hang which is observed if suspend/resume is tried while audio loopback is going on.

soc_suspend() calls snd_pcm_suspend_all() which calls snd_pcm_suspend() for all the substreams in the pcm->streams[]. On debugging, I found that I am not able to come out of snd_pcm_suspend_all(). I think this API needs some fix as the comment also suggests:
FIXME: the open/close code should lock this as well

Quoted 4 lines

Could this be the root cause of this hang? Any pointers on what needs to be
fixed?

[Aggarwal, Anuj] Can someone please confirm that the problem lies in this API? Also, any help on how that can be fixed would be great.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html