Lines Matching refs:pcm

154 static void s3c_pcm_snd_txctrl(struct s3c_pcm_info *pcm, int on)  in s3c_pcm_snd_txctrl()  argument
156 void __iomem *regs = pcm->regs; in s3c_pcm_snd_txctrl()
176 if (!pcm->idleclk) in s3c_pcm_snd_txctrl()
185 static void s3c_pcm_snd_rxctrl(struct s3c_pcm_info *pcm, int on) in s3c_pcm_snd_rxctrl() argument
187 void __iomem *regs = pcm->regs; in s3c_pcm_snd_rxctrl()
207 if (!pcm->idleclk) in s3c_pcm_snd_rxctrl()
220 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); in s3c_pcm_trigger() local
223 dev_dbg(pcm->dev, "Entered %s\n", __func__); in s3c_pcm_trigger()
229 spin_lock_irqsave(&pcm->lock, flags); in s3c_pcm_trigger()
232 s3c_pcm_snd_rxctrl(pcm, 1); in s3c_pcm_trigger()
234 s3c_pcm_snd_txctrl(pcm, 1); in s3c_pcm_trigger()
236 spin_unlock_irqrestore(&pcm->lock, flags); in s3c_pcm_trigger()
242 spin_lock_irqsave(&pcm->lock, flags); in s3c_pcm_trigger()
245 s3c_pcm_snd_rxctrl(pcm, 0); in s3c_pcm_trigger()
247 s3c_pcm_snd_txctrl(pcm, 0); in s3c_pcm_trigger()
249 spin_unlock_irqrestore(&pcm->lock, flags); in s3c_pcm_trigger()
264 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); in s3c_pcm_hw_params() local
265 void __iomem *regs = pcm->regs; in s3c_pcm_hw_params()
271 dev_dbg(pcm->dev, "Entered %s\n", __func__); in s3c_pcm_hw_params()
281 spin_lock_irqsave(&pcm->lock, flags); in s3c_pcm_hw_params()
286 clk = pcm->pclk; in s3c_pcm_hw_params()
288 clk = pcm->cclk; in s3c_pcm_hw_params()
291 sclk_div = clk_get_rate(clk) / pcm->sclk_per_fs / in s3c_pcm_hw_params()
300 sync_div = pcm->sclk_per_fs - 1; in s3c_pcm_hw_params()
309 spin_unlock_irqrestore(&pcm->lock, flags); in s3c_pcm_hw_params()
311 dev_dbg(pcm->dev, "PCMSOURCE_CLK-%lu SCLK=%ufs SCLK_DIV=%d SYNC_DIV=%d\n", in s3c_pcm_hw_params()
312 clk_get_rate(clk), pcm->sclk_per_fs, in s3c_pcm_hw_params()
321 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); in s3c_pcm_set_fmt() local
322 void __iomem *regs = pcm->regs; in s3c_pcm_set_fmt()
327 dev_dbg(pcm->dev, "Entered %s\n", __func__); in s3c_pcm_set_fmt()
329 spin_lock_irqsave(&pcm->lock, flags); in s3c_pcm_set_fmt()
338 dev_err(pcm->dev, "Unsupported clock inversion!\n"); in s3c_pcm_set_fmt()
348 dev_err(pcm->dev, "Unsupported master/slave format!\n"); in s3c_pcm_set_fmt()
355 pcm->idleclk = 1; in s3c_pcm_set_fmt()
358 pcm->idleclk = 0; in s3c_pcm_set_fmt()
361 dev_err(pcm->dev, "Invalid Clock gating request!\n"); in s3c_pcm_set_fmt()
376 dev_err(pcm->dev, "Unsupported data format!\n"); in s3c_pcm_set_fmt()
384 spin_unlock_irqrestore(&pcm->lock, flags); in s3c_pcm_set_fmt()
392 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); in s3c_pcm_set_clkdiv() local
396 pcm->sclk_per_fs = div; in s3c_pcm_set_clkdiv()
409 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(cpu_dai); in s3c_pcm_set_sysclk() local
410 void __iomem *regs = pcm->regs; in s3c_pcm_set_sysclk()
421 if (clk_get_rate(pcm->cclk) != freq) in s3c_pcm_set_sysclk()
422 clk_set_rate(pcm->cclk, freq); in s3c_pcm_set_sysclk()
437 struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(dai); in s3c_pcm_dai_probe() local
439 snd_soc_dai_init_dma_data(dai, pcm->dma_playback, pcm->dma_capture); in s3c_pcm_dai_probe()
489 struct s3c_pcm_info *pcm; in s3c_pcm_dev_probe() local
508 pcm = &s3c_pcm[pdev->id]; in s3c_pcm_dev_probe()
509 pcm->dev = &pdev->dev; in s3c_pcm_dev_probe()
511 spin_lock_init(&pcm->lock); in s3c_pcm_dev_probe()
514 pcm->sclk_per_fs = 128; in s3c_pcm_dev_probe()
516 pcm->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &mem_res); in s3c_pcm_dev_probe()
517 if (IS_ERR(pcm->regs)) in s3c_pcm_dev_probe()
518 return PTR_ERR(pcm->regs); in s3c_pcm_dev_probe()
520 pcm->cclk = devm_clk_get(&pdev->dev, "audio-bus"); in s3c_pcm_dev_probe()
521 if (IS_ERR(pcm->cclk)) { in s3c_pcm_dev_probe()
523 return PTR_ERR(pcm->cclk); in s3c_pcm_dev_probe()
525 ret = clk_prepare_enable(pcm->cclk); in s3c_pcm_dev_probe()
530 dev_set_drvdata(&pdev->dev, pcm); in s3c_pcm_dev_probe()
532 pcm->pclk = devm_clk_get(&pdev->dev, "pcm"); in s3c_pcm_dev_probe()
533 if (IS_ERR(pcm->pclk)) { in s3c_pcm_dev_probe()
535 ret = PTR_ERR(pcm->pclk); in s3c_pcm_dev_probe()
538 ret = clk_prepare_enable(pcm->pclk); in s3c_pcm_dev_probe()
552 pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; in s3c_pcm_dev_probe()
553 pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; in s3c_pcm_dev_probe()
576 clk_disable_unprepare(pcm->pclk); in s3c_pcm_dev_probe()
578 clk_disable_unprepare(pcm->cclk); in s3c_pcm_dev_probe()
584 struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; in s3c_pcm_dev_remove() local
587 clk_disable_unprepare(pcm->cclk); in s3c_pcm_dev_remove()
588 clk_disable_unprepare(pcm->pclk); in s3c_pcm_dev_remove()