Lines Matching full:i2s

26 #include "jz4740-i2s.h"
107 static inline uint32_t jz4740_i2s_read(const struct jz4740_i2s *i2s, in jz4740_i2s_read() argument
110 return readl(i2s->base + reg); in jz4740_i2s_read()
113 static inline void jz4740_i2s_write(const struct jz4740_i2s *i2s, in jz4740_i2s_write() argument
116 writel(value, i2s->base + reg); in jz4740_i2s_write()
122 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_startup() local
129 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_startup()
131 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_startup()
133 ret = clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_startup()
137 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_startup()
139 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_startup()
147 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_shutdown() local
153 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_shutdown()
155 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_shutdown()
157 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_shutdown()
163 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_trigger() local
173 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_trigger()
190 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_trigger()
197 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_set_fmt() local
202 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_set_fmt()
240 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_set_fmt()
241 jz4740_i2s_write(i2s, JZ_REG_AIC_I2S_FMT, format); in jz4740_i2s_set_fmt()
249 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_hw_params() local
254 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_hw_params()
256 div_reg = jz4740_i2s_read(i2s, JZ_REG_AIC_CLK_DIV); in jz4740_i2s_hw_params()
257 div = clk_get_rate(i2s->clk_i2s) / (64 * params_rate(params)); in jz4740_i2s_hw_params()
284 if (i2s->soc_info->version >= JZ_I2S_JZ4770) { in jz4740_i2s_hw_params()
293 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_hw_params()
294 jz4740_i2s_write(i2s, JZ_REG_AIC_CLK_DIV, div_reg); in jz4740_i2s_hw_params()
302 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_set_sysclk() local
311 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
317 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
318 ret = clk_set_rate(i2s->clk_i2s, freq); in jz4740_i2s_set_sysclk()
330 struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); in jz4740_i2s_suspend() local
334 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_suspend()
336 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_suspend()
338 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_suspend()
341 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_suspend()
348 struct jz4740_i2s *i2s = snd_soc_component_get_drvdata(component); in jz4740_i2s_resume() local
352 ret = clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_resume()
357 ret = clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_resume()
359 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_resume()
363 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_resume()
365 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_resume()
373 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_probe() local
377 ret = clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_dai_probe()
381 snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, in jz4740_i2s_dai_probe()
382 &i2s->capture_dma_data); in jz4740_i2s_dai_probe()
384 if (i2s->soc_info->version >= JZ_I2S_JZ4760) { in jz4740_i2s_dai_probe()
398 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET); in jz4740_i2s_dai_probe()
399 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_dai_probe()
406 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_remove() local
408 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_dai_remove()
482 .name = "jz4740-i2s",
489 { .compatible = "ingenic,jz4740-i2s", .data = &jz4740_i2s_soc_info },
490 { .compatible = "ingenic,jz4760-i2s", .data = &jz4760_i2s_soc_info },
491 { .compatible = "ingenic,jz4770-i2s", .data = &jz4770_i2s_soc_info },
492 { .compatible = "ingenic,jz4780-i2s", .data = &jz4780_i2s_soc_info },
500 struct jz4740_i2s *i2s; in jz4740_i2s_dev_probe() local
504 i2s = devm_kzalloc(dev, sizeof(*i2s), GFP_KERNEL); in jz4740_i2s_dev_probe()
505 if (!i2s) in jz4740_i2s_dev_probe()
508 i2s->soc_info = device_get_match_data(dev); in jz4740_i2s_dev_probe()
510 i2s->base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem); in jz4740_i2s_dev_probe()
511 if (IS_ERR(i2s->base)) in jz4740_i2s_dev_probe()
512 return PTR_ERR(i2s->base); in jz4740_i2s_dev_probe()
514 i2s->playback_dma_data.maxburst = 16; in jz4740_i2s_dev_probe()
515 i2s->playback_dma_data.addr = mem->start + JZ_REG_AIC_FIFO; in jz4740_i2s_dev_probe()
517 i2s->capture_dma_data.maxburst = 16; in jz4740_i2s_dev_probe()
518 i2s->capture_dma_data.addr = mem->start + JZ_REG_AIC_FIFO; in jz4740_i2s_dev_probe()
520 i2s->clk_aic = devm_clk_get(dev, "aic"); in jz4740_i2s_dev_probe()
521 if (IS_ERR(i2s->clk_aic)) in jz4740_i2s_dev_probe()
522 return PTR_ERR(i2s->clk_aic); in jz4740_i2s_dev_probe()
524 i2s->clk_i2s = devm_clk_get(dev, "i2s"); in jz4740_i2s_dev_probe()
525 if (IS_ERR(i2s->clk_i2s)) in jz4740_i2s_dev_probe()
526 return PTR_ERR(i2s->clk_i2s); in jz4740_i2s_dev_probe()
528 platform_set_drvdata(pdev, i2s); in jz4740_i2s_dev_probe()
531 i2s->soc_info->dai, 1); in jz4740_i2s_dev_probe()
542 .name = "jz4740-i2s",
550 MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver");
552 MODULE_ALIAS("platform:jz4740-i2s");