Commit 7c21a781 authored by Michal Bachraty's avatar Michal Bachraty Committed by Mark Brown

ASoC: davinci-pcm, davinci-mcasp: Clean up active_serializers

As pointed of by Vaibhav, commit message: "ASoC: davinci-mcasp: Add support for multichannel playback"
number of active serializers can be hidden into fifo_level variable, which is set in davimci-mcasp.
Signed-off-by: default avatarMichal Bachraty <michal.bachraty@streamunlimited.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 5cbad7d3
...@@ -834,17 +834,20 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, ...@@ -834,17 +834,20 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
int word_length; int word_length;
u8 fifo_level; u8 fifo_level;
u8 slots = dev->tdm_slots; u8 slots = dev->tdm_slots;
u8 active_serializers;
int channels; int channels;
struct snd_interval *pcm_channels = hw_param_interval(params, struct snd_interval *pcm_channels = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_CHANNELS); SNDRV_PCM_HW_PARAM_CHANNELS);
channels = pcm_channels->min; channels = pcm_channels->min;
active_serializers = (channels + slots - 1) / slots;
if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL) if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL)
return -EINVAL; return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
fifo_level = dev->txnumevt; fifo_level = dev->txnumevt * active_serializers;
else else
fifo_level = dev->rxnumevt; fifo_level = dev->rxnumevt * active_serializers;
if (dev->op_mode == DAVINCI_MCASP_DIT_MODE) if (dev->op_mode == DAVINCI_MCASP_DIT_MODE)
davinci_hw_dit_param(dev); davinci_hw_dit_param(dev);
...@@ -889,7 +892,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, ...@@ -889,7 +892,6 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
dma_params->acnt = dma_params->data_type; dma_params->acnt = dma_params->data_type;
dma_params->fifo_level = fifo_level; dma_params->fifo_level = fifo_level;
dma_params->active_serializers = (channels + slots - 1) / slots;
davinci_config_channel_size(dev, word_length); davinci_config_channel_size(dev, word_length);
return 0; return 0;
......
...@@ -181,7 +181,6 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) ...@@ -181,7 +181,6 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
unsigned short acnt; unsigned short acnt;
unsigned int count; unsigned int count;
unsigned int fifo_level; unsigned int fifo_level;
unsigned char serializers = prtd->params->active_serializers;
period_size = snd_pcm_lib_period_bytes(substream); period_size = snd_pcm_lib_period_bytes(substream);
dma_offset = prtd->period * period_size; dma_offset = prtd->period * period_size;
...@@ -195,14 +194,14 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) ...@@ -195,14 +194,14 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
data_type = prtd->params->data_type; data_type = prtd->params->data_type;
count = period_size / data_type; count = period_size / data_type;
if (fifo_level) if (fifo_level)
count /= fifo_level * serializers; count /= fifo_level;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
src = dma_pos; src = dma_pos;
dst = prtd->params->dma_addr; dst = prtd->params->dma_addr;
src_bidx = data_type; src_bidx = data_type;
dst_bidx = 4; dst_bidx = 4;
src_cidx = data_type * fifo_level * serializers; src_cidx = data_type * fifo_level;
dst_cidx = 0; dst_cidx = 0;
} else { } else {
src = prtd->params->dma_addr; src = prtd->params->dma_addr;
...@@ -210,7 +209,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) ...@@ -210,7 +209,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
src_bidx = 0; src_bidx = 0;
dst_bidx = data_type; dst_bidx = data_type;
src_cidx = 0; src_cidx = 0;
dst_cidx = data_type * fifo_level * serializers; dst_cidx = data_type * fifo_level;
} }
acnt = prtd->params->acnt; acnt = prtd->params->acnt;
...@@ -225,8 +224,8 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream) ...@@ -225,8 +224,8 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
ASYNC); ASYNC);
else else
edma_set_transfer_params(prtd->asp_link[0], acnt, edma_set_transfer_params(prtd->asp_link[0], acnt,
fifo_level * serializers, fifo_level,
count, fifo_level * serializers, count, fifo_level,
ABSYNC); ABSYNC);
} }
......
...@@ -27,7 +27,6 @@ struct davinci_pcm_dma_params { ...@@ -27,7 +27,6 @@ struct davinci_pcm_dma_params {
unsigned char data_type; /* xfer data type */ unsigned char data_type; /* xfer data type */
unsigned char convert_mono_stereo; unsigned char convert_mono_stereo;
unsigned int fifo_level; unsigned int fifo_level;
unsigned char active_serializers; /* num. of active audio serializers */
}; };
int davinci_soc_platform_register(struct device *dev); int davinci_soc_platform_register(struct device *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment