Lines Matching refs:tx

246 	struct tx_macro *tx;  member
252 struct tx_macro *tx; member
614 static int tx_macro_mclk_enable(struct tx_macro *tx, in tx_macro_mclk_enable() argument
617 struct regmap *regmap = tx->regmap; in tx_macro_mclk_enable()
620 if (tx->tx_mclk_users == 0) { in tx_macro_mclk_enable()
632 tx->tx_mclk_users++; in tx_macro_mclk_enable()
634 if (tx->tx_mclk_users <= 0) { in tx_macro_mclk_enable()
635 dev_err(tx->dev, "clock already disabled\n"); in tx_macro_mclk_enable()
636 tx->tx_mclk_users = 0; in tx_macro_mclk_enable()
639 tx->tx_mclk_users--; in tx_macro_mclk_enable()
640 if (tx->tx_mclk_users == 0) { in tx_macro_mclk_enable()
652 struct tx_macro *tx, u8 decimator) in is_amic_enabled() argument
659 if (tx->data->ver > LPASS_VER_9_0_0) in is_amic_enabled()
677 struct tx_macro *tx; in tx_macro_tx_hpf_corner_freq_callback() local
684 tx = hpf_work->tx; in tx_macro_tx_hpf_corner_freq_callback()
685 component = tx->component; in tx_macro_tx_hpf_corner_freq_callback()
691 if (is_amic_enabled(component, tx, hpf_work->decimator)) { in tx_macro_tx_hpf_corner_freq_callback()
721 struct tx_macro *tx; in tx_macro_mute_update_callback() local
727 tx = tx_mute_dwork->tx; in tx_macro_mute_update_callback()
728 component = tx->component; in tx_macro_mute_update_callback()
739 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_mclk_event() local
743 tx_macro_mclk_enable(tx, true); in tx_macro_mclk_event()
746 tx_macro_mclk_enable(tx, false); in tx_macro_mclk_event()
757 struct tx_macro *tx, u16 mic_sel_reg, in tx_macro_update_smic_sel_v9() argument
779 struct tx_macro *tx, u16 mic_sel_reg, in tx_macro_update_smic_sel_v9_2() argument
807 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_put_dec_enum() local
849 else if (tx->data->ver <= LPASS_VER_9_0_0) in tx_macro_put_dec_enum()
850 tx_macro_update_smic_sel_v9(component, widget, tx, in tx_macro_put_dec_enum()
853 tx_macro_update_smic_sel_v9_2(component, widget, tx, in tx_macro_put_dec_enum()
868 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_tx_mixer_get() local
870 if (test_bit(dec_id, &tx->active_ch_mask[dai_id])) in tx_macro_tx_mixer_get()
888 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_tx_mixer_put() local
891 if (tx->active_decimator[dai_id] == dec_id) in tx_macro_tx_mixer_put()
894 set_bit(dec_id, &tx->active_ch_mask[dai_id]); in tx_macro_tx_mixer_put()
895 tx->active_ch_cnt[dai_id]++; in tx_macro_tx_mixer_put()
896 tx->active_decimator[dai_id] = dec_id; in tx_macro_tx_mixer_put()
898 if (tx->active_decimator[dai_id] == -1) in tx_macro_tx_mixer_put()
901 tx->active_ch_cnt[dai_id]--; in tx_macro_tx_mixer_put()
902 clear_bit(dec_id, &tx->active_ch_mask[dai_id]); in tx_macro_tx_mixer_put()
903 tx->active_decimator[dai_id] = -1; in tx_macro_tx_mixer_put()
921 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_enable_dec() local
947 tx->dec_mode[decimator]); in tx_macro_enable_dec()
955 if (!is_amic_enabled(component, tx, decimator)) { in tx_macro_enable_dec()
963 tx->tx_hpf_work[decimator].hpf_cut_off_freq = in tx_macro_enable_dec()
971 if (is_amic_enabled(component, tx, decimator)) { in tx_macro_enable_dec()
977 &tx->tx_mute_dwork[decimator].dwork, in tx_macro_enable_dec()
979 if (tx->tx_hpf_work[decimator].hpf_cut_off_freq != CF_MIN_3DB_150HZ) { in tx_macro_enable_dec()
981 &tx->tx_hpf_work[decimator].dwork, in tx_macro_enable_dec()
987 if (!is_amic_enabled(component, tx, decimator)) in tx_macro_enable_dec()
1006 if (tx->bcs_enable) { in tx_macro_enable_dec()
1009 tx->bcs_clk_en = true; in tx_macro_enable_dec()
1014 tx->tx_hpf_work[decimator].hpf_cut_off_freq; in tx_macro_enable_dec()
1018 &tx->tx_hpf_work[decimator].dwork)) { in tx_macro_enable_dec()
1024 if (is_amic_enabled(component, tx, decimator)) in tx_macro_enable_dec()
1048 cancel_delayed_work_sync(&tx->tx_mute_dwork[decimator].dwork); in tx_macro_enable_dec()
1057 if (tx->bcs_enable) { in tx_macro_enable_dec()
1064 tx->bcs_clk_en = false; in tx_macro_enable_dec()
1075 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_dec_mode_get() local
1079 ucontrol->value.integer.value[0] = tx->dec_mode[path]; in tx_macro_dec_mode_get()
1091 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_dec_mode_put() local
1093 if (tx->dec_mode[path] == value) in tx_macro_dec_mode_put()
1096 tx->dec_mode[path] = value; in tx_macro_dec_mode_put()
1105 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_get_bcs() local
1107 ucontrol->value.integer.value[0] = tx->bcs_enable; in tx_macro_get_bcs()
1117 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_set_bcs() local
1119 tx->bcs_enable = value; in tx_macro_set_bcs()
1132 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_hw_params() local
1163 for_each_set_bit(decimator, &tx->active_ch_mask[dai->id], TX_MACRO_DEC_MAX) in tx_macro_hw_params()
1175 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_get_channel_map() local
1181 *tx_slot = tx->active_ch_mask[dai->id]; in tx_macro_get_channel_map()
1182 *tx_num = tx->active_ch_cnt[dai->id]; in tx_macro_get_channel_map()
1193 struct tx_macro *tx = snd_soc_component_get_drvdata(component); in tx_macro_digital_mute() local
1197 if (tx->active_decimator[dai->id] == -1) in tx_macro_digital_mute()
1200 decimator = tx->active_decimator[dai->id]; in tx_macro_digital_mute()
2086 struct tx_macro *tx = snd_soc_component_get_drvdata(comp); in tx_macro_component_extend() local
2089 if (tx->data->extra_widgets_num) { in tx_macro_component_extend()
2090 ret = snd_soc_dapm_new_controls(dapm, tx->data->extra_widgets, in tx_macro_component_extend()
2091 tx->data->extra_widgets_num); in tx_macro_component_extend()
2093 dev_err(tx->dev, "failed to add extra widgets: %d\n", ret); in tx_macro_component_extend()
2098 if (tx->data->extra_routes_num) { in tx_macro_component_extend()
2099 ret = snd_soc_dapm_add_routes(dapm, tx->data->extra_routes, in tx_macro_component_extend()
2100 tx->data->extra_routes_num); in tx_macro_component_extend()
2102 dev_err(tx->dev, "failed to add extra routes: %d\n", ret); in tx_macro_component_extend()
2112 struct tx_macro *tx = snd_soc_component_get_drvdata(comp); in tx_macro_component_probe() local
2119 snd_soc_component_init_regmap(comp, tx->regmap); in tx_macro_component_probe()
2122 tx->tx_hpf_work[i].tx = tx; in tx_macro_component_probe()
2123 tx->tx_hpf_work[i].decimator = i; in tx_macro_component_probe()
2124 INIT_DELAYED_WORK(&tx->tx_hpf_work[i].dwork, in tx_macro_component_probe()
2129 tx->tx_mute_dwork[i].tx = tx; in tx_macro_component_probe()
2130 tx->tx_mute_dwork[i].decimator = i; in tx_macro_component_probe()
2131 INIT_DELAYED_WORK(&tx->tx_mute_dwork[i].dwork, in tx_macro_component_probe()
2134 tx->component = comp; in tx_macro_component_probe()
2149 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_enable() local
2150 struct regmap *regmap = tx->regmap; in swclk_gate_enable()
2153 ret = clk_prepare_enable(tx->mclk); in swclk_gate_enable()
2155 dev_err(tx->dev, "failed to enable mclk\n"); in swclk_gate_enable()
2159 tx_macro_mclk_enable(tx, true); in swclk_gate_enable()
2169 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_disable() local
2170 struct regmap *regmap = tx->regmap; in swclk_gate_disable()
2175 tx_macro_mclk_enable(tx, false); in swclk_gate_disable()
2176 clk_disable_unprepare(tx->mclk); in swclk_gate_disable()
2181 struct tx_macro *tx = to_tx_macro(hw); in swclk_gate_is_enabled() local
2184 regmap_read(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
2204 static int tx_macro_register_mclk_output(struct tx_macro *tx) in tx_macro_register_mclk_output() argument
2206 struct device *dev = tx->dev; in tx_macro_register_mclk_output()
2213 if (tx->npl) in tx_macro_register_mclk_output()
2214 parent_clk_name = __clk_get_name(tx->npl); in tx_macro_register_mclk_output()
2216 parent_clk_name = __clk_get_name(tx->mclk); in tx_macro_register_mclk_output()
2223 tx->hw.init = &init; in tx_macro_register_mclk_output()
2224 hw = &tx->hw; in tx_macro_register_mclk_output()
2247 struct tx_macro *tx; in tx_macro_probe() local
2251 tx = devm_kzalloc(dev, sizeof(*tx), GFP_KERNEL); in tx_macro_probe()
2252 if (!tx) in tx_macro_probe()
2255 tx->data = device_get_match_data(dev); in tx_macro_probe()
2257 tx->macro = devm_clk_get_optional(dev, "macro"); in tx_macro_probe()
2258 if (IS_ERR(tx->macro)) in tx_macro_probe()
2259 return dev_err_probe(dev, PTR_ERR(tx->macro), "unable to get macro clock\n"); in tx_macro_probe()
2261 tx->dcodec = devm_clk_get_optional(dev, "dcodec"); in tx_macro_probe()
2262 if (IS_ERR(tx->dcodec)) in tx_macro_probe()
2263 return dev_err_probe(dev, PTR_ERR(tx->dcodec), "unable to get dcodec clock\n"); in tx_macro_probe()
2265 tx->mclk = devm_clk_get(dev, "mclk"); in tx_macro_probe()
2266 if (IS_ERR(tx->mclk)) in tx_macro_probe()
2267 return dev_err_probe(dev, PTR_ERR(tx->mclk), "unable to get mclk clock\n"); in tx_macro_probe()
2269 if (tx->data->flags & LPASS_MACRO_FLAG_HAS_NPL_CLOCK) { in tx_macro_probe()
2270 tx->npl = devm_clk_get(dev, "npl"); in tx_macro_probe()
2271 if (IS_ERR(tx->npl)) in tx_macro_probe()
2272 return dev_err_probe(dev, PTR_ERR(tx->npl), "unable to get npl clock\n"); in tx_macro_probe()
2275 tx->fsgen = devm_clk_get(dev, "fsgen"); in tx_macro_probe()
2276 if (IS_ERR(tx->fsgen)) in tx_macro_probe()
2277 return dev_err_probe(dev, PTR_ERR(tx->fsgen), "unable to get fsgen clock\n"); in tx_macro_probe()
2279 tx->pds = lpass_macro_pds_init(dev); in tx_macro_probe()
2280 if (IS_ERR(tx->pds)) in tx_macro_probe()
2281 return PTR_ERR(tx->pds); in tx_macro_probe()
2303 tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config); in tx_macro_probe()
2304 if (IS_ERR(tx->regmap)) { in tx_macro_probe()
2305 ret = PTR_ERR(tx->regmap); in tx_macro_probe()
2309 dev_set_drvdata(dev, tx); in tx_macro_probe()
2311 tx->dev = dev; in tx_macro_probe()
2314 tx->active_decimator[TX_MACRO_AIF1_CAP] = -1; in tx_macro_probe()
2315 tx->active_decimator[TX_MACRO_AIF2_CAP] = -1; in tx_macro_probe()
2316 tx->active_decimator[TX_MACRO_AIF3_CAP] = -1; in tx_macro_probe()
2319 clk_set_rate(tx->mclk, MCLK_FREQ); in tx_macro_probe()
2320 clk_set_rate(tx->npl, MCLK_FREQ); in tx_macro_probe()
2322 ret = clk_prepare_enable(tx->macro); in tx_macro_probe()
2326 ret = clk_prepare_enable(tx->dcodec); in tx_macro_probe()
2330 ret = clk_prepare_enable(tx->mclk); in tx_macro_probe()
2334 ret = clk_prepare_enable(tx->npl); in tx_macro_probe()
2338 ret = clk_prepare_enable(tx->fsgen); in tx_macro_probe()
2344 if (tx->data->flags & LPASS_MACRO_FLAG_RESET_SWR) in tx_macro_probe()
2345 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2348 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2352 if (tx->data->flags & LPASS_MACRO_FLAG_RESET_SWR) in tx_macro_probe()
2353 regmap_update_bits(tx->regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL, in tx_macro_probe()
2368 ret = tx_macro_register_mclk_output(tx); in tx_macro_probe()
2375 clk_disable_unprepare(tx->fsgen); in tx_macro_probe()
2377 clk_disable_unprepare(tx->npl); in tx_macro_probe()
2379 clk_disable_unprepare(tx->mclk); in tx_macro_probe()
2381 clk_disable_unprepare(tx->dcodec); in tx_macro_probe()
2383 clk_disable_unprepare(tx->macro); in tx_macro_probe()
2385 lpass_macro_pds_exit(tx->pds); in tx_macro_probe()
2392 struct tx_macro *tx = dev_get_drvdata(&pdev->dev); in tx_macro_remove() local
2394 clk_disable_unprepare(tx->macro); in tx_macro_remove()
2395 clk_disable_unprepare(tx->dcodec); in tx_macro_remove()
2396 clk_disable_unprepare(tx->mclk); in tx_macro_remove()
2397 clk_disable_unprepare(tx->npl); in tx_macro_remove()
2398 clk_disable_unprepare(tx->fsgen); in tx_macro_remove()
2400 lpass_macro_pds_exit(tx->pds); in tx_macro_remove()
2405 struct tx_macro *tx = dev_get_drvdata(dev); in tx_macro_runtime_suspend() local
2407 regcache_cache_only(tx->regmap, true); in tx_macro_runtime_suspend()
2408 regcache_mark_dirty(tx->regmap); in tx_macro_runtime_suspend()
2410 clk_disable_unprepare(tx->fsgen); in tx_macro_runtime_suspend()
2411 clk_disable_unprepare(tx->npl); in tx_macro_runtime_suspend()
2412 clk_disable_unprepare(tx->mclk); in tx_macro_runtime_suspend()
2419 struct tx_macro *tx = dev_get_drvdata(dev); in tx_macro_runtime_resume() local
2422 ret = clk_prepare_enable(tx->mclk); in tx_macro_runtime_resume()
2428 ret = clk_prepare_enable(tx->npl); in tx_macro_runtime_resume()
2434 ret = clk_prepare_enable(tx->fsgen); in tx_macro_runtime_resume()
2440 regcache_cache_only(tx->regmap, false); in tx_macro_runtime_resume()
2441 regcache_sync(tx->regmap); in tx_macro_runtime_resume()
2445 clk_disable_unprepare(tx->npl); in tx_macro_runtime_resume()
2447 clk_disable_unprepare(tx->mclk); in tx_macro_runtime_resume()