Lines Matching refs:component

179 	struct snd_soc_component *component;  member
334 static int wcd939x_set_swr_clk_rate(struct snd_soc_component *component, int rate, int bank) in wcd939x_set_swr_clk_rate() argument
358 snd_soc_component_write_field(component, WCD939X_DIGITAL_SWR_TX_CLK_RATE, mask, val); in wcd939x_set_swr_clk_rate()
363 static int wcd939x_io_init(struct snd_soc_component *component) in wcd939x_io_init() argument
365 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
367 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
372 snd_soc_component_write_field(component, WCD939X_ANA_BIAS, in wcd939x_io_init()
375 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_io_init()
377 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_io_init()
379 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_io_init()
382 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_STG2CASC_ULP, in wcd939x_io_init()
387 snd_soc_component_write_field(component, WCD939X_TX_COM_NEW_INT_FE_ICTRL_STG2MAIN_ULP, in wcd939x_io_init()
390 snd_soc_component_write_field(component, WCD939X_MICB1_TEST_CTL_1, in wcd939x_io_init()
392 snd_soc_component_write_field(component, WCD939X_MICB2_TEST_CTL_1, in wcd939x_io_init()
394 snd_soc_component_write_field(component, WCD939X_MICB3_TEST_CTL_1, in wcd939x_io_init()
396 snd_soc_component_write_field(component, WCD939X_MICB4_TEST_CTL_1, in wcd939x_io_init()
398 snd_soc_component_write_field(component, WCD939X_TX_3_4_TEST_BLK_EN2, in wcd939x_io_init()
401 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_io_init()
403 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_io_init()
406 snd_soc_component_write_field(component, WCD939X_HPH_OCP_CTL, in wcd939x_io_init()
408 snd_soc_component_write_field(component, WCD939X_HPH_OCP_CTL, in wcd939x_io_init()
411 snd_soc_component_write(component, WCD939X_E_CFG0, in wcd939x_io_init()
448 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_rxclk() local
452 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
456 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()
461 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
466 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
468 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
470 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
474 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
476 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
479 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DIG_CLK_CTL, in wcd939x_codec_enable_rxclk()
481 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_DIG_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_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_rxclk()
495 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_rxclk()
508 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_hphl_dac_event() local
509 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_hphl_dac_event()
513 snd_soc_component_write_field(component, WCD939X_HPH_RDAC_CLK_CTL1, in wcd939x_codec_hphl_dac_event()
517 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphl_dac_event()
521 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_codec_hphl_dac_event()
524 snd_soc_component_write_field(component, in wcd939x_codec_hphl_dac_event()
530 snd_soc_component_read_field(component, in wcd939x_codec_hphl_dac_event()
535 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_hphl_dac_event()
539 snd_soc_component_write_field(component, in wcd939x_codec_hphl_dac_event()
543 snd_soc_component_write_field(component, WCD939X_HPH_L_EN, in wcd939x_codec_hphl_dac_event()
548 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_L, in wcd939x_codec_hphl_dac_event()
550 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphl_dac_event()
562 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_hphr_dac_event() local
563 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_hphr_dac_event()
565 dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__, in wcd939x_codec_hphr_dac_event()
570 snd_soc_component_write_field(component, WCD939X_HPH_RDAC_CLK_CTL1, in wcd939x_codec_hphr_dac_event()
574 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphr_dac_event()
578 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_codec_hphr_dac_event()
581 snd_soc_component_write_field(component, in wcd939x_codec_hphr_dac_event()
587 snd_soc_component_read_field(component, in wcd939x_codec_hphr_dac_event()
591 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_hphr_dac_event()
595 snd_soc_component_write_field(component, in wcd939x_codec_hphr_dac_event()
599 snd_soc_component_write_field(component, WCD939X_HPH_R_EN, in wcd939x_codec_hphr_dac_event()
604 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_RDAC_HD2_CTL_R, in wcd939x_codec_hphr_dac_event()
606 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_HPH_GAIN_CTL, in wcd939x_codec_hphr_dac_event()
618 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_ear_dac_event() local
619 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_ear_dac_event()
623 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_EAR_GAIN_CTL, in wcd939x_codec_ear_dac_event()
626 snd_soc_component_write_field(component, WCD939X_EAR_DAC_CON, in wcd939x_codec_ear_dac_event()
634 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_ear_dac_event()
638 snd_soc_component_write_field(component, WCD939X_EAR_DAC_CON, in wcd939x_codec_ear_dac_event()
650 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_hphr_pa() local
651 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_hphr_pa()
657 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphr_pa()
665 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphr_pa()
669 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
672 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_enable_hphr_pa()
674 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
677 if (snd_soc_component_read_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
682 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL1, in wcd939x_codec_enable_hphr_pa()
699 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphr_pa()
705 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_enable_hphr_pa()
709 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_hphr_pa()
727 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
750 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphr_pa()
752 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL1, in wcd939x_codec_enable_hphr_pa()
758 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphr_pa()
770 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_hphl_pa() local
771 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_hphl_pa()
774 dev_dbg(component->dev, "%s wname: %s event: %d\n", __func__, in wcd939x_codec_enable_hphl_pa()
780 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphl_pa()
787 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphl_pa()
792 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
795 snd_soc_component_write_field(component, WCD939X_FLYBACK_VNEG_CTRL_4, in wcd939x_codec_enable_hphl_pa()
797 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
800 if (snd_soc_component_read_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
805 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_hphl_pa()
821 snd_soc_component_write_field(component, in wcd939x_codec_enable_hphl_pa()
827 snd_soc_component_write_field(component, WCD939X_HPH_NEW_INT_TIMER1, in wcd939x_codec_enable_hphl_pa()
831 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_hphl_pa()
848 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
869 snd_soc_component_write_field(component, WCD939X_ANA_HPH, in wcd939x_codec_enable_hphl_pa()
871 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_hphl_pa()
876 snd_soc_component_write_field(component, WCD939X_LDOH_MODE, in wcd939x_codec_enable_hphl_pa()
887 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_ear_pa() local
888 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_ear_pa()
893 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_ear_pa()
896 snd_soc_component_write_field(component, WCD939X_ANA_RX_SUPPLIES, in wcd939x_codec_enable_ear_pa()
898 snd_soc_component_write_field(component, WCD939X_ANA_EAR_COMPANDER_CTL, in wcd939x_codec_enable_ear_pa()
910 snd_soc_component_write_field(component, WCD939X_ANA_EAR_COMPANDER_CTL, in wcd939x_codec_enable_ear_pa()
915 snd_soc_component_write_field(component, WCD939X_DIGITAL_PDM_WD_CTL0, in wcd939x_codec_enable_ear_pa()
931 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_dmic() local
971 dev_err(component->dev, "%s: Invalid DMIC Selection\n", __func__); in wcd939x_codec_enable_dmic()
977 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_AMIC_CTL, in wcd939x_codec_enable_dmic()
982 snd_soc_component_write_field(component, in wcd939x_codec_enable_dmic()
987 snd_soc_component_write_field(component, dmic_clk_reg, in wcd939x_codec_enable_dmic()
989 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd939x_codec_enable_dmic()
992 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_codec_enable_dmic()
994 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_DMIC_CTL, in wcd939x_codec_enable_dmic()
998 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_AMIC_CTL, in wcd939x_codec_enable_dmic()
1001 snd_soc_component_write_field(component, in wcd939x_codec_enable_dmic()
1005 snd_soc_component_write_field(component, dmic_clk_en_reg, in wcd939x_codec_enable_dmic()
1015 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_tx_swr_ctrl() local
1016 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_swr_ctrl()
1040 wcd939x_set_swr_clk_rate(component, rate, bank); in wcd939x_tx_swr_ctrl()
1041 wcd939x_set_swr_clk_rate(component, rate, !bank); in wcd939x_tx_swr_ctrl()
1047 wcd939x_set_swr_clk_rate(component, rate, !bank); in wcd939x_tx_swr_ctrl()
1048 wcd939x_set_swr_clk_rate(component, rate, bank); in wcd939x_tx_swr_ctrl()
1092 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_adc() local
1093 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_codec_enable_adc()
1097 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1099 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()
1108 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_ANA_CLK_CTL, in wcd939x_codec_enable_adc()
1118 static void wcd939x_tx_channel_config(struct snd_soc_component *component, in wcd939x_tx_channel_config() argument
1144 snd_soc_component_write_field(component, reg, mask, init); in wcd939x_tx_channel_config()
1150 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_adc_enable_req() local
1151 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_adc_enable_req()
1156 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_REQ_CTL, in wcd939x_adc_enable_req()
1158 snd_soc_component_write_field(component, WCD939X_DIGITAL_CDC_REQ_CTL, in wcd939x_adc_enable_req()
1161 wcd939x_tx_channel_config(component, w->shift, true); in wcd939x_adc_enable_req()
1164 dev_info(component->dev, "Invalid ADC mode\n"); in wcd939x_adc_enable_req()
1170 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1174 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1180 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1184 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1190 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1194 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1200 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1204 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1213 wcd939x_tx_channel_config(component, w->shift, false); in wcd939x_adc_enable_req()
1218 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1222 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1228 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1232 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1238 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1242 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1248 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1252 snd_soc_component_write_field(component, in wcd939x_adc_enable_req()
1266 static int wcd939x_micbias_control(struct snd_soc_component *component, in wcd939x_micbias_control() argument
1269 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_micbias_control()
1287 dev_err(component->dev, "%s: Invalid micbias number: %d\n", in wcd939x_micbias_control()
1297 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1306 snd_soc_component_write_field(component, micb_reg, 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()
1325 snd_soc_component_write_field(component, in wcd939x_micbias_control()
1329 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, in wcd939x_micbias_control()
1345 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1362 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1371 snd_soc_component_write_field(component, micb_reg, in wcd939x_micbias_control()
1391 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_micbias() local
1396 wcd939x_micbias_control(component, micb_num, MICB_ENABLE, true); in wcd939x_codec_enable_micbias()
1403 wcd939x_micbias_control(component, micb_num, MICB_DISABLE, true); in wcd939x_codec_enable_micbias()
1414 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wcd939x_codec_enable_micbias_pullup() local
1419 wcd939x_micbias_control(component, micb_num, in wcd939x_codec_enable_micbias_pullup()
1427 wcd939x_micbias_control(component, micb_num, in wcd939x_codec_enable_micbias_pullup()
1438 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_tx_mode_get() local
1439 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_mode_get()
1451 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_tx_mode_put() local
1452 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_tx_mode_put()
1469 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_rx_hph_mode_get() local
1470 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_rx_hph_mode_get()
1480 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_rx_hph_mode_put() local
1481 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_rx_hph_mode_put()
1517 dev_dbg(component->dev, "%s: Invalid HPH Mode\n", __func__); in wcd939x_rx_hph_mode_put()
1525 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_get_compander() local
1526 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_get_compander()
1540 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_set_compander() local
1541 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_set_compander()
1562 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_ldoh_get() local
1563 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_ldoh_get()
1573 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_ldoh_put() local
1574 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_ldoh_put()
1835 static void wcd939x_mbhc_clk_setup(struct snd_soc_component *component, in wcd939x_mbhc_clk_setup() argument
1838 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_1, in wcd939x_mbhc_clk_setup()
1842 static void wcd939x_mbhc_mbhc_bias_control(struct snd_soc_component *component, in wcd939x_mbhc_mbhc_bias_control() argument
1845 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_mbhc_mbhc_bias_control()
1849 static void wcd939x_mbhc_program_btn_thr(struct snd_soc_component *component, in wcd939x_mbhc_program_btn_thr() argument
1856 dev_err(component->dev, "%s: invalid number of buttons: %d\n", in wcd939x_mbhc_program_btn_thr()
1863 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_BTN0 + i, in wcd939x_mbhc_program_btn_thr()
1865 dev_dbg(component->dev, "%s: btn_high[%d]: %d, vth: %d\n", in wcd939x_mbhc_program_btn_thr()
1870 static bool wcd939x_mbhc_micb_en_status(struct snd_soc_component *component, int micb_num) in wcd939x_mbhc_micb_en_status() argument
1876 snd_soc_component_read(component, WCD939X_ANA_MICB2)); in wcd939x_mbhc_micb_en_status()
1884 static void wcd939x_mbhc_hph_l_pull_up_control(struct snd_soc_component *component, in wcd939x_mbhc_hph_l_pull_up_control() argument
1893 dev_dbg(component->dev, "%s: HS pull up current:%d\n", in wcd939x_mbhc_hph_l_pull_up_control()
1896 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_INT_MECH_DET_CURRENT, in wcd939x_mbhc_hph_l_pull_up_control()
1900 static int wcd939x_mbhc_request_micbias(struct snd_soc_component *component, in wcd939x_mbhc_request_micbias() argument
1903 return wcd939x_micbias_control(component, micb_num, req, false); in wcd939x_mbhc_request_micbias()
1906 static void wcd939x_mbhc_micb_ramp_control(struct snd_soc_component *component, in wcd939x_mbhc_micb_ramp_control() argument
1910 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()
1915 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1917 snd_soc_component_write_field(component, WCD939X_ANA_MICB2_RAMP, in wcd939x_mbhc_micb_ramp_control()
1933 static int wcd939x_mbhc_micb_adjust_voltage(struct snd_soc_component *component, in wcd939x_mbhc_micb_adjust_voltage() argument
1936 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_micb_adjust_voltage()
1967 micb_en = snd_soc_component_read_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1969 cur_vout_ctl = snd_soc_component_read_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1983 dev_dbg(component->dev, "%s: micb_num: %d, cur_mv: %d, req_mv: %d, micb_en: %d\n", in wcd939x_mbhc_micb_adjust_voltage()
1988 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1992 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
1996 snd_soc_component_write_field(component, micb_reg, in wcd939x_mbhc_micb_adjust_voltage()
2011 static int wcd939x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *component, in wcd939x_mbhc_micb_ctrl_threshold_mic() argument
2014 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_micb_ctrl_threshold_mic()
2029 return wcd939x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); in wcd939x_mbhc_micb_ctrl_threshold_mic()
2051 static void wcd939x_mbhc_get_result_params(struct snd_soc_component *component, in wcd939x_mbhc_get_result_params() argument
2060 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_get_result_params()
2063 val = snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_2, in wcd939x_mbhc_get_result_params()
2069 val |= snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_1, in wcd939x_mbhc_get_result_params()
2071 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_get_result_params()
2081 dev_dbg(component->dev, in wcd939x_mbhc_get_result_params()
2094 dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d(milliOhm)\n", in wcd939x_mbhc_get_result_params()
2099 val = snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_1, in wcd939x_mbhc_get_result_params()
2101 val |= snd_soc_component_read_field(component, WCD939X_ANA_MBHC_RESULT_2, in wcd939x_mbhc_get_result_params()
2110 static void wcd939x_mbhc_zdet_ramp(struct snd_soc_component *component, in wcd939x_mbhc_zdet_ramp() argument
2116 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, in wcd939x_mbhc_zdet_ramp()
2118 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN5, WCD939X_MBHC_BTN5_VTH, in wcd939x_mbhc_zdet_ramp()
2120 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN6, WCD939X_MBHC_BTN6_VTH, in wcd939x_mbhc_zdet_ramp()
2122 snd_soc_component_update_bits(component, WCD939X_ANA_MBHC_BTN7, WCD939X_MBHC_BTN7_VTH, in wcd939x_mbhc_zdet_ramp()
2124 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, in wcd939x_mbhc_zdet_ramp()
2126 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_RAMP_CTL, in wcd939x_mbhc_zdet_ramp()
2128 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_ZDET_RAMP_CTL, in wcd939x_mbhc_zdet_ramp()
2135 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2137 dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", in wcd939x_mbhc_zdet_ramp()
2139 wcd939x_mbhc_get_result_params(component, &zdet); in wcd939x_mbhc_zdet_ramp()
2140 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2150 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2152 dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", in wcd939x_mbhc_zdet_ramp()
2154 wcd939x_mbhc_get_result_params(component, &zdet); in wcd939x_mbhc_zdet_ramp()
2155 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ZDET, in wcd939x_mbhc_zdet_ramp()
2161 static void wcd939x_wcd_mbhc_qfuse_cal(struct snd_soc_component *component, in wcd939x_wcd_mbhc_qfuse_cal() argument
2167 q1 = snd_soc_component_read(component, WCD939X_DIGITAL_EFUSE_REG_21 + flag_l_r); in wcd939x_wcd_mbhc_qfuse_cal()
2177 static void wcd939x_wcd_mbhc_calc_impedance(struct snd_soc_component *component, in wcd939x_wcd_mbhc_calc_impedance() argument
2180 struct wcd939x_priv *wcd939x = dev_get_drvdata(component->dev); in wcd939x_wcd_mbhc_calc_impedance()
2186 reg0 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN5); in wcd939x_wcd_mbhc_calc_impedance()
2187 reg1 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN6); in wcd939x_wcd_mbhc_calc_impedance()
2188 reg2 = snd_soc_component_read(component, WCD939X_ANA_MBHC_BTN7); in wcd939x_wcd_mbhc_calc_impedance()
2189 reg3 = snd_soc_component_read(component, WCD939X_MBHC_CTL_CLK); in wcd939x_wcd_mbhc_calc_impedance()
2190 reg4 = snd_soc_component_read(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL); in wcd939x_wcd_mbhc_calc_impedance()
2192 if (snd_soc_component_read_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2194 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2201 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2205 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2213 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2215 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2222 wcd939x_mbhc_zdet_ramp(component, &z1l, NULL); in wcd939x_wcd_mbhc_calc_impedance()
2227 wcd939x_wcd_mbhc_qfuse_cal(component, zl, 0); in wcd939x_wcd_mbhc_calc_impedance()
2229 dev_dbg(component->dev, "%s: impedance on HPH_L = %d(ohms)\n", in wcd939x_wcd_mbhc_calc_impedance()
2233 wcd939x_mbhc_zdet_ramp(component, NULL, &z1r); in wcd939x_wcd_mbhc_calc_impedance()
2238 wcd939x_wcd_mbhc_qfuse_cal(component, zr, 1); in wcd939x_wcd_mbhc_calc_impedance()
2240 dev_dbg(component->dev, "%s: impedance on HPH_R = %d(ohms)\n", in wcd939x_wcd_mbhc_calc_impedance()
2246 dev_dbg(component->dev, in wcd939x_wcd_mbhc_calc_impedance()
2256 dev_dbg(component->dev, in wcd939x_wcd_mbhc_calc_impedance()
2263 snd_soc_component_write_field(component, WCD939X_HPH_R_ATEST, in wcd939x_wcd_mbhc_calc_impedance()
2265 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_wcd_mbhc_calc_impedance()
2267 wcd939x_mbhc_zdet_ramp(component, &z1ls, NULL); in wcd939x_wcd_mbhc_calc_impedance()
2268 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_wcd_mbhc_calc_impedance()
2270 snd_soc_component_write_field(component, WCD939X_HPH_R_ATEST, in wcd939x_wcd_mbhc_calc_impedance()
2274 wcd939x_wcd_mbhc_qfuse_cal(component, &z1ls, 0); in wcd939x_wcd_mbhc_calc_impedance()
2281 dev_dbg(component->dev, "%s: stereo plug type detected\n", in wcd939x_wcd_mbhc_calc_impedance()
2285 dev_dbg(component->dev, "%s: MONO plug type detected\n", in wcd939x_wcd_mbhc_calc_impedance()
2291 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2293 snd_soc_component_write_field(component, WCD939X_HPH_SURGE_EN, in wcd939x_wcd_mbhc_calc_impedance()
2297 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN5, reg0); in wcd939x_wcd_mbhc_calc_impedance()
2298 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN6, reg1); in wcd939x_wcd_mbhc_calc_impedance()
2299 snd_soc_component_write(component, WCD939X_ANA_MBHC_BTN7, reg2); in wcd939x_wcd_mbhc_calc_impedance()
2302 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2307 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_wcd_mbhc_calc_impedance()
2310 snd_soc_component_write(component, WCD939X_MBHC_NEW_ZDET_ANA_CTL, reg4); in wcd939x_wcd_mbhc_calc_impedance()
2311 snd_soc_component_write(component, WCD939X_MBHC_CTL_CLK, reg3); in wcd939x_wcd_mbhc_calc_impedance()
2314 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_ELECT, in wcd939x_wcd_mbhc_calc_impedance()
2318 static void wcd939x_mbhc_gnd_det_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_gnd_det_ctrl() argument
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()
2328 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2330 snd_soc_component_write_field(component, WCD939X_ANA_MBHC_MECH, in wcd939x_mbhc_gnd_det_ctrl()
2336 static void wcd939x_mbhc_hph_pull_down_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_hph_pull_down_ctrl() argument
2339 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_mbhc_hph_pull_down_ctrl()
2341 snd_soc_component_write_field(component, WCD939X_HPH_PA_CTL2, in wcd939x_mbhc_hph_pull_down_ctrl()
2345 static void wcd939x_mbhc_moisture_config(struct snd_soc_component *component) in wcd939x_mbhc_moisture_config() argument
2347 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_moisture_config()
2350 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2357 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd939x_mbhc_moisture_config()
2359 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2364 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_config()
2368 static void wcd939x_mbhc_moisture_detect_en(struct snd_soc_component *component, bool enable) in wcd939x_mbhc_moisture_detect_en() argument
2370 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_moisture_detect_en()
2373 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_detect_en()
2377 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_moisture_detect_en()
2381 static bool wcd939x_mbhc_get_moisture_status(struct snd_soc_component *component) in wcd939x_mbhc_get_moisture_status() argument
2383 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_get_moisture_status()
2387 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2394 dev_dbg(component->dev, "%s: disable moisture detection for NC\n", in wcd939x_mbhc_get_moisture_status()
2396 snd_soc_component_write_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2405 if (snd_soc_component_read_field(component, WCD939X_MBHC_NEW_CTL_2, in wcd939x_mbhc_get_moisture_status()
2409 wcd939x_mbhc_moisture_detect_en(component, true); in wcd939x_mbhc_get_moisture_status()
2412 ret = !snd_soc_component_read_field(component, WCD939X_MBHC_NEW_FSM_STATUS, in wcd939x_mbhc_get_moisture_status()
2418 static void wcd939x_mbhc_moisture_polling_ctrl(struct snd_soc_component *component, in wcd939x_mbhc_moisture_polling_ctrl() argument
2421 snd_soc_component_write_field(component, in wcd939x_mbhc_moisture_polling_ctrl()
2448 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_get_hph_type() local
2449 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_get_hph_type()
2460 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wcd939x_hph_impedance_get() local
2461 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_hph_impedance_get()
2466 dev_dbg(component->dev, "%s: zl=%u(ohms), zr=%u(ohms)\n", __func__, zl, zr); in wcd939x_hph_impedance_get()
2484 static int wcd939x_mbhc_init(struct snd_soc_component *component) in wcd939x_mbhc_init() argument
2486 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_init()
2504 wcd939x->wcd_mbhc = wcd_mbhc_init(component, &mbhc_cb, intr_ids, wcd_mbhc_fields, true); in wcd939x_mbhc_init()
2508 snd_soc_add_component_controls(component, impedance_detect_controls, in wcd939x_mbhc_init()
2510 snd_soc_add_component_controls(component, hph_type_detect_controls, in wcd939x_mbhc_init()
2516 static void wcd939x_mbhc_deinit(struct snd_soc_component *component) in wcd939x_mbhc_deinit() argument
2518 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_mbhc_deinit()
2993 static int wcd939x_soc_codec_probe(struct snd_soc_component *component) in wcd939x_soc_codec_probe() argument
2995 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_soc_codec_probe()
2997 struct device *dev = component->dev; in wcd939x_soc_codec_probe()
3008 snd_soc_component_init_regmap(component, wcd939x->regmap); in wcd939x_soc_codec_probe()
3014 wcd939x->variant = snd_soc_component_read_field(component, in wcd939x_soc_codec_probe()
3018 wcd939x->clsh_info = wcd_clsh_ctrl_alloc(component, WCD939X); in wcd939x_soc_codec_probe()
3024 wcd939x_io_init(component); in wcd939x_soc_codec_probe()
3072 ret = snd_soc_add_component_controls(component, wcd9390_snd_controls, in wcd939x_soc_codec_probe()
3075 dev_err(component->dev, in wcd939x_soc_codec_probe()
3082 ret = snd_soc_add_component_controls(component, wcd9395_snd_controls, in wcd939x_soc_codec_probe()
3085 dev_err(component->dev, in wcd939x_soc_codec_probe()
3095 ret = wcd939x_mbhc_init(component); in wcd939x_soc_codec_probe()
3097 dev_err(component->dev, "mbhc initialization failed\n"); in wcd939x_soc_codec_probe()
3115 static void wcd939x_soc_codec_remove(struct snd_soc_component *component) in wcd939x_soc_codec_remove() argument
3117 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_soc_codec_remove()
3119 wcd939x_mbhc_deinit(component); in wcd939x_soc_codec_remove()
3221 static bool wcd939x_swap_gnd_mic(struct snd_soc_component *component) in wcd939x_swap_gnd_mic() argument
3223 struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(component); in wcd939x_swap_gnd_mic()