Lines Matching refs:asrc
26 dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
29 dev_dbg(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
32 dev_warn(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
217 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_request_pair() local
218 struct device *dev = &asrc->pdev->dev; in fsl_asrc_request_pair()
222 spin_lock_irqsave(&asrc->lock, lock_flags); in fsl_asrc_request_pair()
225 if (asrc->pair[i] != NULL) in fsl_asrc_request_pair()
237 } else if (asrc->channel_avail < channels) { in fsl_asrc_request_pair()
241 asrc->channel_avail -= channels; in fsl_asrc_request_pair()
242 asrc->pair[index] = pair; in fsl_asrc_request_pair()
247 spin_unlock_irqrestore(&asrc->lock, lock_flags); in fsl_asrc_request_pair()
260 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_release_pair() local
265 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_release_pair()
268 spin_lock_irqsave(&asrc->lock, lock_flags); in fsl_asrc_release_pair()
270 asrc->channel_avail += pair->channels; in fsl_asrc_release_pair()
271 asrc->pair[index] = NULL; in fsl_asrc_release_pair()
274 spin_unlock_irqrestore(&asrc->lock, lock_flags); in fsl_asrc_release_pair()
285 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_set_watermarks() local
288 regmap_update_bits(asrc->regmap, REG_ASRMCR(index), in fsl_asrc_set_watermarks()
326 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_set_ideal_ratio() local
355 regmap_write(asrc->regmap, REG_ASRIDRL(index), ratio); in fsl_asrc_set_ideal_ratio()
356 regmap_write(asrc->regmap, REG_ASRIDRH(index), ratio >> 24); in fsl_asrc_set_ideal_ratio()
381 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_config_pair() local
382 struct fsl_asrc_priv *asrc_priv = asrc->private; in fsl_asrc_config_pair()
512 regmap_update_bits(asrc->regmap, REG_ASRCNCR, in fsl_asrc_config_pair()
517 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_config_pair()
519 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_config_pair()
523 regmap_update_bits(asrc->regmap, REG_ASRCSR, in fsl_asrc_config_pair()
533 regmap_update_bits(asrc->regmap, REG_ASRCDR(index), in fsl_asrc_config_pair()
539 regmap_update_bits(asrc->regmap, REG_ASRMCR1(index), in fsl_asrc_config_pair()
545 regmap_update_bits(asrc->regmap, REG_ASRMCR(index), in fsl_asrc_config_pair()
557 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_config_pair()
561 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_config_pair()
568 regmap_update_bits(asrc->regmap, REG_ASRCFG, in fsl_asrc_config_pair()
584 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_start_pair() local
589 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_start_pair()
595 regmap_read(asrc->regmap, REG_ASRCFG, ®); in fsl_asrc_start_pair()
604 regmap_read(asrc->regmap, REG_ASRCNCR, ®); in fsl_asrc_start_pair()
606 regmap_write(asrc->regmap, REG_ASRDI(index), 0); in fsl_asrc_start_pair()
609 regmap_write(asrc->regmap, REG_ASRIER, ASRIER_AOLIE); in fsl_asrc_start_pair()
618 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_stop_pair() local
622 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_stop_pair()
634 struct fsl_asrc *asrc = pair->asrc; in fsl_asrc_get_dma_channel() local
640 return dma_request_slave_channel(&asrc->pdev->dev, name); in fsl_asrc_get_dma_channel()
646 struct fsl_asrc *asrc = snd_soc_dai_get_drvdata(dai); in fsl_asrc_dai_startup() local
647 struct fsl_asrc_priv *asrc_priv = asrc->private; in fsl_asrc_dai_startup()
701 struct fsl_asrc *asrc = snd_soc_dai_get_drvdata(dai); in fsl_asrc_dai_hw_params() local
702 struct fsl_asrc_priv *asrc_priv = asrc->private; in fsl_asrc_dai_hw_params()
724 config.output_format = asrc->asrc_format; in fsl_asrc_dai_hw_params()
726 config.output_sample_rate = asrc->asrc_rate; in fsl_asrc_dai_hw_params()
728 config.input_format = asrc->asrc_format; in fsl_asrc_dai_hw_params()
730 config.input_sample_rate = asrc->asrc_rate; in fsl_asrc_dai_hw_params()
792 struct fsl_asrc *asrc = snd_soc_dai_get_drvdata(dai); in fsl_asrc_dai_probe() local
794 snd_soc_dai_init_dma_data(dai, &asrc->dma_params_tx, in fsl_asrc_dai_probe()
795 &asrc->dma_params_rx); in fsl_asrc_dai_probe()
975 static int fsl_asrc_init(struct fsl_asrc *asrc) in fsl_asrc_init() argument
980 regmap_write(asrc->regmap, REG_ASRCTR, ASRCTR_ASRCEN); in fsl_asrc_init()
983 regmap_write(asrc->regmap, REG_ASRIER, 0x0); in fsl_asrc_init()
986 regmap_write(asrc->regmap, REG_ASRPM1, 0x7fffff); in fsl_asrc_init()
987 regmap_write(asrc->regmap, REG_ASRPM2, 0x255555); in fsl_asrc_init()
988 regmap_write(asrc->regmap, REG_ASRPM3, 0xff7280); in fsl_asrc_init()
989 regmap_write(asrc->regmap, REG_ASRPM4, 0xff7280); in fsl_asrc_init()
990 regmap_write(asrc->regmap, REG_ASRPM5, 0xff7280); in fsl_asrc_init()
993 regmap_update_bits(asrc->regmap, REG_ASRTFR1, in fsl_asrc_init()
1001 ipg_rate = clk_get_rate(asrc->ipg_clk); in fsl_asrc_init()
1002 regmap_write(asrc->regmap, REG_ASR76K, ipg_rate / 76000); in fsl_asrc_init()
1003 return regmap_write(asrc->regmap, REG_ASR56K, ipg_rate / 56000); in fsl_asrc_init()
1013 struct fsl_asrc *asrc = (struct fsl_asrc *)dev_id; in fsl_asrc_isr() local
1014 struct device *dev = &asrc->pdev->dev; in fsl_asrc_isr()
1018 regmap_read(asrc->regmap, REG_ASRSTR, &status); in fsl_asrc_isr()
1021 regmap_write(asrc->regmap, REG_ASRSTR, ASRSTR_AOLE); in fsl_asrc_isr()
1029 if (!asrc->pair[index]) in fsl_asrc_isr()
1033 asrc->pair[index]->error |= ASRC_TASK_Q_OVERLOAD; in fsl_asrc_isr()
1038 asrc->pair[index]->error |= ASRC_OUTPUT_TASK_OVERLOAD; in fsl_asrc_isr()
1043 asrc->pair[index]->error |= ASRC_INPUT_TASK_OVERLOAD; in fsl_asrc_isr()
1048 asrc->pair[index]->error |= ASRC_OUTPUT_BUFFER_OVERFLOW; in fsl_asrc_isr()
1053 asrc->pair[index]->error |= ASRC_INPUT_BUFFER_UNDERRUN; in fsl_asrc_isr()
1073 struct fsl_asrc *asrc; in fsl_asrc_probe() local
1082 asrc = devm_kzalloc(&pdev->dev, sizeof(*asrc), GFP_KERNEL); in fsl_asrc_probe()
1083 if (!asrc) in fsl_asrc_probe()
1090 asrc->pdev = pdev; in fsl_asrc_probe()
1091 asrc->private = asrc_priv; in fsl_asrc_probe()
1098 asrc->paddr = res->start; in fsl_asrc_probe()
1100 asrc->regmap = devm_regmap_init_mmio(&pdev->dev, regs, &fsl_asrc_regmap_config); in fsl_asrc_probe()
1101 if (IS_ERR(asrc->regmap)) { in fsl_asrc_probe()
1103 return PTR_ERR(asrc->regmap); in fsl_asrc_probe()
1111 dev_name(&pdev->dev), asrc); in fsl_asrc_probe()
1117 asrc->mem_clk = devm_clk_get(&pdev->dev, "mem"); in fsl_asrc_probe()
1118 if (IS_ERR(asrc->mem_clk)) { in fsl_asrc_probe()
1120 return PTR_ERR(asrc->mem_clk); in fsl_asrc_probe()
1123 asrc->ipg_clk = devm_clk_get(&pdev->dev, "ipg"); in fsl_asrc_probe()
1124 if (IS_ERR(asrc->ipg_clk)) { in fsl_asrc_probe()
1126 return PTR_ERR(asrc->ipg_clk); in fsl_asrc_probe()
1129 asrc->spba_clk = devm_clk_get(&pdev->dev, "spba"); in fsl_asrc_probe()
1130 if (IS_ERR(asrc->spba_clk)) in fsl_asrc_probe()
1143 asrc->use_edma = asrc_priv->soc->use_edma; in fsl_asrc_probe()
1144 asrc->get_dma_channel = fsl_asrc_get_dma_channel; in fsl_asrc_probe()
1145 asrc->request_pair = fsl_asrc_request_pair; in fsl_asrc_probe()
1146 asrc->release_pair = fsl_asrc_release_pair; in fsl_asrc_probe()
1147 asrc->get_fifo_addr = fsl_asrc_get_fifo_addr; in fsl_asrc_probe()
1148 asrc->pair_priv_size = sizeof(struct fsl_asrc_pair_priv); in fsl_asrc_probe()
1177 asrc->channel_avail = 10; in fsl_asrc_probe()
1180 &asrc->asrc_rate); in fsl_asrc_probe()
1187 asrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt; in fsl_asrc_probe()
1197 asrc->asrc_format = SNDRV_PCM_FORMAT_S16_LE; in fsl_asrc_probe()
1200 asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; in fsl_asrc_probe()
1205 asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; in fsl_asrc_probe()
1210 if (!(FSL_ASRC_FORMATS & pcm_format_to_bits(asrc->asrc_format))) { in fsl_asrc_probe()
1212 asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; in fsl_asrc_probe()
1215 platform_set_drvdata(pdev, asrc); in fsl_asrc_probe()
1216 spin_lock_init(&asrc->lock); in fsl_asrc_probe()
1228 ret = fsl_asrc_init(asrc); in fsl_asrc_probe()
1266 struct fsl_asrc *asrc = dev_get_drvdata(dev); in fsl_asrc_runtime_resume() local
1267 struct fsl_asrc_priv *asrc_priv = asrc->private; in fsl_asrc_runtime_resume()
1272 ret = clk_prepare_enable(asrc->mem_clk); in fsl_asrc_runtime_resume()
1275 ret = clk_prepare_enable(asrc->ipg_clk); in fsl_asrc_runtime_resume()
1278 if (!IS_ERR(asrc->spba_clk)) { in fsl_asrc_runtime_resume()
1279 ret = clk_prepare_enable(asrc->spba_clk); in fsl_asrc_runtime_resume()
1290 regmap_read(asrc->regmap, REG_ASRCTR, &asrctr); in fsl_asrc_runtime_resume()
1291 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_runtime_resume()
1295 regcache_cache_only(asrc->regmap, false); in fsl_asrc_runtime_resume()
1296 regcache_mark_dirty(asrc->regmap); in fsl_asrc_runtime_resume()
1297 regcache_sync(asrc->regmap); in fsl_asrc_runtime_resume()
1299 regmap_update_bits(asrc->regmap, REG_ASRCFG, in fsl_asrc_runtime_resume()
1304 regmap_update_bits(asrc->regmap, REG_ASRCTR, in fsl_asrc_runtime_resume()
1310 regmap_read(asrc->regmap, REG_ASRCFG, ®); in fsl_asrc_runtime_resume()
1330 if (!IS_ERR(asrc->spba_clk)) in fsl_asrc_runtime_resume()
1331 clk_disable_unprepare(asrc->spba_clk); in fsl_asrc_runtime_resume()
1333 clk_disable_unprepare(asrc->ipg_clk); in fsl_asrc_runtime_resume()
1335 clk_disable_unprepare(asrc->mem_clk); in fsl_asrc_runtime_resume()
1341 struct fsl_asrc *asrc = dev_get_drvdata(dev); in fsl_asrc_runtime_suspend() local
1342 struct fsl_asrc_priv *asrc_priv = asrc->private; in fsl_asrc_runtime_suspend()
1345 regmap_read(asrc->regmap, REG_ASRCFG, in fsl_asrc_runtime_suspend()
1348 regcache_cache_only(asrc->regmap, true); in fsl_asrc_runtime_suspend()
1352 if (!IS_ERR(asrc->spba_clk)) in fsl_asrc_runtime_suspend()
1353 clk_disable_unprepare(asrc->spba_clk); in fsl_asrc_runtime_suspend()
1354 clk_disable_unprepare(asrc->ipg_clk); in fsl_asrc_runtime_suspend()
1355 clk_disable_unprepare(asrc->mem_clk); in fsl_asrc_runtime_suspend()