Lines Matching refs:i2s
266 -obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-rockchip-i2s.o snd-soc-rockchip-pcm.o
268 +obj-$(CONFIG_SND_SOC_ROCKCHIP_I2S) += snd-soc-rockchip-i2s.o
287 #define DRV_NAME "rockchip-i2s"
308 @@ -92,6 +97,7 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
312 + spin_lock(&i2s->lock);
314 regmap_update_bits(i2s->regmap, I2S_DMACR,
316 @@ -132,6 +138,7 @@ static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
320 + spin_unlock(&i2s->lock);
323 static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on)
324 @@ -139,6 +146,7 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on)
328 + spin_lock(&i2s->lock);
330 regmap_update_bits(i2s->regmap, I2S_DMACR,
332 @@ -179,6 +187,7 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on)
336 + spin_unlock(&i2s->lock);
342 regmap_update_bits(i2s->regmap, I2S_CKR, mask, val);
373 if (i2s->is_master_mode) {
374 mclk_rate = clk_get_rate(i2s->mclk);
377 + bclk_rate = i2s->bclk_ratio * params_rate(params);
384 regmap_update_bits(i2s->regmap, I2S_CKR,
393 + struct rk_i2s_dev *i2s = to_info(dai);
395 + i2s->bclk_ratio = ratio;
405 struct rk_i2s_dev *i2s = snd_soc_dai_get_drvdata(dai);
407 - dai->capture_dma_data = &i2s->capture_dma_data;
408 - dai->playback_dma_data = &i2s->playback_dma_data;
410 + i2s->has_playback ? &i2s->playback_dma_data : NULL,
411 + i2s->has_capture ? &i2s->capture_dma_data : NULL);
457 { .compatible = "rockchip,rk3066-i2s", },
458 { .compatible = "rockchip,rk3188-i2s", },
459 { .compatible = "rockchip,rk3288-i2s", },
464 +static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, struct resource *res,
467 + struct device_node *node = i2s->dev->of_node;
475 + i2s->has_playback = true;
477 + i2s->has_capture = true;
480 + dai = devm_kmemdup(i2s->dev, &rockchip_i2s_dai,
485 + if (i2s->has_playback) {
496 + i2s->playback_dma_data.addr = res->start + I2S_TXDR;
497 + i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
498 + i2s->playback_dma_data.maxburst = 8;
506 + if (i2s->has_capture) {
517 + i2s->capture_dma_data.addr = res->start + I2S_RXDR;
518 + i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
519 + i2s->capture_dma_data.maxburst = 8;
537 struct rk_i2s_dev *i2s;
545 i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
546 if (!i2s)
549 + spin_lock_init(&i2s->lock);
550 i2s->dev = &pdev->dev;
552 i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
554 i2s->pins = of_id->data;
558 - i2s->hclk = devm_clk_get(&pdev->dev, "i2s_hclk");
559 - if (IS_ERR(i2s->hclk)) {
560 - dev_err(&pdev->dev, "Can't retrieve i2s bus clock\n");
561 - return PTR_ERR(i2s->hclk);
563 - ret = clk_prepare_enable(i2s->hclk);
565 - dev_err(i2s->dev, "hclock enable failed %d\n", ret);
569 - i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk");
570 - if (IS_ERR(i2s->mclk)) {
571 - dev_err(&pdev->dev, "Can't retrieve i2s master clock\n");
572 - ret = PTR_ERR(i2s->mclk);
584 i2s->regmap = devm_regmap_init_mmio(&pdev->dev, regs,
586 if (IS_ERR(i2s->regmap)) {
589 - ret = PTR_ERR(i2s->regmap);
591 + return PTR_ERR(i2s->regmap);
594 - i2s->playback_dma_data.addr = res->start + I2S_TXDR;
595 - i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
596 - i2s->playback_dma_data.maxburst = 4;
598 - i2s->capture_dma_data.addr = res->start + I2S_RXDR;
599 - i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
600 - i2s->capture_dma_data.maxburst = 4;
601 + i2s->bclk_ratio = 64;
603 dev_set_drvdata(&pdev->dev, i2s);
605 + i2s->mclk = devm_clk_get(&pdev->dev, "i2s_clk");
606 + if (IS_ERR(i2s->mclk)) {
607 + dev_err(&pdev->dev, "Can't retrieve i2s master clock\n");
608 + return PTR_ERR(i2s->mclk);
612 + i2s->hclk = devm_clk_get(&pdev->dev, "i2s_hclk");
613 + if (IS_ERR(i2s->hclk)) {
614 + dev_err(&pdev->dev, "Can't retrieve i2s bus clock\n");
615 + return PTR_ERR(i2s->hclk);
617 + ret = clk_prepare_enable(i2s->hclk);
619 + dev_err(i2s->dev, "hclock enable failed %d\n", ret);
634 + ret = rockchip_i2s_init_dai(i2s, res, &dai);
670 clk_disable_unprepare(i2s->hclk);