diff options
author | Bard Liao <bardliao@realtek.com> | 2015-01-21 07:50:15 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-01-27 13:37:27 -0500 |
commit | 5c4ca99df718f6569849ab5fabdf18c14755b144 (patch) | |
tree | 2cd078f05947b22f0bc2d846274145813c7859a7 /sound/soc | |
parent | 97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff) |
ASoC: rt5645: Add rt5650 codec support
This patch adds support for rt5650 codec.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/rt5645.c | 158 | ||||
-rw-r--r-- | sound/soc/codecs/rt5645.h | 15 |
2 files changed, 156 insertions, 17 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 27141e2df878..21b2d72b4ea8 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "rt5645.h" | 31 | #include "rt5645.h" |
32 | 32 | ||
33 | #define RT5645_DEVICE_ID 0x6308 | 33 | #define RT5645_DEVICE_ID 0x6308 |
34 | #define RT5650_DEVICE_ID 0x6419 | ||
34 | 35 | ||
35 | #define RT5645_PR_RANGE_BASE (0xff + 1) | 36 | #define RT5645_PR_RANGE_BASE (0xff + 1) |
36 | #define RT5645_PR_SPACING 0x100 | 37 | #define RT5645_PR_SPACING 0x100 |
@@ -59,6 +60,10 @@ static const struct reg_default init_list[] = { | |||
59 | }; | 60 | }; |
60 | #define RT5645_INIT_REG_LEN ARRAY_SIZE(init_list) | 61 | #define RT5645_INIT_REG_LEN ARRAY_SIZE(init_list) |
61 | 62 | ||
63 | static const struct reg_default rt5650_init_list[] = { | ||
64 | {0xf6, 0x0100}, | ||
65 | }; | ||
66 | |||
62 | static const struct reg_default rt5645_reg[] = { | 67 | static const struct reg_default rt5645_reg[] = { |
63 | { 0x00, 0x0000 }, | 68 | { 0x00, 0x0000 }, |
64 | { 0x01, 0xc8c8 }, | 69 | { 0x01, 0xc8c8 }, |
@@ -86,6 +91,7 @@ static const struct reg_default rt5645_reg[] = { | |||
86 | { 0x2a, 0x5656 }, | 91 | { 0x2a, 0x5656 }, |
87 | { 0x2b, 0x5454 }, | 92 | { 0x2b, 0x5454 }, |
88 | { 0x2c, 0xaaa0 }, | 93 | { 0x2c, 0xaaa0 }, |
94 | { 0x2d, 0x0000 }, | ||
89 | { 0x2f, 0x1002 }, | 95 | { 0x2f, 0x1002 }, |
90 | { 0x31, 0x5000 }, | 96 | { 0x31, 0x5000 }, |
91 | { 0x32, 0x0000 }, | 97 | { 0x32, 0x0000 }, |
@@ -193,6 +199,8 @@ static const struct reg_default rt5645_reg[] = { | |||
193 | { 0xdb, 0x0003 }, | 199 | { 0xdb, 0x0003 }, |
194 | { 0xdc, 0x0049 }, | 200 | { 0xdc, 0x0049 }, |
195 | { 0xdd, 0x001b }, | 201 | { 0xdd, 0x001b }, |
202 | { 0xdf, 0x0008 }, | ||
203 | { 0xe0, 0x4000 }, | ||
196 | { 0xe6, 0x8000 }, | 204 | { 0xe6, 0x8000 }, |
197 | { 0xe7, 0x0200 }, | 205 | { 0xe7, 0x0200 }, |
198 | { 0xec, 0xb300 }, | 206 | { 0xec, 0xb300 }, |
@@ -242,6 +250,7 @@ static bool rt5645_volatile_register(struct device *dev, unsigned int reg) | |||
242 | case RT5645_IRQ_CTRL3: | 250 | case RT5645_IRQ_CTRL3: |
243 | case RT5645_INT_IRQ_ST: | 251 | case RT5645_INT_IRQ_ST: |
244 | case RT5645_IL_CMD: | 252 | case RT5645_IL_CMD: |
253 | case RT5650_4BTN_IL_CMD1: | ||
245 | case RT5645_VENDOR_ID: | 254 | case RT5645_VENDOR_ID: |
246 | case RT5645_VENDOR_ID1: | 255 | case RT5645_VENDOR_ID1: |
247 | case RT5645_VENDOR_ID2: | 256 | case RT5645_VENDOR_ID2: |
@@ -287,6 +296,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) | |||
287 | case RT5645_STO_DAC_MIXER: | 296 | case RT5645_STO_DAC_MIXER: |
288 | case RT5645_MONO_DAC_MIXER: | 297 | case RT5645_MONO_DAC_MIXER: |
289 | case RT5645_DIG_MIXER: | 298 | case RT5645_DIG_MIXER: |
299 | case RT5650_A_DAC_SOUR: | ||
290 | case RT5645_DIG_INF1_DATA: | 300 | case RT5645_DIG_INF1_DATA: |
291 | case RT5645_PDM_OUT_CTRL: | 301 | case RT5645_PDM_OUT_CTRL: |
292 | case RT5645_REC_L1_MIXER: | 302 | case RT5645_REC_L1_MIXER: |
@@ -378,6 +388,8 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) | |||
378 | case RT5645_IL_CMD: | 388 | case RT5645_IL_CMD: |
379 | case RT5645_IL_CMD2: | 389 | case RT5645_IL_CMD2: |
380 | case RT5645_IL_CMD3: | 390 | case RT5645_IL_CMD3: |
391 | case RT5650_4BTN_IL_CMD1: | ||
392 | case RT5650_4BTN_IL_CMD2: | ||
381 | case RT5645_DRC1_HL_CTRL1: | 393 | case RT5645_DRC1_HL_CTRL1: |
382 | case RT5645_DRC2_HL_CTRL1: | 394 | case RT5645_DRC2_HL_CTRL1: |
383 | case RT5645_ADC_MONO_HP_CTRL1: | 395 | case RT5645_ADC_MONO_HP_CTRL1: |
@@ -1007,6 +1019,44 @@ static SOC_ENUM_SINGLE_DECL( | |||
1007 | static const struct snd_kcontrol_new rt5645_if1_adc_in_mux = | 1019 | static const struct snd_kcontrol_new rt5645_if1_adc_in_mux = |
1008 | SOC_DAPM_ENUM("IF1 ADC IN source", rt5645_if1_adc_in_enum); | 1020 | SOC_DAPM_ENUM("IF1 ADC IN source", rt5645_if1_adc_in_enum); |
1009 | 1021 | ||
1022 | /* MX-2d [3] [2] */ | ||
1023 | static const char * const rt5650_a_dac1_src[] = { | ||
1024 | "DAC1", "Stereo DAC Mixer" | ||
1025 | }; | ||
1026 | |||
1027 | static SOC_ENUM_SINGLE_DECL( | ||
1028 | rt5650_a_dac1_l_enum, RT5650_A_DAC_SOUR, | ||
1029 | RT5650_A_DAC1_L_IN_SFT, rt5650_a_dac1_src); | ||
1030 | |||
1031 | static const struct snd_kcontrol_new rt5650_a_dac1_l_mux = | ||
1032 | SOC_DAPM_ENUM("A DAC1 L source", rt5650_a_dac1_l_enum); | ||
1033 | |||
1034 | static SOC_ENUM_SINGLE_DECL( | ||
1035 | rt5650_a_dac1_r_enum, RT5650_A_DAC_SOUR, | ||
1036 | RT5650_A_DAC1_R_IN_SFT, rt5650_a_dac1_src); | ||
1037 | |||
1038 | static const struct snd_kcontrol_new rt5650_a_dac1_r_mux = | ||
1039 | SOC_DAPM_ENUM("A DAC1 R source", rt5650_a_dac1_r_enum); | ||
1040 | |||
1041 | /* MX-2d [1] [0] */ | ||
1042 | static const char * const rt5650_a_dac2_src[] = { | ||
1043 | "Stereo DAC Mixer", "Mono DAC Mixer" | ||
1044 | }; | ||
1045 | |||
1046 | static SOC_ENUM_SINGLE_DECL( | ||
1047 | rt5650_a_dac2_l_enum, RT5650_A_DAC_SOUR, | ||
1048 | RT5650_A_DAC2_L_IN_SFT, rt5650_a_dac2_src); | ||
1049 | |||
1050 | static const struct snd_kcontrol_new rt5650_a_dac2_l_mux = | ||
1051 | SOC_DAPM_ENUM("A DAC2 L source", rt5650_a_dac2_l_enum); | ||
1052 | |||
1053 | static SOC_ENUM_SINGLE_DECL( | ||
1054 | rt5650_a_dac2_r_enum, RT5650_A_DAC_SOUR, | ||
1055 | RT5650_A_DAC2_R_IN_SFT, rt5650_a_dac2_src); | ||
1056 | |||
1057 | static const struct snd_kcontrol_new rt5650_a_dac2_r_mux = | ||
1058 | SOC_DAPM_ENUM("A DAC2 R source", rt5650_a_dac2_r_enum); | ||
1059 | |||
1010 | /* MX-2F [13:12] */ | 1060 | /* MX-2F [13:12] */ |
1011 | static const char * const rt5645_if2_adc_in_src[] = { | 1061 | static const char * const rt5645_if2_adc_in_src[] = { |
1012 | "IF_ADC1", "IF_ADC2", "VAD_ADC" | 1062 | "IF_ADC1", "IF_ADC2", "VAD_ADC" |
@@ -1151,11 +1201,16 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1151 | case SND_SOC_DAPM_POST_PMU: | 1201 | case SND_SOC_DAPM_POST_PMU: |
1152 | hp_amp_power(codec, 1); | 1202 | hp_amp_power(codec, 1); |
1153 | /* headphone unmute sequence */ | 1203 | /* headphone unmute sequence */ |
1154 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, RT5645_CP_FQ1_MASK | | 1204 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { |
1155 | RT5645_CP_FQ2_MASK | RT5645_CP_FQ3_MASK, | 1205 | snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); |
1156 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ1_SFT) | | 1206 | } else { |
1157 | (RT5645_CP_FQ_12_KHZ << RT5645_CP_FQ2_SFT) | | 1207 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, |
1158 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ3_SFT)); | 1208 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | |
1209 | RT5645_CP_FQ3_MASK, | ||
1210 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ1_SFT) | | ||
1211 | (RT5645_CP_FQ_12_KHZ << RT5645_CP_FQ2_SFT) | | ||
1212 | (RT5645_CP_FQ_192_KHZ << RT5645_CP_FQ3_SFT)); | ||
1213 | } | ||
1159 | regmap_write(rt5645->regmap, | 1214 | regmap_write(rt5645->regmap, |
1160 | RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); | 1215 | RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); |
1161 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1216 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, |
@@ -1175,12 +1230,16 @@ static int rt5645_hp_event(struct snd_soc_dapm_widget *w, | |||
1175 | 1230 | ||
1176 | case SND_SOC_DAPM_PRE_PMD: | 1231 | case SND_SOC_DAPM_PRE_PMD: |
1177 | /* headphone mute sequence */ | 1232 | /* headphone mute sequence */ |
1178 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, | 1233 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { |
1179 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | | 1234 | snd_soc_write(codec, RT5645_DEPOP_M3, 0x0737); |
1180 | RT5645_CP_FQ3_MASK, | 1235 | } else { |
1181 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ1_SFT) | | 1236 | snd_soc_update_bits(codec, RT5645_DEPOP_M3, |
1182 | (RT5645_CP_FQ_12_KHZ << RT5645_CP_FQ2_SFT) | | 1237 | RT5645_CP_FQ1_MASK | RT5645_CP_FQ2_MASK | |
1183 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ3_SFT)); | 1238 | RT5645_CP_FQ3_MASK, |
1239 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ1_SFT) | | ||
1240 | (RT5645_CP_FQ_12_KHZ << RT5645_CP_FQ2_SFT) | | ||
1241 | (RT5645_CP_FQ_96_KHZ << RT5645_CP_FQ3_SFT)); | ||
1242 | } | ||
1184 | regmap_write(rt5645->regmap, | 1243 | regmap_write(rt5645->regmap, |
1185 | RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); | 1244 | RT5645_PR_BASE + RT5645_MAMP_INT_REG2, 0xfc00); |
1186 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, | 1245 | snd_soc_update_bits(codec, RT5645_DEPOP_M1, |
@@ -1574,6 +1633,17 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { | |||
1574 | SND_SOC_DAPM_OUTPUT("SPOR"), | 1633 | SND_SOC_DAPM_OUTPUT("SPOR"), |
1575 | }; | 1634 | }; |
1576 | 1635 | ||
1636 | static const struct snd_soc_dapm_widget rt5650_specific_dapm_widgets[] = { | ||
1637 | SND_SOC_DAPM_MUX("A DAC1 L Mux", SND_SOC_NOPM, | ||
1638 | 0, 0, &rt5650_a_dac1_l_mux), | ||
1639 | SND_SOC_DAPM_MUX("A DAC1 R Mux", SND_SOC_NOPM, | ||
1640 | 0, 0, &rt5650_a_dac1_r_mux), | ||
1641 | SND_SOC_DAPM_MUX("A DAC2 L Mux", SND_SOC_NOPM, | ||
1642 | 0, 0, &rt5650_a_dac2_l_mux), | ||
1643 | SND_SOC_DAPM_MUX("A DAC2 R Mux", SND_SOC_NOPM, | ||
1644 | 0, 0, &rt5650_a_dac2_r_mux), | ||
1645 | }; | ||
1646 | |||
1577 | static const struct snd_soc_dapm_route rt5645_dapm_routes[] = { | 1647 | static const struct snd_soc_dapm_route rt5645_dapm_routes[] = { |
1578 | { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc }, | 1648 | { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc }, |
1579 | { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc }, | 1649 | { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc }, |
@@ -1779,13 +1849,9 @@ static const struct snd_soc_dapm_route rt5645_dapm_routes[] = { | |||
1779 | { "DAC MIXR", "DAC R2 Switch", "DAC R2 Volume" }, | 1849 | { "DAC MIXR", "DAC R2 Switch", "DAC R2 Volume" }, |
1780 | { "DAC MIXR", "DAC L2 Switch", "DAC L2 Volume" }, | 1850 | { "DAC MIXR", "DAC L2 Switch", "DAC L2 Volume" }, |
1781 | 1851 | ||
1782 | { "DAC L1", NULL, "Stereo DAC MIXL" }, | ||
1783 | { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, | 1852 | { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, |
1784 | { "DAC R1", NULL, "Stereo DAC MIXR" }, | ||
1785 | { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, | 1853 | { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, |
1786 | { "DAC L2", NULL, "Mono DAC MIXL" }, | ||
1787 | { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, | 1854 | { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, |
1788 | { "DAC R2", NULL, "Mono DAC MIXR" }, | ||
1789 | { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, | 1855 | { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, |
1790 | 1856 | ||
1791 | { "SPK MIXL", "BST1 Switch", "BST1" }, | 1857 | { "SPK MIXL", "BST1 Switch", "BST1" }, |
@@ -1874,6 +1940,30 @@ static const struct snd_soc_dapm_route rt5645_dapm_routes[] = { | |||
1874 | { "SPOR", NULL, "SPK amp" }, | 1940 | { "SPOR", NULL, "SPK amp" }, |
1875 | }; | 1941 | }; |
1876 | 1942 | ||
1943 | static const struct snd_soc_dapm_route rt5650_specific_dapm_routes[] = { | ||
1944 | { "A DAC1 L Mux", "DAC1", "DAC1 MIXL"}, | ||
1945 | { "A DAC1 L Mux", "Stereo DAC Mixer", "Stereo DAC MIXL"}, | ||
1946 | { "A DAC1 R Mux", "DAC1", "DAC1 MIXR"}, | ||
1947 | { "A DAC1 R Mux", "Stereo DAC Mixer", "Stereo DAC MIXR"}, | ||
1948 | |||
1949 | { "A DAC2 L Mux", "Stereo DAC Mixer", "Stereo DAC MIXL"}, | ||
1950 | { "A DAC2 L Mux", "Mono DAC Mixer", "Mono DAC MIXL"}, | ||
1951 | { "A DAC2 R Mux", "Stereo DAC Mixer", "Stereo DAC MIXR"}, | ||
1952 | { "A DAC2 R Mux", "Mono DAC Mixer", "Mono DAC MIXR"}, | ||
1953 | |||
1954 | { "DAC L1", NULL, "A DAC1 L Mux" }, | ||
1955 | { "DAC R1", NULL, "A DAC1 R Mux" }, | ||
1956 | { "DAC L2", NULL, "A DAC2 L Mux" }, | ||
1957 | { "DAC R2", NULL, "A DAC2 R Mux" }, | ||
1958 | }; | ||
1959 | |||
1960 | static const struct snd_soc_dapm_route rt5645_specific_dapm_routes[] = { | ||
1961 | { "DAC L1", NULL, "Stereo DAC MIXL" }, | ||
1962 | { "DAC R1", NULL, "Stereo DAC MIXR" }, | ||
1963 | { "DAC L2", NULL, "Mono DAC MIXL" }, | ||
1964 | { "DAC R2", NULL, "Mono DAC MIXR" }, | ||
1965 | }; | ||
1966 | |||
1877 | static int rt5645_hw_params(struct snd_pcm_substream *substream, | 1967 | static int rt5645_hw_params(struct snd_pcm_substream *substream, |
1878 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 1968 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
1879 | { | 1969 | { |
@@ -2293,6 +2383,22 @@ static int rt5645_probe(struct snd_soc_codec *codec) | |||
2293 | 2383 | ||
2294 | rt5645->codec = codec; | 2384 | rt5645->codec = codec; |
2295 | 2385 | ||
2386 | switch (rt5645->codec_type) { | ||
2387 | case CODEC_TYPE_RT5645: | ||
2388 | snd_soc_dapm_add_routes(&codec->dapm, | ||
2389 | rt5645_specific_dapm_routes, | ||
2390 | ARRAY_SIZE(rt5645_specific_dapm_routes)); | ||
2391 | break; | ||
2392 | case CODEC_TYPE_RT5650: | ||
2393 | snd_soc_dapm_new_controls(&codec->dapm, | ||
2394 | rt5650_specific_dapm_widgets, | ||
2395 | ARRAY_SIZE(rt5650_specific_dapm_widgets)); | ||
2396 | snd_soc_dapm_add_routes(&codec->dapm, | ||
2397 | rt5650_specific_dapm_routes, | ||
2398 | ARRAY_SIZE(rt5650_specific_dapm_routes)); | ||
2399 | break; | ||
2400 | } | ||
2401 | |||
2296 | rt5645_set_bias_level(codec, SND_SOC_BIAS_OFF); | 2402 | rt5645_set_bias_level(codec, SND_SOC_BIAS_OFF); |
2297 | 2403 | ||
2298 | snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); | 2404 | snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); |
@@ -2424,6 +2530,7 @@ static const struct regmap_config rt5645_regmap = { | |||
2424 | 2530 | ||
2425 | static const struct i2c_device_id rt5645_i2c_id[] = { | 2531 | static const struct i2c_device_id rt5645_i2c_id[] = { |
2426 | { "rt5645", 0 }, | 2532 | { "rt5645", 0 }, |
2533 | { "rt5650", 0 }, | ||
2427 | { } | 2534 | { } |
2428 | }; | 2535 | }; |
2429 | MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); | 2536 | MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id); |
@@ -2456,9 +2563,18 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
2456 | } | 2563 | } |
2457 | 2564 | ||
2458 | regmap_read(rt5645->regmap, RT5645_VENDOR_ID2, &val); | 2565 | regmap_read(rt5645->regmap, RT5645_VENDOR_ID2, &val); |
2459 | if (val != RT5645_DEVICE_ID) { | 2566 | |
2567 | switch (val) { | ||
2568 | case RT5645_DEVICE_ID: | ||
2569 | rt5645->codec_type = CODEC_TYPE_RT5645; | ||
2570 | break; | ||
2571 | case RT5650_DEVICE_ID: | ||
2572 | rt5645->codec_type = CODEC_TYPE_RT5650; | ||
2573 | break; | ||
2574 | default: | ||
2460 | dev_err(&i2c->dev, | 2575 | dev_err(&i2c->dev, |
2461 | "Device with ID register %x is not rt5645\n", val); | 2576 | "Device with ID register %x is not rt5645 or rt5650\n", |
2577 | val); | ||
2462 | return -ENODEV; | 2578 | return -ENODEV; |
2463 | } | 2579 | } |
2464 | 2580 | ||
@@ -2469,6 +2585,14 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, | |||
2469 | if (ret != 0) | 2585 | if (ret != 0) |
2470 | dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); | 2586 | dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); |
2471 | 2587 | ||
2588 | if (rt5645->codec_type == CODEC_TYPE_RT5650) { | ||
2589 | ret = regmap_register_patch(rt5645->regmap, rt5650_init_list, | ||
2590 | ARRAY_SIZE(rt5650_init_list)); | ||
2591 | if (ret != 0) | ||
2592 | dev_warn(&i2c->dev, "Apply rt5650 patch failed: %d\n", | ||
2593 | ret); | ||
2594 | } | ||
2595 | |||
2472 | if (rt5645->pdata.in2_diff) | 2596 | if (rt5645->pdata.in2_diff) |
2473 | regmap_update_bits(rt5645->regmap, RT5645_IN2_CTRL, | 2597 | regmap_update_bits(rt5645->regmap, RT5645_IN2_CTRL, |
2474 | RT5645_IN_DF2, RT5645_IN_DF2); | 2598 | RT5645_IN_DF2, RT5645_IN_DF2); |
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h index a815e36a2bdb..74542310d3f0 100644 --- a/sound/soc/codecs/rt5645.h +++ b/sound/soc/codecs/rt5645.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #define RT5645_STO_DAC_MIXER 0x2a | 47 | #define RT5645_STO_DAC_MIXER 0x2a |
48 | #define RT5645_MONO_DAC_MIXER 0x2b | 48 | #define RT5645_MONO_DAC_MIXER 0x2b |
49 | #define RT5645_DIG_MIXER 0x2c | 49 | #define RT5645_DIG_MIXER 0x2c |
50 | #define RT5650_A_DAC_SOUR 0x2d | ||
50 | #define RT5645_DIG_INF1_DATA 0x2f | 51 | #define RT5645_DIG_INF1_DATA 0x2f |
51 | /* Mixer - PDM */ | 52 | /* Mixer - PDM */ |
52 | #define RT5645_PDM_OUT_CTRL 0x31 | 53 | #define RT5645_PDM_OUT_CTRL 0x31 |
@@ -150,6 +151,8 @@ | |||
150 | #define RT5645_IL_CMD 0xdb | 151 | #define RT5645_IL_CMD 0xdb |
151 | #define RT5645_IL_CMD2 0xdc | 152 | #define RT5645_IL_CMD2 0xdc |
152 | #define RT5645_IL_CMD3 0xdd | 153 | #define RT5645_IL_CMD3 0xdd |
154 | #define RT5650_4BTN_IL_CMD1 0xdf | ||
155 | #define RT5650_4BTN_IL_CMD2 0xe0 | ||
153 | #define RT5645_DRC1_HL_CTRL1 0xe7 | 156 | #define RT5645_DRC1_HL_CTRL1 0xe7 |
154 | #define RT5645_DRC2_HL_CTRL1 0xe9 | 157 | #define RT5645_DRC2_HL_CTRL1 0xe9 |
155 | #define RT5645_MUTI_DRC_CTRL1 0xea | 158 | #define RT5645_MUTI_DRC_CTRL1 0xea |
@@ -472,6 +475,12 @@ | |||
472 | #define RT5645_DAC_L2_DAC_R_VOL_MASK (0x1 << 4) | 475 | #define RT5645_DAC_L2_DAC_R_VOL_MASK (0x1 << 4) |
473 | #define RT5645_DAC_L2_DAC_R_VOL_SFT 4 | 476 | #define RT5645_DAC_L2_DAC_R_VOL_SFT 4 |
474 | 477 | ||
478 | /* Analog DAC1/2 Input Source Control (0x2d) */ | ||
479 | #define RT5650_A_DAC1_L_IN_SFT 3 | ||
480 | #define RT5650_A_DAC1_R_IN_SFT 2 | ||
481 | #define RT5650_A_DAC2_L_IN_SFT 1 | ||
482 | #define RT5650_A_DAC2_R_IN_SFT 0 | ||
483 | |||
475 | /* Digital Interface Data Control (0x2f) */ | 484 | /* Digital Interface Data Control (0x2f) */ |
476 | #define RT5645_IF1_ADC2_IN_SEL (0x1 << 15) | 485 | #define RT5645_IF1_ADC2_IN_SEL (0x1 << 15) |
477 | #define RT5645_IF1_ADC2_IN_SFT 15 | 486 | #define RT5645_IF1_ADC2_IN_SFT 15 |
@@ -2175,6 +2184,11 @@ enum { | |||
2175 | RT5645_DMIC_DATA_GPIO11, | 2184 | RT5645_DMIC_DATA_GPIO11, |
2176 | }; | 2185 | }; |
2177 | 2186 | ||
2187 | enum { | ||
2188 | CODEC_TYPE_RT5645, | ||
2189 | CODEC_TYPE_RT5650, | ||
2190 | }; | ||
2191 | |||
2178 | struct rt5645_priv { | 2192 | struct rt5645_priv { |
2179 | struct snd_soc_codec *codec; | 2193 | struct snd_soc_codec *codec; |
2180 | struct rt5645_platform_data pdata; | 2194 | struct rt5645_platform_data pdata; |
@@ -2184,6 +2198,7 @@ struct rt5645_priv { | |||
2184 | struct snd_soc_jack *mic_jack; | 2198 | struct snd_soc_jack *mic_jack; |
2185 | struct delayed_work jack_detect_work; | 2199 | struct delayed_work jack_detect_work; |
2186 | 2200 | ||
2201 | int codec_type; | ||
2187 | int sysclk; | 2202 | int sysclk; |
2188 | int sysclk_src; | 2203 | int sysclk_src; |
2189 | int lrck[RT5645_AIFS]; | 2204 | int lrck[RT5645_AIFS]; |