aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-24 15:09:01 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-31 04:57:35 -0400
commitda1c6ea6cf85544292c30295c70a89e8555358bc (patch)
tree7407347d709bda251c58185909c3d5fc58178587
parentd2dd0540c1dab1ebe4192e69d8dbfcf018ff02b2 (diff)
ASoC: Allow source specification for CODEC level sysclk
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>
-rw-r--r--include/sound/soc.h4
-rw-r--r--sound/soc/codecs/adav80x.c3
-rw-r--r--sound/soc/codecs/wm9081.c4
-rw-r--r--sound/soc/samsung/speyside.c2
-rw-r--r--sound/soc/soc-core.c8
5 files changed, 12 insertions, 9 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0fc8f15f1aca..24e17be38c19 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -276,7 +276,7 @@ enum snd_soc_pcm_subclass {
276}; 276};
277 277
278int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, 278int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
279 unsigned int freq, int dir); 279 int source, unsigned int freq, int dir);
280int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, 280int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
281 unsigned int freq_in, unsigned int freq_out); 281 unsigned int freq_in, unsigned int freq_out);
282 282
@@ -610,7 +610,7 @@ struct snd_soc_codec_driver {
610 610
611 /* codec wide operations */ 611 /* codec wide operations */
612 int (*set_sysclk)(struct snd_soc_codec *codec, 612 int (*set_sysclk)(struct snd_soc_codec *codec,
613 int clk_id, unsigned int freq, int dir); 613 int clk_id, int source, unsigned int freq, int dir);
614 int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source, 614 int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
615 unsigned int freq_in, unsigned int freq_out); 615 unsigned int freq_in, unsigned int freq_out);
616 616
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index 300c04b70e71..f9f08948e5e8 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -523,7 +523,8 @@ static int adav80x_hw_params(struct snd_pcm_substream *substream,
523} 523}
524 524
525static int adav80x_set_sysclk(struct snd_soc_codec *codec, 525static int adav80x_set_sysclk(struct snd_soc_codec *codec,
526 int clk_id, unsigned int freq, int dir) 526 int clk_id, int source,
527 unsigned int freq, int dir)
527{ 528{
528 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 529 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
529 530
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index a4691321f9b3..f32ab1ee9647 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)
1120 return 0; 1120 return 0;
1121} 1121}
1122 1122
1123static int wm9081_set_sysclk(struct snd_soc_codec *codec, 1123static int wm9081_set_sysclk(struct snd_soc_codec *codec, int clk_id,
1124 int clk_id, unsigned int freq, int dir) 1124 int source, unsigned int freq, int dir)
1125{ 1125{
1126 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); 1126 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1127 1127
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index bfed1ff7093f..09df8afbb447 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)
223 snd_soc_dapm_nc_pin(dapm, "LINEOUT"); 223 snd_soc_dapm_nc_pin(dapm, "LINEOUT");
224 224
225 /* At any time the WM9081 is active it will have this clock */ 225 /* At any time the WM9081 is active it will have this clock */
226 return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 226 return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0,
227 48000 * 256, 0); 227 48000 * 256, 0);
228} 228}
229 229
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fc7fff3604f7..4ec93d1df047 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,
2670 if (dai->driver && dai->driver->ops->set_sysclk) 2670 if (dai->driver && dai->driver->ops->set_sysclk)
2671 return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir); 2671 return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir);
2672 else if (dai->codec && dai->codec->driver->set_sysclk) 2672 else if (dai->codec && dai->codec->driver->set_sysclk)
2673 return dai->codec->driver->set_sysclk(dai->codec, clk_id, 2673 return dai->codec->driver->set_sysclk(dai->codec, clk_id, 0,
2674 freq, dir); 2674 freq, dir);
2675 else 2675 else
2676 return -EINVAL; 2676 return -EINVAL;
@@ -2681,16 +2681,18 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
2681 * snd_soc_codec_set_sysclk - configure CODEC system or master clock. 2681 * snd_soc_codec_set_sysclk - configure CODEC system or master clock.
2682 * @codec: CODEC 2682 * @codec: CODEC
2683 * @clk_id: DAI specific clock ID 2683 * @clk_id: DAI specific clock ID
2684 * @source: Source for the clock
2684 * @freq: new clock frequency in Hz 2685 * @freq: new clock frequency in Hz
2685 * @dir: new clock direction - input/output. 2686 * @dir: new clock direction - input/output.
2686 * 2687 *
2687 * Configures the CODEC master (MCLK) or system (SYSCLK) clocking. 2688 * Configures the CODEC master (MCLK) or system (SYSCLK) clocking.
2688 */ 2689 */
2689int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, 2690int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
2690 unsigned int freq, int dir) 2691 int source, unsigned int freq, int dir)
2691{ 2692{
2692 if (codec->driver->set_sysclk) 2693 if (codec->driver->set_sysclk)
2693 return codec->driver->set_sysclk(codec, clk_id, freq, dir); 2694 return codec->driver->set_sysclk(codec, clk_id, source,
2695 freq, dir);
2694 else 2696 else
2695 return -EINVAL; 2697 return -EINVAL;
2696} 2698}