Lines Matching refs:cygaud
239 struct cygnus_audio *cygaud = snd_soc_dai_get_drvdata(dai); in cygnus_dai_get_portinfo() local
241 return &cygaud->portinfo[dai->id]; in cygnus_dai_get_portinfo()
251 value = readl(aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_init_portregs()
256 aio->cygaud->audio + aio->regs.bf_sourcech_grp); in audio_ssp_init_portregs()
262 writel(value, aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_init_portregs()
265 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_init_portregs()
269 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_init_portregs()
272 value = readl(aio->cygaud->i2s_in + in audio_ssp_init_portregs()
276 writel(value, aio->cygaud->i2s_in + in audio_ssp_init_portregs()
282 value = readl(aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_init_portregs()
287 writel(value, aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_init_portregs()
290 value = readl(aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in audio_ssp_init_portregs()
292 writel(value, aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in audio_ssp_init_portregs()
295 writel(aio->portnum, aio->cygaud->audio + BF_SRC_GRP3_OFFSET); in audio_ssp_init_portregs()
297 value = readl(aio->cygaud->audio + SPDIF_CTRL_OFFSET); in audio_ssp_init_portregs()
299 writel(value, aio->cygaud->audio + SPDIF_CTRL_OFFSET); in audio_ssp_init_portregs()
302 value = readl(aio->cygaud->audio + SPDIF_STREAM_CFG_OFFSET); in audio_ssp_init_portregs()
306 writel(value, aio->cygaud->audio + SPDIF_STREAM_CFG_OFFSET); in audio_ssp_init_portregs()
308 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_init_portregs()
312 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_init_portregs()
315 value = readl(aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in audio_ssp_init_portregs()
317 writel(value, aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in audio_ssp_init_portregs()
320 dev_err(aio->cygaud->dev, "Port not supported\n"); in audio_ssp_init_portregs()
331 value = readl(aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_in_enable()
333 writel(value, aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_in_enable()
335 writel(0x1, aio->cygaud->audio + aio->regs.bf_destch_ctrl); in audio_ssp_in_enable()
337 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_in_enable()
340 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_in_enable()
342 value = readl(aio->cygaud->i2s_in + aio->regs.i2s_cap_stream_cfg); in audio_ssp_in_enable()
344 writel(value, aio->cygaud->i2s_in + aio->regs.i2s_cap_stream_cfg); in audio_ssp_in_enable()
353 value = readl(aio->cygaud->i2s_in + aio->regs.i2s_cap_stream_cfg); in audio_ssp_in_disable()
355 writel(value, aio->cygaud->i2s_in + aio->regs.i2s_cap_stream_cfg); in audio_ssp_in_disable()
361 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_in_disable()
364 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_in_disable()
367 writel(0x0, aio->cygaud->audio + aio->regs.bf_destch_ctrl); in audio_ssp_in_disable()
369 value = readl(aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_in_disable()
371 writel(value, aio->cygaud->audio + aio->regs.bf_destch_cfg); in audio_ssp_in_disable()
381 value = readl(aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_out_enable()
383 writel(value, aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_out_enable()
385 writel(1, aio->cygaud->audio + aio->regs.bf_sourcech_ctrl); in audio_ssp_out_enable()
387 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_out_enable()
390 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_out_enable()
392 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_enable()
394 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_enable()
399 value = readl(aio->cygaud->audio + SPDIF_FORMAT_CFG_OFFSET); in audio_ssp_out_enable()
401 writel(value, aio->cygaud->audio + SPDIF_FORMAT_CFG_OFFSET); in audio_ssp_out_enable()
403 writel(1, aio->cygaud->audio + aio->regs.bf_sourcech_ctrl); in audio_ssp_out_enable()
405 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_enable()
407 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_enable()
410 dev_err(aio->cygaud->dev, in audio_ssp_out_enable()
429 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_out_disable()
432 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in audio_ssp_out_disable()
436 value = readl(aio->cygaud->audio + BF_SRC_GRP_SYNC_DIS_OFFSET); in audio_ssp_out_disable()
438 writel(value, aio->cygaud->audio + BF_SRC_GRP_SYNC_DIS_OFFSET); in audio_ssp_out_disable()
440 writel(0, aio->cygaud->audio + aio->regs.bf_sourcech_ctrl); in audio_ssp_out_disable()
442 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_disable()
444 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_disable()
447 value = readl(aio->cygaud->audio + BF_SRC_GRP_SYNC_DIS_OFFSET); in audio_ssp_out_disable()
449 writel(value, aio->cygaud->audio + BF_SRC_GRP_SYNC_DIS_OFFSET); in audio_ssp_out_disable()
451 value = readl(aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_out_disable()
453 writel(value, aio->cygaud->audio + aio->regs.i2s_stream_cfg); in audio_ssp_out_disable()
456 value = readl(aio->cygaud->i2s_in + IOP_SW_INIT_LOGIC); in audio_ssp_out_disable()
458 writel(value, aio->cygaud->i2s_in + IOP_SW_INIT_LOGIC); in audio_ssp_out_disable()
460 writel(value, aio->cygaud->i2s_in + IOP_SW_INIT_LOGIC); in audio_ssp_out_disable()
463 value = readl(aio->cygaud->audio + SPDIF_FORMAT_CFG_OFFSET); in audio_ssp_out_disable()
465 writel(value, aio->cygaud->audio + SPDIF_FORMAT_CFG_OFFSET); in audio_ssp_out_disable()
466 writel(0, aio->cygaud->audio + aio->regs.bf_sourcech_ctrl); in audio_ssp_out_disable()
468 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_disable()
470 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in audio_ssp_out_disable()
473 dev_err(aio->cygaud->dev, in audio_ssp_out_disable()
481 static int pll_configure_mclk(struct cygnus_audio *cygaud, u32 mclk, in pll_configure_mclk() argument
497 dev_err(cygaud->dev, in pll_configure_mclk()
502 ch_clk = cygaud->audio_clk[p_entry->pll_ch_num]; in pll_configure_mclk()
507 dev_err(cygaud->dev, "%s clk_prepare_enable failed %d\n", in pll_configure_mclk()
517 dev_err(cygaud->dev, "%s clk_prepare_enable failed %d\n", in pll_configure_mclk()
526 dev_err(cygaud->dev, "%s Set MCLK rate failed: %d\n", in pll_configure_mclk()
566 dev_err(aio->cygaud->dev, in cygnus_ssp_set_clocks()
568 dev_err(aio->cygaud->dev, "lrclk = %u, bits/frame = %u, mclk = %u\n", in cygnus_ssp_set_clocks()
584 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_ssp_set_clocks()
587 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_ssp_set_clocks()
588 dev_dbg(aio->cygaud->dev, in cygnus_ssp_set_clocks()
594 dev_err(aio->cygaud->dev, "Unknown port type\n"); in cygnus_ssp_set_clocks()
599 value = readl(aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in cygnus_ssp_set_clocks()
602 writel(value, aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in cygnus_ssp_set_clocks()
604 dev_dbg(aio->cygaud->dev, "mclk cfg reg = 0x%x\n", value); in cygnus_ssp_set_clocks()
605 dev_dbg(aio->cygaud->dev, "bits per frame = %u, mclk = %u Hz, lrclk = %u Hz\n", in cygnus_ssp_set_clocks()
620 dev_dbg(aio->cygaud->dev, "%s port = %d\n", __func__, aio->portnum); in cygnus_ssp_hw_params()
621 dev_dbg(aio->cygaud->dev, "params_channels %d\n", in cygnus_ssp_hw_params()
623 dev_dbg(aio->cygaud->dev, "rate %d\n", params_rate(params)); in cygnus_ssp_hw_params()
624 dev_dbg(aio->cygaud->dev, "format %d\n", params_format(params)); in cygnus_ssp_hw_params()
631 dev_err(aio->cygaud->dev, "Cannot run %d channels at %dHz\n", in cygnus_ssp_hw_params()
640 dev_err(aio->cygaud->dev, in cygnus_ssp_hw_params()
646 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in cygnus_ssp_hw_params()
649 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in cygnus_ssp_hw_params()
665 value = readl(aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in cygnus_ssp_hw_params()
668 writel(value, aio->cygaud->audio + aio->regs.bf_sourcech_cfg); in cygnus_ssp_hw_params()
674 value = readl(aio->cygaud->audio + in cygnus_ssp_hw_params()
677 writel(value, aio->cygaud->audio + in cygnus_ssp_hw_params()
682 value = readl(aio->cygaud->audio + in cygnus_ssp_hw_params()
685 writel(value, aio->cygaud->audio + in cygnus_ssp_hw_params()
711 struct cygnus_audio *cygaud = snd_soc_dai_get_drvdata(dai); in cygnus_ssp_set_sysclk() local
713 dev_dbg(aio->cygaud->dev, in cygnus_ssp_set_sysclk()
715 sel = pll_configure_mclk(cygaud, freq, aio); in cygnus_ssp_set_sysclk()
717 dev_err(aio->cygaud->dev, in cygnus_ssp_set_sysclk()
724 dev_dbg(aio->cygaud->dev, "%s Setting MCLKSEL to %d\n", __func__, sel); in cygnus_ssp_set_sysclk()
725 value = readl(aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in cygnus_ssp_set_sysclk()
728 writel(value, aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in cygnus_ssp_set_sysclk()
765 val = readl(aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in cygnus_ssp_shutdown()
767 if (val >= ARRAY_SIZE(aio->cygaud->audio_clk)) { in cygnus_ssp_shutdown()
768 dev_err(aio->cygaud->dev, "Clk index %u is out of bounds\n", in cygnus_ssp_shutdown()
775 clk_disable_unprepare(aio->cygaud-> in cygnus_ssp_shutdown()
781 clk_disable_unprepare(aio->cygaud-> in cygnus_ssp_shutdown()
834 dev_dbg(aio->cygaud->dev, "%s Enter fmt: %x\n", __func__, fmt); in cygnus_ssp_set_fmt()
886 ssp_curcfg = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_ssp_set_fmt()
888 writel(ssp_outcfg, aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_ssp_set_fmt()
894 ssp_curcfg = readl(aio->cygaud->i2s_in + aio->regs.i2s_cap_cfg); in cygnus_ssp_set_fmt()
896 writel(ssp_incfg, aio->cygaud->i2s_in + aio->regs.i2s_cap_cfg); in cygnus_ssp_set_fmt()
898 val = readl(aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in cygnus_ssp_set_fmt()
916 dev_dbg(aio->cygaud->dev, "%s Set OE bits 0x%x\n", __func__, val); in cygnus_ssp_set_fmt()
917 writel(val, aio->cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in cygnus_ssp_set_fmt()
926 struct cygnus_audio *cygaud = snd_soc_dai_get_drvdata(dai); in cygnus_ssp_trigger() local
928 dev_dbg(aio->cygaud->dev, in cygnus_ssp_trigger()
939 cygaud->active_ports++; in cygnus_ssp_trigger()
950 cygaud->active_ports--; in cygnus_ssp_trigger()
972 dev_err(aio->cygaud->dev, in cygnus_set_dai_tdm_slot()
1000 dev_warn(aio->cygaud->dev, in cygnus_set_dai_tdm_slot()
1014 dev_err(aio->cygaud->dev, in cygnus_set_dai_tdm_slot()
1022 dev_dbg(aio->cygaud->dev, "%s active_slots %u, bits per frame %d\n", in cygnus_set_dai_tdm_slot()
1026 value = readl(aio->cygaud->i2s_in + aio->regs.i2s_cap_cfg); in cygnus_set_dai_tdm_slot()
1031 writel(value, aio->cygaud->i2s_in + aio->regs.i2s_cap_cfg); in cygnus_set_dai_tdm_slot()
1034 value = readl(aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_set_dai_tdm_slot()
1039 writel(value, aio->cygaud->audio + aio->regs.i2s_cfg); in cygnus_set_dai_tdm_slot()
1055 val = readl(aio->cygaud->audio + aio->regs.i2s_mclk_cfg); in __cygnus_ssp_suspend()
1057 if (val >= ARRAY_SIZE(aio->cygaud->audio_clk)) { in __cygnus_ssp_suspend()
1058 dev_err(aio->cygaud->dev, "Clk index %u is out of bounds\n", in __cygnus_ssp_suspend()
1064 clk_disable_unprepare(aio->cygaud->audio_clk[val]); in __cygnus_ssp_suspend()
1066 clk_disable_unprepare(aio->cygaud->audio_clk[val]); in __cygnus_ssp_suspend()
1095 error = clk_prepare_enable(aio->cygaud-> in __cygnus_ssp_resume()
1098 dev_err(aio->cygaud->dev, "%s clk_prepare_enable failed\n", in __cygnus_ssp_resume()
1104 error = clk_prepare_enable(aio->cygaud-> in __cygnus_ssp_resume()
1108 clk_disable_unprepare(aio->cygaud-> in __cygnus_ssp_resume()
1110 dev_err(aio->cygaud->dev, "%s clk_prepare_enable failed\n", in __cygnus_ssp_resume()
1207 struct cygnus_audio *cygaud, in parse_ssp_child_node() argument
1243 aio = &cygaud->portinfo[portnum]; in parse_ssp_child_node()
1244 aio->cygaud = cygaud; in parse_ssp_child_node()
1273 aio->cygaud->dev = &pdev->dev; in parse_ssp_child_node()
1282 struct cygnus_audio *cygaud) in audio_clk_init() argument
1287 for (i = 0; i < ARRAY_SIZE(cygaud->audio_clk); i++) { in audio_clk_init()
1290 cygaud->audio_clk[i] = devm_clk_get(&pdev->dev, clk_name); in audio_clk_init()
1291 if (IS_ERR(cygaud->audio_clk[i])) in audio_clk_init()
1292 return PTR_ERR(cygaud->audio_clk[i]); in audio_clk_init()
1302 struct cygnus_audio *cygaud; in cygnus_ssp_probe() local
1307 cygaud = devm_kzalloc(dev, sizeof(struct cygnus_audio), GFP_KERNEL); in cygnus_ssp_probe()
1308 if (!cygaud) in cygnus_ssp_probe()
1311 dev_set_drvdata(dev, cygaud); in cygnus_ssp_probe()
1313 cygaud->audio = devm_platform_ioremap_resource_byname(pdev, "aud"); in cygnus_ssp_probe()
1314 if (IS_ERR(cygaud->audio)) in cygnus_ssp_probe()
1315 return PTR_ERR(cygaud->audio); in cygnus_ssp_probe()
1317 cygaud->i2s_in = devm_platform_ioremap_resource_byname(pdev, "i2s_in"); in cygnus_ssp_probe()
1318 if (IS_ERR(cygaud->i2s_in)) in cygnus_ssp_probe()
1319 return PTR_ERR(cygaud->i2s_in); in cygnus_ssp_probe()
1323 cygaud->audio + AUD_MISC_SEROUT_OE_REG_BASE); in cygnus_ssp_probe()
1335 err = parse_ssp_child_node(pdev, child_node, cygaud, in cygnus_ssp_probe()
1350 cygaud->dev = dev; in cygnus_ssp_probe()
1351 cygaud->active_ports = 0; in cygnus_ssp_probe()
1361 cygaud->irq_num = platform_get_irq(pdev, 0); in cygnus_ssp_probe()
1362 if (cygaud->irq_num <= 0) in cygnus_ssp_probe()
1363 return cygaud->irq_num; in cygnus_ssp_probe()
1365 err = audio_clk_init(pdev, cygaud); in cygnus_ssp_probe()
1371 err = cygnus_soc_platform_register(dev, cygaud); in cygnus_ssp_probe()