Lines Matching refs:scodec
250 static void sun4i_codec_start_playback(struct sun4i_codec *scodec) in sun4i_codec_start_playback() argument
253 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_start_playback()
257 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_start_playback()
261 static void sun4i_codec_stop_playback(struct sun4i_codec *scodec) in sun4i_codec_stop_playback() argument
264 regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_stop_playback()
268 static void sun4i_codec_start_capture(struct sun4i_codec *scodec) in sun4i_codec_start_capture() argument
271 regmap_field_set_bits(scodec->reg_adc_fifoc, in sun4i_codec_start_capture()
275 static void sun4i_codec_stop_capture(struct sun4i_codec *scodec) in sun4i_codec_stop_capture() argument
278 regmap_field_clear_bits(scodec->reg_adc_fifoc, in sun4i_codec_stop_capture()
286 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_trigger() local
293 sun4i_codec_start_playback(scodec); in sun4i_codec_trigger()
295 sun4i_codec_start_capture(scodec); in sun4i_codec_trigger()
302 sun4i_codec_stop_playback(scodec); in sun4i_codec_trigger()
304 sun4i_codec_stop_capture(scodec); in sun4i_codec_trigger()
318 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_prepare_capture() local
322 regmap_field_set_bits(scodec->reg_adc_fifoc, in sun4i_codec_prepare_capture()
327 regmap_field_update_bits(scodec->reg_adc_fifoc, in sun4i_codec_prepare_capture()
336 if (of_device_is_compatible(scodec->dev->of_node, in sun4i_codec_prepare_capture()
338 of_device_is_compatible(scodec->dev->of_node, in sun4i_codec_prepare_capture()
340 regmap_update_bits(scodec->regmap, SUN4I_CODEC_ADC_ACTL, in sun4i_codec_prepare_capture()
345 if (of_device_is_compatible(scodec->dev->of_node, in sun4i_codec_prepare_capture()
348 regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_TUNE, in sun4i_codec_prepare_capture()
359 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_prepare_playback() local
363 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_prepare_playback()
367 regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_prepare_playback()
378 regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_prepare_playback()
383 regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_prepare_playback()
470 static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, in sun4i_codec_hw_params_capture() argument
475 regmap_field_update_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
481 regmap_field_set_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
484 regmap_field_clear_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
489 regmap_field_set_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
492 regmap_field_clear_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
495 scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; in sun4i_codec_hw_params_capture()
497 regmap_field_clear_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
501 regmap_field_set_bits(scodec->reg_adc_fifoc, in sun4i_codec_hw_params_capture()
504 scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; in sun4i_codec_hw_params_capture()
510 static int sun4i_codec_hw_params_playback(struct sun4i_codec *scodec, in sun4i_codec_hw_params_playback() argument
517 regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
527 regmap_update_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
533 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
537 regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
540 scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; in sun4i_codec_hw_params_playback()
542 regmap_clear_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
546 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_hw_params_playback()
549 scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; in sun4i_codec_hw_params_playback()
560 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_hw_params() local
568 ret = clk_set_rate(scodec->clk_module, clk_freq); in sun4i_codec_hw_params()
577 return sun4i_codec_hw_params_playback(scodec, params, in sun4i_codec_hw_params()
580 return sun4i_codec_hw_params_capture(scodec, params, in sun4i_codec_hw_params()
601 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_startup() local
610 regmap_set_bits(scodec->regmap, SUN4I_CODEC_DAC_FIFOC, in sun4i_codec_startup()
613 return clk_prepare_enable(scodec->clk_module); in sun4i_codec_startup()
620 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(rtd->card); in sun4i_codec_shutdown() local
622 clk_disable_unprepare(scodec->clk_module); in sun4i_codec_shutdown()
1247 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(card); in sun4i_codec_dai_probe() local
1249 snd_soc_dai_init_dma_data(dai, &scodec->playback_dma_data, in sun4i_codec_dai_probe()
1250 &scodec->capture_dma_data); in sun4i_codec_dai_probe()
1310 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(w->dapm->card); in sun4i_codec_spk_event() local
1312 gpiod_set_value_cansleep(scodec->gpio_pa, in sun4i_codec_spk_event()
1682 struct sun4i_codec *scodec; in sun4i_codec_probe() local
1688 scodec = devm_kzalloc(&pdev->dev, sizeof(*scodec), GFP_KERNEL); in sun4i_codec_probe()
1689 if (!scodec) in sun4i_codec_probe()
1692 scodec->dev = &pdev->dev; in sun4i_codec_probe()
1704 scodec->regmap = devm_regmap_init_mmio(&pdev->dev, base, in sun4i_codec_probe()
1706 if (IS_ERR(scodec->regmap)) { in sun4i_codec_probe()
1708 return PTR_ERR(scodec->regmap); in sun4i_codec_probe()
1712 scodec->clk_apb = devm_clk_get(&pdev->dev, "apb"); in sun4i_codec_probe()
1713 if (IS_ERR(scodec->clk_apb)) { in sun4i_codec_probe()
1715 return PTR_ERR(scodec->clk_apb); in sun4i_codec_probe()
1718 scodec->clk_module = devm_clk_get(&pdev->dev, "codec"); in sun4i_codec_probe()
1719 if (IS_ERR(scodec->clk_module)) { in sun4i_codec_probe()
1721 return PTR_ERR(scodec->clk_module); in sun4i_codec_probe()
1725 scodec->rst = devm_reset_control_get_exclusive(&pdev->dev, in sun4i_codec_probe()
1727 if (IS_ERR(scodec->rst)) { in sun4i_codec_probe()
1729 return PTR_ERR(scodec->rst); in sun4i_codec_probe()
1733 scodec->gpio_pa = devm_gpiod_get_optional(&pdev->dev, "allwinner,pa", in sun4i_codec_probe()
1735 if (IS_ERR(scodec->gpio_pa)) { in sun4i_codec_probe()
1736 ret = PTR_ERR(scodec->gpio_pa); in sun4i_codec_probe()
1742 scodec->reg_adc_fifoc = devm_regmap_field_alloc(&pdev->dev, in sun4i_codec_probe()
1743 scodec->regmap, in sun4i_codec_probe()
1745 if (IS_ERR(scodec->reg_adc_fifoc)) { in sun4i_codec_probe()
1746 ret = PTR_ERR(scodec->reg_adc_fifoc); in sun4i_codec_probe()
1753 if (clk_prepare_enable(scodec->clk_apb)) { in sun4i_codec_probe()
1759 if (scodec->rst) { in sun4i_codec_probe()
1760 ret = reset_control_deassert(scodec->rst); in sun4i_codec_probe()
1769 scodec->playback_dma_data.addr = res->start + quirks->reg_dac_txdata; in sun4i_codec_probe()
1770 scodec->playback_dma_data.maxburst = 8; in sun4i_codec_probe()
1771 scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; in sun4i_codec_probe()
1774 scodec->capture_dma_data.addr = res->start + quirks->reg_adc_rxdata; in sun4i_codec_probe()
1775 scodec->capture_dma_data.maxburst = 8; in sun4i_codec_probe()
1776 scodec->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; in sun4i_codec_probe()
1806 snd_soc_card_set_drvdata(card, scodec); in sun4i_codec_probe()
1817 if (scodec->rst) in sun4i_codec_probe()
1818 reset_control_assert(scodec->rst); in sun4i_codec_probe()
1820 clk_disable_unprepare(scodec->clk_apb); in sun4i_codec_probe()
1827 struct sun4i_codec *scodec = snd_soc_card_get_drvdata(card); in sun4i_codec_remove() local
1830 if (scodec->rst) in sun4i_codec_remove()
1831 reset_control_assert(scodec->rst); in sun4i_codec_remove()
1832 clk_disable_unprepare(scodec->clk_apb); in sun4i_codec_remove()