Lines Matching +full:left +full:-

1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8988.c -- WM8988 ALSA SoC audio driver
149 static const char *alc_func_txt[] = {"Off", "Right", "Left", "Stereo"};
167 static const DECLARE_TLV_DB_SCALE(pga_tlv, -1725, 75, 0);
168 static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
169 static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
170 static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
171 static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
180 SOC_ENUM("Treble Cut-off", treble),
184 SOC_ENUM("3D Lower Cut-off", stereo_3d_lc),
185 SOC_ENUM("3D Upper Cut-off", stereo_3d_uc),
208 SOC_ENUM("Playback De-emphasis", deemph),
216 SOC_SINGLE_TLV("Left Mixer Left Bypass Volume", WM8988_LOUTM1, 4, 7, 1,
218 SOC_SINGLE_TLV("Left Mixer Right Bypass Volume", WM8988_LOUTM2, 4, 7, 1,
220 SOC_SINGLE_TLV("Right Mixer Left Bypass Volume", WM8988_ROUTM1, 4, 7, 1,
244 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wm8988_lrc_control()
278 /* Left Mixer */
281 SOC_DAPM_SINGLE("Left Bypass Switch", WM8988_LOUTM1, 7, 1, 0),
288 SOC_DAPM_SINGLE("Left Playback Switch", WM8988_ROUTM1, 8, 1, 0),
289 SOC_DAPM_SINGLE("Left Bypass Switch", WM8988_ROUTM1, 7, 1, 0),
297 /* Left PGA Mux */
323 static const char *wm8988_mono_mux[] = {"Stereo", "Mono (Left)",
335 SND_SOC_DAPM_MUX("Left ADC Mux", SND_SOC_NOPM, 0, 0,
340 SND_SOC_DAPM_MUX("Left PGA Mux", WM8988_PWR1, 5, 0,
345 SND_SOC_DAPM_MUX("Left Line Mux", SND_SOC_NOPM, 0, 0,
351 SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8988_PWR1, 3, 0),
354 SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8988_PWR2, 8, 0),
356 SND_SOC_DAPM_MIXER("Left Mixer", SND_SOC_NOPM, 0, 0,
364 SND_SOC_DAPM_PGA("Left Out 2", WM8988_PWR2, 4, 0, NULL, 0),
366 SND_SOC_DAPM_PGA("Left Out 1", WM8988_PWR2, 6, 0, NULL, 0),
384 { "Left Line Mux", "Line 1", "LINPUT1" },
385 { "Left Line Mux", "Line 2", "LINPUT2" },
386 { "Left Line Mux", "PGA", "Left PGA Mux" },
387 { "Left Line Mux", "Differential", "Differential Mux" },
394 { "Left PGA Mux", "Line 1", "LINPUT1" },
395 { "Left PGA Mux", "Line 2", "LINPUT2" },
396 { "Left PGA Mux", "Differential", "Differential Mux" },
407 { "Left ADC Mux", "Stereo", "Left PGA Mux" },
408 { "Left ADC Mux", "Mono (Left)", "Left PGA Mux" },
409 { "Left ADC Mux", "Digital Mono", "Left PGA Mux" },
415 { "Left ADC", NULL, "Left ADC Mux" },
418 { "Left Line Mux", "Line 1", "LINPUT1" },
419 { "Left Line Mux", "Line 2", "LINPUT2" },
420 { "Left Line Mux", "PGA", "Left PGA Mux" },
421 { "Left Line Mux", "Differential", "Differential Mux" },
428 { "Left Mixer", "Playback Switch", "Left DAC" },
429 { "Left Mixer", "Left Bypass Switch", "Left Line Mux" },
430 { "Left Mixer", "Right Playback Switch", "Right DAC" },
431 { "Left Mixer", "Right Bypass Switch", "Right Line Mux" },
433 { "Right Mixer", "Left Playback Switch", "Left DAC" },
434 { "Right Mixer", "Left Bypass Switch", "Left Line Mux" },
438 { "Left Out 1", NULL, "Left Mixer" },
439 { "LOUT1", NULL, "Left Out 1" },
443 { "Left Out 2", NULL, "Left Mixer" },
444 { "LOUT2", NULL, "Left Out 2" },
516 return -EINVAL; in get_coeff()
555 struct snd_soc_component *component = codec_dai->component; in wm8988_set_dai_sysclk()
563 wm8988->sysclk_constraints = &constraints_112896; in wm8988_set_dai_sysclk()
564 wm8988->sysclk = freq; in wm8988_set_dai_sysclk()
571 wm8988->sysclk_constraints = &constraints_12288; in wm8988_set_dai_sysclk()
572 wm8988->sysclk = freq; in wm8988_set_dai_sysclk()
577 wm8988->sysclk_constraints = &constraints_12; in wm8988_set_dai_sysclk()
578 wm8988->sysclk = freq; in wm8988_set_dai_sysclk()
581 return -EINVAL; in wm8988_set_dai_sysclk()
587 struct snd_soc_component *component = codec_dai->component; in wm8988_set_dai_fmt()
598 return -EINVAL; in wm8988_set_dai_fmt()
618 return -EINVAL; in wm8988_set_dai_fmt()
635 return -EINVAL; in wm8988_set_dai_fmt()
645 struct snd_soc_component *component = dai->component; in wm8988_pcm_startup()
649 * MCLK supplied to the CODEC - enforce this. in wm8988_pcm_startup()
651 if (!wm8988->sysclk) { in wm8988_pcm_startup()
652 dev_err(component->dev, in wm8988_pcm_startup()
654 return -EINVAL; in wm8988_pcm_startup()
657 snd_pcm_hw_constraint_list(substream->runtime, 0, in wm8988_pcm_startup()
659 wm8988->sysclk_constraints); in wm8988_pcm_startup()
668 struct snd_soc_component *component = dai->component; in wm8988_pcm_hw_params()
674 coeff = get_coeff(wm8988->sysclk, params_rate(params)); in wm8988_pcm_hw_params()
676 coeff = get_coeff(wm8988->sysclk / 2, params_rate(params)); in wm8988_pcm_hw_params()
680 dev_err(component->dev, in wm8988_pcm_hw_params()
682 params_rate(params), wm8988->sysclk); in wm8988_pcm_hw_params()
712 struct snd_soc_component *component = dai->component; in wm8988_mute()
739 regcache_sync(wm8988->regmap); in wm8988_set_bias_level()
774 .name = "wm8988-hifi",
799 dev_err(component->dev, "Failed to issue reset\n"); in wm8988_probe()
803 /* set the update bits (we always update left then right) */ in wm8988_probe()
846 wm8988 = devm_kzalloc(&spi->dev, sizeof(struct wm8988_priv), in wm8988_spi_probe()
849 return -ENOMEM; in wm8988_spi_probe()
851 wm8988->regmap = devm_regmap_init_spi(spi, &wm8988_regmap); in wm8988_spi_probe()
852 if (IS_ERR(wm8988->regmap)) { in wm8988_spi_probe()
853 ret = PTR_ERR(wm8988->regmap); in wm8988_spi_probe()
854 dev_err(&spi->dev, "Failed to init regmap: %d\n", ret); in wm8988_spi_probe()
860 ret = devm_snd_soc_register_component(&spi->dev, in wm8988_spi_probe()
879 wm8988 = devm_kzalloc(&i2c->dev, sizeof(struct wm8988_priv), in wm8988_i2c_probe()
882 return -ENOMEM; in wm8988_i2c_probe()
886 wm8988->regmap = devm_regmap_init_i2c(i2c, &wm8988_regmap); in wm8988_i2c_probe()
887 if (IS_ERR(wm8988->regmap)) { in wm8988_i2c_probe()
888 ret = PTR_ERR(wm8988->regmap); in wm8988_i2c_probe()
889 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); in wm8988_i2c_probe()
893 ret = devm_snd_soc_register_component(&i2c->dev, in wm8988_i2c_probe()