Lines Matching +full:clkout +full:- +full:fmt

1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8731.c -- WM8731 ALSA SoC Audio driver
6 * Copyright 2006-12 Wolfson Microelectronics, plc
76 if (wm8731->deemph) { in wm8731_set_deemph()
79 if (abs(wm8731_deemph[i] - wm8731->playback_fs) < in wm8731_set_deemph()
80 abs(wm8731_deemph[best] - wm8731->playback_fs)) in wm8731_set_deemph()
90 dev_dbg(component->dev, "Set deemphasis %d (%dHz)\n", in wm8731_set_deemph()
102 ucontrol->value.integer.value[0] = wm8731->deemph; in wm8731_get_deemph()
112 unsigned int deemph = ucontrol->value.integer.value[0]; in wm8731_put_deemph()
116 return -EINVAL; in wm8731_put_deemph()
118 mutex_lock(&wm8731->lock); in wm8731_put_deemph()
119 if (wm8731->deemph != deemph) { in wm8731_put_deemph()
120 wm8731->deemph = deemph; in wm8731_put_deemph()
126 mutex_unlock(&wm8731->lock); in wm8731_put_deemph()
131 static const DECLARE_TLV_DB_SCALE(in_tlv, -3450, 150, 0);
132 static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -1500, 300, 0);
133 static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
194 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in wm8731_check_osc()
197 return wm8731->sysclk_type == WM8731_SYSCLK_XTAL; in wm8731_check_osc()
317 struct snd_soc_component *component = dai->component; in wm8731_hw_params()
320 int i = get_coeff(wm8731->sysclk, params_rate(params)); in wm8731_hw_params()
324 wm8731->playback_fs = params_rate(params); in wm8731_hw_params()
351 struct snd_soc_component *component = dai->component; in wm8731_mute()
364 struct snd_soc_component *component = codec_dai->component; in wm8731_set_dai_sysclk()
371 if (wm8731->mclk && clk_set_rate(wm8731->mclk, freq)) in wm8731_set_dai_sysclk()
372 return -EINVAL; in wm8731_set_dai_sysclk()
373 wm8731->sysclk_type = clk_id; in wm8731_set_dai_sysclk()
376 return -EINVAL; in wm8731_set_dai_sysclk()
381 wm8731->constraints = NULL; in wm8731_set_dai_sysclk()
384 wm8731->constraints = &wm8731_constraints_12000000; in wm8731_set_dai_sysclk()
388 wm8731->constraints = &wm8731_constraints_12288000_18432000; in wm8731_set_dai_sysclk()
392 wm8731->constraints = &wm8731_constraints_11289600_16934400; in wm8731_set_dai_sysclk()
395 return -EINVAL; in wm8731_set_dai_sysclk()
398 wm8731->sysclk = freq; in wm8731_set_dai_sysclk()
407 unsigned int fmt) in wm8731_set_dai_fmt() argument
409 struct snd_soc_component *component = codec_dai->component; in wm8731_set_dai_fmt()
412 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in wm8731_set_dai_fmt()
419 return -EINVAL; in wm8731_set_dai_fmt()
423 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in wm8731_set_dai_fmt()
439 return -EINVAL; in wm8731_set_dai_fmt()
443 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { in wm8731_set_dai_fmt()
456 return -EINVAL; in wm8731_set_dai_fmt()
473 if (wm8731->mclk) { in wm8731_set_bias_level()
474 ret = clk_prepare_enable(wm8731->mclk); in wm8731_set_bias_level()
483 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), in wm8731_set_bias_level()
484 wm8731->supplies); in wm8731_set_bias_level()
488 regcache_sync(wm8731->regmap); in wm8731_set_bias_level()
491 /* Clear PWROFF, gate CLKOUT, everything else as-is */ in wm8731_set_bias_level()
496 if (wm8731->mclk) in wm8731_set_bias_level()
497 clk_disable_unprepare(wm8731->mclk); in wm8731_set_bias_level()
499 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), in wm8731_set_bias_level()
500 wm8731->supplies); in wm8731_set_bias_level()
501 regcache_mark_dirty(wm8731->regmap); in wm8731_set_bias_level()
510 struct wm8731_priv *wm8731 = snd_soc_component_get_drvdata(dai->component); in wm8731_startup()
512 if (wm8731->constraints) in wm8731_startup()
513 snd_pcm_hw_constraint_list(substream->runtime, 0, in wm8731_startup()
515 wm8731->constraints); in wm8731_startup()
535 .name = "wm8731-hifi",
570 wm8731->mclk = devm_clk_get(dev, "mclk"); in wm8731_init()
571 if (IS_ERR(wm8731->mclk)) { in wm8731_init()
572 ret = PTR_ERR(wm8731->mclk); in wm8731_init()
573 if (ret == -ENOENT) { in wm8731_init()
574 wm8731->mclk = NULL; in wm8731_init()
582 mutex_init(&wm8731->lock); in wm8731_init()
584 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++) in wm8731_init()
585 wm8731->supplies[i].supply = wm8731_supply_names[i]; in wm8731_init()
587 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(wm8731->supplies), in wm8731_init()
588 wm8731->supplies); in wm8731_init()
594 ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), in wm8731_init()
595 wm8731->supplies); in wm8731_init()
601 ret = wm8731_reset(wm8731->regmap); in wm8731_init()
608 regmap_write(wm8731->regmap, WM8731_PWR, 0x7f); in wm8731_init()
611 regmap_update_bits(wm8731->regmap, WM8731_LOUT1V, 0x100, 0); in wm8731_init()
612 regmap_update_bits(wm8731->regmap, WM8731_ROUT1V, 0x100, 0); in wm8731_init()
613 regmap_update_bits(wm8731->regmap, WM8731_LINVOL, 0x100, 0); in wm8731_init()
614 regmap_update_bits(wm8731->regmap, WM8731_RINVOL, 0x100, 0); in wm8731_init()
617 regmap_update_bits(wm8731->regmap, WM8731_APANA, 0x8, 0); in wm8731_init()
619 regcache_mark_dirty(wm8731->regmap); in wm8731_init()
632 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); in wm8731_init()