diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-17 02:35:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-21 03:47:39 -0500 |
commit | c94aa30edac4d328674e9c127918317009d30c1a (patch) | |
tree | 42870cb5423f9cabcc901eb6591ca2c212628062 /sound/soc/codecs | |
parent | f2c26d48d9c6e91c6b9c914f215952400e6f889b (diff) |
ASoC: arizona: Allow number of channels clocked to be restricted
Place a cap on the number of channels clocks are generated for. This is
intended for use with systems which have the WM5102 master an I2S bus with
multiple data lines.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/arizona.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 845d25630ba2..d855a6c098d4 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -762,18 +762,28 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
762 | struct snd_soc_dai *dai) | 762 | struct snd_soc_dai *dai) |
763 | { | 763 | { |
764 | struct snd_soc_codec *codec = dai->codec; | 764 | struct snd_soc_codec *codec = dai->codec; |
765 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
766 | struct arizona *arizona = priv->arizona; | ||
765 | int base = dai->driver->base; | 767 | int base = dai->driver->base; |
766 | const int *rates; | 768 | const int *rates; |
767 | int i, ret; | 769 | int i, ret; |
768 | int bclk, lrclk, wl, frame; | 770 | int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1]; |
771 | int bclk, lrclk, wl, frame, bclk_target; | ||
769 | 772 | ||
770 | if (params_rate(params) % 8000) | 773 | if (params_rate(params) % 8000) |
771 | rates = &arizona_44k1_bclk_rates[0]; | 774 | rates = &arizona_44k1_bclk_rates[0]; |
772 | else | 775 | else |
773 | rates = &arizona_48k_bclk_rates[0]; | 776 | rates = &arizona_48k_bclk_rates[0]; |
774 | 777 | ||
778 | bclk_target = snd_soc_params_to_bclk(params); | ||
779 | if (chan_limit && chan_limit < params_channels(params)) { | ||
780 | arizona_aif_dbg(dai, "Limiting to %d channels\n", chan_limit); | ||
781 | bclk_target /= params_channels(params); | ||
782 | bclk_target *= chan_limit; | ||
783 | } | ||
784 | |||
775 | for (i = 0; i < ARRAY_SIZE(arizona_44k1_bclk_rates); i++) { | 785 | for (i = 0; i < ARRAY_SIZE(arizona_44k1_bclk_rates); i++) { |
776 | if (rates[i] >= snd_soc_params_to_bclk(params) && | 786 | if (rates[i] >= bclk_target && |
777 | rates[i] % params_rate(params) == 0) { | 787 | rates[i] % params_rate(params) == 0) { |
778 | bclk = i; | 788 | bclk = i; |
779 | break; | 789 | break; |