Lines Matching refs:wcd937x

207 	struct wcd937x_priv *wcd937x;  in wcd937x_handle_post_irq()  local
210 wcd937x = (struct wcd937x_priv *)data; in wcd937x_handle_post_irq()
214 regmap_write(wcd937x->regmap, WCD937X_DIGITAL_INTR_CLEAR_0, 0); in wcd937x_handle_post_irq()
215 regmap_write(wcd937x->regmap, WCD937X_DIGITAL_INTR_CLEAR_1, 0); in wcd937x_handle_post_irq()
216 regmap_write(wcd937x->regmap, WCD937X_DIGITAL_INTR_CLEAR_2, 0); in wcd937x_handle_post_irq()
243 static void wcd937x_reset(struct wcd937x_priv *wcd937x) in wcd937x_reset() argument
245 gpiod_set_value(wcd937x->reset_gpio, 1); in wcd937x_reset()
247 gpiod_set_value(wcd937x->reset_gpio, 0); in wcd937x_reset()
303 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_rx_clk_enable() local
305 if (atomic_read(&wcd937x->rx_clk_cnt)) in wcd937x_rx_clk_enable()
316 atomic_inc(&wcd937x->rx_clk_cnt); in wcd937x_rx_clk_enable()
323 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_rx_clk_disable() local
325 if (!atomic_read(&wcd937x->rx_clk_cnt)) { in wcd937x_rx_clk_disable()
330 atomic_dec(&wcd937x->rx_clk_cnt); in wcd937x_rx_clk_disable()
344 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_hphl_dac_event() local
345 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_hphl_dac_event()
359 set_bit(HPH_COMP_DELAY, &wcd937x->status_mask); in wcd937x_codec_hphl_dac_event()
371 if (wcd937x->comp1_enable) { in wcd937x_codec_hphl_dac_event()
379 if (wcd937x->comp2_enable) { in wcd937x_codec_hphl_dac_event()
387 if (test_bit(HPH_COMP_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_hphl_dac_event()
389 clear_bit(HPH_COMP_DELAY, &wcd937x->status_mask); in wcd937x_codec_hphl_dac_event()
419 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_hphr_dac_event() local
420 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_hphr_dac_event()
431 set_bit(HPH_COMP_DELAY, &wcd937x->status_mask); in wcd937x_codec_hphr_dac_event()
442 if (wcd937x->comp2_enable) { in wcd937x_codec_hphr_dac_event()
448 if (wcd937x->comp1_enable) { in wcd937x_codec_hphr_dac_event()
457 if (test_bit(HPH_COMP_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_hphr_dac_event()
459 clear_bit(HPH_COMP_DELAY, &wcd937x->status_mask); in wcd937x_codec_hphr_dac_event()
488 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_ear_dac_event() local
489 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_ear_dac_event()
509 if (wcd937x->comp1_enable) in wcd937x_codec_ear_dac_event()
516 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_ear_dac_event()
528 if (wcd937x->comp1_enable) in wcd937x_codec_ear_dac_event()
543 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_aux_dac_event() local
544 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_aux_dac_event()
558 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_aux_dac_event()
579 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_enable_hphr_pa() local
580 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_enable_hphr_pa()
584 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_hphr_pa()
591 set_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphr_pa()
597 if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_enable_hphr_pa()
598 if (wcd937x->comp2_enable) in wcd937x_codec_enable_hphr_pa()
602 clear_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphr_pa()
612 enable_irq(wcd937x->hphr_pdm_wd_int); in wcd937x_codec_enable_hphr_pa()
615 disable_irq_nosync(wcd937x->hphr_pdm_wd_int); in wcd937x_codec_enable_hphr_pa()
616 set_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphr_pa()
617 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, WCD_EVENT_PRE_HPHR_PA_OFF); in wcd937x_codec_enable_hphr_pa()
620 if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_enable_hphr_pa()
621 if (wcd937x->comp2_enable) in wcd937x_codec_enable_hphr_pa()
625 clear_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphr_pa()
628 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, WCD_EVENT_POST_HPHR_PA_OFF); in wcd937x_codec_enable_hphr_pa()
633 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_hphr_pa()
648 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_enable_hphl_pa() local
649 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_enable_hphl_pa()
653 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_hphl_pa()
660 set_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphl_pa()
665 if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_enable_hphl_pa()
666 if (!wcd937x->comp1_enable) in wcd937x_codec_enable_hphl_pa()
670 clear_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphl_pa()
680 enable_irq(wcd937x->hphl_pdm_wd_int); in wcd937x_codec_enable_hphl_pa()
683 disable_irq_nosync(wcd937x->hphl_pdm_wd_int); in wcd937x_codec_enable_hphl_pa()
684 set_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphl_pa()
685 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, WCD_EVENT_PRE_HPHL_PA_OFF); in wcd937x_codec_enable_hphl_pa()
688 if (test_bit(HPH_PA_DELAY, &wcd937x->status_mask)) { in wcd937x_codec_enable_hphl_pa()
689 if (!wcd937x->comp1_enable) in wcd937x_codec_enable_hphl_pa()
693 clear_bit(HPH_PA_DELAY, &wcd937x->status_mask); in wcd937x_codec_enable_hphl_pa()
696 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, WCD_EVENT_POST_HPHL_PA_OFF); in wcd937x_codec_enable_hphl_pa()
701 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_hphl_pa()
716 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_enable_aux_pa() local
717 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_enable_aux_pa()
736 enable_irq(wcd937x->aux_pdm_wd_int); in wcd937x_codec_enable_aux_pa()
739 disable_irq_nosync(wcd937x->aux_pdm_wd_int); in wcd937x_codec_enable_aux_pa()
743 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_aux_pa()
762 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_enable_ear_pa() local
763 int hph_mode = wcd937x->hph_mode; in wcd937x_codec_enable_ear_pa()
768 wcd937x->ear_rx_path = snd_soc_component_read(component, in wcd937x_codec_enable_ear_pa()
771 if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX) in wcd937x_codec_enable_ear_pa()
779 if (!wcd937x->comp1_enable) in wcd937x_codec_enable_ear_pa()
791 if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX) in wcd937x_codec_enable_ear_pa()
792 enable_irq(wcd937x->aux_pdm_wd_int); in wcd937x_codec_enable_ear_pa()
794 enable_irq(wcd937x->hphl_pdm_wd_int); in wcd937x_codec_enable_ear_pa()
797 if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX) in wcd937x_codec_enable_ear_pa()
798 disable_irq_nosync(wcd937x->aux_pdm_wd_int); in wcd937x_codec_enable_ear_pa()
800 disable_irq_nosync(wcd937x->hphl_pdm_wd_int); in wcd937x_codec_enable_ear_pa()
803 if (!wcd937x->comp1_enable) in wcd937x_codec_enable_ear_pa()
808 wcd_clsh_ctrl_set_state(wcd937x->clsh_info, in wcd937x_codec_enable_ear_pa()
815 if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX) in wcd937x_codec_enable_ear_pa()
891 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_tx_swr_ctrl() local
897 set_bit(AMIC2_BCS_ENABLE, &wcd937x->status_mask); in wcd937x_tx_swr_ctrl()
906 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_codec_enable_adc() local
910 atomic_inc(&wcd937x->ana_clk_count); in wcd937x_codec_enable_adc()
919 if (w->shift == 1 && test_bit(AMIC2_BCS_ENABLE, &wcd937x->status_mask)) in wcd937x_codec_enable_adc()
920 clear_bit(AMIC2_BCS_ENABLE, &wcd937x->status_mask); in wcd937x_codec_enable_adc()
934 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_enable_req() local
967 atomic_dec(&wcd937x->ana_clk_count); in wcd937x_enable_req()
968 if (atomic_read(&wcd937x->ana_clk_count) <= 0) { in wcd937x_enable_req()
972 atomic_set(&wcd937x->ana_clk_count, 0); in wcd937x_enable_req()
1029 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_micbias_control() local
1052 mutex_lock(&wcd937x->micb_lock); in wcd937x_micbias_control()
1055 wcd937x->pullup_ref[micb_index]++; in wcd937x_micbias_control()
1056 if (wcd937x->pullup_ref[micb_index] == 1 && in wcd937x_micbias_control()
1057 wcd937x->micb_ref[micb_index] == 0) in wcd937x_micbias_control()
1062 if (wcd937x->pullup_ref[micb_index] > 0) in wcd937x_micbias_control()
1063 wcd937x->pullup_ref[micb_index]++; in wcd937x_micbias_control()
1064 if (wcd937x->pullup_ref[micb_index] == 0 && in wcd937x_micbias_control()
1065 wcd937x->micb_ref[micb_index] == 0) in wcd937x_micbias_control()
1070 wcd937x->micb_ref[micb_index]++; in wcd937x_micbias_control()
1071 atomic_inc(&wcd937x->ana_clk_count); in wcd937x_micbias_control()
1072 if (wcd937x->micb_ref[micb_index] == 1) { in wcd937x_micbias_control()
1092 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, in wcd937x_micbias_control()
1096 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, in wcd937x_micbias_control()
1101 atomic_dec(&wcd937x->ana_clk_count); in wcd937x_micbias_control()
1102 if (wcd937x->micb_ref[micb_index] > 0) in wcd937x_micbias_control()
1103 wcd937x->micb_ref[micb_index]--; in wcd937x_micbias_control()
1104 if (wcd937x->micb_ref[micb_index] == 0 && in wcd937x_micbias_control()
1105 wcd937x->pullup_ref[micb_index] > 0) in wcd937x_micbias_control()
1108 else if (wcd937x->micb_ref[micb_index] == 0 && in wcd937x_micbias_control()
1109 wcd937x->pullup_ref[micb_index] == 0) { in wcd937x_micbias_control()
1111 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, in wcd937x_micbias_control()
1117 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, in wcd937x_micbias_control()
1122 wcd_mbhc_event_notify(wcd937x->wcd_mbhc, in wcd937x_micbias_control()
1124 if (atomic_read(&wcd937x->ana_clk_count) <= 0) { in wcd937x_micbias_control()
1128 atomic_set(&wcd937x->ana_clk_count, 0); in wcd937x_micbias_control()
1132 mutex_unlock(&wcd937x->micb_lock); in wcd937x_micbias_control()
1216 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_rx_hph_mode_get() local
1218 ucontrol->value.integer.value[0] = wcd937x->hph_mode; in wcd937x_rx_hph_mode_get()
1227 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_rx_hph_mode_put() local
1235 if (mode_val == wcd937x->hph_mode) in wcd937x_rx_hph_mode_put()
1247 wcd937x->hph_mode = mode_val; in wcd937x_rx_hph_mode_put()
1259 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_get_compander() local
1266 ucontrol->value.integer.value[0] = hphr ? wcd937x->comp2_enable : in wcd937x_get_compander()
1267 wcd937x->comp1_enable; in wcd937x_get_compander()
1275 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_set_compander() local
1276 struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[AIF1_PB]; in wcd937x_set_compander()
1286 if (value == wcd937x->comp2_enable) in wcd937x_set_compander()
1289 wcd937x->comp2_enable = value; in wcd937x_set_compander()
1291 if (value == wcd937x->comp1_enable) in wcd937x_set_compander()
1294 wcd937x->comp1_enable = value; in wcd937x_set_compander()
1312 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(comp); in wcd937x_get_swr_port() local
1318 wcd = wcd937x->sdw_priv[dai_id]; in wcd937x_get_swr_port()
1331 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(comp); in wcd937x_set_swr_port() local
1338 wcd = wcd937x->sdw_priv[dai_id]; in wcd937x_set_swr_port()
1448 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_micb_adjust_voltage() local
1464 mutex_lock(&wcd937x->micb_lock); in wcd937x_mbhc_micb_adjust_voltage()
1509 mutex_unlock(&wcd937x->micb_lock); in wcd937x_mbhc_micb_adjust_voltage()
1516 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_micb_ctrl_threshold_mic() local
1526 if (wcd937x->micb2_mv >= WCD_MBHC_THR_HS_MICB_MV) in wcd937x_mbhc_micb_ctrl_threshold_mic()
1529 micb_mv = req_en ? WCD_MBHC_THR_HS_MICB_MV : wcd937x->micb2_mv; in wcd937x_mbhc_micb_ctrl_threshold_mic()
1538 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_get_result_params() local
1548 regmap_update_bits(wcd937x->regmap, WCD937X_ANA_MBHC_ZDET, 0x20, 0x20); in wcd937x_mbhc_get_result_params()
1550 regmap_read(wcd937x->regmap, WCD937X_ANA_MBHC_RESULT_2, &val); in wcd937x_mbhc_get_result_params()
1555 regmap_read(wcd937x->regmap, WCD937X_ANA_MBHC_RESULT_1, &val1); in wcd937x_mbhc_get_result_params()
1557 regmap_update_bits(wcd937x->regmap, WCD937X_ANA_MBHC_ZDET, 0x20, 0x00); in wcd937x_mbhc_get_result_params()
1581 regmap_read(wcd937x->regmap, in wcd937x_mbhc_get_result_params()
1583 regmap_read(wcd937x->regmap, in wcd937x_mbhc_get_result_params()
1598 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_zdet_ramp() local
1617 regmap_update_bits(wcd937x->regmap, in wcd937x_mbhc_zdet_ramp()
1620 regmap_update_bits(wcd937x->regmap, in wcd937x_mbhc_zdet_ramp()
1629 regmap_update_bits(wcd937x->regmap, in wcd937x_mbhc_zdet_ramp()
1632 regmap_update_bits(wcd937x->regmap, in wcd937x_mbhc_zdet_ramp()
1661 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_wcd_mbhc_calc_impedance() local
1689 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1694 if (wcd937x->mbhc_cfg.hphl_swh) in wcd937x_wcd_mbhc_calc_impedance()
1695 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1699 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1705 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1785 wcd_mbhc_set_hph_type(wcd937x->wcd_mbhc, WCD_MBHC_HPH_MONO); in wcd937x_wcd_mbhc_calc_impedance()
1807 wcd_mbhc_set_hph_type(wcd937x->wcd_mbhc, WCD_MBHC_HPH_STEREO); in wcd937x_wcd_mbhc_calc_impedance()
1809 wcd_mbhc_set_hph_type(wcd937x->wcd_mbhc, WCD_MBHC_HPH_MONO); in wcd937x_wcd_mbhc_calc_impedance()
1812 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1819 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1823 if (wcd937x->mbhc_cfg.hphl_swh) in wcd937x_wcd_mbhc_calc_impedance()
1824 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1830 regmap_update_bits(wcd937x->regmap, in wcd937x_wcd_mbhc_calc_impedance()
1861 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_moisture_config() local
1863 if (wcd937x->mbhc_cfg.moist_rref == R_OFF) { in wcd937x_mbhc_moisture_config()
1870 if (!wcd937x->mbhc_cfg.hphl_swh) { in wcd937x_mbhc_moisture_config()
1879 WCD937X_M_RTH_CTL_MASK, wcd937x->mbhc_cfg.moist_rref); in wcd937x_mbhc_moisture_config()
1884 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_moisture_detect_en() local
1888 WCD937X_M_RTH_CTL_MASK, wcd937x->mbhc_cfg.moist_rref); in wcd937x_mbhc_moisture_detect_en()
1896 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_get_moisture_status() local
1899 if (wcd937x->mbhc_cfg.moist_rref == R_OFF) { in wcd937x_mbhc_get_moisture_status()
1906 if (!wcd937x->mbhc_cfg.hphl_swh) { in wcd937x_mbhc_get_moisture_status()
1959 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_get_hph_type() local
1961 ucontrol->value.integer.value[0] = wcd_mbhc_get_hph_type(wcd937x->wcd_mbhc); in wcd937x_get_hph_type()
1974 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_hph_impedance_get() local
1978 wcd_mbhc_get_impedance(wcd937x->wcd_mbhc, &zl, &zr); in wcd937x_hph_impedance_get()
1998 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_init() local
1999 struct wcd_mbhc_intr *intr_ids = &wcd937x->intr_ids; in wcd937x_mbhc_init()
2001 intr_ids->mbhc_sw_intr = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2003 intr_ids->mbhc_btn_press_intr = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2005 intr_ids->mbhc_btn_release_intr = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2007 intr_ids->mbhc_hs_ins_intr = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2009 intr_ids->mbhc_hs_rem_intr = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2011 intr_ids->hph_left_ocp = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2013 intr_ids->hph_right_ocp = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_mbhc_init()
2016 wcd937x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd937x_mbhc_init()
2017 if (IS_ERR(wcd937x->wcd_mbhc)) in wcd937x_mbhc_init()
2018 return PTR_ERR(wcd937x->wcd_mbhc); in wcd937x_mbhc_init()
2030 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_mbhc_deinit() local
2032 wcd_mbhc_deinit(wcd937x->wcd_mbhc); in wcd937x_mbhc_deinit()
2433 static int wcd937x_set_micbias_data(struct wcd937x_priv *wcd937x) in wcd937x_set_micbias_data() argument
2438 vout_ctl[0] = wcd937x_get_micb_vout_ctl_val(wcd937x->micb1_mv); in wcd937x_set_micbias_data()
2439 vout_ctl[1] = wcd937x_get_micb_vout_ctl_val(wcd937x->micb2_mv); in wcd937x_set_micbias_data()
2440 vout_ctl[2] = wcd937x_get_micb_vout_ctl_val(wcd937x->micb3_mv); in wcd937x_set_micbias_data()
2444 regmap_update_bits(wcd937x->regmap, WCD937X_ANA_MICB1, WCD937X_ANA_MICB_VOUT, vout_ctl[0]); in wcd937x_set_micbias_data()
2445 regmap_update_bits(wcd937x->regmap, WCD937X_ANA_MICB2, WCD937X_ANA_MICB_VOUT, vout_ctl[1]); in wcd937x_set_micbias_data()
2446 regmap_update_bits(wcd937x->regmap, WCD937X_ANA_MICB3, WCD937X_ANA_MICB_VOUT, vout_ctl[2]); in wcd937x_set_micbias_data()
2491 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_soc_codec_probe() local
2492 struct sdw_slave *tx_sdw_dev = wcd937x->tx_sdw_dev; in wcd937x_soc_codec_probe()
2505 snd_soc_component_init_regmap(component, wcd937x->regmap); in wcd937x_soc_codec_probe()
2518 wcd937x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD937X); in wcd937x_soc_codec_probe()
2519 if (IS_ERR(wcd937x->clsh_info)) { in wcd937x_soc_codec_probe()
2521 return PTR_ERR(wcd937x->clsh_info); in wcd937x_soc_codec_probe()
2524 wcd937x_io_init(wcd937x->regmap); in wcd937x_soc_codec_probe()
2527 regmap_write(wcd937x->regmap, (WCD937X_DIGITAL_INTR_LEVEL_0 + i), 0); in wcd937x_soc_codec_probe()
2531 wcd937x->hphr_pdm_wd_int = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_soc_codec_probe()
2533 wcd937x->hphl_pdm_wd_int = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_soc_codec_probe()
2535 wcd937x->aux_pdm_wd_int = regmap_irq_get_virq(wcd937x->irq_chip, in wcd937x_soc_codec_probe()
2539 ret = devm_request_threaded_irq(dev, wcd937x->hphr_pdm_wd_int, NULL, wcd937x_wd_handle_irq, in wcd937x_soc_codec_probe()
2541 "HPHR PDM WDOG INT", wcd937x); in wcd937x_soc_codec_probe()
2545 ret = devm_request_threaded_irq(dev, wcd937x->hphl_pdm_wd_int, NULL, wcd937x_wd_handle_irq, in wcd937x_soc_codec_probe()
2547 "HPHL PDM WDOG INT", wcd937x); in wcd937x_soc_codec_probe()
2551 ret = devm_request_threaded_irq(dev, wcd937x->aux_pdm_wd_int, NULL, wcd937x_wd_handle_irq, in wcd937x_soc_codec_probe()
2553 "AUX PDM WDOG INT", wcd937x); in wcd937x_soc_codec_probe()
2558 disable_irq_nosync(wcd937x->hphr_pdm_wd_int); in wcd937x_soc_codec_probe()
2559 disable_irq_nosync(wcd937x->hphl_pdm_wd_int); in wcd937x_soc_codec_probe()
2560 disable_irq_nosync(wcd937x->aux_pdm_wd_int); in wcd937x_soc_codec_probe()
2587 struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_soc_codec_remove() local
2590 free_irq(wcd937x->aux_pdm_wd_int, wcd937x); in wcd937x_soc_codec_remove()
2591 free_irq(wcd937x->hphl_pdm_wd_int, wcd937x); in wcd937x_soc_codec_remove()
2592 free_irq(wcd937x->hphr_pdm_wd_int, wcd937x); in wcd937x_soc_codec_remove()
2594 wcd_clsh_ctrl_free(wcd937x->clsh_info); in wcd937x_soc_codec_remove()
2653 struct wcd937x_priv *wcd937x; in wcd937x_swap_gnd_mic() local
2655 wcd937x = snd_soc_component_get_drvdata(component); in wcd937x_swap_gnd_mic()
2657 value = gpiod_get_value(wcd937x->us_euro_gpio); in wcd937x_swap_gnd_mic()
2658 gpiod_set_value(wcd937x->us_euro_gpio, !value); in wcd937x_swap_gnd_mic()
2667 struct wcd937x_priv *wcd937x = dev_get_drvdata(dai->dev); in wcd937x_codec_hw_params() local
2668 struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[dai->id]; in wcd937x_codec_hw_params()
2676 struct wcd937x_priv *wcd937x = dev_get_drvdata(dai->dev); in wcd937x_codec_free() local
2677 struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[dai->id]; in wcd937x_codec_free()
2685 struct wcd937x_priv *wcd937x = dev_get_drvdata(dai->dev); in wcd937x_codec_set_sdw_stream() local
2686 struct wcd937x_sdw_priv *wcd = wcd937x->sdw_priv[dai->id]; in wcd937x_codec_set_sdw_stream()
2730 struct wcd937x_priv *wcd937x = dev_get_drvdata(dev); in wcd937x_bind() local
2736 ret = component_bind_all(dev, wcd937x); in wcd937x_bind()
2742 wcd937x->rxdev = wcd937x_sdw_device_get(wcd937x->rxnode); in wcd937x_bind()
2743 if (!wcd937x->rxdev) { in wcd937x_bind()
2748 wcd937x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd937x->rxdev); in wcd937x_bind()
2749 wcd937x->sdw_priv[AIF1_PB]->wcd937x = wcd937x; in wcd937x_bind()
2751 wcd937x->txdev = wcd937x_sdw_device_get(wcd937x->txnode); in wcd937x_bind()
2752 if (!wcd937x->txdev) { in wcd937x_bind()
2757 wcd937x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd937x->txdev); in wcd937x_bind()
2758 wcd937x->sdw_priv[AIF1_CAP]->wcd937x = wcd937x; in wcd937x_bind()
2759 wcd937x->tx_sdw_dev = dev_to_sdw_dev(wcd937x->txdev); in wcd937x_bind()
2760 if (!wcd937x->tx_sdw_dev) { in wcd937x_bind()
2769 if (!device_link_add(wcd937x->rxdev, wcd937x->txdev, in wcd937x_bind()
2775 if (!device_link_add(dev, wcd937x->txdev, in wcd937x_bind()
2781 if (!device_link_add(dev, wcd937x->rxdev, in wcd937x_bind()
2787 wcd937x->regmap = dev_get_regmap(&wcd937x->tx_sdw_dev->dev, NULL); in wcd937x_bind()
2788 if (!wcd937x->regmap) { in wcd937x_bind()
2793 ret = wcd937x_irq_init(wcd937x, dev); in wcd937x_bind()
2799 wcd937x->sdw_priv[AIF1_PB]->slave_irq = wcd937x->virq; in wcd937x_bind()
2800 wcd937x->sdw_priv[AIF1_CAP]->slave_irq = wcd937x->virq; in wcd937x_bind()
2802 ret = wcd937x_set_micbias_data(wcd937x); in wcd937x_bind()
2818 struct wcd937x_priv *wcd937x = dev_get_drvdata(dev); in wcd937x_unbind() local
2821 device_link_remove(dev, wcd937x->txdev); in wcd937x_unbind()
2822 device_link_remove(dev, wcd937x->rxdev); in wcd937x_unbind()
2823 device_link_remove(wcd937x->rxdev, wcd937x->txdev); in wcd937x_unbind()
2824 component_unbind_all(dev, wcd937x); in wcd937x_unbind()
2825 mutex_destroy(&wcd937x->micb_lock); in wcd937x_unbind()
2833 static int wcd937x_add_slave_components(struct wcd937x_priv *wcd937x, in wcd937x_add_slave_components() argument
2839 wcd937x->rxnode = of_parse_phandle(np, "qcom,rx-device", 0); in wcd937x_add_slave_components()
2840 if (!wcd937x->rxnode) { in wcd937x_add_slave_components()
2844 of_node_get(wcd937x->rxnode); in wcd937x_add_slave_components()
2846 component_compare_of, wcd937x->rxnode); in wcd937x_add_slave_components()
2848 wcd937x->txnode = of_parse_phandle(np, "qcom,tx-device", 0); in wcd937x_add_slave_components()
2849 if (!wcd937x->txnode) { in wcd937x_add_slave_components()
2853 of_node_get(wcd937x->txnode); in wcd937x_add_slave_components()
2855 component_compare_of, wcd937x->txnode); in wcd937x_add_slave_components()
2864 struct wcd937x_priv *wcd937x; in wcd937x_probe() local
2868 wcd937x = devm_kzalloc(dev, sizeof(*wcd937x), GFP_KERNEL); in wcd937x_probe()
2869 if (!wcd937x) in wcd937x_probe()
2872 dev_set_drvdata(dev, wcd937x); in wcd937x_probe()
2873 mutex_init(&wcd937x->micb_lock); in wcd937x_probe()
2875 wcd937x->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); in wcd937x_probe()
2876 if (IS_ERR(wcd937x->reset_gpio)) in wcd937x_probe()
2877 return dev_err_probe(dev, PTR_ERR(wcd937x->reset_gpio), in wcd937x_probe()
2880 wcd937x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", GPIOD_OUT_LOW); in wcd937x_probe()
2881 if (IS_ERR(wcd937x->us_euro_gpio)) in wcd937x_probe()
2882 return dev_err_probe(dev, PTR_ERR(wcd937x->us_euro_gpio), in wcd937x_probe()
2885 cfg = &wcd937x->mbhc_cfg; in wcd937x_probe()
2888 wcd937x->supplies[0].supply = "vdd-rxtx"; in wcd937x_probe()
2889 wcd937x->supplies[1].supply = "vdd-px"; in wcd937x_probe()
2890 wcd937x->supplies[2].supply = "vdd-mic-bias"; in wcd937x_probe()
2891 wcd937x->supplies[3].supply = "vdd-buck"; in wcd937x_probe()
2893 ret = devm_regulator_bulk_get(dev, WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_probe()
2897 ret = regulator_bulk_enable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_probe()
2899 regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_probe()
2903 wcd937x_dt_parse_micbias_info(dev, wcd937x); in wcd937x_probe()
2909 cfg->micb_mv = wcd937x->micb2_mv; in wcd937x_probe()
2914 wcd_dt_parse_mbhc_data(dev, &wcd937x->mbhc_cfg); in wcd937x_probe()
2916 ret = wcd937x_add_slave_components(wcd937x, dev, &match); in wcd937x_probe()
2920 wcd937x_reset(wcd937x); in wcd937x_probe()
2936 regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_probe()
2937 regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_probe()
2945 struct wcd937x_priv *wcd937x = dev_get_drvdata(dev); in wcd937x_remove() local
2953 regulator_bulk_disable(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_remove()
2954 regulator_bulk_free(WCD937X_MAX_BULK_SUPPLY, wcd937x->supplies); in wcd937x_remove()