Lines Matching +full:jz4780 +full:- +full:dma
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
18 #include <linux/dma-mapping.h>
27 #include "jz4740-i2s.h"
116 return readl(i2s->base + reg); in jz4740_i2s_read()
122 writel(value, i2s->base + reg); in jz4740_i2s_write()
139 ret = clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_startup()
163 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_shutdown()
174 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in jz4740_i2s_trigger()
193 return -EINVAL; in jz4740_i2s_trigger()
226 return -EINVAL; in jz4740_i2s_set_fmt()
236 return -EINVAL; in jz4740_i2s_set_fmt()
243 return -EINVAL; in jz4740_i2s_set_fmt()
263 div = clk_get_rate(i2s->clk_i2s) / (64 * params_rate(params)); in jz4740_i2s_hw_params()
273 return -EINVAL; in jz4740_i2s_hw_params()
276 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in jz4740_i2s_hw_params()
285 div_reg |= (div - 1) << I2SDIV_DV_SHIFT; in jz4740_i2s_hw_params()
290 if (i2s->soc_info->version >= JZ_I2S_JZ4770) { in jz4740_i2s_hw_params()
292 div_reg |= (div - 1) << I2SDIV_IDV_SHIFT; in jz4740_i2s_hw_params()
295 div_reg |= (div - 1) << I2SDIV_DV_SHIFT; in jz4740_i2s_hw_params()
315 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
319 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
320 ret = clk_set_rate(i2s->clk_i2s, freq); in jz4740_i2s_set_sysclk()
323 return -EINVAL; in jz4740_i2s_set_sysclk()
340 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_suspend()
343 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_suspend()
354 ret = clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_resume()
359 ret = clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_resume()
361 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_resume()
378 dma_data = &i2s->playback_dma_data; in jz4740_i2c_init_pcm_config()
379 dma_data->maxburst = 16; in jz4740_i2c_init_pcm_config()
380 dma_data->slave_id = JZ4740_DMA_TYPE_AIC_TRANSMIT; in jz4740_i2c_init_pcm_config()
381 dma_data->addr = i2s->phys_base + JZ_REG_AIC_FIFO; in jz4740_i2c_init_pcm_config()
384 dma_data = &i2s->capture_dma_data; in jz4740_i2c_init_pcm_config()
385 dma_data->maxburst = 16; in jz4740_i2c_init_pcm_config()
386 dma_data->slave_id = JZ4740_DMA_TYPE_AIC_RECEIVE; in jz4740_i2c_init_pcm_config()
387 dma_data->addr = i2s->phys_base + JZ_REG_AIC_FIFO; in jz4740_i2c_init_pcm_config()
396 ret = clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_dai_probe()
401 snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, in jz4740_i2s_dai_probe()
402 &i2s->capture_dma_data); in jz4740_i2s_dai_probe()
404 if (i2s->soc_info->version >= JZ_I2S_JZ4760) { in jz4740_i2s_dai_probe()
428 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_dai_remove()
502 .name = "jz4740-i2s",
508 { .compatible = "ingenic,jz4740-i2s", .data = &jz4740_i2s_soc_info },
509 { .compatible = "ingenic,jz4760-i2s", .data = &jz4760_i2s_soc_info },
510 { .compatible = "ingenic,jz4770-i2s", .data = &jz4770_i2s_soc_info },
511 { .compatible = "ingenic,jz4780-i2s", .data = &jz4780_i2s_soc_info },
518 struct device *dev = &pdev->dev; in jz4740_i2s_dev_probe()
525 return -ENOMEM; in jz4740_i2s_dev_probe()
527 i2s->soc_info = device_get_match_data(dev); in jz4740_i2s_dev_probe()
530 i2s->base = devm_ioremap_resource(dev, mem); in jz4740_i2s_dev_probe()
531 if (IS_ERR(i2s->base)) in jz4740_i2s_dev_probe()
532 return PTR_ERR(i2s->base); in jz4740_i2s_dev_probe()
534 i2s->phys_base = mem->start; in jz4740_i2s_dev_probe()
536 i2s->clk_aic = devm_clk_get(dev, "aic"); in jz4740_i2s_dev_probe()
537 if (IS_ERR(i2s->clk_aic)) in jz4740_i2s_dev_probe()
538 return PTR_ERR(i2s->clk_aic); in jz4740_i2s_dev_probe()
540 i2s->clk_i2s = devm_clk_get(dev, "i2s"); in jz4740_i2s_dev_probe()
541 if (IS_ERR(i2s->clk_i2s)) in jz4740_i2s_dev_probe()
542 return PTR_ERR(i2s->clk_i2s); in jz4740_i2s_dev_probe()
547 i2s->soc_info->dai, 1); in jz4740_i2s_dev_probe()
558 .name = "jz4740-i2s",
565 MODULE_AUTHOR("Lars-Peter Clausen, <lars@metafoo.de>");
568 MODULE_ALIAS("platform:jz4740-i2s");