Lines Matching +full:lpass +full:- +full:lpaif

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
5 * lpass-apq8016.c -- ALSA SoC CPU DAI driver for APQ8016 LPASS
19 #include <sound/soc-dai.h>
21 #include <dt-bindings/sound/apq8016-lpass.h>
22 #include "lpass-lpaif-reg.h"
23 #include "lpass.h"
126 const struct lpass_variant *v = drvdata->variant; in apq8016_lpass_alloc_dma_channel()
130 chan = find_first_zero_bit(&drvdata->dma_ch_bit_map, in apq8016_lpass_alloc_dma_channel()
131 v->rdma_channels); in apq8016_lpass_alloc_dma_channel()
133 if (chan >= v->rdma_channels) in apq8016_lpass_alloc_dma_channel()
134 return -EBUSY; in apq8016_lpass_alloc_dma_channel()
136 chan = find_next_zero_bit(&drvdata->dma_ch_bit_map, in apq8016_lpass_alloc_dma_channel()
137 v->wrdma_channel_start + in apq8016_lpass_alloc_dma_channel()
138 v->wrdma_channels, in apq8016_lpass_alloc_dma_channel()
139 v->wrdma_channel_start); in apq8016_lpass_alloc_dma_channel()
141 if (chan >= v->wrdma_channel_start + v->wrdma_channels) in apq8016_lpass_alloc_dma_channel()
142 return -EBUSY; in apq8016_lpass_alloc_dma_channel()
145 set_bit(chan, &drvdata->dma_ch_bit_map); in apq8016_lpass_alloc_dma_channel()
152 clear_bit(chan, &drvdata->dma_ch_bit_map); in apq8016_lpass_free_dma_channel()
160 const struct lpass_variant *variant = drvdata->variant; in apq8016_lpass_init()
161 struct device *dev = &pdev->dev; in apq8016_lpass_init()
165 drvdata->clks = devm_kcalloc(dev, variant->num_clks, in apq8016_lpass_init()
166 sizeof(*drvdata->clks), GFP_KERNEL); in apq8016_lpass_init()
167 if (!drvdata->clks) in apq8016_lpass_init()
168 return -ENOMEM; in apq8016_lpass_init()
169 drvdata->num_clks = variant->num_clks; in apq8016_lpass_init()
171 for (i = 0; i < drvdata->num_clks; i++) in apq8016_lpass_init()
172 drvdata->clks[i].id = variant->clk_name[i]; in apq8016_lpass_init()
174 ret = devm_clk_bulk_get(dev, drvdata->num_clks, drvdata->clks); in apq8016_lpass_init()
180 ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks); in apq8016_lpass_init()
186 drvdata->ahbix_clk = devm_clk_get(dev, "ahbix-clk"); in apq8016_lpass_init()
187 if (IS_ERR(drvdata->ahbix_clk)) { in apq8016_lpass_init()
188 dev_err(dev, "error getting ahbix-clk: %ld\n", in apq8016_lpass_init()
189 PTR_ERR(drvdata->ahbix_clk)); in apq8016_lpass_init()
190 ret = PTR_ERR(drvdata->ahbix_clk); in apq8016_lpass_init()
194 ret = clk_set_rate(drvdata->ahbix_clk, LPASS_AHBIX_CLOCK_FREQUENCY); in apq8016_lpass_init()
200 clk_get_rate(drvdata->ahbix_clk)); in apq8016_lpass_init()
202 ret = clk_prepare_enable(drvdata->ahbix_clk); in apq8016_lpass_init()
211 clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks); in apq8016_lpass_init()
219 clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clks); in apq8016_lpass_exit()
220 clk_disable_unprepare(drvdata->ahbix_clk); in apq8016_lpass_exit()
266 "pcnoc-mport-clk",
267 "pcnoc-sway-clk",
273 "mi2s-osr-clk0",
274 "mi2s-osr-clk1",
275 "mi2s-osr-clk2",
276 "mi2s-osr-clk3",
279 "mi2s-bit-clk0",
280 "mi2s-bit-clk1",
281 "mi2s-bit-clk2",
282 "mi2s-bit-clk3",
291 { .compatible = "qcom,lpass-cpu-apq8016", .data = &apq8016_data },
292 { .compatible = "qcom,apq8016-lpass-cpu", .data = &apq8016_data },
299 .name = "apq8016-lpass-cpu",
307 MODULE_DESCRIPTION("APQ8016 LPASS CPU Driver");