diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-04 15:05:57 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-07-05 12:44:17 -0400 |
commit | c013b27a174e8a83d3c8df799aa37c897842efcb (patch) | |
tree | 249a559c39b0659a7f5c5cbb6210294810bca9dc /sound/soc/codecs | |
parent | 42810d16220484a104317007e3d8fe5269df017b (diff) |
ASoC: arizona: Enable ASYNCCLK domain for audio interfaces
If an audio interface is configured to use ASYNCCLK then update the
asynchronous sample rate rather than one of our primary sample rates.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/arizona.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 8e066ebf1227..d0bcca959111 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -507,6 +507,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
507 | struct snd_soc_dai *dai) | 507 | struct snd_soc_dai *dai) |
508 | { | 508 | { |
509 | struct snd_soc_codec *codec = dai->codec; | 509 | struct snd_soc_codec *codec = dai->codec; |
510 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
511 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | ||
510 | int base = dai->driver->base; | 512 | int base = dai->driver->base; |
511 | const int *rates; | 513 | const int *rates; |
512 | int i; | 514 | int i; |
@@ -530,10 +532,6 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
530 | return -EINVAL; | 532 | return -EINVAL; |
531 | } | 533 | } |
532 | 534 | ||
533 | /* | ||
534 | * We will need to be more flexible than this in future, | ||
535 | * currently we use a single sample rate for the chip. | ||
536 | */ | ||
537 | for (i = 0; i < ARRAY_SIZE(arizona_sr_vals); i++) | 535 | for (i = 0; i < ARRAY_SIZE(arizona_sr_vals); i++) |
538 | if (arizona_sr_vals[i] == params_rate(params)) | 536 | if (arizona_sr_vals[i] == params_rate(params)) |
539 | break; | 537 | break; |
@@ -552,8 +550,28 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
552 | wl = snd_pcm_format_width(params_format(params)); | 550 | wl = snd_pcm_format_width(params_format(params)); |
553 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; | 551 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; |
554 | 552 | ||
555 | snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, | 553 | /* |
556 | ARIZONA_SAMPLE_RATE_1_MASK, sr_val); | 554 | * We will need to be more flexible than this in future, |
555 | * currently we use a single sample rate for SYSCLK. | ||
556 | */ | ||
557 | switch (dai_priv->clk) { | ||
558 | case ARIZONA_CLK_SYSCLK: | ||
559 | snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, | ||
560 | ARIZONA_SAMPLE_RATE_1_MASK, sr_val); | ||
561 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
562 | ARIZONA_AIF1_RATE_MASK, 0); | ||
563 | break; | ||
564 | case ARIZONA_CLK_ASYNCCLK: | ||
565 | snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, | ||
566 | ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); | ||
567 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
568 | ARIZONA_AIF1_RATE_MASK, 8); | ||
569 | break; | ||
570 | default: | ||
571 | arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); | ||
572 | return -EINVAL; | ||
573 | } | ||
574 | |||
557 | snd_soc_update_bits(codec, base + ARIZONA_AIF_BCLK_CTRL, | 575 | snd_soc_update_bits(codec, base + ARIZONA_AIF_BCLK_CTRL, |
558 | ARIZONA_AIF1_BCLK_FREQ_MASK, bclk); | 576 | ARIZONA_AIF1_BCLK_FREQ_MASK, bclk); |
559 | snd_soc_update_bits(codec, base + ARIZONA_AIF_TX_BCLK_RATE, | 577 | snd_soc_update_bits(codec, base + ARIZONA_AIF_TX_BCLK_RATE, |