Lines Matching full:component
12 #include <linux/component.h>
319 static int wcd938x_set_swr_clk_rate(struct snd_soc_component *component, int rate, int bank) in wcd938x_set_swr_clk_rate() argument
342 snd_soc_component_update_bits(component, WCD938X_DIGITAL_SWR_TX_CLK_RATE, in wcd938x_set_swr_clk_rate()
433 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_rxclk() local
437 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
439 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
441 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX0_CTL, in wcd938x_codec_enable_rxclk()
443 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX1_CTL, in wcd938x_codec_enable_rxclk()
445 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_RX2_CTL, in wcd938x_codec_enable_rxclk()
447 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
449 snd_soc_component_write_field(component, WCD938X_AUX_AUXPA, in wcd938x_codec_enable_rxclk()
453 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
455 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
457 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_rxclk()
459 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
461 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_rxclk()
472 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphl_dac_event() local
473 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphl_dac_event()
477 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
480 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()
488 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
492 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
496 if (!wcd938x->comp2_enable || (snd_soc_component_read(component, in wcd938x_codec_hphl_dac_event()
499 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphl_dac_event()
502 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
505 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
513 snd_soc_component_write_field(component, in wcd938x_codec_hphl_dac_event()
526 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_hphr_dac_event() local
527 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_hphr_dac_event()
531 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
534 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()
542 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
546 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
551 (snd_soc_component_read(component, in wcd938x_codec_hphr_dac_event()
554 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_hphr_dac_event()
557 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
560 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
567 snd_soc_component_write_field(component, in wcd938x_codec_hphr_dac_event()
580 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_ear_dac_event() local
581 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_ear_dac_event()
587 component, WCD938X_DIGITAL_CDC_EAR_PATH_CTL); in wcd938x_codec_ear_dac_event()
589 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
592 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
595 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
598 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
602 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
605 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
609 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
616 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_ear_dac_event()
626 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
629 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
633 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
636 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
640 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
644 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_ear_dac_event()
646 snd_soc_component_write_field(component, in wcd938x_codec_ear_dac_event()
659 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_aux_dac_event() local
660 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_aux_dac_event()
664 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
667 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
670 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
674 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_aux_dac_event()
683 snd_soc_component_write_field(component, in wcd938x_codec_aux_dac_event()
695 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphr_pa() local
696 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphr_pa()
702 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
710 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
714 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
720 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
738 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphr_pa()
743 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphr_pa()
747 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphr_pa()
763 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
784 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphr_pa()
786 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL1, in wcd938x_codec_enable_hphr_pa()
791 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphr_pa()
802 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_hphl_pa() local
803 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_hphl_pa()
809 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
816 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
820 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
826 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
843 snd_soc_component_write_field(component, in wcd938x_codec_enable_hphl_pa()
849 snd_soc_component_write_field(component, WCD938X_HPH_NEW_INT_HPH_TIMER1, in wcd938x_codec_enable_hphl_pa()
853 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_hphl_pa()
869 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
889 snd_soc_component_write_field(component, WCD938X_ANA_HPH, in wcd938x_codec_enable_hphl_pa()
891 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_hphl_pa()
896 snd_soc_component_write_field(component, WCD938X_LDOH_MODE, in wcd938x_codec_enable_hphl_pa()
907 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_aux_pa() local
908 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_aux_pa()
913 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
921 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_aux_pa()
932 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_aux_pa()
941 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_aux_pa()
951 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_ear_pa() local
952 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_ear_pa()
961 wcd938x->ear_rx_path = snd_soc_component_read(component, in wcd938x_codec_enable_ear_pa()
964 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
967 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
971 snd_soc_component_write_field(component, in wcd938x_codec_enable_ear_pa()
981 snd_soc_component_write_field(component, WCD938X_ANA_RX_SUPPLIES, in wcd938x_codec_enable_ear_pa()
997 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_codec_enable_ear_pa()
1002 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL2, in wcd938x_codec_enable_ear_pa()
1005 snd_soc_component_write_field(component, WCD938X_DIGITAL_PDM_WD_CTL0, in wcd938x_codec_enable_ear_pa()
1013 snd_soc_component_write_field(component, WCD938X_FLYBACK_EN, in wcd938x_codec_enable_ear_pa()
1025 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_dmic() local
1059 dev_err(component->dev, "%s: Invalid DMIC Selection\n", in wcd938x_codec_enable_dmic()
1066 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1073 snd_soc_component_write_field(component, dmic_clk_reg, in wcd938x_codec_enable_dmic()
1076 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1079 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_DMIC_CTL, in wcd938x_codec_enable_dmic()
1083 snd_soc_component_write_field(component, in wcd938x_codec_enable_dmic()
1086 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd938x_codec_enable_dmic()
1096 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_tx_swr_ctrl() local
1097 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_swr_ctrl()
1127 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1129 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1135 wcd938x_set_swr_clk_rate(component, rate, !bank); in wcd938x_tx_swr_ctrl()
1136 wcd938x_set_swr_clk_rate(component, rate, bank); in wcd938x_tx_swr_ctrl()
1180 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_adc() local
1181 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_codec_enable_adc()
1185 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1188 snd_soc_component_write_field(component, in wcd938x_codec_enable_adc()
1194 snd_soc_component_write_field(component, WCD938X_DIGITAL_CDC_ANA_CLK_CTL, in wcd938x_codec_enable_adc()
1203 static void wcd938x_tx_channel_config(struct snd_soc_component *component, in wcd938x_tx_channel_config() argument
1229 snd_soc_component_write_field(component, reg, mask, mode); in wcd938x_tx_channel_config()
1235 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_adc_enable_req() local
1236 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_adc_enable_req()
1241 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1244 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1247 wcd938x_tx_channel_config(component, w->shift, 1); in wcd938x_adc_enable_req()
1250 dev_info(component->dev, "Invalid ADC mode\n"); in wcd938x_adc_enable_req()
1255 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1258 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1263 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1266 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1271 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1274 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1279 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1282 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1290 wcd938x_tx_channel_config(component, w->shift, 0); in wcd938x_adc_enable_req()
1295 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1298 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1303 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1306 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1311 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1314 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1319 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1322 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1329 snd_soc_component_write_field(component, in wcd938x_adc_enable_req()
1338 static int wcd938x_micbias_control(struct snd_soc_component *component, in wcd938x_micbias_control() argument
1341 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_micbias_control()
1359 dev_err(component->dev, "%s: Invalid micbias number: %d\n", in wcd938x_micbias_control()
1369 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1379 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1385 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1388 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1391 snd_soc_component_write_field(component, in wcd938x_micbias_control()
1395 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1414 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1423 snd_soc_component_write_field(component, micb_reg, in wcd938x_micbias_control()
1442 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias() local
1447 wcd938x_micbias_control(component, micb_num, MICB_ENABLE, true); in wcd938x_codec_enable_micbias()
1454 wcd938x_micbias_control(component, micb_num, MICB_DISABLE, true); in wcd938x_codec_enable_micbias()
1465 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd938x_codec_enable_micbias_pullup() local
1470 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1478 wcd938x_micbias_control(component, micb_num, in wcd938x_codec_enable_micbias_pullup()
1489 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_get() local
1490 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_get()
1502 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_tx_mode_put() local
1503 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_tx_mode_put()
1518 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_get() local
1519 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_get()
1529 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_rx_hph_mode_put() local
1530 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_rx_hph_mode_put()
1543 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ear_pa_put_gain() local
1544 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ear_pa_put_gain()
1547 dev_err(component->dev, "Can not set EAR PA Gain, compander1 is enabled\n"); in wcd938x_ear_pa_put_gain()
1551 snd_soc_component_write_field(component, WCD938X_ANA_EAR_COMPANDER_CTL, in wcd938x_ear_pa_put_gain()
1562 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_compander() local
1563 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_compander()
1581 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_set_compander() local
1582 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_set_compander()
1612 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_get() local
1613 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_get()
1623 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_ldoh_put() local
1624 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_ldoh_put()
1899 static void wcd938x_mbhc_clk_setup(struct snd_soc_component *component, in wcd938x_mbhc_clk_setup() argument
1902 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_1, in wcd938x_mbhc_clk_setup()
1906 static void wcd938x_mbhc_mbhc_bias_control(struct snd_soc_component *component, in wcd938x_mbhc_mbhc_bias_control() argument
1909 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_ELECT, in wcd938x_mbhc_mbhc_bias_control()
1913 static void wcd938x_mbhc_program_btn_thr(struct snd_soc_component *component, in wcd938x_mbhc_program_btn_thr() argument
1920 dev_err(component->dev, "%s: invalid number of buttons: %d\n", in wcd938x_mbhc_program_btn_thr()
1927 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_BTN0 + i, in wcd938x_mbhc_program_btn_thr()
1929 dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n", in wcd938x_mbhc_program_btn_thr()
1934 static bool wcd938x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num) in wcd938x_mbhc_micb_en_status() argument
1939 val = snd_soc_component_read_field(component, in wcd938x_mbhc_micb_en_status()
1948 static void wcd938x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component, in wcd938x_mbhc_hph_l_pull_up_control() argument
1955 snd_soc_component_write_field(component, in wcd938x_mbhc_hph_l_pull_up_control()
1960 static int wcd938x_mbhc_request_micbias(struct snd_soc_component *component, in wcd938x_mbhc_request_micbias() argument
1963 return wcd938x_micbias_control(component, micb_num, req, false); in wcd938x_mbhc_request_micbias()
1966 static void wcd938x_mbhc_micb_ramp_control(struct snd_soc_component *component, in wcd938x_mbhc_micb_ramp_control() argument
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()
1975 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1977 snd_soc_component_write_field(component, WCD938X_ANA_MICB2_RAMP, in wcd938x_mbhc_micb_ramp_control()
1991 static int wcd938x_mbhc_micb_adjust_voltage(struct snd_soc_component *component, in wcd938x_mbhc_micb_adjust_voltage() argument
1994 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_adjust_voltage()
2022 micb_en = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2024 cur_vout_ctl = snd_soc_component_read_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2039 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()
2048 snd_soc_component_write_field(component, micb_reg, in wcd938x_mbhc_micb_adjust_voltage()
2062 static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component, in wcd938x_mbhc_micb_ctrl_threshold_mic() argument
2065 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2080 return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); in wcd938x_mbhc_micb_ctrl_threshold_mic()
2083 static void wcd938x_mbhc_get_result_params(struct snd_soc_component *component, in wcd938x_mbhc_get_result_params() argument
2087 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_result_params()
2114 dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n", in wcd938x_mbhc_get_result_params()
2125 dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", in wcd938x_mbhc_get_result_params()
2143 static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, in wcd938x_mbhc_zdet_ramp() argument
2147 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_zdet_ramp()
2150 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2152 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN5, in wcd938x_mbhc_zdet_ramp()
2154 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN6, in wcd938x_mbhc_zdet_ramp()
2156 snd_soc_component_update_bits(component, WCD938X_ANA_MBHC_BTN7, in wcd938x_mbhc_zdet_ramp()
2158 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, in wcd938x_mbhc_zdet_ramp()
2160 snd_soc_component_update_bits(component, WCD938X_MBHC_NEW_ZDET_RAMP_CTL, in wcd938x_mbhc_zdet_ramp()
2168 dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2170 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2182 dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", in wcd938x_mbhc_zdet_ramp()
2184 wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); in wcd938x_mbhc_zdet_ramp()
2191 static void wcd938x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, in wcd938x_wcd_mbhc_qfuse_cal() argument
2198 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2201 q1 = snd_soc_component_read(component, in wcd938x_wcd_mbhc_qfuse_cal()
2211 static void wcd938x_wcd_mbhc_calc_impedance(struct snd_soc_component *component, in wcd938x_wcd_mbhc_calc_impedance() argument
2214 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_wcd_mbhc_calc_impedance()
2234 reg0 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN5); in wcd938x_wcd_mbhc_calc_impedance()
2235 reg1 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN6); in wcd938x_wcd_mbhc_calc_impedance()
2236 reg2 = snd_soc_component_read(component, WCD938X_ANA_MBHC_BTN7); in wcd938x_wcd_mbhc_calc_impedance()
2237 reg3 = snd_soc_component_read(component, WCD938X_MBHC_CTL_CLK); in wcd938x_wcd_mbhc_calc_impedance()
2238 reg4 = snd_soc_component_read(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL); in wcd938x_wcd_mbhc_calc_impedance()
2240 if (snd_soc_component_read(component, WCD938X_ANA_MBHC_ELECT) & 0x80) { in wcd938x_wcd_mbhc_calc_impedance()
2266 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2283 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, &z1L, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2293 wcd938x_wcd_mbhc_qfuse_cal(component, zl, 0); in wcd938x_wcd_mbhc_calc_impedance()
2295 dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2299 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2317 wcd938x_mbhc_zdet_ramp(component, zdet_param_ptr, NULL, &z1R, d1); in wcd938x_wcd_mbhc_calc_impedance()
2325 wcd938x_wcd_mbhc_qfuse_cal(component, zr, 1); in wcd938x_wcd_mbhc_calc_impedance()
2327 dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n", in wcd938x_wcd_mbhc_calc_impedance()
2333 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2342 dev_dbg(component->dev, in wcd938x_wcd_mbhc_calc_impedance()
2348 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2350 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2353 wcd938x_mbhc_zdet_ramp(component, &zdet_param[0], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2355 wcd938x_mbhc_zdet_ramp(component, &zdet_param[1], &z1Ls, NULL, d1); in wcd938x_wcd_mbhc_calc_impedance()
2356 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_wcd_mbhc_calc_impedance()
2358 snd_soc_component_write_field(component, WCD938X_HPH_R_ATEST, in wcd938x_wcd_mbhc_calc_impedance()
2361 wcd938x_wcd_mbhc_qfuse_cal(component, &z1Ls, 0); in wcd938x_wcd_mbhc_calc_impedance()
2367 dev_dbg(component->dev, "%s: stereo plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2371 dev_dbg(component->dev, "%s: MONO plug type detected\n", in wcd938x_wcd_mbhc_calc_impedance()
2380 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN5, reg0); in wcd938x_wcd_mbhc_calc_impedance()
2381 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN6, reg1); in wcd938x_wcd_mbhc_calc_impedance()
2382 snd_soc_component_write(component, WCD938X_ANA_MBHC_BTN7, reg2); in wcd938x_wcd_mbhc_calc_impedance()
2392 snd_soc_component_write(component, WCD938X_MBHC_NEW_ZDET_ANA_CTL, reg4); in wcd938x_wcd_mbhc_calc_impedance()
2393 snd_soc_component_write(component, WCD938X_MBHC_CTL_CLK, reg3); in wcd938x_wcd_mbhc_calc_impedance()
2399 static void wcd938x_mbhc_gnd_det_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_gnd_det_ctrl() argument
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()
2408 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2410 snd_soc_component_write_field(component, WCD938X_ANA_MBHC_MECH, in wcd938x_mbhc_gnd_det_ctrl()
2415 static void wcd938x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_hph_pull_down_ctrl() argument
2418 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2420 snd_soc_component_write_field(component, WCD938X_HPH_PA_CTL2, in wcd938x_mbhc_hph_pull_down_ctrl()
2424 static void wcd938x_mbhc_moisture_config(struct snd_soc_component *component) in wcd938x_mbhc_moisture_config() argument
2426 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_config()
2429 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2436 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_moisture_config()
2438 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2443 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_config()
2447 static void wcd938x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable) in wcd938x_mbhc_moisture_detect_en() argument
2449 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_moisture_detect_en()
2452 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2455 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_moisture_detect_en()
2459 static bool wcd938x_mbhc_get_moisture_status(struct snd_soc_component *component) in wcd938x_mbhc_get_moisture_status() argument
2461 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_get_moisture_status()
2465 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2472 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd938x_mbhc_get_moisture_status()
2474 snd_soc_component_write_field(component, WCD938X_MBHC_NEW_CTL_2, in wcd938x_mbhc_get_moisture_status()
2483 if (snd_soc_component_read_field(component, WCD938X_MBHC_NEW_CTL_2, WCD938X_M_RTH_CTL_MASK)) in wcd938x_mbhc_get_moisture_status()
2486 wcd938x_mbhc_moisture_detect_en(component, true); in wcd938x_mbhc_get_moisture_status()
2488 ret = ((snd_soc_component_read(component, WCD938X_MBHC_NEW_FSM_STATUS) in wcd938x_mbhc_get_moisture_status()
2496 static void wcd938x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component, in wcd938x_mbhc_moisture_polling_ctrl() argument
2499 snd_soc_component_write_field(component, in wcd938x_mbhc_moisture_polling_ctrl()
2525 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd938x_get_hph_type() local
2526 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_get_hph_type()
2539 struct snd_soc_component *component = in wcd938x_hph_impedance_get() local
2541 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_hph_impedance_get()
2546 dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr); in wcd938x_hph_impedance_get()
2564 static int wcd938x_mbhc_init(struct snd_soc_component *component) in wcd938x_mbhc_init() argument
2566 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_init()
2584 wcd938x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd938x_mbhc_init()
2588 snd_soc_add_component_controls(component, impedance_detect_controls, in wcd938x_mbhc_init()
2590 snd_soc_add_component_controls(component, hph_type_detect_controls, in wcd938x_mbhc_init()
2596 static void wcd938x_mbhc_deinit(struct snd_soc_component *component) in wcd938x_mbhc_deinit() argument
2598 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_mbhc_deinit()
3045 static int wcd938x_soc_codec_probe(struct snd_soc_component *component) in wcd938x_soc_codec_probe() argument
3047 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_probe()
3049 struct device *dev = component->dev; in wcd938x_soc_codec_probe()
3060 snd_soc_component_init_regmap(component, wcd938x->regmap); in wcd938x_soc_codec_probe()
3066 wcd938x->variant = snd_soc_component_read_field(component, in wcd938x_soc_codec_probe()
3070 wcd938x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD938X); in wcd938x_soc_codec_probe()
3124 ret = snd_soc_add_component_controls(component, wcd9380_snd_controls, in wcd938x_soc_codec_probe()
3127 dev_err(component->dev, in wcd938x_soc_codec_probe()
3134 ret = snd_soc_add_component_controls(component, wcd9385_snd_controls, in wcd938x_soc_codec_probe()
3137 dev_err(component->dev, in wcd938x_soc_codec_probe()
3147 ret = wcd938x_mbhc_init(component); in wcd938x_soc_codec_probe()
3149 dev_err(component->dev, "mbhc initialization failed\n"); in wcd938x_soc_codec_probe()
3167 static void wcd938x_soc_codec_remove(struct snd_soc_component *component) in wcd938x_soc_codec_remove() argument
3169 struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_soc_codec_remove()
3171 wcd938x_mbhc_deinit(component); in wcd938x_soc_codec_remove()
3238 static bool wcd938x_swap_gnd_mic(struct snd_soc_component *component, bool active) in wcd938x_swap_gnd_mic() argument
3244 wcd938x = snd_soc_component_get_drvdata(component); in wcd938x_swap_gnd_mic()