All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: pandora: switch clock back to internal on stop
@ 2012-02-18 22:39 Grazvydas Ignotas
  2012-02-19  6:30 ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Grazvydas Ignotas @ 2012-02-18 22:39 UTC (permalink / raw)
  To: alsa-devel
  Cc: Mark Brown, Peter Ujfalusi, Grazvydas Ignotas, linux-omap,
	Liam Girdwood, Jarkko Nikula

For some reason, OMAP doesn't enter lower power states with functional
clock (CLKS) source set to external, so switch it back to internal when
done playing.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
 sound/soc/omap/omap3pandora.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 07794bd..1be26df 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -77,6 +77,27 @@ static int omap3pandora_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
+static int omap3pandora_hw_free(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret;
+
+	/*
+	 * For some reason, if we don't set clock back to internal, OMAP power
+	 * saving features don't work properly (per power domain doesn't enter
+	 * lower power states). Switch it back until better solution is found.
+	 */
+	ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLKS_FCLK,
+				     0, SND_SOC_CLOCK_IN);
+	if (ret < 0) {
+		pr_err(PREFIX "can't set cpu system clock\n");
+		return ret;
+	}
+
+	return 0;
+}
+
 static int omap3pandora_dac_event(struct snd_soc_dapm_widget *w,
 	struct snd_kcontrol *k, int event)
 {
@@ -201,6 +222,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
 
 static struct snd_soc_ops omap3pandora_ops = {
 	.hw_params = omap3pandora_hw_params,
+	.hw_free = omap3pandora_hw_free,
 };
 
 /* Digital audio interface glue - connects codec <--> CPU */
-- 
1.7.0.4

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

end of thread, other threads:[~2012-02-22  7:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-18 22:39 [PATCH] ASoC: pandora: switch clock back to internal on stop Grazvydas Ignotas
2012-02-19  6:30 ` Mark Brown
2012-02-19 15:52   ` Grazvydas Ignotas
2012-02-20  9:52     ` Peter Ujfalusi
2012-02-20 10:50       ` Grazvydas Ignotas
2012-02-20 13:26         ` Peter Ujfalusi
2012-02-20 15:34           ` Grazvydas Ignotas
2012-02-22  7:54       ` Jarkko Nikula

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.