Lines Matching +full:0 +full:xa200
33 #define RT5670_GPIO1_IS_IRQ BIT(0)
52 #define RT5670_DEVICE_ID 0x6271
54 #define RT5670_PR_RANGE_BASE (0xff + 1)
55 #define RT5670_PR_SPACING 0x100
57 #define RT5670_PR_BASE (RT5670_PR_RANGE_BASE + (0 * RT5670_PR_SPACING))
61 .range_max = RT5670_PR_BASE + 0xf8,
63 .selector_mask = 0xff,
64 .selector_shift = 0x0,
66 .window_len = 0x1, },
70 { RT5670_PR_BASE + 0x14, 0x9a8a },
71 { RT5670_PR_BASE + 0x38, 0x1fe1 },
72 { RT5670_PR_BASE + 0x3d, 0x3640 },
73 { 0x8a, 0x0123 },
77 { 0x00, 0x0000 },
78 { 0x02, 0x8888 },
79 { 0x03, 0x8888 },
80 { 0x0a, 0x0001 },
81 { 0x0b, 0x0827 },
82 { 0x0c, 0x0000 },
83 { 0x0d, 0x0008 },
84 { 0x0e, 0x0000 },
85 { 0x0f, 0x0808 },
86 { 0x19, 0xafaf },
87 { 0x1a, 0xafaf },
88 { 0x1b, 0x0011 },
89 { 0x1c, 0x2f2f },
90 { 0x1d, 0x2f2f },
91 { 0x1e, 0x0000 },
92 { 0x1f, 0x2f2f },
93 { 0x20, 0x0000 },
94 { 0x26, 0x7860 },
95 { 0x27, 0x7860 },
96 { 0x28, 0x7871 },
97 { 0x29, 0x8080 },
98 { 0x2a, 0x5656 },
99 { 0x2b, 0x5454 },
100 { 0x2c, 0xaaa0 },
101 { 0x2d, 0x0000 },
102 { 0x2e, 0x2f2f },
103 { 0x2f, 0x1002 },
104 { 0x30, 0x0000 },
105 { 0x31, 0x5f00 },
106 { 0x32, 0x0000 },
107 { 0x33, 0x0000 },
108 { 0x34, 0x0000 },
109 { 0x35, 0x0000 },
110 { 0x36, 0x0000 },
111 { 0x37, 0x0000 },
112 { 0x38, 0x0000 },
113 { 0x3b, 0x0000 },
114 { 0x3c, 0x007f },
115 { 0x3d, 0x0000 },
116 { 0x3e, 0x007f },
117 { 0x45, 0xe00f },
118 { 0x4c, 0x5380 },
119 { 0x4f, 0x0073 },
120 { 0x52, 0x00d3 },
121 { 0x53, 0xf000 },
122 { 0x61, 0x0000 },
123 { 0x62, 0x0001 },
124 { 0x63, 0x00c3 },
125 { 0x64, 0x0000 },
126 { 0x65, 0x0001 },
127 { 0x66, 0x0000 },
128 { 0x6f, 0x8000 },
129 { 0x70, 0x8000 },
130 { 0x71, 0x8000 },
131 { 0x72, 0x8000 },
132 { 0x73, 0x7770 },
133 { 0x74, 0x0e00 },
134 { 0x75, 0x1505 },
135 { 0x76, 0x0015 },
136 { 0x77, 0x0c00 },
137 { 0x78, 0x4000 },
138 { 0x79, 0x0123 },
139 { 0x7f, 0x1100 },
140 { 0x80, 0x0000 },
141 { 0x81, 0x0000 },
142 { 0x82, 0x0000 },
143 { 0x83, 0x0000 },
144 { 0x84, 0x0000 },
145 { 0x85, 0x0000 },
146 { 0x86, 0x0004 },
147 { 0x87, 0x0000 },
148 { 0x88, 0x0000 },
149 { 0x89, 0x0000 },
150 { 0x8a, 0x0123 },
151 { 0x8b, 0x0000 },
152 { 0x8c, 0x0003 },
153 { 0x8d, 0x0000 },
154 { 0x8e, 0x0004 },
155 { 0x8f, 0x1100 },
156 { 0x90, 0x0646 },
157 { 0x91, 0x0c06 },
158 { 0x93, 0x0000 },
159 { 0x94, 0x1270 },
160 { 0x95, 0x1000 },
161 { 0x97, 0x0000 },
162 { 0x98, 0x0000 },
163 { 0x99, 0x0000 },
164 { 0x9a, 0x2184 },
165 { 0x9b, 0x010a },
166 { 0x9c, 0x0aea },
167 { 0x9d, 0x000c },
168 { 0x9e, 0x0400 },
169 { 0xae, 0x7000 },
170 { 0xaf, 0x0000 },
171 { 0xb0, 0x7000 },
172 { 0xb1, 0x0000 },
173 { 0xb2, 0x0000 },
174 { 0xb3, 0x001f },
175 { 0xb4, 0x220c },
176 { 0xb5, 0x1f00 },
177 { 0xb6, 0x0000 },
178 { 0xb7, 0x0000 },
179 { 0xbb, 0x0000 },
180 { 0xbc, 0x0000 },
181 { 0xbd, 0x0000 },
182 { 0xbe, 0x0000 },
183 { 0xbf, 0x0000 },
184 { 0xc0, 0x0000 },
185 { 0xc1, 0x0000 },
186 { 0xc2, 0x0000 },
187 { 0xcd, 0x0000 },
188 { 0xce, 0x0000 },
189 { 0xcf, 0x1813 },
190 { 0xd0, 0x0690 },
191 { 0xd1, 0x1c17 },
192 { 0xd3, 0xa220 },
193 { 0xd4, 0x0000 },
194 { 0xd6, 0x0400 },
195 { 0xd9, 0x0809 },
196 { 0xda, 0x0000 },
197 { 0xdb, 0x0001 },
198 { 0xdc, 0x0049 },
199 { 0xdd, 0x0024 },
200 { 0xe6, 0x8000 },
201 { 0xe7, 0x0000 },
202 { 0xec, 0xa200 },
203 { 0xed, 0x0000 },
204 { 0xee, 0xa200 },
205 { 0xef, 0x0000 },
206 { 0xf8, 0x0000 },
207 { 0xf9, 0x0000 },
208 { 0xfa, 0x8010 },
209 { 0xfb, 0x0033 },
210 { 0xfc, 0x0100 },
217 for (i = 0; i < ARRAY_SIZE(rt5670_ranges); i++) { in rt5670_volatile_register()
264 for (i = 0; i < ARRAY_SIZE(rt5670_ranges); i++) { in rt5670_readable_register()
440 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x0); in rt5670_headset_detect()
444 snd_soc_component_write(component, RT5670_GPIO_CTRL2, 0x0004); in rt5670_headset_detect()
449 snd_soc_component_write(component, RT5670_JD_CTRL3, 0x00f0); in rt5670_headset_detect()
453 RT5670_CBJ_MN_JD, 0); in rt5670_headset_detect()
455 val = snd_soc_component_read(component, RT5670_CJ_CTRL3) & 0x7; in rt5670_headset_detect()
456 if (val == 0x1 || val == 0x2) { in rt5670_headset_detect()
459 snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x8); in rt5670_headset_detect()
460 snd_soc_component_update_bits(component, RT5670_IL_CMD, 0x40, 0x40); in rt5670_headset_detect()
463 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
469 snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x0); in rt5670_headset_detect()
470 snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4); in rt5670_headset_detect()
471 rt5670->jack_type = 0; in rt5670_headset_detect()
484 rt5670_headset_detect(component, 0); in rt5670_jack_suspend()
502 btn_type = val & 0xff80; in rt5670_button_detect()
504 if (btn_type != 0) { in rt5670_button_detect()
521 val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0070; in rt5670_irq_detection()
523 val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0020; in rt5670_irq_detection()
527 case 0x30: /* 2 port */ in rt5670_irq_detection()
528 case 0x0: /* 1 port or 2 port */ in rt5670_irq_detection()
529 if (rt5670->jack_type == 0) { in rt5670_irq_detection()
535 btn_type = 0; in rt5670_irq_detection()
536 if (snd_soc_component_read(rt5670->component, RT5670_INT_IRQ_ST) & 0x4) { in rt5670_irq_detection()
541 case 0x2000: /* up */ in rt5670_irq_detection()
544 case 0x0400: /* center */ in rt5670_irq_detection()
547 case 0x0080: /* down */ in rt5670_irq_detection()
552 "Unexpected button code 0x%04x\n", in rt5670_irq_detection()
557 if (btn_type == 0)/* button release */ in rt5670_irq_detection()
562 case 0x70: /* 2 port */ in rt5670_irq_detection()
563 case 0x10: /* 2 port */ in rt5670_irq_detection()
564 case 0x20: /* 1 port */ in rt5670_irq_detection()
565 report = 0; in rt5670_irq_detection()
566 snd_soc_component_update_bits(rt5670->component, RT5670_INT_IRQ_ST, 0x1, 0x0); in rt5670_irq_detection()
567 rt5670_headset_detect(rt5670->component, 0); in rt5670_irq_detection()
600 return 0; in rt5670_set_jack_detect()
604 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
605 static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0);
606 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
608 static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
610 /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
612 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
613 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
614 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
615 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
616 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
617 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
618 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0)
649 175, 0, dac_vol_tlv),
652 175, 0, dac_vol_tlv),
655 RT5670_BST_SFT1, 8, 0, bst_tlv),
657 RT5670_BST_SFT1, 8, 0, bst_tlv),
667 127, 0, adc_vol_tlv),
671 127, 0, adc_vol_tlv),
676 3, 0, adc_bst_tlv),
680 3, 0, adc_bst_tlv),
706 if (idx < 0) in set_dmic_clk()
723 return 0; in is_sys_clk_from_pll()
733 case 0: in is_using_asrc()
735 shift = 0; in is_using_asrc()
747 shift = 0; in is_using_asrc()
762 return 0; in is_using_asrc()
765 val = (snd_soc_component_read(component, reg) >> shift) & 0xf; in is_using_asrc()
773 return 0; in is_using_asrc()
787 return 0; in can_use_asrc()
808 unsigned int asrc2_mask = 0, asrc2_value = 0; in rt5670_sel_asrc_clk_src()
809 unsigned int asrc3_mask = 0, asrc3_value = 0; in rt5670_sel_asrc_clk_src()
869 return 0; in rt5670_sel_asrc_clk_src()
1082 /*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */
1117 /* MX-2D [1] [0] */
1231 /* MX-28 [1:0] */
1260 "Slot 0-1", "Slot 2-3", "Slot 4-5", "Slot 6-7"
1375 0x0400, 0x0400); in rt5670_hp_power_event()
1382 regmap_write(rt5670->regmap, RT5670_DEPOP_M2, 0x3100); in rt5670_hp_power_event()
1383 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8009); in rt5670_hp_power_event()
1385 RT5670_HP_DCC_INT1, 0x9f00); in rt5670_hp_power_event()
1387 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_power_event()
1390 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x0004); in rt5670_hp_power_event()
1394 return 0; in rt5670_hp_power_event()
1397 return 0; in rt5670_hp_power_event()
1410 RT5670_MAMP_INT_REG2, 0xb400); in rt5670_hp_event()
1411 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1412 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x805d); in rt5670_hp_event()
1413 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1415 0x0300, 0x0300); in rt5670_hp_event()
1417 RT5670_L_MUTE | RT5670_R_MUTE, 0); in rt5670_hp_event()
1419 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1425 RT5670_MAMP_INT_REG2, 0xb400); in rt5670_hp_event()
1426 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0772); in rt5670_hp_event()
1427 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x803d); in rt5670_hp_event()
1429 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x831d); in rt5670_hp_event()
1436 RT5670_GEN_CTRL2, 0x0300, 0x0); in rt5670_hp_event()
1437 regmap_write(rt5670->regmap, RT5670_DEPOP_M1, 0x8019); in rt5670_hp_event()
1438 regmap_write(rt5670->regmap, RT5670_DEPOP_M3, 0x0707); in rt5670_hp_event()
1440 RT5670_MAMP_INT_REG2, 0xfc00); in rt5670_hp_event()
1444 return 0; in rt5670_hp_event()
1447 return 0; in rt5670_hp_event()
1457 return 0; in rt5670_spk_event()
1471 return 0; in rt5670_spk_event()
1474 return 0; in rt5670_spk_event()
1490 RT5670_PWR_BST1_P, 0); in rt5670_bst1_event()
1494 return 0; in rt5670_bst1_event()
1497 return 0; in rt5670_bst1_event()
1513 RT5670_PWR_BST2_P, 0); in rt5670_bst2_event()
1517 return 0; in rt5670_bst2_event()
1520 return 0; in rt5670_bst2_event()
1525 RT5670_PWR_PLL_BIT, 0, NULL, 0),
1527 RT5670_PWR_I2S_DSP_BIT, 0, NULL, 0),
1529 RT5670_PWR_MIC_DET_BIT, 0, NULL, 0),
1533 11, 0, NULL, 0),
1535 12, 0, NULL, 0),
1537 10, 0, NULL, 0),
1539 9, 0, NULL, 0),
1541 8, 0, NULL, 0),
1543 7, 0, NULL, 0),
1545 6, 0, NULL, 0),
1547 5, 0, NULL, 0),
1549 4, 0, NULL, 0),
1551 3, 0, NULL, 0),
1553 2, 0, NULL, 0),
1555 1, 0, NULL, 0),
1557 0, 0, NULL, 0),
1562 RT5670_PWR_MB1_BIT, 0, NULL, 0),
1577 SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0),
1578 SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0),
1579 SND_SOC_DAPM_PGA("DMIC3", SND_SOC_NOPM, 0, 0, NULL, 0),
1581 SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0,
1584 RT5670_DMIC_1_EN_SFT, 0, NULL, 0),
1586 RT5670_DMIC_2_EN_SFT, 0, NULL, 0),
1588 RT5670_DMIC_3_EN_SFT, 0, NULL, 0),
1591 0, NULL, 0, rt5670_bst1_event,
1594 0, NULL, 0, rt5670_bst2_event,
1598 RT5670_PWR_IN_L_BIT, 0, NULL, 0),
1600 RT5670_PWR_IN_R_BIT, 0, NULL, 0),
1603 SND_SOC_DAPM_MIXER("RECMIXL", RT5670_PWR_MIXER, RT5670_PWR_RM_L_BIT, 0,
1605 SND_SOC_DAPM_MIXER("RECMIXR", RT5670_PWR_MIXER, RT5670_PWR_RM_R_BIT, 0,
1608 SND_SOC_DAPM_ADC("ADC 1", NULL, SND_SOC_NOPM, 0, 0),
1609 SND_SOC_DAPM_ADC("ADC 2", NULL, SND_SOC_NOPM, 0, 0),
1611 SND_SOC_DAPM_PGA("ADC 1_2", SND_SOC_NOPM, 0, 0, NULL, 0),
1614 RT5670_PWR_ADC_L_BIT, 0, NULL, 0),
1616 RT5670_PWR_ADC_R_BIT, 0, NULL, 0),
1618 RT5670_CHOP_DAC_ADC, 12, 0, NULL, 0),
1620 SND_SOC_DAPM_MUX("Stereo1 DMIC Mux", SND_SOC_NOPM, 0, 0,
1622 SND_SOC_DAPM_MUX("Stereo1 ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1624 SND_SOC_DAPM_MUX("Stereo1 ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1626 SND_SOC_DAPM_MUX("Stereo1 ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1628 SND_SOC_DAPM_MUX("Stereo1 ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1630 SND_SOC_DAPM_MUX("Stereo2 DMIC Mux", SND_SOC_NOPM, 0, 0,
1632 SND_SOC_DAPM_MUX("Stereo2 ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1634 SND_SOC_DAPM_MUX("Stereo2 ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1636 SND_SOC_DAPM_MUX("Stereo2 ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1638 SND_SOC_DAPM_MUX("Stereo2 ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1640 SND_SOC_DAPM_MUX("Stereo2 ADC LR Mux", SND_SOC_NOPM, 0, 0,
1642 SND_SOC_DAPM_MUX("Mono DMIC L Mux", SND_SOC_NOPM, 0, 0,
1644 SND_SOC_DAPM_MUX("Mono DMIC R Mux", SND_SOC_NOPM, 0, 0,
1646 SND_SOC_DAPM_MUX("Mono ADC L2 Mux", SND_SOC_NOPM, 0, 0,
1648 SND_SOC_DAPM_MUX("Mono ADC L1 Mux", SND_SOC_NOPM, 0, 0,
1650 SND_SOC_DAPM_MUX("Mono ADC R1 Mux", SND_SOC_NOPM, 0, 0,
1652 SND_SOC_DAPM_MUX("Mono ADC R2 Mux", SND_SOC_NOPM, 0, 0,
1656 RT5670_PWR_ADC_S1F_BIT, 0, NULL, 0),
1658 RT5670_PWR_ADC_S2F_BIT, 0, NULL, 0),
1665 SND_SOC_DAPM_MIXER("Sto2 ADC MIXL", SND_SOC_NOPM, 0, 0,
1668 SND_SOC_DAPM_MIXER("Sto2 ADC MIXR", SND_SOC_NOPM, 0, 0,
1672 RT5670_PWR_ADC_MF_L_BIT, 0, NULL, 0),
1677 RT5670_PWR_ADC_MF_R_BIT, 0, NULL, 0),
1683 SND_SOC_DAPM_PGA("Stereo1 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0),
1684 SND_SOC_DAPM_PGA("Stereo1 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0),
1685 SND_SOC_DAPM_PGA("Stereo2 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0),
1686 SND_SOC_DAPM_PGA("Stereo2 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0),
1687 SND_SOC_DAPM_PGA("Sto2 ADC LR MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
1688 SND_SOC_DAPM_PGA("Stereo1 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
1689 SND_SOC_DAPM_PGA("Stereo2 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
1690 SND_SOC_DAPM_PGA("Mono ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
1691 SND_SOC_DAPM_PGA("VAD_ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1692 SND_SOC_DAPM_PGA("IF_ADC1", SND_SOC_NOPM, 0, 0, NULL, 0),
1693 SND_SOC_DAPM_PGA("IF_ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
1694 SND_SOC_DAPM_PGA("IF_ADC3", SND_SOC_NOPM, 0, 0, NULL, 0),
1695 SND_SOC_DAPM_PGA("IF1_ADC1", SND_SOC_NOPM, 0, 0, NULL, 0),
1696 SND_SOC_DAPM_PGA("IF1_ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
1697 SND_SOC_DAPM_PGA("IF1_ADC3", SND_SOC_NOPM, 0, 0, NULL, 0),
1700 SND_SOC_DAPM_PGA("TxDP_ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1701 SND_SOC_DAPM_PGA("TxDP_ADC_L", SND_SOC_NOPM, 0, 0, NULL, 0),
1702 SND_SOC_DAPM_PGA("TxDP_ADC_R", SND_SOC_NOPM, 0, 0, NULL, 0),
1703 SND_SOC_DAPM_PGA("TxDC_DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1705 SND_SOC_DAPM_MUX("TDM Data Mux", SND_SOC_NOPM, 0, 0,
1708 SND_SOC_DAPM_MUX("DSP UL Mux", SND_SOC_NOPM, 0, 0,
1710 SND_SOC_DAPM_MUX("DSP DL Mux", SND_SOC_NOPM, 0, 0,
1713 SND_SOC_DAPM_MUX("RxDP Mux", SND_SOC_NOPM, 0, 0,
1717 SND_SOC_DAPM_MUX("IF2 ADC Mux", SND_SOC_NOPM, 0, 0,
1722 RT5670_PWR_I2S1_BIT, 0, NULL, 0),
1723 SND_SOC_DAPM_PGA("IF1 DAC1", SND_SOC_NOPM, 0, 0, NULL, 0),
1724 SND_SOC_DAPM_PGA("IF1 DAC2", SND_SOC_NOPM, 0, 0, NULL, 0),
1725 SND_SOC_DAPM_PGA("IF1 DAC1 L", SND_SOC_NOPM, 0, 0, NULL, 0),
1726 SND_SOC_DAPM_PGA("IF1 DAC1 R", SND_SOC_NOPM, 0, 0, NULL, 0),
1727 SND_SOC_DAPM_PGA("IF1 DAC2 L", SND_SOC_NOPM, 0, 0, NULL, 0),
1728 SND_SOC_DAPM_PGA("IF1 DAC2 R", SND_SOC_NOPM, 0, 0, NULL, 0),
1729 SND_SOC_DAPM_PGA("IF1 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1730 SND_SOC_DAPM_PGA("IF1 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1731 SND_SOC_DAPM_PGA("IF1 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1733 RT5670_PWR_I2S2_BIT, 0, NULL, 0),
1734 SND_SOC_DAPM_PGA("IF2 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
1735 SND_SOC_DAPM_PGA("IF2 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1736 SND_SOC_DAPM_PGA("IF2 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1737 SND_SOC_DAPM_PGA("IF2 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
1738 SND_SOC_DAPM_PGA("IF2 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
1739 SND_SOC_DAPM_PGA("IF2 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
1742 SND_SOC_DAPM_MUX("IF1 ADC1 IN1 Mux", SND_SOC_NOPM, 0, 0,
1744 SND_SOC_DAPM_MUX("IF1 ADC1 IN2 Mux", SND_SOC_NOPM, 0, 0,
1746 SND_SOC_DAPM_MUX("IF1 ADC2 IN Mux", SND_SOC_NOPM, 0, 0,
1748 SND_SOC_DAPM_MUX("IF1 ADC2 IN1 Mux", SND_SOC_NOPM, 0, 0,
1750 SND_SOC_DAPM_MUX("VAD ADC Mux", SND_SOC_NOPM, 0, 0,
1754 SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
1755 SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
1756 SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0),
1757 SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0,
1761 SND_SOC_DAPM_PGA("Audio DSP", SND_SOC_NOPM, 0, 0, NULL, 0),
1765 SND_SOC_DAPM_MIXER("DAC1 MIXL", SND_SOC_NOPM, 0, 0,
1767 SND_SOC_DAPM_MIXER("DAC1 MIXR", SND_SOC_NOPM, 0, 0,
1769 SND_SOC_DAPM_PGA("DAC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
1772 SND_SOC_DAPM_MUX("DAC L2 Mux", SND_SOC_NOPM, 0, 0,
1774 SND_SOC_DAPM_MUX("DAC R2 Mux", SND_SOC_NOPM, 0, 0,
1777 RT5670_PWR_DAC_L2_BIT, 0, NULL, 0),
1779 RT5670_PWR_DAC_R2_BIT, 0, NULL, 0),
1781 SND_SOC_DAPM_MUX("DAC1 L Mux", SND_SOC_NOPM, 0, 0, &rt5670_dac1l_mux),
1782 SND_SOC_DAPM_MUX("DAC1 R Mux", SND_SOC_NOPM, 0, 0, &rt5670_dac1r_mux),
1786 RT5670_PWR_DAC_S1F_BIT, 0, NULL, 0),
1788 RT5670_PWR_DAC_MF_L_BIT, 0, NULL, 0),
1790 RT5670_PWR_DAC_MF_R_BIT, 0, NULL, 0),
1791 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
1794 SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
1797 SND_SOC_DAPM_MIXER("Mono DAC MIXL", SND_SOC_NOPM, 0, 0,
1800 SND_SOC_DAPM_MIXER("Mono DAC MIXR", SND_SOC_NOPM, 0, 0,
1803 SND_SOC_DAPM_MIXER("DAC MIXL", SND_SOC_NOPM, 0, 0,
1806 SND_SOC_DAPM_MIXER("DAC MIXR", SND_SOC_NOPM, 0, 0,
1812 RT5670_PWR_DAC_L1_BIT, 0, NULL, 0),
1814 RT5670_PWR_DAC_R1_BIT, 0, NULL, 0),
1815 SND_SOC_DAPM_DAC("DAC L1", NULL, SND_SOC_NOPM, 0, 0),
1816 SND_SOC_DAPM_DAC("DAC R1", NULL, SND_SOC_NOPM, 0, 0),
1818 RT5670_PWR_DAC_L2_BIT, 0),
1821 RT5670_PWR_DAC_R2_BIT, 0),
1825 0, rt5670_out_l_mix, ARRAY_SIZE(rt5670_out_l_mix)),
1827 0, rt5670_out_r_mix, ARRAY_SIZE(rt5670_out_r_mix)),
1830 RT5670_PWR_HV_L_BIT, 0,
1833 RT5670_PWR_HV_R_BIT, 0,
1835 SND_SOC_DAPM_PGA("DAC 1", SND_SOC_NOPM, 0, 0, NULL, 0),
1836 SND_SOC_DAPM_PGA("DAC 2", SND_SOC_NOPM, 0, 0, NULL, 0),
1837 SND_SOC_DAPM_PGA("HPOVOL", SND_SOC_NOPM, 0, 0, NULL, 0),
1840 SND_SOC_DAPM_MIXER("HPO MIX", SND_SOC_NOPM, 0, 0,
1843 0, rt5670_lout_mix, ARRAY_SIZE(rt5670_lout_mix)),
1844 SND_SOC_DAPM_SUPPLY_S("Improve HP Amp Drv", 1, SND_SOC_NOPM, 0, 0,
1848 RT5670_PWR_HP_L_BIT, 0, NULL, 0),
1850 RT5670_PWR_HP_R_BIT, 0, NULL, 0),
1851 SND_SOC_DAPM_PGA_S("HP Amp", 1, SND_SOC_NOPM, 0, 0,
1854 SND_SOC_DAPM_SWITCH("LOUT L Playback", SND_SOC_NOPM, 0, 0,
1856 SND_SOC_DAPM_SWITCH("LOUT R Playback", SND_SOC_NOPM, 0, 0,
1858 SND_SOC_DAPM_PGA("LOUT Amp", SND_SOC_NOPM, 0, 0, NULL, 0),
1862 RT5670_PWR_PDM1_BIT, 0, NULL, 0),
1878 RT5670_PWR_PDM2_BIT, 0, NULL, 0),
1890 SND_SOC_DAPM_PGA_E("SPO Amp", SND_SOC_NOPM, 0, 0, NULL, 0,
2092 { "TDM Data Mux", "Slot 0-1", "Stereo1 ADC MIX" },
2299 unsigned int val_len = 0, val_clk, mask_clk; in rt5670_hw_params()
2304 if (pre_div < 0) { in rt5670_hw_params()
2310 if (frame_size < 0) { in rt5670_hw_params()
2360 return 0; in rt5670_hw_params()
2367 unsigned int reg_val = 0; in rt5670_set_dai_fmt()
2375 rt5670->master[dai->id] = 0; in rt5670_set_dai_fmt()
2422 return 0; in rt5670_set_dai_fmt()
2429 unsigned int reg_val = 0; in rt5670_set_codec_sysclk()
2453 return 0; in rt5670_set_codec_sysclk()
2466 return 0; in rt5670_set_dai_pll()
2471 rt5670->pll_in = 0; in rt5670_set_dai_pll()
2472 rt5670->pll_out = 0; in rt5670_set_dai_pll()
2475 return 0; in rt5670_set_dai_pll()
2507 if (ret < 0) { in rt5670_set_dai_pll()
2513 pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), in rt5670_set_dai_pll()
2519 (pll_code.m_bp ? 0 : pll_code.m_code) << RT5670_PLL_M_SFT | in rt5670_set_dai_pll()
2526 return 0; in rt5670_set_dai_pll()
2533 unsigned int val = 0; in rt5670_set_tdm_slot()
2570 snd_soc_component_update_bits(component, RT5670_TDM_CTRL_1, 0x7c00, val); in rt5670_set_tdm_slot()
2572 return 0; in rt5670_set_tdm_slot()
2581 return 0; in rt5670_set_bclk_ratio()
2583 if ((ratio % 50) == 0) in rt5670_set_bclk_ratio()
2590 return 0; in rt5670_set_bclk_ratio()
2613 snd_soc_component_update_bits(component, RT5670_DIG_MISC, 0x1, 0x1); in rt5670_set_bias_level()
2615 RT5670_LDO_SEL_MASK, 0x5); in rt5670_set_bias_level()
2621 RT5670_PWR_FV1 | RT5670_PWR_FV2, 0); in rt5670_set_bias_level()
2623 RT5670_LDO_SEL_MASK, 0x3); in rt5670_set_bias_level()
2636 RT5670_PWR_FV1 | RT5670_PWR_FV2, 0); in rt5670_set_bias_level()
2638 snd_soc_component_update_bits(component, RT5670_DIG_MISC, 0x1, 0x0); in rt5670_set_bias_level()
2645 return 0; in rt5670_set_bias_level()
2678 return 0; in rt5670_probe()
2685 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_remove()
2696 return 0; in rt5670_suspend()
2706 return 0; in rt5670_resume()
2803 { "rt5670", 0 },
2804 { "rt5671", 0 },
2805 { "rt5672", 0 },
2812 { "10EC5670", 0},
2813 { "10EC5672", 0},
2814 { "10EC5640", 0}, /* quirk */
2943 dev_info(&i2c->dev, "Overriding quirk 0x%x => 0x%x\n", in rt5670_i2c_probe()
3017 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3023 regmap_write(rt5670->regmap, RT5670_RESET, 0); in rt5670_i2c_probe()
3027 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0980); in rt5670_i2c_probe()
3029 regmap_write(rt5670->regmap, RT5670_GPIO_CTRL3, 0x0d00); in rt5670_i2c_probe()
3033 if (ret != 0) in rt5670_i2c_probe()
3045 regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000); in rt5670_i2c_probe()
3046 regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010); in rt5670_i2c_probe()
3047 regmap_write(rt5670->regmap, RT5670_IL_CMD3, 0x0014); in rt5670_i2c_probe()
3065 rt5670->sysclk = 0; in rt5670_i2c_probe()
3180 if (ret < 0) in rt5670_i2c_probe()
3185 return 0; in rt5670_i2c_probe()
3196 return 0; in rt5670_i2c_remove()