alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Allow source specification for CODEC level sysclk
@ 2011-08-24 19:09 Mark Brown
  2011-08-30 15:55 ` Lars-Peter Clausen
  2011-08-31 10:54 ` Liam Girdwood
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2011-08-24 19:09 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Mark Brown

Similarly to PLLs/FLLs some modern CODECs provide selectable system clock
sources. When the clock is the clock for a DAI we do not usually need to
identify which clock is being configured so can use clk_id for the source
clock but with CODEC wide system clocks we will need to specify both the
clock being configured and the source.

Add a source argument to the CODEC driver set_sysclk() operation to
reflect this. As this operation is not as widely used as the DAI
set_sysclk() operation the change is not very invasive. We probably
ought to go and make the same alternation for DAIs at some point.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/sound/soc.h          |    4 ++--
 sound/soc/codecs/wm9081.c    |    4 ++--
 sound/soc/samsung/speyside.c |    2 +-
 sound/soc/soc-core.c         |    8 +++++---
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0fc8f15..24e17be 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -276,7 +276,7 @@ enum snd_soc_pcm_subclass {
 };
 
 int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
-			     unsigned int freq, int dir);
+			     int source, unsigned int freq, int dir);
 int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
 			  unsigned int freq_in, unsigned int freq_out);
 
@@ -610,7 +610,7 @@ struct snd_soc_codec_driver {
 
 	/* codec wide operations */
 	int (*set_sysclk)(struct snd_soc_codec *codec,
-			  int clk_id, unsigned int freq, int dir);
+			  int clk_id, int source, unsigned int freq, int dir);
 	int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
 		unsigned int freq_in, unsigned int freq_out);
 
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index a469132..f32ab1e 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1120,8 +1120,8 @@ static int wm9081_digital_mute(struct snd_soc_dai *codec_dai, int mute)
 	return 0;
 }
 
-static int wm9081_set_sysclk(struct snd_soc_codec *codec,
-			     int clk_id, unsigned int freq, int dir)
+static int wm9081_set_sysclk(struct snd_soc_codec *codec, int clk_id,
+			     int source, unsigned int freq, int dir)
 {
 	struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
 
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 12e60e3..401ca22 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -223,7 +223,7 @@ static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm)
 	snd_soc_dapm_nc_pin(dapm, "LINEOUT");
 
 	/* At any time the WM9081 is active it will have this clock */
-	return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK,
+	return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0,
 					48000 * 256, 0);
 }
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fd173f6..187ddfd 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2670,7 +2670,7 @@ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
 	if (dai->driver && dai->driver->ops->set_sysclk)
 		return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir);
 	else if (dai->codec && dai->codec->driver->set_sysclk)
-		return dai->codec->driver->set_sysclk(dai->codec, clk_id,
+		return dai->codec->driver->set_sysclk(dai->codec, clk_id, 0,
 						      freq, dir);
 	else
 		return -EINVAL;
@@ -2681,16 +2681,18 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
  * snd_soc_codec_set_sysclk - configure CODEC system or master clock.
  * @codec: CODEC
  * @clk_id: DAI specific clock ID
+ * @source: Source for the clock
  * @freq: new clock frequency in Hz
  * @dir: new clock direction - input/output.
  *
  * Configures the CODEC master (MCLK) or system (SYSCLK) clocking.
  */
 int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
-	unsigned int freq, int dir)
+			     int source, unsigned int freq, int dir)
 {
 	if (codec->driver->set_sysclk)
-		return codec->driver->set_sysclk(codec, clk_id, freq, dir);
+		return codec->driver->set_sysclk(codec, clk_id, source,
+						 freq, dir);
 	else
 		return -EINVAL;
 }
-- 
1.7.5.4

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

* Re: [PATCH] ASoC: Allow source specification for CODEC level sysclk
  2011-08-24 19:09 [PATCH] ASoC: Allow source specification for CODEC level sysclk Mark Brown
@ 2011-08-30 15:55 ` Lars-Peter Clausen
  2011-08-30 15:58   ` Mark Brown
  2011-08-31 10:54 ` Liam Girdwood
  1 sibling, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2011-08-30 15:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Liam Girdwood

On 08/24/2011 09:09 PM, Mark Brown wrote:
> Similarly to PLLs/FLLs some modern CODECs provide selectable system clock
> sources. When the clock is the clock for a DAI we do not usually need to
> identify which clock is being configured so can use clk_id for the source
> clock but with CODEC wide system clocks we will need to specify both the
> clock being configured and the source.
> 
> Add a source argument to the CODEC driver set_sysclk() operation to
> reflect this. As this operation is not as widely used as the DAI
> set_sysclk() operation the change is not very invasive. We probably
> ought to go and make the same alternation for DAIs at some point.

If we also want to change the DAI driver's set_sysclck we should probably do
this better now than later, because the number of affected drivers is probably
not going to decline.

> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  include/sound/soc.h          |    4 ++--
>  sound/soc/codecs/wm9081.c    |    4 ++--
>  sound/soc/samsung/speyside.c |    2 +-
>  sound/soc/soc-core.c         |    8 +++++---

The adau1701 and adav80x drivers also implement the CODEC driver set_sysclk.

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

* Re: [PATCH] ASoC: Allow source specification for CODEC level sysclk
  2011-08-30 15:55 ` Lars-Peter Clausen
@ 2011-08-30 15:58   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2011-08-30 15:58 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: alsa-devel, patches, Liam Girdwood

On Tue, Aug 30, 2011 at 05:55:19PM +0200, Lars-Peter Clausen wrote:

> > Add a source argument to the CODEC driver set_sysclk() operation to
> > reflect this. As this operation is not as widely used as the DAI
> > set_sysclk() operation the change is not very invasive. We probably
> > ought to go and make the same alternation for DAIs at some point.

> If we also want to change the DAI driver's set_sysclck we should probably do
> this better now than later, because the number of affected drivers is probably
> not going to decline.

At some point; at any rate we don't need to do both in the same commit.

> The adau1701 and adav80x drivers also implement the CODEC driver set_sysclk.

I've actually fixed this up already in my local copy.

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

* Re: [PATCH] ASoC: Allow source specification for CODEC level sysclk
  2011-08-24 19:09 [PATCH] ASoC: Allow source specification for CODEC level sysclk Mark Brown
  2011-08-30 15:55 ` Lars-Peter Clausen
@ 2011-08-31 10:54 ` Liam Girdwood
  1 sibling, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2011-08-31 10:54 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com

On 24/08/11 20:09, Mark Brown wrote:
> Similarly to PLLs/FLLs some modern CODECs provide selectable system clock
> sources. When the clock is the clock for a DAI we do not usually need to
> identify which clock is being configured so can use clk_id for the source
> clock but with CODEC wide system clocks we will need to specify both the
> clock being configured and the source.
> 
> Add a source argument to the CODEC driver set_sysclk() operation to
> reflect this. As this operation is not as widely used as the DAI
> set_sysclk() operation the change is not very invasive. We probably
> ought to go and make the same alternation for DAIs at some point.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

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

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

end of thread, other threads:[~2011-08-31 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-24 19:09 [PATCH] ASoC: Allow source specification for CODEC level sysclk Mark Brown
2011-08-30 15:55 ` Lars-Peter Clausen
2011-08-30 15:58   ` Mark Brown
2011-08-31 10:54 ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).