Lines Matching +full:ain1 +full:- +full:ain2

1 // SPDX-License-Identifier: GPL-2.0
3 // mt6359.c -- mt6359 ALSA SoC audio codec driver
24 regmap_update_bits(priv->regmap, MT6359_SMT_CON1, 0x3ff0, 0x3ff0); in mt6359_set_gpio_smt()
30 regmap_update_bits(priv->regmap, MT6359_DRV_CON2, 0xffff, 0x8888); in mt6359_set_gpio_driving()
31 regmap_update_bits(priv->regmap, MT6359_DRV_CON3, 0xffff, 0x8888); in mt6359_set_gpio_driving()
32 regmap_update_bits(priv->regmap, MT6359_DRV_CON4, 0x00ff, 0x88); in mt6359_set_gpio_driving()
38 regmap_write(priv->regmap, MT6359_GPIO_MODE2_CLR, 0x0ffe); in mt6359_set_playback_gpio()
39 regmap_write(priv->regmap, MT6359_GPIO_MODE2_SET, 0x0249); in mt6359_set_playback_gpio()
42 regmap_write(priv->regmap, MT6359_GPIO_MODE3_CLR, 0x6); in mt6359_set_playback_gpio()
43 regmap_write(priv->regmap, MT6359_GPIO_MODE3_SET, 0x1); in mt6359_set_playback_gpio()
53 regmap_write(priv->regmap, MT6359_GPIO_MODE2_CLR, 0x0ff8); in mt6359_reset_playback_gpio()
54 regmap_update_bits(priv->regmap, MT6359_GPIO_DIR0, 0x7 << 9, 0x0); in mt6359_reset_playback_gpio()
60 regmap_write(priv->regmap, MT6359_GPIO_MODE3_CLR, 0x0e00); in mt6359_set_capture_gpio()
61 regmap_write(priv->regmap, MT6359_GPIO_MODE3_SET, 0x0200); in mt6359_set_capture_gpio()
63 regmap_write(priv->regmap, MT6359_GPIO_MODE4_CLR, 0x003f); in mt6359_set_capture_gpio()
64 regmap_write(priv->regmap, MT6359_GPIO_MODE4_SET, 0x0009); in mt6359_set_capture_gpio()
75 regmap_write(priv->regmap, MT6359_GPIO_MODE3_CLR, 0x0e00); in mt6359_reset_capture_gpio()
77 regmap_write(priv->regmap, MT6359_GPIO_MODE4_CLR, 0x003f); in mt6359_reset_capture_gpio()
79 regmap_update_bits(priv->regmap, MT6359_GPIO_DIR0, in mt6359_reset_capture_gpio()
81 regmap_update_bits(priv->regmap, MT6359_GPIO_DIR1, in mt6359_reset_capture_gpio()
88 regmap_update_bits(priv->regmap, MT6359_DCXO_CW12, in mt6359_set_dcxo()
97 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON23, in mt6359_set_clksq()
105 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON13, in mt6359_set_aud_global_bias()
113 regmap_update_bits(priv->regmap, MT6359_AUD_TOP_CKPDN_CON0, in mt6359_set_topck()
119 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON13, in mt6359_set_decoder_clk()
126 switch (priv->mtkaif_protocol) { in mt6359_mtkaif_tx_enable()
129 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
133 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
136 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
142 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
146 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
153 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
157 regmap_update_bits(priv->regmap, in mt6359_mtkaif_tx_enable()
167 regmap_update_bits(priv->regmap, MT6359_AFE_AUD_PAD_TOP, in mt6359_mtkaif_tx_disable()
176 priv->mtkaif_protocol = mtkaif_protocol; in mt6359_set_mtkaif_protocol()
194 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_mtkaif_calibration_enable()
197 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_mtkaif_calibration_enable()
200 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG1, in mt6359_mtkaif_calibration_enable()
211 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_mtkaif_calibration_disable()
214 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_mtkaif_calibration_disable()
217 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG1, in mt6359_mtkaif_calibration_disable()
237 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_set_mtkaif_calibration_phase()
240 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG, in mt6359_set_mtkaif_calibration_phase()
243 regmap_update_bits(priv->regmap, MT6359_AUDIO_DIG_CFG1, in mt6359_set_mtkaif_calibration_phase()
251 regmap_write(priv->regmap, MT6359_ZCD_CON0, 0x0000); in zcd_disable()
261 stage = up ? i : target - i; in hp_main_output_ramp()
262 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, in hp_main_output_ramp()
265 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, in hp_main_output_ramp()
279 stage = up ? i : target - i; in hp_aux_feedback_loop_gain_ramp()
280 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON9, in hp_aux_feedback_loop_gain_ramp()
291 /* Set input diff pair bias select (Hi-Fi mode) */ in hp_in_pair_current()
292 if (priv->hp_hifi_mode) { in hp_in_pair_current()
295 stage = increase ? i : target - i; in hp_in_pair_current()
296 regmap_update_bits(priv->regmap, in hp_in_pair_current()
310 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON2, in hp_pull_down()
316 for (i = 0x7; i >= 0x0; i--) { in hp_pull_down()
317 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON2, in hp_pull_down()
337 dev_warn(priv->dev, "%s(), volume index is not valid, from %d, to %d\n", in headset_volume_ramp()
342 dev_dbg(priv->dev, "%s(), from %d, to %d\n", __func__, from, to); in headset_volume_ramp()
345 offset = to - from; in headset_volume_ramp()
347 offset = from - to; in headset_volume_ramp()
353 reg_idx = from - count; in headset_volume_ramp()
356 regmap_update_bits(priv->regmap, in headset_volume_ramp()
362 offset--; in headset_volume_ramp()
374 (struct soc_mixer_control *)kcontrol->private_value; in mt6359_put_volsw()
376 int index = ucontrol->value.integer.value[0]; in mt6359_put_volsw()
380 switch (mc->reg) { in mt6359_put_volsw()
382 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL]; in mt6359_put_volsw()
383 orig_gain[1] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTR]; in mt6359_put_volsw()
386 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTL]; in mt6359_put_volsw()
387 orig_gain[1] = priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTR]; in mt6359_put_volsw()
390 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HSOUTL]; in mt6359_put_volsw()
393 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP1]; in mt6359_put_volsw()
396 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP2]; in mt6359_put_volsw()
399 orig_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP3]; in mt6359_put_volsw()
402 return -EINVAL; in mt6359_put_volsw()
409 switch (mc->reg) { in mt6359_put_volsw()
411 regmap_read(priv->regmap, MT6359_ZCD_CON2, &reg); in mt6359_put_volsw()
412 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL] = in mt6359_put_volsw()
414 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTR] = in mt6359_put_volsw()
416 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL]; in mt6359_put_volsw()
417 new_gain[1] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTR]; in mt6359_put_volsw()
420 regmap_read(priv->regmap, MT6359_ZCD_CON1, &reg); in mt6359_put_volsw()
421 priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTL] = in mt6359_put_volsw()
423 priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTR] = in mt6359_put_volsw()
425 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTL]; in mt6359_put_volsw()
426 new_gain[1] = priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTR]; in mt6359_put_volsw()
429 regmap_read(priv->regmap, MT6359_ZCD_CON3, &reg); in mt6359_put_volsw()
430 priv->ana_gain[AUDIO_ANALOG_VOLUME_HSOUTL] = in mt6359_put_volsw()
432 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_HSOUTL]; in mt6359_put_volsw()
435 regmap_read(priv->regmap, MT6359_AUDENC_ANA_CON0, &reg); in mt6359_put_volsw()
436 priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP1] = in mt6359_put_volsw()
438 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP1]; in mt6359_put_volsw()
441 regmap_read(priv->regmap, MT6359_AUDENC_ANA_CON1, &reg); in mt6359_put_volsw()
442 priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP2] = in mt6359_put_volsw()
444 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP2]; in mt6359_put_volsw()
447 regmap_read(priv->regmap, MT6359_AUDENC_ANA_CON2, &reg); in mt6359_put_volsw()
448 priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP3] = in mt6359_put_volsw()
450 new_gain[0] = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP3]; in mt6359_put_volsw()
462 dev_dbg(priv->dev, "%s(), name %s, reg(0x%x) = 0x%x, set index = %x\n", in mt6359_put_volsw()
463 __func__, kcontrol->id.name, mc->reg, reg, index); in mt6359_put_volsw()
475 (struct soc_mixer_control *)kcontrol->private_value; in mt6359_get_playback_volsw()
477 switch (mc->reg) { in mt6359_get_playback_volsw()
479 ucontrol->value.integer.value[0] = in mt6359_get_playback_volsw()
480 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL]; in mt6359_get_playback_volsw()
481 ucontrol->value.integer.value[1] = in mt6359_get_playback_volsw()
482 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTR]; in mt6359_get_playback_volsw()
485 ucontrol->value.integer.value[0] = in mt6359_get_playback_volsw()
486 priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTL]; in mt6359_get_playback_volsw()
487 ucontrol->value.integer.value[1] = in mt6359_get_playback_volsw()
488 priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTR]; in mt6359_get_playback_volsw()
491 ucontrol->value.integer.value[0] = in mt6359_get_playback_volsw()
492 priv->ana_gain[AUDIO_ANALOG_VOLUME_HSOUTL]; in mt6359_get_playback_volsw()
495 return -EINVAL; in mt6359_get_playback_volsw()
756 "None", "AIN0", "AIN1"
776 "None", "AIN2", "AIN3", "AIN0"
797 "None", "AIN3", "AIN2"
820 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_sgen_event()
823 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_sgen_event()
828 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON2, 0x0006); in mt_sgen_event()
830 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON0, 0xcba1); in mt_sgen_event()
832 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON2, 0x0003); in mt_sgen_event()
834 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON2, 0x000b); in mt_sgen_event()
836 regmap_update_bits(priv->regmap, MT6359_AFE_SGEN_CFG0, in mt_sgen_event()
839 regmap_update_bits(priv->regmap, MT6359_AFE_SGEN_CFG1, in mt_sgen_event()
845 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON2, 0x0000); in mt_sgen_event()
846 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON0, 0xcba0); in mt_sgen_event()
857 if (priv->hp_hifi_mode) { in mtk_hp_enable()
859 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON11, in mtk_hp_enable()
864 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mtk_hp_enable()
867 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mtk_hp_enable()
872 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON11, in mtk_hp_enable()
877 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mtk_hp_enable()
880 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mtk_hp_enable()
887 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON10, 0x0087); in mtk_hp_enable()
891 if (priv->dl_rate[MT6359_AIF_1] >= 96000) in mtk_hp_enable()
892 regmap_update_bits(priv->regmap, in mtk_hp_enable()
897 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON4, 0x0000); in mtk_hp_enable()
900 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON2, 0xf133); in mtk_hp_enable()
903 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x000c); in mtk_hp_enable()
905 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x003c); in mtk_hp_enable()
907 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0c00); in mtk_hp_enable()
909 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x30c0); in mtk_hp_enable()
911 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x30f0); in mtk_hp_enable()
913 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x00fc); in mtk_hp_enable()
919 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0e00); in mtk_hp_enable()
921 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0200); in mtk_hp_enable()
924 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x00ff); in mtk_hp_enable()
931 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x77cf); in mtk_hp_enable()
936 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL]); in mtk_hp_enable()
939 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x77c3); in mtk_hp_enable()
941 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x7703); in mtk_hp_enable()
948 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x30ff); in mtk_hp_enable()
949 if (priv->hp_hifi_mode) { in mtk_hp_enable()
950 /* Enable low-noise mode of DAC */ in mtk_hp_enable()
951 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0xf201); in mtk_hp_enable()
953 /* Disable low-noise mode of DAC */ in mtk_hp_enable()
954 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0xf200); in mtk_hp_enable()
959 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x32ff); in mtk_hp_enable()
961 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x3aff); in mtk_hp_enable()
963 /* Disable Pull-down HPL/R to AVSS28_AUD */ in mtk_hp_enable()
969 /* Pull-down HPL/R to AVSS28_AUD */ in mtk_hp_disable()
973 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mtk_hp_disable()
976 /* Disable low-noise mode of DAC */ in mtk_hp_disable()
977 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON9, in mtk_hp_disable()
981 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mtk_hp_disable()
988 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x77c3); in mtk_hp_disable()
990 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x77cf); in mtk_hp_disable()
994 priv->ana_gain[AUDIO_ANALOG_VOLUME_HPOUTL], in mtk_hp_disable()
998 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x77ff); in mtk_hp_disable()
1007 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, 0x3, 0x0); in mtk_hp_disable()
1010 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0e01); in mtk_hp_disable()
1013 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0c01); in mtk_hp_disable()
1019 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, in mtk_hp_disable()
1023 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mtk_hp_disable()
1027 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mtk_hp_disable()
1031 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x201); in mtk_hp_disable()
1034 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, in mtk_hp_disable()
1038 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON1, in mtk_hp_disable()
1046 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_hp_event()
1048 unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); in mt_hp_event()
1051 dev_dbg(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n", in mt_hp_event()
1052 __func__, event, priv->dev_counter[device], mux); in mt_hp_event()
1056 priv->dev_counter[device]++; in mt_hp_event()
1061 priv->dev_counter[device]--; in mt_hp_event()
1076 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_rcv_event()
1079 dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", in mt_rcv_event()
1080 __func__, event, dapm_kcontrol_get_value(w->kcontrols[0])); in mt_rcv_event()
1084 /* Disable handset short-circuit protection */ in mt_rcv_event()
1085 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON6, 0x0010); in mt_rcv_event()
1088 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON11, in mt_rcv_event()
1093 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mt_rcv_event()
1096 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mt_rcv_event()
1101 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON6, 0x0090); in mt_rcv_event()
1104 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON10, 0x7000); in mt_rcv_event()
1107 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON6, 0x0092); in mt_rcv_event()
1109 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON6, 0x0093); in mt_rcv_event()
1112 regmap_write(priv->regmap, MT6359_ZCD_CON3, in mt_rcv_event()
1113 priv->ana_gain[AUDIO_ANALOG_VOLUME_HSOUTL]); in mt_rcv_event()
1119 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x0009); in mt_rcv_event()
1120 /* Enable low-noise mode of DAC */ in mt_rcv_event()
1121 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0001); in mt_rcv_event()
1123 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON6, 0x009b); in mt_rcv_event()
1127 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON6, in mt_rcv_event()
1132 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt_rcv_event()
1139 regmap_write(priv->regmap, MT6359_ZCD_CON3, DL_GAIN_N_40DB); in mt_rcv_event()
1142 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON6, in mt_rcv_event()
1146 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON6, in mt_rcv_event()
1160 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_lo_event()
1162 unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); in mt_lo_event()
1164 dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", in mt_lo_event()
1169 /* Disable handset short-circuit protection */ in mt_lo_event()
1170 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x0010); in mt_lo_event()
1173 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON11, in mt_lo_event()
1178 if (priv->dev_counter[DEVICE_HP] == 0) in mt_lo_event()
1179 regmap_update_bits(priv->regmap, in mt_lo_event()
1184 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON12, in mt_lo_event()
1189 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x0110); in mt_lo_event()
1192 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x0112); in mt_lo_event()
1194 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x0113); in mt_lo_event()
1197 regmap_write(priv->regmap, MT6359_ZCD_CON1, in mt_lo_event()
1198 priv->ana_gain[AUDIO_ANALOG_VOLUME_LINEOUTL]); in mt_lo_event()
1205 if (priv->dev_counter[DEVICE_HP] > 0) { in mt_lo_event()
1206 dev_info(priv->dev, "%s(), can not enable DAC, hp count %d\n", in mt_lo_event()
1207 __func__, priv->dev_counter[DEVICE_HP]); in mt_lo_event()
1211 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON0, 0x3009); in mt_lo_event()
1212 /* Disable low-noise mode of DAC */ in mt_lo_event()
1213 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0xf200); in mt_lo_event()
1216 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x0117); in mt_lo_event()
1219 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x3113); in mt_lo_event()
1220 /* Enable low-noise mode of DAC */ in mt_lo_event()
1221 if (priv->dev_counter[DEVICE_HP] == 0) in mt_lo_event()
1222 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON9, 0x0001); in mt_lo_event()
1224 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON7, 0x311b); in mt_lo_event()
1229 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON7, in mt_lo_event()
1234 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt_lo_event()
1239 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt_lo_event()
1242 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt_lo_event()
1250 regmap_write(priv->regmap, MT6359_ZCD_CON1, DL_GAIN_N_40DB); in mt_lo_event()
1253 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON7, in mt_lo_event()
1257 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON7, in mt_lo_event()
1271 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_adc_clk_gen_event()
1274 dev_dbg(priv->dev, "%s(), event 0x%x\n", __func__, event); in mt_adc_clk_gen_event()
1279 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1282 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1284 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1286 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1291 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1293 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1295 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1297 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON5, in mt_adc_clk_gen_event()
1311 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_dcc_clk_event()
1314 dev_dbg(priv->dev, "%s(), event 0x%x\n", __func__, event); in mt_dcc_clk_event()
1320 regmap_update_bits(priv->regmap, MT6359_AFE_DCCLK_CFG0, in mt_dcc_clk_event()
1322 regmap_update_bits(priv->regmap, MT6359_AFE_DCCLK_CFG0, in mt_dcc_clk_event()
1324 regmap_update_bits(priv->regmap, MT6359_AFE_DCCLK_CFG0, in mt_dcc_clk_event()
1327 regmap_write(priv->regmap, MT6359_AFE_DCCLK_CFG1, 0x0100); in mt_dcc_clk_event()
1330 regmap_update_bits(priv->regmap, MT6359_AFE_DCCLK_CFG0, in mt_dcc_clk_event()
1332 regmap_update_bits(priv->regmap, MT6359_AFE_DCCLK_CFG0, in mt_dcc_clk_event()
1346 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_mic_bias_0_event()
1348 unsigned int mic_type = priv->mux_select[MUX_MIC_TYPE_0]; in mt_mic_bias_0_event()
1350 dev_dbg(priv->dev, "%s(), event 0x%x, mic_type %d\n", in mt_mic_bias_0_event()
1357 regmap_update_bits(priv->regmap, in mt_mic_bias_0_event()
1362 regmap_update_bits(priv->regmap, in mt_mic_bias_0_event()
1367 regmap_update_bits(priv->regmap, in mt_mic_bias_0_event()
1374 regmap_write(priv->regmap, in mt_mic_bias_0_event()
1377 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON15, in mt_mic_bias_0_event()
1381 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON15, in mt_mic_bias_0_event()
1387 regmap_write(priv->regmap, MT6359_AUDENC_ANA_CON15, 0x0000); in mt_mic_bias_0_event()
1400 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_mic_bias_1_event()
1402 unsigned int mic_type = priv->mux_select[MUX_MIC_TYPE_1]; in mt_mic_bias_1_event()
1404 dev_dbg(priv->dev, "%s(), event 0x%x, mic_type %d\n", in mt_mic_bias_1_event()
1411 regmap_write(priv->regmap, in mt_mic_bias_1_event()
1414 regmap_write(priv->regmap, in mt_mic_bias_1_event()
1418 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON16, in mt_mic_bias_1_event()
1433 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_mic_bias_2_event()
1435 unsigned int mic_type = priv->mux_select[MUX_MIC_TYPE_2]; in mt_mic_bias_2_event()
1437 dev_dbg(priv->dev, "%s(), event 0x%x, mic_type %d\n", in mt_mic_bias_2_event()
1444 regmap_update_bits(priv->regmap, in mt_mic_bias_2_event()
1449 regmap_update_bits(priv->regmap, in mt_mic_bias_2_event()
1454 regmap_update_bits(priv->regmap, in mt_mic_bias_2_event()
1461 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON17, in mt_mic_bias_2_event()
1465 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON17, in mt_mic_bias_2_event()
1471 regmap_write(priv->regmap, MT6359_AUDENC_ANA_CON17, 0x0000); in mt_mic_bias_2_event()
1484 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_mtkaif_tx_event()
1487 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_mtkaif_tx_event()
1507 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_ul_src_dmic_event()
1510 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_ul_src_dmic_event()
1515 if (priv->dmic_one_wire_mode) in mt_ul_src_dmic_event()
1516 regmap_write(priv->regmap, MT6359_AFE_UL_SRC_CON0_H, in mt_ul_src_dmic_event()
1519 regmap_write(priv->regmap, MT6359_AFE_UL_SRC_CON0_H, in mt_ul_src_dmic_event()
1522 regmap_update_bits(priv->regmap, MT6359_AFE_UL_SRC_CON0_L, in mt_ul_src_dmic_event()
1526 regmap_write(priv->regmap, in mt_ul_src_dmic_event()
1540 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_ul_src_34_dmic_event()
1543 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_ul_src_34_dmic_event()
1548 regmap_write(priv->regmap, in mt_ul_src_34_dmic_event()
1550 regmap_update_bits(priv->regmap, MT6359_AFE_ADDA6_UL_SRC_CON0_L, in mt_ul_src_34_dmic_event()
1554 regmap_write(priv->regmap, in mt_ul_src_34_dmic_event()
1568 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_adc_l_event()
1571 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_adc_l_event()
1577 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON0, in mt_adc_l_event()
1592 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_adc_r_event()
1595 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_adc_r_event()
1601 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON1, in mt_adc_r_event()
1616 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_adc_3_event()
1619 dev_dbg(priv->dev, "%s(), event = 0x%x\n", __func__, event); in mt_adc_3_event()
1625 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON2, in mt_adc_3_event()
1640 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_l_mux_event()
1642 unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); in mt_pga_l_mux_event()
1644 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); in mt_pga_l_mux_event()
1645 priv->mux_select[MUX_PGA_L] = mux >> RG_AUDPREAMPLINPUTSEL_SFT; in mt_pga_l_mux_event()
1653 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_r_mux_event()
1655 unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); in mt_pga_r_mux_event()
1657 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); in mt_pga_r_mux_event()
1658 priv->mux_select[MUX_PGA_R] = mux >> RG_AUDPREAMPRINPUTSEL_SFT; in mt_pga_r_mux_event()
1666 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_3_mux_event()
1668 unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); in mt_pga_3_mux_event()
1670 dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); in mt_pga_3_mux_event()
1671 priv->mux_select[MUX_PGA_3] = mux >> RG_AUDPREAMP3INPUTSEL_SFT; in mt_pga_3_mux_event()
1679 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_l_event()
1681 int mic_gain_l = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP1]; in mt_pga_l_event()
1682 unsigned int mux_pga = priv->mux_select[MUX_PGA_L]; in mt_pga_l_event()
1687 mic_type = priv->mux_select[MUX_MIC_TYPE_0]; in mt_pga_l_event()
1690 mic_type = priv->mux_select[MUX_MIC_TYPE_1]; in mt_pga_l_event()
1693 dev_err(priv->dev, "%s(), invalid pga mux %d\n", in mt_pga_l_event()
1695 return -EINVAL; in mt_pga_l_event()
1702 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON0, in mt_pga_l_event()
1709 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON0, in mt_pga_l_event()
1715 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON0, in mt_pga_l_event()
1722 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON0, in mt_pga_l_event()
1737 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_r_event()
1739 int mic_gain_r = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP2]; in mt_pga_r_event()
1740 unsigned int mux_pga = priv->mux_select[MUX_PGA_R]; in mt_pga_r_event()
1745 mic_type = priv->mux_select[MUX_MIC_TYPE_0]; in mt_pga_r_event()
1749 mic_type = priv->mux_select[MUX_MIC_TYPE_2]; in mt_pga_r_event()
1752 dev_err(priv->dev, "%s(), invalid pga mux %d\n", in mt_pga_r_event()
1754 return -EINVAL; in mt_pga_r_event()
1761 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON1, in mt_pga_r_event()
1768 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON1, in mt_pga_r_event()
1774 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON1, in mt_pga_r_event()
1781 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON1, in mt_pga_r_event()
1796 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_pga_3_event()
1798 int mic_gain_3 = priv->ana_gain[AUDIO_ANALOG_VOLUME_MICAMP3]; in mt_pga_3_event()
1799 unsigned int mux_pga = priv->mux_select[MUX_PGA_3]; in mt_pga_3_event()
1805 mic_type = priv->mux_select[MUX_MIC_TYPE_2]; in mt_pga_3_event()
1808 dev_err(priv->dev, "%s(), invalid pga mux %d\n", in mt_pga_3_event()
1810 return -EINVAL; in mt_pga_3_event()
1817 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON2, in mt_pga_3_event()
1824 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON2, in mt_pga_3_event()
1830 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON2, in mt_pga_3_event()
1837 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON2, in mt_pga_3_event()
1885 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_hp_pull_down_event()
1906 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_hp_mute_event()
1911 /* Set HPR/HPL gain to -22dB */ in mt_hp_mute_event()
1912 regmap_write(priv->regmap, MT6359_ZCD_CON2, DL_GAIN_N_22DB_REG); in mt_hp_mute_event()
1916 regmap_write(priv->regmap, MT6359_ZCD_CON2, DL_GAIN_N_40DB_REG); in mt_hp_mute_event()
1929 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_hp_damp_event()
1936 regmap_write(priv->regmap, MT6359_AUDDEC_ANA_CON10, 0x0000); in mt_hp_damp_event()
1949 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_esd_resist_event()
1955 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON2, in mt_esd_resist_event()
1962 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON2, in mt_esd_resist_event()
1976 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_sdm_event()
1982 regmap_update_bits(priv->regmap, MT6359_AFUNC_AUD_CON2, in mt_sdm_event()
1985 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON0, 0xcba1); in mt_sdm_event()
1987 regmap_update_bits(priv->regmap, MT6359_AFUNC_AUD_CON2, in mt_sdm_event()
1990 regmap_update_bits(priv->regmap, MT6359_AFUNC_AUD_CON2, in mt_sdm_event()
1995 regmap_update_bits(priv->regmap, MT6359_AFUNC_AUD_CON2, in mt_sdm_event()
1997 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON0, 0xcba0); in mt_sdm_event()
2010 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_sdm_3rd_event()
2016 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON11, 0x0006); in mt_sdm_3rd_event()
2018 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON9, 0xcba1); in mt_sdm_3rd_event()
2020 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON11, 0x0003); in mt_sdm_3rd_event()
2022 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON11, 0x000b); in mt_sdm_3rd_event()
2026 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON11, 0x0000); in mt_sdm_3rd_event()
2027 regmap_write(priv->regmap, MT6359_AFUNC_AUD_CON9, 0xcba0); in mt_sdm_3rd_event()
2040 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_ncp_event()
2045 regmap_write(priv->regmap, MT6359_AFE_NCP_CFG0, 0xc800); in mt_ncp_event()
2376 SND_SOC_DAPM_INPUT("AIN1"),
2377 SND_SOC_DAPM_INPUT("AIN2"),
2416 struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); in mt_dcc_clk_connect()
2419 if (IS_DCC_BASE(priv->mux_select[MUX_MIC_TYPE_0]) || in mt_dcc_clk_connect()
2420 IS_DCC_BASE(priv->mux_select[MUX_MIC_TYPE_1]) || in mt_dcc_clk_connect()
2421 IS_DCC_BASE(priv->mux_select[MUX_MIC_TYPE_2])) in mt_dcc_clk_connect()
2545 {"PGA_L_Mux", "AIN1", "AIN1"},
2548 {"PGA_R_Mux", "AIN2", "AIN2"},
2551 {"PGA_3_Mux", "AIN2", "AIN2"},
2555 {"AIN1", NULL, "MIC_BIAS_1"},
2556 {"AIN2", NULL, "MIC_BIAS_0"},
2557 {"AIN2", NULL, "MIC_BIAS_2"},
2648 struct snd_soc_component *cmpnt = dai->component; in mt6359_codec_dai_hw_params()
2651 int id = dai->id; in mt6359_codec_dai_hw_params()
2653 dev_dbg(priv->dev, "%s(), id %d, substream->stream %d, rate %d, number %d\n", in mt6359_codec_dai_hw_params()
2654 __func__, id, substream->stream, rate, substream->number); in mt6359_codec_dai_hw_params()
2656 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in mt6359_codec_dai_hw_params()
2657 priv->dl_rate[id] = rate; in mt6359_codec_dai_hw_params()
2658 else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in mt6359_codec_dai_hw_params()
2659 priv->ul_rate[id] = rate; in mt6359_codec_dai_hw_params()
2667 struct snd_soc_component *cmpnt = dai->component; in mt6359_codec_dai_startup()
2670 dev_dbg(priv->dev, "%s stream %d\n", __func__, substream->stream); in mt6359_codec_dai_startup()
2671 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in mt6359_codec_dai_startup()
2673 else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in mt6359_codec_dai_startup()
2682 struct snd_soc_component *cmpnt = dai->component; in mt6359_codec_dai_shutdown()
2685 dev_dbg(priv->dev, "%s stream %d\n", __func__, substream->stream); in mt6359_codec_dai_shutdown()
2686 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in mt6359_codec_dai_shutdown()
2688 else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) in mt6359_codec_dai_shutdown()
2705 .name = "mt6359-snd-codec-aif1",
2731 .name = "mt6359-snd-codec-aif2",
2760 regmap_update_bits(priv->regmap, MT6359_DCXO_CW12, in mt6359_codec_init_reg()
2767 regmap_update_bits(priv->regmap, MT6359_AUDENC_ANA_CON23, in mt6359_codec_init_reg()
2772 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt6359_codec_init_reg()
2775 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON0, in mt6359_codec_init_reg()
2779 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON6, in mt6359_codec_init_reg()
2783 regmap_update_bits(priv->regmap, MT6359_AUDDEC_ANA_CON7, in mt6359_codec_init_reg()
2794 priv->hp_hifi_mode = 0; in mt6359_codec_init_reg()
2800 regmap_update_bits(priv->regmap, MT6359_DCXO_CW12, in mt6359_codec_init_reg()
2811 snd_soc_component_init_regmap(cmpnt, priv->regmap); in mt6359_codec_probe()
2818 cmpnt->regmap = NULL; in mt6359_codec_remove()
2821 static const DECLARE_TLV_DB_SCALE(playback_tlv, -1000, 100, 0);
2867 struct device *dev = priv->dev; in mt6359_parse_dt()
2870 np = of_get_child_by_name(dev->parent->of_node, "mt6359codec"); in mt6359_parse_dt()
2872 return -EINVAL; in mt6359_parse_dt()
2874 ret = of_property_read_u32(np, "mediatek,dmic-mode", in mt6359_parse_dt()
2875 &priv->dmic_one_wire_mode); in mt6359_parse_dt()
2877 dev_info(priv->dev, in mt6359_parse_dt()
2878 "%s() failed to read dmic-mode, use default (0)\n", in mt6359_parse_dt()
2880 priv->dmic_one_wire_mode = 0; in mt6359_parse_dt()
2883 ret = of_property_read_u32(np, "mediatek,mic-type-0", in mt6359_parse_dt()
2884 &priv->mux_select[MUX_MIC_TYPE_0]); in mt6359_parse_dt()
2886 dev_info(priv->dev, in mt6359_parse_dt()
2887 "%s() failed to read mic-type-0, use default (%d)\n", in mt6359_parse_dt()
2889 priv->mux_select[MUX_MIC_TYPE_0] = MIC_TYPE_MUX_IDLE; in mt6359_parse_dt()
2892 ret = of_property_read_u32(np, "mediatek,mic-type-1", in mt6359_parse_dt()
2893 &priv->mux_select[MUX_MIC_TYPE_1]); in mt6359_parse_dt()
2895 dev_info(priv->dev, in mt6359_parse_dt()
2896 "%s() failed to read mic-type-1, use default (%d)\n", in mt6359_parse_dt()
2898 priv->mux_select[MUX_MIC_TYPE_1] = MIC_TYPE_MUX_IDLE; in mt6359_parse_dt()
2901 ret = of_property_read_u32(np, "mediatek,mic-type-2", in mt6359_parse_dt()
2902 &priv->mux_select[MUX_MIC_TYPE_2]); in mt6359_parse_dt()
2905 dev_info(priv->dev, in mt6359_parse_dt()
2906 "%s() failed to read mic-type-2, use default (%d)\n", in mt6359_parse_dt()
2908 priv->mux_select[MUX_MIC_TYPE_2] = MIC_TYPE_MUX_IDLE; in mt6359_parse_dt()
2918 struct mt6397_chip *mt6397 = dev_get_drvdata(pdev->dev.parent); in mt6359_platform_driver_probe()
2920 dev_dbg(&pdev->dev, "%s(), dev name %s\n", in mt6359_platform_driver_probe()
2921 __func__, dev_name(&pdev->dev)); in mt6359_platform_driver_probe()
2923 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in mt6359_platform_driver_probe()
2925 return -ENOMEM; in mt6359_platform_driver_probe()
2927 priv->regmap = mt6397->regmap; in mt6359_platform_driver_probe()
2928 if (IS_ERR(priv->regmap)) in mt6359_platform_driver_probe()
2929 return PTR_ERR(priv->regmap); in mt6359_platform_driver_probe()
2931 dev_set_drvdata(&pdev->dev, priv); in mt6359_platform_driver_probe()
2932 priv->dev = &pdev->dev; in mt6359_platform_driver_probe()
2936 dev_warn(&pdev->dev, "%s() failed to parse dts\n", __func__); in mt6359_platform_driver_probe()
2940 return devm_snd_soc_register_component(&pdev->dev, in mt6359_platform_driver_probe()
2948 .name = "mt6359-sound",