Lines Matching +full:mic +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8940.c -- WM8940 ALSA Soc Audio driver
155 static const char *wm8940_companding[] = { "Off", "NC", "u-law", "A-law" };
173 static DECLARE_TLV_DB_SCALE(wm8940_spk_vol_tlv, -5700, 100, 1);
174 static DECLARE_TLV_DB_SCALE(wm8940_att_tlv, -1000, 1000, 0);
175 static DECLARE_TLV_DB_SCALE(wm8940_pga_vol_tlv, -1200, 75, 0);
176 static DECLARE_TLV_DB_SCALE(wm8940_alc_min_tlv, -1200, 600, 0);
178 static DECLARE_TLV_DB_SCALE(wm8940_alc_tar_tlv, -2250, 50, 0);
180 static DECLARE_TLV_DB_SCALE(wm8940_lim_thresh_tlv, -600, 100, 0);
181 static DECLARE_TLV_DB_SCALE(wm8940_adc_tlv, -12750, 50, 1);
222 SOC_ENUM("Mic Bias Level", wm8940_mic_bias_level_enum),
258 static DECLARE_TLV_DB_SCALE(wm8940_boost_vol_tlv, -1500, 300, 1);
260 SOC_DAPM_SINGLE("Mic PGA Switch", WM8940_PGAGAIN, 6, 1, 1),
263 SOC_DAPM_SINGLE_TLV("Mic Volume", WM8940_ADCBOOST,
291 SND_SOC_DAPM_MIXER("Mic PGA", WM8940_POWER2, 2, 0,
297 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8940_POWER1, 4, 0),
324 {"Mic PGA", "MICN Switch", "MICN"},
325 {"Mic PGA", "MICP Switch", "MICP"},
326 {"Mic PGA", "AUX Switch", "AUX"},
329 {"Boost Mixer", "Mic PGA Switch", "Mic PGA"},
330 {"Boost Mixer", "Mic Volume", "MICP"},
341 struct snd_soc_component *component = codec_dai->component; in wm8940_set_dai_fmt()
352 return -EINVAL; in wm8940_set_dai_fmt()
397 struct snd_soc_component *component = dai->component; in wm8940_i2s_hw_params()
405 priv->fs = params_rate(params); in wm8940_i2s_hw_params()
411 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE in wm8940_i2s_hw_params()
466 struct snd_soc_component *component = dai->component; in wm8940_mute()
502 ret = regcache_sync(wm8940->regmap); in wm8940_set_bias_level()
504 dev_err(component->dev, "Failed to sync cache: %d\n", ret); in wm8940_set_bias_level()
585 struct snd_soc_component *component = codec_dai->component; in wm8940_set_dai_pll()
626 struct snd_soc_component *component = codec_dai->component; in wm8940_set_dai_clkdiv()
681 struct snd_soc_component *codec = dai->component; in wm8940_update_clocks()
688 if (!priv->mclk || !priv->fs) in wm8940_update_clocks()
691 fs256 = 256 * priv->fs; in wm8940_update_clocks()
693 f = wm8940_get_mclkdiv(priv->mclk, fs256, &mclkdiv); in wm8940_update_clocks()
694 if (f != priv->mclk) { in wm8940_update_clocks()
704 wm8940_set_dai_pll(dai, 0, 0, priv->mclk, fpll); in wm8940_update_clocks()
713 struct snd_soc_component *codec = dai->component; in wm8940_set_dai_sysclk()
717 return -EINVAL; in wm8940_set_dai_sysclk()
719 priv->mclk = freq; in wm8940_set_dai_sysclk()
743 .name = "wm8940-hifi",
764 struct wm8940_setup_data *pdata = component->dev->platform_data; in wm8940_probe()
769 * Check chip ID for wm8940 - value of 0x00 offset in wm8940_probe()
775 dev_err(component->dev, "Wrong wm8940 chip ID: 0x%x\n", reg); in wm8940_probe()
776 return -ENODEV; in wm8940_probe()
781 dev_err(component->dev, "Failed to issue reset\n"); in wm8940_probe()
793 ret = snd_soc_component_write(component, WM8940_OUTPUTCTL, reg | pdata->vroi); in wm8940_probe()
834 wm8940 = devm_kzalloc(&i2c->dev, sizeof(struct wm8940_priv), in wm8940_i2c_probe()
837 return -ENOMEM; in wm8940_i2c_probe()
839 wm8940->regmap = devm_regmap_init_i2c(i2c, &wm8940_regmap); in wm8940_i2c_probe()
840 if (IS_ERR(wm8940->regmap)) in wm8940_i2c_probe()
841 return PTR_ERR(wm8940->regmap); in wm8940_i2c_probe()
845 ret = devm_snd_soc_register_component(&i2c->dev, in wm8940_i2c_probe()