diff options
-rw-r--r-- | sound/soc/codecs/wm8776.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 0cfbfc1dc093..5b17627aab0f 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -216,8 +216,6 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream, | |||
216 | int ratio_shift, master; | 216 | int ratio_shift, master; |
217 | int i; | 217 | int i; |
218 | 218 | ||
219 | iface = 0; | ||
220 | |||
221 | switch (dai->driver->id) { | 219 | switch (dai->driver->id) { |
222 | case WM8776_DAI_DAC: | 220 | case WM8776_DAI_DAC: |
223 | iface_reg = WM8776_DACIFCTRL; | 221 | iface_reg = WM8776_DACIFCTRL; |
@@ -233,20 +231,23 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream, | |||
233 | return -EINVAL; | 231 | return -EINVAL; |
234 | } | 232 | } |
235 | 233 | ||
236 | |||
237 | /* Set word length */ | 234 | /* Set word length */ |
238 | switch (params_format(params)) { | 235 | switch (snd_pcm_format_width(params_format(params))) { |
239 | case SNDRV_PCM_FORMAT_S16_LE: | 236 | case 16: |
237 | iface = 0; | ||
238 | case 20: | ||
239 | iface = 0x10; | ||
240 | break; | 240 | break; |
241 | case SNDRV_PCM_FORMAT_S20_3LE: | 241 | case 24: |
242 | iface |= 0x10; | 242 | iface = 0x20; |
243 | break; | 243 | break; |
244 | case SNDRV_PCM_FORMAT_S24_LE: | 244 | case 32: |
245 | iface |= 0x20; | 245 | iface = 0x30; |
246 | break; | ||
247 | case SNDRV_PCM_FORMAT_S32_LE: | ||
248 | iface |= 0x30; | ||
249 | break; | 246 | break; |
247 | default: | ||
248 | dev_err(codec->dev, "Unsupported sample size: %i\n", | ||
249 | snd_pcm_format_width(params_format(params))); | ||
250 | return -EINVAL; | ||
250 | } | 251 | } |
251 | 252 | ||
252 | /* Only need to set MCLK/LRCLK ratio if we're master */ | 253 | /* Only need to set MCLK/LRCLK ratio if we're master */ |