Lines Matching refs:i2s
119 static inline uint32_t jz4740_i2s_read(const struct jz4740_i2s *i2s, in jz4740_i2s_read() argument
122 return readl(i2s->base + reg); in jz4740_i2s_read()
125 static inline void jz4740_i2s_write(const struct jz4740_i2s *i2s, in jz4740_i2s_write() argument
128 writel(value, i2s->base + reg); in jz4740_i2s_write()
134 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_startup() local
140 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_startup()
142 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_startup()
144 clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_startup()
146 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_startup()
148 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_startup()
156 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_shutdown() local
162 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_shutdown()
164 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_shutdown()
166 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_shutdown()
172 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_trigger() local
182 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_trigger()
199 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_trigger()
206 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_set_fmt() local
211 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_set_fmt()
249 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_set_fmt()
250 jz4740_i2s_write(i2s, JZ_REG_AIC_I2S_FMT, format); in jz4740_i2s_set_fmt()
258 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_hw_params() local
263 ctrl = jz4740_i2s_read(i2s, JZ_REG_AIC_CTRL); in jz4740_i2s_hw_params()
265 div_reg = jz4740_i2s_read(i2s, JZ_REG_AIC_CLK_DIV); in jz4740_i2s_hw_params()
266 div = clk_get_rate(i2s->clk_i2s) / (64 * params_rate(params)); in jz4740_i2s_hw_params()
293 if (i2s->version >= JZ_I2S_JZ4780) { in jz4740_i2s_hw_params()
302 jz4740_i2s_write(i2s, JZ_REG_AIC_CTRL, ctrl); in jz4740_i2s_hw_params()
303 jz4740_i2s_write(i2s, JZ_REG_AIC_CLK_DIV, div_reg); in jz4740_i2s_hw_params()
311 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_set_sysclk() local
318 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
322 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
323 ret = clk_set_rate(i2s->clk_i2s, freq); in jz4740_i2s_set_sysclk()
335 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_suspend() local
339 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_suspend()
341 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_suspend()
343 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_suspend()
346 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_suspend()
353 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_resume() local
356 clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_resume()
359 clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_resume()
361 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_resume()
363 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_resume()
369 static void jz4740_i2c_init_pcm_config(struct jz4740_i2s *i2s) in jz4740_i2c_init_pcm_config() argument
374 dma_data = &i2s->playback_dma_data; in jz4740_i2c_init_pcm_config()
377 dma_data->addr = i2s->phys_base + JZ_REG_AIC_FIFO; in jz4740_i2c_init_pcm_config()
380 dma_data = &i2s->capture_dma_data; in jz4740_i2c_init_pcm_config()
383 dma_data->addr = i2s->phys_base + JZ_REG_AIC_FIFO; in jz4740_i2c_init_pcm_config()
388 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_probe() local
391 clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_dai_probe()
393 jz4740_i2c_init_pcm_config(i2s); in jz4740_i2s_dai_probe()
394 snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, in jz4740_i2s_dai_probe()
395 &i2s->capture_dma_data); in jz4740_i2s_dai_probe()
397 if (i2s->version >= JZ_I2S_JZ4780) { in jz4740_i2s_dai_probe()
411 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET); in jz4740_i2s_dai_probe()
412 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_dai_probe()
419 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_remove() local
421 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_dai_remove()
493 struct jz4740_i2s *i2s; in jz4740_i2s_dev_probe() local
498 i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); in jz4740_i2s_dev_probe()
499 if (!i2s) in jz4740_i2s_dev_probe()
504 i2s->version = (enum jz47xx_i2s_version)match->data; in jz4740_i2s_dev_probe()
507 i2s->base = devm_ioremap_resource(&pdev->dev, mem); in jz4740_i2s_dev_probe()
508 if (IS_ERR(i2s->base)) in jz4740_i2s_dev_probe()
509 return PTR_ERR(i2s->base); in jz4740_i2s_dev_probe()
511 i2s->phys_base = mem->start; in jz4740_i2s_dev_probe()
513 i2s->clk_aic = devm_clk_get(&pdev->dev, "aic"); in jz4740_i2s_dev_probe()
514 if (IS_ERR(i2s->clk_aic)) in jz4740_i2s_dev_probe()
515 return PTR_ERR(i2s->clk_aic); in jz4740_i2s_dev_probe()
517 i2s->clk_i2s = devm_clk_get(&pdev->dev, "i2s"); in jz4740_i2s_dev_probe()
518 if (IS_ERR(i2s->clk_i2s)) in jz4740_i2s_dev_probe()
519 return PTR_ERR(i2s->clk_i2s); in jz4740_i2s_dev_probe()
521 platform_set_drvdata(pdev, i2s); in jz4740_i2s_dev_probe()
523 if (i2s->version == JZ_I2S_JZ4780) in jz4740_i2s_dev_probe()