Lines Matching refs:va
441 static int va_clk_rsc_fs_gen_request(struct va_macro *va, bool enable) in va_clk_rsc_fs_gen_request() argument
443 struct regmap *regmap = va->regmap; in va_clk_rsc_fs_gen_request()
474 static int va_macro_mclk_enable(struct va_macro *va, bool mclk_enable) in va_macro_mclk_enable() argument
476 struct regmap *regmap = va->regmap; in va_macro_mclk_enable()
479 va_clk_rsc_fs_gen_request(va, true); in va_macro_mclk_enable()
483 va_clk_rsc_fs_gen_request(va, false); in va_macro_mclk_enable()
493 struct va_macro *va = snd_soc_component_get_drvdata(comp); in va_macro_mclk_event() local
497 return clk_prepare_enable(va->fsgen); in va_macro_mclk_event()
499 clk_disable_unprepare(va->fsgen); in va_macro_mclk_event()
556 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_tx_mixer_get() local
558 if (test_bit(dec_id, &va->active_ch_mask[dai_id])) in va_macro_tx_mixer_get()
579 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_tx_mixer_put() local
582 set_bit(dec_id, &va->active_ch_mask[dai_id]); in va_macro_tx_mixer_put()
583 va->active_ch_cnt[dai_id]++; in va_macro_tx_mixer_put()
585 clear_bit(dec_id, &va->active_ch_mask[dai_id]); in va_macro_tx_mixer_put()
586 va->active_ch_cnt[dai_id]--; in va_macro_tx_mixer_put()
597 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_dmic_clk_enable() local
607 dmic_clk_cnt = &(va->dmic_0_1_clk_cnt); in va_dmic_clk_enable()
608 dmic_clk_div = &(va->dmic_0_1_clk_div); in va_dmic_clk_enable()
614 dmic_clk_cnt = &(va->dmic_2_3_clk_cnt); in va_dmic_clk_enable()
615 dmic_clk_div = &(va->dmic_2_3_clk_div); in va_dmic_clk_enable()
621 dmic_clk_cnt = &(va->dmic_4_5_clk_cnt); in va_dmic_clk_enable()
622 dmic_clk_div = &(va->dmic_4_5_clk_div); in va_dmic_clk_enable()
628 dmic_clk_cnt = &(va->dmic_6_7_clk_cnt); in va_dmic_clk_enable()
629 dmic_clk_div = &(va->dmic_6_7_clk_div); in va_dmic_clk_enable()
640 clk_div = va->dmic_clk_div; in va_dmic_clk_enable()
681 clk_div = va->dmic_clk_div; in va_dmic_clk_enable()
683 clk_div = va->dmic_clk_div; in va_dmic_clk_enable()
732 struct va_macro *va = snd_soc_component_get_drvdata(comp); in va_macro_enable_dec() local
749 va->dec_mode[decimator] << CDC_VA_ADC_MODE_SHIFT); in va_macro_enable_dec()
812 struct va_macro *va = snd_soc_component_get_drvdata(comp); in va_macro_dec_mode_get() local
816 ucontrol->value.enumerated.item[0] = va->dec_mode[path]; in va_macro_dec_mode_get()
828 struct va_macro *va = snd_soc_component_get_drvdata(comp); in va_macro_dec_mode_put() local
830 va->dec_mode[path] = value; in va_macro_dec_mode_put()
844 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_hw_params() local
875 for_each_set_bit(decimator, &va->active_ch_mask[dai->id], in va_macro_hw_params()
891 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_get_channel_map() local
897 *tx_slot = va->active_ch_mask[dai->id]; in va_macro_get_channel_map()
898 *tx_num = va->active_ch_cnt[dai->id]; in va_macro_get_channel_map()
910 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_digital_mute() local
913 for_each_set_bit(decimator, &va->active_ch_mask[dai->id], in va_macro_digital_mute()
1311 struct va_macro *va = snd_soc_component_get_drvdata(component); in va_macro_component_probe() local
1313 snd_soc_component_init_regmap(component, va->regmap); in va_macro_component_probe()
1331 struct va_macro *va = to_va_macro(hw); in fsgen_gate_enable() local
1332 struct regmap *regmap = va->regmap; in fsgen_gate_enable()
1335 ret = va_macro_mclk_enable(va, true); in fsgen_gate_enable()
1336 if (va->has_swr_master) in fsgen_gate_enable()
1345 struct va_macro *va = to_va_macro(hw); in fsgen_gate_disable() local
1346 struct regmap *regmap = va->regmap; in fsgen_gate_disable()
1348 if (va->has_swr_master) in fsgen_gate_disable()
1352 va_macro_mclk_enable(va, false); in fsgen_gate_disable()
1357 struct va_macro *va = to_va_macro(hw); in fsgen_gate_is_enabled() local
1360 regmap_read(va->regmap, CDC_VA_TOP_CSR_TOP_CFG0, &val); in fsgen_gate_is_enabled()
1371 static int va_macro_register_fsgen_output(struct va_macro *va) in va_macro_register_fsgen_output() argument
1373 struct clk *parent = va->mclk; in va_macro_register_fsgen_output()
1374 struct device *dev = va->dev; in va_macro_register_fsgen_output()
1390 va->hw.init = &init; in va_macro_register_fsgen_output()
1391 ret = devm_clk_hw_register(va->dev, &va->hw); in va_macro_register_fsgen_output()
1395 return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &va->hw); in va_macro_register_fsgen_output()
1399 struct va_macro *va) in va_macro_validate_dmic_sample_rate() argument
1411 va->dmic_clk_div = VA_MACRO_CLK_DIV_2; in va_macro_validate_dmic_sample_rate()
1414 va->dmic_clk_div = VA_MACRO_CLK_DIV_3; in va_macro_validate_dmic_sample_rate()
1417 va->dmic_clk_div = VA_MACRO_CLK_DIV_4; in va_macro_validate_dmic_sample_rate()
1420 va->dmic_clk_div = VA_MACRO_CLK_DIV_6; in va_macro_validate_dmic_sample_rate()
1423 va->dmic_clk_div = VA_MACRO_CLK_DIV_8; in va_macro_validate_dmic_sample_rate()
1426 va->dmic_clk_div = VA_MACRO_CLK_DIV_16; in va_macro_validate_dmic_sample_rate()
1436 dev_err(va->dev, "%s: Invalid rate %d, for mclk %d\n", in va_macro_validate_dmic_sample_rate()
1447 struct va_macro *va; in va_macro_probe() local
1452 va = devm_kzalloc(dev, sizeof(*va), GFP_KERNEL); in va_macro_probe()
1453 if (!va) in va_macro_probe()
1456 va->dev = dev; in va_macro_probe()
1458 va->macro = devm_clk_get_optional(dev, "macro"); in va_macro_probe()
1459 if (IS_ERR(va->macro)) in va_macro_probe()
1460 return dev_err_probe(dev, PTR_ERR(va->macro), "unable to get macro clock\n"); in va_macro_probe()
1462 va->dcodec = devm_clk_get_optional(dev, "dcodec"); in va_macro_probe()
1463 if (IS_ERR(va->dcodec)) in va_macro_probe()
1464 return dev_err_probe(dev, PTR_ERR(va->dcodec), "unable to get dcodec clock\n"); in va_macro_probe()
1466 va->mclk = devm_clk_get(dev, "mclk"); in va_macro_probe()
1467 if (IS_ERR(va->mclk)) in va_macro_probe()
1468 return dev_err_probe(dev, PTR_ERR(va->mclk), "unable to get mclk clock\n"); in va_macro_probe()
1470 va->pds = lpass_macro_pds_init(dev); in va_macro_probe()
1471 if (IS_ERR(va->pds)) in va_macro_probe()
1472 return PTR_ERR(va->pds); in va_macro_probe()
1478 va->dmic_clk_div = VA_MACRO_CLK_DIV_2; in va_macro_probe()
1480 ret = va_macro_validate_dmic_sample_rate(sample_rate, va); in va_macro_probe()
1493 va->regmap = devm_regmap_init_mmio(dev, base, &va_regmap_config); in va_macro_probe()
1494 if (IS_ERR(va->regmap)) { in va_macro_probe()
1499 dev_set_drvdata(dev, va); in va_macro_probe()
1502 va->has_swr_master = data->has_swr_master; in va_macro_probe()
1505 clk_set_rate(va->mclk, 2 * VA_MACRO_MCLK_FREQ); in va_macro_probe()
1507 ret = clk_prepare_enable(va->macro); in va_macro_probe()
1511 ret = clk_prepare_enable(va->dcodec); in va_macro_probe()
1515 ret = clk_prepare_enable(va->mclk); in va_macro_probe()
1519 if (va->has_swr_master) { in va_macro_probe()
1521 regmap_update_bits(va->regmap, CDC_VA_TOP_CSR_SWR_MIC_CTL0, in va_macro_probe()
1524 regmap_update_bits(va->regmap, CDC_VA_TOP_CSR_SWR_MIC_CTL1, in va_macro_probe()
1527 regmap_update_bits(va->regmap, CDC_VA_TOP_CSR_SWR_MIC_CTL2, in va_macro_probe()
1533 if (va->has_swr_master) { in va_macro_probe()
1534 regmap_update_bits(va->regmap, CDC_VA_CLK_RST_CTRL_SWR_CONTROL, in va_macro_probe()
1536 regmap_update_bits(va->regmap, CDC_VA_CLK_RST_CTRL_SWR_CONTROL, in va_macro_probe()
1538 regmap_update_bits(va->regmap, CDC_VA_CLK_RST_CTRL_SWR_CONTROL, in va_macro_probe()
1554 ret = va_macro_register_fsgen_output(va); in va_macro_probe()
1558 va->fsgen = clk_hw_get_clk(&va->hw, "fsgen"); in va_macro_probe()
1559 if (IS_ERR(va->fsgen)) { in va_macro_probe()
1560 ret = PTR_ERR(va->fsgen); in va_macro_probe()
1567 clk_disable_unprepare(va->mclk); in va_macro_probe()
1569 clk_disable_unprepare(va->dcodec); in va_macro_probe()
1571 clk_disable_unprepare(va->macro); in va_macro_probe()
1573 lpass_macro_pds_exit(va->pds); in va_macro_probe()
1580 struct va_macro *va = dev_get_drvdata(&pdev->dev); in va_macro_remove() local
1582 clk_disable_unprepare(va->mclk); in va_macro_remove()
1583 clk_disable_unprepare(va->dcodec); in va_macro_remove()
1584 clk_disable_unprepare(va->macro); in va_macro_remove()
1586 lpass_macro_pds_exit(va->pds); in va_macro_remove()
1591 struct va_macro *va = dev_get_drvdata(dev); in va_macro_runtime_suspend() local
1593 regcache_cache_only(va->regmap, true); in va_macro_runtime_suspend()
1594 regcache_mark_dirty(va->regmap); in va_macro_runtime_suspend()
1596 clk_disable_unprepare(va->mclk); in va_macro_runtime_suspend()
1603 struct va_macro *va = dev_get_drvdata(dev); in va_macro_runtime_resume() local
1606 ret = clk_prepare_enable(va->mclk); in va_macro_runtime_resume()
1608 dev_err(va->dev, "unable to prepare mclk\n"); in va_macro_runtime_resume()
1612 regcache_cache_only(va->regmap, false); in va_macro_runtime_resume()
1613 regcache_sync(va->regmap); in va_macro_runtime_resume()