Lines Matching +full:mix +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * alc5623.c -- alc562[123] ALSA Soc Audio driver
8 * Copyright 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
53 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in amp_mixer_event()
55 /* to power-on/off class-d amp generators/speaker */ in amp_mixer_event()
56 /* need to write to 'index-46h' register : */ in amp_mixer_event()
77 static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
78 static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
79 static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
205 "RN/-R", "RP/+R", "LN/-R", "Vmid" };
207 "Vmid", "HP Left Mix"};
209 "Vmid", "HP Right Mix"};
211 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
213 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
264 SND_SOC_DAPM_MIXER("HP Mix", SND_SOC_NOPM, 0, 0,
267 SND_SOC_DAPM_MIXER("HPR Mix", ALC5623_PWR_MANAG_ADD2, 4, 0,
270 SND_SOC_DAPM_MIXER("HPL Mix", ALC5623_PWR_MANAG_ADD2, 5, 0,
273 SND_SOC_DAPM_MIXER("HPOut Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
274 SND_SOC_DAPM_MIXER("Mono Mix", ALC5623_PWR_MANAG_ADD2, 2, 0,
277 SND_SOC_DAPM_MIXER("Speaker Mix", ALC5623_PWR_MANAG_ADD2, 3, 0,
282 SND_SOC_DAPM_MIXER("Left Capture Mix", ALC5623_PWR_MANAG_ADD2, 1, 0,
285 SND_SOC_DAPM_MIXER("Right Capture Mix", ALC5623_PWR_MANAG_ADD2, 0, 0,
293 SND_SOC_DAPM_MIXER("I2S Mix", ALC5623_PWR_MANAG_ADD1, 15, 0, NULL, 0),
294 SND_SOC_DAPM_MIXER("AuxI Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
295 SND_SOC_DAPM_MIXER("Line Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
341 SND_SOC_DAPM_MUX("AB-D Amp Mux", SND_SOC_NOPM, 0, 0,
346 /* virtual mixer - mixes left & right channels */
347 {"I2S Mix", NULL, "Left DAC"},
348 {"I2S Mix", NULL, "Right DAC"},
349 {"Line Mix", NULL, "Right LineIn"},
350 {"Line Mix", NULL, "Left LineIn"},
351 {"AuxI Mix", NULL, "Left AuxI"},
352 {"AuxI Mix", NULL, "Right AuxI"},
357 {"HPL Mix", "ADC2HP_L Playback Switch", "Left Capture Mix"},
358 {"HPL Mix", NULL, "HP Mix"},
359 {"HPR Mix", "ADC2HP_R Playback Switch", "Right Capture Mix"},
360 {"HPR Mix", NULL, "HP Mix"},
361 {"HP Mix", "LI2HP Playback Switch", "Line Mix"},
362 {"HP Mix", "AUXI2HP Playback Switch", "AuxI Mix"},
363 {"HP Mix", "MIC12HP Playback Switch", "MIC1 PGA"},
364 {"HP Mix", "MIC22HP Playback Switch", "MIC2 PGA"},
365 {"HP Mix", "DAC2HP Playback Switch", "I2S Mix"},
368 {"Speaker Mix", "LI2SPK Playback Switch", "Line Mix"},
369 {"Speaker Mix", "AUXI2SPK Playback Switch", "AuxI Mix"},
370 {"Speaker Mix", "MIC12SPK Playback Switch", "MIC1 PGA"},
371 {"Speaker Mix", "MIC22SPK Playback Switch", "MIC2 PGA"},
372 {"Speaker Mix", "DAC2SPK Playback Switch", "I2S Mix"},
375 {"Mono Mix", "ADC2MONO_L Playback Switch", "Left Capture Mix"},
376 {"Mono Mix", "ADC2MONO_R Playback Switch", "Right Capture Mix"},
377 {"Mono Mix", "LI2MONO Playback Switch", "Line Mix"},
378 {"Mono Mix", "AUXI2MONO Playback Switch", "AuxI Mix"},
379 {"Mono Mix", "MIC12MONO Playback Switch", "MIC1 PGA"},
380 {"Mono Mix", "MIC22MONO Playback Switch", "MIC2 PGA"},
381 {"Mono Mix", "DAC2MONO Playback Switch", "I2S Mix"},
384 {"Left Capture Mix", "LineInL Capture Switch", "LINEINL"},
385 {"Left Capture Mix", "Left AuxI Capture Switch", "AUXINL"},
386 {"Left Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
387 {"Left Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
388 {"Left Capture Mix", "HPMixerL Capture Switch", "HPL Mix"},
389 {"Left Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
390 {"Left Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
393 {"Right Capture Mix", "LineInR Capture Switch", "LINEINR"},
394 {"Right Capture Mix", "Right AuxI Capture Switch", "AUXINR"},
395 {"Right Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
396 {"Right Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
397 {"Right Capture Mix", "HPMixerR Capture Switch", "HPR Mix"},
398 {"Right Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
399 {"Right Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
402 {"Left Headphone Mux", "HP Left Mix", "HPL Mix"},
406 {"Right Headphone Mux", "HP Right Mix", "HPR Mix"},
411 {"SpeakerOut Mux", "HPOut Mix", "HPOut Mix"},
412 {"SpeakerOut Mux", "Speaker Mix", "Speaker Mix"},
413 {"SpeakerOut Mux", "Mono Mix", "Mono Mix"},
417 {"AuxOut Mux", "HPOut Mix", "HPOut Mix"},
418 {"AuxOut Mux", "Speaker Mix", "Speaker Mix"},
419 {"AuxOut Mux", "Mono Mix", "Mono Mix"},
440 {"Left ADC", NULL, "Left Capture Mix"},
443 {"Right ADC", NULL, "Right Capture Mix"},
445 {"SpeakerOut N Mux", "RN/-R", "SpeakerOut"},
447 {"SpeakerOut N Mux", "LN/-R", "SpeakerOut"},
461 {"AB-D Amp Mux", "AB Amp", "AB Amp"},
462 {"AB-D Amp Mux", "D Amp", "D Amp"},
463 {"SpeakerOut", NULL, "AB-D Amp Mux"},
524 struct snd_soc_component *component = codec_dai->component; in alc5623_set_dai_pll()
529 return -ENODEV; in alc5623_set_dai_pll()
567 return -EINVAL; in alc5623_set_dai_pll()
571 return -EINVAL; in alc5623_set_dai_pll()
608 if (coeff_div[i].fs * rate == alc5623->sysclk) in get_coeff()
611 return -EINVAL; in get_coeff()
620 struct snd_soc_component *component = codec_dai->component; in alc5623_set_dai_sysclk()
632 alc5623->sysclk = freq; in alc5623_set_dai_sysclk()
635 return -EINVAL; in alc5623_set_dai_sysclk()
641 struct snd_soc_component *component = codec_dai->component; in alc5623_set_dai_fmt()
653 return -EINVAL; in alc5623_set_dai_fmt()
674 return -EINVAL; in alc5623_set_dai_fmt()
690 return -EINVAL; in alc5623_set_dai_fmt()
699 struct snd_soc_component *component = dai->component; in alc5623_pcm_hw_params()
722 return -EINVAL; in alc5623_pcm_hw_params()
730 return -EINVAL; in alc5623_pcm_hw_params()
733 dev_dbg(component->dev, "%s: sysclk=%d,rate=%d,coeff=0x%04x\n", in alc5623_pcm_hw_params()
734 __func__, alc5623->sysclk, rate, coeff); in alc5623_pcm_hw_params()
742 struct snd_soc_component *component = dai->component; in alc5623_mute()
786 if (alc5623->id == 0x22) in enable_power_depop()
840 .name = "alc5623-hifi",
865 regcache_cache_only(alc5623->regmap, true); in alc5623_suspend()
876 regcache_cache_only(alc5623->regmap, false); in alc5623_resume()
877 ret = regcache_sync(alc5623->regmap); in alc5623_resume()
879 dev_err(component->dev, "Failed to sync register cache: %d\n", in alc5623_resume()
881 regcache_cache_only(alc5623->regmap, true); in alc5623_resume()
895 if (alc5623->add_ctrl) { in alc5623_probe()
897 alc5623->add_ctrl); in alc5623_probe()
900 if (alc5623->jack_det_ctrl) { in alc5623_probe()
902 alc5623->jack_det_ctrl); in alc5623_probe()
905 switch (alc5623->id) { in alc5623_probe()
919 return -EINVAL; in alc5623_probe()
931 switch (alc5623->id) { in alc5623_probe()
944 return -EINVAL; in alc5623_probe()
994 alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), in alc5623_i2c_probe()
997 return -ENOMEM; in alc5623_i2c_probe()
999 alc5623->regmap = devm_regmap_init_i2c(client, &alc5623_regmap); in alc5623_i2c_probe()
1000 if (IS_ERR(alc5623->regmap)) { in alc5623_i2c_probe()
1001 ret = PTR_ERR(alc5623->regmap); in alc5623_i2c_probe()
1002 dev_err(&client->dev, "Failed to initialise I/O: %d\n", ret); in alc5623_i2c_probe()
1006 ret = regmap_read(alc5623->regmap, ALC5623_VENDOR_ID1, &vid1); in alc5623_i2c_probe()
1008 dev_err(&client->dev, "failed to read vendor ID1: %d\n", ret); in alc5623_i2c_probe()
1012 ret = regmap_read(alc5623->regmap, ALC5623_VENDOR_ID2, &vid2); in alc5623_i2c_probe()
1014 dev_err(&client->dev, "failed to read vendor ID2: %d\n", ret); in alc5623_i2c_probe()
1022 dev_err(&client->dev, "unknown or wrong codec\n"); in alc5623_i2c_probe()
1023 dev_err(&client->dev, "Expected %x:%x, got %x:%x\n", in alc5623_i2c_probe()
1026 return -ENODEV; in alc5623_i2c_probe()
1029 dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2); in alc5623_i2c_probe()
1031 pdata = client->dev.platform_data; in alc5623_i2c_probe()
1033 alc5623->add_ctrl = pdata->add_ctrl; in alc5623_i2c_probe()
1034 alc5623->jack_det_ctrl = pdata->jack_det_ctrl; in alc5623_i2c_probe()
1036 if (client->dev.of_node) { in alc5623_i2c_probe()
1037 np = client->dev.of_node; in alc5623_i2c_probe()
1038 ret = of_property_read_u32(np, "add-ctrl", &val32); in alc5623_i2c_probe()
1040 alc5623->add_ctrl = val32; in alc5623_i2c_probe()
1041 ret = of_property_read_u32(np, "jack-det-ctrl", &val32); in alc5623_i2c_probe()
1043 alc5623->jack_det_ctrl = val32; in alc5623_i2c_probe()
1047 alc5623->id = vid2; in alc5623_i2c_probe()
1048 switch (alc5623->id) { in alc5623_i2c_probe()
1050 alc5623_dai.name = "alc5621-hifi"; in alc5623_i2c_probe()
1053 alc5623_dai.name = "alc5622-hifi"; in alc5623_i2c_probe()
1056 alc5623_dai.name = "alc5623-hifi"; in alc5623_i2c_probe()
1059 return -EINVAL; in alc5623_i2c_probe()
1064 ret = devm_snd_soc_register_component(&client->dev, in alc5623_i2c_probe()
1067 dev_err(&client->dev, "Failed to register codec: %d\n", ret); in alc5623_i2c_probe()
1083 .name = "alc562x-codec",
1093 MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");