Lines Matching refs:rx
1541 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_set_prim_interpolator_rate() local
1543 for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { in rx_macro_set_prim_interpolator_rate()
1586 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_set_mix_interpolator_rate() local
1588 for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { in rx_macro_set_mix_interpolator_rate()
1632 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_hw_params() local
1643 rx->bit_width[dai->id] = params_width(params); in rx_macro_hw_params()
1656 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_get_channel_map() local
1664 for_each_set_bit(temp, &rx->active_ch_mask[dai->id], in rx_macro_get_channel_map()
1685 *rx_num = rx->active_ch_cnt[dai->id]; in rx_macro_get_channel_map()
1848 static void rx_macro_mclk_enable(struct rx_macro *rx, bool mclk_enable) in rx_macro_mclk_enable() argument
1850 struct regmap *regmap = rx->regmap; in rx_macro_mclk_enable()
1853 if (rx->rx_mclk_users == 0) { in rx_macro_mclk_enable()
1867 rx->rx_mclk_users++; in rx_macro_mclk_enable()
1869 if (rx->rx_mclk_users <= 0) { in rx_macro_mclk_enable()
1870 dev_err(rx->dev, "%s: clock already disabled\n", __func__); in rx_macro_mclk_enable()
1871 rx->rx_mclk_users = 0; in rx_macro_mclk_enable()
1874 rx->rx_mclk_users--; in rx_macro_mclk_enable()
1875 if (rx->rx_mclk_users == 0) { in rx_macro_mclk_enable()
1892 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_mclk_event() local
1897 rx_macro_mclk_enable(rx, true); in rx_macro_mclk_event()
1900 rx_macro_mclk_enable(rx, false); in rx_macro_mclk_event()
1979 struct rx_macro *rx, in rx_macro_config_compander() argument
2005 if (!rx->comp_enabled[comp]) in rx_macro_config_compander()
2035 struct rx_macro *rx, in rx_macro_load_compander_coeff() argument
2042 if (!rx->comp_enabled[comp]) in rx_macro_load_compander_coeff()
2056 hph_pwr_mode = rx->hph_pwr_mode; in rx_macro_load_compander_coeff()
2072 struct rx_macro *rx, bool enable) in rx_macro_enable_softclip_clk() argument
2075 if (rx->softclip_clk_users == 0) in rx_macro_enable_softclip_clk()
2078 rx->softclip_clk_users++; in rx_macro_enable_softclip_clk()
2080 rx->softclip_clk_users--; in rx_macro_enable_softclip_clk()
2081 if (rx->softclip_clk_users == 0) in rx_macro_enable_softclip_clk()
2088 struct rx_macro *rx, int event) in rx_macro_config_softclip() argument
2091 if (!rx->is_softclip_on) in rx_macro_config_softclip()
2096 rx_macro_enable_softclip_clk(component, rx, true); in rx_macro_config_softclip()
2105 rx_macro_enable_softclip_clk(component, rx, false); in rx_macro_config_softclip()
2112 struct rx_macro *rx, int event) in rx_macro_config_aux_hpf() argument
2116 if (!rx->is_aux_hpf_on) in rx_macro_config_aux_hpf()
2130 static inline void rx_macro_enable_clsh_block(struct rx_macro *rx, bool enable) in rx_macro_enable_clsh_block() argument
2132 if ((enable && ++rx->clsh_users == 1) || (!enable && --rx->clsh_users == 0)) in rx_macro_enable_clsh_block()
2133 snd_soc_component_update_bits(rx->component, CDC_RX_CLSH_CRC, in rx_macro_enable_clsh_block()
2135 if (rx->clsh_users < 0) in rx_macro_enable_clsh_block()
2136 rx->clsh_users = 0; in rx_macro_enable_clsh_block()
2140 struct rx_macro *rx, in rx_macro_config_classh() argument
2144 rx_macro_enable_clsh_block(rx, false); in rx_macro_config_classh()
2151 rx_macro_enable_clsh_block(rx, true); in rx_macro_config_classh()
2164 if (rx->is_ear_mode_on) in rx_macro_config_classh()
2180 if (rx->is_ear_mode_on) in rx_macro_config_classh()
2245 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_get_compander() local
2247 ucontrol->value.integer.value[0] = rx->comp_enabled[comp]; in rx_macro_get_compander()
2257 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_set_compander() local
2259 rx->comp_enabled[comp] = value; in rx_macro_set_compander()
2269 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_mux_get() local
2272 rx->rx_port_value[widget->shift]; in rx_macro_mux_get()
2285 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_mux_put() local
2287 aif_rst = rx->rx_port_value[widget->shift]; in rx_macro_mux_put()
2298 rx->rx_port_value[widget->shift] = rx_port_value; in rx_macro_mux_put()
2302 if (rx->active_ch_cnt[aif_rst]) { in rx_macro_mux_put()
2304 &rx->active_ch_mask[aif_rst]); in rx_macro_mux_put()
2305 rx->active_ch_cnt[aif_rst]--; in rx_macro_mux_put()
2313 &rx->active_ch_mask[rx_port_value]); in rx_macro_mux_put()
2314 rx->active_ch_cnt[rx_port_value]++; in rx_macro_mux_put()
2353 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_get_ear_mode() local
2355 ucontrol->value.integer.value[0] = rx->is_ear_mode_on; in rx_macro_get_ear_mode()
2363 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_put_ear_mode() local
2365 rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); in rx_macro_put_ear_mode()
2373 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_get_hph_hd2_mode() local
2375 ucontrol->value.integer.value[0] = rx->hph_hd2_mode; in rx_macro_get_hph_hd2_mode()
2383 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_put_hph_hd2_mode() local
2385 rx->hph_hd2_mode = ucontrol->value.integer.value[0]; in rx_macro_put_hph_hd2_mode()
2393 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_get_hph_pwr_mode() local
2395 ucontrol->value.integer.value[0] = rx->hph_pwr_mode; in rx_macro_get_hph_pwr_mode()
2403 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_put_hph_pwr_mode() local
2405 rx->hph_pwr_mode = ucontrol->value.integer.value[0]; in rx_macro_put_hph_pwr_mode()
2413 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_soft_clip_enable_get() local
2415 ucontrol->value.integer.value[0] = rx->is_softclip_on; in rx_macro_soft_clip_enable_get()
2424 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_soft_clip_enable_put() local
2426 rx->is_softclip_on = ucontrol->value.integer.value[0]; in rx_macro_soft_clip_enable_put()
2435 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_aux_hpf_mode_get() local
2437 ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; in rx_macro_aux_hpf_mode_get()
2446 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_aux_hpf_mode_put() local
2448 rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; in rx_macro_aux_hpf_mode_put()
2454 struct rx_macro *rx, in rx_macro_hphdelay_lutbypass() argument
2475 if (rx->is_ear_mode_on) in rx_macro_hphdelay_lutbypass()
2487 if (rx->hph_pwr_mode) in rx_macro_hphdelay_lutbypass()
2509 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_enable_interp_clk() local
2518 if (rx->main_clk_users[interp_idx] == 0) { in rx_macro_enable_interp_clk()
2526 rx_macro_load_compander_coeff(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2527 if (rx->hph_hd2_mode) in rx_macro_enable_interp_clk()
2529 rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2530 rx_macro_config_compander(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2532 rx_macro_config_softclip(component, rx, event); in rx_macro_enable_interp_clk()
2533 rx_macro_config_aux_hpf(component, rx, event); in rx_macro_enable_interp_clk()
2535 rx_macro_config_classh(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2537 rx->main_clk_users[interp_idx]++; in rx_macro_enable_interp_clk()
2541 rx->main_clk_users[interp_idx]--; in rx_macro_enable_interp_clk()
2542 if (rx->main_clk_users[interp_idx] <= 0) { in rx_macro_enable_interp_clk()
2543 rx->main_clk_users[interp_idx] = 0; in rx_macro_enable_interp_clk()
2563 rx_macro_config_classh(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2564 rx_macro_config_compander(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2566 rx_macro_config_softclip(component, rx, event); in rx_macro_enable_interp_clk()
2567 rx_macro_config_aux_hpf(component, rx, event); in rx_macro_enable_interp_clk()
2569 rx_macro_hphdelay_lutbypass(component, rx, interp_idx, event); in rx_macro_enable_interp_clk()
2570 if (rx->hph_hd2_mode) in rx_macro_enable_interp_clk()
2575 return rx->main_clk_users[interp_idx]; in rx_macro_enable_interp_clk()
3394 struct rx_macro *rx = snd_soc_component_get_drvdata(component); in rx_macro_component_probe() local
3396 snd_soc_component_init_regmap(component, rx->regmap); in rx_macro_component_probe()
3417 rx->component = component; in rx_macro_component_probe()
3424 struct rx_macro *rx = to_rx_macro(hw); in swclk_gate_enable() local
3426 rx_macro_mclk_enable(rx, true); in swclk_gate_enable()
3427 if (rx->reset_swr) in swclk_gate_enable()
3428 regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, in swclk_gate_enable()
3432 regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, in swclk_gate_enable()
3435 if (rx->reset_swr) in swclk_gate_enable()
3436 regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, in swclk_gate_enable()
3438 rx->reset_swr = false; in swclk_gate_enable()
3445 struct rx_macro *rx = to_rx_macro(hw); in swclk_gate_disable() local
3447 regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, in swclk_gate_disable()
3450 rx_macro_mclk_enable(rx, false); in swclk_gate_disable()
3455 struct rx_macro *rx = to_rx_macro(hw); in swclk_gate_is_enabled() local
3458 regmap_read(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
3478 static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx) in rx_macro_register_mclk_output() argument
3480 struct device *dev = rx->dev; in rx_macro_register_mclk_output()
3488 parent_clk_name = __clk_get_name(rx->clks[2].clk); in rx_macro_register_mclk_output()
3495 rx->hw.init = &init; in rx_macro_register_mclk_output()
3496 hw = &rx->hw; in rx_macro_register_mclk_output()
3497 ret = clk_hw_register(rx->dev, hw); in rx_macro_register_mclk_output()
3520 struct rx_macro *rx; in rx_macro_probe() local
3524 rx = devm_kzalloc(dev, sizeof(*rx), GFP_KERNEL); in rx_macro_probe()
3525 if (!rx) in rx_macro_probe()
3528 rx->clks[0].id = "macro"; in rx_macro_probe()
3529 rx->clks[1].id = "dcodec"; in rx_macro_probe()
3530 rx->clks[2].id = "mclk"; in rx_macro_probe()
3531 rx->clks[3].id = "npl"; in rx_macro_probe()
3532 rx->clks[4].id = "fsgen"; in rx_macro_probe()
3534 ret = devm_clk_bulk_get_optional(dev, RX_NUM_CLKS_MAX, rx->clks); in rx_macro_probe()
3544 rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); in rx_macro_probe()
3546 dev_set_drvdata(dev, rx); in rx_macro_probe()
3548 rx->reset_swr = true; in rx_macro_probe()
3549 rx->dev = dev; in rx_macro_probe()
3552 clk_set_rate(rx->clks[2].clk, MCLK_FREQ); in rx_macro_probe()
3553 clk_set_rate(rx->clks[3].clk, 2 * MCLK_FREQ); in rx_macro_probe()
3555 ret = clk_bulk_prepare_enable(RX_NUM_CLKS_MAX, rx->clks); in rx_macro_probe()
3559 rx_macro_register_mclk_output(rx); in rx_macro_probe()
3565 clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); in rx_macro_probe()
3572 struct rx_macro *rx = dev_get_drvdata(&pdev->dev); in rx_macro_remove() local
3575 clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks); in rx_macro_remove()