Lines Matching +full:sc7180 +full:- +full:lpass +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
5 * lpass-sc7180.c -- ALSA SoC platform-machine driver for QTi LPASS
13 #include <dt-bindings/sound/sc7180-lpass.h>
15 #include "lpass-lpaif-reg.h"
16 #include "lpass.h"
115 struct lpass_variant *v = drvdata->variant; in sc7280_lpass_alloc_dma_channel()
121 chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
122 v->rdma_channels); in sc7280_lpass_alloc_dma_channel()
124 if (chan >= v->rdma_channels) in sc7280_lpass_alloc_dma_channel()
125 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
127 chan = find_next_zero_bit(&drvdata->dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
128 v->wrdma_channel_start + in sc7280_lpass_alloc_dma_channel()
129 v->wrdma_channels, in sc7280_lpass_alloc_dma_channel()
130 v->wrdma_channel_start); in sc7280_lpass_alloc_dma_channel()
132 if (chan >= v->wrdma_channel_start + v->wrdma_channels) in sc7280_lpass_alloc_dma_channel()
133 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
135 set_bit(chan, &drvdata->dma_ch_bit_map); in sc7280_lpass_alloc_dma_channel()
138 chan = find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
139 v->hdmi_rdma_channels); in sc7280_lpass_alloc_dma_channel()
140 if (chan >= v->hdmi_rdma_channels) in sc7280_lpass_alloc_dma_channel()
141 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
142 set_bit(chan, &drvdata->hdmi_dma_ch_bit_map); in sc7280_lpass_alloc_dma_channel()
145 chan = find_first_zero_bit(&drvdata->rxtx_dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
146 v->rxtx_rdma_channels); in sc7280_lpass_alloc_dma_channel()
147 if (chan >= v->rxtx_rdma_channels) in sc7280_lpass_alloc_dma_channel()
148 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
151 chan = find_next_zero_bit(&drvdata->rxtx_dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
152 v->rxtx_wrdma_channel_start + in sc7280_lpass_alloc_dma_channel()
153 v->rxtx_wrdma_channels, in sc7280_lpass_alloc_dma_channel()
154 v->rxtx_wrdma_channel_start); in sc7280_lpass_alloc_dma_channel()
155 if (chan >= v->rxtx_wrdma_channel_start + v->rxtx_wrdma_channels) in sc7280_lpass_alloc_dma_channel()
156 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
157 set_bit(chan, &drvdata->rxtx_dma_ch_bit_map); in sc7280_lpass_alloc_dma_channel()
160 chan = find_next_zero_bit(&drvdata->va_dma_ch_bit_map, in sc7280_lpass_alloc_dma_channel()
161 v->va_wrdma_channel_start + in sc7280_lpass_alloc_dma_channel()
162 v->va_wrdma_channels, in sc7280_lpass_alloc_dma_channel()
163 v->va_wrdma_channel_start); in sc7280_lpass_alloc_dma_channel()
164 if (chan >= v->va_wrdma_channel_start + v->va_wrdma_channels) in sc7280_lpass_alloc_dma_channel()
165 return -EBUSY; in sc7280_lpass_alloc_dma_channel()
166 set_bit(chan, &drvdata->va_dma_ch_bit_map); in sc7280_lpass_alloc_dma_channel()
179 clear_bit(chan, &drvdata->dma_ch_bit_map); in sc7280_lpass_free_dma_channel()
182 clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map); in sc7280_lpass_free_dma_channel()
186 clear_bit(chan, &drvdata->rxtx_dma_ch_bit_map); in sc7280_lpass_free_dma_channel()
189 clear_bit(chan, &drvdata->va_dma_ch_bit_map); in sc7280_lpass_free_dma_channel()
201 struct lpass_variant *variant = drvdata->variant; in sc7280_lpass_init()
202 struct device *dev = &pdev->dev; in sc7280_lpass_init()
205 drvdata->clks = devm_kcalloc(dev, variant->num_clks, in sc7280_lpass_init()
206 sizeof(*drvdata->clks), GFP_KERNEL); in sc7280_lpass_init()
207 if (!drvdata->clks) in sc7280_lpass_init()
208 return -ENOMEM; in sc7280_lpass_init()
210 drvdata->num_clks = variant->num_clks; in sc7280_lpass_init()
212 for (i = 0; i < drvdata->num_clks; i++) in sc7280_lpass_init()
213 drvdata->clks[i].id = variant->clk_name[i]; in sc7280_lpass_init()
215 ret = devm_clk_bulk_get(dev, drvdata->num_clks, drvdata->clks); in sc7280_lpass_init()
221 ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks); in sc7280_lpass_init()
234 clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks); in sc7280_lpass_exit()
420 {.compatible = "qcom,sc7280-lpass-cpu", .data = &sc7280_data},
427 .name = "sc7280-lpass-cpu",
437 MODULE_DESCRIPTION("SC7280 LPASS CPU DRIVER");