Lines Matching refs:component

338 static int wcd938x_set_swr_clk_rate(struct snd_soc_component *component, int rate, int bank)  in wcd938x_set_swr_clk_rate()  argument
361 snd_soc_component_update_bits(component, WCD938X_DIGITAL_SWR_TX_CLK_RATE, in wcd938x_set_swr_clk_rate()
452 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_rxclk() local
456 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
458 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
460 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX0_CTL, in wcd938x_codec_enable_rxclk()
462 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX1_CTL, in wcd938x_codec_enable_rxclk()
464 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX2_CTL, in wcd938x_codec_enable_rxclk()
466 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
468 snd_soc_component_write_field(component, WCD938X_AUX_AUXPA, in wcd938x_codec_enable_rxclk()
472 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
474 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
476 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
478 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
480 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
491 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphl_dac_event() local
492 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphl_dac_event()
496 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
499 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
502 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
507 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
511 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
515 if (!wcd938x->comp2_enable || (snd_soc_component_read(component, in wcd938x_codec_hphl_dac_event()
518 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphl_dac_event()
521 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
524 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
532 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
545 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphr_dac_event() local
546 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphr_dac_event()
550 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
553 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
556 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
561 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
565 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
570 (snd_soc_component_read(component, in wcd938x_codec_hphr_dac_event()
573 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphr_dac_event()
576 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
579 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
586 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
599 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_ear_dac_event() local
600 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_ear_dac_event()
606 component, WCD938X_DIGITAL_CDC_EAR_PATH_CTL); in wcd938x_codec_ear_dac_event()
608 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
611 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
614 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
617 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
621 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
624 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
628 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
635 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_ear_dac_event()
645 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
648 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
652 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
655 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
659 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
663 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_ear_dac_event()
665 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
678 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_aux_dac_event() local
679 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_aux_dac_event()
683 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
686 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
689 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
693 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_aux_dac_event()
702 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
714 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphr_pa() local
715 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphr_pa()
721 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
729 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
733 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
739 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
757 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
762 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphr_pa()
766 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphr_pa()
782 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
803 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
805 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL1, in wcd938x_codec_enable_hphr_pa()
810 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
821 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphl_pa() local
822 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphl_pa()
828 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
835 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
839 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
845 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
862 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
868 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphl_pa()
872 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphl_pa()
888 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
908 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
910 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_hphl_pa()
915 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
926 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_aux_pa() local
927 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_aux_pa()
932 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
940 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_aux_pa()
951 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
960 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_aux_pa()
970 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_ear_pa() local
971 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_ear_pa()
980 wcd938x->ear_rx_path = snd_soc_component_read(component, in wcd938x_codec_enable_ear_pa()
983 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
986 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
990 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
1000 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_ear_pa()
1016 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_enable_ear_pa()
1021 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
1024 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_ear_pa()
1032 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_ear_pa()
1044 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_dmic() local
1078 dev_err(component->dev, "%s: Invalid DMIC Selection\n", in wcd938x_codec_enable_dmic()
1085 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1092 snd_soc_component_write_field(component, dmic_clk_reg, in wcd938x_codec_enable_dmic()
1095 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1098 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_DMIC_CTL, in wcd938x_codec_enable_dmic()
1102 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1105 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1115 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_tx_swr_ctrl() local
1116 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_swr_ctrl()
1146 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1148 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1154 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1155 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1199 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_adc() local
1200 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_adc()
1204 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1207 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1213 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_adc()
1222 static void wcd938x_tx_channel_config(struct snd_soc_component *component, in wcd938x_tx_channel_config() argument
1248 snd_soc_component_write_field(component, reg, mask, mode); in wcd938x_tx_channel_config()
1254 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_adc_enable_req() local
1255 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_adc_enable_req()
1260 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1263 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1266 wcd938x_tx_channel_config(component, w->shift, 1); in wcd938x_adc_enable_req()
1269 dev_info(component->dev, "Invalid ADC mode\n"); in wcd938x_adc_enable_req()
1274 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1277 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1282 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1285 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1290 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1293 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1298 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1301 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1309 wcd938x_tx_channel_config(component, w->shift, 0); in wcd938x_adc_enable_req()
1314 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1317 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1322 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1325 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1330 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1333 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1338 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1341 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1348 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1357 static int wcd938x_micbias_control(struct snd_soc_component *component, in wcd938x_micbias_control() argument
1360 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_micbias_control()
1378 dev_err(component->dev, "%s: Invalid micbias number: %d\n", in wcd938x_micbias_control()
1388 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1398 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1404 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1407 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1410 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1414 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1433 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1442 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1461 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias() local
1466 wcd938x_micbias_control(component, micb_num, MICB_ENABLE, true); in wcd938x_codec_enable_micbias()
1473 wcd938x_micbias_control(component, micb_num, MICB_DISABLE, true); in wcd938x_codec_enable_micbias()
1484 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias_pullup() local
1489 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1497 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1508 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_get() local
1509 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_get()
1521 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_put() local
1522 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_put()
1537 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_get() local
1538 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_get()
1548 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_put() local
1549 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_put()
1562 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ear_pa_put_gain() local
1563 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ear_pa_put_gain()
1566 dev_err(component->dev, "Can not set EAR PA Gain, compander1 is enabled\n"); in wcd938x_ear_pa_put_gain()
1570 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_ear_pa_put_gain()
1581 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_compander() local
1582 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_compander()
1600 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_set_compander() local
1601 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_set_compander()
1631 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_get() local
1632 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_get()
1642 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_put() local
1643 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_put()
1656 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_bcs_get() local
1657 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_bcs_get()
1667 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_bcs_put() local
1668 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_bcs_put()
1943 static void wcd938x_mbhc_clk_setup(struct snd_soc_component *component, in wcd938x_mbhc_clk_setup() argument
1946 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_1, in wcd938x_mbhc_clk_setup()
1950 static void wcd938x_mbhc_mbhc_bias_control(struct snd_soc_component *component, in wcd938x_mbhc_mbhc_bias_control() argument
1953 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_ELECT, in wcd938x_mbhc_mbhc_bias_control()
1957 static void wcd938x_mbhc_program_btn_thr(struct snd_soc_component *component, in wcd938x_mbhc_program_btn_thr() argument
1964 dev_err(component->dev, "%s: invalid number of buttons: %d\n", in wcd938x_mbhc_program_btn_thr()
1971 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_BTN0 + i, in wcd938x_mbhc_program_btn_thr()
1973 dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n", in wcd938x_mbhc_program_btn_thr()
1978 static bool wcd938x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num) in wcd938x_mbhc_micb_en_status() argument
1983 val = snd_soc_component_read_field(component, in wcd938x_mbhc_micb_en_status()
1992 static void wcd938x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component, in wcd938x_mbhc_hph_l_pull_up_control() argument
1999 snd_soc_component_write_field(component, in wcd938x_mbhc_hph_l_pull_up_control()
2004 static int wcd938x_mbhc_request_micbias(struct snd_soc_component *component, in wcd938x_mbhc_request_micbias() argument
2007 return wcd938x_micbias_control(component, micb_num, req, false); in wcd938x_mbhc_request_micbias()
2010 static void wcd938x_mbhc_micb_ramp_control(struct snd_soc_component *component, in wcd938x_mbhc_micb_ramp_control() argument
2014 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
2016 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
2019 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
2021 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
2035 static int wcd938x_mbhc_micb_adjust_voltage(struct snd_soc_component *component, in wcd938x_mbhc_micb_adjust_voltage() argument
2038 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_adjust_voltage()
2066 micb_en = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2068 cur_vout_ctl = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2083 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2087 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2092 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2106 static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component, in wcd938x_mbhc_micb_ctrl_threshold_mic() argument
2109 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2124 return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2127 static void wcd938x_mbhc_get_result_params(struct snd_soc_component *component, in wcd938x_mbhc_get_result_params() argument
2131 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_result_params()
2158 dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n", in wcd938x_mbhc_get_result_params()
2169 dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", in wcd938x_mbhc_get_result_params()
2187 static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, in wcd938x_mbhc_zdet_ramp() argument
2191 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_zdet_ramp()
2194 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2196 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN5, in wcd938x_mbhc_zdet_ramp()
2198 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN6, in wcd938x_mbhc_zdet_ramp()
2200 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN7, in wcd938x_mbhc_zdet_ramp()
2202 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2204 snd_soc_component_update_bits(component, WCD938X_MBHC_NEW_ZDET_RAMP_CTL, in wcd938x_mbhc_zdet_ramp()
2212 dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2214 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2226 dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2228 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2235 static void wcd938x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, in wcd938x_wcd_mbhc_qfuse_cal() argument
2242 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2245 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2255 static void wcd938x_wcd_mbhc_calc_impedance(struct snd_soc_component *component, in wcd938x_wcd_mbhc_calc_impedance() argument
2258 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_wcd_mbhc_calc_impedance()
2278 reg0 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN5); in wcd938x_wcd_mbhc_calc_impedance()
2279 reg1 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN6); in wcd938x_wcd_mbhc_calc_impedance()
2280 reg2 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN7); in wcd938x_wcd_mbhc_calc_impedance()
2281 reg3 = snd_soc_component_read(component, WCD938X_MBHC_CTL_CLK); in wcd938x_wcd_mbhc_calc_impedance()
2282 reg4 = snd_soc_component_read(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL); in wcd938x_wcd_mbhc_calc_impedance()
2284 if (snd_soc_component_read(component, WCD938X_ANA_MBHC_ELECT) & 0x80) { in wcd938x_wcd_mbhc_calc_impedance()
2310 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2327 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2337 wcd938x_wcd_mbhc_qfuse_cal(component, zl, 0); in wcd938x_wcd_mbhc_calc_impedance()
2339 dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2343 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2361 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2369 wcd938x_wcd_mbhc_qfuse_cal(component, zr, 1); in wcd938x_wcd_mbhc_calc_impedance()
2371 dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2377 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2386 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2392 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2394 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2397 wcd938x_mbhc_zdet_ramp(component, &zdet_param[0], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2399 wcd938x_mbhc_zdet_ramp(component, &zdet_param[1], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2400 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2402 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2405 wcd938x_wcd_mbhc_qfuse_cal(component, &z1Ls, 0); in wcd938x_wcd_mbhc_calc_impedance()
2411 dev_dbg(component->dev, "%s: stereo plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2415 dev_dbg(component->dev, "%s: MONO plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2424 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN5, reg0); in wcd938x_wcd_mbhc_calc_impedance()
2425 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN6, reg1); in wcd938x_wcd_mbhc_calc_impedance()
2426 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN7, reg2); in wcd938x_wcd_mbhc_calc_impedance()
2436 snd_soc_component_write(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, reg4); in wcd938x_wcd_mbhc_calc_impedance()
2437 snd_soc_component_write(component, WCD938X_MBHC_CTL_CLK, reg3); in wcd938x_wcd_mbhc_calc_impedance()
2443 static void wcd938x_mbhc_gnd_det_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_gnd_det_ctrl() argument
2447 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2449 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2452 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2454 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2459 static void wcd938x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_hph_pull_down_ctrl() argument
2462 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2464 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2468 static void wcd938x_mbhc_moisture_config(struct snd_soc_component *component) in wcd938x_mbhc_moisture_config() argument
2470 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_config()
2473 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2480 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_moisture_config()
2482 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2487 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2491 static void wcd938x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable) in wcd938x_mbhc_moisture_detect_en() argument
2493 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_detect_en()
2496 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2499 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2503 static bool wcd938x_mbhc_get_moisture_status(struct snd_soc_component *component) in wcd938x_mbhc_get_moisture_status() argument
2505 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_moisture_status()
2509 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2516 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_get_moisture_status()
2518 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2527 if (snd_soc_component_read_field(component, WCD938X_MBHC_NEW_CTL_2, WCD938X_M_RTH_CTL_MASK)) in wcd938x_mbhc_get_moisture_status()
2530 wcd938x_mbhc_moisture_detect_en(component, true); in wcd938x_mbhc_get_moisture_status()
2532 ret = ((snd_soc_component_read(component, WCD938X_MBHC_NEW_FSM_STATUS) in wcd938x_mbhc_get_moisture_status()
2540 static void wcd938x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_moisture_polling_ctrl() argument
2543 snd_soc_component_write_field(component, in wcd938x_mbhc_moisture_polling_ctrl()
2569 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_hph_type() local
2570 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_hph_type()
2583 struct snd_soc_component *component = in wcd938x_hph_impedance_get() local
2585 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_hph_impedance_get()
2590 dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr); in wcd938x_hph_impedance_get()
2608 static int wcd938x_mbhc_init(struct snd_soc_component *component) in wcd938x_mbhc_init() argument
2610 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_init()
2628 wcd938x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd938x_mbhc_init()
2632 snd_soc_add_component_controls(component, impedance_detect_controls, in wcd938x_mbhc_init()
2634 snd_soc_add_component_controls(component, hph_type_detect_controls, in wcd938x_mbhc_init()
2640 static void wcd938x_mbhc_deinit(struct snd_soc_component *component) in wcd938x_mbhc_deinit() argument
2642 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_deinit()
3091 static int wcd938x_soc_codec_probe(struct snd_soc_component *component) in wcd938x_soc_codec_probe() argument
3093 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_probe()
3095 struct device *dev = component->dev; in wcd938x_soc_codec_probe()
3106 snd_soc_component_init_regmap(component, wcd938x->regmap); in wcd938x_soc_codec_probe()
3112 wcd938x->variant = snd_soc_component_read_field(component, in wcd938x_soc_codec_probe()
3116 wcd938x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD938X); in wcd938x_soc_codec_probe()
3170 ret = snd_soc_add_component_controls(component, wcd9380_snd_controls, in wcd938x_soc_codec_probe()
3173 dev_err(component->dev, in wcd938x_soc_codec_probe()
3180 ret = snd_soc_add_component_controls(component, wcd9385_snd_controls, in wcd938x_soc_codec_probe()
3183 dev_err(component->dev, in wcd938x_soc_codec_probe()
3193 ret = wcd938x_mbhc_init(component); in wcd938x_soc_codec_probe()
3195 dev_err(component->dev, "mbhc initialization failed\n"); in wcd938x_soc_codec_probe()
3213 static void wcd938x_soc_codec_remove(struct snd_soc_component *component) in wcd938x_soc_codec_remove() argument
3215 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_remove()
3217 wcd938x_mbhc_deinit(component); in wcd938x_soc_codec_remove()
3284 static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool active) in wcd938x_swap_gnd_mic() argument
3290 wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_swap_gnd_mic()