Lines Matching full:component

12 #include <linux/component.h>
314 static int wcd938x_set_swr_clk_rate(struct snd_soc_component *component, int rate, int bank) in wcd938x_set_swr_clk_rate() argument
337 snd_soc_component_update_bits(component, WCD938X_DIGITAL_SWR_TX_CLK_RATE, in wcd938x_set_swr_clk_rate()
428 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_rxclk() local
432 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
434 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
436 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX0_CTL, in wcd938x_codec_enable_rxclk()
438 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX1_CTL, in wcd938x_codec_enable_rxclk()
440 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX2_CTL, in wcd938x_codec_enable_rxclk()
442 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
444 snd_soc_component_write_field(component, WCD938X_AUX_AUXPA, in wcd938x_codec_enable_rxclk()
448 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
450 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
452 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
454 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
456 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
467 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphl_dac_event() local
468 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphl_dac_event()
472 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
475 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
478 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
483 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
487 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
491 if (!wcd938x->comp2_enable || (snd_soc_component_read(component, in wcd938x_codec_hphl_dac_event()
494 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphl_dac_event()
497 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
500 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
508 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
521 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphr_dac_event() local
522 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphr_dac_event()
526 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
529 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
532 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
537 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
541 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
546 (snd_soc_component_read(component, in wcd938x_codec_hphr_dac_event()
549 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphr_dac_event()
552 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
555 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
562 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
575 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_ear_dac_event() local
576 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_ear_dac_event()
582 component, WCD938X_DIGITAL_CDC_EAR_PATH_CTL); in wcd938x_codec_ear_dac_event()
584 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
587 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
590 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
593 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
597 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
600 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
604 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
611 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, 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()
631 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
635 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
639 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_ear_dac_event()
641 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
654 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_aux_dac_event() local
655 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_aux_dac_event()
659 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
662 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
665 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
669 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_aux_dac_event()
678 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
690 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphr_pa() local
691 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphr_pa()
697 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
705 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
709 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
715 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
733 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
738 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphr_pa()
742 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphr_pa()
758 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
779 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
781 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL1, in wcd938x_codec_enable_hphr_pa()
786 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
797 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphl_pa() local
798 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphl_pa()
804 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
811 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
815 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
821 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
838 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
844 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphl_pa()
848 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphl_pa()
864 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
884 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
886 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_hphl_pa()
891 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
902 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_aux_pa() local
903 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_aux_pa()
908 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
916 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_aux_pa()
927 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
936 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_aux_pa()
946 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_ear_pa() local
947 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_ear_pa()
956 wcd938x->ear_rx_path = snd_soc_component_read(component, in wcd938x_codec_enable_ear_pa()
959 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
962 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
966 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
976 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_ear_pa()
992 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_enable_ear_pa()
997 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
1000 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_ear_pa()
1008 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_ear_pa()
1020 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_dmic() local
1054 dev_err(component->dev, "%s: Invalid DMIC Selection\n", in wcd938x_codec_enable_dmic()
1061 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1068 snd_soc_component_write_field(component, dmic_clk_reg, in wcd938x_codec_enable_dmic()
1071 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1074 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_DMIC_CTL, in wcd938x_codec_enable_dmic()
1078 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1081 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1091 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_tx_swr_ctrl() local
1092 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_swr_ctrl()
1122 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1124 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1130 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1131 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1175 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_adc() local
1176 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_adc()
1180 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1183 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1189 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_adc()
1198 static void wcd938x_tx_channel_config(struct snd_soc_component *component, in wcd938x_tx_channel_config() argument
1224 snd_soc_component_write_field(component, reg, mask, mode); in wcd938x_tx_channel_config()
1230 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_adc_enable_req() local
1231 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_adc_enable_req()
1236 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1239 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1242 wcd938x_tx_channel_config(component, w->shift, 1); in wcd938x_adc_enable_req()
1245 dev_info(component->dev, "Invalid ADC mode\n"); in wcd938x_adc_enable_req()
1250 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1253 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1258 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1261 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1266 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1269 snd_soc_component_write_field(component, 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()
1285 wcd938x_tx_channel_config(component, w->shift, 0); 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()
1306 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1309 snd_soc_component_write_field(component, 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()
1324 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1333 static int wcd938x_micbias_control(struct snd_soc_component *component, in wcd938x_micbias_control() argument
1336 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_micbias_control()
1354 dev_err(component->dev, "%s: Invalid micbias number: %d\n", in wcd938x_micbias_control()
1364 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1374 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1380 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1383 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1386 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1390 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1409 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1418 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1437 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias() local
1442 wcd938x_micbias_control(component, micb_num, MICB_ENABLE, true); in wcd938x_codec_enable_micbias()
1449 wcd938x_micbias_control(component, micb_num, MICB_DISABLE, true); in wcd938x_codec_enable_micbias()
1460 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias_pullup() local
1465 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1473 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1484 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_get() local
1485 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_get()
1497 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_put() local
1498 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_put()
1513 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_get() local
1514 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_get()
1524 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_put() local
1525 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_put()
1538 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ear_pa_put_gain() local
1539 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ear_pa_put_gain()
1542 dev_err(component->dev, "Can not set EAR PA Gain, compander1 is enabled\n"); in wcd938x_ear_pa_put_gain()
1546 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_ear_pa_put_gain()
1557 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_compander() local
1558 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_compander()
1576 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_set_compander() local
1577 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_set_compander()
1607 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_get() local
1608 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_get()
1618 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_put() local
1619 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_put()
1894 static void wcd938x_mbhc_clk_setup(struct snd_soc_component *component, in wcd938x_mbhc_clk_setup() argument
1897 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_1, in wcd938x_mbhc_clk_setup()
1901 static void wcd938x_mbhc_mbhc_bias_control(struct snd_soc_component *component, in wcd938x_mbhc_mbhc_bias_control() argument
1904 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_ELECT, in wcd938x_mbhc_mbhc_bias_control()
1908 static void wcd938x_mbhc_program_btn_thr(struct snd_soc_component *component, in wcd938x_mbhc_program_btn_thr() argument
1915 dev_err(component->dev, "%s: invalid number of buttons: %d\n", in wcd938x_mbhc_program_btn_thr()
1922 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_BTN0 + i, in wcd938x_mbhc_program_btn_thr()
1924 dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n", in wcd938x_mbhc_program_btn_thr()
1929 static bool wcd938x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num) in wcd938x_mbhc_micb_en_status() argument
1934 val = snd_soc_component_read_field(component, in wcd938x_mbhc_micb_en_status()
1943 static void wcd938x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component, in wcd938x_mbhc_hph_l_pull_up_control() argument
1950 snd_soc_component_write_field(component, in wcd938x_mbhc_hph_l_pull_up_control()
1955 static int wcd938x_mbhc_request_micbias(struct snd_soc_component *component, in wcd938x_mbhc_request_micbias() argument
1958 return wcd938x_micbias_control(component, micb_num, req, false); in wcd938x_mbhc_request_micbias()
1961 static void wcd938x_mbhc_micb_ramp_control(struct snd_soc_component *component, in wcd938x_mbhc_micb_ramp_control() argument
1965 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1967 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1970 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1972 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1986 static int wcd938x_mbhc_micb_adjust_voltage(struct snd_soc_component *component, in wcd938x_mbhc_micb_adjust_voltage() argument
1989 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_adjust_voltage()
2017 micb_en = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2019 cur_vout_ctl = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2034 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2038 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2043 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2057 static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component, in wcd938x_mbhc_micb_ctrl_threshold_mic() argument
2060 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2075 return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2078 static void wcd938x_mbhc_get_result_params(struct snd_soc_component *component, in wcd938x_mbhc_get_result_params() argument
2082 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_result_params()
2109 dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n", in wcd938x_mbhc_get_result_params()
2120 dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", in wcd938x_mbhc_get_result_params()
2138 static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, in wcd938x_mbhc_zdet_ramp() argument
2142 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_zdet_ramp()
2145 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2147 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN5, in wcd938x_mbhc_zdet_ramp()
2149 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN6, in wcd938x_mbhc_zdet_ramp()
2151 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN7, in wcd938x_mbhc_zdet_ramp()
2153 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2155 snd_soc_component_update_bits(component, WCD938X_MBHC_NEW_ZDET_RAMP_CTL, in wcd938x_mbhc_zdet_ramp()
2163 dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2165 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2177 dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2179 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2186 static void wcd938x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, in wcd938x_wcd_mbhc_qfuse_cal() argument
2193 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2196 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2206 static void wcd938x_wcd_mbhc_calc_impedance(struct snd_soc_component *component, in wcd938x_wcd_mbhc_calc_impedance() argument
2209 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_wcd_mbhc_calc_impedance()
2229 reg0 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN5); in wcd938x_wcd_mbhc_calc_impedance()
2230 reg1 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN6); in wcd938x_wcd_mbhc_calc_impedance()
2231 reg2 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN7); in wcd938x_wcd_mbhc_calc_impedance()
2232 reg3 = snd_soc_component_read(component, WCD938X_MBHC_CTL_CLK); in wcd938x_wcd_mbhc_calc_impedance()
2233 reg4 = snd_soc_component_read(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL); in wcd938x_wcd_mbhc_calc_impedance()
2235 if (snd_soc_component_read(component, WCD938X_ANA_MBHC_ELECT) & 0x80) { in wcd938x_wcd_mbhc_calc_impedance()
2261 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2278 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2288 wcd938x_wcd_mbhc_qfuse_cal(component, zl, 0); in wcd938x_wcd_mbhc_calc_impedance()
2290 dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2294 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2312 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2320 wcd938x_wcd_mbhc_qfuse_cal(component, zr, 1); in wcd938x_wcd_mbhc_calc_impedance()
2322 dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2328 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2337 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2343 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2345 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2348 wcd938x_mbhc_zdet_ramp(component, &zdet_param[0], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2350 wcd938x_mbhc_zdet_ramp(component, &zdet_param[1], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2351 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2353 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2356 wcd938x_wcd_mbhc_qfuse_cal(component, &z1Ls, 0); in wcd938x_wcd_mbhc_calc_impedance()
2362 dev_dbg(component->dev, "%s: stereo plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2366 dev_dbg(component->dev, "%s: MONO plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2375 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN5, reg0); in wcd938x_wcd_mbhc_calc_impedance()
2376 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN6, reg1); in wcd938x_wcd_mbhc_calc_impedance()
2377 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN7, reg2); in wcd938x_wcd_mbhc_calc_impedance()
2387 snd_soc_component_write(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, reg4); in wcd938x_wcd_mbhc_calc_impedance()
2388 snd_soc_component_write(component, WCD938X_MBHC_CTL_CLK, reg3); in wcd938x_wcd_mbhc_calc_impedance()
2394 static void wcd938x_mbhc_gnd_det_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_gnd_det_ctrl() argument
2398 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2400 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2403 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2405 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2410 static void wcd938x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_hph_pull_down_ctrl() argument
2413 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2415 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2419 static void wcd938x_mbhc_moisture_config(struct snd_soc_component *component) in wcd938x_mbhc_moisture_config() argument
2421 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_config()
2424 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2431 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_moisture_config()
2433 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2438 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2442 static void wcd938x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable) in wcd938x_mbhc_moisture_detect_en() argument
2444 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_detect_en()
2447 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2450 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2454 static bool wcd938x_mbhc_get_moisture_status(struct snd_soc_component *component) in wcd938x_mbhc_get_moisture_status() argument
2456 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_moisture_status()
2460 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2467 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_get_moisture_status()
2469 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2478 if (snd_soc_component_read_field(component, WCD938X_MBHC_NEW_CTL_2, WCD938X_M_RTH_CTL_MASK)) in wcd938x_mbhc_get_moisture_status()
2481 wcd938x_mbhc_moisture_detect_en(component, true); in wcd938x_mbhc_get_moisture_status()
2483 ret = ((snd_soc_component_read(component, WCD938X_MBHC_NEW_FSM_STATUS) in wcd938x_mbhc_get_moisture_status()
2491 static void wcd938x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_moisture_polling_ctrl() argument
2494 snd_soc_component_write_field(component, in wcd938x_mbhc_moisture_polling_ctrl()
2520 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_hph_type() local
2521 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_hph_type()
2534 struct snd_soc_component *component = in wcd938x_hph_impedance_get() local
2536 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_hph_impedance_get()
2541 dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr); in wcd938x_hph_impedance_get()
2559 static int wcd938x_mbhc_init(struct snd_soc_component *component) in wcd938x_mbhc_init() argument
2561 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_init()
2579 wcd938x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd938x_mbhc_init()
2583 snd_soc_add_component_controls(component, impedance_detect_controls, in wcd938x_mbhc_init()
2585 snd_soc_add_component_controls(component, hph_type_detect_controls, in wcd938x_mbhc_init()
2591 static void wcd938x_mbhc_deinit(struct snd_soc_component *component) in wcd938x_mbhc_deinit() argument
2593 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_deinit()
3040 static int wcd938x_soc_codec_probe(struct snd_soc_component *component) in wcd938x_soc_codec_probe() argument
3042 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_probe()
3044 struct device *dev = component->dev; in wcd938x_soc_codec_probe()
3055 snd_soc_component_init_regmap(component, wcd938x->regmap); in wcd938x_soc_codec_probe()
3061 wcd938x->variant = snd_soc_component_read_field(component, in wcd938x_soc_codec_probe()
3065 wcd938x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD938X); in wcd938x_soc_codec_probe()
3119 ret = snd_soc_add_component_controls(component, wcd9380_snd_controls, in wcd938x_soc_codec_probe()
3122 dev_err(component->dev, in wcd938x_soc_codec_probe()
3129 ret = snd_soc_add_component_controls(component, wcd9385_snd_controls, in wcd938x_soc_codec_probe()
3132 dev_err(component->dev, in wcd938x_soc_codec_probe()
3142 ret = wcd938x_mbhc_init(component); in wcd938x_soc_codec_probe()
3144 dev_err(component->dev, "mbhc initialization failed\n"); in wcd938x_soc_codec_probe()
3162 static void wcd938x_soc_codec_remove(struct snd_soc_component *component) in wcd938x_soc_codec_remove() argument
3164 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_remove()
3166 wcd938x_mbhc_deinit(component); in wcd938x_soc_codec_remove()
3233 static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool active) in wcd938x_swap_gnd_mic() argument
3239 wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_swap_gnd_mic()