Lines Matching +full:0 +full:x2d
48 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
49 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9550, 50, 0);
50 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_analog_pga_tlv, 0, 300, 0);
51 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_pga_tlv, 0, 600, 0);
52 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(softramp_rate, 0, 100, 0);
53 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(drc_target_tlv, -3200, 200, 0);
54 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(drc_recovery_tlv, -125, 250, 0);
86 SOC_SINGLE_TLV("DAC Playback Volume", ES8326_DAC_VOL, 0, 0xbf, 0, dac_vol_tlv),
88 SOC_SINGLE_TLV("DAC Ramp Rate", ES8326_DAC_RAMPRATE, 0, 0x0f, 0, softramp_rate),
89 SOC_SINGLE_TLV("DRC Recovery Level", ES8326_DRC_RECOVERY, 0, 4, 0, drc_recovery_tlv),
91 SOC_SINGLE_TLV("DRC Target Level", ES8326_DRC_WINSIZE, 0, 0x0f, 0, drc_target_tlv),
93 SOC_DOUBLE_R_TLV("ADC Capture Volume", ES8326_ADC1_VOL, ES8326_ADC2_VOL, 0, 0xff, 0,
95 SOC_DOUBLE_TLV("ADC PGA Volume", ES8326_ADC_SCALE, 4, 0, 5, 0, adc_pga_tlv),
96 SOC_SINGLE_TLV("ADC PGA Gain Volume", ES8326_PGAGAIN, 0, 10, 0, adc_analog_pga_tlv),
97 SOC_SINGLE_TLV("ADC Ramp Rate", ES8326_ADC_RAMPRATE, 0, 0x0f, 0, softramp_rate),
98 SOC_SINGLE("ALC Capture Switch", ES8326_ALC_RECOVERY, 3, 1, 0),
100 0, 4, 0, drc_recovery_tlv),
103 0, 0x0f, 0, drc_target_tlv),
113 SND_SOC_DAPM_ADC("ADC L", NULL, SND_SOC_NOPM, 0, 0),
114 SND_SOC_DAPM_ADC("ADC R", NULL, SND_SOC_NOPM, 0, 0),
117 SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture", 0, SND_SOC_NOPM, 0, 0),
118 SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0, SND_SOC_NOPM, 0, 0),
121 SND_SOC_DAPM_PGA("ADC L1", ES8326_ADC_MUTE, 0, 1, NULL, 0),
122 SND_SOC_DAPM_PGA("ADC R1", ES8326_ADC_MUTE, 1, 1, NULL, 0),
123 SND_SOC_DAPM_PGA("ADC L2", ES8326_ADC_MUTE, 2, 1, NULL, 0),
124 SND_SOC_DAPM_PGA("ADC R2", ES8326_ADC_MUTE, 3, 1, NULL, 0),
127 SND_SOC_DAPM_DAC("Right DAC", NULL, ES8326_ANA_PDN, 0, 1),
129 SND_SOC_DAPM_SUPPLY("MICBIAS1", ES8326_ANA_MICBIAS, 2, 0, NULL, 0),
130 SND_SOC_DAPM_SUPPLY("MICBIAS2", ES8326_ANA_MICBIAS, 3, 0, NULL, 0),
132 SND_SOC_DAPM_PGA("LHPMIX", ES8326_DAC2HPMIX, 7, 0, NULL, 0),
133 SND_SOC_DAPM_PGA("RHPMIX", ES8326_DAC2HPMIX, 3, 0, NULL, 0),
180 .max_register = 0xff,
202 {32, 8000, 256000, 0x60, 0x00, 0x0F, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
203 {32, 16000, 512000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
204 {32, 44100, 1411200, 0x00, 0x00, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
205 {32, 48000, 1536000, 0x00, 0x00, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
206 {36, 8000, 288000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x23, 0x47},
207 {36, 16000, 576000, 0x20, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x23, 0x47},
208 {48, 8000, 384000, 0x60, 0x02, 0x1F, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
209 {48, 16000, 768000, 0x20, 0x02, 0x0F, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
210 {48, 48000, 2304000, 0x00, 0x02, 0x0D, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
211 {64, 8000, 512000, 0x60, 0x00, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
212 {64, 16000, 1024000, 0x20, 0x00, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
214 {64, 44100, 2822400, 0x00, 0x00, 0x11, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
215 {64, 48000, 3072000, 0x00, 0x00, 0x11, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
216 {72, 8000, 576000, 0x20, 0x00, 0x13, 0x35, 0x0A, 0x1B, 0x23, 0x47},
217 {72, 16000, 1152000, 0x20, 0x00, 0x05, 0x75, 0x0A, 0x1B, 0x23, 0x47},
218 {96, 8000, 768000, 0x60, 0x02, 0x1D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
219 {96, 16000, 1536000, 0x20, 0x02, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
220 {100, 48000, 4800000, 0x04, 0x04, 0x3F, 0x6D, 0x38, 0x08, 0x4f, 0x1f},
221 {125, 48000, 6000000, 0x04, 0x04, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
222 {128, 8000, 1024000, 0x60, 0x00, 0x13, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
223 {128, 16000, 2048000, 0x20, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
225 {128, 44100, 5644800, 0x00, 0x00, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
226 {128, 48000, 6144000, 0x00, 0x00, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
227 {144, 8000, 1152000, 0x20, 0x00, 0x03, 0x35, 0x0A, 0x1B, 0x23, 0x47},
228 {144, 16000, 2304000, 0x20, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x23, 0x47},
229 {192, 8000, 1536000, 0x60, 0x02, 0x0D, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
230 {192, 16000, 3072000, 0x20, 0x02, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x3F},
231 {200, 48000, 9600000, 0x04, 0x04, 0x0F, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
232 {250, 48000, 12000000, 0x04, 0x04, 0x0F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
233 {256, 8000, 2048000, 0x60, 0x00, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
234 {256, 16000, 4096000, 0x20, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
236 {256, 44100, 11289600, 0x00, 0x00, 0x10, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
237 {256, 48000, 12288000, 0x00, 0x00, 0x30, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
238 {288, 8000, 2304000, 0x20, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x23, 0x47},
239 {384, 8000, 3072000, 0x60, 0x02, 0x05, 0x75, 0x0A, 0x1B, 0x1F, 0x7F},
240 {384, 16000, 6144000, 0x20, 0x02, 0x03, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
241 {384, 48000, 18432000, 0x00, 0x02, 0x01, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
242 {400, 48000, 19200000, 0x09, 0x04, 0x0f, 0x6d, 0x3a, 0x0A, 0x4F, 0x1F},
243 {500, 48000, 24000000, 0x18, 0x04, 0x1F, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
244 {512, 8000, 4096000, 0x60, 0x00, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
245 {512, 16000, 8192000, 0x20, 0x00, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
247 {512, 44100, 22579200, 0x00, 0x00, 0x00, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
248 {512, 48000, 24576000, 0x00, 0x00, 0x00, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
249 {768, 8000, 6144000, 0x60, 0x02, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
250 {768, 16000, 12288000, 0x20, 0x02, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
251 {800, 48000, 38400000, 0x00, 0x18, 0x13, 0x2D, 0x0A, 0x0A, 0x1F, 0x1F},
252 {1024, 8000, 8192000, 0x60, 0x00, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
253 {1024, 16000, 16384000, 0x20, 0x00, 0x00, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
254 {1152, 16000, 18432000, 0x20, 0x08, 0x11, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
255 {1536, 8000, 12288000, 0x60, 0x02, 0x01, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
257 {1536, 16000, 24576000, 0x20, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x3F},
258 {1625, 8000, 13000000, 0x0C, 0x18, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
259 {1625, 16000, 26000000, 0x0C, 0x18, 0x1F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
260 {2048, 8000, 16384000, 0x60, 0x00, 0x00, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
261 {2304, 8000, 18432000, 0x40, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x5F},
262 {3072, 8000, 24576000, 0x60, 0x02, 0x10, 0x35, 0x0A, 0x1B, 0x1F, 0x7F},
263 {3250, 8000, 26000000, 0x0C, 0x18, 0x0F, 0x2D, 0x0A, 0x0A, 0x27, 0x27},
271 for (i = 0; i < ARRAY_SIZE(coeff_div); i++) { in get_coeff()
287 return 0; in es8326_set_dai_sysclk()
293 u8 iface = 0; in es8326_set_dai_fmt()
328 return 0; in es8326_set_dai_fmt()
337 u8 srate = 0; in es8326_pcm_hw_params()
365 if (coeff >= 0) { in es8326_pcm_hw_params()
386 return 0; in es8326_pcm_hw_params()
399 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xf0); in es8326_mute()
407 regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c); in es8326_mute()
412 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa0); in es8326_mute()
413 regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80); in es8326_mute()
418 return 0; in es8326_mute()
433 regmap_write(es8326->regmap, ES8326_RESET, 0x9f); in es8326_set_bias_level()
435 regmap_update_bits(es8326->regmap, ES8326_DAC_DSM, 0x01, 0x00); in es8326_set_bias_level()
439 regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E); in es8326_set_bias_level()
440 regmap_write(es8326->regmap, ES8326_PGA_PDN, 0x40); in es8326_set_bias_level()
441 regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x00); in es8326_set_bias_level()
442 regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x20); in es8326_set_bias_level()
451 regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b); in es8326_set_bias_level()
452 regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x00); in es8326_set_bias_level()
453 regmap_update_bits(es8326->regmap, ES8326_CLK_CTL, 0x20, 0x00); in es8326_set_bias_level()
458 return 0; in es8326_set_bias_level()
535 case 0x93: in es8326_jack_button_handler()
539 case 0x6f: in es8326_jack_button_handler()
540 case 0x4b: in es8326_jack_button_handler()
544 case 0x27: in es8326_jack_button_handler()
548 case 0x1e: in es8326_jack_button_handler()
549 case 0xe2: in es8326_jack_button_handler()
551 cur_button = 0; in es8326_jack_button_handler()
557 if ((prev_button == cur_button) && (cur_button != 0)) { in es8326_jack_button_handler()
563 press_count = 0; in es8326_jack_button_handler()
575 if (button_to_report != 0) { in es8326_jack_button_handler()
578 snd_soc_jack_report(es8326->jack, 0, in es8326_jack_button_handler()
580 button_to_report = 0; in es8326_jack_button_handler()
601 es8326->jack_remove_retry = 0; in es8326_jack_detect_handler()
614 if ((iface & ES8326_HPINSERT_FLAG) == 0) { in es8326_jack_detect_handler()
620 snd_soc_jack_report(es8326->jack, 0, SND_JACK_HEADSET); in es8326_jack_detect_handler()
622 regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33); in es8326_jack_detect_handler()
623 regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x44); in es8326_jack_detect_handler()
624 regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x66); in es8326_jack_detect_handler()
625 es8326->hp = 0; in es8326_jack_detect_handler()
627 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); in es8326_jack_detect_handler()
631 if (es8326->jack_remove_retry == 0) { in es8326_jack_detect_handler()
640 es8326->jack_remove_retry = 0; in es8326_jack_detect_handler()
643 es8326->jack_remove_retry = 0; in es8326_jack_detect_handler()
644 if (es8326->hp == 0) { in es8326_jack_detect_handler()
650 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01); in es8326_jack_detect_handler()
652 regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00); in es8326_jack_detect_handler()
664 if ((iface & ES8326_HPBUTTON_FLAG) == 0x01) { in es8326_jack_detect_handler()
673 regmap_write(es8326->regmap, ES8326_ADC_SCALE, 0x33); in es8326_jack_detect_handler()
675 0x08, 0x08); in es8326_jack_detect_handler()
677 0x80, 0x80); in es8326_jack_detect_handler()
678 regmap_write(es8326->regmap, ES8326_ADC1_SRC, 0x00); in es8326_jack_detect_handler()
679 regmap_write(es8326->regmap, ES8326_ADC2_SRC, 0x00); in es8326_jack_detect_handler()
681 0x08, 0x00); in es8326_jack_detect_handler()
721 regmap_write(es8326->regmap, ES8326_CLK_INV, 0xc0); in es8326_calibrate()
722 regmap_write(es8326->regmap, ES8326_CLK_DIV1, 0x01); in es8326_calibrate()
723 regmap_write(es8326->regmap, ES8326_CLK_DLL, 0x30); in es8326_calibrate()
724 regmap_write(es8326->regmap, ES8326_CLK_MUX, 0xed); in es8326_calibrate()
725 regmap_write(es8326->regmap, ES8326_CLK_TRI, 0xc1); in es8326_calibrate()
726 regmap_write(es8326->regmap, ES8326_DAC_MUTE, 0x03); in es8326_calibrate()
727 regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7f); in es8326_calibrate()
728 regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x33); in es8326_calibrate()
729 regmap_write(es8326->regmap, ES8326_DAC2HPMIX, 0x88); in es8326_calibrate()
730 regmap_write(es8326->regmap, ES8326_HP_VOL, 0x80); in es8326_calibrate()
731 regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c); in es8326_calibrate()
732 regmap_write(es8326->regmap, ES8326_RESET, 0xc0); in es8326_calibrate()
737 if ((reg & 0xf0) != 0x40) in es8326_calibrate()
740 regmap_write(es8326->regmap, ES8326_HP_CAL, 0xd4); in es8326_calibrate()
742 regmap_write(es8326->regmap, ES8326_HP_CAL, 0x4d); in es8326_calibrate()
747 regmap_write(es8326->regmap, ES8326_HP_OFFSET_CAL, 0x8c); in es8326_calibrate()
750 regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00); in es8326_calibrate()
755 return 0; in es8326_calibrate()
766 regmap_write(es8326->regmap, ES8326_RESET, 0x1f); in es8326_resume()
767 regmap_write(es8326->regmap, ES8326_VMIDSEL, 0x0E); in es8326_resume()
769 regmap_write(es8326->regmap, ES8326_HPJACK_TIMER, 0x88); in es8326_resume()
771 regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x81); in es8326_resume()
772 regmap_write(es8326->regmap, ES8326_CLK_RESAMPLE, 0x05); in es8326_resume()
775 regmap_write(es8326->regmap, ES8326_CLK_DIV_CPC, 0x84); in es8326_resume()
778 regmap_write(es8326->regmap, ES8326_RESET, 0x17); in es8326_resume()
780 regmap_write(es8326->regmap, ES8326_HP_MISC, 0x08); in es8326_resume()
781 regmap_write(es8326->regmap, ES8326_PULLUP_CTL, 0x00); in es8326_resume()
784 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa7); in es8326_resume()
786 regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xab); in es8326_resume()
788 regmap_write(es8326->regmap, ES8326_HP_DRIVER_REF, 0xbb); in es8326_resume()
790 regmap_write(es8326->regmap, ES8326_HP_DRIVER, 0xa1); in es8326_resume()
792 regmap_write(es8326->regmap, ES8326_CLK_INV, 0x00); in es8326_resume()
793 regmap_write(es8326->regmap, ES8326_CLK_VMIDS1, 0xc4); in es8326_resume()
794 regmap_write(es8326->regmap, ES8326_CLK_VMIDS2, 0x81); in es8326_resume()
795 regmap_write(es8326->regmap, ES8326_CLK_CAL_TIME, 0x00); in es8326_resume()
799 regmap_write(es8326->regmap, ES8326_HP_CAL, 0x00); in es8326_resume()
801 regmap_write(es8326->regmap, ES8326_ANA_LP, 0xf0); in es8326_resume()
804 regmap_write(es8326->regmap, ES8326_ANA_MICBIAS, 0x4f); in es8326_resume()
805 regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x08); in es8326_resume()
806 regmap_write(es8326->regmap, ES8326_ANA_VSEL, 0x7F); in es8326_resume()
808 regmap_write(es8326->regmap, ES8326_VMIDLOW, 0x23); in es8326_resume()
810 regmap_write(es8326->regmap, ES8326_DAC_DSM, 0x08); in es8326_resume()
811 regmap_write(es8326->regmap, ES8326_DAC_VPPSCALE, 0x15); in es8326_resume()
821 regmap_write(es8326->regmap, ES8326_ANA_PDN, 0x3b); in es8326_resume()
829 regmap_write(es8326->regmap, ES8326_HPDET_TYPE, 0x80 | in es8326_resume()
832 (ES8326_HP_DET_SRC_PIN9 | es8326->jack_pol | 0x04))); in es8326_resume()
834 es8326->jack_remove_retry = 0; in es8326_resume()
835 es8326->hp = 0; in es8326_resume()
836 return 0; in es8326_resume()
851 regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x01); in es8326_suspend()
853 regmap_write(es8326->regmap, ES8326_CSM_I2C_STA, 0x00); in es8326_suspend()
854 return 0; in es8326_suspend()
867 if (ret != 0) { in es8326_probe()
874 if (ret != 0) { in es8326_probe()
881 if (ret != 0) { in es8326_probe()
889 if (ret != 0) { in es8326_probe()
897 if (ret != 0) { in es8326_probe()
899 es8326->interrupt_clk = 0x45; in es8326_probe()
904 return 0; in es8326_probe()
934 snd_soc_jack_report(es8326->jack, 0, SND_JACK_HEADSET); in es8326_disable_jack_detect()
948 return 0; in es8326_set_jack()
1027 {"es8326", 0 },
1042 {"ESSX8326", 0},