Lines Matching full:spdif
3 * IMG SPDIF output controller driver
54 struct img_spdif_out *spdif = dev_get_drvdata(dev); in img_spdif_out_runtime_suspend() local
56 clk_disable_unprepare(spdif->clk_ref); in img_spdif_out_runtime_suspend()
57 clk_disable_unprepare(spdif->clk_sys); in img_spdif_out_runtime_suspend()
64 struct img_spdif_out *spdif = dev_get_drvdata(dev); in img_spdif_out_runtime_resume() local
67 ret = clk_prepare_enable(spdif->clk_sys); in img_spdif_out_runtime_resume()
73 ret = clk_prepare_enable(spdif->clk_ref); in img_spdif_out_runtime_resume()
76 clk_disable_unprepare(spdif->clk_sys); in img_spdif_out_runtime_resume()
83 static inline void img_spdif_out_writel(struct img_spdif_out *spdif, u32 val, in img_spdif_out_writel() argument
86 writel(val, spdif->base + reg); in img_spdif_out_writel()
89 static inline u32 img_spdif_out_readl(struct img_spdif_out *spdif, u32 reg) in img_spdif_out_readl() argument
91 return readl(spdif->base + reg); in img_spdif_out_readl()
94 static void img_spdif_out_reset(struct img_spdif_out *spdif) in img_spdif_out_reset() argument
98 ctl = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CTL) & in img_spdif_out_reset()
100 status_low = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSL); in img_spdif_out_reset()
101 status_high = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_reset()
103 reset_control_assert(spdif->rst); in img_spdif_out_reset()
104 reset_control_deassert(spdif->rst); in img_spdif_out_reset()
106 img_spdif_out_writel(spdif, ctl, IMG_SPDIF_OUT_CTL); in img_spdif_out_reset()
107 img_spdif_out_writel(spdif, status_low, IMG_SPDIF_OUT_CSL); in img_spdif_out_reset()
108 img_spdif_out_writel(spdif, status_high, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_reset()
136 struct img_spdif_out *spdif = snd_soc_dai_get_drvdata(cpu_dai); in img_spdif_out_get_status() local
140 spin_lock_irqsave(&spdif->lock, flags); in img_spdif_out_get_status()
142 reg = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSL); in img_spdif_out_get_status()
148 reg = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_get_status()
153 spin_unlock_irqrestore(&spdif->lock, flags); in img_spdif_out_get_status()
162 struct img_spdif_out *spdif = snd_soc_dai_get_drvdata(cpu_dai); in img_spdif_out_set_status() local
171 spin_lock_irqsave(&spdif->lock, flags); in img_spdif_out_set_status()
173 img_spdif_out_writel(spdif, reg, IMG_SPDIF_OUT_CSL); in img_spdif_out_set_status()
175 reg = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_set_status()
179 img_spdif_out_writel(spdif, reg, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_set_status()
181 spin_unlock_irqrestore(&spdif->lock, flags); in img_spdif_out_set_status()
206 struct img_spdif_out *spdif = snd_soc_dai_get_drvdata(dai); in img_spdif_out_trigger() local
214 reg = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CTL); in img_spdif_out_trigger()
216 img_spdif_out_writel(spdif, reg, IMG_SPDIF_OUT_CTL); in img_spdif_out_trigger()
221 spin_lock_irqsave(&spdif->lock, flags); in img_spdif_out_trigger()
222 img_spdif_out_reset(spdif); in img_spdif_out_trigger()
223 spin_unlock_irqrestore(&spdif->lock, flags); in img_spdif_out_trigger()
235 struct img_spdif_out *spdif = snd_soc_dai_get_drvdata(dai); in img_spdif_out_hw_params() local
245 dev_dbg(spdif->dev, "hw_params rate %ld channels %u format %u\n", in img_spdif_out_hw_params()
254 pre_div_a = clk_round_rate(spdif->clk_ref, rate * 256); in img_spdif_out_hw_params()
257 pre_div_b = clk_round_rate(spdif->clk_ref, rate * 384); in img_spdif_out_hw_params()
266 clk_set_rate(spdif->clk_ref, pre_div_b); in img_spdif_out_hw_params()
268 clk_set_rate(spdif->clk_ref, pre_div_a); in img_spdif_out_hw_params()
275 clk_rate = clk_get_rate(spdif->clk_ref); in img_spdif_out_hw_params()
280 reg = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CTL); in img_spdif_out_hw_params()
285 img_spdif_out_writel(spdif, reg, IMG_SPDIF_OUT_CTL); in img_spdif_out_hw_params()
292 struct img_spdif_out *spdif = snd_soc_dai_get_drvdata(dai); in img_spdif_out_dai_probe() local
294 snd_soc_dai_init_dma_data(dai, &spdif->dma_data, NULL); in img_spdif_out_dai_probe()
319 .name = "img-spdif-out",
325 struct img_spdif_out *spdif; in img_spdif_out_probe() local
331 spdif = devm_kzalloc(&pdev->dev, sizeof(*spdif), GFP_KERNEL); in img_spdif_out_probe()
332 if (!spdif) in img_spdif_out_probe()
335 platform_set_drvdata(pdev, spdif); in img_spdif_out_probe()
337 spdif->dev = &pdev->dev; in img_spdif_out_probe()
343 spdif->base = base; in img_spdif_out_probe()
345 spdif->rst = devm_reset_control_get_exclusive(&pdev->dev, "rst"); in img_spdif_out_probe()
346 if (IS_ERR(spdif->rst)) in img_spdif_out_probe()
347 return dev_err_probe(&pdev->dev, PTR_ERR(spdif->rst), in img_spdif_out_probe()
350 spdif->clk_sys = devm_clk_get(&pdev->dev, "sys"); in img_spdif_out_probe()
351 if (IS_ERR(spdif->clk_sys)) in img_spdif_out_probe()
352 return dev_err_probe(dev, PTR_ERR(spdif->clk_sys), in img_spdif_out_probe()
355 spdif->clk_ref = devm_clk_get(&pdev->dev, "ref"); in img_spdif_out_probe()
356 if (IS_ERR(spdif->clk_ref)) in img_spdif_out_probe()
357 return dev_err_probe(dev, PTR_ERR(spdif->clk_ref), in img_spdif_out_probe()
370 img_spdif_out_writel(spdif, IMG_SPDIF_OUT_CTL_FS_MASK, in img_spdif_out_probe()
373 img_spdif_out_reset(spdif); in img_spdif_out_probe()
376 spin_lock_init(&spdif->lock); in img_spdif_out_probe()
378 spdif->dma_data.addr = res->start + IMG_SPDIF_OUT_TX_FIFO; in img_spdif_out_probe()
379 spdif->dma_data.addr_width = 4; in img_spdif_out_probe()
380 spdif->dma_data.maxburst = 4; in img_spdif_out_probe()
415 struct img_spdif_out *spdif = dev_get_drvdata(dev); in img_spdif_out_suspend() local
424 spdif->suspend_ctl = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CTL); in img_spdif_out_suspend()
425 spdif->suspend_csl = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSL); in img_spdif_out_suspend()
426 spdif->suspend_csh = img_spdif_out_readl(spdif, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_suspend()
435 struct img_spdif_out *spdif = dev_get_drvdata(dev); in img_spdif_out_resume() local
442 img_spdif_out_writel(spdif, spdif->suspend_ctl, IMG_SPDIF_OUT_CTL); in img_spdif_out_resume()
443 img_spdif_out_writel(spdif, spdif->suspend_csl, IMG_SPDIF_OUT_CSL); in img_spdif_out_resume()
444 img_spdif_out_writel(spdif, spdif->suspend_csh, IMG_SPDIF_OUT_CSH_UV); in img_spdif_out_resume()
453 { .compatible = "img,spdif-out" },
466 .name = "img-spdif-out",
476 MODULE_DESCRIPTION("IMG SPDIF Output driver");