Lines Matching +full:warn +full:- +full:soc +full:- +full:level

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm8580.c -- WM8580 and WM8581 ALSA Soc Audio driver
5 * Copyright 2008-12 Wolfson Microelectronics PLC.
14 * Currently only the primary audio interface is supported - S/PDIF and
33 #include <sound/soc.h>
116 /* AIF control 1 (registers 9h-bh) */
127 /* AIF control 2 (registers ch-eh) */
254 static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
260 (struct soc_mixer_control *)kcontrol->private_value;
263 unsigned int reg = mc->reg;
264 unsigned int reg2 = mc->rreg;
268 regcache_cache_only(wm8580->regmap, true);
269 regmap_update_bits(wm8580->regmap, reg, 0x100, 0x000);
270 regmap_update_bits(wm8580->regmap, reg2, 0x100, 0x000);
271 regcache_cache_only(wm8580->regmap, false);
312 SOC_SINGLE("Capture High-Pass Filter Switch", WM8580_ADC_CONTROL1, 4, 1, 0),
407 pr_debug("wm8580: PLL %uHz->%uHz\n", source, target);
410 * region of 90-100MHz.
415 pll_div->freqmode = post_table[i].freqmode;
416 pll_div->postscale = post_table[i].postscale;
425 return -EINVAL;
432 pll_div->prescale = 1;
435 pll_div->prescale = 0;
440 return -EINVAL;
443 pll_div->n = Ndiv;
451 pll_div->k = K;
454 pll_div->n, pll_div->k, pll_div->prescale, pll_div->freqmode,
455 pll_div->postscale);
464 struct snd_soc_component *component = codec_dai->component;
479 state = &wm8580->a;
484 state = &wm8580->b;
489 return -ENODEV;
498 state->in = freq_in;
499 state->out = freq_out;
501 /* Always disable the PLL - it is not safe to leave it running
538 struct snd_soc_component *component = dai->component;
562 return -EINVAL;
566 ratio = wm8580->sysclk[dai->driver->id] / params_rate(params);
571 dev_err(component->dev, "Invalid clock ratio %d/%d\n",
572 wm8580->sysclk[dai->driver->id], params_rate(params));
573 return -EINVAL;
576 dev_dbg(component->dev, "Running at %dfs with %dHz clock\n",
577 wm8580_sysclk_ratios[i], wm8580->sysclk[dai->driver->id]);
579 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
584 dev_dbg(component->dev, "Selecting 64x OSR\n");
588 dev_dbg(component->dev, "Selecting 128x OSR\n");
595 snd_soc_component_update_bits(component, WM8580_PAIF1 + dai->driver->id,
598 snd_soc_component_update_bits(component, WM8580_PAIF3 + dai->driver->id,
606 struct snd_soc_component *component = codec_dai->component;
611 aifa = snd_soc_component_read(component, WM8580_PAIF1 + codec_dai->driver->id);
612 aifb = snd_soc_component_read(component, WM8580_PAIF3 + codec_dai->driver->id);
624 return -EINVAL;
650 return -EINVAL;
659 return -EINVAL;
670 return -EINVAL;
675 return -EINVAL;
678 snd_soc_component_write(component, WM8580_PAIF1 + codec_dai->driver->id, aifa);
679 snd_soc_component_write(component, WM8580_PAIF3 + codec_dai->driver->id, aifb);
687 struct snd_soc_component *component = codec_dai->component;
712 return -EINVAL;
738 return -EINVAL;
744 return -EINVAL;
753 struct snd_soc_component *component = dai->component;
757 switch (dai->driver->id) {
769 WARN(1, "Unknown DAI driver ID\n");
770 return -EINVAL;
775 if (dai->driver->id != WM8580_DAI_PAIFTX)
776 return -EINVAL;
789 dev_err(component->dev, "Unknown clock %d\n", clk_id);
790 return -EINVAL;
794 wm8580->sysclk[dai->driver->id] = freq;
805 struct snd_soc_component *component = codec_dai->component;
821 enum snd_soc_bias_level level)
823 switch (level) {
852 struct snd_soc_component *component = dai->component;
855 return snd_pcm_hw_constraint_minmax(substream->runtime,
856 SNDRV_PCM_HW_PARAM_CHANNELS, 1, wm8580->drvdata->num_dacs * 2);
883 .name = "wm8580-hifi-playback",
894 .name = "wm8580-hifi-capture",
913 switch (wm8580->drvdata->num_dacs) {
926 ret = regulator_bulk_enable(ARRAY_SIZE(wm8580->supplies),
927 wm8580->supplies);
929 dev_err(component->dev, "Failed to enable supplies: %d\n", ret);
936 dev_err(component->dev, "Failed to reset component: %d\n", ret);
943 regulator_bulk_disable(ARRAY_SIZE(wm8580->supplies), wm8580->supplies);
953 regulator_bulk_disable(ARRAY_SIZE(wm8580->supplies), wm8580->supplies);
996 wm8580 = devm_kzalloc(&i2c->dev, sizeof(struct wm8580_priv),
999 return -ENOMEM;
1001 wm8580->regmap = devm_regmap_init_i2c(i2c, &wm8580_regmap);
1002 if (IS_ERR(wm8580->regmap))
1003 return PTR_ERR(wm8580->regmap);
1005 for (i = 0; i < ARRAY_SIZE(wm8580->supplies); i++)
1006 wm8580->supplies[i].supply = wm8580_supply_names[i];
1008 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8580->supplies),
1009 wm8580->supplies);
1011 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
1017 wm8580->drvdata = i2c_get_match_data(i2c);
1018 if (!wm8580->drvdata)
1019 return dev_err_probe(&i2c->dev, -EINVAL, "failed to find driver data\n");
1021 ret = devm_snd_soc_register_component(&i2c->dev,