aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8994.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r--sound/soc/codecs/wm8994.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 2b2dadc54dac..3fddc7ad1127 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -1045,6 +1045,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1045 struct snd_kcontrol *kcontrol, int event) 1045 struct snd_kcontrol *kcontrol, int event)
1046{ 1046{
1047 struct snd_soc_codec *codec = w->codec; 1047 struct snd_soc_codec *codec = w->codec;
1048 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1048 struct wm8994 *control = codec->control_data; 1049 struct wm8994 *control = codec->control_data;
1049 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; 1050 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
1050 int i; 1051 int i;
@@ -1063,6 +1064,10 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1063 1064
1064 switch (event) { 1065 switch (event) {
1065 case SND_SOC_DAPM_PRE_PMU: 1066 case SND_SOC_DAPM_PRE_PMU:
1067 /* Don't enable timeslot 2 if not in use */
1068 if (wm8994->channels[0] <= 2)
1069 mask &= ~(WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA);
1070
1066 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); 1071 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1);
1067 if ((val & WM8994_AIF1ADCL_SRC) && 1072 if ((val & WM8994_AIF1ADCL_SRC) &&
1068 (val & WM8994_AIF1ADCR_SRC)) 1073 (val & WM8994_AIF1ADCR_SRC))
@@ -2687,7 +2692,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
2687 return -EINVAL; 2692 return -EINVAL;
2688 } 2693 }
2689 2694
2690 bclk_rate = params_rate(params) * 4; 2695 bclk_rate = params_rate(params);
2691 switch (params_format(params)) { 2696 switch (params_format(params)) {
2692 case SNDRV_PCM_FORMAT_S16_LE: 2697 case SNDRV_PCM_FORMAT_S16_LE:
2693 bclk_rate *= 16; 2698 bclk_rate *= 16;
@@ -2708,6 +2713,17 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
2708 return -EINVAL; 2713 return -EINVAL;
2709 } 2714 }
2710 2715
2716 wm8994->channels[id] = params_channels(params);
2717 switch (params_channels(params)) {
2718 case 1:
2719 case 2:
2720 bclk_rate *= 2;
2721 break;
2722 default:
2723 bclk_rate *= 4;
2724 break;
2725 }
2726
2711 /* Try to find an appropriate sample rate; look for an exact match. */ 2727 /* Try to find an appropriate sample rate; look for an exact match. */
2712 for (i = 0; i < ARRAY_SIZE(srs); i++) 2728 for (i = 0; i < ARRAY_SIZE(srs); i++)
2713 if (srs[i].rate == params_rate(params)) 2729 if (srs[i].rate == params_rate(params))