Skip to content

Commit

Permalink
ASoC: davinci-mcasp: Add Support BCLK-to-LRCLK ratio for TDM modes
Browse files Browse the repository at this point in the history
For TDM mode, BCLK-to-LCLK ratio is computed as (tdm_slots) x (word_length).
I2S mode is only subset of TDM mode with specific tdm_slots = 2 channels.
Also bclk_lrclk_ratio can be greater than 255, therefore u16 need to be used.

Signed-off-by: Michal Bachraty <[email protected]>
Acked-by: Daniel Mack <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Michal Bachraty authored and broonie committed Apr 23, 2013
1 parent 7c21a78 commit d486fea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions sound/soc/davinci/davinci-mcasp.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,11 +636,12 @@ static int davinci_config_channel_size(struct davinci_audio_dev *dev,
* callback, take it into account here. That allows us to for example
* send 32 bits per channel to the codec, while only 16 of them carry
* audio payload.
* The clock ratio is given for a full period of data (both left and
* right channels), so it has to be divided by 2.
* The clock ratio is given for a full period of data (for I2S format
* both left and right channels), so it has to be divided by number of
* tdm-slots (for I2S - divided by 2).
*/
if (dev->bclk_lrclk_ratio)
word_length = dev->bclk_lrclk_ratio / 2;
word_length = dev->bclk_lrclk_ratio / dev->tdm_slots;

/* mapping of the XSSZ bit-field as described in the datasheet */
fmt = (word_length >> 1) - 1;
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/davinci/davinci-mcasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct davinci_audio_dev {
u8 num_serializer;
u8 *serial_dir;
u8 version;
u8 bclk_lrclk_ratio;
u16 bclk_lrclk_ratio;

/* McASP FIFO related */
u8 txnumevt;
Expand Down

0 comments on commit d486fea

Please sign in to comment.