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
320 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
326 clk_set_parent(i2s->clk_i2s, parent); in jz4740_i2s_set_sysclk()
327 ret = clk_set_rate(i2s->clk_i2s, freq); in jz4740_i2s_set_sysclk()
339 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_suspend() local
343 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_suspend()
345 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_suspend()
347 clk_disable_unprepare(i2s->clk_i2s); in jz4740_i2s_suspend()
350 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_suspend()
357 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_resume() local
360 clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_resume()
363 clk_prepare_enable(i2s->clk_i2s); in jz4740_i2s_resume()
365 conf = jz4740_i2s_read(i2s, JZ_REG_AIC_CONF); in jz4740_i2s_resume()
367 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_resume()
373 static void jz4740_i2c_init_pcm_config(struct jz4740_i2s *i2s) in jz4740_i2c_init_pcm_config() argument
378 dma_data = &i2s->playback_dma_data; 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()
387 dma_data->addr = i2s->phys_base + JZ_REG_AIC_FIFO; in jz4740_i2c_init_pcm_config()
392 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_probe() local
395 clk_prepare_enable(i2s->clk_aic); in jz4740_i2s_dai_probe()
397 jz4740_i2c_init_pcm_config(i2s); in jz4740_i2s_dai_probe()
398 snd_soc_dai_init_dma_data(dai, &i2s->playback_dma_data, in jz4740_i2s_dai_probe()
399 &i2s->capture_dma_data); in jz4740_i2s_dai_probe()
401 if (i2s->version >= JZ_I2S_JZ4780) { in jz4740_i2s_dai_probe()
415 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, JZ_AIC_CONF_RESET); in jz4740_i2s_dai_probe()
416 jz4740_i2s_write(i2s, JZ_REG_AIC_CONF, conf); in jz4740_i2s_dai_probe()
423 struct jz4740_i2s *i2s = snd_soc_dai_get_drvdata(dai); in jz4740_i2s_dai_remove() local
425 clk_disable_unprepare(i2s->clk_aic); in jz4740_i2s_dai_remove()
497 struct jz4740_i2s *i2s; in jz4740_i2s_dev_probe() local
502 i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL); in jz4740_i2s_dev_probe()
503 if (!i2s) in jz4740_i2s_dev_probe()
508 i2s->version = (enum jz47xx_i2s_version)match->data; in jz4740_i2s_dev_probe()
511 i2s->base = devm_ioremap_resource(&pdev->dev, mem); in jz4740_i2s_dev_probe()
512 if (IS_ERR(i2s->base)) in jz4740_i2s_dev_probe()
513 return PTR_ERR(i2s->base); in jz4740_i2s_dev_probe()
515 i2s->phys_base = mem->start; in jz4740_i2s_dev_probe()
517 i2s->clk_aic = devm_clk_get(&pdev->dev, "aic"); in jz4740_i2s_dev_probe()
518 if (IS_ERR(i2s->clk_aic)) in jz4740_i2s_dev_probe()
519 return PTR_ERR(i2s->clk_aic); in jz4740_i2s_dev_probe()
521 i2s->clk_i2s = devm_clk_get(&pdev->dev, "i2s"); in jz4740_i2s_dev_probe()
522 if (IS_ERR(i2s->clk_i2s)) in jz4740_i2s_dev_probe()
523 return PTR_ERR(i2s->clk_i2s); in jz4740_i2s_dev_probe()
525 platform_set_drvdata(pdev, i2s); in jz4740_i2s_dev_probe()
527 if (i2s->version == JZ_I2S_JZ4780) in jz4740_i2s_dev_probe()