Lines Matching refs:tx

244 	struct tx_macro *tx;  member
250 struct tx_macro *tx; member
601 static int tx_macro_mclk_enable(struct tx_macro *tx, in tx_macro_mclk_enable() argument
604 struct regmap *regmap = tx->regmap; in tx_macro_mclk_enable()
607 if (tx->tx_mclk_users == 0) { in tx_macro_mclk_enable()
619 tx->tx_mclk_users++; in tx_macro_mclk_enable()
621 if (tx->tx_mclk_users <= 0) { in tx_macro_mclk_enable()
622 dev_err(tx->dev, "clock already disabled\n"); in tx_macro_mclk_enable()
623 tx->tx_mclk_users = 0; in tx_macro_mclk_enable()
626 tx->tx_mclk_users--; in tx_macro_mclk_enable()
627 if (tx->tx_mclk_users == 0) { in tx_macro_mclk_enable()
659 struct tx_macro *tx; in tx_macro_tx_hpf_corner_freq_callback() local
666 tx = hpf_work->tx; in tx_macro_tx_hpf_corner_freq_callback()
667 component = tx->component; in tx_macro_tx_hpf_corner_freq_callback()
703 struct tx_macro *tx; in tx_macro_mute_update_callback() local
709 tx = tx_mute_dwork->tx; in tx_macro_mute_update_callback()
710 component = tx->component; in tx_macro_mute_update_callback()
721 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_mclk_event() local
725 tx_macro_mclk_enable(tx, true); in tx_macro_mclk_event()
728 tx_macro_mclk_enable(tx, false); in tx_macro_mclk_event()
746 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_put_dec_enum() local
796 tx->dmic_clk_div); in tx_macro_put_dec_enum()
811 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_tx_mixer_get() local
813 if (test_bit(dec_id, &tx->active_ch_mask[dai_id])) in tx_macro_tx_mixer_get()
831 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_tx_mixer_put() local
834 if (tx->active_decimator[dai_id] == dec_id) in tx_macro_tx_mixer_put()
837 set_bit(dec_id, &tx->active_ch_mask[dai_id]); in tx_macro_tx_mixer_put()
838 tx->active_ch_cnt[dai_id]++; in tx_macro_tx_mixer_put()
839 tx->active_decimator[dai_id] = dec_id; in tx_macro_tx_mixer_put()
841 if (tx->active_decimator[dai_id] == -1) in tx_macro_tx_mixer_put()
844 tx->active_ch_cnt[dai_id]--; in tx_macro_tx_mixer_put()
845 clear_bit(dec_id, &tx->active_ch_mask[dai_id]); in tx_macro_tx_mixer_put()
846 tx->active_decimator[dai_id] = -1; in tx_macro_tx_mixer_put()
864 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_enable_dec() local
885 tx->dmic_clk_div); in tx_macro_enable_dec()
890 tx->dec_mode[decimator]); in tx_macro_enable_dec()
906 tx->tx_hpf_work[decimator].hpf_cut_off_freq = in tx_macro_enable_dec()
920 &tx->tx_mute_dwork[decimator].dwork, in tx_macro_enable_dec()
922 if (tx->tx_hpf_work[decimator].hpf_cut_off_freq != CF_MIN_3DB_150HZ) { in tx_macro_enable_dec()
924 &tx->tx_hpf_work[decimator].dwork, in tx_macro_enable_dec()
949 if (tx->bcs_enable) { in tx_macro_enable_dec()
952 tx->bcs_clk_en = true; in tx_macro_enable_dec()
957 tx->tx_hpf_work[decimator].hpf_cut_off_freq; in tx_macro_enable_dec()
961 &tx->tx_hpf_work[decimator].dwork)) { in tx_macro_enable_dec()
991 cancel_delayed_work_sync(&tx->tx_mute_dwork[decimator].dwork); in tx_macro_enable_dec()
1000 if (tx->bcs_enable) { in tx_macro_enable_dec()
1007 tx->bcs_clk_en = false; in tx_macro_enable_dec()
1018 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_dec_mode_get() local
1022 ucontrol->value.integer.value[0] = tx->dec_mode[path]; in tx_macro_dec_mode_get()
1034 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_dec_mode_put() local
1036 if (tx->dec_mode[path] == value) in tx_macro_dec_mode_put()
1039 tx->dec_mode[path] = value; in tx_macro_dec_mode_put()
1048 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_get_bcs() local
1050 ucontrol->value.integer.value[0] = tx->bcs_enable; in tx_macro_get_bcs()
1060 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_set_bcs() local
1062 tx->bcs_enable = value; in tx_macro_set_bcs()
1075 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_hw_params() local
1106 for_each_set_bit(decimator, &tx->active_ch_mask[dai->id], TX_MACRO_DEC_MAX) in tx_macro_hw_params()
1118 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_get_channel_map() local
1124 *tx_slot = tx->active_ch_mask[dai->id]; in tx_macro_get_channel_map()
1125 *tx_num = tx->active_ch_cnt[dai->id]; in tx_macro_get_channel_map()
1136 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_digital_mute() local
1140 if (tx->active_decimator[dai->id] == -1) in tx_macro_digital_mute()
1143 decimator = tx->active_decimator[dai->id]; in tx_macro_digital_mute()
1828 struct tx_macro *tx = snd_soc_component_get_drvdata(comp); in tx_macro_component_probe() local
1831 snd_soc_component_init_regmap(comp, tx->regmap); in tx_macro_component_probe()
1834 tx->tx_hpf_work[i].tx = tx; in tx_macro_component_probe()
1835 tx->tx_hpf_work[i].decimator = i; in tx_macro_component_probe()
1836 INIT_DELAYED_WORK(&tx->tx_hpf_work[i].dwork, in tx_macro_component_probe()
1841 tx->tx_mute_dwork[i].tx = tx; in tx_macro_component_probe()
1842 tx->tx_mute_dwork[i].decimator = i; in tx_macro_component_probe()
1843 INIT_DELAYED_WORK(&tx->tx_mute_dwork[i].dwork, in tx_macro_component_probe()
1846 tx->component = comp; in tx_macro_component_probe()
1859 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_enable() local
1860 struct regmap *regmap = tx->regmap; in swclk_gate_enable()
1863 ret = clk_prepare_enable(tx->mclk); in swclk_gate_enable()
1865 dev_err(tx->dev, "failed to enable mclk\n"); in swclk_gate_enable()
1869 tx_macro_mclk_enable(tx, true); in swclk_gate_enable()
1879 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_disable() local
1880 struct regmap *regmap = tx->regmap; in swclk_gate_disable()
1885 tx_macro_mclk_enable(tx, false); in swclk_gate_disable()
1886 clk_disable_unprepare(tx->mclk); in swclk_gate_disable()
1891 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_is_enabled() local
1894 regmap_read(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
1914 static int tx_macro_register_mclk_output(struct tx_macro *tx) in tx_macro_register_mclk_output() argument
1916 struct device *dev = tx->dev; in tx_macro_register_mclk_output()
1923 if (tx->npl) in tx_macro_register_mclk_output()
1924 parent_clk_name = __clk_get_name(tx->npl); in tx_macro_register_mclk_output()
1926 parent_clk_name = __clk_get_name(tx->mclk); in tx_macro_register_mclk_output()
1933 tx->hw.init = &init; in tx_macro_register_mclk_output()
1934 hw = &tx->hw; in tx_macro_register_mclk_output()
1958 struct tx_macro *tx; in tx_macro_probe() local
1964 tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL); in tx_macro_probe()
1965 if (!tx) in tx_macro_probe()
1968 tx->macro = devm_clk_get_optional(dev, "macro"); in tx_macro_probe()
1969 if (IS_ERR(tx->macro)) in tx_macro_probe()
1970 return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n"); in tx_macro_probe()
1972 tx->dcodec = devm_clk_get_optional(dev, "dcodec"); in tx_macro_probe()
1973 if (IS_ERR(tx->dcodec)) in tx_macro_probe()
1974 return dev_err_probe(dev, PTR_ERR(tx->dcodec), "unable to get dcodec clock\n"); in tx_macro_probe()
1976 tx->mclk = devm_clk_get(dev, "mclk"); in tx_macro_probe()
1977 if (IS_ERR(tx->mclk)) in tx_macro_probe()
1978 return dev_err_probe(dev, PTR_ERR(tx->mclk), "unable to get mclk clock\n"); in tx_macro_probe()
1981 tx->npl = devm_clk_get(dev, "npl"); in tx_macro_probe()
1982 if (IS_ERR(tx->npl)) in tx_macro_probe()
1983 return dev_err_probe(dev, PTR_ERR(tx->npl), "unable to get npl clock\n"); in tx_macro_probe()
1986 tx->fsgen = devm_clk_get(dev, "fsgen"); in tx_macro_probe()
1987 if (IS_ERR(tx->fsgen)) in tx_macro_probe()
1988 return dev_err_probe(dev, PTR_ERR(tx->fsgen), "unable to get fsgen clock\n"); in tx_macro_probe()
1990 tx->pds = lpass_macro_pds_init(dev); in tx_macro_probe()
1991 if (IS_ERR(tx->pds)) in tx_macro_probe()
1992 return PTR_ERR(tx->pds); in tx_macro_probe()
2014 tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config); in tx_macro_probe()
2015 if (IS_ERR(tx->regmap)) { in tx_macro_probe()
2016 ret = PTR_ERR(tx->regmap); in tx_macro_probe()
2020 dev_set_drvdata(dev, tx); in tx_macro_probe()
2022 tx->dev = dev; in tx_macro_probe()
2025 clk_set_rate(tx->mclk, MCLK_FREQ); in tx_macro_probe()
2026 clk_set_rate(tx->npl, MCLK_FREQ); in tx_macro_probe()
2028 ret = clk_prepare_enable(tx->macro); in tx_macro_probe()
2032 ret = clk_prepare_enable(tx->dcodec); in tx_macro_probe()
2036 ret = clk_prepare_enable(tx->mclk); in tx_macro_probe()
2040 ret = clk_prepare_enable(tx->npl); in tx_macro_probe()
2044 ret = clk_prepare_enable(tx->fsgen); in tx_macro_probe()
2049 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2052 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2055 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2070 ret = tx_macro_register_mclk_output(tx); in tx_macro_probe()
2077 clk_disable_unprepare(tx->fsgen); in tx_macro_probe()
2079 clk_disable_unprepare(tx->npl); in tx_macro_probe()
2081 clk_disable_unprepare(tx->mclk); in tx_macro_probe()
2083 clk_disable_unprepare(tx->dcodec); in tx_macro_probe()
2085 clk_disable_unprepare(tx->macro); in tx_macro_probe()
2087 lpass_macro_pds_exit(tx->pds); in tx_macro_probe()
2094 struct tx_macro *tx = dev_get_drvdata(&pdev->dev); in tx_macro_remove() local
2096 clk_disable_unprepare(tx->macro); in tx_macro_remove()
2097 clk_disable_unprepare(tx->dcodec); in tx_macro_remove()
2098 clk_disable_unprepare(tx->mclk); in tx_macro_remove()
2099 clk_disable_unprepare(tx->npl); in tx_macro_remove()
2100 clk_disable_unprepare(tx->fsgen); in tx_macro_remove()
2102 lpass_macro_pds_exit(tx->pds); in tx_macro_remove()
2107 struct tx_macro *tx = dev_get_drvdata(dev); in tx_macro_runtime_suspend() local
2109 regcache_cache_only(tx->regmap, true); in tx_macro_runtime_suspend()
2110 regcache_mark_dirty(tx->regmap); in tx_macro_runtime_suspend()
2112 clk_disable_unprepare(tx->fsgen); in tx_macro_runtime_suspend()
2113 clk_disable_unprepare(tx->npl); in tx_macro_runtime_suspend()
2114 clk_disable_unprepare(tx->mclk); in tx_macro_runtime_suspend()
2121 struct tx_macro *tx = dev_get_drvdata(dev); in tx_macro_runtime_resume() local
2124 ret = clk_prepare_enable(tx->mclk); in tx_macro_runtime_resume()
2130 ret = clk_prepare_enable(tx->npl); in tx_macro_runtime_resume()
2136 ret = clk_prepare_enable(tx->fsgen); in tx_macro_runtime_resume()
2142 regcache_cache_only(tx->regmap, false); in tx_macro_runtime_resume()
2143 regcache_sync(tx->regmap); in tx_macro_runtime_resume()
2147 clk_disable_unprepare(tx->npl); in tx_macro_runtime_resume()
2149 clk_disable_unprepare(tx->mclk); in tx_macro_runtime_resume()