Searched refs:saif (Results 1 - 4 of 4) sorted by relevance

/linux-4.4.14/sound/soc/mxs/
H A Dmxs-saif.c35 #include "mxs-saif.h"
52 * We abstract this as each saif has a master, the master could be
53 * itself or other saifs. In the generic saif driver, saif does not need
63 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_set_dai_sysclk() local
67 saif->mclk = freq; mxs_saif_set_dai_sysclk()
81 static inline struct mxs_saif *mxs_saif_get_master(struct mxs_saif * saif) mxs_saif_get_master() argument
83 return mxs_saif[saif->master_id]; mxs_saif_get_master()
89 static int mxs_saif_set_clk(struct mxs_saif *saif, mxs_saif_set_clk() argument
97 dev_dbg(saif->dev, "mclk %d rate %d\n", mclk, rate); mxs_saif_set_clk()
99 /* Set master saif to generate proper clock */ mxs_saif_set_clk()
100 master_saif = mxs_saif_get_master(saif); mxs_saif_set_clk()
104 dev_dbg(saif->dev, "master saif%d\n", master_saif->id); mxs_saif_set_clk()
108 dev_err(saif->dev, mxs_saif_set_clk()
109 "can not change clock, master saif%d(rate %d) is ongoing\n", mxs_saif_set_clk()
123 * For 32x mclk, set saif clk as 512*fs. mxs_saif_set_clk()
124 * For 48x mclk, set saif clk as 384*fs. mxs_saif_set_clk()
126 * If MCLK is not used, we just set saif clk to 512*fs. mxs_saif_set_clk()
207 struct mxs_saif *saif = mxs_saif[saif_id]; mxs_saif_put_mclk() local
210 if (!saif) mxs_saif_put_mclk()
213 stat = __raw_readl(saif->base + SAIF_STAT); mxs_saif_put_mclk()
215 dev_err(saif->dev, "error: busy\n"); mxs_saif_put_mclk()
219 clk_disable_unprepare(saif->clk); mxs_saif_put_mclk()
223 saif->base + SAIF_CTRL + MXS_SET_ADDR); mxs_saif_put_mclk()
225 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_put_mclk()
227 saif->mclk_in_use = 0; mxs_saif_put_mclk()
236 * by saif.
241 struct mxs_saif *saif = mxs_saif[saif_id]; mxs_saif_get_mclk() local
246 if (!saif) mxs_saif_get_mclk()
251 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_get_mclk()
255 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_get_mclk()
257 master_saif = mxs_saif_get_master(saif); mxs_saif_get_mclk()
258 if (saif != master_saif) { mxs_saif_get_mclk()
259 dev_err(saif->dev, "can not get mclk from a non-master saif\n"); mxs_saif_get_mclk()
263 stat = __raw_readl(saif->base + SAIF_STAT); mxs_saif_get_mclk()
265 dev_err(saif->dev, "error: busy\n"); mxs_saif_get_mclk()
269 saif->mclk_in_use = 1; mxs_saif_get_mclk()
270 ret = mxs_saif_set_clk(saif, mclk, rate); mxs_saif_get_mclk()
274 ret = clk_prepare_enable(saif->clk); mxs_saif_get_mclk()
280 saif->base + SAIF_CTRL + MXS_SET_ADDR); mxs_saif_get_mclk()
294 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_set_dai_fmt() local
296 stat = __raw_readl(saif->base + SAIF_STAT); mxs_saif_set_dai_fmt()
302 scr0 = __raw_readl(saif->base + SAIF_CTRL); mxs_saif_set_dai_fmt()
353 if (saif->id == saif->master_id) mxs_saif_set_dai_fmt()
358 __raw_writel(scr | scr0, saif->base + SAIF_CTRL); mxs_saif_set_dai_fmt()
370 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_startup() local
373 saif->fifo_underrun = 0; mxs_saif_startup()
374 saif->fifo_overrun = 0; mxs_saif_startup()
378 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_startup()
382 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_startup()
395 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_hw_params() local
400 master_saif = mxs_saif_get_master(saif); mxs_saif_hw_params()
405 if (!saif->mclk && saif->mclk_in_use) { mxs_saif_hw_params()
410 stat = __raw_readl(saif->base + SAIF_STAT); mxs_saif_hw_params()
417 * Set saif clk based on sample rate. mxs_saif_hw_params()
418 * If mclk is used, we also set mclk, if not, saif->mclk is mxs_saif_hw_params()
421 ret = mxs_saif_set_clk(saif, saif->mclk, params_rate(params)); mxs_saif_hw_params()
428 clk_prepare(saif->clk); mxs_saif_hw_params()
429 if (saif != master_saif) { mxs_saif_hw_params()
431 * Set an initial clock rate for the saif internal logic to work mxs_saif_hw_params()
433 * that uses the other saif's BITCLK&LRCLK but it still needs a mxs_saif_hw_params()
437 clk_enable(saif->clk); mxs_saif_hw_params()
438 ret = clk_set_rate(saif->clk, 24000000); mxs_saif_hw_params()
439 clk_disable(saif->clk); mxs_saif_hw_params()
446 scr = __raw_readl(saif->base + SAIF_CTRL); mxs_saif_hw_params()
475 __raw_writel(scr, saif->base + SAIF_CTRL); mxs_saif_hw_params()
482 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_prepare() local
486 saif->base + SAIF_CTRL + MXS_SET_ADDR); mxs_saif_prepare()
494 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai); mxs_saif_trigger() local
499 master_saif = mxs_saif_get_master(saif); mxs_saif_trigger()
507 if (saif->state == MXS_SAIF_STATE_RUNNING) mxs_saif_trigger()
514 dev_err(saif->dev, "Failed to enable master clock\n"); mxs_saif_trigger()
519 * If the saif's master is not itself, we also need to enable mxs_saif_trigger()
522 if (saif != master_saif) { mxs_saif_trigger()
523 ret = clk_enable(saif->clk); mxs_saif_trigger()
525 dev_err(saif->dev, "Failed to enable master clock\n"); mxs_saif_trigger()
531 saif->base + SAIF_CTRL + MXS_SET_ADDR); mxs_saif_trigger()
540 * write data to saif data register to trigger mxs_saif_trigger()
546 __raw_writel(0, saif->base + SAIF_DATA); mxs_saif_trigger()
547 __raw_writel(0, saif->base + SAIF_DATA); mxs_saif_trigger()
550 * read data from saif data register to trigger mxs_saif_trigger()
556 __raw_readl(saif->base + SAIF_DATA); mxs_saif_trigger()
557 __raw_readl(saif->base + SAIF_DATA); mxs_saif_trigger()
561 saif->state = MXS_SAIF_STATE_RUNNING; mxs_saif_trigger()
563 dev_dbg(saif->dev, "CTRL 0x%x STAT 0x%x\n", mxs_saif_trigger()
564 __raw_readl(saif->base + SAIF_CTRL), mxs_saif_trigger()
565 __raw_readl(saif->base + SAIF_STAT)); mxs_saif_trigger()
574 if (saif->state == MXS_SAIF_STATE_STOPPED) mxs_saif_trigger()
589 if (saif != master_saif) { mxs_saif_trigger()
591 saif->base + SAIF_CTRL + MXS_CLR_ADDR); mxs_saif_trigger()
593 clk_disable(saif->clk); mxs_saif_trigger()
597 saif->state = MXS_SAIF_STATE_STOPPED; mxs_saif_trigger()
623 struct mxs_saif *saif = dev_get_drvdata(dai->dev); mxs_saif_dai_probe() local
625 snd_soc_dai_set_drvdata(dai, saif); mxs_saif_dai_probe()
631 .name = "mxs-saif",
649 .name = "mxs-saif",
654 struct mxs_saif *saif = dev_id; mxs_saif_irq() local
657 stat = __raw_readl(saif->base + SAIF_STAT); mxs_saif_irq()
663 dev_dbg(saif->dev, "underrun!!! %d\n", ++saif->fifo_underrun); mxs_saif_irq()
665 saif->base + SAIF_STAT + MXS_CLR_ADDR); mxs_saif_irq()
669 dev_dbg(saif->dev, "overrun!!! %d\n", ++saif->fifo_overrun); mxs_saif_irq()
671 saif->base + SAIF_STAT + MXS_CLR_ADDR); mxs_saif_irq()
674 dev_dbg(saif->dev, "SAIF_CTRL %x SAIF_STAT %x\n", mxs_saif_irq()
675 __raw_readl(saif->base + SAIF_CTRL), mxs_saif_irq()
676 __raw_readl(saif->base + SAIF_STAT)); mxs_saif_irq()
683 struct mxs_saif *saif = platform_get_drvdata(pdev); mxs_saif_mclk_init() local
689 __clk_get_name(saif->clk), 0, mxs_saif_mclk_init()
690 saif->base + SAIF_CTRL, mxs_saif_mclk_init()
712 struct mxs_saif *saif; mxs_saif_probe() local
719 saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); mxs_saif_probe()
720 if (!saif) mxs_saif_probe()
723 ret = of_alias_get_id(np, "saif"); mxs_saif_probe()
727 saif->id = ret; mxs_saif_probe()
730 * If there is no "fsl,saif-master" phandle, it's a saif mxs_saif_probe()
734 master = of_parse_phandle(np, "fsl,saif-master", 0); mxs_saif_probe()
736 saif->master_id = saif->id; mxs_saif_probe()
738 ret = of_alias_get_id(master, "saif"); mxs_saif_probe()
742 saif->master_id = ret; mxs_saif_probe()
745 if (saif->master_id >= ARRAY_SIZE(mxs_saif)) { mxs_saif_probe()
750 mxs_saif[saif->id] = saif; mxs_saif_probe()
752 saif->clk = devm_clk_get(&pdev->dev, NULL); mxs_saif_probe()
753 if (IS_ERR(saif->clk)) { mxs_saif_probe()
754 ret = PTR_ERR(saif->clk); mxs_saif_probe()
762 saif->base = devm_ioremap_resource(&pdev->dev, iores); mxs_saif_probe()
763 if (IS_ERR(saif->base)) mxs_saif_probe()
764 return PTR_ERR(saif->base); mxs_saif_probe()
774 saif->dev = &pdev->dev; mxs_saif_probe()
776 dev_name(&pdev->dev), saif); mxs_saif_probe()
782 platform_set_drvdata(pdev, saif); mxs_saif_probe()
785 if (saif->id == 0) { mxs_saif_probe()
808 { .compatible = "fsl,imx28-saif", },
817 .name = "mxs-saif",
827 MODULE_ALIAS("platform:mxs-saif");
H A DMakefile2 snd-soc-mxs-objs := mxs-saif.o
H A Dmxs-sgtl5000.c30 #include "mxs-saif.h"
110 saif_np[0] = of_parse_phandle(np, "saif-controllers", 0); mxs_sgtl5000_probe()
111 saif_np[1] = of_parse_phandle(np, "saif-controllers", 1); mxs_sgtl5000_probe()
/linux-4.4.14/drivers/clk/mxs/
H A Dclk-imx23.c91 clk32k, dri, pwm, filt, uart, ssp, gpmi, spdif, emi, saif, enumerator in enum:imx23_clk
155 clks[saif] = mxs_clk_gate("saif", "saif_div", SAIF, 31); mx23_clocks_init()

Completed in 194 milliseconds