Lines Matching +full:bit +full:- +full:per +full:- +full:mux
1 // SPDX-License-Identifier: GPL-2.0
3 * ak4619.c -- Asahi Kasei ALSA SoC Audio driver
47 #define DAC_DEMP 0x13 /* DAC De-Emphasis Setting */
51 * Bit fields
55 #define PMAD2 BIT(5)
56 #define PMAD1 BIT(4)
57 #define PMDA2 BIT(2)
58 #define PMDA1 BIT(1)
59 #define RSTN BIT(0)
69 #define BCKP BIT(1)
81 #define SLOT BIT(4)
111 #define AD1MUTE_EN BIT(5)
112 #define AD2MUTE_EN BIT(6)
126 /* DAC De-Emphasis Setting */
145 #define DA1MUTE_EN BIT(4)
146 #define DA2MUTE_EN BIT(5)
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);
184 * min : 0xFE : -103.0 dB
187 static const DECLARE_TLV_DB_SCALE(adc_tlv, -10350, 50, 1);
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()
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"
349 SOC_DAPM_ENUM("Analog Input 1 Left MUX", ak4619_ad_1_left_in);
351 SOC_DAPM_ENUM("Analog Input 1 Right MUX", ak4619_ad_1_right_in);
353 SOC_DAPM_ENUM("Analog Input 2 Left MUX", ak4619_ad_2_left_in);
355 SOC_DAPM_ENUM("Analog Input 2 Right MUX", ak4619_ad_2_right_in);
357 /* DAC source mux */
366 SOC_DAPM_ENUM("DAC 1 Source MUX", ak4619_dac_1_in);
368 SOC_DAPM_ENUM("DAC 2 Source MUX", ak4619_dac_2_in);
410 SND_SOC_DAPM_MUX("Analog Input 1 Left MUX", SND_SOC_NOPM, 0, 0, &ak4619_ad_1_left_in_mux),
411 SND_SOC_DAPM_MUX("Analog Input 1 Right MUX", SND_SOC_NOPM, 0, 0, &ak4619_ad_1_right_in_mux),
412 SND_SOC_DAPM_MUX("Analog Input 2 Left MUX", SND_SOC_NOPM, 0, 0, &ak4619_ad_2_left_in_mux),
413 SND_SOC_DAPM_MUX("Analog Input 2 Right MUX", SND_SOC_NOPM, 0, 0, &ak4619_ad_2_right_in_mux),
416 SND_SOC_DAPM_MUX("DAC 1 Source MUX", SND_SOC_NOPM, 0, 0, &ak4619_dac_1_in_mux),
417 SND_SOC_DAPM_MUX("DAC 2 Source MUX", SND_SOC_NOPM, 0, 0, &ak4619_dac_2_in_mux),
430 {"DAC1", NULL, "DAC 1 Source MUX"},
431 {"DAC2", NULL, "DAC 2 Source MUX"},
433 {"DAC 1 Source MUX", "SDIN1", "SDIN1"},
434 {"DAC 1 Source MUX", "SDIN2", "SDIN2"},
435 {"DAC 1 Source MUX", "SDOUT1", "SDOUT1"},
436 {"DAC 1 Source MUX", "SDOUT2", "SDOUT2"},
438 {"DAC 2 Source MUX", "SDIN1", "SDIN1"},
439 {"DAC 2 Source MUX", "SDIN2", "SDIN2"},
440 {"DAC 2 Source MUX", "SDOUT1", "SDOUT1"},
441 {"DAC 2 Source MUX", "SDOUT2", "SDOUT2"},
447 {"ADC1", NULL, "Analog Input 1 Left MUX"},
448 {"ADC1", NULL, "Analog Input 1 Right MUX"},
450 {"ADC2", NULL, "Analog Input 2 Left MUX"},
451 {"ADC2", NULL, "Analog Input 2 Right MUX"},
453 {"Analog Input 1 Left MUX", "Differential", "MIC1L"},
454 {"Analog Input 1 Left MUX", "Single-Ended1", "MIC1L"},
455 {"Analog Input 1 Left MUX", "Single-Ended2", "MIC1L"},
456 {"Analog Input 1 Left MUX", "Pseudo Differential", "MIC1L"},
458 {"Analog Input 1 Right MUX", "Differential", "MIC1R"},
459 {"Analog Input 1 Right MUX", "Single-Ended1", "MIC1R"},
460 {"Analog Input 1 Right MUX", "Single-Ended2", "MIC1R"},
461 {"Analog Input 1 Right MUX", "Pseudo Differential", "MIC1R"},
463 {"Analog Input 2 Left MUX", "Differential", "MIC2L"},
464 {"Analog Input 2 Left MUX", "Single-Ended1", "MIC2L"},
465 {"Analog Input 2 Left MUX", "Single-Ended2", "MIC2L"},
466 {"Analog Input 2 Left MUX", "Pseudo Differential", "MIC2L"},
468 {"Analog Input 2 Right MUX", "Differential", "MIC2R"},
469 {"Analog Input 2 Right MUX", "Single-Ended1", "MIC2R"},
470 {"Analog Input 2 Right MUX", "Single-Ended2", "MIC2R"},
471 {"Analog Input 2 Right MUX", "Pseudo Differential", "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()
674 /* By default only 64 BICK per LRCLK is supported */ 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()
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",