diff options
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/davinci-mcasp.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index c28508da34cf..68347b55f6e1 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -403,7 +403,8 @@ out: | |||
403 | return ret; | 403 | return ret; |
404 | } | 404 | } |
405 | 405 | ||
406 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) | 406 | static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, |
407 | int div, bool explicit) | ||
407 | { | 408 | { |
408 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); | 409 | struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); |
409 | 410 | ||
@@ -420,7 +421,8 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
420 | ACLKXDIV(div - 1), ACLKXDIV_MASK); | 421 | ACLKXDIV(div - 1), ACLKXDIV_MASK); |
421 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, | 422 | mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, |
422 | ACLKRDIV(div - 1), ACLKRDIV_MASK); | 423 | ACLKRDIV(div - 1), ACLKRDIV_MASK); |
423 | mcasp->bclk_div = div; | 424 | if (explicit) |
425 | mcasp->bclk_div = div; | ||
424 | break; | 426 | break; |
425 | 427 | ||
426 | case 2: /* BCLK/LRCLK ratio */ | 428 | case 2: /* BCLK/LRCLK ratio */ |
@@ -434,6 +436,12 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div | |||
434 | return 0; | 436 | return 0; |
435 | } | 437 | } |
436 | 438 | ||
439 | static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, | ||
440 | int div) | ||
441 | { | ||
442 | return __davinci_mcasp_set_clkdiv(dai, div_id, div, 1); | ||
443 | } | ||
444 | |||
437 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, | 445 | static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
438 | unsigned int freq, int dir) | 446 | unsigned int freq, int dir) |
439 | { | 447 | { |
@@ -459,8 +467,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, | |||
459 | { | 467 | { |
460 | u32 fmt; | 468 | u32 fmt; |
461 | u32 tx_rotate = (word_length / 4) & 0x7; | 469 | u32 tx_rotate = (word_length / 4) & 0x7; |
462 | u32 rx_rotate = (32 - word_length) / 4; | ||
463 | u32 mask = (1ULL << word_length) - 1; | 470 | u32 mask = (1ULL << word_length) - 1; |
471 | /* | ||
472 | * For captured data we should not rotate, inversion and masking is | ||
473 | * enoguh to get the data to the right position: | ||
474 | * Format data from bus after reverse (XRBUF) | ||
475 | * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB| | ||
476 | * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
477 | * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
478 | * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB| | ||
479 | */ | ||
480 | u32 rx_rotate = 0; | ||
464 | 481 | ||
465 | /* | 482 | /* |
466 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() | 483 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() |
@@ -738,7 +755,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, | |||
738 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", | 755 | "Inaccurate BCLK: %u Hz / %u != %u Hz\n", |
739 | mcasp->sysclk_freq, div, bclk_freq); | 756 | mcasp->sysclk_freq, div, bclk_freq); |
740 | } | 757 | } |
741 | davinci_mcasp_set_clkdiv(cpu_dai, 1, div); | 758 | __davinci_mcasp_set_clkdiv(cpu_dai, 1, div, 0); |
742 | } | 759 | } |
743 | 760 | ||
744 | ret = mcasp_common_hw_param(mcasp, substream->stream, | 761 | ret = mcasp_common_hw_param(mcasp, substream->stream, |