Lines Matching +full:adc +full:- +full:startup +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0
3 * ak4619.c -- Asahi Kasei ALSA SoC Audio driver
39 #define ADC_DF 0x0a /* ADC Digital Filter Setting */
40 #define ADC_AI 0x0b /* ADC Analog Input Setting */
41 #define ADC_MHPF 0x0D /* ADC Mute & HPF Control */
47 #define DAC_DEMP 0x13 /* DAC De-Emphasis Setting */
91 /* ADC Digital Volume */
95 /* ADC Digital Filter Setting */
105 /* ADC Mute & HPF Control */
126 /* DAC De-Emphasis Setting */
165 * min : 0xFE : -115.0 dB
168 static const DECLARE_TLV_DB_SCALE(dac_tlv, -11550, 50, 1);
175 * min: 0x00 : -6.0 dB
177 static const DECLARE_TLV_DB_SCALE(mic_tlv, -600, 300, 0);
180 * ADC Volume
184 * min : 0xFE : -103.0 dB
187 static const DECLARE_TLV_DB_SCALE(adc_tlv, -10350, 50, 1);
189 /* ADC & DAC Volume Level Transition Time select */
197 /* ADC Digital Filter select */
199 "Sharp Roll-Off Filter",
200 "Slow Roll-Off Filter",
201 "Short Delay Sharp Roll-Off Filter",
202 "Short Delay Slow Roll-Off Filter",
209 /* DAC De-Emphasis Filter select */
219 "Sharp Roll-Off Filter",
220 "Slow Roll-Off Filter",
221 "Short Delay Sharp Roll-Off Filter",
222 "Short Delay Slow Roll-Off Filter"
237 if (!ak4619->deemph_en) in ak4619_set_deemph()
240 switch (ak4619->playback_rate) { in ak4619_set_deemph()
262 int deemph_en = ucontrol->value.integer.value[0]; in ak4619_put_deemph()
270 return -EINVAL; in ak4619_put_deemph()
273 if (ak4619->deemph_en != deemph_en) in ak4619_put_deemph()
276 ak4619->deemph_en = deemph_en; in ak4619_put_deemph()
288 ucontrol->value.integer.value[0] = ak4619->deemph_en; in ak4619_get_deemph()
301 SOC_DOUBLE_R_TLV("ADC 1 Volume", LADC1, RADC1, VOLAD_SHIFT, VOLAD_MAX, 1, adc_tlv),
302 SOC_DOUBLE_R_TLV("ADC 2 Volume", LADC2, RADC2, VOLAD_SHIFT, VOLAD_MAX, 1, adc_tlv),
307 /* Volume Level Transition Time controls */
308 SOC_ENUM("ADC Volume Level Transition Time", ak4619_adc_vol_trans),
309 SOC_ENUM("DAC Volume Level Transition Time", ak4619_dac_vol_trans),
315 SOC_SINGLE("ADC 1 Switch", ADC_MHPF, AD1MUTE_SHIFT, AD1MUTE_MAX, 1),
316 SOC_SINGLE("ADC 2 Switch", ADC_MHPF, AD2MUTE_SHIFT, AD2MUTE_MAX, 1),
319 SOC_ENUM("ADC 1 Digital Filter", ak4619_adc_1_digi_fil),
320 SOC_ENUM("ADC 2 Digital Filter", ak4619_adc_2_digi_fil),
322 SOC_SINGLE("ADC 1 HPF", ADC_MHPF, AD1HPFN_SHIFT, AD1HPFN_MAX, 1),
323 SOC_SINGLE("ADC 2 HPF", ADC_MHPF, AD2HPFN_SHIFT, AD2HPFN_MAX, 1),
325 SOC_ENUM("DAC 1 De-Emphasis Filter", ak4619_dac_1_de_emp),
326 SOC_ENUM("DAC 2 De-Emphasis Filter", ak4619_dac_2_de_emp),
331 SOC_SINGLE_BOOL_EXT("Playback De-Emphasis Switch", 0, ak4619_get_deemph, ak4619_put_deemph),
340 "Differential", "Single-Ended1", "Single-Ended2", "Pseudo Differential"
454 {"Analog Input 1 Left MUX", "Single-Ended1", "MIC1L"},
455 {"Analog Input 1 Left MUX", "Single-Ended2", "MIC1L"},
459 {"Analog Input 1 Right MUX", "Single-Ended1", "MIC1R"},
460 {"Analog Input 1 Right MUX", "Single-Ended2", "MIC1R"},
464 {"Analog Input 2 Left MUX", "Single-Ended1", "MIC2L"},
465 {"Analog Input 2 Left MUX", "Single-Ended2", "MIC2L"},
469 {"Analog Input 2 Right MUX", "Single-Ended1", "MIC2R"},
470 {"Analog Input 2 Right MUX", "Single-Ended2", "MIC2R"},
536 struct snd_soc_component *component = dai->component; in ak4619_dai_hw_params()
541 bool is_play = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; in ak4619_dai_hw_params()
560 return -EINVAL; in ak4619_dai_hw_params()
563 return -EINVAL; in ak4619_dai_hw_params()
568 fs = ak4619->sysclk / rate; in ak4619_dai_hw_params()
570 return -EINVAL; in ak4619_dai_hw_params()
593 return -EINVAL; in ak4619_dai_hw_params()
602 return -EINVAL; in ak4619_dai_hw_params()
609 return -EINVAL; in ak4619_dai_hw_params()
612 return -EINVAL; in ak4619_dai_hw_params()
620 ak4619->playback_rate = rate; in ak4619_dai_hw_params()
629 struct snd_soc_component *component = dai->component; in ak4619_dai_set_fmt()
643 return -EINVAL; in ak4619_dai_set_fmt()
663 return -EINVAL; in ak4619_dai_set_fmt()
671 return -EINVAL; in ak4619_dai_set_fmt()
687 struct snd_soc_component *component = codec_dai->component; in ak4619_dai_set_sysclk()
690 ak4619->sysclk = freq; in ak4619_dai_set_sysclk()
697 struct snd_soc_component *component = dai->component; in ak4619_dai_mute()
708 struct snd_pcm_hw_constraint_list *constraint = &ak4619->constraint; in ak4619_hw_constraints()
730 * [8kHz - 48kHz] : 256fs, 384fs or 512fs in ak4619_hw_constraints()
731 * [64kHz - 96kHz] : 256fs in ak4619_hw_constraints()
736 fs = ak4619->sysclk / ak4619_sr[i]; in ak4619_hw_constraints()
746 case (ARRAY_SIZE(ak4619_sr) - 1): in ak4619_hw_constraints()
747 case (ARRAY_SIZE(ak4619_sr) - 2): in ak4619_hw_constraints()
759 constraint->list = ak4619_sr; in ak4619_hw_constraints()
760 constraint->mask = ak4619_rate_mask; in ak4619_hw_constraints()
761 constraint->count = ARRAY_SIZE(ak4619_sr); in ak4619_hw_constraints()
772 struct snd_soc_component *component = dai->component; in ak4619_dai_startup()
775 ak4619_hw_constraints(ak4619, substream->runtime); in ak4619_dai_startup()
797 .startup = ak4619_dai_startup,
828 { .compatible = "asahi-kasei,ak4619", .data = &ak4619_regmap_cfg },
851 .name = "ak4619-hifi",
872 struct device *dev = &i2c->dev; in ak4619_i2c_probe()
878 return -ENOMEM; in ak4619_i2c_probe()
882 ak4619->regmap = devm_regmap_init_i2c(i2c, &ak4619_regmap_cfg); in ak4619_i2c_probe()
883 if (IS_ERR(ak4619->regmap)) { in ak4619_i2c_probe()
884 ret = PTR_ERR(ak4619->regmap); in ak4619_i2c_probe()
902 .name = "ak4619-codec",