Lines Matching full:wsa

20 #include "lpass-wsa-macro.h"
609 SOC_DAPM_ENUM("WSA RX_MIX EC0_Mux", rx_mix_ec0_enum);
612 SOC_DAPM_ENUM("WSA RX_MIX EC1_Mux", rx_mix_ec1_enum);
615 /* WSA Macro */
880 struct wsa_macro *wsa = dev_get_drvdata(dev); in wsa_is_rw_register() local
986 if (wsa->codec_version >= LPASS_CODEC_VERSION_2_5) in wsa_is_rw_register()
1025 struct wsa_macro *wsa = dev_get_drvdata(dev); in wsa_is_readable_register() local
1047 if (wsa->codec_version >= LPASS_CODEC_VERSION_2_5) in wsa_is_readable_register()
1075 struct wsa_macro *wsa = dev_get_drvdata(dev); in wsa_is_volatile_register() local
1095 if (wsa->codec_version >= LPASS_CODEC_VERSION_2_5) in wsa_is_volatile_register()
1125 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_set_spkr_mode() local
1127 wsa->spkr_mode = mode; in wsa_macro_set_spkr_mode()
1161 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_set_prim_interpolator_rate() local
1163 for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { in wsa_macro_set_prim_interpolator_rate()
1181 wsa->reg_layout->rx_intx_1_mix_inp0_sel_mask); in wsa_macro_set_prim_interpolator_rate()
1183 wsa->reg_layout->rx_intx_1_mix_inp1_sel_mask); in wsa_macro_set_prim_interpolator_rate()
1185 wsa->reg_layout->rx_intx_1_mix_inp2_sel_mask); in wsa_macro_set_prim_interpolator_rate()
1213 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_set_mix_interpolator_rate() local
1215 for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { in wsa_macro_set_mix_interpolator_rate()
1226 wsa->reg_layout->rx_intx_2_sel_mask); in wsa_macro_set_mix_interpolator_rate()
1306 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_get_channel_map() local
1311 *tx_slot = wsa->active_ch_mask[dai->id]; in wsa_macro_get_channel_map()
1312 *tx_num = wsa->active_ch_cnt[dai->id]; in wsa_macro_get_channel_map()
1316 for_each_set_bit(temp, &wsa->active_ch_mask[dai->id], in wsa_macro_get_channel_map()
1411 static void wsa_macro_mclk_enable(struct wsa_macro *wsa, bool mclk_enable) in wsa_macro_mclk_enable() argument
1413 struct regmap *regmap = wsa->regmap; in wsa_macro_mclk_enable()
1416 if (wsa->wsa_mclk_users == 0) { in wsa_macro_mclk_enable()
1430 wsa->wsa_mclk_users++; in wsa_macro_mclk_enable()
1432 if (wsa->wsa_mclk_users <= 0) { in wsa_macro_mclk_enable()
1433 dev_err(wsa->dev, "clock already disabled\n"); in wsa_macro_mclk_enable()
1434 wsa->wsa_mclk_users = 0; in wsa_macro_mclk_enable()
1437 wsa->wsa_mclk_users--; in wsa_macro_mclk_enable()
1438 if (wsa->wsa_mclk_users == 0) { in wsa_macro_mclk_enable()
1455 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_mclk_event() local
1457 wsa_macro_mclk_enable(wsa, event == SND_SOC_DAPM_PRE_PMU); in wsa_macro_mclk_event()
1466 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_enable_vi_feedback() local
1469 if (test_bit(WSA_MACRO_TX0, &wsa->active_ch_mask[WSA_MACRO_AIF_VI])) { in wsa_macro_enable_vi_feedback()
1472 } else if (test_bit(WSA_MACRO_TX1, &wsa->active_ch_mask[WSA_MACRO_AIF_VI])) { in wsa_macro_enable_vi_feedback()
1603 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_config_compander() local
1605 if (!wsa->comp_enabled[comp]) in wsa_macro_config_compander()
1609 (comp * wsa->reg_layout->compander1_reg_offset); in wsa_macro_config_compander()
1651 struct wsa_macro *wsa, in wsa_macro_enable_softclip_clk() argument
1655 u16 softclip_clk_reg = wsa->reg_layout->softclip0_reg_base + in wsa_macro_enable_softclip_clk()
1656 (path * wsa->reg_layout->softclip1_reg_offset); in wsa_macro_enable_softclip_clk()
1661 if (wsa->softclip_clk_users[path] == 0) { in wsa_macro_enable_softclip_clk()
1670 wsa->softclip_clk_users[path]++; in wsa_macro_enable_softclip_clk()
1672 wsa->softclip_clk_users[path]--; in wsa_macro_enable_softclip_clk()
1673 if (wsa->softclip_clk_users[path] == 0) { in wsa_macro_enable_softclip_clk()
1689 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_config_softclip() local
1697 if (!wsa->is_softclip_on[softclip_path]) in wsa_macro_config_softclip()
1701 (softclip_path * wsa->reg_layout->softclip1_reg_offset); in wsa_macro_config_softclip()
1705 wsa_macro_enable_softclip_clk(component, wsa, softclip_path, in wsa_macro_config_softclip()
1716 wsa_macro_enable_softclip_clk(component, wsa, softclip_path, in wsa_macro_config_softclip()
1726 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_adie_lb() local
1734 wsa->reg_layout->rx_intx_1_mix_inp0_sel_mask); in wsa_macro_adie_lb()
1740 wsa->reg_layout->rx_intx_1_mix_inp1_sel_mask); in wsa_macro_adie_lb()
1746 wsa->reg_layout->rx_intx_1_mix_inp2_sel_mask); in wsa_macro_adie_lb()
1801 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_enable_prim_interpolator() local
1807 wsa->prim_int_users[ind]++; in wsa_macro_enable_prim_interpolator()
1808 if (wsa->prim_int_users[ind] == 1) { in wsa_macro_enable_prim_interpolator()
1829 wsa->prim_int_users[ind]--; in wsa_macro_enable_prim_interpolator()
1830 if (wsa->prim_int_users[ind] == 0) { in wsa_macro_enable_prim_interpolator()
1843 struct wsa_macro *wsa, in wsa_macro_config_ear_spkr_gain() argument
1848 switch (wsa->spkr_mode) { in wsa_macro_config_ear_spkr_gain()
1862 if (wsa->comp_enabled[WSA_MACRO_COMP1] && in wsa_macro_config_ear_spkr_gain()
1864 (wsa->ear_spkr_gain != 0)) { in wsa_macro_config_ear_spkr_gain()
1866 val = comp_gain_offset + wsa->ear_spkr_gain - 1; in wsa_macro_config_ear_spkr_gain()
1875 if (wsa->comp_enabled[WSA_MACRO_COMP1] && in wsa_macro_config_ear_spkr_gain()
1877 (wsa->ear_spkr_gain != 0)) { in wsa_macro_config_ear_spkr_gain()
1894 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_enable_interpolator() local
1913 if ((wsa->spkr_gain_offset == WSA_MACRO_GAIN_OFFSET_M1P5_DB) && in wsa_macro_enable_interpolator()
1914 (wsa->comp_enabled[WSA_MACRO_COMP1] || in wsa_macro_enable_interpolator()
1915 wsa->comp_enabled[WSA_MACRO_COMP2])) { in wsa_macro_enable_interpolator()
1935 wsa_macro_config_ear_spkr_gain(component, wsa, in wsa_macro_enable_interpolator()
1942 if ((wsa->spkr_gain_offset == WSA_MACRO_GAIN_OFFSET_M1P5_DB) && in wsa_macro_enable_interpolator()
1943 (wsa->comp_enabled[WSA_MACRO_COMP1] || in wsa_macro_enable_interpolator()
1944 wsa->comp_enabled[WSA_MACRO_COMP2])) { in wsa_macro_enable_interpolator()
1962 wsa_macro_config_ear_spkr_gain(component, wsa, in wsa_macro_enable_interpolator()
2026 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_enable_echo() local
2046 if (wsa->ec_hq[ec_tx]) { in wsa_macro_enable_echo()
2067 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_get_ec_hq() local
2069 ucontrol->value.integer.value[0] = wsa->ec_hq[ec_tx]; in wsa_macro_get_ec_hq()
2080 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_set_ec_hq() local
2082 wsa->ec_hq[ec_tx] = value; in wsa_macro_set_ec_hq()
2093 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_get_compander() local
2095 ucontrol->value.integer.value[0] = wsa->comp_enabled[comp]; in wsa_macro_get_compander()
2105 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_set_compander() local
2107 wsa->comp_enabled[comp] = value; in wsa_macro_set_compander()
2116 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_ear_spkr_pa_gain_get() local
2118 ucontrol->value.integer.value[0] = wsa->ear_spkr_gain; in wsa_macro_ear_spkr_pa_gain_get()
2127 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_ear_spkr_pa_gain_put() local
2129 wsa->ear_spkr_gain = ucontrol->value.integer.value[0]; in wsa_macro_ear_spkr_pa_gain_put()
2141 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_rx_mux_get() local
2144 wsa->rx_port_value[widget->shift]; in wsa_macro_rx_mux_get()
2160 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_rx_mux_put() local
2162 aif_rst = wsa->rx_port_value[widget->shift]; in wsa_macro_rx_mux_put()
2171 wsa->rx_port_value[widget->shift] = rx_port_value; in wsa_macro_rx_mux_put()
2177 if (wsa->active_ch_cnt[aif_rst]) { in wsa_macro_rx_mux_put()
2179 &wsa->active_ch_mask[aif_rst]); in wsa_macro_rx_mux_put()
2180 wsa->active_ch_cnt[aif_rst]--; in wsa_macro_rx_mux_put()
2186 &wsa->active_ch_mask[rx_port_value]); in wsa_macro_rx_mux_put()
2187 wsa->active_ch_cnt[rx_port_value]++; in wsa_macro_rx_mux_put()
2191 "%s: Invalid AIF_ID for WSA RX MUX %d\n", in wsa_macro_rx_mux_put()
2205 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_soft_clip_enable_get() local
2208 ucontrol->value.integer.value[0] = wsa->is_softclip_on[path]; in wsa_macro_soft_clip_enable_get()
2217 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_soft_clip_enable_put() local
2220 wsa->is_softclip_on[path] = ucontrol->value.integer.value[0]; in wsa_macro_soft_clip_enable_put()
2263 SOC_DAPM_ENUM_EXT("WSA RX0 Mux", rx_mux_enum,
2265 SOC_DAPM_ENUM_EXT("WSA RX1 Mux", rx_mux_enum,
2267 SOC_DAPM_ENUM_EXT("WSA RX_MIX0 Mux", rx_mux_enum,
2269 SOC_DAPM_ENUM_EXT("WSA RX_MIX1 Mux", rx_mux_enum,
2279 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_vi_feed_mixer_get() local
2283 if (test_bit(spk_tx_id, &wsa->active_ch_mask[dai_id])) in wsa_macro_vi_feed_mixer_get()
2297 struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); in wsa_macro_vi_feed_mixer_put() local
2305 &wsa->active_ch_mask[dai_id])) { in wsa_macro_vi_feed_mixer_put()
2307 &wsa->active_ch_mask[dai_id]); in wsa_macro_vi_feed_mixer_put()
2308 wsa->active_ch_cnt[dai_id]++; in wsa_macro_vi_feed_mixer_put()
2312 &wsa->active_ch_mask[dai_id])) { in wsa_macro_vi_feed_mixer_put()
2314 &wsa->active_ch_mask[dai_id]); in wsa_macro_vi_feed_mixer_put()
2315 wsa->active_ch_cnt[dai_id]++; in wsa_macro_vi_feed_mixer_put()
2320 &wsa->active_ch_mask[dai_id])) { in wsa_macro_vi_feed_mixer_put()
2322 &wsa->active_ch_mask[dai_id]); in wsa_macro_vi_feed_mixer_put()
2323 wsa->active_ch_cnt[dai_id]--; in wsa_macro_vi_feed_mixer_put()
2327 &wsa->active_ch_mask[dai_id])) { in wsa_macro_vi_feed_mixer_put()
2329 &wsa->active_ch_mask[dai_id]); in wsa_macro_vi_feed_mixer_put()
2330 wsa->active_ch_cnt[dai_id]--; in wsa_macro_vi_feed_mixer_put()
2348 SND_SOC_DAPM_AIF_IN("WSA AIF1 PB", "WSA_AIF1 Playback", 0,
2350 SND_SOC_DAPM_AIF_IN("WSA AIF_MIX1 PB", "WSA_AIF_MIX1 Playback", 0,
2353 SND_SOC_DAPM_AIF_OUT_E("WSA AIF_VI", "WSA_AIF_VI Capture", 0,
2357 SND_SOC_DAPM_AIF_OUT("WSA AIF_ECHO", "WSA_AIF_ECHO Capture", 0,
2362 SND_SOC_DAPM_MUX_E("WSA RX_MIX EC0_MUX", SND_SOC_NOPM,
2366 SND_SOC_DAPM_MUX_E("WSA RX_MIX EC1_MUX", SND_SOC_NOPM,
2371 SND_SOC_DAPM_MUX("WSA RX0 MUX", SND_SOC_NOPM, WSA_MACRO_RX0, 0,
2373 SND_SOC_DAPM_MUX("WSA RX1 MUX", SND_SOC_NOPM, WSA_MACRO_RX1, 0,
2375 SND_SOC_DAPM_MUX("WSA RX_MIX0 MUX", SND_SOC_NOPM, WSA_MACRO_RX_MIX0, 0,
2377 SND_SOC_DAPM_MUX("WSA RX_MIX1 MUX", SND_SOC_NOPM, WSA_MACRO_RX_MIX1, 0,
2380 SND_SOC_DAPM_MIXER("WSA RX0", SND_SOC_NOPM, 0, 0, NULL, 0),
2381 SND_SOC_DAPM_MIXER("WSA RX1", SND_SOC_NOPM, 0, 0, NULL, 0),
2382 SND_SOC_DAPM_MIXER("WSA RX_MIX0", SND_SOC_NOPM, 0, 0, NULL, 0),
2383 SND_SOC_DAPM_MIXER("WSA RX_MIX1", SND_SOC_NOPM, 0, 0, NULL, 0),
2396 SND_SOC_DAPM_INPUT("WSA SRC0_INP"),
2469 {"WSA AIF_VI", NULL, "WSA_AIF_VI Mixer"},
2470 {"WSA AIF_VI", NULL, "WSA_MCLK"},
2472 {"WSA RX_MIX EC0_MUX", "RX_MIX_TX0", "WSA_RX INT0 SEC MIX"},
2473 {"WSA RX_MIX EC1_MUX", "RX_MIX_TX0", "WSA_RX INT0 SEC MIX"},
2474 {"WSA RX_MIX EC0_MUX", "RX_MIX_TX1", "WSA_RX INT1 SEC MIX"},
2475 {"WSA RX_MIX EC1_MUX", "RX_MIX_TX1", "WSA_RX INT1 SEC MIX"},
2476 {"WSA AIF_ECHO", NULL, "WSA RX_MIX EC0_MUX"},
2477 {"WSA AIF_ECHO", NULL, "WSA RX_MIX EC1_MUX"},
2478 {"WSA AIF_ECHO", NULL, "WSA_MCLK"},
2480 {"WSA AIF1 PB", NULL, "WSA_MCLK"},
2481 {"WSA AIF_MIX1 PB", NULL, "WSA_MCLK"},
2483 {"WSA RX0 MUX", "AIF1_PB", "WSA AIF1 PB"},
2484 {"WSA RX1 MUX", "AIF1_PB", "WSA AIF1 PB"},
2485 {"WSA RX_MIX0 MUX", "AIF1_PB", "WSA AIF1 PB"},
2486 {"WSA RX_MIX1 MUX", "AIF1_PB", "WSA AIF1 PB"},
2488 {"WSA RX0 MUX", "AIF_MIX1_PB", "WSA AIF_MIX1 PB"},
2489 {"WSA RX1 MUX", "AIF_MIX1_PB", "WSA AIF_MIX1 PB"},
2490 {"WSA RX_MIX0 MUX", "AIF_MIX1_PB", "WSA AIF_MIX1 PB"},
2491 {"WSA RX_MIX1 MUX", "AIF_MIX1_PB", "WSA AIF_MIX1 PB"},
2493 {"WSA RX0", NULL, "WSA RX0 MUX"},
2494 {"WSA RX1", NULL, "WSA RX1 MUX"},
2495 {"WSA RX_MIX0", NULL, "WSA RX_MIX0 MUX"},
2496 {"WSA RX_MIX1", NULL, "WSA RX_MIX1 MUX"},
2498 {"WSA RX0", NULL, "WSA_RX0_CLK"},
2499 {"WSA RX1", NULL, "WSA_RX1_CLK"},
2500 {"WSA RX_MIX0", NULL, "WSA_RX_MIX0_CLK"},
2501 {"WSA RX_MIX1", NULL, "WSA_RX_MIX1_CLK"},
2503 {"WSA_RX0 INP0", "RX0", "WSA RX0"},
2504 {"WSA_RX0 INP0", "RX1", "WSA RX1"},
2505 {"WSA_RX0 INP0", "RX_MIX0", "WSA RX_MIX0"},
2506 {"WSA_RX0 INP0", "RX_MIX1", "WSA RX_MIX1"},
2511 {"WSA_RX0 INP1", "RX0", "WSA RX0"},
2512 {"WSA_RX0 INP1", "RX1", "WSA RX1"},
2513 {"WSA_RX0 INP1", "RX_MIX0", "WSA RX_MIX0"},
2514 {"WSA_RX0 INP1", "RX_MIX1", "WSA RX_MIX1"},
2519 {"WSA_RX0 INP2", "RX0", "WSA RX0"},
2520 {"WSA_RX0 INP2", "RX1", "WSA RX1"},
2521 {"WSA_RX0 INP2", "RX_MIX0", "WSA RX_MIX0"},
2522 {"WSA_RX0 INP2", "RX_MIX1", "WSA RX_MIX1"},
2527 {"WSA_RX0 MIX INP", "RX0", "WSA RX0"},
2528 {"WSA_RX0 MIX INP", "RX1", "WSA RX1"},
2529 {"WSA_RX0 MIX INP", "RX_MIX0", "WSA RX_MIX0"},
2530 {"WSA_RX0 MIX INP", "RX_MIX1", "WSA RX_MIX1"},
2535 {"WSA_RX0 INT0 SIDETONE MIX", "SRC0", "WSA SRC0_INP"},
2542 {"WSA_RX1 INP0", "RX0", "WSA RX0"},
2543 {"WSA_RX1 INP0", "RX1", "WSA RX1"},
2544 {"WSA_RX1 INP0", "RX_MIX0", "WSA RX_MIX0"},
2545 {"WSA_RX1 INP0", "RX_MIX1", "WSA RX_MIX1"},
2550 {"WSA_RX1 INP1", "RX0", "WSA RX0"},
2551 {"WSA_RX1 INP1", "RX1", "WSA RX1"},
2552 {"WSA_RX1 INP1", "RX_MIX0", "WSA RX_MIX0"},
2553 {"WSA_RX1 INP1", "RX_MIX1", "WSA RX_MIX1"},
2558 {"WSA_RX1 INP2", "RX0", "WSA RX0"},
2559 {"WSA_RX1 INP2", "RX1", "WSA RX1"},
2560 {"WSA_RX1 INP2", "RX_MIX0", "WSA RX_MIX0"},
2561 {"WSA_RX1 INP2", "RX_MIX1", "WSA RX_MIX1"},
2566 {"WSA_RX1 MIX INP", "RX0", "WSA RX0"},
2567 {"WSA_RX1 MIX INP", "RX1", "WSA RX1"},
2568 {"WSA_RX1 MIX INP", "RX_MIX0", "WSA RX_MIX0"},
2569 {"WSA_RX1 MIX INP", "RX_MIX1", "WSA RX_MIX1"},
2580 static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) in wsa_swrm_clock() argument
2582 struct regmap *regmap = wsa->regmap; in wsa_swrm_clock()
2587 ret = clk_prepare_enable(wsa->mclk); in wsa_swrm_clock()
2589 dev_err(wsa->dev, "failed to enable mclk\n"); in wsa_swrm_clock()
2592 wsa_macro_mclk_enable(wsa, true); in wsa_swrm_clock()
2601 wsa_macro_mclk_enable(wsa, false); in wsa_swrm_clock()
2602 clk_disable_unprepare(wsa->mclk); in wsa_swrm_clock()
2611 struct wsa_macro *wsa = snd_soc_component_get_drvdata(comp); in wsa_macro_component_probe() local
2615 snd_soc_component_init_regmap(comp, wsa->regmap); in wsa_macro_component_probe()
2617 wsa->spkr_gain_offset = WSA_MACRO_GAIN_OFFSET_M1P5_DB; in wsa_macro_component_probe()
2630 switch (wsa->codec_version) { in wsa_macro_component_probe()
2665 struct wsa_macro *wsa = to_wsa_macro(hw); in swclk_gate_is_enabled() local
2668 regmap_read(wsa->regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
2687 static int wsa_macro_register_mclk_output(struct wsa_macro *wsa) in wsa_macro_register_mclk_output() argument
2689 struct device *dev = wsa->dev; in wsa_macro_register_mclk_output()
2695 if (wsa->npl) in wsa_macro_register_mclk_output()
2696 parent_clk_name = __clk_get_name(wsa->npl); in wsa_macro_register_mclk_output()
2698 parent_clk_name = __clk_get_name(wsa->mclk); in wsa_macro_register_mclk_output()
2707 wsa->hw.init = &init; in wsa_macro_register_mclk_output()
2708 hw = &wsa->hw; in wsa_macro_register_mclk_output()
2709 ret = clk_hw_register(wsa->dev, hw); in wsa_macro_register_mclk_output()
2717 .name = "WSA MACRO",
2730 struct wsa_macro *wsa; in wsa_macro_probe() local
2737 wsa = devm_kzalloc(dev, sizeof(*wsa), GFP_KERNEL); in wsa_macro_probe()
2738 if (!wsa) in wsa_macro_probe()
2741 wsa->macro = devm_clk_get_optional(dev, "macro"); in wsa_macro_probe()
2742 if (IS_ERR(wsa->macro)) in wsa_macro_probe()
2743 return dev_err_probe(dev, PTR_ERR(wsa->macro), "unable to get macro clock\n"); in wsa_macro_probe()
2745 wsa->dcodec = devm_clk_get_optional(dev, "dcodec"); in wsa_macro_probe()
2746 if (IS_ERR(wsa->dcodec)) in wsa_macro_probe()
2747 return dev_err_probe(dev, PTR_ERR(wsa->dcodec), "unable to get dcodec clock\n"); in wsa_macro_probe()
2749 wsa->mclk = devm_clk_get(dev, "mclk"); in wsa_macro_probe()
2750 if (IS_ERR(wsa->mclk)) in wsa_macro_probe()
2751 return dev_err_probe(dev, PTR_ERR(wsa->mclk), "unable to get mclk clock\n"); in wsa_macro_probe()
2754 wsa->npl = devm_clk_get(dev, "npl"); in wsa_macro_probe()
2755 if (IS_ERR(wsa->npl)) in wsa_macro_probe()
2756 return dev_err_probe(dev, PTR_ERR(wsa->npl), "unable to get npl clock\n"); in wsa_macro_probe()
2759 wsa->fsgen = devm_clk_get(dev, "fsgen"); in wsa_macro_probe()
2760 if (IS_ERR(wsa->fsgen)) in wsa_macro_probe()
2761 return dev_err_probe(dev, PTR_ERR(wsa->fsgen), "unable to get fsgen clock\n"); in wsa_macro_probe()
2767 wsa->codec_version = lpass_macro_get_codec_version(); in wsa_macro_probe()
2770 switch (wsa->codec_version) { in wsa_macro_probe()
2776 wsa->reg_layout = &wsa_codec_v2_1; in wsa_macro_probe()
2791 wsa->reg_layout = &wsa_codec_v2_5; in wsa_macro_probe()
2803 dev_err(dev, "Unsupported Codec version (%d)\n", wsa->codec_version); in wsa_macro_probe()
2816 wsa->regmap = devm_regmap_init_mmio(dev, base, reg_config); in wsa_macro_probe()
2817 if (IS_ERR(wsa->regmap)) in wsa_macro_probe()
2818 return PTR_ERR(wsa->regmap); in wsa_macro_probe()
2820 dev_set_drvdata(dev, wsa); in wsa_macro_probe()
2822 wsa->dev = dev; in wsa_macro_probe()
2825 clk_set_rate(wsa->mclk, WSA_MACRO_MCLK_FREQ); in wsa_macro_probe()
2826 clk_set_rate(wsa->npl, WSA_MACRO_MCLK_FREQ); in wsa_macro_probe()
2828 ret = clk_prepare_enable(wsa->macro); in wsa_macro_probe()
2832 ret = clk_prepare_enable(wsa->dcodec); in wsa_macro_probe()
2836 ret = clk_prepare_enable(wsa->mclk); in wsa_macro_probe()
2840 ret = clk_prepare_enable(wsa->npl); in wsa_macro_probe()
2844 ret = clk_prepare_enable(wsa->fsgen); in wsa_macro_probe()
2849 regmap_update_bits(wsa->regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, in wsa_macro_probe()
2852 regmap_update_bits(wsa->regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, in wsa_macro_probe()
2856 regmap_update_bits(wsa->regmap, CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, in wsa_macro_probe()
2871 ret = wsa_macro_register_mclk_output(wsa); in wsa_macro_probe()
2878 clk_disable_unprepare(wsa->fsgen); in wsa_macro_probe()
2880 clk_disable_unprepare(wsa->npl); in wsa_macro_probe()
2882 clk_disable_unprepare(wsa->mclk); in wsa_macro_probe()
2884 clk_disable_unprepare(wsa->dcodec); in wsa_macro_probe()
2886 clk_disable_unprepare(wsa->macro); in wsa_macro_probe()
2894 struct wsa_macro *wsa = dev_get_drvdata(&pdev->dev); in wsa_macro_remove() local
2896 clk_disable_unprepare(wsa->macro); in wsa_macro_remove()
2897 clk_disable_unprepare(wsa->dcodec); in wsa_macro_remove()
2898 clk_disable_unprepare(wsa->mclk); in wsa_macro_remove()
2899 clk_disable_unprepare(wsa->npl); in wsa_macro_remove()
2900 clk_disable_unprepare(wsa->fsgen); in wsa_macro_remove()
2905 struct wsa_macro *wsa = dev_get_drvdata(dev); in wsa_macro_runtime_suspend() local
2907 regcache_cache_only(wsa->regmap, true); in wsa_macro_runtime_suspend()
2908 regcache_mark_dirty(wsa->regmap); in wsa_macro_runtime_suspend()
2910 clk_disable_unprepare(wsa->fsgen); in wsa_macro_runtime_suspend()
2911 clk_disable_unprepare(wsa->npl); in wsa_macro_runtime_suspend()
2912 clk_disable_unprepare(wsa->mclk); in wsa_macro_runtime_suspend()
2919 struct wsa_macro *wsa = dev_get_drvdata(dev); in wsa_macro_runtime_resume() local
2922 ret = clk_prepare_enable(wsa->mclk); in wsa_macro_runtime_resume()
2928 ret = clk_prepare_enable(wsa->npl); in wsa_macro_runtime_resume()
2934 ret = clk_prepare_enable(wsa->fsgen); in wsa_macro_runtime_resume()
2940 regcache_cache_only(wsa->regmap, false); in wsa_macro_runtime_resume()
2941 regcache_sync(wsa->regmap); in wsa_macro_runtime_resume()
2945 clk_disable_unprepare(wsa->npl); in wsa_macro_runtime_resume()
2947 clk_disable_unprepare(wsa->mclk); in wsa_macro_runtime_resume()
2958 .compatible = "qcom,sc7280-lpass-wsa-macro",
2961 .compatible = "qcom,sm8250-lpass-wsa-macro",
2964 .compatible = "qcom,sm8450-lpass-wsa-macro",
2967 .compatible = "qcom,sm8550-lpass-wsa-macro",
2969 .compatible = "qcom,sc8280xp-lpass-wsa-macro",
2987 MODULE_DESCRIPTION("WSA macro driver");