aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5677.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/rt5677.c')
-rw-r--r--sound/soc/codecs/rt5677.c275
1 files changed, 229 insertions, 46 deletions
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 918ada9738b0..fb9c20eace3f 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -702,6 +702,9 @@ static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on)
702 static bool activity; 702 static bool activity;
703 int ret; 703 int ret;
704 704
705 if (!IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI))
706 return -ENXIO;
707
705 if (on && !activity) { 708 if (on && !activity) {
706 activity = true; 709 activity = true;
707 710
@@ -896,7 +899,7 @@ static const struct snd_kcontrol_new rt5677_snd_controls[] = {
896static int set_dmic_clk(struct snd_soc_dapm_widget *w, 899static int set_dmic_clk(struct snd_soc_dapm_widget *w,
897 struct snd_kcontrol *kcontrol, int event) 900 struct snd_kcontrol *kcontrol, int event)
898{ 901{
899 struct snd_soc_codec *codec = w->codec; 902 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
900 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 903 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
901 int idx = rl6231_calc_dmic_clk(rt5677->sysclk); 904 int idx = rl6231_calc_dmic_clk(rt5677->sysclk);
902 905
@@ -911,7 +914,8 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
911static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, 914static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
912 struct snd_soc_dapm_widget *sink) 915 struct snd_soc_dapm_widget *sink)
913{ 916{
914 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(source->codec); 917 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
918 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
915 unsigned int val; 919 unsigned int val;
916 920
917 regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); 921 regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val);
@@ -922,6 +926,101 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
922 return 0; 926 return 0;
923} 927}
924 928
929static int is_using_asrc(struct snd_soc_dapm_widget *source,
930 struct snd_soc_dapm_widget *sink)
931{
932 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
933 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
934 unsigned int reg, shift, val;
935
936 if (source->reg == RT5677_ASRC_1) {
937 switch (source->shift) {
938 case 12:
939 reg = RT5677_ASRC_4;
940 shift = 0;
941 break;
942 case 13:
943 reg = RT5677_ASRC_4;
944 shift = 4;
945 break;
946 case 14:
947 reg = RT5677_ASRC_4;
948 shift = 8;
949 break;
950 case 15:
951 reg = RT5677_ASRC_4;
952 shift = 12;
953 break;
954 default:
955 return 0;
956 }
957 } else {
958 switch (source->shift) {
959 case 0:
960 reg = RT5677_ASRC_6;
961 shift = 8;
962 break;
963 case 1:
964 reg = RT5677_ASRC_6;
965 shift = 12;
966 break;
967 case 2:
968 reg = RT5677_ASRC_5;
969 shift = 0;
970 break;
971 case 3:
972 reg = RT5677_ASRC_5;
973 shift = 4;
974 break;
975 case 4:
976 reg = RT5677_ASRC_5;
977 shift = 8;
978 break;
979 case 5:
980 reg = RT5677_ASRC_5;
981 shift = 12;
982 break;
983 case 12:
984 reg = RT5677_ASRC_3;
985 shift = 0;
986 break;
987 case 13:
988 reg = RT5677_ASRC_3;
989 shift = 4;
990 break;
991 case 14:
992 reg = RT5677_ASRC_3;
993 shift = 12;
994 break;
995 default:
996 return 0;
997 }
998 }
999
1000 regmap_read(rt5677->regmap, reg, &val);
1001 val = (val >> shift) & 0xf;
1002
1003 switch (val) {
1004 case 1 ... 6:
1005 return 1;
1006 default:
1007 return 0;
1008 }
1009
1010}
1011
1012static int can_use_asrc(struct snd_soc_dapm_widget *source,
1013 struct snd_soc_dapm_widget *sink)
1014{
1015 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
1016 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
1017
1018 if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384)
1019 return 1;
1020
1021 return 0;
1022}
1023
925/* Digital Mixer */ 1024/* Digital Mixer */
926static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = { 1025static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = {
927 SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER, 1026 SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER,
@@ -2031,7 +2130,7 @@ static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux =
2031static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, 2130static int rt5677_bst1_event(struct snd_soc_dapm_widget *w,
2032 struct snd_kcontrol *kcontrol, int event) 2131 struct snd_kcontrol *kcontrol, int event)
2033{ 2132{
2034 struct snd_soc_codec *codec = w->codec; 2133 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2035 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2134 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2036 2135
2037 switch (event) { 2136 switch (event) {
@@ -2055,7 +2154,7 @@ static int rt5677_bst1_event(struct snd_soc_dapm_widget *w,
2055static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, 2154static int rt5677_bst2_event(struct snd_soc_dapm_widget *w,
2056 struct snd_kcontrol *kcontrol, int event) 2155 struct snd_kcontrol *kcontrol, int event)
2057{ 2156{
2058 struct snd_soc_codec *codec = w->codec; 2157 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2059 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2158 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2060 2159
2061 switch (event) { 2160 switch (event) {
@@ -2079,7 +2178,7 @@ static int rt5677_bst2_event(struct snd_soc_dapm_widget *w,
2079static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, 2178static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
2080 struct snd_kcontrol *kcontrol, int event) 2179 struct snd_kcontrol *kcontrol, int event)
2081{ 2180{
2082 struct snd_soc_codec *codec = w->codec; 2181 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2083 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2182 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2084 2183
2085 switch (event) { 2184 switch (event) {
@@ -2101,7 +2200,7 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
2101static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, 2200static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
2102 struct snd_kcontrol *kcontrol, int event) 2201 struct snd_kcontrol *kcontrol, int event)
2103{ 2202{
2104 struct snd_soc_codec *codec = w->codec; 2203 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2105 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2204 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2106 2205
2107 switch (event) { 2206 switch (event) {
@@ -2123,7 +2222,7 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
2123static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, 2222static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w,
2124 struct snd_kcontrol *kcontrol, int event) 2223 struct snd_kcontrol *kcontrol, int event)
2125{ 2224{
2126 struct snd_soc_codec *codec = w->codec; 2225 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2127 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2226 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2128 2227
2129 switch (event) { 2228 switch (event) {
@@ -2150,7 +2249,7 @@ static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w,
2150static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, 2249static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w,
2151 struct snd_kcontrol *kcontrol, int event) 2250 struct snd_kcontrol *kcontrol, int event)
2152{ 2251{
2153 struct snd_soc_codec *codec = w->codec; 2252 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2154 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2253 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2155 unsigned int value; 2254 unsigned int value;
2156 2255
@@ -2173,7 +2272,7 @@ static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w,
2173static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, 2272static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w,
2174 struct snd_kcontrol *kcontrol, int event) 2273 struct snd_kcontrol *kcontrol, int event)
2175{ 2274{
2176 struct snd_soc_codec *codec = w->codec; 2275 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2177 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2276 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2178 unsigned int value; 2277 unsigned int value;
2179 2278
@@ -2196,7 +2295,7 @@ static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w,
2196static int rt5677_vref_event(struct snd_soc_dapm_widget *w, 2295static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
2197 struct snd_kcontrol *kcontrol, int event) 2296 struct snd_kcontrol *kcontrol, int event)
2198{ 2297{
2199 struct snd_soc_codec *codec = w->codec; 2298 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
2200 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 2299 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
2201 2300
2202 switch (event) { 2301 switch (event) {
@@ -2226,6 +2325,45 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
2226 0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU | 2325 0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU |
2227 SND_SOC_DAPM_POST_PMU), 2326 SND_SOC_DAPM_POST_PMU),
2228 2327
2328 /* ASRC */
2329 SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0),
2330 SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5677_ASRC_1, 1, 0, NULL, 0),
2331 SND_SOC_DAPM_SUPPLY_S("I2S3 ASRC", 1, RT5677_ASRC_1, 2, 0, NULL, 0),
2332 SND_SOC_DAPM_SUPPLY_S("I2S4 ASRC", 1, RT5677_ASRC_1, 3, 0, NULL, 0),
2333 SND_SOC_DAPM_SUPPLY_S("DAC STO ASRC", 1, RT5677_ASRC_2, 14, 0, NULL, 0),
2334 SND_SOC_DAPM_SUPPLY_S("DAC MONO2 L ASRC", 1, RT5677_ASRC_2, 13, 0, NULL,
2335 0),
2336 SND_SOC_DAPM_SUPPLY_S("DAC MONO2 R ASRC", 1, RT5677_ASRC_2, 12, 0, NULL,
2337 0),
2338 SND_SOC_DAPM_SUPPLY_S("DAC MONO3 L ASRC", 1, RT5677_ASRC_1, 15, 0, NULL,
2339 0),
2340 SND_SOC_DAPM_SUPPLY_S("DAC MONO3 R ASRC", 1, RT5677_ASRC_1, 14, 0, NULL,
2341 0),
2342 SND_SOC_DAPM_SUPPLY_S("DAC MONO4 L ASRC", 1, RT5677_ASRC_1, 13, 0, NULL,
2343 0),
2344 SND_SOC_DAPM_SUPPLY_S("DAC MONO4 R ASRC", 1, RT5677_ASRC_1, 12, 0, NULL,
2345 0),
2346 SND_SOC_DAPM_SUPPLY_S("DMIC STO1 ASRC", 1, RT5677_ASRC_2, 11, 0, NULL,
2347 0),
2348 SND_SOC_DAPM_SUPPLY_S("DMIC STO2 ASRC", 1, RT5677_ASRC_2, 10, 0, NULL,
2349 0),
2350 SND_SOC_DAPM_SUPPLY_S("DMIC STO3 ASRC", 1, RT5677_ASRC_2, 9, 0, NULL,
2351 0),
2352 SND_SOC_DAPM_SUPPLY_S("DMIC STO4 ASRC", 1, RT5677_ASRC_2, 8, 0, NULL,
2353 0),
2354 SND_SOC_DAPM_SUPPLY_S("DMIC MONO L ASRC", 1, RT5677_ASRC_2, 7, 0, NULL,
2355 0),
2356 SND_SOC_DAPM_SUPPLY_S("DMIC MONO R ASRC", 1, RT5677_ASRC_2, 6, 0, NULL,
2357 0),
2358 SND_SOC_DAPM_SUPPLY_S("ADC STO1 ASRC", 1, RT5677_ASRC_2, 5, 0, NULL, 0),
2359 SND_SOC_DAPM_SUPPLY_S("ADC STO2 ASRC", 1, RT5677_ASRC_2, 4, 0, NULL, 0),
2360 SND_SOC_DAPM_SUPPLY_S("ADC STO3 ASRC", 1, RT5677_ASRC_2, 3, 0, NULL, 0),
2361 SND_SOC_DAPM_SUPPLY_S("ADC STO4 ASRC", 1, RT5677_ASRC_2, 2, 0, NULL, 0),
2362 SND_SOC_DAPM_SUPPLY_S("ADC MONO L ASRC", 1, RT5677_ASRC_2, 1, 0, NULL,
2363 0),
2364 SND_SOC_DAPM_SUPPLY_S("ADC MONO R ASRC", 1, RT5677_ASRC_2, 0, 0, NULL,
2365 0),
2366
2229 /* Input Side */ 2367 /* Input Side */
2230 /* micbias */ 2368 /* micbias */
2231 SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5677_PWR_ANLG2, RT5677_PWR_MB1_BIT, 2369 SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5677_PWR_ANLG2, RT5677_PWR_MB1_BIT,
@@ -2656,10 +2794,18 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
2656 /* DAC Mixer */ 2794 /* DAC Mixer */
2657 SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2, 2795 SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2,
2658 RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0), 2796 RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0),
2659 SND_SOC_DAPM_SUPPLY("dac mono left filter", RT5677_PWR_DIG2, 2797 SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2,
2660 RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0), 2798 RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0),
2661 SND_SOC_DAPM_SUPPLY("dac mono right filter", RT5677_PWR_DIG2, 2799 SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2,
2662 RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0), 2800 RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0),
2801 SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2,
2802 RT5677_PWR_DAC_M3F_L_BIT, 0, NULL, 0),
2803 SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2,
2804 RT5677_PWR_DAC_M3F_R_BIT, 0, NULL, 0),
2805 SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2,
2806 RT5677_PWR_DAC_M4F_L_BIT, 0, NULL, 0),
2807 SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2,
2808 RT5677_PWR_DAC_M4F_R_BIT, 0, NULL, 0),
2663 2809
2664 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0, 2810 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
2665 rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)), 2811 rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)),
@@ -2732,6 +2878,31 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
2732}; 2878};
2733 2879
2734static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { 2880static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2881 { "Stereo1 DMIC Mux", NULL, "DMIC STO1 ASRC", can_use_asrc },
2882 { "Stereo2 DMIC Mux", NULL, "DMIC STO2 ASRC", can_use_asrc },
2883 { "Stereo3 DMIC Mux", NULL, "DMIC STO3 ASRC", can_use_asrc },
2884 { "Stereo4 DMIC Mux", NULL, "DMIC STO4 ASRC", can_use_asrc },
2885 { "Mono DMIC L Mux", NULL, "DMIC MONO L ASRC", can_use_asrc },
2886 { "Mono DMIC R Mux", NULL, "DMIC MONO R ASRC", can_use_asrc },
2887 { "I2S1", NULL, "I2S1 ASRC", can_use_asrc},
2888 { "I2S2", NULL, "I2S2 ASRC", can_use_asrc},
2889 { "I2S3", NULL, "I2S3 ASRC", can_use_asrc},
2890 { "I2S4", NULL, "I2S4 ASRC", can_use_asrc},
2891
2892 { "dac stereo1 filter", NULL, "DAC STO ASRC", is_using_asrc },
2893 { "dac mono2 left filter", NULL, "DAC MONO2 L ASRC", is_using_asrc },
2894 { "dac mono2 right filter", NULL, "DAC MONO2 R ASRC", is_using_asrc },
2895 { "dac mono3 left filter", NULL, "DAC MONO3 L ASRC", is_using_asrc },
2896 { "dac mono3 right filter", NULL, "DAC MONO3 R ASRC", is_using_asrc },
2897 { "dac mono4 left filter", NULL, "DAC MONO4 L ASRC", is_using_asrc },
2898 { "dac mono4 right filter", NULL, "DAC MONO4 R ASRC", is_using_asrc },
2899 { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc },
2900 { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc },
2901 { "adc stereo3 filter", NULL, "ADC STO3 ASRC", is_using_asrc },
2902 { "adc stereo4 filter", NULL, "ADC STO4 ASRC", is_using_asrc },
2903 { "adc mono left filter", NULL, "ADC MONO L ASRC", is_using_asrc },
2904 { "adc mono right filter", NULL, "ADC MONO R ASRC", is_using_asrc },
2905
2735 { "DMIC1", NULL, "DMIC L1" }, 2906 { "DMIC1", NULL, "DMIC L1" },
2736 { "DMIC1", NULL, "DMIC R1" }, 2907 { "DMIC1", NULL, "DMIC R1" },
2737 { "DMIC2", NULL, "DMIC L2" }, 2908 { "DMIC2", NULL, "DMIC L2" },
@@ -2862,8 +3033,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2862 3033
2863 { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" }, 3034 { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" },
2864 { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" }, 3035 { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" },
2865 { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
2866
2867 { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" }, 3036 { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" },
2868 { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" }, 3037 { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" },
2869 { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, 3038 { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2884,8 +3053,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2884 3053
2885 { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" }, 3054 { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" },
2886 { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" }, 3055 { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" },
2887 { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll },
2888
2889 { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" }, 3056 { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" },
2890 { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" }, 3057 { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" },
2891 { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll }, 3058 { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2900,8 +3067,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2900 3067
2901 { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" }, 3068 { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" },
2902 { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" }, 3069 { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" },
2903 { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll },
2904
2905 { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" }, 3070 { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" },
2906 { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" }, 3071 { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" },
2907 { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll }, 3072 { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -2916,8 +3081,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2916 3081
2917 { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" }, 3082 { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" },
2918 { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" }, 3083 { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" },
2919 { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll },
2920
2921 { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" }, 3084 { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" },
2922 { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" }, 3085 { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" },
2923 { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll }, 3086 { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll },
@@ -3121,8 +3284,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3121 { "IB45 Bypass Mux", "Bypass", "IB45 Mux" }, 3284 { "IB45 Bypass Mux", "Bypass", "IB45 Mux" },
3122 { "IB45 Bypass Mux", "Pass SRC", "IB45 Mux" }, 3285 { "IB45 Bypass Mux", "Pass SRC", "IB45 Mux" },
3123 3286
3124 { "IB6 Mux", "IF1 DAC 6", "IF1 DAC6" }, 3287 { "IB6 Mux", "IF1 DAC 6", "IF1 DAC6 Mux" },
3125 { "IB6 Mux", "IF2 DAC 6", "IF2 DAC6" }, 3288 { "IB6 Mux", "IF2 DAC 6", "IF2 DAC6 Mux" },
3126 { "IB6 Mux", "SLB DAC 6", "SLB DAC6" }, 3289 { "IB6 Mux", "SLB DAC 6", "SLB DAC6" },
3127 { "IB6 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" }, 3290 { "IB6 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" },
3128 { "IB6 Mux", "IF4 DAC L", "IF4 DAC L" }, 3291 { "IB6 Mux", "IF4 DAC L", "IF4 DAC L" },
@@ -3130,8 +3293,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3130 { "IB6 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, 3293 { "IB6 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" },
3131 { "IB6 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, 3294 { "IB6 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" },
3132 3295
3133 { "IB7 Mux", "IF1 DAC 7", "IF1 DAC7" }, 3296 { "IB7 Mux", "IF1 DAC 7", "IF1 DAC7 Mux" },
3134 { "IB7 Mux", "IF2 DAC 7", "IF2 DAC7" }, 3297 { "IB7 Mux", "IF2 DAC 7", "IF2 DAC7 Mux" },
3135 { "IB7 Mux", "SLB DAC 7", "SLB DAC7" }, 3298 { "IB7 Mux", "SLB DAC 7", "SLB DAC7" },
3136 { "IB7 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" }, 3299 { "IB7 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" },
3137 { "IB7 Mux", "IF4 DAC R", "IF4 DAC R" }, 3300 { "IB7 Mux", "IF4 DAC R", "IF4 DAC R" },
@@ -3466,23 +3629,21 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3466 3629
3467 { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" }, 3630 { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" },
3468 { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" }, 3631 { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" },
3469 { "DAC1 MIXL", NULL, "dac stereo1 filter" },
3470 { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" }, 3632 { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" },
3471 { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" }, 3633 { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" },
3472 { "DAC1 MIXR", NULL, "dac stereo1 filter" },
3473 3634
3474 { "DAC1 FS", NULL, "DAC1 MIXL" }, 3635 { "DAC1 FS", NULL, "DAC1 MIXL" },
3475 { "DAC1 FS", NULL, "DAC1 MIXR" }, 3636 { "DAC1 FS", NULL, "DAC1 MIXR" },
3476 3637
3477 { "DAC2 L Mux", "IF1 DAC 2", "IF1 DAC2" }, 3638 { "DAC2 L Mux", "IF1 DAC 2", "IF1 DAC2 Mux" },
3478 { "DAC2 L Mux", "IF2 DAC 2", "IF2 DAC2" }, 3639 { "DAC2 L Mux", "IF2 DAC 2", "IF2 DAC2 Mux" },
3479 { "DAC2 L Mux", "IF3 DAC L", "IF3 DAC L" }, 3640 { "DAC2 L Mux", "IF3 DAC L", "IF3 DAC L" },
3480 { "DAC2 L Mux", "IF4 DAC L", "IF4 DAC L" }, 3641 { "DAC2 L Mux", "IF4 DAC L", "IF4 DAC L" },
3481 { "DAC2 L Mux", "SLB DAC 2", "SLB DAC2" }, 3642 { "DAC2 L Mux", "SLB DAC 2", "SLB DAC2" },
3482 { "DAC2 L Mux", "OB 2", "OutBound2" }, 3643 { "DAC2 L Mux", "OB 2", "OutBound2" },
3483 3644
3484 { "DAC2 R Mux", "IF1 DAC 3", "IF1 DAC3" }, 3645 { "DAC2 R Mux", "IF1 DAC 3", "IF1 DAC3 Mux" },
3485 { "DAC2 R Mux", "IF2 DAC 3", "IF2 DAC3" }, 3646 { "DAC2 R Mux", "IF2 DAC 3", "IF2 DAC3 Mux" },
3486 { "DAC2 R Mux", "IF3 DAC R", "IF3 DAC R" }, 3647 { "DAC2 R Mux", "IF3 DAC R", "IF3 DAC R" },
3487 { "DAC2 R Mux", "IF4 DAC R", "IF4 DAC R" }, 3648 { "DAC2 R Mux", "IF4 DAC R", "IF4 DAC R" },
3488 { "DAC2 R Mux", "SLB DAC 3", "SLB DAC3" }, 3649 { "DAC2 R Mux", "SLB DAC 3", "SLB DAC3" },
@@ -3490,29 +3651,29 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3490 { "DAC2 R Mux", "Haptic Generator", "Haptic Generator" }, 3651 { "DAC2 R Mux", "Haptic Generator", "Haptic Generator" },
3491 { "DAC2 R Mux", "VAD ADC", "VAD ADC Mux" }, 3652 { "DAC2 R Mux", "VAD ADC", "VAD ADC Mux" },
3492 3653
3493 { "DAC3 L Mux", "IF1 DAC 4", "IF1 DAC4" }, 3654 { "DAC3 L Mux", "IF1 DAC 4", "IF1 DAC4 Mux" },
3494 { "DAC3 L Mux", "IF2 DAC 4", "IF2 DAC4" }, 3655 { "DAC3 L Mux", "IF2 DAC 4", "IF2 DAC4 Mux" },
3495 { "DAC3 L Mux", "IF3 DAC L", "IF3 DAC L" }, 3656 { "DAC3 L Mux", "IF3 DAC L", "IF3 DAC L" },
3496 { "DAC3 L Mux", "IF4 DAC L", "IF4 DAC L" }, 3657 { "DAC3 L Mux", "IF4 DAC L", "IF4 DAC L" },
3497 { "DAC3 L Mux", "SLB DAC 4", "SLB DAC4" }, 3658 { "DAC3 L Mux", "SLB DAC 4", "SLB DAC4" },
3498 { "DAC3 L Mux", "OB 4", "OutBound4" }, 3659 { "DAC3 L Mux", "OB 4", "OutBound4" },
3499 3660
3500 { "DAC3 R Mux", "IF1 DAC 5", "IF1 DAC4" }, 3661 { "DAC3 R Mux", "IF1 DAC 5", "IF1 DAC5 Mux" },
3501 { "DAC3 R Mux", "IF2 DAC 5", "IF2 DAC4" }, 3662 { "DAC3 R Mux", "IF2 DAC 5", "IF2 DAC5 Mux" },
3502 { "DAC3 R Mux", "IF3 DAC R", "IF3 DAC R" }, 3663 { "DAC3 R Mux", "IF3 DAC R", "IF3 DAC R" },
3503 { "DAC3 R Mux", "IF4 DAC R", "IF4 DAC R" }, 3664 { "DAC3 R Mux", "IF4 DAC R", "IF4 DAC R" },
3504 { "DAC3 R Mux", "SLB DAC 5", "SLB DAC5" }, 3665 { "DAC3 R Mux", "SLB DAC 5", "SLB DAC5" },
3505 { "DAC3 R Mux", "OB 5", "OutBound5" }, 3666 { "DAC3 R Mux", "OB 5", "OutBound5" },
3506 3667
3507 { "DAC4 L Mux", "IF1 DAC 6", "IF1 DAC6" }, 3668 { "DAC4 L Mux", "IF1 DAC 6", "IF1 DAC6 Mux" },
3508 { "DAC4 L Mux", "IF2 DAC 6", "IF2 DAC6" }, 3669 { "DAC4 L Mux", "IF2 DAC 6", "IF2 DAC6 Mux" },
3509 { "DAC4 L Mux", "IF3 DAC L", "IF3 DAC L" }, 3670 { "DAC4 L Mux", "IF3 DAC L", "IF3 DAC L" },
3510 { "DAC4 L Mux", "IF4 DAC L", "IF4 DAC L" }, 3671 { "DAC4 L Mux", "IF4 DAC L", "IF4 DAC L" },
3511 { "DAC4 L Mux", "SLB DAC 6", "SLB DAC6" }, 3672 { "DAC4 L Mux", "SLB DAC 6", "SLB DAC6" },
3512 { "DAC4 L Mux", "OB 6", "OutBound6" }, 3673 { "DAC4 L Mux", "OB 6", "OutBound6" },
3513 3674
3514 { "DAC4 R Mux", "IF1 DAC 7", "IF1 DAC7" }, 3675 { "DAC4 R Mux", "IF1 DAC 7", "IF1 DAC7 Mux" },
3515 { "DAC4 R Mux", "IF2 DAC 7", "IF2 DAC7" }, 3676 { "DAC4 R Mux", "IF2 DAC 7", "IF2 DAC7 Mux" },
3516 { "DAC4 R Mux", "IF3 DAC R", "IF3 DAC R" }, 3677 { "DAC4 R Mux", "IF3 DAC R", "IF3 DAC R" },
3517 { "DAC4 R Mux", "IF4 DAC R", "IF4 DAC R" }, 3678 { "DAC4 R Mux", "IF4 DAC R", "IF4 DAC R" },
3518 { "DAC4 R Mux", "SLB DAC 7", "SLB DAC7" }, 3679 { "DAC4 R Mux", "SLB DAC 7", "SLB DAC7" },
@@ -3536,35 +3697,46 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3536 { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, 3697 { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" },
3537 { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" }, 3698 { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" },
3538 { "Stereo DAC MIXR", NULL, "dac stereo1 filter" }, 3699 { "Stereo DAC MIXR", NULL, "dac stereo1 filter" },
3700 { "dac stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll },
3539 3701
3540 { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" }, 3702 { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" },
3541 { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" }, 3703 { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" },
3542 { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" }, 3704 { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" },
3543 { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" }, 3705 { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" },
3544 { "Mono DAC MIXL", NULL, "dac mono left filter" }, 3706 { "Mono DAC MIXL", NULL, "dac mono2 left filter" },
3707 { "dac mono2 left filter", NULL, "PLL1", is_sys_clk_from_pll },
3545 { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" }, 3708 { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" },
3546 { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" }, 3709 { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" },
3547 { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, 3710 { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" },
3548 { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" }, 3711 { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" },
3549 { "Mono DAC MIXR", NULL, "dac mono right filter" }, 3712 { "Mono DAC MIXR", NULL, "dac mono2 right filter" },
3713 { "dac mono2 right filter", NULL, "PLL1", is_sys_clk_from_pll },
3550 3714
3551 { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, 3715 { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" },
3552 { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, 3716 { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" },
3553 { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" }, 3717 { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" },
3554 { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" }, 3718 { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" },
3719 { "DD1 MIXL", NULL, "dac mono3 left filter" },
3720 { "dac mono3 left filter", NULL, "PLL1", is_sys_clk_from_pll },
3555 { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, 3721 { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" },
3556 { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, 3722 { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" },
3557 { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" }, 3723 { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" },
3558 { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" }, 3724 { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" },
3725 { "DD1 MIXR", NULL, "dac mono3 right filter" },
3726 { "dac mono3 right filter", NULL, "PLL1", is_sys_clk_from_pll },
3559 3727
3560 { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, 3728 { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" },
3561 { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, 3729 { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" },
3562 { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" }, 3730 { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" },
3563 { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" }, 3731 { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" },
3732 { "DD2 MIXL", NULL, "dac mono4 left filter" },
3733 { "dac mono4 left filter", NULL, "PLL1", is_sys_clk_from_pll },
3564 { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, 3734 { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" },
3565 { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, 3735 { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" },
3566 { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" }, 3736 { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" },
3567 { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" }, 3737 { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" },
3738 { "DD2 MIXR", NULL, "dac mono4 right filter" },
3739 { "dac mono4 right filter", NULL, "PLL1", is_sys_clk_from_pll },
3568 3740
3569 { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" }, 3741 { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" },
3570 { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" }, 3742 { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" },
@@ -3586,11 +3758,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
3586 { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" }, 3758 { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" },
3587 3759
3588 { "DAC 1", NULL, "DAC12 SRC Mux" }, 3760 { "DAC 1", NULL, "DAC12 SRC Mux" },
3589 { "DAC 1", NULL, "PLL1", is_sys_clk_from_pll },
3590 { "DAC 2", NULL, "DAC12 SRC Mux" }, 3761 { "DAC 2", NULL, "DAC12 SRC Mux" },
3591 { "DAC 2", NULL, "PLL1", is_sys_clk_from_pll },
3592 { "DAC 3", NULL, "DAC3 SRC Mux" }, 3762 { "DAC 3", NULL, "DAC3 SRC Mux" },
3593 { "DAC 3", NULL, "PLL1", is_sys_clk_from_pll },
3594 3763
3595 { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" }, 3764 { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" },
3596 { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" }, 3765 { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" },
@@ -3937,7 +4106,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
3937 unsigned int rx_mask, int slots, int slot_width) 4106 unsigned int rx_mask, int slots, int slot_width)
3938{ 4107{
3939 struct snd_soc_codec *codec = dai->codec; 4108 struct snd_soc_codec *codec = dai->codec;
3940 unsigned int val = 0; 4109 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
4110 unsigned int val = 0, slot_width_25 = 0;
3941 4111
3942 if (rx_mask || tx_mask) 4112 if (rx_mask || tx_mask)
3943 val |= (1 << 12); 4113 val |= (1 << 12);
@@ -3961,6 +4131,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
3961 case 20: 4131 case 20:
3962 val |= (1 << 8); 4132 val |= (1 << 8);
3963 break; 4133 break;
4134 case 25:
4135 slot_width_25 = 0x8080;
3964 case 24: 4136 case 24:
3965 val |= (2 << 8); 4137 val |= (2 << 8);
3966 break; 4138 break;
@@ -3974,10 +4146,16 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
3974 4146
3975 switch (dai->id) { 4147 switch (dai->id) {
3976 case RT5677_AIF1: 4148 case RT5677_AIF1:
3977 snd_soc_update_bits(codec, RT5677_TDM1_CTRL1, 0x1f00, val); 4149 regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00,
4150 val);
4151 regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000,
4152 slot_width_25);
3978 break; 4153 break;
3979 case RT5677_AIF2: 4154 case RT5677_AIF2:
3980 snd_soc_update_bits(codec, RT5677_TDM2_CTRL1, 0x1f00, val); 4155 regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00,
4156 val);
4157 regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x80,
4158 slot_width_25);
3981 break; 4159 break;
3982 default: 4160 default:
3983 break; 4161 break;
@@ -4762,6 +4940,11 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
4762 RT5677_GPIO5_DIR_OUT); 4940 RT5677_GPIO5_DIR_OUT);
4763 } 4941 }
4764 4942
4943 if (rt5677->pdata.micbias1_vdd_3v3)
4944 regmap_update_bits(rt5677->regmap, RT5677_MICBIAS,
4945 RT5677_MICBIAS1_CTRL_VDD_MASK,
4946 RT5677_MICBIAS1_CTRL_VDD_3_3V);
4947
4765 rt5677_init_gpio(i2c); 4948 rt5677_init_gpio(i2c);
4766 rt5677_init_irq(i2c); 4949 rt5677_init_irq(i2c);
4767 4950