All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] ASoC: Indentation fix for null loop operation
@ 2011-06-06 18:18 Mark Brown
  2011-06-06 18:18 ` [PATCH 2/6] ASoC: Remove trace for DAPM bias level logging Mark Brown
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

More with the legibility.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6be6546..988cdff 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -209,7 +209,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
 		int val, item, bitmask;
 
 		for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
-		;
+			;
 		val = snd_soc_read(w->codec, e->reg);
 		item = (val >> e->shift_l) & (bitmask - 1);
 
-- 
1.7.5.3

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

* [PATCH 2/6] ASoC: Remove trace for DAPM bias level logging
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
@ 2011-06-06 18:18 ` Mark Brown
  2011-06-06 18:18 ` [PATCH 3/6] ASoC: Simplify logic in snd_soc_dapm_set_bias_level() Mark Brown
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

It's redundant now thanks to the use of the generic trace infrastructure.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |   18 ------------------
 1 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 988cdff..4452b57 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -139,24 +139,6 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 	struct snd_soc_card *card = dapm->card;
 	int ret = 0;
 
-	switch (level) {
-	case SND_SOC_BIAS_ON:
-		dev_dbg(dapm->dev, "Setting full bias\n");
-		break;
-	case SND_SOC_BIAS_PREPARE:
-		dev_dbg(dapm->dev, "Setting bias prepare\n");
-		break;
-	case SND_SOC_BIAS_STANDBY:
-		dev_dbg(dapm->dev, "Setting standby bias\n");
-		break;
-	case SND_SOC_BIAS_OFF:
-		dev_dbg(dapm->dev, "Setting bias off\n");
-		break;
-	default:
-		dev_err(dapm->dev, "Setting invalid bias %d\n", level);
-		return -EINVAL;
-	}
-
 	trace_snd_soc_bias_level_start(card, level);
 
 	if (card && card->set_bias_level)
-- 
1.7.5.3

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

* [PATCH 3/6] ASoC: Simplify logic in snd_soc_dapm_set_bias_level()
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
  2011-06-06 18:18 ` [PATCH 2/6] ASoC: Remove trace for DAPM bias level logging Mark Brown
@ 2011-06-06 18:18 ` Mark Brown
  2011-06-06 18:18 ` [PATCH 4/6] ASoC: Add context parameter to card DAPM callbacks Mark Brown
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

No functional changes but much less indentation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4452b57..d989dd7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -143,17 +143,19 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 
 	if (card && card->set_bias_level)
 		ret = card->set_bias_level(card, level);
-	if (ret == 0) {
-		if (dapm->codec && dapm->codec->driver->set_bias_level)
-			ret = dapm->codec->driver->set_bias_level(dapm->codec, level);
-		else
-			dapm->bias_level = level;
-	}
-	if (ret == 0) {
-		if (card && card->set_bias_level_post)
-			ret = card->set_bias_level_post(card, level);
-	}
+	if (ret != 0)
+		goto out;
+
+	if (dapm->codec && dapm->codec->driver->set_bias_level)
+		ret = dapm->codec->driver->set_bias_level(dapm->codec, level);
+	else
+		dapm->bias_level = level;
+	if (ret != 0)
+		goto out;
 
+	if (card && card->set_bias_level_post)
+		ret = card->set_bias_level_post(card, level);
+out:
 	trace_snd_soc_bias_level_done(card, level);
 
 	return ret;
-- 
1.7.5.3

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

* [PATCH 4/6] ASoC: Add context parameter to card DAPM callbacks
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
  2011-06-06 18:18 ` [PATCH 2/6] ASoC: Remove trace for DAPM bias level logging Mark Brown
  2011-06-06 18:18 ` [PATCH 3/6] ASoC: Simplify logic in snd_soc_dapm_set_bias_level() Mark Brown
@ 2011-06-06 18:18 ` Mark Brown
  2011-06-06 18:18 ` [PATCH 5/6] ASoC: Only provide a default bias level update for CODEC contexts Mark Brown
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

The card callback will get called for each DAPM context in the card so it
can be useful for it to know which device is currently undergoing a
transition.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc.h              |    2 ++
 sound/soc/atmel/sam9g20_wm8731.c |    1 +
 sound/soc/omap/ams-delta.c       |    3 ++-
 sound/soc/samsung/speyside.c     |    4 ++++
 sound/soc/soc-dapm.c             |    4 ++--
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0f29700..f55efc1 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -726,8 +726,10 @@ struct snd_soc_card {
 
 	/* callbacks */
 	int (*set_bias_level)(struct snd_soc_card *,
+			      struct snd_soc_dapm_context *dapm,
 			      enum snd_soc_bias_level level);
 	int (*set_bias_level_post)(struct snd_soc_card *,
+				   struct snd_soc_dapm_context *dapm,
 				   enum snd_soc_bias_level level);
 
 	long pmdown_time;
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 95572d2..bad3aa1 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -92,6 +92,7 @@ static struct snd_soc_ops at91sam9g20ek_ops = {
 };
 
 static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card,
+					struct snd_soc_dapm_context *dapm,
 					enum snd_soc_bias_level level)
 {
 	static int mclk_on;
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index 462cbcb..b40095a 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -427,7 +427,8 @@ static struct snd_soc_ops ams_delta_ops = {
 
 /* Board specific codec bias level control */
 static int ams_delta_set_bias_level(struct snd_soc_card *card,
-					enum snd_soc_bias_level level)
+				    struct snd_soc_dapm_context *dapm,
+				    enum snd_soc_bias_level level)
 {
 	struct snd_soc_codec *codec = card->rtd->codec;
 
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 93078b1..99fb033 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -20,11 +20,15 @@
 #define WM8915_HPSEL_GPIO 214
 
 static int speyside_set_bias_level(struct snd_soc_card *card,
+				   struct snd_soc_dapm_context *dapm,
 				   enum snd_soc_bias_level level)
 {
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
 	int ret;
 
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
 	switch (level) {
 	case SND_SOC_BIAS_STANDBY:
 		ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_MCLK2,
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d989dd7..1682834 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -142,7 +142,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 	trace_snd_soc_bias_level_start(card, level);
 
 	if (card && card->set_bias_level)
-		ret = card->set_bias_level(card, level);
+		ret = card->set_bias_level(card, dapm, level);
 	if (ret != 0)
 		goto out;
 
@@ -154,7 +154,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 		goto out;
 
 	if (card && card->set_bias_level_post)
-		ret = card->set_bias_level_post(card, level);
+		ret = card->set_bias_level_post(card, dapm, level);
 out:
 	trace_snd_soc_bias_level_done(card, level);
 
-- 
1.7.5.3

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

* [PATCH 5/6] ASoC: Only provide a default bias level update for CODEC contexts
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
                   ` (2 preceding siblings ...)
  2011-06-06 18:18 ` [PATCH 4/6] ASoC: Add context parameter to card DAPM callbacks Mark Brown
@ 2011-06-06 18:18 ` Mark Brown
  2011-06-06 18:18 ` [PATCH 6/6] ASoC: Manage Speyside system clocking only in bias management Mark Brown
  2011-06-06 19:35 ` [PATCH 1/6] ASoC: Indentation fix for null loop operation Liam Girdwood
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

This allows the card driver to use the bias level variable more easily in
multi component systems.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/soc-dapm.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1682834..34106bc 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -146,10 +146,13 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 	if (ret != 0)
 		goto out;
 
-	if (dapm->codec && dapm->codec->driver->set_bias_level)
-		ret = dapm->codec->driver->set_bias_level(dapm->codec, level);
-	else
-		dapm->bias_level = level;
+	if (dapm->codec) {
+		if (dapm->codec->driver->set_bias_level)
+			ret = dapm->codec->driver->set_bias_level(dapm->codec,
+								  level);
+		else
+			dapm->bias_level = level;
+	}
 	if (ret != 0)
 		goto out;
 
-- 
1.7.5.3

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

* [PATCH 6/6] ASoC: Manage Speyside system clocking only in bias management
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
                   ` (3 preceding siblings ...)
  2011-06-06 18:18 ` [PATCH 5/6] ASoC: Only provide a default bias level update for CODEC contexts Mark Brown
@ 2011-06-06 18:18 ` Mark Brown
  2011-06-06 19:35 ` [PATCH 1/6] ASoC: Indentation fix for null loop operation Liam Girdwood
  5 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-06-06 18:18 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Now that the CODEC driver supports it defer configuration of the system
clock until bias management which is a much more idiomatic place to do
system power control and makes things a lot more happy when we're using
both interfaces.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/samsung/speyside.c |   50 +++++++++++++++++++++++++++++++++--------
 1 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 99fb033..2515dba 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -42,11 +42,51 @@ static int speyside_set_bias_level(struct snd_soc_card *card,
 			pr_err("Failed to stop FLL\n");
 			return ret;
 		}
+		break;
+
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+static int speyside_set_bias_level_post(struct snd_soc_card *card,
+					struct snd_soc_dapm_context *dapm,
+					enum snd_soc_bias_level level)
+{
+	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
+	int ret;
+
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
+	switch (level) {
+	case SND_SOC_BIAS_PREPARE:
+		if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
+			ret = snd_soc_dai_set_pll(codec_dai, 0,
+						  WM8915_FLL_MCLK2,
+						  32768, 48000 * 256);
+			if (ret < 0) {
+				pr_err("Failed to start FLL\n");
+				return ret;
+			}
+
+			ret = snd_soc_dai_set_sysclk(codec_dai,
+						     WM8915_SYSCLK_FLL,
+						     48000 * 256,
+						     SND_SOC_CLOCK_IN);
+			if (ret < 0)
+				return ret;
+		}
+		break;
 
 	default:
 		break;
 	}
 
+	card->dapm.bias_level = level;
+
 	return 0;
 }
 
@@ -70,16 +110,6 @@ static int speyside_hw_params(struct snd_pcm_substream *substream,
 	if (ret < 0)
 		return ret;
 
-	ret = snd_soc_dai_set_pll(codec_dai, 0, WM8915_FLL_MCLK2,
-				  32768, 256 * 48000);
-	if (ret < 0)
-		return ret;
-
-	ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_FLL,
-				     256 * 48000, SND_SOC_CLOCK_IN);
-	if (ret < 0)
-		return ret;
-
 	return 0;
 }
 
-- 
1.7.5.3

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

* Re: [PATCH 1/6] ASoC: Indentation fix for null loop operation
  2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
                   ` (4 preceding siblings ...)
  2011-06-06 18:18 ` [PATCH 6/6] ASoC: Manage Speyside system clocking only in bias management Mark Brown
@ 2011-06-06 19:35 ` Liam Girdwood
  5 siblings, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2011-06-06 19:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com

On 06/06/11 19:18, Mark Brown wrote:
> More with the legibility.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  sound/soc/soc-dapm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index 6be6546..988cdff 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -209,7 +209,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
>  		int val, item, bitmask;
>  
>  		for (bitmask = 1; bitmask < e->max; bitmask <<= 1)
> -		;
> +			;
>  		val = snd_soc_read(w->codec, e->reg);
>  		item = (val >> e->shift_l) & (bitmask - 1);
>  

All


Acked-by: Liam Girdwood <lrg@ti.com>

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

end of thread, other threads:[~2011-06-06 19:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 18:18 [PATCH 1/6] ASoC: Indentation fix for null loop operation Mark Brown
2011-06-06 18:18 ` [PATCH 2/6] ASoC: Remove trace for DAPM bias level logging Mark Brown
2011-06-06 18:18 ` [PATCH 3/6] ASoC: Simplify logic in snd_soc_dapm_set_bias_level() Mark Brown
2011-06-06 18:18 ` [PATCH 4/6] ASoC: Add context parameter to card DAPM callbacks Mark Brown
2011-06-06 18:18 ` [PATCH 5/6] ASoC: Only provide a default bias level update for CODEC contexts Mark Brown
2011-06-06 18:18 ` [PATCH 6/6] ASoC: Manage Speyside system clocking only in bias management Mark Brown
2011-06-06 19:35 ` [PATCH 1/6] ASoC: Indentation fix for null loop operation Liam Girdwood

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.