aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-12 19:04:07 -0400
committerMark Brown <broonie@linaro.org>2014-03-12 19:04:07 -0400
commit3b93f0598c30a4d14b72223023fa56315eab15a4 (patch)
tree35e745a126733d8dfde2a9d023d66ec05099fcef
parent08fa654549bc427a7660a1c93d8ba5bd477618ba (diff)
parente48c6d7f01032c42907dc2cd81b73f95490c81a1 (diff)
Merge remote-tracking branch 'asoc/topic/pcm1792a' into asoc-next
-rw-r--r--sound/soc/codecs/pcm1792a.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/sound/soc/codecs/pcm1792a.c b/sound/soc/codecs/pcm1792a.c
index 7146653a8e16..3a80ba4452df 100644
--- a/sound/soc/codecs/pcm1792a.c
+++ b/sound/soc/codecs/pcm1792a.c
@@ -107,24 +107,35 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
107 struct snd_soc_codec *codec = dai->codec; 107 struct snd_soc_codec *codec = dai->codec;
108 struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec); 108 struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec);
109 int val = 0, ret; 109 int val = 0, ret;
110 int pcm_format = params_format(params);
111 110
112 priv->rate = params_rate(params); 111 priv->rate = params_rate(params);
113 112
114 switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) { 113 switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) {
115 case SND_SOC_DAIFMT_RIGHT_J: 114 case SND_SOC_DAIFMT_RIGHT_J:
116 if (pcm_format == SNDRV_PCM_FORMAT_S24_LE || 115 switch (params_width(params)) {
117 pcm_format == SNDRV_PCM_FORMAT_S32_LE) 116 case 24:
118 val = 0x02; 117 case 32:
119 else if (pcm_format == SNDRV_PCM_FORMAT_S16_LE) 118 val = 2;
120 val = 0x00; 119 break;
120 case 16:
121 val = 0;
122 break;
123 default:
124 return -EINVAL;
125 }
121 break; 126 break;
122 case SND_SOC_DAIFMT_I2S: 127 case SND_SOC_DAIFMT_I2S:
123 if (pcm_format == SNDRV_PCM_FORMAT_S24_LE || 128 switch (params_width(params)) {
124 pcm_format == SNDRV_PCM_FORMAT_S32_LE) 129 case 24:
125 val = 0x05; 130 case 32:
126 else if (pcm_format == SNDRV_PCM_FORMAT_S16_LE) 131 val = 5;
127 val = 0x04; 132 break;
133 case 16:
134 val = 4;
135 break;
136 default:
137 return -EINVAL;
138 }
128 break; 139 break;
129 default: 140 default:
130 dev_err(codec->dev, "Invalid DAI format\n"); 141 dev_err(codec->dev, "Invalid DAI format\n");