Skip to contentSkip to conversation

ASoC: omap-mcbsp: When closing the port select PRCM source for CLKS signal

PATCH In review Peter Ujfalusi 4 participants 10 messages Mar 5, 2012 – Mar 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: omap-mcbsp: When closing the port select PRCM source for CLKS signal

If external source for the CLKS signal selection kept after the port is no longer in use the system might refuse to go suspend.
There is also a chance that the external clock is not running when next time the McBSP port is started which can result errors when we try to access McBSP registers.
Reset the CLKS source back to PRCM source unconditionally.

---
 sound/soc/omap/mcbsp.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
sound/soc/omap/mcbsp.c +10 -0
index d716793..21dbb05 100644
@@ -548,6 +548,16 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
 
 	reg_cache = mcbsp->reg_cache;
 
+	/*
+	 * Select CLKS source from internal source unconditionally before
+	 * marking the McBSP port as free.
+	 * If the external clock source via MCBSP_CLKS pin has been selected the
+	 * system will refuse to enter idle if the CLKS pin source is not reset
+	 * back to internal source.
+	 */
+	if (!cpu_class_is_omap1())
+		omap2_mcbsp_set_clks_src(mcbsp, MCBSP_CLKS_PRCM_SRC);
+
 	spin_lock(&mcbsp->lock);
 	if (mcbsp->free)
 		dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id);
Signature · 1 line
1.7.8.5
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Peter Ujfalusi

If external source for the CLKS signal selection kept after the port is no longer in use the system might refuse to go suspend.
There is also a chance that the external clock is not running when next time the McBSP port is started which can result errors when we try to access McBSP registers.
Reset the CLKS source back to PRCM source unconditionally.

though it'd be better if the driver could remember and restore the setting when the device becomes active again so that machine drivers don't need to.

#2 lore raw
Quoted 3 lines · Mark Brown

though it'd be better if the driver could remember and restore the setting when the device becomes active again so that machine drivers don't need to.

Yes, this is my long term plan regarding to the clock selection. With this patch the omap3pandora can suspend after audio activity.

Signature · 1 line
Péter
#3 lore raw
In reply to Peter Ujfalusi
Quoted 8 lines · Peter Ujfalusi

If external source for the CLKS signal selection kept after the port is no longer in use the system might refuse to go suspend.
There is also a chance that the external clock is not running when next time the McBSP port is started which can result errors when we try to access McBSP registers.
Reset the CLKS source back to PRCM source unconditionally.

I guess this depends on mcbsp move series?
Do we have those queued somewhere, so I don't have to collect patches from the list?

Signature · 5 lines
Gražvydas
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#4 lore raw
Quoted 1 line · Grazvydas Ignotas

I guess this depends on mcbsp move series?

Yes.

Quoted 2 lines

Do we have those queued somewhere, so I don't have to collect patches from the list?

It is not queued as of now since it has dependency on some other patches. I expect it will be in Liam's for-3.4 in a coming days.

Signature · 5 lines
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#5 lore raw
In reply to Grazvydas Ignotas

Hi,

Quoted 3 lines · Grazvydas Ignotas

I guess this depends on mcbsp move series?
Do we have those queued somewhere, so I don't have to collect patches from the list?

You can apply this patch on top of my for-3.4 branch which I have just updated on top of Liam's for-3.4 branch:

[email protected]:omap-audio/linux-audio.git peter/topic/for-3.4

Signature · 5 lines
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#6 lore raw
Quoted 12 lines · Peter Ujfalusi

Hi,

Quoted 3 lines · Grazvydas Ignotas

I guess this depends on mcbsp move series?
Do we have those queued somewhere, so I don't have to collect patches from the list?

You can apply this patch on top of my for-3.4 branch which I have just updated on top of Liam's for-3.4 branch:

[email protected]:omap-audio/linux-audio.git peter/topic/for-3.4

I've now applied these patches on top of my for-3.4.

Regards

Liam

#7 lore raw
Quoted 1 line · Liam Girdwood

I've now applied these patches on top of my for-3.4.

I pulled these on top of today's linux-next and it doesn't build as a module:

Building modules, stage 2.
MODPOST 36 modules
ERROR: "omap_mcbsp_start" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_get_tx_delay" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_disable" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_init" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_set_chgain" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_set_rx_threshold" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_get_chgain" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_free" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp_set_clks_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_is_enabled" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_stop" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp1_mux_fsr_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_request" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp1_mux_clkr_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_config" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_get_rx_delay" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_set_tx_threshold" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_sysfs_remove" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_enable" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!

Signature · 5 lines
Gražvydas
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#8 lore raw

Hi,

Quoted 4 lines · Grazvydas Ignotas
Quoted 1 line · Liam Girdwood

I've now applied these patches on top of my for-3.4.

I pulled these on top of today's linux-next and it doesn't build as a module:

Opps. I have not tried it as a module...
There seams to be an issue with the Kconfig/Makefile change. Thanks for reporting it, I'll fix it.

Signature · 1 line
Péter
Quoted 32 lines

 Building modules, stage 2.
 MODPOST 36 modules
ERROR: "omap_mcbsp_start" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_get_tx_delay" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_disable" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_init" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_set_chgain" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_set_rx_threshold" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_get_chgain" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_free" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp_set_clks_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_is_enabled" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_stop" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp1_mux_fsr_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_request" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap2_mcbsp1_mux_clkr_src" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_config" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_get_rx_delay" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_set_tx_threshold" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_mcbsp_sysfs_remove" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!
ERROR: "omap_st_enable" [sound/soc/omap/snd-soc-omap-mcbsp.ko] undefined!

Quoted 2 lines

--
Gražvydas

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

Tested-by on v1 1/1
#9 lore raw
In reply to Peter Ujfalusi
Quoted 8 lines · Peter Ujfalusi

If external source for the CLKS signal selection kept after the port is no longer in use the system might refuse to go suspend.
There is also a chance that the external clock is not running when next time the McBSP port is started which can result errors when we try to access McBSP registers.
Reset the CLKS source back to PRCM source unconditionally.

Quoted 28 lines

---
 sound/soc/omap/mcbsp.c |   10 ++++++++++

 1 files changed, 10 insertions(+), 0 deletions(-)
sound/soc/omap/mcbsp.c +10 -1
index d716793..21dbb05 100644
@@ -548,6 +548,16 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
 
        reg_cache = mcbsp->reg_cache;
 
+       /*
+        * Select CLKS source from internal source unconditionally before
+        * marking the McBSP port as free.
+        * If the external clock source via MCBSP_CLKS pin has been selected the
+        * system will refuse to enter idle if the CLKS pin source is not reset
+        * back to internal source.
+        */
+       if (!cpu_class_is_omap1())
+               omap2_mcbsp_set_clks_src(mcbsp, MCBSP_CLKS_PRCM_SRC);
+
        spin_lock(&mcbsp->lock);
        if (mcbsp->free)
                dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id);
--

1.7.8.5

Signature · 5 lines
Gražvydas
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel