aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8994.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-22 18:05:10 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-23 06:57:11 -0400
commit778a76e2dbdb896d005849e9e74518d6aba85671 (patch)
tree37559db6336d9b6f86ce978bce9c3718102cef0c /sound/soc/codecs/wm8994.c
parent74511020dde10252f8b8e648690d99dba721de14 (diff)
ASoC: Implement WM8994 DAI tristate support
This also adds the first DAI operation for AIF3 so fill out the ID and the ops for that too. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r--sound/soc/codecs/wm8994.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 29f3771c33a4..d01d3091fe81 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3332,6 +3332,36 @@ static int wm8994_aif_mute(struct snd_soc_dai *codec_dai, int mute)
3332 return 0; 3332 return 0;
3333} 3333}
3334 3334
3335static int wm8994_set_tristate(struct snd_soc_dai *codec_dai, int tristate)
3336{
3337 struct snd_soc_codec *codec = codec_dai->codec;
3338 int reg, val, mask;
3339
3340 switch (codec_dai->id) {
3341 case 1:
3342 reg = WM8994_AIF1_MASTER_SLAVE;
3343 mask = WM8994_AIF1_TRI;
3344 break;
3345 case 2:
3346 reg = WM8994_AIF2_MASTER_SLAVE;
3347 mask = WM8994_AIF2_TRI;
3348 break;
3349 case 3:
3350 reg = WM8994_POWER_MANAGEMENT_6;
3351 mask = WM8994_AIF3_TRI;
3352 break;
3353 default:
3354 return -EINVAL;
3355 }
3356
3357 if (tristate)
3358 val = mask;
3359 else
3360 val = 0;
3361
3362 return snd_soc_update_bits(codec, reg, mask, reg);
3363}
3364
3335#define WM8994_RATES SNDRV_PCM_RATE_8000_96000 3365#define WM8994_RATES SNDRV_PCM_RATE_8000_96000
3336 3366
3337#define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 3367#define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
@@ -3343,6 +3373,7 @@ static struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
3343 .hw_params = wm8994_hw_params, 3373 .hw_params = wm8994_hw_params,
3344 .digital_mute = wm8994_aif_mute, 3374 .digital_mute = wm8994_aif_mute,
3345 .set_pll = wm8994_set_fll, 3375 .set_pll = wm8994_set_fll,
3376 .set_tristate = wm8994_set_tristate,
3346}; 3377};
3347 3378
3348static struct snd_soc_dai_ops wm8994_aif2_dai_ops = { 3379static struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
@@ -3351,6 +3382,11 @@ static struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
3351 .hw_params = wm8994_hw_params, 3382 .hw_params = wm8994_hw_params,
3352 .digital_mute = wm8994_aif_mute, 3383 .digital_mute = wm8994_aif_mute,
3353 .set_pll = wm8994_set_fll, 3384 .set_pll = wm8994_set_fll,
3385 .set_tristate = wm8994_set_tristate,
3386};
3387
3388static struct snd_soc_dai_ops wm8994_aif3_dai_ops = {
3389 .set_tristate = wm8994_set_tristate,
3354}; 3390};
3355 3391
3356struct snd_soc_dai wm8994_dai[] = { 3392struct snd_soc_dai wm8994_dai[] = {
@@ -3394,6 +3430,7 @@ struct snd_soc_dai wm8994_dai[] = {
3394 }, 3430 },
3395 { 3431 {
3396 .name = "WM8994 AIF3", 3432 .name = "WM8994 AIF3",
3433 .id = 3,
3397 .playback = { 3434 .playback = {
3398 .stream_name = "AIF3 Playback", 3435 .stream_name = "AIF3 Playback",
3399 .channels_min = 2, 3436 .channels_min = 2,
@@ -3408,6 +3445,7 @@ struct snd_soc_dai wm8994_dai[] = {
3408 .rates = WM8994_RATES, 3445 .rates = WM8994_RATES,
3409 .formats = WM8994_FORMATS, 3446 .formats = WM8994_FORMATS,
3410 }, 3447 },
3448 .ops = &wm8994_aif3_dai_ops,
3411 } 3449 }
3412}; 3450};
3413EXPORT_SYMBOL_GPL(wm8994_dai); 3451EXPORT_SYMBOL_GPL(wm8994_dai);