diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-07 12:14:56 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-12-08 08:56:31 -0500 |
commit | b1e43d933a3f1183e15d91b1737ecafb7de153eb (patch) | |
tree | 43c34da2e2a31375d59fcb892b40cad3b5d03595 /sound/soc/codecs | |
parent | e4f078d8c0790e94e09af975ca0b870e2f050e17 (diff) |
ASoC: Support WM8994 mono AIF configurations
The WM8994 supports mono signals - enable this in the driver. With DSP
mode an automatic data channel selector is available, activate this
when in mono mode.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/wm8994.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index b37e95c4e7c7..997fd178563f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -2099,10 +2099,12 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2099 | struct wm8994 *control = codec->control_data; | 2099 | struct wm8994 *control = codec->control_data; |
2100 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2100 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2101 | int aif1_reg; | 2101 | int aif1_reg; |
2102 | int aif2_reg; | ||
2102 | int bclk_reg; | 2103 | int bclk_reg; |
2103 | int lrclk_reg; | 2104 | int lrclk_reg; |
2104 | int rate_reg; | 2105 | int rate_reg; |
2105 | int aif1 = 0; | 2106 | int aif1 = 0; |
2107 | int aif2 = 0; | ||
2106 | int bclk = 0; | 2108 | int bclk = 0; |
2107 | int lrclk = 0; | 2109 | int lrclk = 0; |
2108 | int rate_val = 0; | 2110 | int rate_val = 0; |
@@ -2113,6 +2115,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2113 | switch (dai->id) { | 2115 | switch (dai->id) { |
2114 | case 1: | 2116 | case 1: |
2115 | aif1_reg = WM8994_AIF1_CONTROL_1; | 2117 | aif1_reg = WM8994_AIF1_CONTROL_1; |
2118 | aif2_reg = WM8994_AIF1_CONTROL_2; | ||
2116 | bclk_reg = WM8994_AIF1_BCLK; | 2119 | bclk_reg = WM8994_AIF1_BCLK; |
2117 | rate_reg = WM8994_AIF1_RATE; | 2120 | rate_reg = WM8994_AIF1_RATE; |
2118 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || | 2121 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || |
@@ -2125,6 +2128,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2125 | break; | 2128 | break; |
2126 | case 2: | 2129 | case 2: |
2127 | aif1_reg = WM8994_AIF2_CONTROL_1; | 2130 | aif1_reg = WM8994_AIF2_CONTROL_1; |
2131 | aif2_reg = WM8994_AIF2_CONTROL_2; | ||
2128 | bclk_reg = WM8994_AIF2_BCLK; | 2132 | bclk_reg = WM8994_AIF2_BCLK; |
2129 | rate_reg = WM8994_AIF2_RATE; | 2133 | rate_reg = WM8994_AIF2_RATE; |
2130 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || | 2134 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || |
@@ -2180,6 +2184,10 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2180 | dev_dbg(dai->dev, "AIF%dCLK is %dHz, target BCLK %dHz\n", | 2184 | dev_dbg(dai->dev, "AIF%dCLK is %dHz, target BCLK %dHz\n", |
2181 | dai->id, wm8994->aifclk[id], bclk_rate); | 2185 | dai->id, wm8994->aifclk[id], bclk_rate); |
2182 | 2186 | ||
2187 | if (params_channels(params) == 1 && | ||
2188 | (snd_soc_read(codec, aif1_reg) & 0x18) == 0x18) | ||
2189 | aif2 |= WM8994_AIF1_MONO; | ||
2190 | |||
2183 | if (wm8994->aifclk[id] == 0) { | 2191 | if (wm8994->aifclk[id] == 0) { |
2184 | dev_err(dai->dev, "AIF%dCLK not configured\n", dai->id); | 2192 | dev_err(dai->dev, "AIF%dCLK not configured\n", dai->id); |
2185 | return -EINVAL; | 2193 | return -EINVAL; |
@@ -2223,6 +2231,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2223 | lrclk, bclk_rate / lrclk); | 2231 | lrclk, bclk_rate / lrclk); |
2224 | 2232 | ||
2225 | snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); | 2233 | snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); |
2234 | snd_soc_update_bits(codec, aif2_reg, WM8994_AIF1_MONO, aif2); | ||
2226 | snd_soc_update_bits(codec, bclk_reg, WM8994_AIF1_BCLK_DIV_MASK, bclk); | 2235 | snd_soc_update_bits(codec, bclk_reg, WM8994_AIF1_BCLK_DIV_MASK, bclk); |
2227 | snd_soc_update_bits(codec, lrclk_reg, WM8994_AIF1DAC_RATE_MASK, | 2236 | snd_soc_update_bits(codec, lrclk_reg, WM8994_AIF1DAC_RATE_MASK, |
2228 | lrclk); | 2237 | lrclk); |
@@ -2378,14 +2387,14 @@ static struct snd_soc_dai_driver wm8994_dai[] = { | |||
2378 | .id = 1, | 2387 | .id = 1, |
2379 | .playback = { | 2388 | .playback = { |
2380 | .stream_name = "AIF1 Playback", | 2389 | .stream_name = "AIF1 Playback", |
2381 | .channels_min = 2, | 2390 | .channels_min = 1, |
2382 | .channels_max = 2, | 2391 | .channels_max = 2, |
2383 | .rates = WM8994_RATES, | 2392 | .rates = WM8994_RATES, |
2384 | .formats = WM8994_FORMATS, | 2393 | .formats = WM8994_FORMATS, |
2385 | }, | 2394 | }, |
2386 | .capture = { | 2395 | .capture = { |
2387 | .stream_name = "AIF1 Capture", | 2396 | .stream_name = "AIF1 Capture", |
2388 | .channels_min = 2, | 2397 | .channels_min = 1, |
2389 | .channels_max = 2, | 2398 | .channels_max = 2, |
2390 | .rates = WM8994_RATES, | 2399 | .rates = WM8994_RATES, |
2391 | .formats = WM8994_FORMATS, | 2400 | .formats = WM8994_FORMATS, |
@@ -2397,14 +2406,14 @@ static struct snd_soc_dai_driver wm8994_dai[] = { | |||
2397 | .id = 2, | 2406 | .id = 2, |
2398 | .playback = { | 2407 | .playback = { |
2399 | .stream_name = "AIF2 Playback", | 2408 | .stream_name = "AIF2 Playback", |
2400 | .channels_min = 2, | 2409 | .channels_min = 1, |
2401 | .channels_max = 2, | 2410 | .channels_max = 2, |
2402 | .rates = WM8994_RATES, | 2411 | .rates = WM8994_RATES, |
2403 | .formats = WM8994_FORMATS, | 2412 | .formats = WM8994_FORMATS, |
2404 | }, | 2413 | }, |
2405 | .capture = { | 2414 | .capture = { |
2406 | .stream_name = "AIF2 Capture", | 2415 | .stream_name = "AIF2 Capture", |
2407 | .channels_min = 2, | 2416 | .channels_min = 1, |
2408 | .channels_max = 2, | 2417 | .channels_max = 2, |
2409 | .rates = WM8994_RATES, | 2418 | .rates = WM8994_RATES, |
2410 | .formats = WM8994_FORMATS, | 2419 | .formats = WM8994_FORMATS, |
@@ -2416,14 +2425,14 @@ static struct snd_soc_dai_driver wm8994_dai[] = { | |||
2416 | .id = 3, | 2425 | .id = 3, |
2417 | .playback = { | 2426 | .playback = { |
2418 | .stream_name = "AIF3 Playback", | 2427 | .stream_name = "AIF3 Playback", |
2419 | .channels_min = 2, | 2428 | .channels_min = 1, |
2420 | .channels_max = 2, | 2429 | .channels_max = 2, |
2421 | .rates = WM8994_RATES, | 2430 | .rates = WM8994_RATES, |
2422 | .formats = WM8994_FORMATS, | 2431 | .formats = WM8994_FORMATS, |
2423 | }, | 2432 | }, |
2424 | .capture = { | 2433 | .capture = { |
2425 | .stream_name = "AIF3 Capture", | 2434 | .stream_name = "AIF3 Capture", |
2426 | .channels_min = 2, | 2435 | .channels_min = 1, |
2427 | .channels_max = 2, | 2436 | .channels_max = 2, |
2428 | .rates = WM8994_RATES, | 2437 | .rates = WM8994_RATES, |
2429 | .formats = WM8994_FORMATS, | 2438 | .formats = WM8994_FORMATS, |