Lines Matching defs:host

194 static void sun4i_spdif_configure(struct sun4i_spdif_dev *host)
196 const struct sun4i_spdif_quirks *quirks = host->quirks;
199 regmap_write(host->regmap, SUN4I_SPDIF_CTL, SUN4I_SPDIF_CTL_RESET);
202 regmap_update_bits(host->regmap, SUN4I_SPDIF_FCTL,
206 regmap_write(host->regmap, SUN4I_SPDIF_TXCNT, 0);
210 struct sun4i_spdif_dev *host)
213 regmap_update_bits(host->regmap, SUN4I_SPDIF_TXCFG,
218 regmap_update_bits(host->regmap, SUN4I_SPDIF_TXCFG,
222 regmap_update_bits(host->regmap, SUN4I_SPDIF_INT,
226 regmap_update_bits(host->regmap, SUN4I_SPDIF_CTL,
231 struct sun4i_spdif_dev *host)
234 regmap_update_bits(host->regmap, SUN4I_SPDIF_TXCFG,
238 regmap_update_bits(host->regmap, SUN4I_SPDIF_INT,
242 regmap_update_bits(host->regmap, SUN4I_SPDIF_CTL,
250 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
255 sun4i_spdif_configure(host);
270 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
271 struct platform_device *pdev = host->pdev;
318 ret = clk_set_rate(host->spdif_clk, mclk);
325 regmap_update_bits(host->regmap, SUN4I_SPDIF_FCTL,
357 regmap_write(host->regmap, SUN4I_SPDIF_TXCFG, reg_val);
366 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(dai);
375 sun4i_snd_txctrl_on(substream, host);
381 sun4i_snd_txctrl_off(substream, host);
419 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
424 spin_lock_irqsave(&host->lock, flags);
426 regmap_read(host->regmap, SUN4I_SPDIF_TXCHSTA0, &reg);
433 regmap_read(host->regmap, SUN4I_SPDIF_TXCHSTA1, &reg);
438 spin_unlock_irqrestore(&host->lock, flags);
447 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
453 spin_lock_irqsave(&host->lock, flags);
460 regmap_update_bits_check(host->regmap, SUN4I_SPDIF_TXCHSTA0,
466 regmap_update_bits_check(host->regmap, SUN4I_SPDIF_TXCHSTA1,
473 regmap_update_bits(host->regmap, SUN4I_SPDIF_TXCFG,
477 spin_unlock_irqrestore(&host->lock, flags);
501 struct sun4i_spdif_dev *host = snd_soc_dai_get_drvdata(dai);
503 snd_soc_dai_init_dma_data(dai, &host->dma_params_tx, NULL);
597 struct sun4i_spdif_dev *host = dev_get_drvdata(dev);
599 clk_disable_unprepare(host->spdif_clk);
600 clk_disable_unprepare(host->apb_clk);
607 struct sun4i_spdif_dev *host = dev_get_drvdata(dev);
610 ret = clk_prepare_enable(host->spdif_clk);
613 ret = clk_prepare_enable(host->apb_clk);
615 clk_disable_unprepare(host->spdif_clk);
622 struct sun4i_spdif_dev *host;
630 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
631 if (!host)
634 host->pdev = pdev;
635 spin_lock_init(&host->lock);
638 memcpy(&host->cpu_dai_drv, &sun4i_spdif_dai, sizeof(sun4i_spdif_dai));
639 host->cpu_dai_drv.name = dev_name(&pdev->dev);
651 host->quirks = quirks;
653 host->regmap = devm_regmap_init_mmio(&pdev->dev, base,
657 host->apb_clk = devm_clk_get(&pdev->dev, "apb");
658 if (IS_ERR(host->apb_clk)) {
660 return PTR_ERR(host->apb_clk);
663 host->spdif_clk = devm_clk_get(&pdev->dev, "spdif");
664 if (IS_ERR(host->spdif_clk)) {
666 return PTR_ERR(host->spdif_clk);
669 host->dma_params_tx.addr = res->start + quirks->reg_dac_txdata;
670 host->dma_params_tx.maxburst = 8;
671 host->dma_params_tx.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
673 platform_set_drvdata(pdev, host);
676 host->rst = devm_reset_control_get_optional_exclusive(&pdev->dev,
678 if (PTR_ERR(host->rst) == -EPROBE_DEFER) {
683 if (!IS_ERR(host->rst))
684 reset_control_deassert(host->rst);