ASoC: qcom: apq8016: add wrdma support

This patch adds wrdma support in lpass-apq8016 by providing the register
offsets and adding support in dma channel allocation callback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Srinivas Kandagatla 2016-02-11 12:19:30 +00:00 committed by Mark Brown
parent bbedefb9e8
commit 6a9364ca6f
1 changed files with 19 additions and 3 deletions

View File

@ -137,11 +137,23 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
int direction) int direction)
{ {
struct lpass_variant *v = drvdata->variant; struct lpass_variant *v = drvdata->variant;
int chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, int chan = 0;
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
v->rdma_channels); v->rdma_channels);
if (chan >= v->rdma_channels) if (chan >= v->rdma_channels)
return -EBUSY; return -EBUSY;
} else {
chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
v->wrdma_channel_start +
v->wrdma_channels,
v->wrdma_channel_start);
if (chan >= v->wrdma_channel_start + v->wrdma_channels)
return -EBUSY;
}
set_bit(chan, &drvdata->dma_ch_bit_map); set_bit(chan, &drvdata->dma_ch_bit_map);
@ -214,6 +226,10 @@ static struct lpass_variant apq8016_data = {
.rdma_reg_stride = 0x1000, .rdma_reg_stride = 0x1000,
.rdma_channels = 2, .rdma_channels = 2,
.dmactl_audif_start = 1, .dmactl_audif_start = 1,
.wrdma_reg_base = 0xB000,
.wrdma_reg_stride = 0x1000,
.wrdma_channel_start = 5,
.wrdma_channels = 2,
.dai_driver = apq8016_lpass_cpu_dai_driver, .dai_driver = apq8016_lpass_cpu_dai_driver,
.num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver), .num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver),
.init = apq8016_lpass_init, .init = apq8016_lpass_init,