diff options
Diffstat (limited to 'sound/soc/ep93xx/ep93xx-i2s.c')
-rw-r--r-- | sound/soc/ep93xx/ep93xx-i2s.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c index fff579a1c134..042f4e93746f 100644 --- a/sound/soc/ep93xx/ep93xx-i2s.c +++ b/sound/soc/ep93xx/ep93xx-i2s.c | |||
@@ -242,7 +242,7 @@ static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
242 | { | 242 | { |
243 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); | 243 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
244 | unsigned word_len, div, sdiv, lrdiv; | 244 | unsigned word_len, div, sdiv, lrdiv; |
245 | int found = 0, err; | 245 | int err; |
246 | 246 | ||
247 | switch (params_format(params)) { | 247 | switch (params_format(params)) { |
248 | case SNDRV_PCM_FORMAT_S16_LE: | 248 | case SNDRV_PCM_FORMAT_S16_LE: |
@@ -275,15 +275,14 @@ static int ep93xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
275 | * the codec uses. | 275 | * the codec uses. |
276 | */ | 276 | */ |
277 | div = clk_get_rate(info->mclk) / params_rate(params); | 277 | div = clk_get_rate(info->mclk) / params_rate(params); |
278 | for (sdiv = 2; sdiv <= 4; sdiv += 2) | 278 | sdiv = 4; |
279 | for (lrdiv = 64; lrdiv <= 128; lrdiv <<= 1) | 279 | if (div > (256 + 512) / 2) { |
280 | if (sdiv * lrdiv == div) { | 280 | lrdiv = 128; |
281 | found = 1; | 281 | } else { |
282 | goto out; | 282 | lrdiv = 64; |
283 | } | 283 | if (div < (128 + 256) / 2) |
284 | out: | 284 | sdiv = 2; |
285 | if (!found) | 285 | } |
286 | return -EINVAL; | ||
287 | 286 | ||
288 | err = clk_set_rate(info->sclk, clk_get_rate(info->mclk) / sdiv); | 287 | err = clk_set_rate(info->sclk, clk_get_rate(info->mclk) / sdiv); |
289 | if (err) | 288 | if (err) |
@@ -314,10 +313,12 @@ static int ep93xx_i2s_suspend(struct snd_soc_dai *dai) | |||
314 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); | 313 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
315 | 314 | ||
316 | if (!dai->active) | 315 | if (!dai->active) |
317 | return; | 316 | return 0; |
318 | 317 | ||
319 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK); | 318 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_PLAYBACK); |
320 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_CAPTURE); | 319 | ep93xx_i2s_disable(info, SNDRV_PCM_STREAM_CAPTURE); |
320 | |||
321 | return 0; | ||
321 | } | 322 | } |
322 | 323 | ||
323 | static int ep93xx_i2s_resume(struct snd_soc_dai *dai) | 324 | static int ep93xx_i2s_resume(struct snd_soc_dai *dai) |
@@ -325,10 +326,12 @@ static int ep93xx_i2s_resume(struct snd_soc_dai *dai) | |||
325 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); | 326 | struct ep93xx_i2s_info *info = snd_soc_dai_get_drvdata(dai); |
326 | 327 | ||
327 | if (!dai->active) | 328 | if (!dai->active) |
328 | return; | 329 | return 0; |
329 | 330 | ||
330 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK); | 331 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_PLAYBACK); |
331 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_CAPTURE); | 332 | ep93xx_i2s_enable(info, SNDRV_PCM_STREAM_CAPTURE); |
333 | |||
334 | return 0; | ||
332 | } | 335 | } |
333 | #else | 336 | #else |
334 | #define ep93xx_i2s_suspend NULL | 337 | #define ep93xx_i2s_suspend NULL |
@@ -352,13 +355,13 @@ static struct snd_soc_dai_driver ep93xx_i2s_dai = { | |||
352 | .playback = { | 355 | .playback = { |
353 | .channels_min = 2, | 356 | .channels_min = 2, |
354 | .channels_max = 2, | 357 | .channels_max = 2, |
355 | .rates = SNDRV_PCM_RATE_8000_96000, | 358 | .rates = SNDRV_PCM_RATE_8000_192000, |
356 | .formats = EP93XX_I2S_FORMATS, | 359 | .formats = EP93XX_I2S_FORMATS, |
357 | }, | 360 | }, |
358 | .capture = { | 361 | .capture = { |
359 | .channels_min = 2, | 362 | .channels_min = 2, |
360 | .channels_max = 2, | 363 | .channels_max = 2, |
361 | .rates = SNDRV_PCM_RATE_8000_96000, | 364 | .rates = SNDRV_PCM_RATE_8000_192000, |
362 | .formats = EP93XX_I2S_FORMATS, | 365 | .formats = EP93XX_I2S_FORMATS, |
363 | }, | 366 | }, |
364 | .ops = &ep93xx_i2s_dai_ops, | 367 | .ops = &ep93xx_i2s_dai_ops, |