diff options
Diffstat (limited to 'sound/soc/qcom/lpass-apq8016.c')
-rw-r--r-- | sound/soc/qcom/lpass-apq8016.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c index 94efc01020c4..3eef0c37ba50 100644 --- a/sound/soc/qcom/lpass-apq8016.c +++ b/sound/soc/qcom/lpass-apq8016.c | |||
@@ -133,23 +133,36 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = { | |||
133 | }, | 133 | }, |
134 | }; | 134 | }; |
135 | 135 | ||
136 | static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata) | 136 | static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata, |
137 | int direction) | ||
137 | { | 138 | { |
138 | struct lpass_variant *v = drvdata->variant; | 139 | struct lpass_variant *v = drvdata->variant; |
139 | int chan = find_first_zero_bit(&drvdata->rdma_ch_bit_map, | 140 | int chan = 0; |
141 | |||
142 | if (direction == SNDRV_PCM_STREAM_PLAYBACK) { | ||
143 | chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, | ||
140 | v->rdma_channels); | 144 | v->rdma_channels); |
141 | 145 | ||
142 | if (chan >= v->rdma_channels) | 146 | if (chan >= v->rdma_channels) |
143 | return -EBUSY; | 147 | return -EBUSY; |
148 | } else { | ||
149 | chan = find_next_zero_bit(&drvdata->dma_ch_bit_map, | ||
150 | v->wrdma_channel_start + | ||
151 | v->wrdma_channels, | ||
152 | v->wrdma_channel_start); | ||
153 | |||
154 | if (chan >= v->wrdma_channel_start + v->wrdma_channels) | ||
155 | return -EBUSY; | ||
156 | } | ||
144 | 157 | ||
145 | set_bit(chan, &drvdata->rdma_ch_bit_map); | 158 | set_bit(chan, &drvdata->dma_ch_bit_map); |
146 | 159 | ||
147 | return chan; | 160 | return chan; |
148 | } | 161 | } |
149 | 162 | ||
150 | static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan) | 163 | static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan) |
151 | { | 164 | { |
152 | clear_bit(chan, &drvdata->rdma_ch_bit_map); | 165 | clear_bit(chan, &drvdata->dma_ch_bit_map); |
153 | 166 | ||
154 | return 0; | 167 | return 0; |
155 | } | 168 | } |
@@ -212,7 +225,11 @@ static struct lpass_variant apq8016_data = { | |||
212 | .rdma_reg_base = 0x8400, | 225 | .rdma_reg_base = 0x8400, |
213 | .rdma_reg_stride = 0x1000, | 226 | .rdma_reg_stride = 0x1000, |
214 | .rdma_channels = 2, | 227 | .rdma_channels = 2, |
215 | .rdmactl_audif_start = 1, | 228 | .dmactl_audif_start = 1, |
229 | .wrdma_reg_base = 0xB000, | ||
230 | .wrdma_reg_stride = 0x1000, | ||
231 | .wrdma_channel_start = 5, | ||
232 | .wrdma_channels = 2, | ||
216 | .dai_driver = apq8016_lpass_cpu_dai_driver, | 233 | .dai_driver = apq8016_lpass_cpu_dai_driver, |
217 | .num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver), | 234 | .num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver), |
218 | .init = apq8016_lpass_init, | 235 | .init = apq8016_lpass_init, |