Lines Matching full:component
16 #include <linux/component.h>
178 struct snd_soc_component *component; member
331 static int wcd939x_set_swr_clk_rate(struct snd_soc_component *component, int rate, int bank) in wcd939x_set_swr_clk_rate() argument
355 snd_soc_component_write_field(component, WCD939X_DIGITAL_SWR_TX_CLK_RATE, mask, val); in wcd939x_set_swr_clk_rate()
360 static int wcd939x_io_init(struct snd_soc_component *component) in wcd939x_io_init() argument
362 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
364 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
369 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
372 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_io_init()
374 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_io_init()
376 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_io_init()
379 snd_soc_component_write_field(component, WCD939X_TX_COM_NEW_INT_FE_ICTRL_STG2CASC_ULP, in wcd939x_io_init()
381 snd_soc_component_write_field(component, WCD939X_TX_COM_NEW_INT_FE_ICTRL_STG2CASC_ULP, in wcd939x_io_init()
384 snd_soc_component_write_field(component, WCD939X_TX_COM_NEW_INT_FE_ICTRL_STG2MAIN_ULP, in wcd939x_io_init()
387 snd_soc_component_write_field(component, WCD939X_MICB1_TEST_CTL_1, in wcd939x_io_init()
389 snd_soc_component_write_field(component, WCD939X_MICB2_TEST_CTL_1, in wcd939x_io_init()
391 snd_soc_component_write_field(component, WCD939X_MICB3_TEST_CTL_1, in wcd939x_io_init()
393 snd_soc_component_write_field(component, WCD939X_MICB4_TEST_CTL_1, in wcd939x_io_init()
395 snd_soc_component_write_field(component, WCD939X_TX_3_4_TEST_BLK_EN2, in wcd939x_io_init()
398 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_io_init()
400 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_io_init()
403 snd_soc_component_write_field(component, WCD939X_HPH_OCP_CTL, in wcd939x_io_init()
405 snd_soc_component_write_field(component, WCD939X_HPH_OCP_CTL, in wcd939x_io_init()
408 snd_soc_component_write(component, WCD939X_E_CFG0, in wcd939x_io_init()
445 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_rxclk() local
449 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
453 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
455 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
458 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
463 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
465 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
467 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
471 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
473 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
476 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
478 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
480 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
483 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
486 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
489 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
492 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
505 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_hphl_dac_event() local
506 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_hphl_dac_event()
510 snd_soc_component_write_field(component, WCD939X_HPH_RDAC_CLK_CTL1, in wcd939x_codec_hphl_dac_event()
514 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphl_dac_event()
518 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_codec_hphl_dac_event()
521 snd_soc_component_write_field(component, in wcd939x_codec_hphl_dac_event()
527 snd_soc_component_read_field(component, in wcd939x_codec_hphl_dac_event()
532 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_hphl_dac_event()
536 snd_soc_component_write_field(component, in wcd939x_codec_hphl_dac_event()
540 snd_soc_component_write_field(component, WCD939X_HPH_L_EN, in wcd939x_codec_hphl_dac_event()
545 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_codec_hphl_dac_event()
547 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphl_dac_event()
559 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_hphr_dac_event() local
560 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_hphr_dac_event()
562 dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__, in wcd939x_codec_hphr_dac_event()
567 snd_soc_component_write_field(component, WCD939X_HPH_RDAC_CLK_CTL1, in wcd939x_codec_hphr_dac_event()
571 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphr_dac_event()
575 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_codec_hphr_dac_event()
578 snd_soc_component_write_field(component, in wcd939x_codec_hphr_dac_event()
584 snd_soc_component_read_field(component, in wcd939x_codec_hphr_dac_event()
588 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_hphr_dac_event()
592 snd_soc_component_write_field(component, in wcd939x_codec_hphr_dac_event()
596 snd_soc_component_write_field(component, WCD939X_HPH_R_EN, in wcd939x_codec_hphr_dac_event()
601 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_codec_hphr_dac_event()
603 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphr_dac_event()
615 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_ear_dac_event() local
616 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_ear_dac_event()
620 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_EAR_GAIN_CTL, in wcd939x_codec_ear_dac_event()
623 snd_soc_component_write_field(component, WCD939X_EAR_DAC_CON, in wcd939x_codec_ear_dac_event()
631 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_ear_dac_event()
635 snd_soc_component_write_field(component, WCD939X_EAR_DAC_CON, in wcd939x_codec_ear_dac_event()
647 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_hphr_pa() local
648 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_hphr_pa()
654 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphr_pa()
662 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphr_pa()
666 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
669 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_enable_hphr_pa()
671 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
674 if (snd_soc_component_read_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
679 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL1, in wcd939x_codec_enable_hphr_pa()
696 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphr_pa()
702 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_enable_hphr_pa()
706 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_hphr_pa()
724 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
747 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
749 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL1, in wcd939x_codec_enable_hphr_pa()
755 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphr_pa()
767 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_hphl_pa() local
768 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_hphl_pa()
771 dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__, in wcd939x_codec_enable_hphl_pa()
777 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphl_pa()
784 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphl_pa()
789 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
792 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_enable_hphl_pa()
794 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
797 if (snd_soc_component_read_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
802 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_hphl_pa()
818 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphl_pa()
824 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_enable_hphl_pa()
828 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_hphl_pa()
845 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
866 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
868 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_hphl_pa()
873 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphl_pa()
884 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_ear_pa() local
885 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_ear_pa()
890 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_ear_pa()
893 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_ear_pa()
895 snd_soc_component_write_field(component, WCD939X_ANA_EAR_COMPANDER_CTL, in wcd939x_codec_enable_ear_pa()
907 snd_soc_component_write_field(component, WCD939X_ANA_EAR_COMPANDER_CTL, in wcd939x_codec_enable_ear_pa()
912 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_ear_pa()
928 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_dmic() local
968 dev_err(component->dev, "%s: Invalid DMIC Selection\n", __func__); in wcd939x_codec_enable_dmic()
974 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_AMIC_CTL, in wcd939x_codec_enable_dmic()
979 snd_soc_component_write_field(component, in wcd939x_codec_enable_dmic()
984 snd_soc_component_write_field(component, dmic_clk_reg, in wcd939x_codec_enable_dmic()
986 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd939x_codec_enable_dmic()
989 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_codec_enable_dmic()
991 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_codec_enable_dmic()
995 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_AMIC_CTL, in wcd939x_codec_enable_dmic()
998 snd_soc_component_write_field(component, in wcd939x_codec_enable_dmic()
1002 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd939x_codec_enable_dmic()
1012 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_tx_swr_ctrl() local
1013 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_swr_ctrl()
1037 wcd939x_set_swr_clk_rate(component, rate, bank); in wcd939x_tx_swr_ctrl()
1038 wcd939x_set_swr_clk_rate(component, rate, !bank); in wcd939x_tx_swr_ctrl()
1044 wcd939x_set_swr_clk_rate(component, rate, !bank); in wcd939x_tx_swr_ctrl()
1045 wcd939x_set_swr_clk_rate(component, rate, bank); in wcd939x_tx_swr_ctrl()
1089 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_adc() local
1090 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_adc()
1094 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1096 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1102 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1105 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1115 static void wcd939x_tx_channel_config(struct snd_soc_component *component, in wcd939x_tx_channel_config() argument
1141 snd_soc_component_write_field(component, reg, mask, init); in wcd939x_tx_channel_config()
1147 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_adc_enable_req() local
1148 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_adc_enable_req()
1153 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_REQ_CTL, in wcd939x_adc_enable_req()
1155 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_REQ_CTL, in wcd939x_adc_enable_req()
1158 wcd939x_tx_channel_config(component, w->shift, true); in wcd939x_adc_enable_req()
1161 dev_info(component->dev, "Invalid ADC mode\n"); in wcd939x_adc_enable_req()
1167 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1171 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1177 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1181 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1187 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1191 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1197 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1201 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1210 wcd939x_tx_channel_config(component, w->shift, false); in wcd939x_adc_enable_req()
1215 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1219 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1225 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1229 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1235 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1239 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1245 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1249 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1263 static int wcd939x_micbias_control(struct snd_soc_component *component, in wcd939x_micbias_control() argument
1266 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_micbias_control()
1284 dev_err(component->dev, "%s: Invalid micbias number: %d\n", in wcd939x_micbias_control()
1294 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1303 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1310 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1313 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1316 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1319 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1322 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1326 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1330 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1333 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1336 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1339 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1342 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1359 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1368 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1388 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_micbias() local
1393 wcd939x_micbias_control(component, micb_num, MICB_ENABLE, true); in wcd939x_codec_enable_micbias()
1400 wcd939x_micbias_control(component, micb_num, MICB_DISABLE, true); in wcd939x_codec_enable_micbias()
1411 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_micbias_pullup() local
1416 wcd939x_micbias_control(component, micb_num, in wcd939x_codec_enable_micbias_pullup()
1424 wcd939x_micbias_control(component, micb_num, in wcd939x_codec_enable_micbias_pullup()
1435 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_tx_mode_get() local
1436 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_mode_get()
1448 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_tx_mode_put() local
1449 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_mode_put()
1466 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_rx_hph_mode_get() local
1467 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_rx_hph_mode_get()
1477 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_rx_hph_mode_put() local
1478 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_rx_hph_mode_put()
1514 dev_dbg(component->dev, "%s: Invalid HPH Mode\n", __func__); in wcd939x_rx_hph_mode_put()
1522 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_get_compander() local
1523 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_get_compander()
1537 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_set_compander() local
1538 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_set_compander()
1559 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_ldoh_get() local
1560 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_ldoh_get()
1570 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_ldoh_put() local
1571 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_ldoh_put()
1832 static void wcd939x_mbhc_clk_setup(struct snd_soc_component *component, in wcd939x_mbhc_clk_setup() argument
1835 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_1, in wcd939x_mbhc_clk_setup()
1839 static void wcd939x_mbhc_mbhc_bias_control(struct snd_soc_component *component, in wcd939x_mbhc_mbhc_bias_control() argument
1842 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_mbhc_mbhc_bias_control()
1846 static void wcd939x_mbhc_program_btn_thr(struct snd_soc_component *component, in wcd939x_mbhc_program_btn_thr() argument
1853 dev_err(component->dev, "%s: invalid number of buttons: %d\n", in wcd939x_mbhc_program_btn_thr()
1860 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_BTN0 + i, in wcd939x_mbhc_program_btn_thr()
1862 dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n", in wcd939x_mbhc_program_btn_thr()
1867 static bool wcd939x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num) in wcd939x_mbhc_micb_en_status() argument
1873 snd_soc_component_read(component, WCD939X_ANA_MICB2)); in wcd939x_mbhc_micb_en_status()
1881 static void wcd939x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component, in wcd939x_mbhc_hph_l_pull_up_control() argument
1890 dev_dbg(component->dev, "%s: HS pull up current:%d\n", in wcd939x_mbhc_hph_l_pull_up_control()
1893 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_INT_MECH_DET_CURRENT, in wcd939x_mbhc_hph_l_pull_up_control()
1897 static int wcd939x_mbhc_request_micbias(struct snd_soc_component *component, in wcd939x_mbhc_request_micbias() argument
1900 return wcd939x_micbias_control(component, micb_num, req, false); in wcd939x_mbhc_request_micbias()
1903 static void wcd939x_mbhc_micb_ramp_control(struct snd_soc_component *component, in wcd939x_mbhc_micb_ramp_control() argument
1907 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1909 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1912 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1914 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1930 static int wcd939x_mbhc_micb_adjust_voltage(struct snd_soc_component *component, in wcd939x_mbhc_micb_adjust_voltage() argument
1933 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_micb_adjust_voltage()
1964 micb_en = snd_soc_component_read_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1966 cur_vout_ctl = snd_soc_component_read_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1980 dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n", in wcd939x_mbhc_micb_adjust_voltage()
1985 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1989 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1993 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
2008 static int wcd939x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component, in wcd939x_mbhc_micb_ctrl_threshold_mic() argument
2011 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_micb_ctrl_threshold_mic()
2026 return wcd939x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); in wcd939x_mbhc_micb_ctrl_threshold_mic()
2048 static void wcd939x_mbhc_get_result_params(struct snd_soc_component *component, in wcd939x_mbhc_get_result_params() argument
2057 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_get_result_params()
2060 val = snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_2, in wcd939x_mbhc_get_result_params()
2066 val |= snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_1, in wcd939x_mbhc_get_result_params()
2068 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_get_result_params()
2078 dev_dbg(component->dev, in wcd939x_mbhc_get_result_params()
2091 dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d(milliOhm)\n", in wcd939x_mbhc_get_result_params()
2096 val = snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_1, in wcd939x_mbhc_get_result_params()
2098 val |= snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_2, in wcd939x_mbhc_get_result_params()
2107 static void wcd939x_mbhc_zdet_ramp(struct snd_soc_component *component, in wcd939x_mbhc_zdet_ramp() argument
2113 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, in wcd939x_mbhc_zdet_ramp()
2115 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN5, WCD939X_MBHC_BTN5_VTH, in wcd939x_mbhc_zdet_ramp()
2117 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN6, WCD939X_MBHC_BTN6_VTH, in wcd939x_mbhc_zdet_ramp()
2119 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN7, WCD939X_MBHC_BTN7_VTH, in wcd939x_mbhc_zdet_ramp()
2121 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, in wcd939x_mbhc_zdet_ramp()
2123 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_RAMP_CTL, in wcd939x_mbhc_zdet_ramp()
2125 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_RAMP_CTL, in wcd939x_mbhc_zdet_ramp()
2132 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2134 dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", in wcd939x_mbhc_zdet_ramp()
2136 wcd939x_mbhc_get_result_params(component, &zdet); in wcd939x_mbhc_zdet_ramp()
2137 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2147 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2149 dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", in wcd939x_mbhc_zdet_ramp()
2151 wcd939x_mbhc_get_result_params(component, &zdet); in wcd939x_mbhc_zdet_ramp()
2152 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2158 static void wcd939x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, in wcd939x_wcd_mbhc_qfuse_cal() argument
2164 q1 = snd_soc_component_read(component, WCD939X_DIGITAL_EFUSE_REG_21 + flag_l_r); in wcd939x_wcd_mbhc_qfuse_cal()
2174 static void wcd939x_wcd_mbhc_calc_impedance(struct snd_soc_component *component, in wcd939x_wcd_mbhc_calc_impedance() argument
2177 struct wcd939x_priv *wcd939x = dev_get_drvdata(component->dev); in wcd939x_wcd_mbhc_calc_impedance()
2183 reg0 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN5); in wcd939x_wcd_mbhc_calc_impedance()
2184 reg1 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN6); in wcd939x_wcd_mbhc_calc_impedance()
2185 reg2 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN7); in wcd939x_wcd_mbhc_calc_impedance()
2186 reg3 = snd_soc_component_read(component, WCD939X_MBHC_CTL_CLK); in wcd939x_wcd_mbhc_calc_impedance()
2187 reg4 = snd_soc_component_read(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL); in wcd939x_wcd_mbhc_calc_impedance()
2189 if (snd_soc_component_read_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2191 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2198 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2202 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2210 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2212 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2219 wcd939x_mbhc_zdet_ramp(component, &z1l, NULL); in wcd939x_wcd_mbhc_calc_impedance()
2224 wcd939x_wcd_mbhc_qfuse_cal(component, zl, 0); in wcd939x_wcd_mbhc_calc_impedance()
2226 dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n", in wcd939x_wcd_mbhc_calc_impedance()
2230 wcd939x_mbhc_zdet_ramp(component, NULL, &z1r); in wcd939x_wcd_mbhc_calc_impedance()
2235 wcd939x_wcd_mbhc_qfuse_cal(component, zr, 1); in wcd939x_wcd_mbhc_calc_impedance()
2237 dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n", in wcd939x_wcd_mbhc_calc_impedance()
2243 dev_dbg(component->dev, in wcd939x_wcd_mbhc_calc_impedance()
2253 dev_dbg(component->dev, in wcd939x_wcd_mbhc_calc_impedance()
2260 snd_soc_component_write_field(component, WCD939X_HPH_R_ATEST, in wcd939x_wcd_mbhc_calc_impedance()
2262 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_wcd_mbhc_calc_impedance()
2264 wcd939x_mbhc_zdet_ramp(component, &z1ls, NULL); in wcd939x_wcd_mbhc_calc_impedance()
2265 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_wcd_mbhc_calc_impedance()
2267 snd_soc_component_write_field(component, WCD939X_HPH_R_ATEST, in wcd939x_wcd_mbhc_calc_impedance()
2271 wcd939x_wcd_mbhc_qfuse_cal(component, &z1ls, 0); in wcd939x_wcd_mbhc_calc_impedance()
2278 dev_dbg(component->dev, "%s: stereo plug type detected\n", in wcd939x_wcd_mbhc_calc_impedance()
2282 dev_dbg(component->dev, "%s: MONO plug type detected\n", in wcd939x_wcd_mbhc_calc_impedance()
2288 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2290 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2294 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN5, reg0); in wcd939x_wcd_mbhc_calc_impedance()
2295 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN6, reg1); in wcd939x_wcd_mbhc_calc_impedance()
2296 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN7, reg2); in wcd939x_wcd_mbhc_calc_impedance()
2299 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2304 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2307 snd_soc_component_write(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, reg4); in wcd939x_wcd_mbhc_calc_impedance()
2308 snd_soc_component_write(component, WCD939X_MBHC_CTL_CLK, reg3); in wcd939x_wcd_mbhc_calc_impedance()
2311 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2315 static void wcd939x_mbhc_gnd_det_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_gnd_det_ctrl() argument
2319 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2322 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2325 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2327 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2333 static void wcd939x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_hph_pull_down_ctrl() argument
2336 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_mbhc_hph_pull_down_ctrl()
2338 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_mbhc_hph_pull_down_ctrl()
2342 static void wcd939x_mbhc_moisture_config(struct snd_soc_component *component) in wcd939x_mbhc_moisture_config() argument
2344 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_moisture_config()
2347 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2354 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd939x_mbhc_moisture_config()
2356 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2361 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2365 static void wcd939x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable) in wcd939x_mbhc_moisture_detect_en() argument
2367 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_moisture_detect_en()
2370 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_detect_en()
2374 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_detect_en()
2378 static bool wcd939x_mbhc_get_moisture_status(struct snd_soc_component *component) in wcd939x_mbhc_get_moisture_status() argument
2380 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_get_moisture_status()
2384 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2391 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd939x_mbhc_get_moisture_status()
2393 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2402 if (snd_soc_component_read_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2406 wcd939x_mbhc_moisture_detect_en(component, true); in wcd939x_mbhc_get_moisture_status()
2409 ret = !snd_soc_component_read_field(component, WCD939X_MBHC_NEW_FSM_STATUS, in wcd939x_mbhc_get_moisture_status()
2415 static void wcd939x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_moisture_polling_ctrl() argument
2418 snd_soc_component_write_field(component, in wcd939x_mbhc_moisture_polling_ctrl()
2445 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_get_hph_type() local
2446 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_get_hph_type()
2457 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_hph_impedance_get() local
2458 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_hph_impedance_get()
2463 dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr); in wcd939x_hph_impedance_get()
2481 static int wcd939x_mbhc_init(struct snd_soc_component *component) in wcd939x_mbhc_init() argument
2483 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_init()
2501 wcd939x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd939x_mbhc_init()
2505 snd_soc_add_component_controls(component, impedance_detect_controls, in wcd939x_mbhc_init()
2507 snd_soc_add_component_controls(component, hph_type_detect_controls, in wcd939x_mbhc_init()
2513 static void wcd939x_mbhc_deinit(struct snd_soc_component *component) in wcd939x_mbhc_deinit() argument
2515 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_deinit()
2990 static int wcd939x_soc_codec_probe(struct snd_soc_component *component) in wcd939x_soc_codec_probe() argument
2992 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_soc_codec_probe()
2994 struct device *dev = component->dev; in wcd939x_soc_codec_probe()
3005 snd_soc_component_init_regmap(component, wcd939x->regmap); in wcd939x_soc_codec_probe()
3011 wcd939x->variant = snd_soc_component_read_field(component, in wcd939x_soc_codec_probe()
3015 wcd939x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD939X); in wcd939x_soc_codec_probe()
3021 wcd939x_io_init(component); in wcd939x_soc_codec_probe()
3069 ret = snd_soc_add_component_controls(component, wcd9390_snd_controls, in wcd939x_soc_codec_probe()
3072 dev_err(component->dev, in wcd939x_soc_codec_probe()
3079 ret = snd_soc_add_component_controls(component, wcd9395_snd_controls, in wcd939x_soc_codec_probe()
3082 dev_err(component->dev, in wcd939x_soc_codec_probe()
3092 ret = wcd939x_mbhc_init(component); in wcd939x_soc_codec_probe()
3094 dev_err(component->dev, "mbhc initialization failed\n"); in wcd939x_soc_codec_probe()
3112 static void wcd939x_soc_codec_remove(struct snd_soc_component *component) in wcd939x_soc_codec_remove() argument
3114 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_soc_codec_remove()
3116 wcd939x_mbhc_deinit(component); in wcd939x_soc_codec_remove()
3218 static bool wcd939x_swap_gnd_mic(struct snd_soc_component *component, bool active) in wcd939x_swap_gnd_mic() argument
3220 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_swap_gnd_mic()