Lines Matching +full:clkdiv +full:- +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2012-2013, Analog Devices Inc.
4 * Author: Lars-Peter Clausen <lars@metafoo.de>
66 return -EINVAL; in axi_spdif_trigger()
69 regmap_update_bits(spdif->regmap, AXI_SPDIF_REG_CTRL, in axi_spdif_trigger()
80 unsigned int clkdiv, stat; in axi_spdif_hw_params() local
97 clkdiv = DIV_ROUND_CLOSEST(clk_get_rate(spdif->clk_ref), in axi_spdif_hw_params()
98 rate * 64 * 2) - 1; in axi_spdif_hw_params()
99 clkdiv <<= AXI_SPDIF_CTRL_CLKDIV_OFFSET; in axi_spdif_hw_params()
101 regmap_write(spdif->regmap, AXI_SPDIF_REG_STAT, stat); in axi_spdif_hw_params()
102 regmap_update_bits(spdif->regmap, AXI_SPDIF_REG_CTRL, in axi_spdif_hw_params()
103 AXI_SPDIF_CTRL_CLKDIV_MASK, clkdiv); in axi_spdif_hw_params()
112 snd_soc_dai_init_dma_data(dai, &spdif->dma_data, NULL); in axi_spdif_dai_probe()
123 ret = snd_pcm_hw_constraint_ratnums(substream->runtime, 0, in axi_spdif_startup()
125 &spdif->rate_constraints); in axi_spdif_startup()
129 ret = clk_prepare_enable(spdif->clk_ref); in axi_spdif_startup()
133 regmap_update_bits(spdif->regmap, AXI_SPDIF_REG_CTRL, in axi_spdif_startup()
144 regmap_update_bits(spdif->regmap, AXI_SPDIF_REG_CTRL, in axi_spdif_shutdown()
147 clk_disable_unprepare(spdif->clk_ref); in axi_spdif_shutdown()
169 .name = "axi-spdif",
187 spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); in axi_spdif_probe()
189 return -ENOMEM; in axi_spdif_probe()
197 spdif->regmap = devm_regmap_init_mmio(&pdev->dev, base, in axi_spdif_probe()
199 if (IS_ERR(spdif->regmap)) in axi_spdif_probe()
200 return PTR_ERR(spdif->regmap); in axi_spdif_probe()
202 spdif->clk = devm_clk_get(&pdev->dev, "axi"); in axi_spdif_probe()
203 if (IS_ERR(spdif->clk)) in axi_spdif_probe()
204 return PTR_ERR(spdif->clk); in axi_spdif_probe()
206 spdif->clk_ref = devm_clk_get(&pdev->dev, "ref"); in axi_spdif_probe()
207 if (IS_ERR(spdif->clk_ref)) in axi_spdif_probe()
208 return PTR_ERR(spdif->clk_ref); in axi_spdif_probe()
210 ret = clk_prepare_enable(spdif->clk); in axi_spdif_probe()
214 spdif->dma_data.addr = res->start + AXI_SPDIF_REG_TX_FIFO; in axi_spdif_probe()
215 spdif->dma_data.addr_width = 4; in axi_spdif_probe()
216 spdif->dma_data.maxburst = 1; in axi_spdif_probe()
218 spdif->ratnum.num = clk_get_rate(spdif->clk_ref) / 128; in axi_spdif_probe()
219 spdif->ratnum.den_step = 1; in axi_spdif_probe()
220 spdif->ratnum.den_min = 1; in axi_spdif_probe()
221 spdif->ratnum.den_max = 64; in axi_spdif_probe()
223 spdif->rate_constraints.rats = &spdif->ratnum; in axi_spdif_probe()
224 spdif->rate_constraints.nrats = 1; in axi_spdif_probe()
226 ret = devm_snd_soc_register_component(&pdev->dev, &axi_spdif_component, in axi_spdif_probe()
231 ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); in axi_spdif_probe()
238 clk_disable_unprepare(spdif->clk); in axi_spdif_probe()
246 clk_disable_unprepare(spdif->clk); in axi_spdif_dev_remove()
250 { .compatible = "adi,axi-spdif-tx-1.00.a", },
257 .name = "axi-spdif",
265 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");