Lines Matching full:wcd

23 #include "wcd-clsh-v2.h"
24 #include "wcd-mbhc-v2.h"
97 /* As fine version info cannot be retrieved before wcd probe.
98 * Define three coarse versions for possible future use before wcd probe.
1264 static int wcd934x_set_sido_input_src(struct wcd934x_codec *wcd, int sido_src) in wcd934x_set_sido_input_src() argument
1266 if (sido_src == wcd->sido_input_src) in wcd934x_set_sido_input_src()
1270 regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, in wcd934x_set_sido_input_src()
1275 wcd->sido_input_src = sido_src; in wcd934x_set_sido_input_src()
1280 static int wcd934x_enable_ana_bias_and_sysclk(struct wcd934x_codec *wcd) in wcd934x_enable_ana_bias_and_sysclk() argument
1282 mutex_lock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1284 if (++wcd->sysclk_users != 1) { in wcd934x_enable_ana_bias_and_sysclk()
1285 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1288 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_enable_ana_bias_and_sysclk()
1290 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1293 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1301 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1303 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_enable_ana_bias_and_sysclk()
1311 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1314 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1317 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1320 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_enable_ana_bias_and_sysclk()
1322 regmap_update_bits(wcd->regmap, in wcd934x_enable_ana_bias_and_sysclk()
1326 regmap_update_bits(wcd->regmap, in wcd934x_enable_ana_bias_and_sysclk()
1330 regmap_update_bits(wcd->regmap, WCD934X_CODEC_RPM_CLK_GATE, in wcd934x_enable_ana_bias_and_sysclk()
1338 wcd934x_set_sido_input_src(wcd, SIDO_SOURCE_RCO_BG); in wcd934x_enable_ana_bias_and_sysclk()
1343 static int wcd934x_disable_ana_bias_and_syclk(struct wcd934x_codec *wcd) in wcd934x_disable_ana_bias_and_syclk() argument
1345 mutex_lock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1346 if (--wcd->sysclk_users != 0) { in wcd934x_disable_ana_bias_and_syclk()
1347 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1350 mutex_unlock(&wcd->sysclk_mutex); in wcd934x_disable_ana_bias_and_syclk()
1352 regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, in wcd934x_disable_ana_bias_and_syclk()
1355 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_disable_ana_bias_and_syclk()
1357 regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, in wcd934x_disable_ana_bias_and_syclk()
1363 static int __wcd934x_cdc_mclk_enable(struct wcd934x_codec *wcd, bool enable) in __wcd934x_cdc_mclk_enable() argument
1368 ret = clk_prepare_enable(wcd->extclk); in __wcd934x_cdc_mclk_enable()
1371 dev_err(wcd->dev, "%s: ext clk enable failed\n", in __wcd934x_cdc_mclk_enable()
1375 ret = wcd934x_enable_ana_bias_and_sysclk(wcd); in __wcd934x_cdc_mclk_enable()
1379 regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, in __wcd934x_cdc_mclk_enable()
1386 wcd934x_disable_ana_bias_and_syclk(wcd); in __wcd934x_cdc_mclk_enable()
1387 clk_disable_unprepare(wcd->extclk); in __wcd934x_cdc_mclk_enable()
1397 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_enable_mclk() local
1401 return __wcd934x_cdc_mclk_enable(wcd, true); in wcd934x_codec_enable_mclk()
1403 return __wcd934x_cdc_mclk_enable(wcd, false); in wcd934x_codec_enable_mclk()
1409 static int wcd934x_get_version(struct wcd934x_codec *wcd) in wcd934x_get_version() argument
1416 regmap = wcd->regmap; in wcd934x_get_version()
1446 wcd->version = ver; in wcd934x_get_version()
1447 dev_info(wcd->dev, "WCD934X Minor:0x%x Version:0x%x\n", id_minor, ver); in wcd934x_get_version()
1452 static void wcd934x_enable_efuse_sensing(struct wcd934x_codec *wcd) in wcd934x_enable_efuse_sensing() argument
1456 __wcd934x_cdc_mclk_enable(wcd, true); in wcd934x_enable_efuse_sensing()
1458 regmap_update_bits(wcd->regmap, in wcd934x_enable_efuse_sensing()
1462 regmap_update_bits(wcd->regmap, in wcd934x_enable_efuse_sensing()
1471 wcd934x_set_sido_input_src(wcd, SIDO_SOURCE_RCO_BG); in wcd934x_enable_efuse_sensing()
1473 rc = regmap_read(wcd->regmap, in wcd934x_enable_efuse_sensing()
1479 __wcd934x_cdc_mclk_enable(wcd, false); in wcd934x_enable_efuse_sensing()
1482 static int wcd934x_swrm_clock(struct wcd934x_codec *wcd, bool enable) in wcd934x_swrm_clock() argument
1485 __wcd934x_cdc_mclk_enable(wcd, true); in wcd934x_swrm_clock()
1486 regmap_update_bits(wcd->regmap, in wcd934x_swrm_clock()
1491 regmap_update_bits(wcd->regmap, in wcd934x_swrm_clock()
1494 __wcd934x_cdc_mclk_enable(wcd, false); in wcd934x_swrm_clock()
1504 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_set_prim_interpolator_rate() local
1509 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_prim_interpolator_rate()
1542 dev_err(wcd->dev, in wcd934x_set_prim_interpolator_rate()
1561 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_set_mix_interpolator_rate() local
1565 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_mix_interpolator_rate()
1630 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(comp); in wcd934x_set_decimator_rate() local
1636 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) { in wcd934x_set_decimator_rate()
1666 dev_err(wcd->dev, "Invalid SLIM TX%u port DAI ID:%d\n", in wcd934x_set_decimator_rate()
1693 dev_err(wcd->dev, "ERROR: Invalid tx_port: %d\n", in wcd934x_set_decimator_rate()
1707 static int wcd934x_slim_set_hw_params(struct wcd934x_codec *wcd, in wcd934x_slim_set_hw_params() argument
1737 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1745 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1751 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1758 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1765 ret = regmap_write(wcd->if_regmap, in wcd934x_slim_set_hw_params()
1774 dai_data->sruntime = slim_stream_allocate(wcd->sdev, "WCD934x-SLIM"); in wcd934x_slim_set_hw_params()
1779 dev_err(wcd->dev, "Error Setting slim hw params\n"); in wcd934x_slim_set_hw_params()
1790 struct wcd934x_codec *wcd; in wcd934x_hw_params() local
1793 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_hw_params()
1799 dev_err(wcd->dev, "cannot set sample rate: %u\n", in wcd934x_hw_params()
1805 wcd->dai[dai->id].sconfig.bps = params_width(params); in wcd934x_hw_params()
1808 dev_err(wcd->dev, "Invalid format 0x%x\n", in wcd934x_hw_params()
1838 dev_err(wcd->dev, "Invalid TX sample rate: %d\n", in wcd934x_hw_params()
1847 dev_err(wcd->dev, "Cannot set TX Decimator rate\n"); in wcd934x_hw_params()
1852 wcd->dai[dai->id].sconfig.bps = params_width(params); in wcd934x_hw_params()
1855 dev_err(wcd->dev, "Invalid format 0x%x\n", in wcd934x_hw_params()
1861 dev_err(wcd->dev, "Invalid stream type %d\n", in wcd934x_hw_params()
1866 wcd->dai[dai->id].sconfig.rate = params_rate(params); in wcd934x_hw_params()
1868 return wcd934x_slim_set_hw_params(wcd, &wcd->dai[dai->id], substream->stream); in wcd934x_hw_params()
1875 struct wcd934x_codec *wcd; in wcd934x_hw_free() local
1877 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_hw_free()
1879 dai_data = &wcd->dai[dai->id]; in wcd934x_hw_free()
1890 struct wcd934x_codec *wcd; in wcd934x_trigger() local
1893 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_trigger()
1895 dai_data = &wcd->dai[dai->id]; in wcd934x_trigger()
1924 struct wcd934x_codec *wcd; in wcd934x_set_channel_map() local
1927 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_set_channel_map()
1930 dev_err(wcd->dev, "Invalid tx %d or rx %d channel count\n", in wcd934x_set_channel_map()
1936 dev_err(wcd->dev, "Invalid tx_slot=%p, rx_slot=%p\n", in wcd934x_set_channel_map()
1941 wcd->num_rx_port = rx_num; in wcd934x_set_channel_map()
1943 wcd->rx_chs[i].ch_num = rx_slot[i]; in wcd934x_set_channel_map()
1944 INIT_LIST_HEAD(&wcd->rx_chs[i].list); in wcd934x_set_channel_map()
1947 wcd->num_tx_port = tx_num; in wcd934x_set_channel_map()
1949 wcd->tx_chs[i].ch_num = tx_slot[i]; in wcd934x_set_channel_map()
1950 INIT_LIST_HEAD(&wcd->tx_chs[i].list); in wcd934x_set_channel_map()
1961 struct wcd934x_codec *wcd; in wcd934x_get_channel_map() local
1964 wcd = snd_soc_component_get_drvdata(dai->component); in wcd934x_get_channel_map()
1972 dev_err(wcd->dev, "Invalid rx_slot %p or rx_num %p\n", in wcd934x_get_channel_map()
1977 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) in wcd934x_get_channel_map()
1986 dev_err(wcd->dev, "Invalid tx_slot %p or tx_num %p\n", in wcd934x_get_channel_map()
1991 list_for_each_entry(ch, &wcd->dai[dai->id].slim_ch_list, list) in wcd934x_get_channel_map()
1997 dev_err(wcd->dev, "Invalid DAI ID %x\n", dai->id); in wcd934x_get_channel_map()
2125 struct wcd934x_codec *wcd = to_wcd934x_codec(hw); in swclk_gate_is_enabled() local
2128 regmap_read(wcd->regmap, WCD934X_CDC_CLK_RST_CTRL_SWR_CONTROL, &val); in swclk_gate_is_enabled()
2148 static struct clk *wcd934x_register_mclk_output(struct wcd934x_codec *wcd) in wcd934x_register_mclk_output() argument
2150 struct clk *parent = wcd->extclk; in wcd934x_register_mclk_output()
2151 struct device *dev = wcd->dev; in wcd934x_register_mclk_output()
2159 if (of_property_read_u32(np, "clock-frequency", &wcd->rate)) in wcd934x_register_mclk_output()
2171 wcd->hw.init = &init; in wcd934x_register_mclk_output()
2173 hw = &wcd->hw; in wcd934x_register_mclk_output()
2174 ret = devm_clk_hw_register(wcd->dev->parent, hw); in wcd934x_register_mclk_output()
2213 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_init_dmic() local
2220 &wcd->micb2_mv); in wcd934x_init_dmic()
2235 if (wcd->rate == WCD934X_MCLK_CLK_9P6MHZ) in wcd934x_init_dmic()
2240 wcd->dmic_sample_rate = def_dmic_rate; in wcd934x_init_dmic()
2249 static void wcd934x_hw_init(struct wcd934x_codec *wcd) in wcd934x_hw_init() argument
2251 struct regmap *rm = wcd->regmap; in wcd934x_hw_init()
2263 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_comp_init() local
2265 wcd934x_hw_init(wcd); in wcd934x_comp_init()
2266 wcd934x_enable_efuse_sensing(wcd); in wcd934x_comp_init()
2267 wcd934x_get_version(wcd); in wcd934x_comp_init()
2274 struct wcd934x_codec *wcd = data; in wcd934x_slim_irq_handler() local
2284 regmap_read(wcd->if_regmap, i, &val); in wcd934x_slim_irq_handler()
2297 regmap_read(wcd->if_regmap, in wcd934x_slim_irq_handler()
2306 regmap_read(wcd->if_regmap, reg, &int_val); in wcd934x_slim_irq_handler()
2310 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2315 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2328 wcd->if_regmap, reg, &int_val); in wcd934x_slim_irq_handler()
2331 regmap_write(wcd->if_regmap, in wcd934x_slim_irq_handler()
2337 dev_err_ratelimited(wcd->dev, in wcd934x_slim_irq_handler()
2341 regmap_write(wcd->if_regmap, in wcd934x_slim_irq_handler()
2504 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_mbhc_request_micbias() local
2508 __wcd934x_cdc_mclk_enable(wcd, true); in wcd934x_mbhc_request_micbias()
2513 __wcd934x_cdc_mclk_enable(wcd, false); in wcd934x_mbhc_request_micbias()
2969 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component); in wcd934x_get_hph_type() local
2971 ucontrol->value.integer.value[0] = wcd_mbhc_get_hph_type(wcd->mbhc); in wcd934x_get_hph_type()
2983 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component); in wcd934x_hph_impedance_get() local
2987 wcd_mbhc_get_impedance(wcd->mbhc, &zl, &zr); in wcd934x_hph_impedance_get()
3008 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component); in wcd934x_mbhc_init() local
3009 struct wcd_mbhc_intr *intr_ids = &wcd->intr_ids; in wcd934x_mbhc_init()
3026 wcd->mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd934x_mbhc_init()
3027 if (IS_ERR(wcd->mbhc)) { in wcd934x_mbhc_init()
3028 wcd->mbhc = NULL; in wcd934x_mbhc_init()
3042 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(component); in wcd934x_mbhc_deinit() local
3044 if (!wcd->mbhc) in wcd934x_mbhc_deinit()
3047 wcd_mbhc_deinit(wcd->mbhc); in wcd934x_mbhc_deinit()
3052 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_comp_probe() local
3055 snd_soc_component_init_regmap(component, wcd->regmap); in wcd934x_comp_probe()
3056 wcd->component = component; in wcd934x_comp_probe()
3059 wcd->clsh_ctrl = wcd_clsh_ctrl_alloc(component, wcd->version); in wcd934x_comp_probe()
3060 if (IS_ERR(wcd->clsh_ctrl)) in wcd934x_comp_probe()
3061 return PTR_ERR(wcd->clsh_ctrl); in wcd934x_comp_probe()
3064 wcd->hph_mode = CLS_H_LOHIFI; in wcd934x_comp_probe()
3069 INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list); in wcd934x_comp_probe()
3081 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_comp_remove() local
3084 wcd_clsh_ctrl_free(wcd->clsh_ctrl); in wcd934x_comp_remove()
3091 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_comp_set_sysclk() local
3094 wcd->rate = freq; in wcd934x_comp_set_sysclk()
3096 if (wcd->rate == WCD934X_MCLK_CLK_12P288MHZ) in wcd934x_comp_set_sysclk()
3103 return clk_set_rate(wcd->extclk, freq); in wcd934x_comp_set_sysclk()
3223 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_compander_get() local
3225 ucontrol->value.integer.value[0] = wcd->comp_enabled[comp]; in wcd934x_compander_get()
3234 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_compander_set() local
3239 if (wcd->comp_enabled[comp] == value) in wcd934x_compander_set()
3242 wcd->comp_enabled[comp] = value; in wcd934x_compander_set()
3275 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_rx_hph_mode_get() local
3277 ucontrol->value.enumerated.item[0] = wcd->hph_mode; in wcd934x_rx_hph_mode_get()
3286 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_rx_hph_mode_put() local
3291 if (mode_val == wcd->hph_mode) in wcd934x_rx_hph_mode_put()
3295 dev_err(wcd->dev, "Invalid HPH Mode, default to ClSH HiFi\n"); in wcd934x_rx_hph_mode_put()
3298 wcd->hph_mode = mode_val; in wcd934x_rx_hph_mode_put()
3308 struct wcd934x_codec *wcd = dev_get_drvdata(dapm->dev); in slim_rx_mux_get() local
3310 ucontrol->value.enumerated.item[0] = wcd->rx_port_value[w->shift]; in slim_rx_mux_get()
3344 struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev); in slim_rx_mux_put() local
3351 int prev_mux_idx = wcd->rx_port_value[port_id]; in slim_rx_mux_put()
3365 list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) { in slim_rx_mux_put()
3381 if (list_empty(&wcd->rx_chs[port_id].list)) { in slim_rx_mux_put()
3382 list_add_tail(&wcd->rx_chs[port_id].list, in slim_rx_mux_put()
3383 &wcd->dai[aif_id].slim_ch_list); in slim_rx_mux_put()
3385 dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id); in slim_rx_mux_put()
3391 dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx); in slim_rx_mux_put()
3395 wcd->rx_port_value[port_id] = mux_idx; in slim_rx_mux_put()
3396 snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id], in slim_rx_mux_put()
3824 struct wcd934x_codec *wcd = dev_get_drvdata(dapm->dev); in slim_tx_mixer_get() local
3829 ucontrol->value.integer.value[0] = wcd->tx_port_value[port_id]; in slim_tx_mixer_get()
3838 struct wcd934x_codec *wcd = dev_get_drvdata(widget->dapm->dev); in slim_tx_mixer_put() local
3848 if (enable == wcd->tx_port_value[port_id]) in slim_tx_mixer_put()
3852 if (list_empty(&wcd->tx_chs[port_id].list)) { in slim_tx_mixer_put()
3853 list_add_tail(&wcd->tx_chs[port_id].list, in slim_tx_mixer_put()
3854 &wcd->dai[dai_id].slim_ch_list); in slim_tx_mixer_put()
3856 dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id); in slim_tx_mixer_put()
3862 list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) { in slim_tx_mixer_put()
3865 list_del_init(&wcd->tx_chs[port_id].list); in slim_tx_mixer_put()
3873 wcd->tx_port_value[port_id] = enable; in slim_tx_mixer_put()
4141 struct wcd934x_codec *wcd = dev_get_drvdata(component->dev); in wcd934x_codec_enable_int_port() local
4153 regmap_read(wcd->if_regmap, reg, &val); in wcd934x_codec_enable_int_port()
4155 regmap_write(wcd->if_regmap, reg, in wcd934x_codec_enable_int_port()
4164 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(comp); in wcd934x_codec_enable_slim() local
4165 struct wcd_slim_codec_dai_data *dai = &wcd->dai[w->shift]; in wcd934x_codec_enable_slim()
4253 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_config_compander() local
4262 if (!wcd->comp_enabled[compander]) in wcd934x_config_compander()
4437 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_ear_dac_event() local
4445 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_ear_dac_event()
4450 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_ear_dac_event()
4463 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_hphl_dac_event() local
4464 int hph_mode = wcd->hph_mode; in wcd934x_codec_hphl_dac_event()
4487 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_hphl_dac_event()
4494 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_hphl_dac_event()
4515 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_hphr_dac_event() local
4516 int hph_mode = wcd->hph_mode; in wcd934x_codec_hphr_dac_event()
4537 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_hphr_dac_event()
4545 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_hphr_dac_event()
4564 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_lineout_dac_event() local
4568 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_PRE_DAC, in wcd934x_codec_lineout_dac_event()
4572 wcd_clsh_ctrl_set_state(wcd->clsh_ctrl, WCD_CLSH_EVENT_POST_PA, in wcd934x_codec_lineout_dac_event()
4585 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(comp); in wcd934x_codec_enable_hphl_pa() local
4618 wcd_mbhc_event_notify(wcd->mbhc, WCD_EVENT_POST_HPHL_PA_OFF); in wcd934x_codec_enable_hphl_pa()
4637 wcd_mbhc_event_notify(wcd->mbhc, WCD_EVENT_POST_HPHL_PA_OFF); in wcd934x_codec_enable_hphl_pa()
4649 struct wcd934x_codec *wcd = snd_soc_component_get_drvdata(comp); in wcd934x_codec_enable_hphr_pa() local
4684 wcd_mbhc_event_notify(wcd->mbhc, WCD_EVENT_PRE_HPHR_PA_OFF); in wcd934x_codec_enable_hphr_pa()
4702 wcd_mbhc_event_notify(wcd->mbhc, WCD_EVENT_POST_HPHR_PA_OFF); in wcd934x_codec_enable_hphr_pa()
4711 struct wcd934x_codec *wcd) in wcd934x_get_dmic_sample_rate() argument
4745 dmic_fs = min(wcd->dmic_sample_rate, WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ); in wcd934x_get_dmic_sample_rate()
4749 dmic_fs = wcd->dmic_sample_rate; in wcd934x_get_dmic_sample_rate()
4809 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_enable_dmic() local
4835 dmic_clk_cnt = &wcd->dmic_0_1_clk_cnt; in wcd934x_codec_enable_dmic()
4840 dmic_clk_cnt = &wcd->dmic_2_3_clk_cnt; in wcd934x_codec_enable_dmic()
4845 dmic_clk_cnt = &wcd->dmic_4_5_clk_cnt; in wcd934x_codec_enable_dmic()
4857 wcd); in wcd934x_codec_enable_dmic()
4858 dmic_rate_val = wcd934x_get_dmic_clk_val(comp, wcd->rate, in wcd934x_codec_enable_dmic()
5817 struct wcd934x_codec *wcd = dev_get_drvdata(comp->dev); in wcd934x_codec_set_jack() local
5820 if (!wcd->mbhc) in wcd934x_codec_set_jack()
5823 if (jack && !wcd->mbhc_started) { in wcd934x_codec_set_jack()
5824 ret = wcd_mbhc_start(wcd->mbhc, &wcd->mbhc_cfg, jack); in wcd934x_codec_set_jack()
5825 wcd->mbhc_started = true; in wcd934x_codec_set_jack()
5826 } else if (wcd->mbhc_started) { in wcd934x_codec_set_jack()
5827 wcd_mbhc_stop(wcd->mbhc); in wcd934x_codec_set_jack()
5828 wcd->mbhc_started = false; in wcd934x_codec_set_jack()
5848 static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) in wcd934x_codec_parse_data() argument
5850 struct device *dev = &wcd->sdev->dev; in wcd934x_codec_parse_data()
5851 struct wcd_mbhc_config *cfg = &wcd->mbhc_cfg; in wcd934x_codec_parse_data()
5858 wcd->sidev = of_slim_get_device(wcd->sdev->ctrl, ifc_dev_np); in wcd934x_codec_parse_data()
5860 if (!wcd->sidev) in wcd934x_codec_parse_data()
5863 slim_get_logical_addr(wcd->sidev); in wcd934x_codec_parse_data()
5864 wcd->if_regmap = regmap_init_slimbus(wcd->sidev, in wcd934x_codec_parse_data()
5866 if (IS_ERR(wcd->if_regmap)) in wcd934x_codec_parse_data()
5867 return dev_err_probe(dev, PTR_ERR(wcd->if_regmap), in wcd934x_codec_parse_data()
5871 &wcd->dmic_sample_rate); in wcd934x_codec_parse_data()
5877 cfg->micb_mv = wcd->micb2_mv; in wcd934x_codec_parse_data()
5892 struct wcd934x_codec *wcd; in wcd934x_codec_probe() local
5895 wcd = devm_kzalloc(dev, sizeof(*wcd), GFP_KERNEL); in wcd934x_codec_probe()
5896 if (!wcd) in wcd934x_codec_probe()
5899 wcd->dev = dev; in wcd934x_codec_probe()
5900 wcd->regmap = data->regmap; in wcd934x_codec_probe()
5901 wcd->extclk = data->extclk; in wcd934x_codec_probe()
5902 wcd->sdev = to_slim_device(data->dev); in wcd934x_codec_probe()
5903 mutex_init(&wcd->sysclk_mutex); in wcd934x_codec_probe()
5904 mutex_init(&wcd->micb_lock); in wcd934x_codec_probe()
5906 ret = wcd934x_codec_parse_data(wcd); in wcd934x_codec_probe()
5911 regmap_update_bits(wcd->regmap, WCD934X_CODEC_RPM_CLK_MCLK_CFG, in wcd934x_codec_probe()
5914 memcpy(wcd->rx_chs, wcd934x_rx_chs, sizeof(wcd934x_rx_chs)); in wcd934x_codec_probe()
5915 memcpy(wcd->tx_chs, wcd934x_tx_chs, sizeof(wcd934x_tx_chs)); in wcd934x_codec_probe()
5919 return dev_err_probe(wcd->dev, irq, "Failed to get SLIM IRQ\n"); in wcd934x_codec_probe()
5924 "slim", wcd); in wcd934x_codec_probe()
5928 wcd934x_register_mclk_output(wcd); in wcd934x_codec_probe()
5929 platform_set_drvdata(pdev, wcd); in wcd934x_codec_probe()